@g1cloud/entity-modeler-next 5.1.5 → 5.1.6
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/core/fkDerived.d.ts +50 -1
- package/dist/core/javaTypes.d.ts +3 -1
- package/dist/core/propagation.d.ts +6 -1
- package/dist/core/scaffoldJava.d.ts +51 -0
- package/dist/entity-modeler-next.css +1 -1
- package/dist/entity-modeler.js +12229 -11837
- package/dist/entity-modeler.umd.cjs +29 -29
- package/dist/i18n/ko.d.ts +10 -4
- package/dist/view/columnResolution.d.ts +30 -0
- package/dist/view/embedSlotCollapse.d.ts +9 -1
- package/dist/view/useAttributeEditing.d.ts +9 -1
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
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 _D=Object.defineProperty;var kD=(be,t,ee)=>t in be?_D(be,t,{enumerable:!0,configurable:!0,writable:!0,value:ee}):be[t]=ee;var nt=(be,t,ee)=>kD(be,typeof t!="symbol"?t+"":t,ee);const Bh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Dh(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={...Bh,...o},a=new Map(e.entities.map(_=>[_.modelId,_])),r=new Map(n.entityLayouts.map(_=>[_.entityRef,_])),l=new Map(n.associationLayouts.map(_=>[_.associationRef,_])),s=new Map;for(const _ of e.groups)for(const E of _.memberEntityRefs)s.set(E,_.modelId);const c=new Map;for(const _ of n.groupLayouts)for(const E of _.memberNoteRefs??[])c.set(E,_.groupRef);let d=0;const u=e.entities.map(_=>{const E=s.get(_.modelId),N=r.get(_.modelId);if(N){const b={location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}};return{entity:_,geo:b,collapsed:N.collapsed??!1,locked:N.locked??!1,groupRef:E,style:N.style,attributeStyles:N.attributeStyles,operationStyles:N.operationStyles}}const p=Dh(d++,i);return{entity:_,geo:p,collapsed:!1,locked:!1,groupRef:E}}),m=new Map(n.groupLayouts.map(_=>[_.groupRef,_])),h=e.groups.map(_=>{const E=m.get(_.modelId),N=E?{location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:_,geo:N,style:E==null?void 0:E.style,locked:(E==null?void 0:E.locked)??!1}}),f=e.associations.map(_=>{const E=l.get(_.modelId);return{association:_,waypoints:(E==null?void 0:E.waypoints)??[],sourceColumnRef:E==null?void 0:E.sourceColumnRef,targetColumnRef:E==null?void 0:E.targetColumnRef}}),y=n.notes.map(_=>({note:{..._,geo:{location:{x:_.geo.location.x,y:_.geo.location.y},size:{width:_.geo.size.width,height:_.geo.size.height}}},groupRef:c.get(_.modelId)})),k=[];for(const _ of n.notes)for(const E of _.connections??[])a.has(E.targetRef)&&k.push({noteRef:_.modelId,targetRef:E.targetRef,waypoints:E.waypoints.map(N=>({x:N.x,y:N.y}))});return{entities:u,associations:f,groups:h,notes:y,noteConnections:k}}const Oh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Bs(e,n,o={}){const i={...Oh,...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},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((k,_)=>{const E=_%y,N=Math.floor(_/y);r.push({id:k,location:{x:h.x+i.pad+E*i.cellWidth,y:h.y+i.pad+i.headerHeight+N*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,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+f*i.cellHeight}})}),r}const Ds={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Lh(e,n={}){const o={...Ds,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Nr(e,n={}){const o={...Ds,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Lh(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 On(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 Os(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 Pi="inherited:";function Ls(e,n){return`${Pi}${e}:${n}`}function Ln(e){return e.startsWith(Pi)}function wr(e){if(!Ln(e))return null;const n=e.slice(Pi.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 Go(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:Ls(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 Ph={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function Yo(e){return Ph[e]??e}function zi(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Fi(e,n,o,i,a=0){var u;if(!zi(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 f=h.attributes.find(y=>y.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,h)=>m.order-h.order).flatMap(m=>m.dbAttrs)[a]:void 0}function zh(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=Ps(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function nn(e,n){return Ps(e,n,new Set)}function Ps(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=zh(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const zs=e=>e==null||e.trim()==="";function Fs(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=nn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return Fi(e,o,i.entities,i.associations,n)}function on(e,n,o,i,a,r){const l=Fs(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:Fh(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function Fh(e){return e!=null&&Object.values(e).some(n=>!zs(n))}function qo(e,n,o,i,a,r){var l;return zs(n.physicalName)?((l=Fs(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Us(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 Ir(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 vn(e,n){return Ir(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function fo(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Pn(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 Ui(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 Hs="(미지정)",Uh="(이름 없음)",Hi=e=>e==null||String(e).trim()==="",ji=e=>Hi(e)?Uh:String(e),js=e=>Hi(e)?Hs:String(e);function Ks(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 Hs}function Gs(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Hi(n)?js(e.physicalName):String(n),a=Hi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function Ys(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function qs(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(`## ${ji(c.name)}${d} «${Yo(c.stereotype)}»${u?` [${u}]`:""}`);const m=fo(vn(c,e.entities)),h=_=>{var E;return _.sharedColumnRef?(E=Pn(_,m))==null?void 0:E.physicalName:void 0},f=[...c.attributes].sort((_,E)=>_.order-E.order);for(const _ of f){if(_.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${_.name?` ${_.name} ${"─".repeat(8)}`:""}`);continue}const E=_.dbAttrs.map(($,L)=>on(_,$,L,c,e,n)),N=[_.identifier?"PK":"",_.notNull?"NOT NULL":""].filter(Boolean),p=` - ${ji(_.name)}: ${js(_.type)}`,b=$=>$.length?` {${$.join(", ")}}`:"";if(E.length>1){a.push(`${p}${b(N)}`),E.forEach(($,L)=>{const T=Us(_,L,e,n);a.push(` · ${T?`${T} → `:""}${Gs($,h($))}${b(Ys($))}`)});continue}const w=E[0],A=w?` → ${Gs(w,h(w))}`:"";a.push(`${p}${A}${b([...N,...w?Ys(w):[]])}`)}const y=On(c.attributes);for(const _ of c.indexes??[]){const E=_.columns.map(N=>{var p,b;return`${((p=y.attributeOf(N.columnRef))==null?void 0:p.name)??((b=wr(N.columnRef))==null?void 0:b.field)??N.columnRef}${N.descending?" DESC":""}`}).join(", ");a.push(` index ${ji(_.name)}${_.unique?" UNIQUE":""}: ${E}`)}const k=[...c.operations??[]].sort((_,E)=>_.order-E.order);for(const _ of k){const E=_.visibility?` {${_.visibility}}`:"",N=(s=_.description)!=null&&s.ko?` — ${_.description.ko}`:"";a.push(` method ${ji(_.name)}()${E}${N}`)}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} ${Ks(c.end1.multiplicity)} —— ${Ks(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
-
`).trim()}function
|
|
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
|
|
1
|
+
(function(Ne,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):(Ne=typeof globalThis<"u"?globalThis:Ne||self,t(Ne.EntityModeler={},Ne.Vue,Ne.OpenBlueseaCore))})(this,(function(Ne,t,te){"use strict";var KD=Object.defineProperty;var GD=(Ne,t,te)=>t in Ne?KD(Ne,t,{enumerable:!0,configurable:!0,writable:!0,value:te}):Ne[t]=te;var ct=(Ne,t,te)=>GD(Ne,typeof t!="symbol"?t+"":t,te);const zh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Fh(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 Ys(e,n,o={}){const i={...zh,...o},a=new Map(e.entities.map(g=>[g.modelId,g])),r=new Map(n.entityLayouts.map(g=>[g.entityRef,g])),l=new Map(n.associationLayouts.map(g=>[g.associationRef,g])),s=new Map;for(const g of e.groups)for(const b of g.memberEntityRefs)s.set(b,g.modelId);const c=new Map;for(const g of n.groupLayouts)for(const b of g.memberNoteRefs??[])c.set(b,g.groupRef);let d=0;const u=e.entities.map(g=>{const b=s.get(g.modelId),E=r.get(g.modelId);if(E){const N={location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}};return{entity:g,geo:N,collapsed:E.collapsed??!1,locked:E.locked??!1,groupRef:b,style:E.style,attributeStyles:E.attributeStyles,operationStyles:E.operationStyles}}const h=Fh(d++,i);return{entity:g,geo:h,collapsed:!1,locked:!1,groupRef:b}}),m=new Map(n.groupLayouts.map(g=>[g.groupRef,g])),p=e.groups.map(g=>{const b=m.get(g.modelId),E=b?{location:{x:b.geo.location.x,y:b.geo.location.y},size:{width:b.geo.size.width,height:b.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:E,style:b==null?void 0:b.style,locked:(b==null?void 0:b.locked)??!1}}),f=e.associations.map(g=>{const b=l.get(g.modelId);return{association:g,waypoints:(b==null?void 0:b.waypoints)??[],sourceColumnRef:b==null?void 0:b.sourceColumnRef,targetColumnRef:b==null?void 0:b.targetColumnRef}}),y=n.notes.map(g=>({note:{...g,geo:{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}},groupRef:c.get(g.modelId)})),_=[];for(const g of n.notes)for(const b of g.connections??[])a.has(b.targetRef)&&_.push({noteRef:g.modelId,targetRef:b.targetRef,waypoints:b.waypoints.map(E=>({x:E.x,y:E.y}))});return{entities:u,associations:f,groups:p,notes:y,noteConnections:_}}const Uh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function qs(e,n,o={}){const i={...Uh,...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 y=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((_,g)=>{const b=g%y,E=Math.floor(g/y);r.push({id:_,location:{x:p.x+i.pad+b*i.cellWidth,y:p.y+i.pad+i.headerHeight+E*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 Ws={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Hh(e,n={}){const o={...Ws,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Vr(e,n={}){const o={...Ws,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Hh(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 Hn(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 Js(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 qi="inherited:";function Xs(e,n){return`${qi}${e}:${n}`}function jn(e){return e.startsWith(qi)}function Br(e){if(!jn(e))return null;const n=e.slice(qi.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 Qo(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:Xs(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 jh={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function ei(e){return jh[e]??e}function Wi(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function mn(e){return e.attrType==="RELATION_OWN"&&e.dbAttrs.length>1}function Dr(e){const n=new Set;for(const o of e)o.end2.attributeRef&&n.add(o.end2.attributeRef),o.end1.attributeRef&&o.end1.navigable&&n.add(o.end1.attributeRef);return n}function Or(e,n,o){var a;if(e.attrType!=="RELATION_OWN"||o.has(e.modelId))return!1;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 Kn(e,n,o,i,a=0){var d;if(!Wi(e))return;const r=i.find(u=>u.end1.attributeRef===e.modelId||u.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(u=>u.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(d=e.derivedFrom)==null?void 0:d.sourceAttributeRef;if(c){const u=s==null?void 0:s.attributes.find(m=>m.modelId===c);if(u!=null&&u.dbAttrs[a])return u.dbAttrs[a];if(u)return ti(s)[a];for(const m of o){const p=m.attributes.find(f=>f.modelId===c);if(p)return p.dbAttrs[a]??ti(s)[a]}}if(s)return ti(s)[a]}function ti(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 Kh(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=Zs(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function fn(e,n){return Zs(e,n,new Set)}function Zs(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=Kh(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const Qs=e=>e==null||e.trim()==="";function ec(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=fn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return Kn(e,o,i.entities,i.associations,n)}function pn(e,n,o,i,a,r){const l=ec(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:Gh(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function Gh(e){return e!=null&&Object.values(e).some(n=>!Qs(n))}function ni(e,n,o,i,a,r){var l;return Qs(n.physicalName)?((l=ec(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function tc(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 Lr(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 $n(e,n){return Lr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function ko(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Gn(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 Ji(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 nc="(미지정)",Yh="(이름 없음)",Xi=e=>e==null||String(e).trim()==="",Zi=e=>Xi(e)?Yh:String(e),oc=e=>Xi(e)?nc:String(e);function ic(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 nc}function ac(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Xi(n)?oc(e.physicalName):String(n),a=Xi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function rc(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function lc(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} «${ei(c.stereotype)}»${u?` [${u}]`:""}`);const m=ko($n(c,e.entities)),p=g=>{var b;return g.sharedColumnRef?(b=Gn(g,m))==null?void 0:b.physicalName:void 0},f=[...c.attributes].sort((g,b)=>g.order-b.order);for(const g of f){if(g.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${g.name?` ${g.name} ${"─".repeat(8)}`:""}`);continue}const b=g.dbAttrs.map((S,V)=>pn(g,S,V,c,e,n)),E=[g.identifier?"PK":"",g.notNull?"NOT NULL":""].filter(Boolean),h=` - ${Zi(g.name)}: ${oc(g.type)}`,N=S=>S.length?` {${S.join(", ")}}`:"";if(b.length>1){a.push(`${h}${N(E)}`),b.forEach((S,V)=>{const $=tc(g,V,e,n);a.push(` · ${$?`${$} → `:""}${ac(S,p(S))}${N(rc(S))}`)});continue}const w=b[0],C=w?` → ${ac(w,p(w))}`:"";a.push(`${h}${C}${N([...E,...w?rc(w):[]])}`)}const y=Hn(c.attributes);for(const g of c.indexes??[]){const b=g.columns.map(E=>{var h,N;return`${((h=y.attributeOf(E.columnRef))==null?void 0:h.name)??((N=Br(E.columnRef))==null?void 0:N.field)??E.columnRef}${E.descending?" DESC":""}`}).join(", ");a.push(` index ${Zi(g.name)}${g.unique?" UNIQUE":""}: ${b}`)}const _=[...c.operations??[]].sort((g,b)=>g.order-b.order);for(const g of _){const b=g.visibility?` {${g.visibility}}`:"",E=(s=g.description)!=null&&s.ko?` — ${g.description.ko}`:"";a.push(` method ${Zi(g.name)}()${b}${E}`)}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} ${ic(c.end1.multiplicity)} —— ${ic(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
+
`).trim()}function Eo(e){return e.referenceOnly===!0}function Pr(e){const n=new Set;for(const o of e.entities)Eo(o)&&n.add(o.modelId);return n}function sc(e){return e.entities.filter(n=>!Eo(n))}function cc(e,n=Pr(e)){return n.size===0?e.associations:e.associations.filter(o=>!n.has(o.end1.entityRef)&&!n.has(o.end2.entityRef))}function zr(e,n){return n?{...e,entities:e.entities.map(o=>o.referenceOnly?o:{...o,referenceOnly:!0})}:e}function qh(e,n){return Eo(e)||n===!0}const Wh=e=>e&&e[0].toLowerCase()+e.slice(1);function Qi(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function dc(e){return e!=="EXACTLY_ONE_INSTANCE"&&e!=="ONE_OR_MORE_INSTANCES"}function ea(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 Jh(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function ta(e,n){const o=Wh(e);return n?Jh(o):o}function No(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function Xh(e){return e==="CLASS"?"class":"er"}function Fr(e,n,o){const i=Zh(e);return n==="class"?ay(i):ny(i,o)}function Zh(e){const n=Pr(e);return n.size===0?e:{...e,entities:sc(e),associations:cc(e,n)}}function oi(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function Ur(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function uc(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=oi(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 Qh(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const mc=ea;function Hr(e){return e!=null&&fc[e]!=null}const fc={NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"};function pc(e,n){const o={NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"},i=Hr(e)?e:"ZERO_OR_MORE_INSTANCES";return(n==="left"?fc:o)[i]}function ey(e,n,o,i){if(e.dbAttrs.length===0)return[];const a=[];return e.dbAttrs.forEach((r,l)=>{var p;const s=pn(e,r,l,n,o,i);if(s.sharedColumnRef!=null)return;const c=l===0?e.name:tc(e,l,o,i),d=oi(s.dataType||e.type,"unknown"),u=oi(s.physicalName||c,"col"),m=s.length?`(${s.length}${s.scale!=null?`,${s.scale}`:""})`:"";a.push(ty(d,u,e,s.unique===!0,m,(p=s.logicalName)==null?void 0:p.ko))}),a}function ty(e,n,o,i,a,r){const l=[o.identifier?"PK":"",Qh(o)?"FK":"",i?"UK":""].filter(Boolean).join(", "),s=Ur([r,a].filter(Boolean).join(" ")),c=[` ${e} ${n}`];return l&&c.push(l),c.join(" ")+(s?` "${s}"`:"")}function ny(e,n){const o=uc(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 ey(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=`${pc(r.end1.multiplicity,"left")}--${pc(r.end2.multiplicity,"right")}`,d=Ur(r.description);i.push(` ${l} ${c} ${s} : "${d}"`),(!Hr(r.end1.multiplicity)||!Hr(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 oy(e){return e&&e!=="UNDEFINED"?ei(e):null}function iy(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function ay(e){const n=uc(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=oy(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(` +${iy(c.type)} ${oi(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${oi(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=ry(i),s=Ur(i.description),c=` ${a} "${mc(i.end1.multiplicity)}" ${l} "${mc(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function ry(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Pe(){return crypto.randomUUID()}const hc=["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"],ly=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"]),sy=hc.filter(e=>!ly.has(e)),cy={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function jr(e){return cy[e]??e}const dy=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Kr=new Set(["NUMERIC","DECIMAL"]);function yc(e,n=sy){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const hn="CustomType",Yn="GroupCodeEnum",Gr="String",ii=[{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:Yn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:hn,label:"CustomType"}],uy=new Map(ii.map(e=>[e.value,e.label]));function wo(e){return uy.get(e)??e}const my={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 gc(e){if(e)return my[e.toUpperCase()]}const fy={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"]),[Yn]:new Set(["VARCHAR","CHAR"])},py=new Map(ii.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function hy(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!hc.includes(i))return;const a=py.get(o)??o,r=fy[a];if(r)return r.has(i)}const yy=new Set([Yn,"CustomMoneyType"]),bc=ii.filter(e=>!yy.has(e.value)).map(e=>e.value===hn?{...e,label:"CustomType (사용자정의)"}:e);function _c(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=[...bc,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:wo(e)},...i]:i}function gy(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function na(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 Yr(e,n,o,i){var a;return n.attrType==="DIVIDER"||e==="LOGICAL"?"":(e==="CLASS"||mn(n))&&n.attrType.startsWith("RELATION")&&i?o?`${o==="SET"?"Set":"List"}<${i}>`:i:o&&n.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${wo(n.type)}>`:gy(n)?wo(n.type):e==="CLASS"?n.type===hn&&n.customType||wo(n.type):jr(((a=n.dbAttrs[0])==null?void 0:a.dataType)??"")}const by={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},_y={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function ky(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,y)=>f.attributes.find(_=>{var g;return _.identifier&&(y==null||((g=_.dbAttrs[0])==null?void 0:g.physicalName)===y)});let p=c.length===1?c[0]:void 0;if(!p){const f=c.filter(y=>m(y.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 Ey(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(y=>y.trim()).filter(Boolean));let d,u,m;if(i!=null){const y=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(y){d=Number(y[1]),y[2]!=null&&(u=Number(y[2]));const _=i.slice(0,y.index).trim();_&&(m=_)}else i.trim()&&(m=i.trim())}const p={modelId:Pe(),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:Pe(),name:s,type:gc(l)??"",attrType:"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[p]},foreignKey:c.has("FK")}}function kc(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:Pe(),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=Ey(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,y]=p[2].split(/--|\.\./);let _=(p[4]??"").trim();const g=_.match(/^"([^"]*)"$/);g&&(_=g[1]),a.push({left:p[1],right:p[3],cardL:f??"",cardR:y??"",label:_});continue}/^\S+$/.test(u)&&l(u)}const c=a.map(d=>{const u=l(d.left),m=l(d.right);return{modelId:Pe(),description:d.label||void 0,end1:{entityRef:u.modelId,multiplicity:by[d.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:_y[d.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return ky(o,c,r),{modelId:Pe(),entities:o,associations:c,groups:[]}}function Ec(e){const n=kc(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Vr(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:Pe(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const Nc={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"}},Ny=Object.keys(Nc).sort((e,n)=>n.length-e.length),wc=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,Io=`${wc}(?:\\.${wc})*`,wy=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Io})\s*\(([\s\S]*)\)\s*$`,"i"),Iy=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Io})\s*\(([^)]*)\)`,"i"),vy=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${Io})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Io})\s*\(([^)]*)\)`,"i"),Cy=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Io})\s+ON\s+(${Io})\s*\(([^)]*)\)`,"i");function Dt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function qn(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 Sy(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=Dt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const g of Ny)if(a.startsWith(g)){const b=Nc[g];r=b.dataType,l=!!b.autoIncrement;let E=i.slice(g.length);const h=E.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);h&&(s=Number(h[1]),h[2]!=null&&(c=Number(h[2])),E=E.slice(h[0].length)),d=E,u=!0;break}if(!u){const g=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);g&&(r=g[1].toUpperCase(),g[2]!=null&&(s=Number(g[2])),g[3]!=null&&(c=Number(g[3])),d=g[4]??"")}const m=d.toUpperCase(),p=/\bPRIMARY\s+KEY\b/.test(m),f=p||/\bNOT\s+NULL\b/.test(m),y=/\bUNIQUE\b/.test(m),_={modelId:Pe(),physicalName:o,dataType:r};return s!=null&&(_.length=s),c!=null&&(_.scale=c),y&&(_.unique=!0),l&&(_.autoIncrement=!0),{primaryKey:p,attr:{modelId:Pe(),name:o,type:gc(r)??"",attrType:"NORMAL",identifier:p,notNull:f,order:0,dbAttrs:[_]}}}function xy(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function Ic(e){const n=e.match(/\(([^)]*)\)/);return n?qn(n[1]).map(Dt):[]}function qr(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(wy);if(!m)continue;const p=Dt(m[1]),f=m[2],y={modelId:Pe(),name:p,stereotype:"JPA_ENTITY",table:{physicalName:p},attributes:[]},_=new Map,g=[];let b=0;for(const E of qn(f)){if(xy(E)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(E))g.push(...Ic(E));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(E))for(const w of Ic(E)){const C=_.get(w.toLowerCase());C!=null&&C.dbAttrs[0]&&(C.dbAttrs[0].unique=!0)}const N=E.match(Iy);N&&l.push({childTable:p,childCols:qn(N[1]).map(Dt),parentTable:Dt(N[2]),parentCols:qn(N[3]).map(Dt)});continue}const h=Sy(E);if(!h){n.push(`컬럼 정의 해석 실패: ${E.slice(0,40)}`);continue}h.attr.order=b++,h.attr.type||n.push(`자바 타입 미해소(수동 지정 필요): ${p}.${h.attr.name} — ${(d=h.attr.dbAttrs[0])==null?void 0:d.dataType}`),y.attributes.push(h.attr),_.set(h.attr.name.toLowerCase(),h.attr)}for(const E of g){const h=_.get(E.toLowerCase());h&&(h.identifier=!0,h.notNull=!0)}o.push(y),i.set(p.toLowerCase(),y);for(const[E,h]of _)a.set(`${p.toLowerCase()}.${E}`,h)}for(const u of c){const m=u.match(vy);m&&l.push({childTable:Dt(m[1]),childCols:qn(m[2]).map(Dt),parentTable:Dt(m[3]),parentCols:qn(m[4]).map(Dt)})}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()}`),y={modelId:Pe(),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)=>{const b=a.get(`${u.childTable.toLowerCase()}.${_.toLowerCase()}`),E=a.get(`${u.parentTable.toLowerCase()}.${(u.parentCols[g]??"").toLowerCase()}`);b&&(b.attrType="RELATION_OWN",b.derivedFrom={associationRef:y.modelId,sourceAttributeRef:(E==null?void 0:E.modelId)??""},g===0&&(y.end2.attributeRef=b.modelId))}),r.push(y)}for(const u of c){const m=u.match(Cy);if(!m)continue;const p=Dt(m[3]),f=i.get(p.toLowerCase());if(!f){n.push(`인덱스 대상 테이블 없음: ${p}`);continue}const _=qn(m[4]).map(b=>Dt(b.replace(/\s+(ASC|DESC)$/i,""))).map(b=>{var E,h;return(h=(E=a.get(`${p.toLowerCase()}.${b.toLowerCase()}`))==null?void 0:E.dbAttrs[0])==null?void 0:h.modelId}).filter(b=>!!b).map(b=>({columnRef:b,descending:!1}));if(!_.length)continue;const g={modelId:Pe(),name:Dt(m[2]),unique:!!m[1],columns:_};f.indexes=[...f.indexes??[],g]}return{logical:{modelId:Pe(),entities:o,associations:r,groups:[]},warnings:n}}function vc(e){const{logical:n}=qr(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Vr(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:Pe(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}function Ry(){return"postgres"}function Cc(e,n="postgres",o){return By(e,o)}const vo=e=>e==null||e.trim()==="";function oa(e){return[...e.attributes].filter(n=>n.attrType!=="DIVIDER"&&!n.transient).sort((n,o)=>n.order-o.order)}function Ay(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)&&!Eo(o))}function Wr(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name}const $y={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 Ty(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":$y[n]??n.toLowerCase()}function My(e,n,o){const i=[];for(const a of oa(e))a.dbAttrs.forEach((r,l)=>{const s=pn(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&&!vo(e.physicalName)&&!vo(e.dataType)}function Vy(e){return[` -- ⚠ 컬럼명 충돌로 ${e.length}개 컬럼 생략 (CHK-NAME-2 — 같은 물리명을 둘 이상이 사용):`,...e.map(({attr:o,name:i})=>` -- ${o.name||"(이름 없음)"} → ${i}`)].join(`
|
|
6
|
+
`)}function By(e,n){const o=Ay(e),i=new Map,a=new Map;for(const d of e.entities)for(const u of oa(d)){i.set(u.modelId,d);const m=[];u.dbAttrs.forEach((p,f)=>{const y=pn(u,p,f,d,e,n);Sc(y)&&(m[f]=y.physicalName)}),a.set(u.modelId,m)}const r=[],l=[],s=[];for(const d of o){const u=Wr(d),m=My(d,e,n);if(m.length===0)continue;const p=new Map,f=new Map;for(const{attr:S,col:V,name:$}of m){const R=S.dbAttrs.findIndex(T=>T.modelId===V.modelId),x=p.get(S.modelId)??[];x[R<0?x.length:R]=$,p.set(S.modelId,x),f.set(V.modelId,$)}const y=new Set,_=[],g=[];for(const{attr:S,col:V,name:$}of m){if(y.has($)){_.push({attr:S,col:V,name:$});continue}y.add($);const R=[` ${$} ${Ty(V)}`];S.notNull&&!S.identifier&&R.push("NOT NULL"),V.unique&&R.push("UNIQUE"),g.push(R.join(" "))}const b=oa(d).filter(S=>S.identifier).flatMap(S=>p.get(S.modelId)??[]).filter(S=>!vo(S));b.length&&g.push(` PRIMARY KEY (${b.join(", ")})`);const E=g.join(`,
|
|
7
|
+
`)+(_.length?`
|
|
8
|
+
${Vy(_)}`:"");r.push(`CREATE TABLE ${u} (
|
|
9
|
+
${E}
|
|
10
|
+
);`);const h=new Map,N=[];for(const S of oa(d)){const V=S.derivedFrom;if(!V)continue;const $=i.get(V.sourceAttributeRef);if(!$)continue;if(Eo($)){N.push(`${S.name||S.modelId} → ${Wr($)}`);continue}const R=p.get(S.modelId)??[],x=a.get(V.sourceAttributeRef)??[],T=[];for(let k=0;k<Math.max(R.length,x.length);k++){const v=R[k],I=x[k];vo(v)||vo(I)||T.push([v,I])}if(!T.length)continue;const M=h.get(V.associationRef)??{childCols:[],parentTable:Wr($),parentCols:[]};for(const[k,v]of T)M.childCols.push(k),M.parentCols.push(v);h.set(V.associationRef,M)}N.length&&l.push(`-- ⚠ ${u}: 참고 전용 부모를 참조하는 FK ${N.length}개 생략 — ${N.join(", ")}`);let w=0;for(const S of h.values()){const V=`fk_${u}_${S.parentTable}${h.size>1?`_${++w}`:""}`;l.push(`ALTER TABLE ${u} ADD CONSTRAINT ${V} FOREIGN KEY (${S.childCols.join(", ")}) REFERENCES ${S.parentTable} (${S.parentCols.join(", ")});`)}const C=Hn(d.attributes);for(const S of d.indexes??[]){const V=[],$=[],R=[],x=new Set;for(const M of S.columns){const k=f.get(C.canon(M.columnRef));if(vo(k)){jn(M.columnRef)||$.push(Js(C,M.columnRef));continue}if(x.has(k)){R.push(k);continue}x.add(k),V.push(k)}if($.length&&s.push(`-- ⚠ ${u} 인덱스 ${S.name||"(이름 없음)"}: 컬럼 참조 미해소 ${$.length}개 생략 — ${$.join(", ")}`),R.length&&s.push(`-- ⚠ ${u} 인덱스 ${S.name||"(이름 없음)"}: 중복 컬럼 ${R.length}개 생략 (CHK-DSN-7) — ${R.join(", ")}`),!V.length)continue;const T=S.name||`ix_${u}_${V.join("_")}`;s.push(`CREATE ${S.unique?"UNIQUE ":""}INDEX ${T} ON ${u} (${V.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 Or="entity-modeler-diagram",Lr=1;class Un extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function hc(e,n){return JSON.stringify({format:Or,version:Lr,logical:e,layout:n},null,2)}const Wi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),_o=e=>Array.isArray(e)?e:[];function yc(e){let n;try{n=JSON.parse(e)}catch{throw new Un("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Wi(n))throw new Un("최상위가 객체가 아닙니다.");if(n.format!==Or)throw new Un(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Lr)throw new Un(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Wi(o)||!Array.isArray(o.entities))throw new Un("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Wi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Un("엔티티 골격(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:_o(o.associations),groups:_o(o.groups)},a=Wi(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:_o(a.entityLayouts),associationLayouts:_o(a.associationLayouts),groupLayouts:_o(a.groupLayouts),notes:_o(a.notes)};return{logical:i,layout:r}}const $y=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function vt(e){return e.replace($y,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Pe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function gc(e){return`<text ${[`x="${Pe(e.x)}"`,`y="${Pe(e.y)}"`,`fill="${vt(e.fill)}"`,`font-size="${Pe(e.fontSize)}"`,e.fontFamily?`font-family="${vt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${vt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${vt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${vt(e.text)}</text>`}function Ty(e){return`<line x1="${Pe(e.x1)}" y1="${Pe(e.y)}" x2="${Pe(e.x2)}" y2="${Pe(e.y)}" stroke="${vt(e.stroke)}" stroke-width="${Pe(e.strokeWidth??1)}" />`}function My(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 Vy(e,n,o,i,a){return[`M${Pe(e+a.tl)},${Pe(n)}`,`L${Pe(e+o-a.tr)},${Pe(n)}`,a.tr?`Q${Pe(e+o)},${Pe(n)} ${Pe(e+o)},${Pe(n+a.tr)}`:"",`L${Pe(e+o)},${Pe(n+i-a.br)}`,a.br?`Q${Pe(e+o)},${Pe(n+i)} ${Pe(e+o-a.br)},${Pe(n+i)}`:"",`L${Pe(e+a.bl)},${Pe(n+i)}`,a.bl?`Q${Pe(e)},${Pe(n+i)} ${Pe(e)},${Pe(n+i-a.bl)}`:"",`L${Pe(e)},${Pe(n+a.tl)}`,a.tl?`Q${Pe(e)},${Pe(n)} ${Pe(e+a.tl)},${Pe(n)}`:"","Z"].filter(Boolean).join(" ")}function Pr(e){const n=My(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${vt(e.fill)}"`,`stroke="${vt(e.stroke)}"`,`stroke-width="${Pe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${vt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Pe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Vy(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Pe(e.x)}" y="${Pe(e.y)}" width="${Pe(e.w)}" height="${Pe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Ty(l));for(const l of e.texts)r.push(gc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function By(e){const o=[`<path ${[`d="${vt(e.d)}"`,'fill="none"',`stroke="${vt(e.stroke)}"`,`stroke-width="${Pe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${vt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(gc(i));return`<g>${o.join("")}</g>`}function bc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Pe(n)}" y="${Pe(o)}" width="${Pe(i)}" height="${Pe(a)}" fill="${vt(e.background)}" />`);for(const l of e.groups)r.push(Pr(l));for(const l of e.edges)r.push(By(l));for(const l of e.entities)r.push(Pr(l));for(const l of e.notes)r.push(Pr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Pe(n)} ${Pe(o)} ${Pe(i)} ${Pe(a)}" width="${Pe(i)}" height="${Pe(a)}">`+r.join("")+"</svg>"}function Ji(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 Dy(e,n,o){const i=Ji(e,o),a=Ji(n,o);return i.kind===a.kind&&i.value!==a.value}const zr=()=>crypto.randomUUID(),_c=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Oy=e=>e&&e[0].toLowerCase()+e.slice(1),Ly=e=>e&&e[0].toUpperCase()+e.slice(1),kc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Py(e,n){return Oy(e??"")+Ly(n??"")}function zy(e,n){const o=ho(e.name,n);return o===e.name?e:{...e,name:o,dbAttrs:e.dbAttrs.map(i=>({...i,physicalName:kc(o)}))}}function Ec(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&&!Xs(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=Py(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:kc(c),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const Xi=(e,n)=>`${e}::${n}`,Zi=e=>e??void 0;function Fy(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||Zi(s.length)!==Zi(r.length)||Zi(s.scale)!==Zi(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 Uy(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 Xo(e,n,o=zr){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=>Ec(e,f)),s=new Map(l.map(f=>[Xi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Xi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const y=Xi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(y)||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 h=a.attributes.reduce((f,y)=>Math.max(f,y.order),-1)+1;for(const f of l){const y=Xi(f.associationRef,f.sourceAttributeRef),k=d.get(y);if(k){const _=Fy(k,f,o);_&&i.update.push({attributeId:k.modelId,patch:_})}else{const _=zy(f,m);m.add(_.name),i.add.push(Uy(_,h++,o))}}return i}function Nc(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 Hy(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function wc(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 Ic(e,n,o=zr){const i=new Map,a=Hy(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 f=Xo(a,h,o);if(_c(f))continue;const y=i.get(h);i.set(h,y?wc(y,f):f);const k=a.entities.find(_=>_.modelId===h);k&&Nc(k,f),r.has(h)||(r.add(h),c.push(h))}}return i}function vc(e,n,o=zr){const i=[],a=Xo(e,n,o);let r=e;_c(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 Nc(s,a),s})});for(const[l,s]of Ic(r,n,o))i.push({entityId:l,plan:s});return i}function ko(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||!zi(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 Zo=63;function Fr(e){if(!e)return null;const n=e.length;return n>Zo?n:null}function Ur(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function gt(e){return!e||e.trim()===""}function Eo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function jy(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const h=o.get(m.end1.entityRef)??[];h.push(m.end2.entityRef),o.set(m.end1.entityRef,h)}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 h of o.get(m)??[]){const f=l.get(h)??i;if(f===i)u(h);else if(f===a){const y=s.slice(s.indexOf(h)),k=[...y].sort().join(" ");d.has(k)||(d.add(k),c.push(y))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function Cc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Ky(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function xc(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Gy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=gt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Yy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Gy(a,o))).size===1}function Sc(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 Hr(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 Qi(e,n){var m,h,f,y,k,_,E,N,p;const o=[],i=new Map(e.entities.map(b=>[b.modelId,b])),a=new Map(e.associations.map(b=>[b.modelId,b])),r=vr(e),l=r.size===0?e.entities:Ws(e),s=Js(e,r);for(const b of Sc(l,w=>w.name))for(const w of b){const A=b.filter(T=>T!==w),$=Cc(w)&&A.some(Cc),L=A.some(T=>!Dy(w,T,e));!$&&!L||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:w.modelId,params:{name:w.name,reason:$?"entity":"package"}})}for(const b of Sc(Ky(l),xc))if(new Set(b.map(w=>w.name)).size!==1&&!Yy(b,e))for(const w of b)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:w.modelId,params:{name:xc(w)}});const c=l.flatMap(b=>(b.indexes??[]).map(w=>({e:b,ix:w})));for(const b of Hr(c,w=>w.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:b.ix.modelId,contextRef:b.e.modelId,params:{name:b.ix.name}});for(const b of l){const w=b.attributes.filter(g=>g.attrType!=="DIVIDER");if(gt(b.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:b.modelId}),b.stereotype==="JPA_ENTITY"&&!b.abstractClass&&(w.some(g=>g.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:b.modelId}),gt((m=b.table)==null?void 0:m.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:b.modelId})),b.stereotype==="JPA_EMBEDDABLE")for(const g of w.filter(I=>I.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w.filter(I=>I.identifier&&I.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w)if(!g.identifier)for(const I of g.dbAttrs)!I.autoIncrement&>(I.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:I.autoIncrement?{name:g.name}:{name:g.name,seq:I.sequenceName??""}});const A=w.filter(g=>g.identifier&&!g.transient);if(A.reduce((g,I)=>g+I.dbAttrs.length,0)>=2)for(const g of A)for(const I of g.dbAttrs)!I.autoIncrement&>(I.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w.filter(I=>I.naturalId&&I.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w.filter(I=>I.naturalId&&I.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w.filter(I=>I.naturalId&&!I.notNull&&!I.identifier&&!I.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});!b.abstractClass&&w.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:b.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&w.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:b.modelId,params:{count:w.length,threshold:n.largeEntityThreshold}});for(const g of Hr(w,I=>I.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w)if(gt(g.name)){const I=g.attrType.startsWith("RELATION")||g.attrType.startsWith("EMBED");o.push({ruleId:I?"CHK-NAME-7":"CHK-NAME-4",severity:I?"error":"info",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,...I?{params:{attrType:g.attrType}}:{}})}const $=w.flatMap(g=>g.dbAttrs.map((I,v)=>({attr:g,index:v,col:I,eff:on(g,I,v,b,e,n),name:qo(g,I,v,b,e,n)})).filter(I=>I.eff.sharedColumnRef==null));for(const g of Hr($,I=>I.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:g.col.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of $){if(!gt(g.name)||g.attr.transient||gt(g.attr.name)&&(g.attr.attrType.startsWith("RELATION")||g.attr.attrType.startsWith("EMBED"))||g.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const I=Fi(g.attr,b,e.entities,e.associations,g.index);gt(I==null?void 0:I.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:g.col.modelId,contextRef:b.modelId,params:{name:g.attr.name}})}for(const g of $){const I=g.col,v=Fr(I.physicalName);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{max:Zo,len:v}}),n!=null&&n.reservedWords&&!gt(I.physicalName)&&n.reservedWords.has(I.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{name:I.physicalName}}),n!=null&&n.selectableDataTypes&&!gt(I.dataType)&&!n.selectableDataTypes.has(I.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{dataType:I.dataType}});const O=g.attr.transient||I.multiValue||g.attr.attrType.startsWith("EMBED")||g.attr.attrType.startsWith("RELATION")?void 0:dy(g.attr.type,I.dataType);O===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{type:g.attr.type,dataType:Ur(I)}}),O!==!1&&!gt(I.dataType)&&ay.has(I.dataType)&&!I.length&&(on(g.attr,I,g.index,b,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{dataType:I.dataType}}))}for(const g of $)gt(g.col.dataType)&&(g.attr.transient||g.attr.attrType.startsWith("EMBED")||g.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:g.col.modelId,contextRef:b.modelId,params:{name:g.attr.name}}));if((h=n==null?void 0:n.embeddableCatalog)!=null&&h.length){const g=fo(vn(b,e.entities));for(const I of w){if(I.attrType!=="EMBED_PREDEF")continue;const v=n.embeddableCatalog.find(O=>O.type===I.type);v&&I.dbAttrs.forEach((O,x)=>{if(O.sharedColumnRef==null)return;const z=v.fields[x],j=g.get(O.sharedColumnRef);if(!z||!j)return;(j.dataType!==z.dataType||(j.length??null)!==(z.length??null)||(j.scale??null)!==(z.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:O.modelId,contextRef:b.modelId,params:{targetType:Ur(j),metaName:z.name,metaType:Ur(z)}})})}}for(const g of w){const I=g.dbAttrs[0];if(!(I!=null&&I.multiValue))continue;g.type===zn&&I.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{type:g.type||"",dataType:I.dataType||""}})}for(const g of w){if(g.attrType!=="EMBED_OWN"||!g.embedded)continue;const I=i.get(g.embedded.embeddableRef);if(!I)continue;const v=a.get(g.embedded.associationRef),O=v==null?void 0:v.end1.entityRef===g.embedded.embeddableRef?v.end1:v.end2;if(O&&Eo(O.multiplicity))continue;const x=nn(I).length;g.dbAttrs.length!==x&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name,embeddable:I.name,slots:g.dbAttrs.length,declared:x}})}const L=(f=b.table)==null?void 0:f.physicalName,T=Fr(L);T!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:b.modelId,params:{max:Zo,len:T}}),n!=null&&n.reservedWords&&!gt(L)&&n.reservedWords.has(L.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:b.modelId,params:{name:L}});const S=new Set;for(const g of b.attributes){S.add(g.modelId);for(const I of g.dbAttrs)S.add(I.modelId)}const C=new Set(Go(b,(n==null?void 0:n.superClassCatalog)??[]).map(g=>g.modelId)),M=(((y=n==null?void 0:n.superClassCatalog)==null?void 0:y.length)??0)>0,B=On(b.attributes);for(const g of b.indexes??[]){const I=Fr(g.name);I!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:{max:Zo,len:I}}),n!=null&&n.reservedWords&&!gt(g.name)&&n.reservedWords.has(g.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const v of g.columns){const O=v.columnRef;if(S.has(O)||C.has(O))continue;const x=Ln(O);x&&!M||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:x?{name:g.name,field:((k=wr(O))==null?void 0:k.field)??O}:{name:g.name}})}g.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}}),new Set(g.columns.map(v=>B.canon(v.columnRef))).size!==g.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}})}}const d=new Map;for(const b of e.entities)for(const w of b.attributes)w.attrType==="EMBED_OWN"&&w.embedded&&d.set(w.embedded.associationRef,w);for(const b of s){if(Eo(b.end1.multiplicity)&&Eo(b.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:b.modelId}),d.has(b.modelId)&&b.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:b.modelId}),!d.has(b.modelId)){const w=!!b.end2.attributeRef&&(((E=(_=b.end2.jpa)==null?void 0:_.cascadeTypes)==null?void 0:E.length)??0)>0,A=!!b.end1.attributeRef&&b.end1.navigable&&(((p=(N=b.end1.jpa)==null?void 0:N.cascadeTypes)==null?void 0:p.length)??0)>0;w&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:b.modelId})}if(!d.has(b.modelId)&&b.end1.navigable&&b.end1.attributeRef){const w=i.get(b.end1.entityRef),A=w==null?void 0:w.attributes.some(T=>T.modelId===b.end1.attributeRef),$=i.get(b.end2.entityRef),L=Ec(e,b).length>0;A&&$&&L&&(b.end2.attributeRef&&$.attributes.some(S=>S.modelId===b.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:b.modelId,params:{child:$.name}}))}for(const w of["end1","end2"]){const A=b[w].jpa;if(!A)continue;const $=A.cascadeTypes??[],L=$.includes("ALL"),T=$.includes("REMOVE");L&&$.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:b.modelId,params:{which:w}}),A.orphanRemoval&&(T||L)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:b.modelId,params:{which:w,cascade:L?"ALL":"REMOVE"}}),Eo(b[w].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:b.modelId,params:{which:w}}),A.orphanRemoval&&Eo(b[w==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:b.modelId,params:{which:w}}),!Eo(b[w].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:b.modelId,params:{which:w}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:b.modelId,params:{which:w}})}}const u=new Map(e.entities.map(b=>[b.modelId,b.name||b.modelId]));for(const b of jy(l,s)){const w=[...b,b[0]].map(A=>u.get(A)??A).join(" → ");for(const A of b)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:w}})}if(n!=null&&n.flagEntitiesWithoutRelations){const b=new Set;for(const A of e.associations)b.add(A.end1.entityRef),b.add(A.end2.entityRef);const w=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const $ of A.attributes)$.embedded&&(b.add(A.modelId),b.add($.embedded.embeddableRef));if(!gt(A.superClass)){b.add(A.modelId);const $=w.get(A.superClass);$&&b.add($)}}for(const A of l)b.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function jr(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return qy(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 qy(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=On(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 No="javax.persistence",et={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"},Wy={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function Rc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Ut(o)?null:o??Wy[n]}const ea={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function Jy(e){if(!e)return;if(ea[e])return{simpleName:e,fqn:ea[e]};const n=Object.entries(ea).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function Ac(e){return!(Ut(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Xy(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&&(po(l)||o.skipUngeneratable!==!1&&!Ac(l)||a.push(eg(l,e,o)))}return a}class $c{constructor(){nt(this,"imports",new Set);nt(this,"body",[]);nt(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${No}.${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 Jr="entity-modeler-diagram",Xr=1;class Wn extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function xc(e,n){return JSON.stringify({format:Jr,version:Xr,logical:e,layout:n},null,2)}const ia=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Co=e=>Array.isArray(e)?e:[];function Rc(e){let n;try{n=JSON.parse(e)}catch{throw new Wn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!ia(n))throw new Wn("최상위가 객체가 아닙니다.");if(n.format!==Jr)throw new Wn(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Xr)throw new Wn(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!ia(o)||!Array.isArray(o.entities))throw new Wn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!ia(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Wn("엔티티 골격(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:Co(o.associations),groups:Co(o.groups)},a=ia(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Co(a.entityLayouts),associationLayouts:Co(a.associationLayouts),groupLayouts:Co(a.groupLayouts),notes:Co(a.notes)};return{logical:i,layout:r}}const Dy=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ot(e){return e.replace(Dy,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function He(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Ac(e){return`<text ${[`x="${He(e.x)}"`,`y="${He(e.y)}"`,`fill="${Ot(e.fill)}"`,`font-size="${He(e.fontSize)}"`,e.fontFamily?`font-family="${Ot(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ot(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ot(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ot(e.text)}</text>`}function Oy(e){return`<line x1="${He(e.x1)}" y1="${He(e.y)}" x2="${He(e.x2)}" y2="${He(e.y)}" stroke="${Ot(e.stroke)}" stroke-width="${He(e.strokeWidth??1)}" />`}function Ly(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 Py(e,n,o,i,a){return[`M${He(e+a.tl)},${He(n)}`,`L${He(e+o-a.tr)},${He(n)}`,a.tr?`Q${He(e+o)},${He(n)} ${He(e+o)},${He(n+a.tr)}`:"",`L${He(e+o)},${He(n+i-a.br)}`,a.br?`Q${He(e+o)},${He(n+i)} ${He(e+o-a.br)},${He(n+i)}`:"",`L${He(e+a.bl)},${He(n+i)}`,a.bl?`Q${He(e)},${He(n+i)} ${He(e)},${He(n+i-a.bl)}`:"",`L${He(e)},${He(n+a.tl)}`,a.tl?`Q${He(e)},${He(n)} ${He(e+a.tl)},${He(n)}`:"","Z"].filter(Boolean).join(" ")}function Zr(e){const n=Ly(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${Ot(e.fill)}"`,`stroke="${Ot(e.stroke)}"`,`stroke-width="${He(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ot(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${He(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Py(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${He(e.x)}" y="${He(e.y)}" width="${He(e.w)}" height="${He(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Oy(l));for(const l of e.texts)r.push(Ac(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function zy(e){const o=[`<path ${[`d="${Ot(e.d)}"`,'fill="none"',`stroke="${Ot(e.stroke)}"`,`stroke-width="${He(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ot(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Ac(i));return`<g>${o.join("")}</g>`}function $c(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${He(n)}" y="${He(o)}" width="${He(i)}" height="${He(a)}" fill="${Ot(e.background)}" />`);for(const l of e.groups)r.push(Zr(l));for(const l of e.edges)r.push(zy(l));for(const l of e.entities)r.push(Zr(l));for(const l of e.notes)r.push(Zr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${He(n)} ${He(o)} ${He(i)} ${He(a)}" width="${He(i)}" height="${He(a)}">`+r.join("")+"</svg>"}function aa(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 Fy(e,n,o){const i=aa(e,o),a=aa(n,o);return i.kind===a.kind&&i.value!==a.value}const Qr=()=>crypto.randomUUID(),Tc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Uy=e=>e&&e[0].toLowerCase()+e.slice(1),Hy=e=>e&&e[0].toUpperCase()+e.slice(1);function jy(e,n){return Uy(e??"")+Hy(n??"")}function Ky(e,n){const o=No(e.name,n);if(o===e.name)return e;const i=o.slice(e.name.length);return{...e,name:o,dbAttrs:e.dbAttrs.map((a,r)=>{var l;return{...a,physicalName:`${((l=e.originPhysicalNames)==null?void 0:l[r])??""}${i}`}})}}function Mc(e,n){const o=e.entities.find(d=>d.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&&!dc(n.end1.multiplicity),l=o.attributes.filter(d=>d.identifier&&(d.attrType==="NORMAL"||d.attrType==="RELATION_OWN")).sort((d,u)=>d.order-u.order);if(l.length===0)return[];const s=l[0],c=l.flatMap(d=>d.dbAttrs);return[(d=>{const u=jy(o.name,d.name);return{associationRef:n.modelId,sourceAttributeRef:d.modelId,name:u,type:d.type,identifier:a,notNull:r,dbAttrs:c.map(m=>({physicalName:"",logicalName:m.logicalName,dataType:m.dataType,length:m.length,scale:m.scale})),originPhysicalNames:c.map(m=>m.physicalName??"")}})(s)]}const ra=(e,n)=>`${e}::${n}`,la=e=>e??void 0;function Gy(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||la(s.length)!==la(r.length)||la(s.scale)!==la(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 Yy(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 ai(e,n,o=Qr){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=>Mc(e,f)),s=new Map(l.map(f=>[ra(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ra(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const y=ra(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(y)||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,y)=>Math.max(f,y.order),-1)+1;for(const f of l){const y=ra(f.associationRef,f.sourceAttributeRef),_=d.get(y);if(_){const g=Gy(_,f,o);g&&i.update.push({attributeId:_.modelId,patch:g})}else{const g=Ky(f,m);m.add(g.name),i.add.push(Yy(g,p++,o))}}return i}function Vc(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 qy(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function Bc(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 Dc(e,n,o=Qr){const i=new Map,a=qy(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=ai(a,p,o);if(Tc(f))continue;const y=i.get(p);i.set(p,y?Bc(y,f):f);const _=a.entities.find(g=>g.modelId===p);_&&Vc(_,f),r.has(p)||(r.add(p),c.push(p))}}return i}function Oc(e,n,o=Qr){const i=[],a=ai(e,n,o);let r=e;Tc(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 Vc(s,a),s})});for(const[l,s]of Dc(r,n,o))i.push({entityId:l,plan:s});return i}function So(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||!Wi(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 ri=63;function el(e){if(!e)return null;const n=e.length;return n>ri?n:null}function tl(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Ct(e){return!e||e.trim()===""}function xo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Wy(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 y=s.slice(s.indexOf(p)),_=[...y].sort().join(" ");d.has(_)||(d.add(_),c.push(y))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function Lc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Jy(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function Pc(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Xy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=Ct(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Zy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Xy(a,o))).size===1}function zc(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 nl(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 sa(e,n){var p,f,y,_,g,b,E,h,N;const o=[],i=new Map(e.entities.map(w=>[w.modelId,w])),a=new Map(e.associations.map(w=>[w.modelId,w])),r=Dr(e.associations),l=Pr(e),s=l.size===0?e.entities:sc(e),c=cc(e,l);for(const w of zc(s,C=>C.name))for(const C of w){const S=w.filter(R=>R!==C),V=Lc(C)&&S.some(Lc),$=S.some(R=>!Fy(C,R,e));!V&&!$||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:C.modelId,params:{name:C.name,reason:V?"entity":"package"}})}for(const w of zc(Jy(s),Pc))if(new Set(w.map(C=>C.name)).size!==1&&!Zy(w,e))for(const C of w)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:C.modelId,params:{name:Pc(C)}});const d=s.flatMap(w=>(w.indexes??[]).map(C=>({e:w,ix:C})));for(const w of nl(d,C=>C.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:w.ix.modelId,contextRef:w.e.modelId,params:{name:w.ix.name}});for(const w of s){const C=w.attributes.filter(v=>v.attrType!=="DIVIDER");if(Ct(w.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:w.modelId}),w.stereotype==="JPA_ENTITY"&&!w.abstractClass&&(C.some(v=>v.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:w.modelId}),Ct((p=w.table)==null?void 0:p.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:w.modelId})),w.stereotype==="JPA_EMBEDDABLE")for(const v of C.filter(I=>I.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C.filter(I=>I.identifier&&I.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C)if(!v.identifier)for(const I of v.dbAttrs)!I.autoIncrement&&Ct(I.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:I.autoIncrement?{name:v.name}:{name:v.name,seq:I.sequenceName??""}});const S=C.filter(v=>v.identifier&&!v.transient);if(S.reduce((v,I)=>v+I.dbAttrs.length,0)>=2)for(const v of S)for(const I of v.dbAttrs)!I.autoIncrement&&Ct(I.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C.filter(I=>I.naturalId&&I.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C.filter(I=>I.naturalId&&I.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C.filter(I=>I.naturalId&&!I.notNull&&!I.identifier&&!I.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});!w.abstractClass&&C.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:w.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&C.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:w.modelId,params:{count:C.length,threshold:n.largeEntityThreshold}});for(const v of nl(C,I=>I.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C)if(Ct(v.name)){const I=(v.attrType.startsWith("RELATION")||v.attrType.startsWith("EMBED"))&&!Or(v,w,r);o.push({ruleId:I?"CHK-NAME-7":"CHK-NAME-4",severity:I?"error":"info",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,...I?{params:{attrType:v.attrType}}:{}})}const V=C.flatMap(v=>v.dbAttrs.map((I,O)=>({attr:v,index:O,col:I,eff:pn(v,I,O,w,e,n),name:ni(v,I,O,w,e,n)})).filter(I=>I.eff.sharedColumnRef==null));for(const v of nl(V,I=>I.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:v.col.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of V){if(!Ct(v.name)||v.attr.transient||Ct(v.attr.name)&&(v.attr.attrType.startsWith("RELATION")||v.attr.attrType.startsWith("EMBED"))||v.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const I=Kn(v.attr,w,e.entities,e.associations,v.index);Ct(I==null?void 0:I.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:v.col.modelId,contextRef:w.modelId,params:{name:v.attr.name}})}for(const v of V){const I=v.col,O=el(I.physicalName);O!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{max:ri,len:O}}),n!=null&&n.reservedWords&&!Ct(I.physicalName)&&n.reservedWords.has(I.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{name:I.physicalName}}),n!=null&&n.selectableDataTypes&&!Ct(I.dataType)&&!n.selectableDataTypes.has(I.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{dataType:I.dataType}});const A=v.attr.transient||I.multiValue||v.attr.attrType.startsWith("EMBED")||v.attr.attrType.startsWith("RELATION")?void 0:hy(v.attr.type,I.dataType);A===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{type:v.attr.type,dataType:tl(I)}}),A!==!1&&!Ct(I.dataType)&&dy.has(I.dataType)&&!I.length&&(pn(v.attr,I,v.index,w,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{dataType:I.dataType}}))}for(const v of V)Ct(v.col.dataType)&&(v.attr.transient||v.attr.attrType.startsWith("EMBED")||v.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:v.col.modelId,contextRef:w.modelId,params:{name:v.attr.name}}));if((f=n==null?void 0:n.embeddableCatalog)!=null&&f.length){const v=ko($n(w,e.entities));for(const I of C){if(I.attrType!=="EMBED_PREDEF")continue;const O=n.embeddableCatalog.find(A=>A.type===I.type);O&&I.dbAttrs.forEach((A,L)=>{if(A.sharedColumnRef==null)return;const H=O.fields[L],oe=v.get(A.sharedColumnRef);if(!H||!oe)return;(oe.dataType!==H.dataType||(oe.length??null)!==(H.length??null)||(oe.scale??null)!==(H.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:A.modelId,contextRef:w.modelId,params:{targetType:tl(oe),metaName:H.name,metaType:tl(H)}})})}}for(const v of C){const I=v.dbAttrs[0];if(!(I!=null&&I.multiValue))continue;v.type===Yn&&I.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{type:v.type||"",dataType:I.dataType||""}})}for(const v of C){if(v.attrType!=="EMBED_OWN"||!v.embedded)continue;const I=i.get(v.embedded.embeddableRef);if(!I)continue;const O=a.get(v.embedded.associationRef),A=O==null?void 0:O.end1.entityRef===v.embedded.embeddableRef?O.end1:O.end2;if(A&&xo(A.multiplicity))continue;const L=fn(I).length;v.dbAttrs.length!==L&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name,embeddable:I.name,slots:v.dbAttrs.length,declared:L}})}const $=(y=w.table)==null?void 0:y.physicalName,R=el($);R!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:w.modelId,params:{max:ri,len:R}}),n!=null&&n.reservedWords&&!Ct($)&&n.reservedWords.has($.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:w.modelId,params:{name:$}});const x=new Set;for(const v of w.attributes){x.add(v.modelId);for(const I of v.dbAttrs)x.add(I.modelId)}const T=new Set(Qo(w,(n==null?void 0:n.superClassCatalog)??[]).map(v=>v.modelId)),M=(((_=n==null?void 0:n.superClassCatalog)==null?void 0:_.length)??0)>0,k=Hn(w.attributes);for(const v of w.indexes??[]){const I=el(v.name);I!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:{max:ri,len:I}}),n!=null&&n.reservedWords&&!Ct(v.name)&&n.reservedWords.has(v.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const O of v.columns){const A=O.columnRef;if(x.has(A)||T.has(A))continue;const L=jn(A);L&&!M||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:L?{name:v.name,field:((g=Br(A))==null?void 0:g.field)??A}:{name:v.name}})}v.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}}),new Set(v.columns.map(O=>k.canon(O.columnRef))).size!==v.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}})}}const u=new Map;for(const w of e.entities)for(const C of w.attributes)C.attrType==="EMBED_OWN"&&C.embedded&&u.set(C.embedded.associationRef,C);for(const w of c){if(xo(w.end1.multiplicity)&&xo(w.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:w.modelId}),u.has(w.modelId)&&w.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:w.modelId}),!u.has(w.modelId)){const C=!!w.end2.attributeRef&&(((E=(b=w.end2.jpa)==null?void 0:b.cascadeTypes)==null?void 0:E.length)??0)>0,S=!!w.end1.attributeRef&&w.end1.navigable&&(((N=(h=w.end1.jpa)==null?void 0:h.cascadeTypes)==null?void 0:N.length)??0)>0;C&&S&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:w.modelId})}if(!u.has(w.modelId)&&w.end1.navigable&&w.end1.attributeRef){const C=i.get(w.end1.entityRef),S=C==null?void 0:C.attributes.some(R=>R.modelId===w.end1.attributeRef),V=i.get(w.end2.entityRef),$=Mc(e,w).length>0;S&&V&&$&&(w.end2.attributeRef&&V.attributes.some(x=>x.modelId===w.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:w.modelId,params:{child:V.name}}))}for(const C of["end1","end2"]){const S=w[C].jpa;if(!S)continue;const V=S.cascadeTypes??[],$=V.includes("ALL"),R=V.includes("REMOVE");$&&V.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:w.modelId,params:{which:C}}),S.orphanRemoval&&(R||$)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:w.modelId,params:{which:C,cascade:$?"ALL":"REMOVE"}}),xo(w[C].multiplicity)&&S.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:w.modelId,params:{which:C}}),S.orphanRemoval&&xo(w[C==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:w.modelId,params:{which:C}}),!xo(w[C].multiplicity)&&(S.collectionType||S.collectionTable||S.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:w.modelId,params:{which:C}}),S.collectionType==="SET"&&S.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:w.modelId,params:{which:C}})}}const m=new Map(e.entities.map(w=>[w.modelId,w.name||w.modelId]));for(const w of Wy(s,c)){const C=[...w,w[0]].map(S=>m.get(S)??S).join(" → ");for(const S of w)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:S,params:{path:C}})}if(n!=null&&n.flagEntitiesWithoutRelations){const w=new Set;for(const S of e.associations)w.add(S.end1.entityRef),w.add(S.end2.entityRef);const C=new Map(e.entities.map(S=>[S.name,S.modelId]));for(const S of e.entities){for(const V of S.attributes)V.embedded&&(w.add(S.modelId),w.add(V.embedded.embeddableRef));if(!Ct(S.superClass)){w.add(S.modelId);const V=C.get(S.superClass);V&&w.add(V)}}for(const S of s)w.has(S.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:S.modelId})}return o}function ol(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return Qy(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 Qy(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=Hn(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 Ro="javax.persistence",lt={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"},eg={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function Fc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Qt(o)?null:o??eg[n]}const ca={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function tg(e){if(!e)return;if(ca[e])return{simpleName:e,fqn:ca[e]};const n=Object.entries(ca).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function Uc(e){return!(Qt(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function ng(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&&(Eo(l)||o.skipUngeneratable!==!1&&!Uc(l)||a.push(ag(l,e,o)))}return a}class Hc{constructor(){ct(this,"imports",new Set);ct(this,"body",[]);ct(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${Ro}.${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 Tc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Mc(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function wo(e,n){n&&(e.import(et.lombokGetter),e.line(" @Getter"))}const Zy=["ko","en","ja","zh"];function Kr(e,n){if(!e)return[];const o=Zy.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 ta(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...Jo,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===zn){if(i){const c=[`${No}.Enumerated`,`${No}.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:[`${No}.Enumerated`,`${No}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===an){const c=Jy(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=Rc(o,"money");return{type:"Money",primitive:!1,imports:c?[et.money,`${No}.Convert`]:[et.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=ea[e];if(s)return{type:e,primitive:!1,imports:[s,et.jdbcTypeCode,et.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 Vc(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function Qo(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return ta(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 ta(e.type,e.customType,o).type;const r=Vc(a);return r.length>=2?`${a.name}PK`:r.length===1?Qo(r[0],n,o,new Set([...i,a.modelId])):ta(e.type,e.customType,o).type}function Gr(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!Wr(n.end2.multiplicity)&&e.dbAttrs.length===1}function Yr(e,n,o){var a;if(e.derivedIdFieldName)return e.derivedIdFieldName;const i=Jr(e,n,o,0);return Mc(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function Qy(e,n,o,i,a){var l;const r=e.derivedFrom?(l=o.get(n.end1.entityRef))==null?void 0:l.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef):void 0;return Qo(r||e,i,a)}function eg(e,n,o){var C,M,B,g,I,v,O;if(e.stereotype==="JPA_EMBEDDABLE")return tg(e,n,o);const i=new $c,a=e.name;let r=ei(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${na}')`),r=na);const l=new Map(n.entities.map(x=>[x.modelId,x])),s=r,c=fg(e,o,i),d=new Map;for(const x of n.associations)x.end2.attributeRef&&d.set(x.end2.attributeRef,{assoc:x,role:"owner"}),x.end1.attributeRef&&x.end1.navigable&&d.set(x.end1.attributeRef,{assoc:x,role:"inverse"});const u=Vc(e),m=new Set;for(const x of u)Gr(x,(C=d.get(x.modelId))==null?void 0:C.assoc)&&m.add(x.modelId);const h=new Set(u.filter(x=>x.attrType==="NORMAL").flatMap(x=>x.dbAttrs.map(z=>z.physicalName)).filter(Boolean)),f=[];for(const x of u){if(!m.has(x.modelId))continue;const z=d.get(x.modelId).assoc,j=x.dbAttrs[0],ne=Jr(x,z,l,0),de=(j==null?void 0:j.physicalName)||ne||"";if(de&&h.has(de))continue;const pe=Yr(x,z,l);if(!pe){i.fillIn(`${a}.${x.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);continue}f.push({modelId:`synthetic-id:${x.modelId}`,name:pe,type:Qy(x,z,l,n,o),attrType:"NORMAL",identifier:!0,notNull:!0,order:x.order,dbAttrs:[{...j??{modelId:`synthetic-col:${x.modelId}`,dataType:""},physicalName:de}]})}const y=[...u.filter(x=>!m.has(x.modelId)),...f].sort((x,z)=>x.order-z.order),k=y.length>=2,_=y.length===1,E=`${a}PK`,N=x=>m.has(x.modelId)?"mapsId":x.identifier?"id":"none",p=o.lombok!==!1;i.jpa("Entity"),i.import(et.jsonIdentityInfo),i.import(et.jsogGenerator);const b=["@Entity"];b.push(lg(e,n,o,i)),b.push('@SuppressWarnings("serial")'),b.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),k&&(i.jpa("IdClass"),i.import(`${r}.${a}.${E}`),b.push(`@IdClass(${a}.${E}.class)`)),(M=e.jpaAttrs)!=null&&M.useDynamicInsert&&(b.push("@DynamicInsert"),i.import(et.dynamicInsert)),(B=e.jpaAttrs)!=null&&B.useDynamicUpdate&&(b.push("@DynamicUpdate"),i.import(et.dynamicUpdate)),(g=e.jpaAttrs)!=null&&g.useCacheable&&(b.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(ng),b.push("@PersonalInfo")),p&&(i.import(et.lombokNoArgs),i.import(et.lombokAccessLevel),b.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const x of Kr((I=e.table)==null?void 0:I.logicalName,""))i.line(x);for(const x of b)i.line(x);const w=e.abstractClass?"abstract ":"";i.line(`public ${w}class ${a}${c}${Oc(e,i)} {`);const A=[...f,...e.attributes.filter(x=>x.attrType!=="DIVIDER")].sort((x,z)=>x.order-z.order),$=new Set(f.map(x=>x.modelId));for(const x of u){if(!m.has(x.modelId))continue;const z=(v=x.dbAttrs[0])==null?void 0:v.physicalName;if(z)for(const j of u)j.attrType==="NORMAL"&&j.dbAttrs.some(ne=>ne.physicalName===z)&&$.add(j.modelId)}const L=(O=e.jpaAttrs)!=null&&O.useVersion?u.length?u[u.length-1].modelId:null:void 0,T=[];for(const x of A){if(x.attrType.startsWith("EMBED"))T.push(...Fc(x,e,n,o,i));else if(x.attrType==="RELATION_OWN"){const z=d.get(x.modelId);if(z){const j=dg(x,z.assoc,s,l,N(x),p,n,o,i);j&&T.push(j)}else sg(x,e,new Set(d.keys()))||i.fillIn(`${e.name}.${x.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`)}else if(x.attrType==="RELATION_REF"){const z=d.get(x.modelId),j=z?ug(x,z.assoc,s,l,p,n,o,i):null;j&&T.push(j)}else T.push(Pc(x,a,o,i,$.has(x.modelId)));x.modelId===L&&Bc(i,T,p)}L===null&&Bc(i,T,p),p||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Dc(T,i,p),Lc(e,i),k&&(i.import(et.jsonBackReference),i.import(et.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 ${E} getPK() {`),i.line(` return (${E}) HibernateBeanUtil.getPK(this);`),i.line(" }"),pg(E,y.map(x=>({type:Qo(x,n,o),name:x.name})),p,i)),i.line("}");let S;return k?S=hg(a,E,r):_&&(S=yg(a,r,Qo(y[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:S}}function Bc(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 Dc(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${Tc(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 tg(e,n,o){var d;const i=new $c,a=e.name;let r=ei(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${na}')`),r=na),i.jpa("Embeddable"),i.import(et.jsonIdentityInfo),i.import(et.jsogGenerator),i.import(et.serializable);for(const u of Kr((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}${Oc(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(...Fc(u,e,n,o,i));continue}c.push(Pc(u,a,o,i))}return Dc(c,i,o.lombok!==!1),Lc(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Oc(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 ng="net.g1project.bluecomm.annotation.PersonalInfo",og="net.g1project.bluecomm.annotation.PersonalInfoAttribute",ig="net.g1project.bluecomm.model.PersonalInfoAttributeType";function Lc(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,`
|
|
18
|
+
`}}function jc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Kc(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function Ao(e,n){n&&(e.import(lt.lombokGetter),e.line(" @Getter"))}const og=["ko","en","ja","zh"];function il(e,n){if(!e)return[];const o=og.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 da(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...ii,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Yn){if(i){const c=[`${Ro}.Enumerated`,`${Ro}.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:[`${Ro}.Enumerated`,`${Ro}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===hn){const c=tg(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=Fc(o,"money");return{type:"Money",primitive:!1,imports:c?[lt.money,`${Ro}.Convert`]:[lt.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=ca[e];if(s)return{type:e,primitive:!1,imports:[s,lt.jdbcTypeCode,lt.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 al(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function li(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return da(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 da(e.type,e.customType,o).type;const r=al(a);return r.length>=2?`${a.name}PK`:r.length===1?li(r[0],n,o,new Set([...i,a.modelId])):da(e.type,e.customType,o).type}function ua(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!ma(n.end2.multiplicity)&&e.dbAttrs.length===1}function rl(e,n,o){var a;if(e.derivedIdFieldName)return e.derivedIdFieldName;const i=cl(e,n,o,0);return Kc(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function ig(e,n,o,i,a){var l;const r=e.derivedFrom?(l=o.get(n.end1.entityRef))==null?void 0:l.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef):void 0;return li(r||e,i,a)}function ll(e,n,o){var y,_,g;const i=new Map(n.entities.map(b=>[b.modelId,b])),a=Dr(n.associations),r=new Map;for(const b of n.associations)b.end2.attributeRef&&r.set(b.end2.attributeRef,{assoc:b,role:"owner"}),b.end1.attributeRef&&b.end1.navigable&&r.set(b.end1.attributeRef,{assoc:b,role:"inverse"});const l=al(e),s=new Set;for(const b of l)ua(b,(y=r.get(b.modelId))==null?void 0:y.assoc)&&s.add(b.modelId);const c=new Set(l.filter(b=>b.attrType==="NORMAL").flatMap(b=>b.dbAttrs.map(E=>E.physicalName)).filter(Boolean)),d=[],u=[];for(const b of l){if(!s.has(b.modelId))continue;const E=r.get(b.modelId).assoc,h=b.dbAttrs[0],N=(h==null?void 0:h.physicalName)||cl(b,E,i,0)||"";if(N&&c.has(N))continue;const w=rl(b,E,i);if(!w){u.push(b);continue}const C=b.derivedFrom?(_=i.get(E.end1.entityRef))==null?void 0:_.attributes.find(S=>S.modelId===b.derivedFrom.sourceAttributeRef):void 0;d.push({attr:{modelId:`synthetic-id:${b.modelId}`,name:w,type:o?o(b,E):(C==null?void 0:C.type)??b.type,customType:(C==null?void 0:C.customType)??b.customType,attrType:"NORMAL",identifier:!0,notNull:!0,order:b.order,dbAttrs:[{...h??{modelId:`synthetic-col:${b.modelId}`,dataType:""},physicalName:N}]},role:"scalar",synthetic:!0,sourceAttr:b})}const m=[],p=[];for(const b of e.attributes)if(b.attrType!=="DIVIDER"){if(b.attrType.startsWith("EMBED")){p.push({attr:b,role:"embed",synthetic:!1,sourceAttr:b,collection:na(b,n.associations)});continue}if(b.attrType==="RELATION_OWN"){const E=r.get(b.modelId);E?p.push({attr:b,role:"relation-owner",synthetic:!1,sourceAttr:b,assoc:E.assoc,target:i.get(E.assoc.end1.entityRef)}):Or(b,e,a)?m.push({attr:b,reason:"join-column-only"}):m.push({attr:b,reason:"no-anchor"});continue}if(b.attrType==="RELATION_REF"){const E=r.get(b.modelId);if(!E){m.push({attr:b,reason:"nav-not-materialized"});continue}p.push({attr:b,role:"relation-inverse",synthetic:!1,sourceAttr:b,assoc:E.assoc,target:i.get(E.assoc.end2.entityRef),collection:ma(E.assoc.end2.multiplicity)?((g=E.assoc.end2.jpa)==null?void 0:g.collectionType)??"LIST":void 0});continue}p.push({attr:b,role:"scalar",synthetic:!1,sourceAttr:b})}return{fields:[...d,...p].sort((b,E)=>b.attr.order-E.attr.order),omitted:m,unresolvedDerivedIds:u}}function ag(e,n,o){var x,T,M,k,v,I,O;if(e.stereotype==="JPA_EMBEDDABLE")return rg(e,n,o);const i=new Hc,a=e.name;let r=si(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${fa}')`),r=fa);const l=new Map(n.entities.map(A=>[A.modelId,A])),s=r,c=gg(e,o,i),d=new Map;for(const A of n.associations)A.end2.attributeRef&&d.set(A.end2.attributeRef,{assoc:A,role:"owner"}),A.end1.attributeRef&&A.end1.navigable&&d.set(A.end1.attributeRef,{assoc:A,role:"inverse"});const u=al(e),m=new Set;for(const A of u)ua(A,(x=d.get(A.modelId))==null?void 0:x.assoc)&&m.add(A.modelId);const p=ll(e,n,(A,L)=>ig(A,L,l,n,o)),f=p.fields.filter(A=>A.synthetic).map(A=>A.attr);for(const A of p.unresolvedDerivedIds)i.fillIn(`${a}.${A.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);for(const A of p.omitted)A.reason==="no-anchor"&&i.fillIn(`${e.name}.${A.attr.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`);const y=[...u.filter(A=>!m.has(A.modelId)),...f].sort((A,L)=>A.order-L.order),_=y.length>=2,g=y.length===1,b=`${a}PK`,E=A=>m.has(A.modelId)?"mapsId":A.identifier?"id":"none",h=o.lombok!==!1;i.jpa("Entity"),i.import(lt.jsonIdentityInfo),i.import(lt.jsogGenerator);const N=["@Entity"];N.push(mg(e,n,o,i)),N.push('@SuppressWarnings("serial")'),N.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),_&&(i.jpa("IdClass"),i.import(`${r}.${a}.${b}`),N.push(`@IdClass(${a}.${b}.class)`)),(T=e.jpaAttrs)!=null&&T.useDynamicInsert&&(N.push("@DynamicInsert"),i.import(lt.dynamicInsert)),(M=e.jpaAttrs)!=null&&M.useDynamicUpdate&&(N.push("@DynamicUpdate"),i.import(lt.dynamicUpdate)),(k=e.jpaAttrs)!=null&&k.useCacheable&&(N.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(lg),N.push("@PersonalInfo")),h&&(i.import(lt.lombokNoArgs),i.import(lt.lombokAccessLevel),N.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const A of il((v=e.table)==null?void 0:v.logicalName,""))i.line(A);for(const A of N)i.line(A);const w=e.abstractClass?"abstract ":"";i.line(`public ${w}class ${a}${c}${qc(e,i)} {`);const C=p.fields.map(A=>A.attr),S=new Set(f.map(A=>A.modelId));for(const A of u){if(!m.has(A.modelId))continue;const L=(I=A.dbAttrs[0])==null?void 0:I.physicalName;if(L)for(const H of u)H.attrType==="NORMAL"&&H.dbAttrs.some(oe=>oe.physicalName===L)&&S.add(H.modelId)}const V=(O=e.jpaAttrs)!=null&&O.useVersion?u.length?u[u.length-1].modelId:null:void 0,$=[];for(const A of C){if(A.attrType.startsWith("EMBED"))$.push(...Zc(A,e,n,o,i));else if(A.attrType==="RELATION_OWN"){const L=d.get(A.modelId),H=pg(A,L.assoc,s,l,E(A),h,n,o,i);H&&$.push(H)}else if(A.attrType==="RELATION_REF"){const L=d.get(A.modelId),H=hg(A,L.assoc,s,l,h,n,o,i);H&&$.push(H)}else $.push(Jc(A,a,o,i,S.has(A.modelId)));A.modelId===V&&Gc(i,$,h)}V===null&&Gc(i,$,h),h||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Yc($,i,h),Wc(e,i),_&&(i.import(lt.jsonBackReference),i.import(lt.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 ${b} getPK() {`),i.line(` return (${b}) HibernateBeanUtil.getPK(this);`),i.line(" }"),bg(b,y.map(A=>({type:li(A,n,o),name:A.name})),h,i)),i.line("}");let R;return _?R=_g(a,b,r):g&&(R=kg(a,r,li(y[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:R}}function Gc(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 Yc(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${jc(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 rg(e,n,o){var d;const i=new Hc,a=e.name;let r=si(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${fa}')`),r=fa),i.jpa("Embeddable"),i.import(lt.jsonIdentityInfo),i.import(lt.jsogGenerator),i.import(lt.serializable);for(const u of il((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}${qc(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(...Zc(u,e,n,o,i));continue}c.push(Jc(u,a,o,i))}return Yc(c,i,o.lombok!==!1),Wc(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function qc(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 lg="net.g1project.bluecomm.annotation.PersonalInfo",sg="net.g1project.bluecomm.annotation.PersonalInfoAttribute",cg="net.g1project.bluecomm.model.PersonalInfoAttributeType";function Wc(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Qt(i.name)||Qt(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(sg),n.import(cg),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function Jc(e,n,o,i,a=!1){const r=e.dbAttrs[0],l=e.name||Kc(r==null?void 0:r.physicalName)||"unnamedField";e.name||i.fillIn(`${n}.${l}: 속성 이름 미지정 — 물리명 '${(r==null?void 0:r.physicalName)??""}'에서 파생, 모델 정정 필요`);const s=da(e.type,e.customType,o,e.groupCode);for(const m of s.imports)i.import(m);for(const m of s.fillIns)i.fillIn(`${n}.${l}: ${m}`);const c=(r==null?void 0:r.multiValue)===!0,d=c?`Set<${s.type}>`:s.type;c&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${n}.${l}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const m of il(r==null?void 0:r.logicalName," "))i.line(m);e.identifier&&(i.jpa("Id"),i.line(" @Id"),r!=null&&r.autoIncrement&&a?i.fillIn(`${n}.${l}: 파생 식별(@MapsId) 스칼라에 autoIncrement 지정 — 값의 출처가 연관이므로 @GeneratedValue 미방출, 모델 확인 필요`):r!=null&&r.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(lt.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${yg(e,r,i,a)}`);for(const m of s.fieldAnnotations)i.line(` ${m}`);const u=!c&&(r==null?void 0:r.dataType)==="VARCHAR"?e.type==="PrimitiveBoolean"?"booleanYnPrimitive":e.type==="Boolean"?"booleanYnBoxed":null:null;if(u){const m=Fc(o,u);m?(i.jpa("Convert"),i.line(` @Convert(converter = ${m}.class)`)):i.fillIn(`${n}.${l}: Y/N 문자 플래그 컨버터 비활성(converterCatalog) — boolean × VARCHAR 매핑 @Convert 손채움 필요`)}return c?(i.line(` // TODO [손채움]: ${l} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),Ao(i,o.lombok!==!1),i.line(` private ${d} ${l} = new LinkedHashSet<>();`)):(Ao(i,o.lombok!==!1),i.line(` private ${d} ${l};`)),{type:d,name:l,category:0}}function Xc(e,n,o){var s,c;if(e.attrType==="EMBED_PREDEF"){const d=(s=o.embeddableCatalog)==null?void 0:s.find(u=>u.type===e.type);return e.dbAttrs.map((u,m)=>{var p,f;return{propertyPath:((p=d==null?void 0:d.fields[m])==null?void 0:p.name)??"",defaultPhysical:((f=d==null?void 0:d.fields[m])==null?void 0:f.physicalName)??""}})}const i=(c=e.embedded)!=null&&c.embeddableRef?n.entities.find(d=>d.modelId===e.embedded.embeddableRef):void 0,a=fn(i,{entities:n.entities,embeddableCatalog:o.embeddableCatalog}),r=d=>({propertyPath:d.propertyPath,defaultPhysical:d.defaultPhysical,...d.defaultSharedRef!=null?{defaultSharedRef:d.defaultSharedRef}:{}});return e.dbAttrs.length===a.length?a.map(r):a.filter(d=>!!d.defaultPhysical).map(r)}function dg(e,n,o,i,a,r){var u;const l=ko($n(n,o.entities)),s=m=>{var p;return m==null?"":((p=l.get(m))==null?void 0:p.physicalName)??""},c=e.dbAttrs.length===fn((u=e.embedded)!=null&&u.embeddableRef?o.entities.find(m=>m.modelId===e.embedded.embeddableRef):void 0).length,d=[];return e.dbAttrs.forEach((m,p)=>{const f=i[p],y=c?pn(e,m,p,n,o,{embeddableCatalog:a.embeddableCatalog}):m,_=Gn(y,l),g=_?_.physicalName:y.physicalName||"",b=(f==null?void 0:f.defaultSharedRef)!=null?s(f.defaultSharedRef):(f==null?void 0:f.defaultPhysical)??"";if(!(!g||g===b)){if(!f||!f.propertyPath){r.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${p}] @AttributeOverride 프로퍼티 경로 미해소(카탈로그/중첩 임베더블 형상 확인)`);return}d.push(_?`@AttributeOverride(name = "${f.propertyPath}", column = @Column(name = "${g}", insertable = false, updatable = false))`:`@AttributeOverride(name = "${f.propertyPath}", column = @Column(name = "${g}"))`)}}),d}function Qt(e){return!e||e.trim()===""}function Zc(e,n,o,i,a){var m,p,f,y;const r=n.name,l=si(n,o,i);if(Qt(e.name))return a.fillIn(`${r} 임베드: 속성명(필드명) 미지정 — @Embedded/@ElementCollection 방출 불가, 속성명을 채워야 함`),[];let s=e.type;if(e.attrType==="EMBED_OWN"){const _=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(g=>g.modelId===e.embedded.embeddableRef):void 0;if(_){s=_.name;const g=si(_,o,i);g&&g!==l&&a.import(`${g}.${_.name}`)}}if(Qt(s))return a.fillIn(`${r}.${e.name}: 임베드 대상 타입 미해소 — @Embedded/@ElementCollection 방출 불가`),[];if(e.type==="Money")return[ug(e,n,o,i,a)];const c=Xc(e,o,i),d=dg(e,n,o,c,i,a),u=na(e,o.associations);if(a.line(""),u){const _=o.associations.find(w=>{var C;return w.modelId===((C=e.embedded)==null?void 0:C.associationRef)}),g=_?_.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?_.end2:_.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const b=(f=g==null?void 0:g.jpa)==null?void 0:f.collectionTable;b?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${b}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),sl(d,a);const E=u==="SET";!E&&((y=g==null?void 0:g.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${g.jpa.orderColumn}")`)),a.import(E?"java.util.Set":"java.util.List"),a.import(E?"java.util.LinkedHashSet":"java.util.ArrayList");const h=E?`Set<${s}>`:`List<${s}>`,N=E?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${N};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),sl(d,a),Ao(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function ug(e,n,o,i,a){a.jpa("Embedded"),a.import(lt.compositeType),a.import(lt.money),a.import(lt.moneyUserType);const r=Xc(e,o,i),l=ko($n(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var g,b;const u=((g=r[d])==null?void 0:g.propertyPath)||(d===0?"amount":d===1?"currency":`field${d}`),m=Gn(c,l),p=((b=r[d])==null?void 0:b.defaultPhysical)||"",f=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!f||f===p))return[];const _=[`name = "${m?m.physicalName:f||p}"`];return e.notNull&&_.push("nullable = false"),m?_.push("insertable = false","updatable = false"):(c.insertable===!1&&_.push("insertable = false"),c.updatable===!1&&_.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${_.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),sl(s,a),Ao(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function sl(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 mg(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,y)=>s.set(f.modelId,ni(p,f,y,e,n,l)));for(const p of Qo(e,o.superClassCatalog??[]))s.set(p.modelId,p.physicalName);const c=Hn(e.attributes),d=[];for(const p of r){const f=[];for(const _ of p.columns){const g=s.get(c.canon(_.columnRef));if(!g){i.fillIn(`${e.name}.@Index(${p.name}): 컬럼 참조 미해소(${Js(c,_.columnRef)}) — 카탈로그 확인`);continue}f.includes(g)||f.push(g)}if(!f.length)continue;const y=p.unique?", unique = true":"";d.push(`@Index(name = "${p.name}", columnList = "${f.join(", ")}"${y})`)}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 ma(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function cl(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=ti(a)[i])==null?void 0:r.physicalName}return(l=ti(a)[i])==null?void 0:l.physicalName}function fg(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 Qc(e,n,o,i,a){if(!e)return;const r=si(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function pg(e,n,o,i,a,r,l,s,c){var b;const d=i.get(n.end1.entityRef),u=(d==null?void 0:d.name)??n.end1.entityRef;if(Qt(e.name)||Qt(u))return c.fillIn(`${u||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @ManyToOne/@OneToOne 방출 불가`),null;const m=ma(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),Qc(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}`)),(b=p==null?void 0:p.cascadeTypes)!=null&&b.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${p.cascadeTypes.map(E=>`CascadeType.${E}`).join(", ")} }`)),c.jpa("JoinColumn");const y=i.get(n.end2.entityRef),_=y?fg(e,n,y,i):[e],g=[];for(const E of _){const h=Math.max(1,E.dbAttrs.length);for(let N=0;N<h;N++){const w=E.dbAttrs[N],C=cl(E,n,i,N),S=(w==null?void 0:w.physicalName)||C||"",V=[];S?V.push(`name = "${S}"`):c.fillIn(`${(y==null?void 0:y.name)??""}.${E.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),C&&V.push(`referencedColumnName = "${C}"`),E.notNull&&V.push("nullable = false"),(w==null?void 0:w.insertable)===!1&&V.push("insertable = false"),(w==null?void 0:w.updatable)===!1&&V.push("updatable = false"),g.push(`@JoinColumn(${V.join(", ")})`)}}return c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${f.length?`(${f.join(", ")})`:""}`),g.length===1?c.line(` ${g[0]}`):(c.jpa("JoinColumns"),c.line(` @JoinColumns({${g[0]},`),g.slice(1).forEach((E,h)=>{const N=h===g.length-2;c.line(` ${E}${N?"})":","}`)})),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),Ao(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function hg(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(Qt(e.name)||Qt(d))return s.fillIn(`${d||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @OneToMany/@OneToOne 방출 불가`),null;const u=c==null?void 0:c.attributes.find(w=>w.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;Qc(c,o,r,l,s);const p=ma(n.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),Ao(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const f=n.end1.jpa,y=n.end1.composition||n.end2.composition;let _=(f==null?void 0:f.cascadeTypes)??[],g=f==null?void 0:f.orphanRemoval;y&&_.length===0&&(_=["ALL"],g==null&&(g=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const b=[`mappedBy = "${m}"`];_.length&&(s.jpa("CascadeType"),b.push(`cascade = { ${_.map(w=>`CascadeType.${w}`).join(", ")} }`)),g&&b.push("orphanRemoval = true"),f!=null&&f.fetchType&&(s.jpa("FetchType"),b.push(`fetch = FetchType.${f.fetchType}`)),s.line(` @OneToMany(${b.join(", ")})`),f!=null&&f.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${f.orderBy}")`));const E=(f==null?void 0:f.collectionType)==="SET";s.import(E?"java.util.Set":"java.util.List"),s.import(E?"java.util.LinkedHashSet":"java.util.ArrayList");const h=E?`Set<${d}>`:`List<${d}>`,N=E?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${h} ${e.name} = ${N};`),{type:h,name:e.name,category:1,collection:!0}}function yg(e,n,o,i=!1){o.jpa("Column");const a=[`name = "${(n==null?void 0:n.physicalName)??""}"`];if(e.notNull&&a.push("nullable = false"),n){const r=Kr.has(n.dataType);n.length!=null&&a.push(r?`precision = ${n.length}`:`length = ${n.length}`),n.scale!=null&&a.push(`scale = ${n.scale}`),i?a.push("insertable = false","updatable = false"):(n.insertable===!1&&a.push("insertable = false"),n.updatable===!1&&a.push("updatable = false")),n.unique&&a.push("unique = true")}return`@Column(${a.join(", ")})`}function gg(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 bg(e,n,o,i){i.import(lt.serializable),i.import(lt.objects),i.import(lt.jsonUtils),o&&i.import(lt.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${jc(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 _g(e,n,o){const i=[`${o}.${e}`,`${o}.${e}.${n}`,lt.jpaRepository,lt.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 kg(e,n,o){const i=[`${n}.${e}`,lt.jpaRepository,lt.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 na="com.example",gg="command.domain";function ei(e,n,o={}){const i=Ji(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??gg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const bg="CustomMoneyType",_g="Money";function kg(e){return!(e.type!==bg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Eg(e){const n=e.dbAttrs[0]??{modelId:De(),physicalName:"",dataType:""},o={modelId:De(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:_g,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Ng(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>kg(l)?(a=!0,n=!0,Eg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function wg(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const k=new Map,_=new Map,E=new Map,N=(p,b,w)=>{if(!p)return;o.get(p)||o.set(p,[{entityId:b,assignedId:p}]),i.push({id:p,entityId:b,sink:w}),w(p)};for(const p of y.attributes){N(p.modelId,y.modelId,b=>k.set(p,b));for(const b of p.dbAttrs)N(b.modelId,y.modelId,w=>_.set(b,w))}for(const p of y.indexes??[])N(p.modelId,y.modelId,b=>E.set(p,b));a.set(y,{attrs:k,cols:_,idx:E})}const r=new Set(o.keys()),l=new Map;for(const y of i){const k=(l.get(y.id)??0)+1;if(l.set(y.id,k),k===1)continue;const _=Ig(y.id,k-1,r);r.add(_),o.get(y.id).push({entityId:y.entityId,assignedId:_}),y.sink(_)}const s=[...o.values()].reduce((y,k)=>y+Math.max(0,k.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,k)=>{var E;if(!k||!y)return k;const _=o.get(k);return!_||_.length<2?k:((E=_.find(N=>N.entityId===y))==null?void 0:E.assignedId)??k},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,k)=>{const _=d.get(y);if(_)return _.end1.entityRef===k?_.end2.entityRef:_.end1.entityRef},m=e.entities.map(y=>{var p;const k=a.get(y),_=y.attributes.map(b=>{const w=k.attrs.get(b),A=b.dbAttrs.map(T=>{const S=k.cols.get(T);return S===T.modelId?T:{...T,modelId:S}});let $=b.derivedFrom;if($){const T=u($.associationRef,y.modelId),S=c(T,$.sourceAttributeRef);S!==$.sourceAttributeRef&&($={...$,sourceAttributeRef:S})}return w!==b.modelId||$!==b.derivedFrom||A.some((T,S)=>T!==b.dbAttrs[S])?{...b,modelId:w,dbAttrs:A,derivedFrom:$}:b}),E=(p=y.indexes)==null?void 0:p.map(b=>{const w=k.idx.get(b),A=b.columns.map(L=>{const T=c(y.modelId,L.columnRef);return T===L.columnRef?L:{...L,columnRef:T}});return w!==b.modelId||A.some((L,T)=>L!==b.columns[T])?{...b,modelId:w,columns:A}:b});return _.some((b,w)=>b!==y.attributes[w])||E&&y.indexes&&E.some((b,w)=>b!==y.indexes[w])?{...y,attributes:_,...E?{indexes:E}:{}}:y}),h=e.associations.map(y=>{const k=c(y.end1.entityRef,y.end1.attributeRef),_=c(y.end2.entityRef,y.end2.attributeRef);return k===y.end1.attributeRef&&_===y.end2.attributeRef?y:{...y,end1:k===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:k},end2:_===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:_}}}),f=n.associationLayouts.map(y=>{const k=d.get(y.associationRef);if(!k)return y;const _=c(k.end1.entityRef,y.sourceColumnRef),E=c(k.end2.entityRef,y.targetColumnRef);return _===y.sourceColumnRef&&E===y.targetColumnRef?y:{...y,sourceColumnRef:_,targetColumnRef:E}});return{logical:{...e,entities:m,associations:h},layout:f.some((y,k)=>y!==n.associationLayouts[k])?{...n,associationLayouts:f}:n,reissued:s}}function Ig(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 Xr(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 jc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Kc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(jc);if(!i.length)continue;const a=o.filter(s=>!jc(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 Io(e){return JSON.parse(JSON.stringify(e))}function Gc(e,n,o){var L;const i=o.idFactory??De,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 S of r.associations){const C=T.has(S.end1.entityRef),M=T.has(S.end2.entityRef);C!==M&&s.add(C?S.end2.entityRef:S.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,f=T=>{let S=h.get(T);return S||(S=i(),h.set(T,S)),S};for(const T of c){f(T.modelId);for(const S of T.attributes){f(S.modelId);for(const C of S.dbAttrs)f(C.modelId)}for(const S of T.indexes??[])f(S.modelId);for(const S of T.operations??[])f(S.modelId)}for(const T of u)f(T.modelId);const y=T=>h.get(T),k=c.map(T=>{const S=Io(T);S.modelId=y(T.modelId),S.attributes=S.attributes.map(C=>vg(C,y,m,d));for(const C of S.indexes??[])C.modelId=y(C.modelId),C.columns=C.columns.map(M=>Ln(M.columnRef)?M:{...M,columnRef:y(M.columnRef)}).filter(M=>M.columnRef!==void 0);for(const C of S.operations??[])C.modelId=y(C.modelId);return S});Kc(k);const _=u.map(T=>{const S=Io(T);return S.modelId=y(T.modelId),S.end1=Yc(S.end1,y),S.end2=Yc(S.end2,y),S}),E=[];for(const T of r.groups){const S=T.memberEntityRefs.filter(M=>d.has(M));if(S.length===0)continue;const C=Io(T);C.modelId=f(T.modelId),C.memberEntityRefs=S.map(M=>y(M)),E.push(C)}const N=o.collisionSuffix??"_imported",p=new Set(o.existing.entities.map(T=>T.name)),b=new Set(o.existing.entities.map(T=>{var S;return(S=T.table)==null?void 0:S.physicalName}).filter(T=>!!T));for(const T of k)p.has(T.name)&&(T.name=`${T.name}${N}`),(L=T.table)!=null&&L.physicalName&&b.has(T.table.physicalName)&&(T.table.physicalName=`${T.table.physicalName}${N}`);const w=[];for(const T of l.entityLayouts){const S=y(T.entityRef);if(!S)continue;const C=Io(T);C.entityRef=S,C.geo={...C.geo,location:Zr(C.geo.location,a)},C.attributeStyles&&(C.attributeStyles=oa(C.attributeStyles,y)),C.operationStyles&&(C.operationStyles=oa(C.operationStyles,y)),w.push(C)}const A=[];for(const T of l.associationLayouts){const S=y(T.associationRef);if(!S)continue;const C=Io(T);C.associationRef=S,C.sourceColumnRef=T.sourceColumnRef?y(T.sourceColumnRef):void 0,C.targetColumnRef=T.targetColumnRef?y(T.targetColumnRef):void 0,C.waypoints=C.waypoints.map(M=>Zr(M,a)),A.push(C)}const $=[];for(const T of l.groupLayouts){const S=y(T.groupRef);if(!S)continue;const C=Io(T);C.groupRef=S,C.geo={...C.geo,location:Zr(C.geo.location,a)},delete C.memberNoteRefs,$.push(C)}return{logical:{entities:k,associations:_,groups:E},layout:{entityLayouts:w,associationLayouts:A,groupLayouts:$},idMap:h}}function Zr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function vg(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 Yc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function oa(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 Hn(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)=>Hn(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(!Hn(e[i],n[i]))return!1;return!0}return!1}function jn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||Hn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Kn(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 Cg(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 xg=new Set(["attributes","operations","indexes","rev"]),Sg=new Set(["end1","end2","rev"]),Rg=new Set(["memberEntityRefs","rev"]),qc=new Set(["modelId"]),Ag=new Set(["modelId","columns"]),$g=new Set([]);function Tg(e,n,o,i){const a=Kn(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=jn(s,c,qc);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Kn(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=jn(s,c,qc);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Kn(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(!Hn(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=jn(s,c,Ag);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Mg(e,n,o){const i=Kn(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=jn(l,s,xg);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Tg(l.modelId,l,s,o)}const a=Kn(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=jn(l,s,Sg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=jn(l[d]??{},s[d]??{},$g);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=Kn(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=jn(l,s,Rg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Cg(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 ia(e,n,o,i,a,r,l){const s=Kn(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)Hn(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 Vg(e,n,o){ia(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ia(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ia(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ia(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Bg(e,n){const o=[];return Mg(e.logical,n.logical,o),Vg(e.layout,n.layout,o),o}function Dg(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 Og={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 Lg{constructor(n){nt(this,"out",[]);nt(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({...ti(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({...ti(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({...ti(n),field:a,value:void 0,removed:!0});continue}this.out.push({...ti(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({...ti(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function ti(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=Og[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Gn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function el(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Cn(e,n){var r,l,s,c,d,u,m,h;const o=Dg(n),i=new Lg(n.field),a=[...e].sort((f,y)=>f.seq-y.seq);for(const f of a)for(const y of f.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?Ht(i,f,y.value,"entity"):y.kind==="entity.update"?Gn(i,f,y.patch):y.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const k=el((r=y.value)==null?void 0:r.attributes,n.attributeRef);k&&Ht(i,f,k,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?Ht(i,f,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Gn(i,f,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(f);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const k=el((s=y.value)==null?void 0:s.operations,n.operationRef);k&&Ht(i,f,k,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?Ht(i,f,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Gn(i,f,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(f);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const k=el((d=y.value)==null?void 0:d.indexes,n.indexRef);k&&Ht(i,f,k,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?Ht(i,f,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Gn(i,f,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(f);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?Ht(i,f,y.value,"association"):y.kind==="association.update"?Gn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const k=(m=y.value)==null?void 0:m[n.end];Ht(i,f,k,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Gn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){Ht(i,f,y.value,"group");const k=(h=y.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(k))for(const _ of k)i.member(f,_,!1)}else y.kind==="group.update"?Gn(i,f,y.patch):y.kind==="group.remove"?i.remove(f):y.kind==="group.addMember"&&y.entityRef!=null?i.member(f,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(f,y.entityRef,!0);break}return i.result()}const Ze={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},Pg={"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":Ze,"entityLayout.remove":Ze,"entityLayout.move":Ze,"entityLayout.resize":Ze,"entityLayout.setCollapsed":Ze,"entityLayout.setLocked":Ze,"entityLayout.setStyle":Ze,"entityLayout.setAttrStyle":Ze,"entityLayout.setOpStyle":Ze,"groupLayout.add":Ze,"groupLayout.remove":Ze,"groupLayout.move":Ze,"groupLayout.resize":Ze,"groupLayout.setLocked":Ze,"groupLayout.setStyle":Ze,"groupLayout.addNoteMember":Ze,"groupLayout.removeNoteMember":Ze,"associationLayout.add":Ze,"associationLayout.remove":Ze,"associationLayout.setWaypoints":Ze,"note.add":Ze,"note.remove":Ze,"note.move":Ze,"note.resize":Ze,"note.setMemo":Ze,"note.setStyle":Ze,"noteConnection.add":Ze,"noteConnection.remove":Ze,"noteConnection.setWaypoints":Ze},At=e=>typeof e=="string"?e:void 0,zg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Wc(e){return At(e.containerRef)??At(e.entityRef)}function tl(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 nl(e){const n=Pg[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,...tl(o,"attributes","attribute",a),...tl(o,"operations","operation",a),...tl(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Wc(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?zg(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 Fg(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=Wc(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 Ug(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Hg(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 nl(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 aa(e,n){return e.map(o=>({...o,subject:n}))}function Jc(e,n){const o=e.filter(s=>s.ops.some(c=>Ug(c,n))),{attributes:i,operations:a,indexes:r}=Hg(o,n),l=[...aa(Cn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...aa(Cn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...aa(Cn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...aa(Cn(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 ol(e){return`${e.kind}:${e.ref}:${e.end??""}`}function jg(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of nl(i))a.existence==="add"&&n.add(ol(a.subject));return n}function Kg(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=Fg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Gg(e){const{entities:n,associations:o,groups:i}=Kg(e),a=[];for(const r of n)for(const l of Jc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Cn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Cn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Cn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function il(e){const n=Gg(e),o=jg(e),i=new Map;for(const l of n){const s=ol(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=ol(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 Xc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Yg(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 nl(r)){if(!l.existence||l.inline)continue;const s=l.subject;qg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const qg=new Set(["attribute","operation","index"]);function al(e,n){const{fromSeq:o}=n,i=il(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=Xc(m.subject);let f=s.get(h);f||(f={subject:m.subject,evs:[]},s.set(h,f)),f.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 Yg(e,o,r)){const h=s.get(Xc(m.subject));h!=null&&h.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,y)=>f.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",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||h&&f)continue;const y=new Map;let k=null;for(const E of m.evs){E.verb==="add"&&k!==null&&k!=="add"&&y.clear(),k=E.verb;for(const N of E.fields){const p=y.get(N.field);p?p.lastValue=N.value:y.set(N.field,{firstOld:N.oldValue,hasOld:N.oldValue!==void 0,lastValue:N.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(h){const E=[];for(const[N,p]of y)E.push({field:N,value:p.lastValue});d.push({subject:m.subject,verb:"added",fields:E});continue}const _=[];for(const[E,N]of y)N.hasOld&&Hn(N.firstOld,N.lastValue)||_.push({field:E,value:N.lastValue,...N.hasOld?{oldValue:N.firstOld}:{}});_.length!==0&&d.push({subject:m.subject,verb:"modified",fields:_})}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 rl{constructor(n){nt(this,"undoStack",[]);nt(this,"redoStack",[]);nt(this,"savePoint",null);nt(this,"listeners",new Set);nt(this,"commandListeners",new Set);nt(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 Et(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Qc(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 it(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function rn(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 ra(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=Qc(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 ed(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Qc(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(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 td(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=it(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(it(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Et(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Et(o)}]}}}}function nd(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=it(i,e);o=a.name,a.name=n},invert(i){it(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 vo(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 od(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 ni(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 id(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=ni(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 ad(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 rd(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 ll(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 la(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=ni(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 sa(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 ld(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:Et(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Et(o)}]}}}}function sd(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 cd(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 ca(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 dd(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 ud(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 md(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=ni(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 fd(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){it(o,e).attributes.push(n)},invert(o){const i=it(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 Kt(e,n,o){const i={},a=r=>{const l=it(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:Et(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Et(i)}]}}}}function pd(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=it(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&&it(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 hd(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 sl(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=it(a,e);i=r.attributes.map(s=>({...s}));const l=Xr([...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&&it(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=it(a,e).attributes;return hd("attribute.update","attributeRef",e,r,i??[])}}}function yd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=it(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=it(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 gd(e,n,o){const i={},a=r=>{var s;const l=(s=it(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:Et(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Et(i)}]}}}}function bd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=it(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=it(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 _d(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=it(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Xr([...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=it(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=it(a,e).operations??[];return hd("operation.update","operationRef",e,r,i??[])}}}function kd(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=ni(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 da(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 Ed(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 ua(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:Et(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Et(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:Et(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Et(i)}]}}}}function Nd(e,n){return{label:"인덱스 추가",apply(o){const i=it(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=it(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 ma(e,n,o){const i={},a=r=>{var s;const l=(s=it(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:Et(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Et(i)}]}}}}function wd(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=it(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&&it(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 Gt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),oi=(e,n)=>{var o;return((o=$t(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Id(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=oi(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Gt(e,r)],invert:[Gt(e,l)]}}}}function vd(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=oi(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Gt(e,a)],invert:[Gt(e,r)]}}}}function Cd(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:[Gt(e,oi(a,e))],invert:[Gt(e,i??[])]}}}}function xd(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:[Gt(e,oi(o,e))],invert:[Gt(e,n??[])]}}}}function Sd(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=oi(i,e),r=a.slice();return r.splice(n,1),{forward:[Gt(e,a)],invert:[Gt(e,r)]}}}}function Rd(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 Ad(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 ii(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 Td(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 Md(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=ni(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 Vd(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 Bd(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 xn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),fa=(e,n,o)=>{var i;return((i=rn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Dd(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 Od(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 Ld(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=rn(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=rn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=fa(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[xn(e,n,l)],invert:[xn(e,n,s)]}}}}function Pd(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=rn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=rn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=fa(a,e,n),l=r.slice();return l.splice(o,1),{forward:[xn(e,n,r)],invert:[xn(e,n,l)]}}}}function zd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=rn(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=rn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=fa(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[xn(e,n,r)],invert:[xn(e,n,l)]}}}}function Fd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=rn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=rn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[xn(e,n,fa(i,e,n))],invert:[xn(e,n,o??[])]}}}}function Qe(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 Wg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:da,addAttribute:jt,addEntity:ra,addEntityToGroup:cd,addGroup:sa,addIndex:Nd,addNote:Rd,addNoteConnection:Dd,addNoteConnectionWaypoint:Pd,addNoteToGroup:Vd,addOperation:yd,addWaypoint:Sd,clearNoteConnectionWaypoints:Fd,clearWaypoints:xd,composite:Qe,moveEntity:vo,moveGroup:dd,moveNote:ii,moveNoteConnectionWaypoint:Ld,moveWaypoint:Id,removeAssociation:Ed,removeAttribute:pd,removeEntity:ed,removeEntityFromGroup:ca,removeGroup:sd,removeIndex:wd,removeNote:Ad,removeNoteConnection:Od,removeNoteConnectionWaypoint:zd,removeNoteFromGroup:Bd,removeOperation:bd,removeWaypoint:vd,renameEntity:nd,reorderAttributes:sl,reorderOperations:_d,resizeEntity:od,resizeGroup:ud,resizeNote:$d,setAllEntitiesCollapsed:ll,setAttributeSwatch:la,setEntityCollapsed:ad,setEntityLocked:rd,setEntitySwatch:id,setGroupLocked:fd,setGroupSwatch:md,setNoteMemo:Td,setNoteSwatch:Md,setOperationSwatch:kd,translateWaypoints:Cd,updateAssociation:ua,updateAssociationEnd:Tt,updateAttribute:Kt,updateEntity:td,updateGroup:ld,updateIndex:ma,updateOperation:gd},Symbol.toStringTag,{value:"Module"}));class Ud{constructor(){nt(this,"revs",new Map);nt(this,"layoutVersion",0);nt(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 Jg=[400,1200];function Xg(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 Zg(e){const n=Xg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Qg=e=>new Promise(n=>setTimeout(n,e));class Hd{constructor(n){nt(this,"cache",new Ud);nt(this,"newClientOpId");nt(this,"debounceMs");nt(this,"retryDelaysMs");nt(this,"emissions",new WeakMap);nt(this,"open",null);nt(this,"debounceHandle",null);nt(this,"queue",[]);nt(this,"sending",!1);nt(this,"_frozen",!1);nt(this,"stack",null);nt(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??De,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??Jg}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||!Zg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Qg(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 jd=["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"],Kd=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Gd(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 eb(e){return nn(e).length}function cl(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 tb(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=qo(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 Yd(e,n,o=De){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=eb(i);if(a===0)return[];const r=cl(e,n),l=nn(i).map(c=>c.col),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;tb(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 qd(e,n,o){var h;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 y=r.get(f);if(!y)return[];l.push(y)}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,y)=>f===c[y]))return[];const d=new Map(s.map((f,y)=>[f,y])),u=cl(e,n),m=[];for(const f of e.entities)for(const y of f.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 k=c.map(E=>y.dbAttrs[d.get(E)]),_=k.reduce((E,N,p)=>N===y.dbAttrs[p]?E:E+1,0);_&&m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:k,moved:_})}return m}function Wd(e,n,o){var h;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=nn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(nn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,y)=>{c.has(f)&&d.add(y)}),d.size===s.length)return[];const u=cl(e,n),m=[];for(const f of e.entities)for(const y of f.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 k=y.dbAttrs.filter((N,p)=>d.has(p)),_=y.dbAttrs.filter((N,p)=>!d.has(p));y.dbAttrs.some((N,p)=>{if(d.has(p))return!1;const b=l[p],w=!!N.physicalName&&N.physicalName!==((b==null?void 0:b.physicalName)??""),A=N.sharedColumnRef!=null&&N.sharedColumnRef!==(b==null?void 0:b.sharedColumnRef);return w||A})||m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:k,dropped:_})}return m}function nb(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 ob(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 Jd(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function ht(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=>rb(i,e))}}function ib(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 dl(e,n){const o=ib(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 ul(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 ab=new Set(["name","description","packageName","excludeDDLGeneration"]);function rb(e,n){var a;const o=Ji(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 Xd(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 lb(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 sb(e,n){const o=lb(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=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 ml(e){return e.by!==void 0&&e.by!=="name"}function cb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function db(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function ub(e,n){const o=cb(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 Qd(e,n){const o=db(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 eu(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function tu(e){return eu(e)&&e.dataType==null}function nu(e,n,o){const i=eu(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 ou(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let h=!1;for(const f of n.fields){const y=u.get(f.name);if(y!=null&&y.sharedColumnPhysicalName){const k={ref:y.sharedColumnPhysicalName,by:"physicalName"},_=Zd(vn(i,a),k);if(!_.ok){s.push(_.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:_.matches}),h=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:_.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 mb=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName"]),fb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),pb=new Set(["description","identifying"]),hb=new Set(["multiplicity","navigable","composition"]),yb=new Set(["name","unique","description","parameters"]),gb=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Co(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 fl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),bb=new Set([...fl].filter(e=>e!=="sharedColumnRef"));function _b(e,n,o,i){if(i||o.some(l=>!bb.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))fl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function kb(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 f=n.fields[h],y=f?c.get(f.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},E=Zd(vn(i,a),_);if(!E.ok){s.push(E.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:E.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:E.value.modelId});return}const k={...m};delete k.sharedColumnRef,d.push({...k,...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 iu(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 au(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=sb(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 xo(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 Eb(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 Gd(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function Nb(e,n,o,i,a,r){const l=m=>{const h=new Map;for(const{entityId:f,item:y}of m){if(a.has(f))continue;const k=h.get(f)??[];k.push(y),h.set(f,k)}return h},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,h]of s)if(!c.has(m))for(const f of Wd(n,m,h))u(f);for(const[m,h]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(y=>y.modelId===m?{...y,attributes:[...y.attributes,...h]}:y)};for(const y of Yd(f,m,r))u(y)}}function pl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of vc(n,o,i)){for(const u of c.remove)xo(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 wb(e,n,o={}){const i=o.mkId??De,a=o.embeddableCatalog??[],r=p=>a.find(b=>b.type===p),l=[],s=[],c=new Map,d=(p,b)=>{const w=c.get(p)??Rt(b);return c.set(p,w+1),w},u=new Map,m=new Set,h=new Set,f={seen:new Set,pairs:[]},y=[],k=new Set,_=(p,b)=>`${p}\0${b}`,E=new Set;for(const p of n)p.kind==="entity.add"&&(E.add(p.spec.name),p.spec.physicalName&&E.add(p.spec.physicalName));const N=new Set;return n.forEach((p,b)=>{var w,A,$,L,T;switch(p.kind){case"entity.add":{const S=e.entities.filter(O=>O.name===p.spec.name).map(O=>O.modelId);if(S.length||N.has(p.spec.name)){s.push({code:"entity-name-conflict",opIndex:b,handle:{ref:p.spec.name},matches:S});break}N.add(p.spec.name);const C=i(),M={modelId:C,name:p.spec.name,stereotype:p.spec.stereotype??"JPA_ENTITY",attributes:[],...p.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...p.spec.physicalName?{table:{physicalName:p.spec.physicalName}}:{}},B={ref:p.spec.name};let g=!1;for(const[O,x]of(p.spec.attributes??[]).entries()){if(x.type==="GroupCodeEnum"&&!x.groupCode){s.push({code:"groupcode-required",opIndex:b,entity:B,handle:{ref:x.name}}),g=!0;continue}if(!r(x.type)&&!((w=x.embeddableOverrides)!=null&&w.length)&&tu(x)){s.push({code:"datatype-required",opIndex:b,entity:B,handle:{ref:x.name}}),g=!0;continue}const z=r(x.type);if(z){const j=ou(x,z,O,M,e.entities,b,B,s,i);j?M.attributes.push(j):g=!0}else(A=x.embeddableOverrides)!=null&&A.length?(s.push({code:"embeddable-type-unresolved",opIndex:b,entity:B,handle:{ref:x.name}}),g=!0):M.attributes.push(nu(x,O,i))}const I=(p.spec.operations??[]).map((O,x)=>iu(O,x,i));I.length&&(M.operations=I);const v=[];for(const O of p.spec.indexes??[]){const x=au(M,O,b,B,s,i);x?v.push(x):g=!0}if(v.length&&(M.indexes=v),g)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:C,value:M});break}case"entity.update":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=Co(p.patch,fb,["jpaAttrs.","table."]);if(C.length){s.push({code:"entity-patch-unknown-key",opIndex:b,entity:p.entity,keys:C});break}const M=p.patch.stereotype;if(typeof M=="string"&&M!==S.value.stereotype&&(M==="JPA_EMBEDDABLE"||S.value.stereotype==="JPA_EMBEDDABLE")){s.push({code:"stereotype-embeddable-transition-unsupported",opIndex:b,entity:p.entity,from:S.value.stereotype??"",to:M});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,patch:p.patch});break}case"entity.remove":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=S.value.modelId,M=e.associations.filter(v=>v.end1.entityRef===C||v.end2.entityRef===C),B=new Set(M.map(v=>v.modelId));for(const v of M)m.has(v.modelId)||(m.add(v.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:v.modelId}));for(const v of e.entities)if(v.modelId!==C)for(const O of v.attributes)O.embedded&&B.has(O.embedded.associationRef)&&xo(l,f,v.modelId,O.modelId);for(const v of M){if(v.end1.entityRef===C||!v.end1.attributeRef)continue;const O=e.entities.find(z=>z.modelId===v.end1.entityRef),x=O==null?void 0:O.attributes.find(z=>z.modelId===v.end1.attributeRef&&z.attrType==="RELATION_REF");x&&xo(l,f,O.modelId,x.modelId)}const g={...e,entities:e.entities.filter(v=>v.modelId!==C),associations:e.associations.filter(v=>!B.has(v.modelId))},I=new Set(M.filter(v=>v.end1.entityRef===C&&v.end2.entityRef!==C).map(v=>v.end2.entityRef));for(const v of I)pl(l,g,v,i,f,d);for(const v of e.groups)v.memberEntityRefs.includes(C)&&(k.has(_(v.modelId,C))||(k.add(_(v.modelId,C)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:v.modelId,groupRef:v.modelId,entityRef:C})));h.add(C),l.push({kind:"entity.remove",casUnit:"logical",entityRef:C});break}case"attribute.add":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}if(p.spec.type==="GroupCodeEnum"&&!p.spec.groupCode){s.push({code:"groupcode-required",opIndex:b,entity:p.entity,handle:{ref:p.spec.name}});break}if(!r(p.spec.type)&&!(($=p.spec.embeddableOverrides)!=null&&$.length)&&tu(p.spec)){s.push({code:"datatype-required",opIndex:b,entity:p.entity,handle:{ref:p.spec.name}});break}const C=d(S.value.modelId,S.value.attributes),M=r(p.spec.type);let B;if(M)B=ou(p.spec,M,C,S.value,e.entities,b,p.entity,s,i);else if((L=p.spec.embeddableOverrides)!=null&&L.length){s.push({code:"embeddable-type-unresolved",opIndex:b,entity:p.entity,handle:{ref:p.spec.name}});break}else B=nu(p.spec,C,i);if(!B)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,value:B}),y.push({entityId:S.value.modelId,attribute:B});break}case"attribute.update":case"attribute.remove":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=Xd(S.value,p.attribute);if(!C.ok){s.push(C.reason==="not-found"?{code:"attribute-not-found",opIndex:b,entity:p.entity,handle:p.attribute}:{code:"attribute-ambiguous",opIndex:b,entity:p.entity,handle:p.attribute,matches:C.matches});break}if(p.kind==="attribute.update"){const M=[],B=[];let g=!1;for(const x of Object.keys(p.patch)){if(x.includes(".")){x.startsWith("dbAttrs.")?g=!0:B.push(x);continue}fl.has(x)?M.push(x):mb.has(x)||B.push(x)}if(B.length){s.push({code:"attribute-patch-unknown-key",opIndex:b,entity:p.entity,handle:p.attribute,keys:B});break}if("attrType"in p.patch){const x=String(p.patch.attrType),z=Kd.includes(x)?x!==C.value.attrType?"transition":void 0:"unknown-value";if(z){s.push({code:"attribute-attrtype-unsupported",opIndex:b,entity:p.entity,handle:p.attribute,reason:z,current:C.value.attrType,requested:x});break}}const I="type"in p.patch?p.patch.type:C.value.type,v="groupCode"in p.patch?p.patch.groupCode:C.value.groupCode;if(I==="GroupCodeEnum"&&!v){s.push({code:"groupcode-required",opIndex:b,entity:p.entity,handle:p.attribute});break}let O=p.patch;if(M.length){const x=_b(C.value,p.patch,M,g);if(!x){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:b,entity:p.entity,handle:p.attribute,keys:M});break}O=x}if((T=p.embeddableOverrides)!=null&&T.length){const x=r(C.value.type);if(!x||C.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:b,entity:p.entity,handle:p.attribute});break}const z=kb(C.value,x,p.embeddableOverrides,S.value,e.entities,b,p.entity,s);if(!z)break;O={...O,dbAttrs:z}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,attributeRef:C.value.modelId,patch:O})}else{const M=ko(e,S.value.modelId,C.value.modelId);if(M){const B=g=>{var I;return((I=e.entities.find(v=>v.modelId===g))==null?void 0:I.name)??g};s.push({code:"attribute-fk-managed",opIndex:b,entity:p.entity,handle:p.attribute,association:{from:B(M.end1.entityRef),to:B(M.end2.entityRef)}});break}xo(l,f,S.value.modelId,C.value.modelId)}break}case"association.add":{const S=ht(e,p.spec.from),C=ht(e,p.spec.to);if(S.ok||s.push(yt(S.reason,b,p.spec.from,S.matches,E)),C.ok||s.push(yt(C.reason,b,p.spec.to,C.matches,E)),!S.ok||!C.ok)break;if(p.spec.identifying&&S.value.modelId===C.value.modelId){s.push({code:"self-identifying",opIndex:b,handle:{from:p.spec.from,to:p.spec.to}});break}if(S.value.stereotype==="JPA_EMBEDDABLE"||C.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:b,handle:{from:p.spec.from,to:p.spec.to}});break}const M=i(),B={modelId:M,...p.spec.identifying!=null?{identifying:p.spec.identifying}:{},end1:{entityRef:S.value.modelId,multiplicity:p.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:C.value.modelId,multiplicity:p.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:p.spec.composition??!1}},g={...e,associations:[...e.associations,B]},I=Xo(g,C.value.modelId,i);I.add[0]&&(B.end2.attributeRef=I.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:M,value:B});for(const v of I.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,value:{...v,order:d(C.value.modelId,C.value.attributes)}});break}case"association.remove":{const S=ht(e,p.association.from),C=ht(e,p.association.to);if(S.ok||s.push(yt(S.reason,b,p.association.from,S.matches,E)),C.ok||s.push(yt(C.reason,b,p.association.to,C.matches,E)),!S.ok||!C.ok)break;const M=Jd(e,S.value.modelId,C.value.modelId);if(M.length!==1){s.push(M.length===0?{code:"association-not-found",opIndex:b,handle:p.association}:{code:"association-ambiguous",opIndex:b,handle:p.association,matches:M.map(v=>v.modelId)});break}const B=M[0];m.has(B.modelId)||(m.add(B.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:B.modelId}));const g=e.entities.find(v=>v.attributes.some(O=>{var x;return((x=O.embedded)==null?void 0:x.associationRef)===B.modelId}));if(g){const v=g.attributes.find(O=>{var x;return((x=O.embedded)==null?void 0:x.associationRef)===B.modelId});xo(l,f,g.modelId,v.modelId);break}if(B.end1.attributeRef){const v=e.entities.find(x=>x.modelId===B.end1.entityRef),O=v==null?void 0:v.attributes.find(x=>x.modelId===B.end1.attributeRef&&x.attrType==="RELATION_REF");O&&xo(l,f,v.modelId,O.modelId)}const I={...e,associations:e.associations.filter(v=>v.modelId!==B.modelId)};pl(l,I,B.end2.entityRef,i,f,d);break}case"association.update":{const S=ru(e,p.association,b,s,E);if(!S)break;const C=p.patch.identifying,M=typeof C=="boolean"?C:void 0;if(M===!0&&S.end1.entityRef===S.end2.entityRef){s.push({code:"self-identifying",opIndex:b,handle:p.association});break}const B=Co(p.patch,pb);if(B.length){s.push({code:"association-patch-unknown-key",opIndex:b,handle:p.association,keys:B});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:S.modelId,associationRef:S.modelId,patch:p.patch}),M!==void 0&&M!==(S.identifying??!1)){const g={...e,associations:e.associations.map(I=>I.modelId===S.modelId?{...I,identifying:M}:I)};pl(l,g,S.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const S=ru(e,p.association,b,s,E);if(!S)break;const C=p.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(p.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:b,handle:p.association});break}const M=Co(p.patch,hb,["jpa."]);if(M.length){s.push({code:"association-end-patch-unknown-key",opIndex:b,handle:p.association,keys:M});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:S.modelId,associationRef:S.modelId,end:C,patch:p.patch});break}case"index.add":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=au(S.value,p.spec,b,p.entity,s,i);if(!C)break;l.push({kind:"index.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:C.modelId,value:C});break}case"index.update":case"index.remove":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}if(ml(p.index)){s.push({code:"handle-by-unsupported",opIndex:b,entity:p.entity,handle:p.index,target:"index"});break}const C=ub(S.value,p.index);if(!C.ok){s.push(C.reason==="not-found"?{code:"index-not-found",opIndex:b,entity:p.entity,handle:p.index}:{code:"index-ambiguous",opIndex:b,entity:p.entity,handle:p.index,matches:C.matches});break}if(p.kind==="index.update"){if("columns"in p.patch){s.push({code:"index-columns-patch-unsupported",opIndex:b,entity:p.entity,handle:p.index});break}const M=Co(p.patch,yb);if(M.length){s.push({code:"index-patch-unknown-key",opIndex:b,entity:p.entity,handle:p.index,keys:M});break}l.push({kind:"index.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:C.value.modelId,patch:p.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:C.value.modelId});break}case"operation.add":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=u.get(S.value.modelId)??(S.value.operations?Rt(S.value.operations):0);u.set(S.value.modelId,C+1);const M=iu(p.spec,C,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:M.modelId,value:M});break}case"operation.update":case"operation.remove":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}if(ml(p.operation)){s.push({code:"handle-by-unsupported",opIndex:b,entity:p.entity,handle:p.operation,target:"operation"});break}const C=Qd(S.value,p.operation);if(!C.ok){s.push(C.reason==="not-found"?{code:"operation-not-found",opIndex:b,entity:p.entity,handle:p.operation}:{code:"operation-ambiguous",opIndex:b,entity:p.entity,handle:p.operation,matches:C.matches});break}if(p.kind==="operation.update"){const M=Co(p.patch,gb);if(M.length){s.push({code:"operation-patch-unknown-key",opIndex:b,entity:p.entity,handle:p.operation,keys:M});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:C.value.modelId,patch:p.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:C.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const S=p.kind==="attribute.reorder",C=ht(e,p.entity);if(!C.ok){s.push(yt(C.reason,b,p.entity,C.matches,E));break}const M=S?p.order:p.operations,B=[],g=new Set;let I=!1;for(const z of M){if(!S&&ml(z)){s.push({code:"handle-by-unsupported",opIndex:b,entity:p.entity,handle:z,target:"operation"}),I=!0;continue}const j=S?Xd(C.value,z):Qd(C.value,z);if(!j.ok){s.push(j.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:b,entity:p.entity,handle:z}:{code:"reorder-handle-ambiguous",opIndex:b,entity:p.entity,handle:z,matches:j.matches}),I=!0;continue}if(g.has(j.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:b,entity:p.entity,handle:z}),I=!0;continue}g.add(j.value.modelId),B.push(j.value)}if(I)break;const O=[...S?C.value.attributes:C.value.operations??[]].sort((z,j)=>z.order-j.order).filter(z=>!g.has(z.modelId)),x=[...B,...O];if(x.forEach((z,j)=>{z.order!==j&&l.push(S?{kind:"attribute.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,attributeRef:z.modelId,patch:{order:j}}:{kind:"operation.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:z.modelId,patch:{order:j}})}),S)for(const z of qd(e,C.value.modelId,x.map(j=>j.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:z.entityId,entityRef:z.entityId,attributeRef:z.attributeId,patch:{dbAttrs:z.dbAttrs}});break}case"group.add":{const S=[];let C=!1;for(const g of p.spec.members){const I=ht(e,g);if(!I.ok){s.push(yt(I.reason,b,g,I.matches,E)),C=!0;continue}S.push(I.value.modelId)}if(C)break;const M=i(),B={modelId:M,excludeDDLGeneration:p.spec.excludeDDLGeneration??!1,memberEntityRefs:S,...p.spec.name?{name:p.spec.name}:{},...p.spec.packageName?{packageName:p.spec.packageName}:{},...p.spec.description?{description:p.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:M,value:B});break}case"group.update":{const S=dl(e,p.group);if(!S.ok){s.push(ul(S,b,p.group));break}const C=Co(p.patch,ab);if(C.length){s.push({code:"group-patch-unknown-key",opIndex:b,handle:p.group,keys:C});break}l.push({kind:"group.update",casUnit:"logical",containerRef:S.value.modelId,groupRef:S.value.modelId,patch:p.patch});break}case"group.remove":{const S=dl(e,p.group);if(!S.ok){s.push(ul(S,b,p.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:S.value.modelId});break}case"group.addMember":case"group.removeMember":{const S=dl(e,p.group);if(!S.ok){s.push(ul(S,b,p.group));break}const C=ht(e,p.entity);if(!C.ok){s.push(yt(C.reason,b,p.entity,C.matches,E));break}const M=S.value.memberEntityRefs.includes(C.value.modelId);if(p.kind==="group.addMember"?M:!M)break;if(p.kind==="group.removeMember"){if(k.has(_(S.value.modelId,C.value.modelId)))break;k.add(_(S.value.modelId,C.value.modelId))}l.push({kind:p.kind,casUnit:"logical",containerRef:S.value.modelId,groupRef:S.value.modelId,entityRef:C.value.modelId});break}}}),s.length||Eb(l,e,f,h),s.length||Nb(l,e,f,y,h,i),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function yt(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 ru(e,n,o,i,a){const r=ht(e,n.from),l=ht(e,n.to);if(r.ok||i.push(yt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(yt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Jd(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 lu={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},Ib={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},vb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Cb={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},Sn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},xb={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:{...Sn,description:"속성 설명(다국어)."},columnLogicalName:{...Sn,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},Sb={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}},su={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Rb={type:"object",description:"일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)을 end 로 주면 거부된다(임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...su,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...su,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},Ab={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...lu,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},$b={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Sn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Tb={type:"object",properties:{name:{...Sn,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},Mb={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:[...Kd],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},derivedIdFieldName:{type:"string",description:"파생 식별(@MapsId) FK가 매핑되는 **스칼라 @Id 필드명**. 이 속성의 name은 연관 필드명(@MapsId @OneToOne 필드)이고 같은 관계가 두 Java 필드를 만든다. 단일 컬럼 @OneToOne 식별 FK에만 의미가 있고, 미설정 시 부모 PK 물리명의 camelCase로 파생된다(실물 관행). 컬럼은 공유하므로 속성은 하나이며 물리명은 지정하지 않는다."},description:{...Sn,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:{...Sn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},Vb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Bb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Db={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...Sn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Ob={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로 변경. stereotype 은 JPA_EMBEDDABLE 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},Lb={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function rt(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const Pb={"entity.add":rt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":rt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":rt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":rt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":rt("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":rt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":rt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":rt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":rt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":rt("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":rt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":rt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":rt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":rt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":rt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":rt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":rt("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":rt("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":rt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":rt("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":rt("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":rt("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":rt("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},zb={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},Fb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...Sn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},cu={anyOf:jd.map(e=>Pb[e])},Ub={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:lu,nameHandle:Ib,groupHandle:zb,assocHandle:vb,entitySpec:Cb,attrSpec:xb,embeddableOverrides:Sb,assocSpec:Rb,indexSpec:Ab,operationSpec:$b,groupSpec:Tb,entityUpdatePatch:Ob,attrUpdatePatch:Mb,assocUpdatePatch:Vb,assocEndUpdatePatch:Lb,indexUpdatePatch:Bb,operationUpdatePatch:Db,groupUpdatePatch:Fb,symbolicOp:cu}};function Hb(e,n,o,i={}){const a=i.mkClientOpId??De,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 du={location:{x:0,y:0},size:{width:220,height:140}};function uu(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 jb=/^[-=_*~\s]{3,}$/;function Kb(e){return e.attrType&&e.attrType!=="NORMAL"||!jb.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Gb(e){return e.type===an&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Yb(e,n){if(e.attrType==="DIVIDER"||Kb(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=Gb(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(uu)}}function qb(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 Wb(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 Jb(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(Yb),operations:(n=e.operations)==null?void 0:n.map(qb),indexes:(o=e.indexes)==null?void 0:o.map(Wb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Xb(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??{...du},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 mu(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 hl(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:mu(e)}}function Zb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>yl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Qb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:Zb(e),end1:hl(e.end1),end2:hl(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 yl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function fu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function pu(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 hu(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(uu)}}function e_(e,n,o){var b,w;const i=yl(e.end1.attribute),a=yl(e.end2.attribute);if(i===a)return Qb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(w=(b=s.dbAttrs)==null?void 0:b[0])==null?void 0:w.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((A,$)=>Math.max(A,$.order),-1)+1:s.order??0,h={...hu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const f=n.get(r.endModel.refId),y=l.attribute;let k;if(y&&f&&r.navigable){const A=Ki(l.multiplicity);k={modelId:y.modelId??crypto.randomUUID(),name:ho(y.name??Yi((u==null?void 0:u.name)??l.endModel.refId,A),new Set(f.attributes.map($=>$.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce(($,L)=>Math.max($,L.order),-1)+1,dbAttrs:[]},f.attributes.push(k)}const _=(A,$)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:$?k==null?void 0:k.modelId:h.modelId,jpa:mu(A)}),E=r.endModel.refId===l.endModel.refId,N={modelId:e.modelId,description:e.description,identifying:!E&&h.identifier===!0?!0:void 0,end1:_(e.end1,i),end2:_(e.end2,a)},p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:h.modelId,targetColumnRef:i?h.modelId:d,style:e.style};return{assoc:N,layout:p}}function t_(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 n_(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((k,_)=>Math.max(k,_.order),-1)+1:l.order??0,d={...hu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(k=>t_(k,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=k=>({...hl(k),legacyEmbedRaw:k.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,f={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:f}}function o_(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 yu(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=o_(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 gu(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 i_(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=Ki(i.end2.multiplicity),u=Yi(r.name,d),m=ho(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,f)=>Math.max(h,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function a_(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 bu(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&&!Xs(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 _u(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?r_(n):l_(n)}function r_(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:h,...f}=m;return h!=null&&(o[m.modelId]=h),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);i_(a,r),a_(a,r),bu(a,r);const{version:s,...c}=e.layout;gu(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 l_(e){var E,N;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(p,b)=>{o.push(Jb(p));const w=Xb(p);w.geo={location:{x:w.geo.location.x+b.x,y:w.geo.location.y+b.y},size:w.geo.size},i.push(w);for(const A of p.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const p of e.entities??[])d(p,u);const m=[];for(const p of e.groups??[]){const b=p.entities??[];l.push({modelId:p.modelId,name:p.name,description:p.description,packageName:p.packageName,excludeDDLGeneration:p.excludeDDLGeneration??!1,memberEntityRefs:b.map(A=>A.modelId)});const w=((E=p.geo)==null?void 0:E.location)??u;if(p.geo){const A=(p.notes??[]).map($=>$.modelId);s.push({groupRef:p.modelId,geo:p.geo,style:p.style,locked:p.locked,memberNoteRefs:A.length?A:void 0})}for(const A of b)d(A,w);for(const A of p.notes??[])m.push(yu(A,w))}const h=new Map(o.map(p=>[p.modelId,p])),f=new Map,y=new Map;for(const p of o)for(const b of p.attributes)for(const w of b.dbAttrs)f.set(w.modelId,b.modelId),y.set(w.modelId,w);for(const p of c)for(const b of[p.end1,p.end2]){const w=b.attribute;if(w&&(((N=w.dbAttrs)==null?void 0:N.length)??0)>0)for(const A of w.dbAttrs)A.modelId&&f.set(A.modelId,w.modelId)}for(const p of c){const b=fu(p.end1.attribute),w=fu(p.end2.attribute),A=pu(p.end1)||pu(p.end2),{assoc:$,layout:L}=b!==w||A?n_(p,h,y):e_(p,h,f);a.push($),r.push(L)}gu(o,a,r),Kc(o),bu(o,a);const k={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(p=>yu(p)),...m]}},_={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:k,meta:_}}function ku(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 s_(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(ku),style:n}}function c_(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 d_(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 Rn(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 u_(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{...ku(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function m_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function Eu(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 f_(e){const n=new Set;for(const o of e.logical.associations){const i=Eu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function p_(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 h_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function y_(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:h_(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 g_(e,n,o){let i;for(const m of n.logical.entities){const h=m.attributes.find(f=>{var y;return((y=f.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)=>y_(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:Rn(e.end1,c?s:u),end2:Rn(e.end2,c?u:s)}}function b_(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:Rn(e.end1,e.end1.legacyEmbedRaw),end2:Rn(e.end2,e.end2.legacyEmbedRaw)};const a=g_(e,n,i);if(a)return a;const r=Eu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?u_(r.fk,l):void 0,c=m_(r.navAttr);return{...i,end1:Rn(e.end1,r.navEnd===e.end1?s:c),end2:Rn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:Rn(e.end1),end2:Rn(e.end2)}}function Nu(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(f=>f.associationRef===h),c=(r==null?void 0:r.geo)??{...du},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 f;return s_(h,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var f;return c_(h,(f=r==null?void 0:r.operationStyles)==null?void 0:f[h.modelId])}),ownedAssociations:l.map(h=>b_(h,n,s(h.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(d_),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 __(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=>wu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Nu(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 wu(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 k_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=f_(e),r=p_(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=>Nu(s,e,a,r)),groups:e.logical.groups.map(s=>__(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>wu(s))}}function E_(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 N_=["notNull"];function w_(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}=_u(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 f of m.attributes){const y=h.get(f.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const k={};for(const _ of N_)f[_]===!0!=(y[_]===!0)&&(k[_]=f[_],s.attributeFieldsByName[_]=(s.attributeFieldsByName[_]??0)+1);Object.keys(k).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:k}),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 ai(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function ln(e){return typeof e=="function"?e():t.unref(e)}const I_=typeof window<"u"&&typeof document<"u",v_=e=>typeof e<"u",C_=Object.prototype.toString,x_=e=>C_.call(e)==="[object Object]",S_=()=>{};function R_(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 Iu=e=>e();function A_(e=Iu){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 vu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function $_(e,n,o={}){const{eventFilter:i=Iu,...a}=o;return t.watch(e,R_(i,n),a)}function So(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=A_(i);return{stop:$_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function T_(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=ln(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 gl(e,n=!1){function o(m,{flush:h="sync",deep:f=!1,timeout:y,throwOnTimeout:k}={}){let _=null;const N=[new Promise(p=>{_=t.watch(e,b=>{m(b)!==n&&(_==null||_(),p(b))},{flush:h,deep:f,immediate:!0})})];return y!=null&&N.push(vu(y,k).then(()=>ln(e)).finally(()=>_==null?void 0:_())),Promise.race(N)}function i(m,h){if(!t.isRef(m))return o(b=>b===m,h);const{flush:f="sync",deep:y=!1,timeout:k,throwOnTimeout:_}=h??{};let E=null;const p=[new Promise(b=>{E=t.watch([e,m],([w,A])=>{n!==(w===A)&&(E==null||E(),b(w))},{flush:f,deep:y,immediate:!0})})];return k!=null&&p.push(vu(k,_).then(()=>ln(e)).finally(()=>(E==null||E(),ln(e)))),Promise.race(p)}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(f=>{const y=Array.from(f);return y.includes(m)||y.includes(ln(m))},h)}function d(m){return u(1,m)}function u(m=1,h){let f=-1;return o(()=>(f+=1,f>=m),h)}return Array.isArray(ln(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return gl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return gl(e,!n)}}}function bl(e){return gl(e)}function M_(e){var n;const o=ln(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Cu=I_?window:void 0;function xu(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Cu):[n,o,i,a]=e,!n)return S_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,h,f)=>(u.addEventListener(m,h,f),()=>u.removeEventListener(m,h,f)),c=t.watch(()=>[M_(n),ln(a)],([u,m])=>{if(l(),!u)return;const h=x_(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(y=>s(u,f,y,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ai(d),d}function V_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Su(...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=Cu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=V_(n);return xu(a,r,u=>{u.repeat&&ln(s)||c(u)&&o(u)},l)}function B_(e){return JSON.parse(JSON.stringify(e))}function _l(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,f=t.getCurrentInstance(),y=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 k=d;n||(n="modelValue"),k=k||`update:${n.toString()}`;const _=p=>s?typeof s=="function"?s(p):B_(p):p,E=()=>v_(e[n])?_(e[n]):m,N=p=>{h?h(p)&&y(k,p):y(k,p)};if(c){const p=E(),b=t.ref(p);let w=!1;return t.watch(()=>e[n],A=>{w||(w=!0,b.value=_(A),t.nextTick(()=>w=!1))}),t.watch(b,A=>{!w&&(A!==e[n]||u)&&N(A)},{deep:u}),b}else return t.computed({get(){return E()},set(p){N(p)}})}var D_={value:()=>{}};function pa(){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 ha(o)}function ha(e){this._=e}function O_(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}})}ha.prototype=pa.prototype={constructor:ha,on:function(e,n){var o=this._,i=O_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=L_(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]=Ru(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Ru(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 ha(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 L_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Ru(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=D_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var kl="http://www.w3.org/1999/xhtml";const Au={svg:"http://www.w3.org/2000/svg",xhtml:kl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ya(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Au.hasOwnProperty(n)?{space:Au[n],local:e}:e}function P_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===kl&&n.documentElement.namespaceURI===kl?n.createElement(e):n.createElementNS(o,e)}}function z_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $u(e){var n=ya(e);return(n.local?z_:P_)(n)}function F_(){}function El(e){return e==null?F_:function(){return this.querySelector(e)}}function U_(e){typeof e!="function"&&(e=El(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 H_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function j_(){return[]}function Tu(e){return e==null?j_:function(){return this.querySelectorAll(e)}}function K_(e){return function(){return H_(e.apply(this,arguments))}}function G_(e){typeof e=="function"?e=K_(e):e=Tu(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 Mu(e){return function(){return this.matches(e)}}function Vu(e){return function(n){return n.matches(e)}}var Y_=Array.prototype.find;function q_(e){return function(){return Y_.call(this.children,e)}}function W_(){return this.firstElementChild}function J_(e){return this.select(e==null?W_:q_(typeof e=="function"?e:Vu(e)))}var X_=Array.prototype.filter;function Z_(){return Array.from(this.children)}function Q_(e){return function(){return X_.call(this.children,e)}}function ek(e){return this.selectAll(e==null?Z_:Q_(typeof e=="function"?e:Vu(e)))}function tk(e){typeof e!="function"&&(e=Mu(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 Bu(e){return new Array(e.length)}function nk(){return new Ct(this._enter||this._groups.map(Bu),this._parents)}function ga(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ga.prototype={constructor:ga,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 ok(e){return function(){return e}}function ik(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 ga(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function ak(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(h[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 ga(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function rk(e){return e.__data__}function lk(e,n){if(!arguments.length)return Array.from(this,rk);var o=n?ak:ik,i=this._parents,a=this._groups;typeof e!="function"&&(e=ok(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,f=sk(e.call(u,u&&u.__data__,d,i)),y=f.length,k=s[d]=new Array(y),_=l[d]=new Array(y),E=c[d]=new Array(h);o(u,m,k,_,E,f,n);for(var N=0,p=0,b,w;N<y;++N)if(b=k[N]){for(N>=p&&(p=N+1);!(w=_[p])&&++p<y;);b._next=w||null}}return l=new Ct(l,i),l._enter=s,l._exit=c,l}function sk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ck(){return new Ct(this._exit||this._groups.map(Bu),this._parents)}function dk(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 uk(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),f,y=0;y<m;++y)(f=d[y]||u[y])&&(h[y]=f);for(;c<a;++c)s[c]=o[c];return new Ct(s,this._parents)}function mk(){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 fk(e){e||(e=pk);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 Ct(a,this._parents).order()}function pk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function hk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function yk(){return Array.from(this)}function gk(){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 bk(){let e=0;for(const n of this)++e;return e}function _k(){return!this.node()}function kk(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 Ek(e){return function(){this.removeAttribute(e)}}function Nk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wk(e,n){return function(){this.setAttribute(e,n)}}function Ik(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function vk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Ck(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 xk(e,n){var o=ya(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?Nk:Ek:typeof n=="function"?o.local?Ck:vk:o.local?Ik:wk)(o,n))}function Du(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Sk(e){return function(){this.style.removeProperty(e)}}function Rk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Ak(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function $k(e,n,o){return arguments.length>1?this.each((n==null?Sk:typeof n=="function"?Ak:Rk)(e,n,o??"")):Ro(this.node(),e)}function Ro(e,n){return e.style.getPropertyValue(n)||Du(e).getComputedStyle(e,null).getPropertyValue(n)}function Tk(e){return function(){delete this[e]}}function Mk(e,n){return function(){this[e]=n}}function Vk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Bk(e,n){return arguments.length>1?this.each((n==null?Tk:typeof n=="function"?Vk:Mk)(e,n)):this.node()[e]}function Ou(e){return e.trim().split(/^|\s+/)}function Nl(e){return e.classList||new Lu(e)}function Lu(e){this._node=e,this._names=Ou(e.getAttribute("class")||"")}Lu.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 Pu(e,n){for(var o=Nl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function zu(e,n){for(var o=Nl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Dk(e){return function(){Pu(this,e)}}function Ok(e){return function(){zu(this,e)}}function Lk(e,n){return function(){(n.apply(this,arguments)?Pu:zu)(this,e)}}function Pk(e,n){var o=Ou(e+"");if(arguments.length<2){for(var i=Nl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Lk:n?Dk:Ok)(o,n))}function zk(){this.textContent=""}function Fk(e){return function(){this.textContent=e}}function Uk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Hk(e){return arguments.length?this.each(e==null?zk:(typeof e=="function"?Uk:Fk)(e)):this.node().textContent}function jk(){this.innerHTML=""}function Kk(e){return function(){this.innerHTML=e}}function Gk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Yk(e){return arguments.length?this.each(e==null?jk:(typeof e=="function"?Gk:Kk)(e)):this.node().innerHTML}function qk(){this.nextSibling&&this.parentNode.appendChild(this)}function Wk(){return this.each(qk)}function Jk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xk(){return this.each(Jk)}function Zk(e){var n=typeof e=="function"?e:$u(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Qk(){return null}function eE(e,n){var o=typeof e=="function"?e:$u(e),i=n==null?Qk:typeof n=="function"?n:El(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function tE(){var e=this.parentNode;e&&e.removeChild(this)}function nE(){return this.each(tE)}function oE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function iE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function aE(e){return this.select(e?iE:oE)}function rE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function lE(e){return function(n){e.call(this,n,this.__data__)}}function sE(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 cE(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 dE(e,n,o){return function(){var i=this.__on,a,r=lE(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 uE(e,n,o){var i=sE(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?dE:cE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Fu(e,n,o){var i=Du(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 mE(e,n){return function(){return Fu(this,e,n)}}function fE(e,n){return function(){return Fu(this,e,n.apply(this,arguments))}}function pE(e,n){return this.each((typeof n=="function"?fE:mE)(e,n))}function*hE(){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 Uu=[null];function Ct(e,n){this._groups=e,this._parents=n}function ri(){return new Ct([[document.documentElement]],Uu)}function yE(){return this}Ct.prototype=ri.prototype={constructor:Ct,select:U_,selectAll:G_,selectChild:J_,selectChildren:ek,filter:tk,data:lk,enter:nk,exit:ck,join:dk,merge:uk,selection:yE,order:mk,sort:fk,call:hk,nodes:yk,node:gk,size:bk,empty:_k,each:kk,attr:xk,style:$k,property:Bk,classed:Pk,text:Hk,html:Yk,raise:Wk,lower:Xk,append:Zk,insert:eE,remove:nE,clone:aE,datum:rE,on:uE,dispatch:pE,[Symbol.iterator]:hE};function Mt(e){return typeof e=="string"?new Ct([[document.querySelector(e)]],[document.documentElement]):new Ct([[e]],Uu)}function gE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Yt(e,n){if(e=gE(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 bE={passive:!1},li={capture:!0,passive:!1};function wl(e){e.stopImmediatePropagation()}function Ao(e){e.preventDefault(),e.stopImmediatePropagation()}function Hu(e){var n=e.document.documentElement,o=Mt(e).on("dragstart.drag",Ao,li);"onselectstart"in n?o.on("selectstart.drag",Ao,li):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function ju(e,n){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ao,li),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 ba=e=>()=>e;function Il(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}})}Il.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function _E(e){return!e.ctrlKey&&!e.button}function kE(){return this.parentNode}function EE(e,n){return n??{x:e.x,y:e.y}}function NE(){return navigator.maxTouchPoints||"ontouchstart"in this}function wE(){var e=_E,n=kE,o=EE,i=NE,a={},r=pa("start","drag","end"),l=0,s,c,d,u,m=0;function h(b){b.on("mousedown.drag",f).filter(i).on("touchstart.drag",_).on("touchmove.drag",E,bE).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(b,w){if(!(u||!e.call(this,b,w))){var A=p(this,n.call(this,b,w),b,w,"mouse");A&&(Mt(b.view).on("mousemove.drag",y,li).on("mouseup.drag",k,li),Hu(b.view),wl(b),d=!1,s=b.clientX,c=b.clientY,A("start",b))}}function y(b){if(Ao(b),!d){var w=b.clientX-s,A=b.clientY-c;d=w*w+A*A>m}a.mouse("drag",b)}function k(b){Mt(b.view).on("mousemove.drag mouseup.drag",null),ju(b.view,d),Ao(b),a.mouse("end",b)}function _(b,w){if(e.call(this,b,w)){var A=b.changedTouches,$=n.call(this,b,w),L=A.length,T,S;for(T=0;T<L;++T)(S=p(this,$,b,w,A[T].identifier,A[T]))&&(wl(b),S("start",b,A[T]))}}function E(b){var w=b.changedTouches,A=w.length,$,L;for($=0;$<A;++$)(L=a[w[$].identifier])&&(Ao(b),L("drag",b,w[$]))}function N(b){var w=b.changedTouches,A=w.length,$,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),$=0;$<A;++$)(L=a[w[$].identifier])&&(wl(b),L("end",b,w[$]))}function p(b,w,A,$,L,T){var S=r.copy(),C=Yt(T||A,w),M,B,g;if((g=o.call(b,new Il("beforestart",{sourceEvent:A,target:h,identifier:L,active:l,x:C[0],y:C[1],dx:0,dy:0,dispatch:S}),$))!=null)return M=g.x-C[0]||0,B=g.y-C[1]||0,function I(v,O,x){var z=C,j;switch(v){case"start":a[L]=I,j=l++;break;case"end":delete a[L],--l;case"drag":C=Yt(x||O,w),j=l;break}S.call(v,b,new Il(v,{sourceEvent:O,subject:g,target:h,identifier:L,active:j,x:C[0]+M,y:C[1]+B,dx:C[0]-z[0],dy:C[1]-z[1],dispatch:S}),$)}}return h.filter=function(b){return arguments.length?(e=typeof b=="function"?b:ba(!!b),h):e},h.container=function(b){return arguments.length?(n=typeof b=="function"?b:ba(b),h):n},h.subject=function(b){return arguments.length?(o=typeof b=="function"?b:ba(b),h):o},h.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:ba(!!b),h):i},h.on=function(){var b=r.on.apply(r,arguments);return b===r?h:b},h.clickDistance=function(b){return arguments.length?(m=(b=+b)*b,h):Math.sqrt(m)},h}function vl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Ku(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function si(){}var ci=.7,_a=1/ci,$o="\\s*([+-]?\\d+)\\s*",di="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",IE=/^#([0-9a-f]{3,8})$/,vE=new RegExp(`^rgb\\(${$o},${$o},${$o}\\)$`),CE=new RegExp(`^rgb\\(${qt},${qt},${qt}\\)$`),xE=new RegExp(`^rgba\\(${$o},${$o},${$o},${di}\\)$`),SE=new RegExp(`^rgba\\(${qt},${qt},${qt},${di}\\)$`),RE=new RegExp(`^hsl\\(${di},${qt},${qt}\\)$`),AE=new RegExp(`^hsla\\(${di},${qt},${qt},${di}\\)$`),Gu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};vl(si,Yn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Yu,formatHex:Yu,formatHex8:$E,formatHsl:TE,formatRgb:qu,toString:qu});function Yu(){return this.rgb().formatHex()}function $E(){return this.rgb().formatHex8()}function TE(){return Qu(this).formatHsl()}function qu(){return this.rgb().formatRgb()}function Yn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=IE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Wu(n):o===3?new Nt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ka(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ka(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=vE.exec(e))?new Nt(n[1],n[2],n[3],1):(n=CE.exec(e))?new Nt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=xE.exec(e))?ka(n[1],n[2],n[3],n[4]):(n=SE.exec(e))?ka(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=RE.exec(e))?Zu(n[1],n[2]/100,n[3]/100,1):(n=AE.exec(e))?Zu(n[1],n[2]/100,n[3]/100,n[4]):Gu.hasOwnProperty(e)?Wu(Gu[e]):e==="transparent"?new Nt(NaN,NaN,NaN,0):null}function Wu(e){return new Nt(e>>16&255,e>>8&255,e&255,1)}function ka(e,n,o,i){return i<=0&&(e=n=o=NaN),new Nt(e,n,o,i)}function ME(e){return e instanceof si||(e=Yn(e)),e?(e=e.rgb(),new Nt(e.r,e.g,e.b,e.opacity)):new Nt}function Cl(e,n,o,i){return arguments.length===1?ME(e):new Nt(e,n,o,i??1)}function Nt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}vl(Nt,Cl,Ku(si,{brighter(e){return e=e==null?_a:Math.pow(_a,e),new Nt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ci:Math.pow(ci,e),new Nt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Nt(qn(this.r),qn(this.g),qn(this.b),Ea(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:Ju,formatHex:Ju,formatHex8:VE,formatRgb:Xu,toString:Xu}));function Ju(){return`#${Wn(this.r)}${Wn(this.g)}${Wn(this.b)}`}function VE(){return`#${Wn(this.r)}${Wn(this.g)}${Wn(this.b)}${Wn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xu(){const e=Ea(this.opacity);return`${e===1?"rgb(":"rgba("}${qn(this.r)}, ${qn(this.g)}, ${qn(this.b)}${e===1?")":`, ${e})`}`}function Ea(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Wn(e){return e=qn(e),(e<16?"0":"")+e.toString(16)}function Zu(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 Qu(e){if(e instanceof Vt)return new Vt(e.h,e.s,e.l,e.opacity);if(e instanceof si||(e=Yn(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 BE(e,n,o,i){return arguments.length===1?Qu(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}vl(Vt,BE,Ku(si,{brighter(e){return e=e==null?_a:Math.pow(_a,e),new Vt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ci:Math.pow(ci,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 Nt(xl(e>=240?e-240:e+120,a,i),xl(e,a,i),xl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Vt(em(this.h),Na(this.s),Na(this.l),Ea(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=Ea(this.opacity);return`${e===1?"hsl(":"hsla("}${em(this.h)}, ${Na(this.s)*100}%, ${Na(this.l)*100}%${e===1?")":`, ${e})`}`}}));function em(e){return e=(e||0)%360,e<0?e+360:e}function Na(e){return Math.max(0,Math.min(1,e||0))}function xl(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 Sl=e=>()=>e;function DE(e,n){return function(o){return e+o*n}}function OE(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 LE(e){return(e=+e)==1?tm:function(n,o){return o-n?OE(n,o,e):Sl(isNaN(n)?o:n)}}function tm(e,n){var o=n-e;return o?DE(e,o):Sl(isNaN(e)?n:e)}const wa=(function e(n){var o=LE(n);function i(a,r){var l=o((a=Cl(a)).r,(r=Cl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=tm(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 PE(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 zE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function FE(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]=ui(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 UE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function Wt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function HE(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]=ui(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Rl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Al=new RegExp(Rl.source,"g");function jE(e){return function(){return e}}function KE(e){return function(n){return e(n)+""}}function nm(e,n){var o=Rl.lastIndex=Al.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Rl.exec(e))&&(a=Al.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:Wt(i,a)})),o=Al.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?KE(c[0].x):jE(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 ui(e,n){var o=typeof n,i;return n==null||o==="boolean"?Sl(n):(o==="number"?Wt:o==="string"?(i=Yn(n))?(n=i,wa):nm:n instanceof Yn?wa:n instanceof Date?UE:zE(n)?PE:Array.isArray(n)?FE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?HE:Wt)(e,n)}var om=180/Math.PI,$l={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function im(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)*om,skewX:Math.atan(c)*om,scaleX:l,scaleY:s}}var Ia;function GE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?$l:im(n.a,n.b,n.c,n.d,n.e,n.f)}function YE(e){return e==null||(Ia||(Ia=document.createElementNS("http://www.w3.org/2000/svg","g")),Ia.setAttribute("transform",e),!(e=Ia.transform.baseVal.consolidate()))?$l:(e=e.matrix,im(e.a,e.b,e.c,e.d,e.e,e.f))}function am(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,f,y){if(d!==m||u!==h){var k=f.push("translate(",null,n,null,o);y.push({i:k-4,x:Wt(d,m)},{i:k-2,x:Wt(u,h)})}else(m||h)&&f.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:Wt(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:Wt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,f,y){if(d!==m||u!==h){var k=f.push(a(f)+"scale(",null,",",null,")");y.push({i:k-4,x:Wt(d,m)},{i:k-2,x:Wt(u,h)})}else(m!==1||h!==1)&&f.push(a(f)+"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(f){for(var y=-1,k=h.length,_;++y<k;)m[(_=h[y]).i]=_.x(f);return m.join("")}}}var qE=am(GE,"px, ","px)","deg)"),WE=am(YE,", ",")",")"),JE=1e-12;function rm(e){return((e=Math.exp(e))+1/e)/2}function XE(e){return((e=Math.exp(e))-1/e)/2}function ZE(e){return((e=Math.exp(2*e))-1)/(e+1)}const va=(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],f=u-s,y=m-c,k=f*f+y*y,_,E;if(k<JE)E=Math.log(h/d)/n,_=function($){return[s+$*f,c+$*y,d*Math.exp(n*$*E)]};else{var N=Math.sqrt(k),p=(h*h-d*d+i*k)/(2*d*o*N),b=(h*h-d*d-i*k)/(2*h*o*N),w=Math.log(Math.sqrt(p*p+1)-p),A=Math.log(Math.sqrt(b*b+1)-b);E=(A-w)/n,_=function($){var L=$*E,T=rm(w),S=d/(o*N)*(T*ZE(n*L+w)-XE(w));return[s+S*f,c+S*y,d*T/rm(n*L+w)]}}return _.duration=E*1e3*n/Math.SQRT2,_}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 To=0,mi=0,fi=0,lm=1e3,Ca,pi,xa=0,Jn=0,Sa=0,hi=typeof performance=="object"&&performance.now?performance:Date,sm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Tl(){return Jn||(sm(QE),Jn=hi.now()+Sa)}function QE(){Jn=0}function Ra(){this._call=this._time=this._next=null}Ra.prototype=cm.prototype={constructor:Ra,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Tl():+o)+(n==null?0:+n),!this._next&&pi!==this&&(pi?pi._next=this:Ca=this,pi=this),this._call=e,this._time=o,Ml()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ml())}};function cm(e,n,o){var i=new Ra;return i.restart(e,n,o),i}function e1(){Tl(),++To;for(var e=Ca,n;e;)(n=Jn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--To}function dm(){Jn=(xa=hi.now())+Sa,To=mi=0;try{e1()}finally{To=0,n1(),Jn=0}}function t1(){var e=hi.now(),n=e-xa;n>lm&&(Sa-=n,xa=e)}function n1(){for(var e,n=Ca,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:Ca=o);pi=e,Ml(i)}function Ml(e){if(!To){mi&&(mi=clearTimeout(mi));var n=e-Jn;n>24?(e<1/0&&(mi=setTimeout(dm,e-hi.now()-Sa)),fi&&(fi=clearInterval(fi))):(fi||(xa=hi.now(),fi=setInterval(t1,lm)),To=1,sm(dm))}}function um(e,n,o){var i=new Ra;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var o1=pa("start","end","cancel","interrupt"),i1=[],mm=0,fm=1,Vl=2,Aa=3,pm=4,Bl=5,$a=6;function Ta(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;a1(e,o,{name:n,index:i,group:a,on:o1,tween:i1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:mm})}function Dl(e,n){var o=Bt(e,n);if(o.state>mm)throw new Error("too late; already scheduled");return o}function Jt(e,n){var o=Bt(e,n);if(o.state>Aa)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 a1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=cm(r,0,o.time);function r(d){o.state=fm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,f;if(o.state!==fm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Aa)return um(l);f.state===pm?(f.state=$a,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=$a,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(um(function(){o.state===Aa&&(o.state=pm,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=Aa,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++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=Bl,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Bl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=$a,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Ma(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<Bl,i.state=$a,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function r1(e){return this.each(function(){Ma(this,e)})}function l1(e,n){var o,i;return function(){var a=Jt(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 s1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Jt(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 c1(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?l1:s1)(o,e,n))}function Ol(e,n,o){var i=e._id;return e.each(function(){var a=Jt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Bt(a,i).value[n]}}function hm(e,n){var o;return(typeof n=="number"?Wt:n instanceof Yn?wa:(o=Yn(n))?(n=o,wa):nm)(e,n)}function d1(e){return function(){this.removeAttribute(e)}}function u1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function m1(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 f1(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 p1(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 h1(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 y1(e,n){var o=ya(e),i=o==="transform"?WE:hm;return this.attrTween(e,typeof n=="function"?(o.local?h1:p1)(o,i,Ol(this,"attr."+e,n)):n==null?(o.local?u1:d1)(o):(o.local?f1:m1)(o,i,n))}function g1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function b1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function _1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&b1(e,r)),o}return a._value=n,a}function k1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&g1(e,r)),o}return a._value=n,a}function E1(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=ya(e);return this.tween(o,(i.local?_1:k1)(i,n))}function N1(e,n){return function(){Dl(this,e).delay=+n.apply(this,arguments)}}function w1(e,n){return n=+n,function(){Dl(this,e).delay=n}}function I1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?N1:w1)(n,e)):Bt(this.node(),n).delay}function v1(e,n){return function(){Jt(this,e).duration=+n.apply(this,arguments)}}function C1(e,n){return n=+n,function(){Jt(this,e).duration=n}}function x1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?v1:C1)(n,e)):Bt(this.node(),n).duration}function S1(e,n){if(typeof n!="function")throw new Error;return function(){Jt(this,e).ease=n}}function R1(e){var n=this._id;return arguments.length?this.each(S1(n,e)):Bt(this.node(),n).ease}function A1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Jt(this,e).ease=o}}function $1(e){if(typeof e!="function")throw new Error;return this.each(A1(this._id,e))}function T1(e){typeof e!="function"&&(e=Mu(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 sn(i,this._parents,this._name,this._id)}function M1(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,f=0;f<u;++f)(h=c[f]||d[f])&&(m[f]=h);for(;s<i;++s)l[s]=n[s];return new sn(l,this._parents,this._name,this._id)}function V1(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 B1(e,n,o){var i,a,r=V1(n)?Dl:Jt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function D1(e,n){var o=this._id;return arguments.length<2?Bt(this.node(),o).on.on(e):this.each(B1(o,e,n))}function O1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function L1(){return this.on("end.remove",O1(this._id))}function P1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=El(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,Ta(d[h],n,o,h,d,Bt(u,o)));return new sn(r,this._parents,n,o)}function z1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Tu(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),f,y=Bt(u,o),k=0,_=h.length;k<_;++k)(f=h[k])&&Ta(f,n,o,k,h,y);r.push(h),l.push(u)}return new sn(r,l,n,o)}var F1=ri.prototype.constructor;function U1(){return new F1(this._groups,this._parents)}function H1(e,n){var o,i,a;return function(){var r=Ro(this,e),l=(this.style.removeProperty(e),Ro(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function ym(e){return function(){this.style.removeProperty(e)}}function j1(e,n,o){var i,a=o+"",r;return function(){var l=Ro(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function K1(e,n,o){var i,a,r;return function(){var l=Ro(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Ro(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function G1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Jt(this,e),d=c.on,u=c.value[r]==null?s||(s=ym(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function Y1(e,n,o){var i=(e+="")=="transform"?qE:hm;return n==null?this.styleTween(e,H1(e,i)).on("end.style."+e,ym(e)):typeof n=="function"?this.styleTween(e,K1(e,i,Ol(this,"style."+e,n))).each(G1(this._id,e)):this.styleTween(e,j1(e,i,n),o).on("end.style."+e,null)}function q1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function W1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&q1(e,l,o)),i}return r._value=n,r}function J1(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,W1(e,n,o??""))}function X1(e){return function(){this.textContent=e}}function Z1(e){return function(){var n=e(this);this.textContent=n??""}}function Q1(e){return this.tween("text",typeof e=="function"?Z1(Ol(this,"text",e)):X1(e==null?"":e+""))}function e0(e){return function(n){this.textContent=e.call(this,n)}}function t0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&e0(a)),n}return i._value=e,i}function n0(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,t0(e))}function o0(){for(var e=this._name,n=this._id,o=gm(),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);Ta(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new sn(i,this._parents,e,o)}function i0(){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=Jt(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 a0=0;function sn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function gm(){return++a0}var cn=ri.prototype;sn.prototype={constructor:sn,select:P1,selectAll:z1,selectChild:cn.selectChild,selectChildren:cn.selectChildren,filter:T1,merge:M1,selection:U1,transition:o0,call:cn.call,nodes:cn.nodes,node:cn.node,size:cn.size,empty:cn.empty,each:cn.each,on:D1,attr:y1,attrTween:E1,style:Y1,styleTween:J1,text:Q1,textTween:n0,remove:L1,tween:c1,delay:I1,duration:x1,ease:R1,easeVarying:$1,end:i0,[Symbol.iterator]:cn[Symbol.iterator]};function r0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var l0={time:null,delay:0,duration:250,ease:r0};function s0(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 c0(e){var n,o;e instanceof sn?(n=e._id,e=e._name):(n=gm(),(o=l0).time=Tl(),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])&&Ta(c,e,n,d,l,o||s0(c,n));return new sn(i,this._parents,e,n)}ri.prototype.interrupt=r1,ri.prototype.transition=c0;const Va=e=>()=>e;function d0(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 dn(e,n,o){this.k=e,this.x=n,this.y=o}dn.prototype={constructor:dn,scale:function(e){return e===1?this:new dn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new dn(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 Mo=new dn(1,0,0);dn.prototype;function Ll(e){e.stopImmediatePropagation()}function yi(e){e.preventDefault(),e.stopImmediatePropagation()}function u0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function m0(){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 bm(){return this.__zoom||Mo}function f0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function p0(){return navigator.maxTouchPoints||"ontouchstart"in this}function h0(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 y0(){var e=u0,n=m0,o=h0,i=f0,a=p0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=va,d=pa("start","zoom","end"),u,m,h,f=500,y=150,k=0,_=10;function E(g){g.property("__zoom",bm).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(g,I,v,O){var x=g.selection?g.selection():g;x.property("__zoom",bm),g!==x?w(g,I,v,O):x.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},E.scaleBy=function(g,I,v,O){E.scaleTo(g,function(){var x=this.__zoom.k,z=typeof I=="function"?I.apply(this,arguments):I;return x*z},v,O)},E.scaleTo=function(g,I,v,O){E.transform(g,function(){var x=n.apply(this,arguments),z=this.__zoom,j=v==null?b(x):typeof v=="function"?v.apply(this,arguments):v,ne=z.invert(j),de=typeof I=="function"?I.apply(this,arguments):I;return o(p(N(z,de),j,ne),x,l)},v,O)},E.translateBy=function(g,I,v,O){E.transform(g,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,O)},E.translateTo=function(g,I,v,O,x){E.transform(g,function(){var z=n.apply(this,arguments),j=this.__zoom,ne=O==null?b(z):typeof O=="function"?O.apply(this,arguments):O;return o(Mo.translate(ne[0],ne[1]).scale(j.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),z,l)},O,x)};function N(g,I){return I=Math.max(r[0],Math.min(r[1],I)),I===g.k?g:new dn(I,g.x,g.y)}function p(g,I,v){var O=I[0]-v[0]*g.k,x=I[1]-v[1]*g.k;return O===g.x&&x===g.y?g:new dn(g.k,O,x)}function b(g){return[(+g[0][0]+ +g[1][0])/2,(+g[0][1]+ +g[1][1])/2]}function w(g,I,v,O){g.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var x=this,z=arguments,j=A(x,z).event(O),ne=n.apply(x,z),de=v==null?b(ne):typeof v=="function"?v.apply(x,z):v,pe=Math.max(ne[1][0]-ne[0][0],ne[1][1]-ne[0][1]),he=x.__zoom,fe=typeof I=="function"?I.apply(x,z):I,ye=c(he.invert(de).concat(pe/he.k),fe.invert(de).concat(pe/fe.k));return function(_e){if(_e===1)_e=fe;else{var Re=ye(_e),ce=pe/Re[2];_e=new dn(ce,de[0]-Re[0]*ce,de[1]-Re[1]*ce)}j.zoom(null,_e)}})}function A(g,I,v){return!v&&g.__zooming||new $(g,I)}function $(g,I){this.that=g,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(g,I),this.taps=0}$.prototype={event:function(g){return g&&(this.sourceEvent=g),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(g,I){return this.mouse&&g!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&g!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&g!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(g){var I=Mt(this.that).datum();d.call(g,this.that,new d0(g,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),I)}};function L(g,...I){if(!e.apply(this,arguments))return;var v=A(this,I).event(g),O=this.__zoom,x=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),z=Yt(g);if(v.wheel)(v.mouse[0][0]!==z[0]||v.mouse[0][1]!==z[1])&&(v.mouse[1]=O.invert(v.mouse[0]=z)),clearTimeout(v.wheel);else{if(O.k===x)return;v.mouse=[z,O.invert(z)],Ma(this),v.start()}yi(g),v.wheel=setTimeout(j,y),v.zoom("mouse",o(p(N(O,x),v.mouse[0],v.mouse[1]),v.extent,l));function j(){v.wheel=null,v.end()}}function T(g,...I){if(h||!e.apply(this,arguments))return;var v=g.currentTarget,O=A(this,I,!0).event(g),x=Mt(g.view).on("mousemove.zoom",de,!0).on("mouseup.zoom",pe,!0),z=Yt(g,v),j=g.clientX,ne=g.clientY;Hu(g.view),Ll(g),O.mouse=[z,this.__zoom.invert(z)],Ma(this),O.start();function de(he){if(yi(he),!O.moved){var fe=he.clientX-j,ye=he.clientY-ne;O.moved=fe*fe+ye*ye>k}O.event(he).zoom("mouse",o(p(O.that.__zoom,O.mouse[0]=Yt(he,v),O.mouse[1]),O.extent,l))}function pe(he){x.on("mousemove.zoom mouseup.zoom",null),ju(he.view,O.moved),yi(he),O.event(he).end()}}function S(g,...I){if(e.apply(this,arguments)){var v=this.__zoom,O=Yt(g.changedTouches?g.changedTouches[0]:g,this),x=v.invert(O),z=v.k*(g.shiftKey?.5:2),j=o(p(N(v,z),O,x),n.apply(this,I),l);yi(g),s>0?Mt(this).transition().duration(s).call(w,j,O,g):Mt(this).call(E.transform,j,O,g)}}function C(g,...I){if(e.apply(this,arguments)){var v=g.touches,O=v.length,x=A(this,I,g.changedTouches.length===O).event(g),z,j,ne,de;for(Ll(g),j=0;j<O;++j)ne=v[j],de=Yt(ne,this),de=[de,this.__zoom.invert(de),ne.identifier],x.touch0?!x.touch1&&x.touch0[2]!==de[2]&&(x.touch1=de,x.taps=0):(x.touch0=de,z=!0,x.taps=1+!!u);u&&(u=clearTimeout(u)),z&&(x.taps<2&&(m=de[0],u=setTimeout(function(){u=null},f)),Ma(this),x.start())}}function M(g,...I){if(this.__zooming){var v=A(this,I).event(g),O=g.changedTouches,x=O.length,z,j,ne,de;for(yi(g),z=0;z<x;++z)j=O[z],ne=Yt(j,this),v.touch0&&v.touch0[2]===j.identifier?v.touch0[0]=ne:v.touch1&&v.touch1[2]===j.identifier&&(v.touch1[0]=ne);if(j=v.that.__zoom,v.touch1){var pe=v.touch0[0],he=v.touch0[1],fe=v.touch1[0],ye=v.touch1[1],_e=(_e=fe[0]-pe[0])*_e+(_e=fe[1]-pe[1])*_e,Re=(Re=ye[0]-he[0])*Re+(Re=ye[1]-he[1])*Re;j=N(j,Math.sqrt(_e/Re)),ne=[(pe[0]+fe[0])/2,(pe[1]+fe[1])/2],de=[(he[0]+ye[0])/2,(he[1]+ye[1])/2]}else if(v.touch0)ne=v.touch0[0],de=v.touch0[1];else return;v.zoom("touch",o(p(j,ne,de),v.extent,l))}}function B(g,...I){if(this.__zooming){var v=A(this,I).event(g),O=g.changedTouches,x=O.length,z,j;for(Ll(g),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),z=0;z<x;++z)j=O[z],v.touch0&&v.touch0[2]===j.identifier?delete v.touch0:v.touch1&&v.touch1[2]===j.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&&(j=Yt(j,this),Math.hypot(m[0]-j[0],m[1]-j[1])<_)){var ne=Mt(this).on("dblclick.zoom");ne&&ne.apply(this,arguments)}}}return E.wheelDelta=function(g){return arguments.length?(i=typeof g=="function"?g:Va(+g),E):i},E.filter=function(g){return arguments.length?(e=typeof g=="function"?g:Va(!!g),E):e},E.touchable=function(g){return arguments.length?(a=typeof g=="function"?g:Va(!!g),E):a},E.extent=function(g){return arguments.length?(n=typeof g=="function"?g:Va([[+g[0][0],+g[0][1]],[+g[1][0],+g[1][1]]]),E):n},E.scaleExtent=function(g){return arguments.length?(r[0]=+g[0],r[1]=+g[1],E):[r[0],r[1]]},E.translateExtent=function(g){return arguments.length?(l[0][0]=+g[0][0],l[1][0]=+g[1][0],l[0][1]=+g[0][1],l[1][1]=+g[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(g){return arguments.length?(o=g,E):o},E.duration=function(g){return arguments.length?(s=+g,E):s},E.interpolate=function(g){return arguments.length?(c=g,E):c},E.on=function(){var g=d.on.apply(d,arguments);return g===d?E:g},E.clickDistance=function(g){return arguments.length?(k=(g=+g)*g,E):Math.sqrt(k)},E.tapDistance=function(g){return arguments.length?(_=+g,E):_},E}var Me=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Me||{}),Pl=(e=>(e.Partial="partial",e.Full="full",e))(Pl||{}),Xn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Xn||{}),un=(e=>(e.Strict="strict",e.Loose="loose",e))(un||{}),zl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(zl||{}),gi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(gi||{}),_m=(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))(_m||{});const g0=["INPUT","SELECT","TEXTAREA"],b0=typeof document<"u"?document:null;function Fl(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 g0.includes(i==null?void 0:i.nodeName)||a||!!r}function _0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function km(e,n,o,i){const a=n.replace("+",`
|
|
27
|
+
`}}const fa="com.example",Eg="command.domain";function si(e,n,o={}){const i=aa(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??Eg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Ng="CustomMoneyType",wg="Money";function Ig(e){return!(e.type!==Ng||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function vg(e){const n=e.dbAttrs[0]??{modelId:Pe(),physicalName:"",dataType:""},o={modelId:Pe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:wg,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Cg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Ig(l)?(a=!0,n=!0,vg(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 _=new Map,g=new Map,b=new Map,E=(h,N,w)=>{if(!h)return;o.get(h)||o.set(h,[{entityId:N,assignedId:h}]),i.push({id:h,entityId:N,sink:w}),w(h)};for(const h of y.attributes){E(h.modelId,y.modelId,N=>_.set(h,N));for(const N of h.dbAttrs)E(N.modelId,y.modelId,w=>g.set(N,w))}for(const h of y.indexes??[])E(h.modelId,y.modelId,N=>b.set(h,N));a.set(y,{attrs:_,cols:g,idx:b})}const r=new Set(o.keys()),l=new Map;for(const y of i){const _=(l.get(y.id)??0)+1;if(l.set(y.id,_),_===1)continue;const g=xg(y.id,_-1,r);r.add(g),o.get(y.id).push({entityId:y.entityId,assignedId:g}),y.sink(g)}const s=[...o.values()].reduce((y,_)=>y+Math.max(0,_.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,_)=>{var b;if(!_||!y)return _;const g=o.get(_);return!g||g.length<2?_:((b=g.find(E=>E.entityId===y))==null?void 0:b.assignedId)??_},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,_)=>{const g=d.get(y);if(g)return g.end1.entityRef===_?g.end2.entityRef:g.end1.entityRef},m=e.entities.map(y=>{var h;const _=a.get(y),g=y.attributes.map(N=>{const w=_.attrs.get(N),C=N.dbAttrs.map($=>{const R=_.cols.get($);return R===$.modelId?$:{...$,modelId:R}});let S=N.derivedFrom;if(S){const $=u(S.associationRef,y.modelId),R=c($,S.sourceAttributeRef);R!==S.sourceAttributeRef&&(S={...S,sourceAttributeRef:R})}return w!==N.modelId||S!==N.derivedFrom||C.some(($,R)=>$!==N.dbAttrs[R])?{...N,modelId:w,dbAttrs:C,derivedFrom:S}:N}),b=(h=y.indexes)==null?void 0:h.map(N=>{const w=_.idx.get(N),C=N.columns.map(V=>{const $=c(y.modelId,V.columnRef);return $===V.columnRef?V:{...V,columnRef:$}});return w!==N.modelId||C.some((V,$)=>V!==N.columns[$])?{...N,modelId:w,columns:C}:N});return g.some((N,w)=>N!==y.attributes[w])||b&&y.indexes&&b.some((N,w)=>N!==y.indexes[w])?{...y,attributes:g,...b?{indexes:b}:{}}:y}),p=e.associations.map(y=>{const _=c(y.end1.entityRef,y.end1.attributeRef),g=c(y.end2.entityRef,y.end2.attributeRef);return _===y.end1.attributeRef&&g===y.end2.attributeRef?y:{...y,end1:_===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:_},end2:g===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:g}}}),f=n.associationLayouts.map(y=>{const _=d.get(y.associationRef);if(!_)return y;const g=c(_.end1.entityRef,y.sourceColumnRef),b=c(_.end2.entityRef,y.targetColumnRef);return g===y.sourceColumnRef&&b===y.targetColumnRef?y:{...y,sourceColumnRef:g,targetColumnRef:b}});return{logical:{...e,entities:m,associations:p},layout:f.some((y,_)=>y!==n.associationLayouts[_])?{...n,associationLayouts:f}:n,reissued:s}}function xg(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function zt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function dl(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 ed(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function td(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(ed);if(!i.length)continue;const a=o.filter(s=>!ed(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 nd(e,n,o){var V;const i=o.idFactory??Pe,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const $=new Set(n);for(const R of r.associations){const x=$.has(R.end1.entityRef),T=$.has(R.end2.entityRef);x!==T&&s.add(x?R.end2.entityRef:R.end1.entityRef)}}const c=r.entities.filter($=>s.has($.modelId)),d=new Set(c.map($=>$.modelId)),u=r.associations.filter($=>d.has($.end1.entityRef)&&d.has($.end2.entityRef)),m=new Set(u.map($=>$.modelId)),p=new Map,f=$=>{let R=p.get($);return R||(R=i(),p.set($,R)),R};for(const $ of c){f($.modelId);for(const R of $.attributes){f(R.modelId);for(const x of R.dbAttrs)f(x.modelId)}for(const R of $.indexes??[])f(R.modelId);for(const R of $.operations??[])f(R.modelId)}for(const $ of u)f($.modelId);const y=$=>p.get($),_=c.map($=>{const R=$o($);R.modelId=y($.modelId),R.attributes=R.attributes.map(x=>Rg(x,y,m,d));for(const x of R.indexes??[])x.modelId=y(x.modelId),x.columns=x.columns.map(T=>jn(T.columnRef)?T:{...T,columnRef:y(T.columnRef)}).filter(T=>T.columnRef!==void 0);for(const x of R.operations??[])x.modelId=y(x.modelId);return R});td(_);const g=u.map($=>{const R=$o($);return R.modelId=y($.modelId),R.end1=od(R.end1,y),R.end2=od(R.end2,y),R}),b=[];for(const $ of r.groups){const R=$.memberEntityRefs.filter(T=>d.has(T));if(R.length===0)continue;const x=$o($);x.modelId=f($.modelId),x.memberEntityRefs=R.map(T=>y(T)),b.push(x)}const E=o.collisionSuffix??"_imported",h=new Set(o.existing.entities.map($=>$.name)),N=new Set(o.existing.entities.map($=>{var R;return(R=$.table)==null?void 0:R.physicalName}).filter($=>!!$));for(const $ of _)h.has($.name)&&($.name=`${$.name}${E}`),(V=$.table)!=null&&V.physicalName&&N.has($.table.physicalName)&&($.table.physicalName=`${$.table.physicalName}${E}`);const w=[];for(const $ of l.entityLayouts){const R=y($.entityRef);if(!R)continue;const x=$o($);x.entityRef=R,x.geo={...x.geo,location:ul(x.geo.location,a)},x.attributeStyles&&(x.attributeStyles=pa(x.attributeStyles,y)),x.operationStyles&&(x.operationStyles=pa(x.operationStyles,y)),w.push(x)}const C=[];for(const $ of l.associationLayouts){const R=y($.associationRef);if(!R)continue;const x=$o($);x.associationRef=R,x.sourceColumnRef=$.sourceColumnRef?y($.sourceColumnRef):void 0,x.targetColumnRef=$.targetColumnRef?y($.targetColumnRef):void 0,x.waypoints=x.waypoints.map(T=>ul(T,a)),C.push(x)}const S=[];for(const $ of l.groupLayouts){const R=y($.groupRef);if(!R)continue;const x=$o($);x.groupRef=R,x.geo={...x.geo,location:ul(x.geo.location,a)},delete x.memberNoteRefs,S.push(x)}return{logical:{entities:_,associations:g,groups:b},layout:{entityLayouts:w,associationLayouts:C,groupLayouts:S},idMap:p}}function ul(e,n){return{x:e.x+n.x,y:e.y+n.y}}function Rg(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 od(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function pa(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function ml(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function Jn(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)=>Jn(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(!Jn(e[i],n[i]))return!1;return!0}return!1}function Xn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||Jn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Zn(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 Ag(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"]),Tg=new Set(["end1","end2","rev"]),Mg=new Set(["memberEntityRefs","rev"]),id=new Set(["modelId"]),Vg=new Set(["modelId","columns"]),Bg=new Set([]);function Dg(e,n,o,i){const a=Zn(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=Xn(s,c,id);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Zn(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=Xn(s,c,id);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Zn(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(!Jn(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=Xn(s,c,Vg);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Og(e,n,o){const i=Zn(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:ml(l)});for(const{cur:l,tgt:s}of i.common){const c=Xn(l,s,$g);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Dg(l.modelId,l,s,o)}const a=Zn(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:ml(l)});for(const{cur:l,tgt:s}of a.common){const c=Xn(l,s,Tg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=Xn(l[d]??{},s[d]??{},Bg);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=Zn(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:ml(l)});for(const{cur:l,tgt:s}of r.common){const c=Xn(l,s,Mg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Ag(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 ha(e,n,o,i,a,r,l){const s=Zn(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)Jn(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 Lg(e,n,o){ha(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ha(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ha(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ha(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Pg(e,n){const o=[];return Og(e.logical,n.logical,o),Lg(e.layout,n.layout,o),o}function zg(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 Fg={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 Ug{constructor(n){ct(this,"out",[]);ct(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({...ci(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({...ci(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({...ci(n),field:a,value:void 0,removed:!0});continue}this.out.push({...ci(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({...ci(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function ci(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 en(e,n,o,i){if(o==null||typeof o!="object")return;const a=Fg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Qn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function fl(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Tn(e,n){var r,l,s,c,d,u,m,p;const o=zg(n),i=new Ug(n.field),a=[...e].sort((f,y)=>f.seq-y.seq);for(const f of a)for(const y of f.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?en(i,f,y.value,"entity"):y.kind==="entity.update"?Qn(i,f,y.patch):y.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const _=fl((r=y.value)==null?void 0:r.attributes,n.attributeRef);_&&en(i,f,_,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?en(i,f,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Qn(i,f,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(f);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const _=fl((s=y.value)==null?void 0:s.operations,n.operationRef);_&&en(i,f,_,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?en(i,f,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Qn(i,f,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(f);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const _=fl((d=y.value)==null?void 0:d.indexes,n.indexRef);_&&en(i,f,_,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?en(i,f,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Qn(i,f,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(f);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?en(i,f,y.value,"association"):y.kind==="association.update"?Qn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const _=(m=y.value)==null?void 0:m[n.end];en(i,f,_,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Qn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){en(i,f,y.value,"group");const _=(p=y.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(_))for(const g of _)i.member(f,g,!1)}else y.kind==="group.update"?Qn(i,f,y.patch):y.kind==="group.remove"?i.remove(f):y.kind==="group.addMember"&&y.entityRef!=null?i.member(f,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(f,y.entityRef,!0);break}return i.result()}const at={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},Hg={"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":at,"entityLayout.remove":at,"entityLayout.move":at,"entityLayout.resize":at,"entityLayout.setCollapsed":at,"entityLayout.setLocked":at,"entityLayout.setStyle":at,"entityLayout.setAttrStyle":at,"entityLayout.setOpStyle":at,"groupLayout.add":at,"groupLayout.remove":at,"groupLayout.move":at,"groupLayout.resize":at,"groupLayout.setLocked":at,"groupLayout.setStyle":at,"groupLayout.addNoteMember":at,"groupLayout.removeNoteMember":at,"associationLayout.add":at,"associationLayout.remove":at,"associationLayout.setWaypoints":at,"note.add":at,"note.remove":at,"note.move":at,"note.resize":at,"note.setMemo":at,"note.setStyle":at,"noteConnection.add":at,"noteConnection.remove":at,"noteConnection.setWaypoints":at},Ft=e=>typeof e=="string"?e:void 0,jg=e=>{var n;return Ft((n=e.value)==null?void 0:n.modelId)};function ad(e){return Ft(e.containerRef)??Ft(e.entityRef)}function pl(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=Ft(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function hl(e){const n=Hg[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=Ft(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...pl(o,"attributes","attribute",a),...pl(o,"operations","operation",a),...pl(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=ad(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?jg(o):Ft(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=Ft(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=Ft(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Kg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=Ft(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=ad(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=Ft(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=Ft(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function Gg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Yg(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 hl(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 ya(e,n){return e.map(o=>({...o,subject:n}))}function rd(e,n){const o=e.filter(s=>s.ops.some(c=>Gg(c,n))),{attributes:i,operations:a,indexes:r}=Yg(o,n),l=[...ya(Tn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...ya(Tn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...ya(Tn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...ya(Tn(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 yl(e){return`${e.kind}:${e.ref}:${e.end??""}`}function qg(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of hl(i))a.existence==="add"&&n.add(yl(a.subject));return n}function Wg(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=Kg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Jg(e){const{entities:n,associations:o,groups:i}=Wg(e),a=[];for(const r of n)for(const l of rd(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Tn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Tn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Tn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function gl(e){const n=Jg(e),o=qg(e),i=new Map;for(const l of n){const s=yl(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=yl(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 ld(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Xg(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 hl(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 bl(e,n){const{fromSeq:o}=n,i=gl(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=ld(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 Xg(e,o,r)){const p=s.get(ld(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,y)=>f.seq-y.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 y=new Map;let _=null;for(const b of m.evs){b.verb==="add"&&_!==null&&_!=="add"&&y.clear(),_=b.verb;for(const E of b.fields){const h=y.get(E.field);h?h.lastValue=E.value:y.set(E.field,{firstOld:E.oldValue,hasOld:E.oldValue!==void 0,lastValue:E.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const b=[];for(const[E,h]of y)b.push({field:E,value:h.lastValue});d.push({subject:m.subject,verb:"added",fields:b});continue}const g=[];for(const[b,E]of y)E.hasOld&&Jn(E.firstOld,E.lastValue)||g.push({field:b,value:E.lastValue,...E.hasOld?{oldValue:E.firstOld}:{}});g.length!==0&&d.push({subject:m.subject,verb:"modified",fields:g})}return{fromSeq:o,toSeq:r,entries:d}}function sd(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 _l{constructor(n){ct(this,"undoStack",[]);ct(this,"redoStack",[]);ct(this,"savePoint",null);ct(this,"listeners",new Set);ct(this,"commandListeners",new Set);ct(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 Mt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function cd(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function _t(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Ut(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function dt(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function yn(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 ga(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=cd(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=_t(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 dd(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=cd(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=_t(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 ud(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=dt(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(dt(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Mt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Mt(o)}]}}}}function md(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=dt(i,e);o=a.name,a.name=n},invert(i){dt(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 To(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=_t(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=_t(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 fd(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=_t(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=_t(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 di(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 pd(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=_t(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=di(r.style,n)},invert(i){const a=_t(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=_t(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 hd(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=_t(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=_t(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 yd(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=_t(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=_t(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 kl(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 ba(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=_t(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=di(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=_t(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=_t(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 _a(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 gd(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:Mt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Mt(o)}]}}}}function bd(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 _d(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 ka(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 kd(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 Ed(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 Nd(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=di(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 wd(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 tn(e,n){return{label:`속성 추가: ${n.name}`,apply(o){dt(o,e).attributes.push(n)},invert(o){const i=dt(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 nn(e,n,o){const i={},a=r=>{const l=dt(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:Mt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Mt(i)}]}}}}function Id(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=dt(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&&dt(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 vd(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=dt(a,e);i=r.attributes.map(s=>({...s}));const l=dl([...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&&dt(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=dt(a,e).attributes;return vd("attribute.update","attributeRef",e,r,i??[])}}}function Cd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=dt(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=dt(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 Sd(e,n,o){const i={},a=r=>{var s;const l=(s=dt(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:Mt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Mt(i)}]}}}}function xd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=dt(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=dt(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 Rd(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=dt(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=dl([...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=dt(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=dt(a,e).operations??[];return vd("operation.update","operationRef",e,r,i??[])}}}function Ad(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=_t(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=di(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=_t(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=_t(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 Ea(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 $d(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 Na(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:Mt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Mt(o)}]}}}}function Ht(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:Mt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Mt(i)}]}}}}function Td(e,n){return{label:"인덱스 추가",apply(o){const i=dt(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=dt(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 wa(e,n,o){const i={},a=r=>{var s;const l=(s=dt(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:Mt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Mt(i)}]}}}}function Md(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=dt(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&&dt(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 on=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ui=(e,n)=>{var o;return((o=Ut(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Vd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Ut(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=Ut(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ui(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[on(e,r)],invert:[on(e,l)]}}}}function Bd(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Ut(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=Ut(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ui(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[on(e,a)],invert:[on(e,r)]}}}}function Dd(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Ut(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=Ut(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[on(e,ui(a,e))],invert:[on(e,i??[])]}}}}function Od(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Ut(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Ut(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[on(e,ui(o,e))],invert:[on(e,n??[])]}}}}function Ld(e,n,o){return{label:"waypoint 추가",apply(i){const a=Ut(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Ut(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ui(i,e),r=a.slice();return r.splice(n,1),{forward:[on(e,a)],invert:[on(e,r)]}}}}function Pd(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 zd(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 mi(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 Fd(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 Ud(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 Hd(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=di(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 jd(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 Kd(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 Mn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),Ia=(e,n,o)=>{var i;return((i=yn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Gd(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 Yd(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 qd(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=yn(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=yn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Ia(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Mn(e,n,l)],invert:[Mn(e,n,s)]}}}}function Wd(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=yn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=yn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Ia(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Mn(e,n,r)],invert:[Mn(e,n,l)]}}}}function Jd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=yn(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=yn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Ia(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Mn(e,n,r)],invert:[Mn(e,n,l)]}}}}function Xd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=yn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=yn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Mn(e,n,Ia(i,e,n))],invert:[Mn(e,n,o??[])]}}}}function rt(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 Qg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ea,addAttribute:tn,addEntity:ga,addEntityToGroup:_d,addGroup:_a,addIndex:Td,addNote:Pd,addNoteConnection:Gd,addNoteConnectionWaypoint:Wd,addNoteToGroup:jd,addOperation:Cd,addWaypoint:Ld,clearNoteConnectionWaypoints:Xd,clearWaypoints:Od,composite:rt,moveEntity:To,moveGroup:kd,moveNote:mi,moveNoteConnectionWaypoint:qd,moveWaypoint:Vd,removeAssociation:$d,removeAttribute:Id,removeEntity:dd,removeEntityFromGroup:ka,removeGroup:bd,removeIndex:Md,removeNote:zd,removeNoteConnection:Yd,removeNoteConnectionWaypoint:Jd,removeNoteFromGroup:Kd,removeOperation:xd,removeWaypoint:Bd,renameEntity:md,reorderAttributes:El,reorderOperations:Rd,resizeEntity:fd,resizeGroup:Ed,resizeNote:Fd,setAllEntitiesCollapsed:kl,setAttributeSwatch:ba,setEntityCollapsed:hd,setEntityLocked:yd,setEntitySwatch:pd,setGroupLocked:wd,setGroupSwatch:Nd,setNoteMemo:Ud,setNoteSwatch:Hd,setOperationSwatch:Ad,translateWaypoints:Dd,updateAssociation:Na,updateAssociationEnd:Ht,updateAttribute:nn,updateEntity:ud,updateGroup:gd,updateIndex:wa,updateOperation:Sd},Symbol.toStringTag,{value:"Module"}));class Zd{constructor(){ct(this,"revs",new Map);ct(this,"layoutVersion",0);ct(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 eb=[400,1200];function tb(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 nb(e){const n=tb(e);return n==null||n===408||n===429?!0:n<400||n>=500}const ob=e=>new Promise(n=>setTimeout(n,e));class Qd{constructor(n){ct(this,"cache",new Zd);ct(this,"newClientOpId");ct(this,"debounceMs");ct(this,"retryDelaysMs");ct(this,"emissions",new WeakMap);ct(this,"open",null);ct(this,"debounceHandle",null);ct(this,"queue",[]);ct(this,"sending",!1);ct(this,"_frozen",!1);ct(this,"stack",null);ct(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Pe,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??eb}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||!nb(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await ob(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 eu=["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"],tu=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function nu(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 ib(e){return fn(e).length}function Nl(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 ab(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=ni(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 ou(e,n,o=Pe){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=ib(i);if(a===0)return[];const r=Nl(e,n),l=fn(i).map(c=>c.col),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;ab(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 iu(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 y=r.get(f);if(!y)return[];l.push(y)}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,y)=>f===c[y]))return[];const d=new Map(s.map((f,y)=>[f,y])),u=Nl(e,n),m=[];for(const f of e.entities)for(const y of f.attributes){if(y.attrType!=="EMBED_OWN"||((p=y.embedded)==null?void 0:p.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const _=c.map(b=>y.dbAttrs[d.get(b)]),g=_.reduce((b,E,h)=>E===y.dbAttrs[h]?b:b+1,0);g&&m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:_,moved:g})}return m}function au(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=fn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(fn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,y)=>{c.has(f)&&d.add(y)}),d.size===s.length)return[];const u=Nl(e,n),m=[];for(const f of e.entities)for(const y of f.attributes){if(y.attrType!=="EMBED_OWN"||((p=y.embedded)==null?void 0:p.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const _=y.dbAttrs.filter((E,h)=>d.has(h)),g=y.dbAttrs.filter((E,h)=>!d.has(h));y.dbAttrs.some((E,h)=>{if(d.has(h))return!1;const N=l[h],w=!!E.physicalName&&E.physicalName!==((N==null?void 0:N.physicalName)??""),C=E.sharedColumnRef!=null&&E.sharedColumnRef!==(N==null?void 0:N.sharedColumnRef);return w||C})||m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:_,dropped:g})}return m}function rb(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 lb(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 ru(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function wt(e,n){const o=rb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>db(i,e))}}function sb(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 wl(e,n){const o=sb(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 Il(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 cb=new Set(["name","description","packageName","excludeDDLGeneration"]);function db(e,n){var a;const o=aa(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 lu(e,n){const o=lb(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 ub(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 mb(e,n){const o=ub(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 su(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 vl(e){return e.by!==void 0&&e.by!=="name"}function fb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function pb(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function hb(e,n){const o=fb(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 cu(e,n){const o=pb(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 du(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function uu(e){return du(e)&&e.dataType==null}function mu(e,n,o){const i=du(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 fu(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 y=u.get(f.name);if(y!=null&&y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=su($n(i,a),_);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:g.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:g.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 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 yb=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName"]),gb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),bb=new Set(["description","identifying"]),_b=new Set(["multiplicity","navigable","composition"]),kb=new Set(["name","unique","description","parameters"]),Eb=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Mo(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 Cl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),Nb=new Set([...Cl].filter(e=>e!=="sharedColumnRef"));function wb(e,n,o,i){if(i||o.some(l=>!Nb.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))Cl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function Ib(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],y=f?c.get(f.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const g={ref:y.sharedColumnPhysicalName,by:"physicalName"},b=su($n(i,a),g);if(!b.ok){s.push(b.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:b.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});return}const _={...m};delete _.sharedColumnRef,d.push({..._,...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 pu(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 hu(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=mb(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 Vo(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 vb(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 nu(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function Cb(e,n,o,i,a,r){const l=m=>{const p=new Map;for(const{entityId:f,item:y}of m){if(a.has(f))continue;const _=p.get(f)??[];_.push(y),p.set(f,_)}return p},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,p]of s)if(!c.has(m))for(const f of au(n,m,p))u(f);for(const[m,p]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(y=>y.modelId===m?{...y,attributes:[...y.attributes,...p]}:y)};for(const y of ou(f,m,r))u(y)}}function Sl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of Oc(n,o,i)){for(const u of c.remove)Vo(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??Pe,a=o.embeddableCatalog??[],r=h=>a.find(N=>N.type===h),l=[],s=[],c=new Map,d=(h,N)=>{const w=c.get(h)??zt(N);return c.set(h,w+1),w},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},y=[],_=new Set,g=(h,N)=>`${h}\0${N}`,b=new Set;for(const h of n)h.kind==="entity.add"&&(b.add(h.spec.name),h.spec.physicalName&&b.add(h.spec.physicalName));const E=new Set;return n.forEach((h,N)=>{var w,C,S,V,$;switch(h.kind){case"entity.add":{const R=e.entities.filter(O=>O.name===h.spec.name).map(O=>O.modelId);if(R.length||E.has(h.spec.name)){s.push({code:"entity-name-conflict",opIndex:N,handle:{ref:h.spec.name},matches:R});break}E.add(h.spec.name);const x=i(),T={modelId:x,name:h.spec.name,stereotype:h.spec.stereotype??"JPA_ENTITY",attributes:[],...h.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...h.spec.physicalName?{table:{physicalName:h.spec.physicalName}}:{}},M={ref:h.spec.name};let k=!1;for(const[O,A]of(h.spec.attributes??[]).entries()){if(A.type==="GroupCodeEnum"&&!A.groupCode){s.push({code:"groupcode-required",opIndex:N,entity:M,handle:{ref:A.name}}),k=!0;continue}if(!r(A.type)&&!((w=A.embeddableOverrides)!=null&&w.length)&&uu(A)){s.push({code:"datatype-required",opIndex:N,entity:M,handle:{ref:A.name}}),k=!0;continue}const L=r(A.type);if(L){const H=fu(A,L,O,T,e.entities,N,M,s,i);H?T.attributes.push(H):k=!0}else(C=A.embeddableOverrides)!=null&&C.length?(s.push({code:"embeddable-type-unresolved",opIndex:N,entity:M,handle:{ref:A.name}}),k=!0):T.attributes.push(mu(A,O,i))}const v=(h.spec.operations??[]).map((O,A)=>pu(O,A,i));v.length&&(T.operations=v);const I=[];for(const O of h.spec.indexes??[]){const A=hu(T,O,N,M,s,i);A?I.push(A):k=!0}if(I.length&&(T.indexes=I),k)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:x,value:T});break}case"entity.update":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=Mo(h.patch,gb,["jpaAttrs.","table."]);if(x.length){s.push({code:"entity-patch-unknown-key",opIndex:N,entity:h.entity,keys:x});break}const T=h.patch.stereotype;if(typeof T=="string"&&T!==R.value.stereotype&&(T==="JPA_EMBEDDABLE"||R.value.stereotype==="JPA_EMBEDDABLE")){s.push({code:"stereotype-embeddable-transition-unsupported",opIndex:N,entity:h.entity,from:R.value.stereotype??"",to:T});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,patch:h.patch});break}case"entity.remove":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=R.value.modelId,T=e.associations.filter(I=>I.end1.entityRef===x||I.end2.entityRef===x),M=new Set(T.map(I=>I.modelId));for(const I of T)m.has(I.modelId)||(m.add(I.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:I.modelId}));for(const I of e.entities)if(I.modelId!==x)for(const O of I.attributes)O.embedded&&M.has(O.embedded.associationRef)&&Vo(l,f,I.modelId,O.modelId);for(const I of T){if(I.end1.entityRef===x||!I.end1.attributeRef)continue;const O=e.entities.find(L=>L.modelId===I.end1.entityRef),A=O==null?void 0:O.attributes.find(L=>L.modelId===I.end1.attributeRef&&L.attrType==="RELATION_REF");A&&Vo(l,f,O.modelId,A.modelId)}const k={...e,entities:e.entities.filter(I=>I.modelId!==x),associations:e.associations.filter(I=>!M.has(I.modelId))},v=new Set(T.filter(I=>I.end1.entityRef===x&&I.end2.entityRef!==x).map(I=>I.end2.entityRef));for(const I of v)Sl(l,k,I,i,f,d);for(const I of e.groups)I.memberEntityRefs.includes(x)&&(_.has(g(I.modelId,x))||(_.add(g(I.modelId,x)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:I.modelId,groupRef:I.modelId,entityRef:x})));p.add(x),l.push({kind:"entity.remove",casUnit:"logical",entityRef:x});break}case"attribute.add":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}if(h.spec.type==="GroupCodeEnum"&&!h.spec.groupCode){s.push({code:"groupcode-required",opIndex:N,entity:h.entity,handle:{ref:h.spec.name}});break}if(!r(h.spec.type)&&!((S=h.spec.embeddableOverrides)!=null&&S.length)&&uu(h.spec)){s.push({code:"datatype-required",opIndex:N,entity:h.entity,handle:{ref:h.spec.name}});break}const x=d(R.value.modelId,R.value.attributes),T=r(h.spec.type);let M;if(T)M=fu(h.spec,T,x,R.value,e.entities,N,h.entity,s,i);else if((V=h.spec.embeddableOverrides)!=null&&V.length){s.push({code:"embeddable-type-unresolved",opIndex:N,entity:h.entity,handle:{ref:h.spec.name}});break}else M=mu(h.spec,x,i);if(!M)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:M}),y.push({entityId:R.value.modelId,attribute:M});break}case"attribute.update":case"attribute.remove":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=lu(R.value,h.attribute);if(!x.ok){s.push(x.reason==="not-found"?{code:"attribute-not-found",opIndex:N,entity:h.entity,handle:h.attribute}:{code:"attribute-ambiguous",opIndex:N,entity:h.entity,handle:h.attribute,matches:x.matches});break}if(h.kind==="attribute.update"){const T=[],M=[];let k=!1;for(const A of Object.keys(h.patch)){if(A.includes(".")){A.startsWith("dbAttrs.")?k=!0:M.push(A);continue}Cl.has(A)?T.push(A):yb.has(A)||M.push(A)}if(M.length){s.push({code:"attribute-patch-unknown-key",opIndex:N,entity:h.entity,handle:h.attribute,keys:M});break}if("attrType"in h.patch){const A=String(h.patch.attrType),L=tu.includes(A)?A!==x.value.attrType?"transition":void 0:"unknown-value";if(L){s.push({code:"attribute-attrtype-unsupported",opIndex:N,entity:h.entity,handle:h.attribute,reason:L,current:x.value.attrType,requested:A});break}}const v="type"in h.patch?h.patch.type:x.value.type,I="groupCode"in h.patch?h.patch.groupCode:x.value.groupCode;if(v==="GroupCodeEnum"&&!I){s.push({code:"groupcode-required",opIndex:N,entity:h.entity,handle:h.attribute});break}let O=h.patch;if(T.length){const A=wb(x.value,h.patch,T,k);if(!A){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:N,entity:h.entity,handle:h.attribute,keys:T});break}O=A}if(($=h.embeddableOverrides)!=null&&$.length){const A=r(x.value.type);if(!A||x.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:N,entity:h.entity,handle:h.attribute});break}const L=Ib(x.value,A,h.embeddableOverrides,R.value,e.entities,N,h.entity,s);if(!L)break;O={...O,dbAttrs:L}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:x.value.modelId,patch:O})}else{const T=So(e,R.value.modelId,x.value.modelId);if(T){const M=k=>{var v;return((v=e.entities.find(I=>I.modelId===k))==null?void 0:v.name)??k};s.push({code:"attribute-fk-managed",opIndex:N,entity:h.entity,handle:h.attribute,association:{from:M(T.end1.entityRef),to:M(T.end2.entityRef)}});break}Vo(l,f,R.value.modelId,x.value.modelId)}break}case"association.add":{const R=wt(e,h.spec.from),x=wt(e,h.spec.to);if(R.ok||s.push(It(R.reason,N,h.spec.from,R.matches,b)),x.ok||s.push(It(x.reason,N,h.spec.to,x.matches,b)),!R.ok||!x.ok)break;if(h.spec.identifying&&R.value.modelId===x.value.modelId){s.push({code:"self-identifying",opIndex:N,handle:{from:h.spec.from,to:h.spec.to}});break}if(R.value.stereotype==="JPA_EMBEDDABLE"||x.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:N,handle:{from:h.spec.from,to:h.spec.to}});break}const T=i(),M={modelId:T,...h.spec.identifying!=null?{identifying:h.spec.identifying}:{},end1:{entityRef:R.value.modelId,multiplicity:h.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:x.value.modelId,multiplicity:h.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:h.spec.composition??!1}},k={...e,associations:[...e.associations,M]},v=ai(k,x.value.modelId,i);v.add[0]&&(M.end2.attributeRef=v.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:M});for(const I of v.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:{...I,order:d(x.value.modelId,x.value.attributes)}});break}case"association.remove":{const R=wt(e,h.association.from),x=wt(e,h.association.to);if(R.ok||s.push(It(R.reason,N,h.association.from,R.matches,b)),x.ok||s.push(It(x.reason,N,h.association.to,x.matches,b)),!R.ok||!x.ok)break;const T=ru(e,R.value.modelId,x.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:N,handle:h.association}:{code:"association-ambiguous",opIndex:N,handle:h.association,matches:T.map(I=>I.modelId)});break}const M=T[0];m.has(M.modelId)||(m.add(M.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:M.modelId}));const k=e.entities.find(I=>I.attributes.some(O=>{var A;return((A=O.embedded)==null?void 0:A.associationRef)===M.modelId}));if(k){const I=k.attributes.find(O=>{var A;return((A=O.embedded)==null?void 0:A.associationRef)===M.modelId});Vo(l,f,k.modelId,I.modelId);break}if(M.end1.attributeRef){const I=e.entities.find(A=>A.modelId===M.end1.entityRef),O=I==null?void 0:I.attributes.find(A=>A.modelId===M.end1.attributeRef&&A.attrType==="RELATION_REF");O&&Vo(l,f,I.modelId,O.modelId)}const v={...e,associations:e.associations.filter(I=>I.modelId!==M.modelId)};Sl(l,v,M.end2.entityRef,i,f,d);break}case"association.update":{const R=yu(e,h.association,N,s,b);if(!R)break;const x=h.patch.identifying,T=typeof x=="boolean"?x:void 0;if(T===!0&&R.end1.entityRef===R.end2.entityRef){s.push({code:"self-identifying",opIndex:N,handle:h.association});break}const M=Mo(h.patch,bb);if(M.length){s.push({code:"association-patch-unknown-key",opIndex:N,handle:h.association,keys:M});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:R.modelId,associationRef:R.modelId,patch:h.patch}),T!==void 0&&T!==(R.identifying??!1)){const k={...e,associations:e.associations.map(v=>v.modelId===R.modelId?{...v,identifying:T}:v)};Sl(l,k,R.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const R=yu(e,h.association,N,s,b);if(!R)break;const x=h.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(h.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:N,handle:h.association});break}const T=Mo(h.patch,_b,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:N,handle:h.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:R.modelId,associationRef:R.modelId,end:x,patch:h.patch});break}case"index.add":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=hu(R.value,h.spec,N,h.entity,s,i);if(!x)break;l.push({kind:"index.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,indexRef:x.modelId,value:x});break}case"index.update":case"index.remove":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}if(vl(h.index)){s.push({code:"handle-by-unsupported",opIndex:N,entity:h.entity,handle:h.index,target:"index"});break}const x=hb(R.value,h.index);if(!x.ok){s.push(x.reason==="not-found"?{code:"index-not-found",opIndex:N,entity:h.entity,handle:h.index}:{code:"index-ambiguous",opIndex:N,entity:h.entity,handle:h.index,matches:x.matches});break}if(h.kind==="index.update"){if("columns"in h.patch){s.push({code:"index-columns-patch-unsupported",opIndex:N,entity:h.entity,handle:h.index});break}const T=Mo(h.patch,kb);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:N,entity:h.entity,handle:h.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,indexRef:x.value.modelId,patch:h.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,indexRef:x.value.modelId});break}case"operation.add":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=u.get(R.value.modelId)??(R.value.operations?zt(R.value.operations):0);u.set(R.value.modelId,x+1);const T=pu(h.spec,x,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}if(vl(h.operation)){s.push({code:"handle-by-unsupported",opIndex:N,entity:h.entity,handle:h.operation,target:"operation"});break}const x=cu(R.value,h.operation);if(!x.ok){s.push(x.reason==="not-found"?{code:"operation-not-found",opIndex:N,entity:h.entity,handle:h.operation}:{code:"operation-ambiguous",opIndex:N,entity:h.entity,handle:h.operation,matches:x.matches});break}if(h.kind==="operation.update"){const T=Mo(h.patch,Eb);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:N,entity:h.entity,handle:h.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:x.value.modelId,patch:h.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:x.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const R=h.kind==="attribute.reorder",x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,N,h.entity,x.matches,b));break}const T=R?h.order:h.operations,M=[],k=new Set;let v=!1;for(const L of T){if(!R&&vl(L)){s.push({code:"handle-by-unsupported",opIndex:N,entity:h.entity,handle:L,target:"operation"}),v=!0;continue}const H=R?lu(x.value,L):cu(x.value,L);if(!H.ok){s.push(H.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:N,entity:h.entity,handle:L}:{code:"reorder-handle-ambiguous",opIndex:N,entity:h.entity,handle:L,matches:H.matches}),v=!0;continue}if(k.has(H.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:N,entity:h.entity,handle:L}),v=!0;continue}k.add(H.value.modelId),M.push(H.value)}if(v)break;const O=[...R?x.value.attributes:x.value.operations??[]].sort((L,H)=>L.order-H.order).filter(L=>!k.has(L.modelId)),A=[...M,...O];if(A.forEach((L,H)=>{L.order!==H&&l.push(R?{kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:L.modelId,patch:{order:H}}:{kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:L.modelId,patch:{order:H}})}),R)for(const L of iu(e,x.value.modelId,A.map(H=>H.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:L.entityId,entityRef:L.entityId,attributeRef:L.attributeId,patch:{dbAttrs:L.dbAttrs}});break}case"group.add":{const R=[];let x=!1;for(const k of h.spec.members){const v=wt(e,k);if(!v.ok){s.push(It(v.reason,N,k,v.matches,b)),x=!0;continue}R.push(v.value.modelId)}if(x)break;const T=i(),M={modelId:T,excludeDDLGeneration:h.spec.excludeDDLGeneration??!1,memberEntityRefs:R,...h.spec.name?{name:h.spec.name}:{},...h.spec.packageName?{packageName:h.spec.packageName}:{},...h.spec.description?{description:h.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:T,value:M});break}case"group.update":{const R=wl(e,h.group);if(!R.ok){s.push(Il(R,N,h.group));break}const x=Mo(h.patch,cb);if(x.length){s.push({code:"group-patch-unknown-key",opIndex:N,handle:h.group,keys:x});break}l.push({kind:"group.update",casUnit:"logical",containerRef:R.value.modelId,groupRef:R.value.modelId,patch:h.patch});break}case"group.remove":{const R=wl(e,h.group);if(!R.ok){s.push(Il(R,N,h.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:R.value.modelId});break}case"group.addMember":case"group.removeMember":{const R=wl(e,h.group);if(!R.ok){s.push(Il(R,N,h.group));break}const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,N,h.entity,x.matches,b));break}const T=R.value.memberEntityRefs.includes(x.value.modelId);if(h.kind==="group.addMember"?T:!T)break;if(h.kind==="group.removeMember"){if(_.has(g(R.value.modelId,x.value.modelId)))break;_.add(g(R.value.modelId,x.value.modelId))}l.push({kind:h.kind,casUnit:"logical",containerRef:R.value.modelId,groupRef:R.value.modelId,entityRef:x.value.modelId});break}}}),s.length||vb(l,e,f,p),s.length||Cb(l,e,f,y,p,i),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function It(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 yu(e,n,o,i,a){const r=wt(e,n.from),l=wt(e,n.to);if(r.ok||i.push(It(r.reason,o,n.from,r.matches,a)),l.ok||i.push(It(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=ru(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 gu={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},xb={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},Rb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Ab={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},Vn={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:{...Vn,description:"속성 설명(다국어)."},columnLogicalName:{...Vn,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},Tb={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}},bu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Mb={type:"object",description:"일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)을 end 로 주면 거부된다(임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...bu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...bu,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},Vb={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...gu,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},Bb={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Vn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Db={type:"object",properties:{name:{...Vn,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},Ob={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:[...tu],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},derivedIdFieldName:{type:"string",description:"파생 식별(@MapsId) FK가 매핑되는 **스칼라 @Id 필드명**. 이 속성의 name은 연관 필드명(@MapsId @OneToOne 필드)이고 같은 관계가 두 Java 필드를 만든다. 단일 컬럼 @OneToOne 식별 FK에만 의미가 있고, 미설정 시 부모 PK 물리명의 camelCase로 파생된다(실물 관행). 컬럼은 공유하므로 속성은 하나이며 물리명은 지정하지 않는다."},description:{...Vn,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:{...Vn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},Lb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Pb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},zb={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...Vn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Fb={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로 변경. stereotype 은 JPA_EMBEDDABLE 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},Ub={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function mt(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const Hb={"entity.add":mt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":mt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":mt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":mt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":mt("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":mt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":mt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":mt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":mt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":mt("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":mt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":mt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":mt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":mt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":mt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":mt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":mt("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":mt("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":mt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":mt("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":mt("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":mt("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":mt("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},jb={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},Kb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...Vn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},_u={anyOf:eu.map(e=>Hb[e])},Gb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:gu,nameHandle:xb,groupHandle:jb,assocHandle:Rb,entitySpec:Ab,attrSpec:$b,embeddableOverrides:Tb,assocSpec:Mb,indexSpec:Vb,operationSpec:Bb,groupSpec:Db,entityUpdatePatch:Fb,attrUpdatePatch:Ob,assocUpdatePatch:Lb,assocEndUpdatePatch:Ub,indexUpdatePatch:Pb,operationUpdatePatch:zb,groupUpdatePatch:Kb,symbolicOp:_u}};function Yb(e,n,o,i={}){const a=i.mkClientOpId??Pe,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 ku={location:{x:0,y:0},size:{width:220,height:140}};function Eu(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 qb=/^[-=_*~\s]{3,}$/;function Wb(e){return e.attrType&&e.attrType!=="NORMAL"||!qb.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Jb(e){return e.type===hn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Xb(e,n){if(e.attrType==="DIVIDER"||Wb(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=Jb(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(Eu)}}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 Qb(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 e_(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(Xb),operations:(n=e.operations)==null?void 0:n.map(Zb),indexes:(o=e.indexes)==null?void 0:o.map(Qb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function t_(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??{...ku},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 Nu(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 xl(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:Nu(e)}}function n_(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>Rl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function o_(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:n_(e),end1:xl(e.end1),end2:xl(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 Rl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function wu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Iu(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 vu(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(Eu)}}function i_(e,n,o){var N,w;const i=Rl(e.end1.attribute),a=Rl(e.end2.attribute);if(i===a)return o_(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(w=(N=s.dbAttrs)==null?void 0:N[0])==null?void 0:w.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((C,S)=>Math.max(C,S.order),-1)+1:s.order??0,p={...vu(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),y=l.attribute;let _;if(y&&f&&r.navigable){const C=Qi(l.multiplicity);_={modelId:y.modelId??crypto.randomUUID(),name:No(y.name??ta((u==null?void 0:u.name)??l.endModel.refId,C),new Set(f.attributes.map(S=>S.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((S,V)=>Math.max(S,V.order),-1)+1,dbAttrs:[]},f.attributes.push(_)}const g=(C,S)=>({entityRef:C.endModel.refId,multiplicity:C.multiplicity,navigable:C.navigable,composition:C.composition,attributeRef:S?_==null?void 0:_.modelId:p.modelId,jpa:Nu(C)}),b=r.endModel.refId===l.endModel.refId,E={modelId:e.modelId,description:e.description,identifying:!b&&p.identifier===!0?!0:void 0,end1:g(e.end1,i),end2:g(e.end2,a)},h={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:E,layout:h}}function a_(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 r_(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((_,g)=>Math.max(_,g.order),-1)+1:l.order??0,d={...vu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(_=>a_(_,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=_=>({...xl(_),legacyEmbedRaw:_.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 l_(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 Cu(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=l_(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 Su(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 s_(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=Qi(i.end2.multiplicity),u=ta(r.name,d),m=No(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 c_(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 xu(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&&!dc(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?d_(n):u_(n)}function d_(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);s_(a,r),c_(a,r),xu(a,r);const{version:s,...c}=e.layout;Su(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 u_(e){var b,E;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(h,N)=>{o.push(e_(h));const w=t_(h);w.geo={location:{x:w.geo.location.x+N.x,y:w.geo.location.y+N.y},size:w.geo.size},i.push(w);for(const C of h.ownedAssociations??[])c.push(C)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const m=[];for(const h of e.groups??[]){const N=h.entities??[];l.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:N.map(C=>C.modelId)});const w=((b=h.geo)==null?void 0:b.location)??u;if(h.geo){const C=(h.notes??[]).map(S=>S.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:C.length?C:void 0})}for(const C of N)d(C,w);for(const C of h.notes??[])m.push(Cu(C,w))}const p=new Map(o.map(h=>[h.modelId,h])),f=new Map,y=new Map;for(const h of o)for(const N of h.attributes)for(const w of N.dbAttrs)f.set(w.modelId,N.modelId),y.set(w.modelId,w);for(const h of c)for(const N of[h.end1,h.end2]){const w=N.attribute;if(w&&(((E=w.dbAttrs)==null?void 0:E.length)??0)>0)for(const C of w.dbAttrs)C.modelId&&f.set(C.modelId,w.modelId)}for(const h of c){const N=wu(h.end1.attribute),w=wu(h.end2.attribute),C=Iu(h.end1)||Iu(h.end2),{assoc:S,layout:V}=N!==w||C?r_(h,p,y):i_(h,p,f);a.push(S),r.push(V)}Su(o,a,r),td(o),xu(o,a);const _={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(h=>Cu(h)),...m]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:_,meta:g}}function Au(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 m_(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(Au),style:n}}function f_(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 p_(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 Bn(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 h_(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{...Au(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function y_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function $u(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 g_(e){const n=new Set;for(const o of e.logical.associations){const i=$u(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function b_(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,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function k_(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.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 E_(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var y;return((y=f.embedded)==null?void 0:y.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)=>k_(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:Bn(e.end1,c?s:u),end2:Bn(e.end2,c?u:s)}}function N_(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:Bn(e.end1,e.end1.legacyEmbedRaw),end2:Bn(e.end2,e.end2.legacyEmbedRaw)};const a=E_(e,n,i);if(a)return a;const r=$u(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?h_(r.fk,l):void 0,c=y_(r.navAttr);return{...i,end1:Bn(e.end1,r.navEnd===e.end1?s:c),end2:Bn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:Bn(e.end1),end2:Bn(e.end2)}}function Tu(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)??{...ku},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 m_(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 f_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>N_(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(p_),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 w_(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=>Mu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Tu(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 Mu(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 I_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=g_(e),r=b_(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=>Tu(s,e,a,r)),groups:e.logical.groups.map(s=>w_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>Mu(s))}}function v_(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 C_=["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(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 y=p.get(f.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const _={};for(const g of C_)f[g]===!0!=(y[g]===!0)&&(_[g]=f[g],s.attributeFieldsByName[g]=(s.attributeFieldsByName[g]??0)+1);Object.keys(_).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:_}),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 fi(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function gn(e){return typeof e=="function"?e():t.unref(e)}const x_=typeof window<"u"&&typeof document<"u",R_=e=>typeof e<"u",A_=Object.prototype.toString,$_=e=>A_.call(e)==="[object Object]",T_=()=>{};function M_(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 Vu=e=>e();function V_(e=Vu){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 Bu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function B_(e,n,o={}){const{eventFilter:i=Vu,...a}=o;return t.watch(e,M_(i,n),a)}function Bo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=V_(i);return{stop:B_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function D_(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=gn(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 Al(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:y,throwOnTimeout:_}={}){let g=null;const E=[new Promise(h=>{g=t.watch(e,N=>{m(N)!==n&&(g==null||g(),h(N))},{flush:p,deep:f,immediate:!0})})];return y!=null&&E.push(Bu(y,_).then(()=>gn(e)).finally(()=>g==null?void 0:g())),Promise.race(E)}function i(m,p){if(!t.isRef(m))return o(N=>N===m,p);const{flush:f="sync",deep:y=!1,timeout:_,throwOnTimeout:g}=p??{};let b=null;const h=[new Promise(N=>{b=t.watch([e,m],([w,C])=>{n!==(w===C)&&(b==null||b(),N(w))},{flush:f,deep:y,immediate:!0})})];return _!=null&&h.push(Bu(_,g).then(()=>gn(e)).finally(()=>(b==null||b(),gn(e)))),Promise.race(h)}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 y=Array.from(f);return y.includes(m)||y.includes(gn(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(gn(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Al(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return Al(e,!n)}}}function $l(e){return Al(e)}function O_(e){var n;const o=gn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Du=x_?window:void 0;function Ou(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Du):[n,o,i,a]=e,!n)return T_;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(()=>[O_(n),gn(a)],([u,m])=>{if(l(),!u)return;const p=$_(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(y=>s(u,f,y,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return fi(d),d}function L_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Lu(...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=Du,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=L_(n);return Ou(a,r,u=>{u.repeat&&gn(s)||c(u)&&o(u)},l)}function P_(e){return JSON.parse(JSON.stringify(e))}function Tl(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(),y=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 _=d;n||(n="modelValue"),_=_||`update:${n.toString()}`;const g=h=>s?typeof s=="function"?s(h):P_(h):h,b=()=>R_(e[n])?g(e[n]):m,E=h=>{p?p(h)&&y(_,h):y(_,h)};if(c){const h=b(),N=t.ref(h);let w=!1;return t.watch(()=>e[n],C=>{w||(w=!0,N.value=g(C),t.nextTick(()=>w=!1))}),t.watch(N,C=>{!w&&(C!==e[n]||u)&&E(C)},{deep:u}),N}else return t.computed({get(){return b()},set(h){E(h)}})}var z_={value:()=>{}};function va(){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 Ca(o)}function Ca(e){this._=e}function F_(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}})}Ca.prototype=va.prototype={constructor:Ca,on:function(e,n){var o=this._,i=F_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=U_(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]=Pu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Pu(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 Ca(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 U_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Pu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=z_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Ml="http://www.w3.org/1999/xhtml";const zu={svg:"http://www.w3.org/2000/svg",xhtml:Ml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Sa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),zu.hasOwnProperty(n)?{space:zu[n],local:e}:e}function H_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Ml&&n.documentElement.namespaceURI===Ml?n.createElement(e):n.createElementNS(o,e)}}function j_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fu(e){var n=Sa(e);return(n.local?j_:H_)(n)}function K_(){}function Vl(e){return e==null?K_:function(){return this.querySelector(e)}}function G_(e){typeof e!="function"&&(e=Vl(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 Lt(i,this._parents)}function Y_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function q_(){return[]}function Uu(e){return e==null?q_:function(){return this.querySelectorAll(e)}}function W_(e){return function(){return Y_(e.apply(this,arguments))}}function J_(e){typeof e=="function"?e=W_(e):e=Uu(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 Lt(i,a)}function Hu(e){return function(){return this.matches(e)}}function ju(e){return function(n){return n.matches(e)}}var X_=Array.prototype.find;function Z_(e){return function(){return X_.call(this.children,e)}}function Q_(){return this.firstElementChild}function ek(e){return this.select(e==null?Q_:Z_(typeof e=="function"?e:ju(e)))}var tk=Array.prototype.filter;function nk(){return Array.from(this.children)}function ok(e){return function(){return tk.call(this.children,e)}}function ik(e){return this.selectAll(e==null?nk:ok(typeof e=="function"?e:ju(e)))}function ak(e){typeof e!="function"&&(e=Hu(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 Lt(i,this._parents)}function Ku(e){return new Array(e.length)}function rk(){return new Lt(this._enter||this._groups.map(Ku),this._parents)}function xa(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}xa.prototype={constructor:xa,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 lk(e){return function(){return e}}function sk(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 xa(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function ck(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 xa(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function dk(e){return e.__data__}function uk(e,n){if(!arguments.length)return Array.from(this,dk);var o=n?ck:sk,i=this._parents,a=this._groups;typeof e!="function"&&(e=lk(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=mk(e.call(u,u&&u.__data__,d,i)),y=f.length,_=s[d]=new Array(y),g=l[d]=new Array(y),b=c[d]=new Array(p);o(u,m,_,g,b,f,n);for(var E=0,h=0,N,w;E<y;++E)if(N=_[E]){for(E>=h&&(h=E+1);!(w=g[h])&&++h<y;);N._next=w||null}}return l=new Lt(l,i),l._enter=s,l._exit=c,l}function mk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fk(){return new Lt(this._exit||this._groups.map(Ku),this._parents)}function pk(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 hk(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,y=0;y<m;++y)(f=d[y]||u[y])&&(p[y]=f);for(;c<a;++c)s[c]=o[c];return new Lt(s,this._parents)}function yk(){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 gk(e){e||(e=bk);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 Lt(a,this._parents).order()}function bk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function _k(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function kk(){return Array.from(this)}function Ek(){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 Nk(){let e=0;for(const n of this)++e;return e}function wk(){return!this.node()}function Ik(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 vk(e){return function(){this.removeAttribute(e)}}function Ck(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Sk(e,n){return function(){this.setAttribute(e,n)}}function xk(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function Rk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Ak(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=Sa(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?Ck:vk:typeof n=="function"?o.local?Ak:Rk:o.local?xk:Sk)(o,n))}function Gu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Tk(e){return function(){this.style.removeProperty(e)}}function Mk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Vk(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Bk(e,n,o){return arguments.length>1?this.each((n==null?Tk:typeof n=="function"?Vk:Mk)(e,n,o??"")):Do(this.node(),e)}function Do(e,n){return e.style.getPropertyValue(n)||Gu(e).getComputedStyle(e,null).getPropertyValue(n)}function Dk(e){return function(){delete this[e]}}function Ok(e,n){return function(){this[e]=n}}function Lk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Pk(e,n){return arguments.length>1?this.each((n==null?Dk:typeof n=="function"?Lk:Ok)(e,n)):this.node()[e]}function Yu(e){return e.trim().split(/^|\s+/)}function Bl(e){return e.classList||new qu(e)}function qu(e){this._node=e,this._names=Yu(e.getAttribute("class")||"")}qu.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 Wu(e,n){for(var o=Bl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Ju(e,n){for(var o=Bl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function zk(e){return function(){Wu(this,e)}}function Fk(e){return function(){Ju(this,e)}}function Uk(e,n){return function(){(n.apply(this,arguments)?Wu:Ju)(this,e)}}function Hk(e,n){var o=Yu(e+"");if(arguments.length<2){for(var i=Bl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Uk:n?zk:Fk)(o,n))}function jk(){this.textContent=""}function Kk(e){return function(){this.textContent=e}}function Gk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Yk(e){return arguments.length?this.each(e==null?jk:(typeof e=="function"?Gk:Kk)(e)):this.node().textContent}function qk(){this.innerHTML=""}function Wk(e){return function(){this.innerHTML=e}}function Jk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Xk(e){return arguments.length?this.each(e==null?qk:(typeof e=="function"?Jk:Wk)(e)):this.node().innerHTML}function Zk(){this.nextSibling&&this.parentNode.appendChild(this)}function Qk(){return this.each(Zk)}function eE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tE(){return this.each(eE)}function nE(e){var n=typeof e=="function"?e:Fu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function oE(){return null}function iE(e,n){var o=typeof e=="function"?e:Fu(e),i=n==null?oE:typeof n=="function"?n:Vl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function aE(){var e=this.parentNode;e&&e.removeChild(this)}function rE(){return this.each(aE)}function lE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function sE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function cE(e){return this.select(e?sE:lE)}function dE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function uE(e){return function(n){e.call(this,n,this.__data__)}}function mE(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 fE(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 pE(e,n,o){return function(){var i=this.__on,a,r=uE(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 hE(e,n,o){var i=mE(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?pE:fE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Xu(e,n,o){var i=Gu(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 yE(e,n){return function(){return Xu(this,e,n)}}function gE(e,n){return function(){return Xu(this,e,n.apply(this,arguments))}}function bE(e,n){return this.each((typeof n=="function"?gE:yE)(e,n))}function*_E(){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 Zu=[null];function Lt(e,n){this._groups=e,this._parents=n}function pi(){return new Lt([[document.documentElement]],Zu)}function kE(){return this}Lt.prototype=pi.prototype={constructor:Lt,select:G_,selectAll:J_,selectChild:ek,selectChildren:ik,filter:ak,data:uk,enter:rk,exit:fk,join:pk,merge:hk,selection:kE,order:yk,sort:gk,call:_k,nodes:kk,node:Ek,size:Nk,empty:wk,each:Ik,attr:$k,style:Bk,property:Pk,classed:Hk,text:Yk,html:Xk,raise:Qk,lower:tE,append:nE,insert:iE,remove:rE,clone:cE,datum:dE,on:hE,dispatch:bE,[Symbol.iterator]:_E};function jt(e){return typeof e=="string"?new Lt([[document.querySelector(e)]],[document.documentElement]):new Lt([[e]],Zu)}function EE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function an(e,n){if(e=EE(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 NE={passive:!1},hi={capture:!0,passive:!1};function Dl(e){e.stopImmediatePropagation()}function Oo(e){e.preventDefault(),e.stopImmediatePropagation()}function Qu(e){var n=e.document.documentElement,o=jt(e).on("dragstart.drag",Oo,hi);"onselectstart"in n?o.on("selectstart.drag",Oo,hi):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function em(e,n){var o=e.document.documentElement,i=jt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Oo,hi),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 Ra=e=>()=>e;function Ol(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}})}Ol.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wE(e){return!e.ctrlKey&&!e.button}function IE(){return this.parentNode}function vE(e,n){return n??{x:e.x,y:e.y}}function CE(){return navigator.maxTouchPoints||"ontouchstart"in this}function SE(){var e=wE,n=IE,o=vE,i=CE,a={},r=va("start","drag","end"),l=0,s,c,d,u,m=0;function p(N){N.on("mousedown.drag",f).filter(i).on("touchstart.drag",g).on("touchmove.drag",b,NE).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(N,w){if(!(u||!e.call(this,N,w))){var C=h(this,n.call(this,N,w),N,w,"mouse");C&&(jt(N.view).on("mousemove.drag",y,hi).on("mouseup.drag",_,hi),Qu(N.view),Dl(N),d=!1,s=N.clientX,c=N.clientY,C("start",N))}}function y(N){if(Oo(N),!d){var w=N.clientX-s,C=N.clientY-c;d=w*w+C*C>m}a.mouse("drag",N)}function _(N){jt(N.view).on("mousemove.drag mouseup.drag",null),em(N.view,d),Oo(N),a.mouse("end",N)}function g(N,w){if(e.call(this,N,w)){var C=N.changedTouches,S=n.call(this,N,w),V=C.length,$,R;for($=0;$<V;++$)(R=h(this,S,N,w,C[$].identifier,C[$]))&&(Dl(N),R("start",N,C[$]))}}function b(N){var w=N.changedTouches,C=w.length,S,V;for(S=0;S<C;++S)(V=a[w[S].identifier])&&(Oo(N),V("drag",N,w[S]))}function E(N){var w=N.changedTouches,C=w.length,S,V;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),S=0;S<C;++S)(V=a[w[S].identifier])&&(Dl(N),V("end",N,w[S]))}function h(N,w,C,S,V,$){var R=r.copy(),x=an($||C,w),T,M,k;if((k=o.call(N,new Ol("beforestart",{sourceEvent:C,target:p,identifier:V,active:l,x:x[0],y:x[1],dx:0,dy:0,dispatch:R}),S))!=null)return T=k.x-x[0]||0,M=k.y-x[1]||0,function v(I,O,A){var L=x,H;switch(I){case"start":a[V]=v,H=l++;break;case"end":delete a[V],--l;case"drag":x=an(A||O,w),H=l;break}R.call(I,N,new Ol(I,{sourceEvent:O,subject:k,target:p,identifier:V,active:H,x:x[0]+T,y:x[1]+M,dx:x[0]-L[0],dy:x[1]-L[1],dispatch:R}),S)}}return p.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Ra(!!N),p):e},p.container=function(N){return arguments.length?(n=typeof N=="function"?N:Ra(N),p):n},p.subject=function(N){return arguments.length?(o=typeof N=="function"?N:Ra(N),p):o},p.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:Ra(!!N),p):i},p.on=function(){var N=r.on.apply(r,arguments);return N===r?p:N},p.clickDistance=function(N){return arguments.length?(m=(N=+N)*N,p):Math.sqrt(m)},p}function Ll(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function tm(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function yi(){}var gi=.7,Aa=1/gi,Lo="\\s*([+-]?\\d+)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xE=/^#([0-9a-f]{3,8})$/,RE=new RegExp(`^rgb\\(${Lo},${Lo},${Lo}\\)$`),AE=new RegExp(`^rgb\\(${rn},${rn},${rn}\\)$`),$E=new RegExp(`^rgba\\(${Lo},${Lo},${Lo},${bi}\\)$`),TE=new RegExp(`^rgba\\(${rn},${rn},${rn},${bi}\\)$`),ME=new RegExp(`^hsl\\(${bi},${rn},${rn}\\)$`),VE=new RegExp(`^hsla\\(${bi},${rn},${rn},${bi}\\)$`),nm={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};Ll(yi,eo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:om,formatHex:om,formatHex8:BE,formatHsl:DE,formatRgb:im,toString:im});function om(){return this.rgb().formatHex()}function BE(){return this.rgb().formatHex8()}function DE(){return cm(this).formatHsl()}function im(){return this.rgb().formatRgb()}function eo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=xE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?am(n):o===3?new Vt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?$a(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?$a(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=RE.exec(e))?new Vt(n[1],n[2],n[3],1):(n=AE.exec(e))?new Vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=$E.exec(e))?$a(n[1],n[2],n[3],n[4]):(n=TE.exec(e))?$a(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=ME.exec(e))?sm(n[1],n[2]/100,n[3]/100,1):(n=VE.exec(e))?sm(n[1],n[2]/100,n[3]/100,n[4]):nm.hasOwnProperty(e)?am(nm[e]):e==="transparent"?new Vt(NaN,NaN,NaN,0):null}function am(e){return new Vt(e>>16&255,e>>8&255,e&255,1)}function $a(e,n,o,i){return i<=0&&(e=n=o=NaN),new Vt(e,n,o,i)}function OE(e){return e instanceof yi||(e=eo(e)),e?(e=e.rgb(),new Vt(e.r,e.g,e.b,e.opacity)):new Vt}function Pl(e,n,o,i){return arguments.length===1?OE(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}Ll(Vt,Pl,tm(yi,{brighter(e){return e=e==null?Aa:Math.pow(Aa,e),new Vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gi:Math.pow(gi,e),new Vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vt(to(this.r),to(this.g),to(this.b),Ta(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rm,formatHex:rm,formatHex8:LE,formatRgb:lm,toString:lm}));function rm(){return`#${no(this.r)}${no(this.g)}${no(this.b)}`}function LE(){return`#${no(this.r)}${no(this.g)}${no(this.b)}${no((isNaN(this.opacity)?1:this.opacity)*255)}`}function lm(){const e=Ta(this.opacity);return`${e===1?"rgb(":"rgba("}${to(this.r)}, ${to(this.g)}, ${to(this.b)}${e===1?")":`, ${e})`}`}function Ta(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function to(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function no(e){return e=to(e),(e<16?"0":"")+e.toString(16)}function sm(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Kt(e,n,o,i)}function cm(e){if(e instanceof Kt)return new Kt(e.h,e.s,e.l,e.opacity);if(e instanceof yi||(e=eo(e)),!e)return new Kt;if(e instanceof Kt)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 Kt(l,s,c,e.opacity)}function PE(e,n,o,i){return arguments.length===1?cm(e):new Kt(e,n,o,i??1)}function Kt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Ll(Kt,PE,tm(yi,{brighter(e){return e=e==null?Aa:Math.pow(Aa,e),new Kt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gi:Math.pow(gi,e),new Kt(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(zl(e>=240?e-240:e+120,a,i),zl(e,a,i),zl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Kt(dm(this.h),Ma(this.s),Ma(this.l),Ta(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ta(this.opacity);return`${e===1?"hsl(":"hsla("}${dm(this.h)}, ${Ma(this.s)*100}%, ${Ma(this.l)*100}%${e===1?")":`, ${e})`}`}}));function dm(e){return e=(e||0)%360,e<0?e+360:e}function Ma(e){return Math.max(0,Math.min(1,e||0))}function zl(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 Fl=e=>()=>e;function zE(e,n){return function(o){return e+o*n}}function FE(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 UE(e){return(e=+e)==1?um:function(n,o){return o-n?FE(n,o,e):Fl(isNaN(n)?o:n)}}function um(e,n){var o=n-e;return o?zE(e,o):Fl(isNaN(e)?n:e)}const Va=(function e(n){var o=UE(n);function i(a,r){var l=o((a=Pl(a)).r,(r=Pl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=um(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 HE(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 jE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function KE(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]=_i(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 GE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function ln(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function YE(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]=_i(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Ul=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hl=new RegExp(Ul.source,"g");function qE(e){return function(){return e}}function WE(e){return function(n){return e(n)+""}}function mm(e,n){var o=Ul.lastIndex=Hl.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Ul.exec(e))&&(a=Hl.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:ln(i,a)})),o=Hl.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?WE(c[0].x):qE(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 _i(e,n){var o=typeof n,i;return n==null||o==="boolean"?Fl(n):(o==="number"?ln:o==="string"?(i=eo(n))?(n=i,Va):mm:n instanceof eo?Va:n instanceof Date?GE:jE(n)?HE:Array.isArray(n)?KE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?YE:ln)(e,n)}var fm=180/Math.PI,jl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pm(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)*fm,skewX:Math.atan(c)*fm,scaleX:l,scaleY:s}}var Ba;function JE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?jl:pm(n.a,n.b,n.c,n.d,n.e,n.f)}function XE(e){return e==null||(Ba||(Ba=document.createElementNS("http://www.w3.org/2000/svg","g")),Ba.setAttribute("transform",e),!(e=Ba.transform.baseVal.consolidate()))?jl:(e=e.matrix,pm(e.a,e.b,e.c,e.d,e.e,e.f))}function hm(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,y){if(d!==m||u!==p){var _=f.push("translate(",null,n,null,o);y.push({i:_-4,x:ln(d,m)},{i:_-2,x:ln(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:ln(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:ln(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,y){if(d!==m||u!==p){var _=f.push(a(f)+"scale(",null,",",null,")");y.push({i:_-4,x:ln(d,m)},{i:_-2,x:ln(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 y=-1,_=p.length,g;++y<_;)m[(g=p[y]).i]=g.x(f);return m.join("")}}}var ZE=hm(JE,"px, ","px)","deg)"),QE=hm(XE,", ",")",")"),e1=1e-12;function ym(e){return((e=Math.exp(e))+1/e)/2}function t1(e){return((e=Math.exp(e))-1/e)/2}function n1(e){return((e=Math.exp(2*e))-1)/(e+1)}const Da=(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,y=m-c,_=f*f+y*y,g,b;if(_<e1)b=Math.log(p/d)/n,g=function(S){return[s+S*f,c+S*y,d*Math.exp(n*S*b)]};else{var E=Math.sqrt(_),h=(p*p-d*d+i*_)/(2*d*o*E),N=(p*p-d*d-i*_)/(2*p*o*E),w=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(N*N+1)-N);b=(C-w)/n,g=function(S){var V=S*b,$=ym(w),R=d/(o*E)*($*n1(n*V+w)-t1(w));return[s+R*f,c+R*y,d*$/ym(n*V+w)]}}return g.duration=b*1e3*n/Math.SQRT2,g}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 Po=0,ki=0,Ei=0,gm=1e3,Oa,Ni,La=0,oo=0,Pa=0,wi=typeof performance=="object"&&performance.now?performance:Date,bm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kl(){return oo||(bm(o1),oo=wi.now()+Pa)}function o1(){oo=0}function za(){this._call=this._time=this._next=null}za.prototype=_m.prototype={constructor:za,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Kl():+o)+(n==null?0:+n),!this._next&&Ni!==this&&(Ni?Ni._next=this:Oa=this,Ni=this),this._call=e,this._time=o,Gl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gl())}};function _m(e,n,o){var i=new za;return i.restart(e,n,o),i}function i1(){Kl(),++Po;for(var e=Oa,n;e;)(n=oo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Po}function km(){oo=(La=wi.now())+Pa,Po=ki=0;try{i1()}finally{Po=0,r1(),oo=0}}function a1(){var e=wi.now(),n=e-La;n>gm&&(Pa-=n,La=e)}function r1(){for(var e,n=Oa,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:Oa=o);Ni=e,Gl(i)}function Gl(e){if(!Po){ki&&(ki=clearTimeout(ki));var n=e-oo;n>24?(e<1/0&&(ki=setTimeout(km,e-wi.now()-Pa)),Ei&&(Ei=clearInterval(Ei))):(Ei||(La=wi.now(),Ei=setInterval(a1,gm)),Po=1,bm(km))}}function Em(e,n,o){var i=new za;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var l1=va("start","end","cancel","interrupt"),s1=[],Nm=0,wm=1,Yl=2,Fa=3,Im=4,ql=5,Ua=6;function Ha(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;c1(e,o,{name:n,index:i,group:a,on:l1,tween:s1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Nm})}function Wl(e,n){var o=Gt(e,n);if(o.state>Nm)throw new Error("too late; already scheduled");return o}function sn(e,n){var o=Gt(e,n);if(o.state>Fa)throw new Error("too late; already running");return o}function Gt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function c1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=_m(r,0,o.time);function r(d){o.state=wm,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!==wm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Fa)return Em(l);f.state===Im?(f.state=Ua,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Ua,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Em(function(){o.state===Fa&&(o.state=Im,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Yl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Yl){for(o.state=Fa,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=ql,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===ql&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ua,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function ja(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>Yl&&i.state<ql,i.state=Ua,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function d1(e){return this.each(function(){ja(this,e)})}function u1(e,n){var o,i;return function(){var a=sn(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 m1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=sn(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 f1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Gt(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?u1:m1)(o,e,n))}function Jl(e,n,o){var i=e._id;return e.each(function(){var a=sn(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Gt(a,i).value[n]}}function vm(e,n){var o;return(typeof n=="number"?ln:n instanceof eo?Va:(o=eo(n))?(n=o,Va):mm)(e,n)}function p1(e){return function(){this.removeAttribute(e)}}function h1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function y1(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 g1(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 b1(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 _1(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 k1(e,n){var o=Sa(e),i=o==="transform"?QE:vm;return this.attrTween(e,typeof n=="function"?(o.local?_1:b1)(o,i,Jl(this,"attr."+e,n)):n==null?(o.local?h1:p1)(o):(o.local?g1:y1)(o,i,n))}function E1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function N1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function w1(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 I1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&E1(e,r)),o}return a._value=n,a}function v1(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=Sa(e);return this.tween(o,(i.local?w1:I1)(i,n))}function C1(e,n){return function(){Wl(this,e).delay=+n.apply(this,arguments)}}function S1(e,n){return n=+n,function(){Wl(this,e).delay=n}}function x1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?C1:S1)(n,e)):Gt(this.node(),n).delay}function R1(e,n){return function(){sn(this,e).duration=+n.apply(this,arguments)}}function A1(e,n){return n=+n,function(){sn(this,e).duration=n}}function $1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?R1:A1)(n,e)):Gt(this.node(),n).duration}function T1(e,n){if(typeof n!="function")throw new Error;return function(){sn(this,e).ease=n}}function M1(e){var n=this._id;return arguments.length?this.each(T1(n,e)):Gt(this.node(),n).ease}function V1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;sn(this,e).ease=o}}function B1(e){if(typeof e!="function")throw new Error;return this.each(V1(this._id,e))}function D1(e){typeof e!="function"&&(e=Hu(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 bn(i,this._parents,this._name,this._id)}function O1(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 bn(l,this._parents,this._name,this._id)}function L1(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 P1(e,n,o){var i,a,r=L1(n)?Wl:sn;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function z1(e,n){var o=this._id;return arguments.length<2?Gt(this.node(),o).on.on(e):this.each(P1(o,e,n))}function F1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function U1(){return this.on("end.remove",F1(this._id))}function H1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Vl(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,Ha(d[p],n,o,p,d,Gt(u,o)));return new bn(r,this._parents,n,o)}function j1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Uu(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,y=Gt(u,o),_=0,g=p.length;_<g;++_)(f=p[_])&&Ha(f,n,o,_,p,y);r.push(p),l.push(u)}return new bn(r,l,n,o)}var K1=pi.prototype.constructor;function G1(){return new K1(this._groups,this._parents)}function Y1(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 Cm(e){return function(){this.style.removeProperty(e)}}function q1(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 W1(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 J1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=sn(this,e),d=c.on,u=c.value[r]==null?s||(s=Cm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function X1(e,n,o){var i=(e+="")=="transform"?ZE:vm;return n==null?this.styleTween(e,Y1(e,i)).on("end.style."+e,Cm(e)):typeof n=="function"?this.styleTween(e,W1(e,i,Jl(this,"style."+e,n))).each(J1(this._id,e)):this.styleTween(e,q1(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 Q1(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 e0(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,Q1(e,n,o??""))}function t0(e){return function(){this.textContent=e}}function n0(e){return function(){var n=e(this);this.textContent=n??""}}function o0(e){return this.tween("text",typeof e=="function"?n0(Jl(this,"text",e)):t0(e==null?"":e+""))}function i0(e){return function(n){this.textContent=e.call(this,n)}}function a0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&i0(a)),n}return i._value=e,i}function r0(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,a0(e))}function l0(){for(var e=this._name,n=this._id,o=Sm(),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=Gt(c,n);Ha(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new bn(i,this._parents,e,o)}function s0(){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=sn(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 c0=0;function bn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Sm(){return++c0}var _n=pi.prototype;bn.prototype={constructor:bn,select:H1,selectAll:j1,selectChild:_n.selectChild,selectChildren:_n.selectChildren,filter:D1,merge:O1,selection:G1,transition:l0,call:_n.call,nodes:_n.nodes,node:_n.node,size:_n.size,empty:_n.empty,each:_n.each,on:z1,attr:k1,attrTween:v1,style:X1,styleTween:e0,text:o0,textTween:r0,remove:U1,tween:f1,delay:x1,duration:$1,ease:M1,easeVarying:B1,end:s0,[Symbol.iterator]:_n[Symbol.iterator]};function d0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var u0={time:null,delay:0,duration:250,ease:d0};function m0(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 f0(e){var n,o;e instanceof bn?(n=e._id,e=e._name):(n=Sm(),(o=u0).time=Kl(),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])&&Ha(c,e,n,d,l,o||m0(c,n));return new bn(i,this._parents,e,n)}pi.prototype.interrupt=d1,pi.prototype.transition=f0;const Ka=e=>()=>e;function p0(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 kn(e,n,o){this.k=e,this.x=n,this.y=o}kn.prototype={constructor:kn,scale:function(e){return e===1?this:new kn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new kn(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 zo=new kn(1,0,0);kn.prototype;function Xl(e){e.stopImmediatePropagation()}function Ii(e){e.preventDefault(),e.stopImmediatePropagation()}function h0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function y0(){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 xm(){return this.__zoom||zo}function g0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function b0(){return navigator.maxTouchPoints||"ontouchstart"in this}function _0(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 k0(){var e=h0,n=y0,o=_0,i=g0,a=b0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Da,d=va("start","zoom","end"),u,m,p,f=500,y=150,_=0,g=10;function b(k){k.property("__zoom",xm).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",x).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(k,v,I,O){var A=k.selection?k.selection():k;A.property("__zoom",xm),k!==A?w(k,v,I,O):A.interrupt().each(function(){C(this,arguments).event(O).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},b.scaleBy=function(k,v,I,O){b.scaleTo(k,function(){var A=this.__zoom.k,L=typeof v=="function"?v.apply(this,arguments):v;return A*L},I,O)},b.scaleTo=function(k,v,I,O){b.transform(k,function(){var A=n.apply(this,arguments),L=this.__zoom,H=I==null?N(A):typeof I=="function"?I.apply(this,arguments):I,oe=L.invert(H),ue=typeof v=="function"?v.apply(this,arguments):v;return o(h(E(L,ue),H,oe),A,l)},I,O)},b.translateBy=function(k,v,I,O){b.transform(k,function(){return o(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof I=="function"?I.apply(this,arguments):I),n.apply(this,arguments),l)},null,O)},b.translateTo=function(k,v,I,O,A){b.transform(k,function(){var L=n.apply(this,arguments),H=this.__zoom,oe=O==null?N(L):typeof O=="function"?O.apply(this,arguments):O;return o(zo.translate(oe[0],oe[1]).scale(H.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof I=="function"?-I.apply(this,arguments):-I),L,l)},O,A)};function E(k,v){return v=Math.max(r[0],Math.min(r[1],v)),v===k.k?k:new kn(v,k.x,k.y)}function h(k,v,I){var O=v[0]-I[0]*k.k,A=v[1]-I[1]*k.k;return O===k.x&&A===k.y?k:new kn(k.k,O,A)}function N(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function w(k,v,I,O){k.on("start.zoom",function(){C(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(O).end()}).tween("zoom",function(){var A=this,L=arguments,H=C(A,L).event(O),oe=n.apply(A,L),ue=I==null?N(oe):typeof I=="function"?I.apply(A,L):I,be=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),pe=A.__zoom,he=typeof v=="function"?v.apply(A,L):v,_e=c(pe.invert(ue).concat(be/pe.k),he.invert(ue).concat(be/he.k));return function(ye){if(ye===1)ye=he;else{var Ae=_e(ye),Fe=be/Ae[2];ye=new kn(Fe,ue[0]-Ae[0]*Fe,ue[1]-Ae[1]*Fe)}H.zoom(null,ye)}})}function C(k,v,I){return!I&&k.__zooming||new S(k,v)}function S(k,v){this.that=k,this.args=v,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,v),this.taps=0}S.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,v){return this.mouse&&k!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var v=jt(this.that).datum();d.call(k,this.that,new p0(k,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),v)}};function V(k,...v){if(!e.apply(this,arguments))return;var I=C(this,v).event(k),O=this.__zoom,A=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),L=an(k);if(I.wheel)(I.mouse[0][0]!==L[0]||I.mouse[0][1]!==L[1])&&(I.mouse[1]=O.invert(I.mouse[0]=L)),clearTimeout(I.wheel);else{if(O.k===A)return;I.mouse=[L,O.invert(L)],ja(this),I.start()}Ii(k),I.wheel=setTimeout(H,y),I.zoom("mouse",o(h(E(O,A),I.mouse[0],I.mouse[1]),I.extent,l));function H(){I.wheel=null,I.end()}}function $(k,...v){if(p||!e.apply(this,arguments))return;var I=k.currentTarget,O=C(this,v,!0).event(k),A=jt(k.view).on("mousemove.zoom",ue,!0).on("mouseup.zoom",be,!0),L=an(k,I),H=k.clientX,oe=k.clientY;Qu(k.view),Xl(k),O.mouse=[L,this.__zoom.invert(L)],ja(this),O.start();function ue(pe){if(Ii(pe),!O.moved){var he=pe.clientX-H,_e=pe.clientY-oe;O.moved=he*he+_e*_e>_}O.event(pe).zoom("mouse",o(h(O.that.__zoom,O.mouse[0]=an(pe,I),O.mouse[1]),O.extent,l))}function be(pe){A.on("mousemove.zoom mouseup.zoom",null),em(pe.view,O.moved),Ii(pe),O.event(pe).end()}}function R(k,...v){if(e.apply(this,arguments)){var I=this.__zoom,O=an(k.changedTouches?k.changedTouches[0]:k,this),A=I.invert(O),L=I.k*(k.shiftKey?.5:2),H=o(h(E(I,L),O,A),n.apply(this,v),l);Ii(k),s>0?jt(this).transition().duration(s).call(w,H,O,k):jt(this).call(b.transform,H,O,k)}}function x(k,...v){if(e.apply(this,arguments)){var I=k.touches,O=I.length,A=C(this,v,k.changedTouches.length===O).event(k),L,H,oe,ue;for(Xl(k),H=0;H<O;++H)oe=I[H],ue=an(oe,this),ue=[ue,this.__zoom.invert(ue),oe.identifier],A.touch0?!A.touch1&&A.touch0[2]!==ue[2]&&(A.touch1=ue,A.taps=0):(A.touch0=ue,L=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),L&&(A.taps<2&&(m=ue[0],u=setTimeout(function(){u=null},f)),ja(this),A.start())}}function T(k,...v){if(this.__zooming){var I=C(this,v).event(k),O=k.changedTouches,A=O.length,L,H,oe,ue;for(Ii(k),L=0;L<A;++L)H=O[L],oe=an(H,this),I.touch0&&I.touch0[2]===H.identifier?I.touch0[0]=oe:I.touch1&&I.touch1[2]===H.identifier&&(I.touch1[0]=oe);if(H=I.that.__zoom,I.touch1){var be=I.touch0[0],pe=I.touch0[1],he=I.touch1[0],_e=I.touch1[1],ye=(ye=he[0]-be[0])*ye+(ye=he[1]-be[1])*ye,Ae=(Ae=_e[0]-pe[0])*Ae+(Ae=_e[1]-pe[1])*Ae;H=E(H,Math.sqrt(ye/Ae)),oe=[(be[0]+he[0])/2,(be[1]+he[1])/2],ue=[(pe[0]+_e[0])/2,(pe[1]+_e[1])/2]}else if(I.touch0)oe=I.touch0[0],ue=I.touch0[1];else return;I.zoom("touch",o(h(H,oe,ue),I.extent,l))}}function M(k,...v){if(this.__zooming){var I=C(this,v).event(k),O=k.changedTouches,A=O.length,L,H;for(Xl(k),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),L=0;L<A;++L)H=O[L],I.touch0&&I.touch0[2]===H.identifier?delete I.touch0:I.touch1&&I.touch1[2]===H.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(H=an(H,this),Math.hypot(m[0]-H[0],m[1]-H[1])<g)){var oe=jt(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return b.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ka(+k),b):i},b.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ka(!!k),b):e},b.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Ka(!!k),b):a},b.extent=function(k){return arguments.length?(n=typeof k=="function"?k:Ka([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),b):n},b.scaleExtent=function(k){return arguments.length?(r[0]=+k[0],r[1]=+k[1],b):[r[0],r[1]]},b.translateExtent=function(k){return arguments.length?(l[0][0]=+k[0][0],l[1][0]=+k[1][0],l[0][1]=+k[0][1],l[1][1]=+k[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(k){return arguments.length?(o=k,b):o},b.duration=function(k){return arguments.length?(s=+k,b):s},b.interpolate=function(k){return arguments.length?(c=k,b):c},b.on=function(){var k=d.on.apply(d,arguments);return k===d?b:k},b.clickDistance=function(k){return arguments.length?(_=(k=+k)*k,b):Math.sqrt(_)},b.tapDistance=function(k){return arguments.length?(g=+k,b):g},b}var De=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(De||{}),Zl=(e=>(e.Partial="partial",e.Full="full",e))(Zl||{}),io=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(io||{}),En=(e=>(e.Strict="strict",e.Loose="loose",e))(En||{}),Ql=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Ql||{}),vi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(vi||{}),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 E0=["INPUT","SELECT","TEXTAREA"],N0=typeof document<"u"?document:null;function es(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 E0.includes(i==null?void 0:i.nodeName)||a||!!r}function w0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Am(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 k0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=E0(o.code,e);return Array.isArray(e)?e.some(a=>km(o[i],a,n,o.type==="keyup")):km(o[i],e,n,o.type==="keyup")}}function E0(e,n){return n.includes(e)?"code":"key"}function bi(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??b0),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}),xu(["blur","contextmenu"],s),Su((...d)=>l(...d),d=>{var u,m;const h=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,f=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=_0(d),(!a||a&&!h)&&Fl(d))return;const k=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,_=(k==null?void 0:k.nodeName)==="BUTTON"||(k==null?void 0:k.nodeName)==="A";!f&&(a||!_)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Su((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Fl(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,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"?k0(d,r):d}return i}const Em="vue-flow__node-desc",Nm="vue-flow__edge-desc",N0="vue-flow__aria-live",wm=["Enter"," ","Escape"],Vo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ba(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Da(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 Oa(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Zn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function Im(e,n){return{x:Zn(e.x,n[0][0],n[1][0]),y:Zn(e.y,n[0][1],n[1][1])}}function vm(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function An(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Qn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!An(e)}function _i(e){return Qn(e)&&"computedPosition"in e}function La(e){return!Number.isNaN(e)&&Number.isFinite(e)}function w0(e){return La(e.width)&&La(e.height)&&La(e.x)&&La(e.y)}function I0(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:ut(e.data)?e.data:{},events:t.markRaw(ut(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function Cm(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:ut(e.data)?e.data:{},events:t.markRaw(ut(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 xm(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 v0(...e){if(e.length===3){const[r,l,s]=e;return xm(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>An(r)&&r.source===i).map(r=>o.find(l=>Qn(l)&&l.id===r.target))}function C0(...e){if(e.length===3){const[r,l,s]=e;return xm(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>An(r)&&r.target===i).map(r=>o.find(l=>Qn(l)&&l.id===r.source))}function Sm({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function x0(e,n){return n.some(o=>An(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 ki({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function Ei({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?za(s,l):s}function Rm(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 Pa({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function Am({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function S0(e,n){return Am(Rm(Pa(e),Pa(n)))}function Ul(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=Rm(n,Pa({...i.computedPosition,...i.dimensions}))}return Am(n)}function $m(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...Ei(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 f=Da(r,Ba(s)),y=m===null||h===null,k=i&&f>0,_=(m??0)*(h??0);(y||k||f>=_||s.dragging)&&l.push(s)}return l}function eo(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 Bo(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 Ii(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function R0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=Bo(e,o),a=Bo(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Bo(e.top??e.y??0,o),a=Bo(e.bottom??e.y??0,o),r=Bo(e.left??e.x??0,n),l=Bo(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 A0(e,n,o,i,a,r){const{x:l,y:s}=ki(e,{x:n,y:o,zoom:i}),{x:c,y:d}=ki({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 Tm(e,n,o,i,a,r=.1){const l=R0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=Zn(d,i,a),m=e.x+e.width/2,h=e.y+e.height/2,f=n/2-m*u,y=o/2-h*u,k=A0(e,f,y,u,n,o),_={left:Math.min(k.left-l.left,0),top:Math.min(k.top-l.top,0),right:Math.min(k.right-l.right,0),bottom:Math.min(k.bottom-l.bottom,0)};return{x:f-_.left+_.right,y:y-_.top+_.bottom,zoom:u}}function $0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Mm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Mm(o,n):!1}function Ni(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Hl(e){const n=e.ctrlKey&&wi()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function Vm(e,n,o){return e<n?Zn(Math.abs(e-n),1,n)/n:e>o?-Zn(Math.abs(e-o),1,n)/n:0}function Bm(e,n,o=15,i=40){const a=Vm(e.x,i,n.width-i)*o,r=Vm(e.y,i,n.height-i)*o;return[a,r]}function jl(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 Dm(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(_i(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&&_i(c)&&jl(l,c)}break;case"dimensions":if(_i(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&&_i(c)&&(!!c.dimensions.width&&!!c.dimensions.height?jl(l,c):t.nextTick(()=>{jl(l,c)}))}break}return n}function $n(e,n){return{id:e,type:"select",selected:n}}function Om(e){return{item:e,type:"add"}}function Lm(e){return{id:e,type:"remove"}}function Pm(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Tn(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($n(r.id,l)))}return i}const zm=()=>{};function Ae(e){const n=new Set;let o=zm,i=()=>!1;const a=()=>n.size>0||i(),r=h=>{o=h},l=()=>{o=zm},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{n.delete(h)};return{on:h=>{n.add(h);const f=()=>d(h);return ai(f),{off:f}},off:d,trigger:h=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(y=>y(h)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Fm(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 T0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Mm(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 Kl({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 Um(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 M0(e,n,o){const[i,a,r,l]=typeof e!="string"?Um(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 V0(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=M0(a,e,i);r&&(a=r)}else n(new ft(dt.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]=Um(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 B0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Gl(e,n,o,i,a){const r=B0(e.dimensions,V0(e,o,i,a)),l=Im(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 Do(e,n,o=Me.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??P0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case Me.Top:return{x:a+l/2,y:r};case Me.Right:return{x:a+l,y:r+s/2};case Me.Bottom:return{x:a+l/2,y:r+s};case Me.Left:return{x:a,y:r+s/2}}}function Hm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function D0({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=Pa({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 O0(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 dt=(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))(dt||{});const jm={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 I0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=v0(o.code,e);return Array.isArray(e)?e.some(a=>Am(o[i],a,n,o.type==="keyup")):Am(o[i],e,n,o.type==="keyup")}}function v0(e,n){return n.includes(e)?"code":"key"}function Ci(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??N0),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}),Ou(["blur","contextmenu"],s),Lu((...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=w0(d),(!a||a&&!p)&&es(d))return;const _=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,g=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";!f&&(a||!g)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Lu((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&es(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"?I0(d,r):d}return i}const $m="vue-flow__node-desc",Tm="vue-flow__edge-desc",C0="vue-flow__aria-live",Mm=["Enter"," ","Escape"],Fo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ga(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ya(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 qa(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ao(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function Vm(e,n){return{x:ao(e.x,n[0][0],n[1][0]),y:ao(e.y,n[0][1],n[1][1])}}function Bm(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function Dn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function ro(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Dn(e)}function Si(e){return ro(e)&&"computedPosition"in e}function Wa(e){return!Number.isNaN(e)&&Number.isFinite(e)}function S0(e){return Wa(e.width)&&Wa(e.height)&&Wa(e.x)&&Wa(e.y)}function x0(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:gt(e.data)?e.data:{},events:t.markRaw(gt(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function Dm(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:gt(e.data)?e.data:{},events:t.markRaw(gt(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 Om(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 R0(...e){if(e.length===3){const[r,l,s]=e;return Om(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>Dn(r)&&r.source===i).map(r=>o.find(l=>ro(l)&&l.id===r.target))}function A0(...e){if(e.length===3){const[r,l,s]=e;return Om(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>Dn(r)&&r.target===i).map(r=>o.find(l=>ro(l)&&l.id===r.source))}function Lm({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function $0(e,n){return n.some(o=>Dn(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 xi({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function Ri({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?Xa(s,l):s}function Pm(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 Ja({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function zm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function T0(e,n){return zm(Pm(Ja(e),Ja(n)))}function ts(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=Pm(n,Ja({...i.computedPosition,...i.dimensions}))}return zm(n)}function Fm(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...Ri(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=Ya(r,Ga(s)),y=m===null||p===null,_=i&&f>0,g=(m??0)*(p??0);(y||_||f>=g||s.dragging)&&l.push(s)}return l}function lo(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 Uo(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 Ti(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function M0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=Uo(e,o),a=Uo(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Uo(e.top??e.y??0,o),a=Uo(e.bottom??e.y??0,o),r=Uo(e.left??e.x??0,n),l=Uo(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 V0(e,n,o,i,a,r){const{x:l,y:s}=xi(e,{x:n,y:o,zoom:i}),{x:c,y:d}=xi({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 Um(e,n,o,i,a,r=.1){const l=M0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=ao(d,i,a),m=e.x+e.width/2,p=e.y+e.height/2,f=n/2-m*u,y=o/2-p*u,_=V0(e,f,y,u,n,o),g={left:Math.min(_.left-l.left,0),top:Math.min(_.top-l.top,0),right:Math.min(_.right-l.right,0),bottom:Math.min(_.bottom-l.bottom,0)};return{x:f-g.left+g.right,y:y-g.top+g.bottom,zoom:u}}function B0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Hm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Hm(o,n):!1}function Ai(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function ns(e){const n=e.ctrlKey&&$i()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function jm(e,n,o){return e<n?ao(Math.abs(e-n),1,n)/n:e>o?-ao(Math.abs(e-o),1,n)/n:0}function Km(e,n,o=15,i=40){const a=jm(e.x,i,n.width-i)*o,r=jm(e.y,i,n.height-i)*o;return[a,r]}function os(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 Gm(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(Si(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&&Si(c)&&os(l,c)}break;case"dimensions":if(Si(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&&Si(c)&&(!!c.dimensions.width&&!!c.dimensions.height?os(l,c):t.nextTick(()=>{os(l,c)}))}break}return n}function On(e,n){return{id:e,type:"select",selected:n}}function Ym(e){return{item:e,type:"add"}}function qm(e){return{id:e,type:"remove"}}function Wm(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Ln(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(On(r.id,l)))}return i}const Jm=()=>{};function Me(e){const n=new Set;let o=Jm,i=()=>!1;const a=()=>n.size>0||i(),r=p=>{o=p},l=()=>{o=Jm},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{n.delete(p)};return{on:p=>{n.add(p);const f=()=>d(p);return fi(f),{off:f}},off:d,trigger:p=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(y=>y(p)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Xm(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 D0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Hm(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 is({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 Zm(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 O0(e,n,o){const[i,a,r,l]=typeof e!="string"?Zm(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 L0(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=O0(a,e,i);r&&(a=r)}else n(new kt(yt.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]=Zm(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 P0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function as(e,n,o,i,a){const r=P0(e.dimensions,L0(e,o,i,a)),l=Vm(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 Ho(e,n,o=De.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??H0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case De.Top:return{x:a+l/2,y:r};case De.Right:return{x:a+l,y:r+s/2};case De.Bottom:return{x:a+l/2,y:r+s};case De.Left:return{x:a,y:r+s/2}}}function Qm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function z0({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=Ja({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 F0(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 yt=(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))(yt||{});const ef={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 ft extends Error{constructor(n,...o){var i;super((i=jm[n])==null?void 0:i.call(jm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Yl(e){return"clientX"in e}function L0(e){return"sourceEvent"in e}function Xt(e,n){const o=Yl(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 wi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function P0(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 za(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const z0=()=>!0;function ql(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function F0(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())Da(a,Ba(r))>0&&i.push(r);return i}const U0=250;function H0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=F0(e,o,n+U0);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:f}=Do(d,m,m.position,!0),y=Math.sqrt((h-e.x)**2+(f-e.y)**2);y>n||(y<s?(l=[{...m,x:h,y:f}],s=y):y===s&&l.push({...m,x:h,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 Km(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=z0},u,m,h,f){const y=r==="target",k=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:_,y:E}=Xt(e),N=l.elementFromPoint(_,E),p=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:k,b={handleDomNode:p,isValid:!1,connection:null,toHandle:null};if(p){const w=Gm(void 0,p),A=p.getAttribute("data-nodeid"),$=p.getAttribute("data-handleid"),L=p.classList.contains("connectable"),T=p.classList.contains("connectableend");if(!A||!w)return b;const S={source:y?A:i,sourceHandle:y?$:a,target:y?i:A,targetHandle:y?a:$};b.connection=S;const M=L&&T&&(o===un.Strict?y&&w==="source"||!y&&w==="target":A!==i||$!==a);b.isValid=M&&d(S,{nodes:m,edges:u,sourceNode:h(S.source),targetNode:h(S.target)}),b.toHandle=Ym(A,w,$,f,o,!0)}return b}function Gm(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function j0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function K0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Ym(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===un.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,...Do(d,m,m.position,!0)}:m}const Wl={[Me.Left]:Me.Right,[Me.Right]:Me.Left,[Me.Top]:Me.Bottom,[Me.Bottom]:Me.Top},G0=["production","prod"];function Ii(e,...n){qm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function qm(){return!G0.includes(process.env.NODE_ENV||"")}function Wm(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,...Oa(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 ut(e){return typeof t.unref(e)<"u"}function Y0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ft(dt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return An(e)?a=e:a={...e,id:Sm(e)},a=Cm(a,void 0,i),x0(a,n)?!1:a}function q0(e,n,o,i,a){if(!n.source||!n.target)return a(new ft(dt.EDGE_INVALID,e.id)),!1;if(!o)return a(new ft(dt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Sm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Jm(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Qn(l)){o(new ft(dt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=I0(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(dt.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 Xm(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 Xl(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}`;Xm("source",c,u,e,a,l),Xm("target",c,d,e,r,s)}}function Zm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Zl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=An(d)?d:Y0(d,s,a,r);if(!u)continue;const m=o(u.source),h=o(u.target);if(!m||!h){a(new ft(dt.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ft(dt.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new ft(dt.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:h})){a(new ft(dt.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...Cm(u,f,r),sourceNode:m,targetNode:h})}return c}const Qm=Symbol("vueFlow"),ef=Symbol("nodeId"),tf=Symbol("nodeRef"),W0=Symbol("edgeId"),J0=Symbol("edgeRef"),Fa=Symbol("slots");function nf(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:f,multiSelectionActive:y,nodesSelectionActive:k,selectNodesOnDrag:_,removeSelectedElements:E,addSelectedNodes:N,updateNodePositions:p,emits:b}=qe(),{onStart:w,onDrag:A,onStop:$,onClick:L,el:T,disabled:S,id:C,selectable:M,dragHandle:B}=e,g=t.shallowRef(!1);let I=[],v,O=null,x={x:void 0,y:void 0},z={x:0,y:0},j=null,ne=!1,de=!1,pe=0,he=!1;const fe=Q0(),ye=({x:se,y:ue})=>{x={x:se,y:ue};let U=!1;if(I=I.map(F=>{const H={x:se-F.distance.x,y:ue-F.distance.y},{computedPosition:Z}=Gl(F,o.value?za(H,i.value):H,b.error,l.value,F.parentNode?f(F.parentNode):void 0);return U=U||F.position.x!==Z.x||F.position.y!==Z.y,F.position=Z,F}),de=de||U,!!U&&(p(I,!0,!0),g.value=!0,j)){const[F,H]=Kl({id:C,dragItems:I,findNode:f});A({event:j,node:F,nodes:H})}},_e=()=>{if(!O)return;const[se,ue]=Bm(z,O,u.value);if(se!==0||ue!==0){const U={x:(x.x??0)-se/c.value.zoom,y:(x.y??0)-ue/c.value.zoom};h({x:se,y:ue})&&ye(U)}pe=requestAnimationFrame(_e)},Re=(se,ue)=>{ne=!0;const U=f(C);!_.value&&!y.value&&U&&(U.selected||E()),U&&t.toValue(M)&&_.value&&Jl(U,y.value,N,E,k,!1,ue);const F=fe(se.sourceEvent);if(x=F,I=T0(r.value,m.value,F,C),I.length){const[H,Z]=Kl({id:C,dragItems:I,findNode:f});w({event:se.sourceEvent,node:H,nodes:Z})}},ce=(se,ue)=>{var U;se.sourceEvent.type==="touchmove"&&se.sourceEvent.touches.length>1||(de=!1,s.value===0&&Re(se,ue),x=fe(se.sourceEvent),O=((U=n.value)==null?void 0:U.getBoundingClientRect())||null,z=Xt(se.sourceEvent,O))},le=(se,ue)=>{const U=fe(se.sourceEvent);if(!he&&ne&&d.value&&(he=!0,_e()),!ne){const F=U.xSnapped-(x.x??0),H=U.ySnapped-(x.y??0);Math.sqrt(F*F+H*H)>s.value&&Re(se,ue)}(x.x!==U.xSnapped||x.y!==U.ySnapped)&&I.length&&ne&&(j=se.sourceEvent,z=Xt(se.sourceEvent,O),ye(U))},ae=se=>{let ue=!1;if(!ne&&!g.value&&!y.value){const U=se.sourceEvent,F=fe(U),H=F.xSnapped-(x.x??0),Z=F.ySnapped-(x.y??0),X=Math.sqrt(H*H+Z*Z);X!==0&&X<=s.value&&(L==null||L(U),ue=!0)}if(I.length&&!ue){de&&(p(I,!1,!1),de=!1);const[U,F]=Kl({id:C,dragItems:I,findNode:f});$({event:se.sourceEvent,node:U,nodes:F})}I=[],g.value=!1,he=!1,ne=!1,x={x:void 0,y:void 0},cancelAnimationFrame(pe)};return t.watch([()=>t.toValue(S),T],([se,ue],U,F)=>{if(ue){const H=Mt(ue);se||(v=wE().on("start",Z=>ce(Z,ue)).on("drag",Z=>le(Z,ue)).on("end",Z=>ae(Z)).filter(Z=>{const X=Z.target,Ne=t.toValue(B);return!Z.button&&(!a.value||!Fm(X,`.${a.value}`,ue)&&(!Ne||Fm(X,Ne,ue)))}),H.call(v)),F(()=>{H.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),g}function X0(){return{doubleClick:Ae(),click:Ae(),mouseEnter:Ae(),mouseMove:Ae(),mouseLeave:Ae(),contextMenu:Ae(),updateStart:Ae(),update:Ae(),updateEnd:Ae()}}function Z0(e,n){const o=X0();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 Q0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=qe();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=L0(a)?a.sourceEvent:a,{x:c,y:d}=Xt(s,l),u=Ei({x:c,y:d},e.value),{x:m,y:h}=o.value?za(u,n.value):u;return{xSnapped:m,ySnapped:h,...u}}}function Ua(){return!0}function of({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:f,autoPanOnConnect:y,autoPanSpeed:k,findNode:_,panBy:E,startConnection:N,updateConnection:p,endConnection:b,emits:w,viewport:A,edges:$,nodes:L,isValidConnection:T,nodeLookup:S}=qe();let C=null,M=!1,B=null;function g(v){var O;const x=t.toValue(o)==="target",z=Yl(v),j=vm(v.target),ne=v.currentTarget;if(ne&&(z&&v.button===0||!z)){let de=function(ve){U=Xt(ve,ae),ye=H0(Ei(U,A.value,!1,[1,1]),u.value,S.value,Z),F||(H(),F=!0);const G=Km(ve,{handle:ye,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:x?"target":"source",isValidConnection:fe,doc:j,lib:"vue",flowId:s,nodeLookup:S.value},$.value,L.value,_,S.value);B=G.handleDomNode,C=G.connection,M=K0(!!ye,G.isValid);const q={...Se,isValid:M,to:G.toHandle&&M?ki({x:G.toHandle.x,y:G.toHandle.y},A.value):U,toHandle:G.toHandle,toPosition:M&&G.toHandle?G.toHandle.position:Wl[Z.position],toNode:G.toHandle?S.value.get(G.toHandle.nodeId):null};if(M&&ye&&(Se!=null&&Se.toHandle)&&q.toHandle&&Se.toHandle.type===q.toHandle.type&&Se.toHandle.nodeId===q.toHandle.nodeId&&Se.toHandle.id===q.toHandle.id&&Se.to.x===q.to.x&&Se.to.y===q.to.y)return;const Y=ye??G.toHandle;if(p(Y&&M?ki({x:Y.x,y:Y.y},A.value):U,Y,j0(!!Y,M)),Se=q,!ye&&!M&&!B)return ql(ue);C&&C.source!==C.target&&B&&(ql(ue),ue=B,B.classList.add("connecting","vue-flow__handle-connecting"),B.classList.toggle("valid",!!M),B.classList.toggle("vue-flow__handle-valid",!!M))},pe=function(ve){"touches"in ve&&ve.touches.length>0||((ye||B)&&C&&M&&(r?r(ve,C):w.connect(C)),w.connectEnd(ve),a&&(l==null||l(ve)),ql(ue),cancelAnimationFrame(_e),b(ve),F=!1,M=!1,C=null,B=null,j.removeEventListener("mousemove",de),j.removeEventListener("mouseup",pe),j.removeEventListener("touchmove",de),j.removeEventListener("touchend",pe))};const he=_(t.toValue(n));let fe=t.toValue(i)||T.value||Ua;!fe&&he&&(fe=(x?he.isValidSourcePos:he.isValidTargetPos)||Ua);let ye,_e=0;const{x:Re,y:ce}=Xt(v),le=Gm(t.toValue(a),ne),ae=(O=c.value)==null?void 0:O.getBoundingClientRect();if(!ae||!le)return;const se=Ym(t.toValue(n),le,t.toValue(e),S.value,d.value);if(!se)return;let ue,U=Xt(v,ae),F=!1;const H=()=>{if(!y.value)return;const[ve,G]=Bm(U,ae,k.value);E({x:ve,y:G}),_e=requestAnimationFrame(H)},Z={...se,nodeId:t.toValue(n),type:le,position:se.position},X=S.value.get(t.toValue(n)),me={inProgress:!0,isValid:null,from:Do(X,Z,Me.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:X,to:U,toHandle:null,toPosition:Wl[Z.position],toNode:null};N({nodeId:t.toValue(n),id:t.toValue(e),type:le,position:(ne==null?void 0:ne.getAttribute("data-handlepos"))||Me.Top,...U},{x:Re-ae.left,y:ce-ae.top}),w.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:le});let Se=me;j.addEventListener("mousemove",de),j.addEventListener("mouseup",pe),j.addEventListener("touchmove",de),j.addEventListener("touchend",pe)}}function I(v){var O,x;if(!m.value)return;const z=t.toValue(o)==="target";if(!h.value){w.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),N({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Me.Top,...Xt(v)},void 0,!0);return}let j=t.toValue(i)||T.value||Ua;const ne=_(t.toValue(n));if(!j&&ne&&(j=(z?ne.isValidSourcePos:ne.isValidTargetPos)||Ua),ne&&(typeof ne.connectable>"u"?f.value:ne.connectable)===!1)return;const de=vm(v.target),pe=Km(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Me.Top,...Xt(v)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:j,doc:de,lib:"vue",flowId:s,nodeLookup:S.value},$.value,L.value,_,S.value),he=((O=pe.connection)==null?void 0:O.source)===((x=pe.connection)==null?void 0:x.target);pe.isValid&&pe.connection&&!he&&w.connect(pe.connection),w.clickConnectEnd(v),b(v,!0)}return{handlePointerDown:g,handleClick:I}}function eN(){return t.inject(ef,"")}function af(e){const n=e??eN()??"",o=t.inject(tf,t.ref(null)),{findNode:i,edges:a,emits:r}=qe(),l=i(n);return l||r.error(new ft(dt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>eo([l],a.value))}}function tN(){return{doubleClick:Ae(),click:Ae(),mouseEnter:Ae(),mouseMove:Ae(),mouseLeave:Ae(),contextMenu:Ae(),dragStart:Ae(),drag:Ae(),dragStop:Ae()}}function nN(e,n){const o=tN();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 rf(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=qe();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,h=d?4:1,f=c.x*u*h,y=c.y*m*h,k=[];for(const _ of e.value)if(_.draggable||l&&typeof _.draggable>"u"){const E={x:_.computedPosition.x+f,y:_.computedPosition.y+y},{position:N}=Gl(_,E,s.error,n.value,_.parentNode?i(_.parentNode):void 0);k.push({id:_.id,position:N,from:_.position,distance:{x:c.x,y:c.y},dimensions:_.dimensions})}o(k,!0,!1)}}const Ha=.1,oN=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Mn(){return Ii("Viewport not initialized yet."),Promise.resolve(!1)}const iN={zoomIn:Mn,zoomOut:Mn,zoomTo:Mn,fitView:Mn,setCenter:Mn,fitBounds:Mn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Mn,setTransform:Mn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function aN(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ui:va).scaleBy(Ql(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}=Im({x:-i,y:-a},e.translateExtent),m=Mo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?ui:va).transform(Ql(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"?ui:va).scaleTo(Ql(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:Ha,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=Ul(s),{x:d,y:u,zoom:m}=Tm(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ha);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:Ha})=>{const{x:l,y:s,zoom:c}=Tm(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Ha);return o(l,s,c,r)},project:a=>Ei(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 Ei(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 ki(s,e.viewport)}return{x:0,y:0}}}:iN)}function Ql(e,n=0,o=oN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function rN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let k,_,E=!!(o.nodes.value.length||o.edges.value.length);k=So([e.modelValue,()=>{var N,p;return(p=(N=e.modelValue)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setElements(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=So([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,p])=>{var b;(b=e.modelValue)!=null&&b.value&&Array.isArray(e.modelValue.value)&&(k==null||k.pause(),e.modelValue.value=[...N,...p],t.nextTick(()=>{k==null||k.resume()}))},{immediate:E}),t.onScopeDispose(()=>{k==null||k.stop(),_==null||_.stop()})})},r=()=>{i.run(()=>{let k,_,E=!!o.nodes.value.length;k=So([e.nodes,()=>{var N,p;return(p=(N=e.nodes)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setNodes(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=So([o.nodes,()=>o.nodes.value.length],([N])=>{var p;(p=e.nodes)!=null&&p.value&&Array.isArray(e.nodes.value)&&(k==null||k.pause(),e.nodes.value=[...N],t.nextTick(()=>{k==null||k.resume()}))},{immediate:E}),t.onScopeDispose(()=>{k==null||k.stop(),_==null||_.stop()})})},l=()=>{i.run(()=>{let k,_,E=!!o.edges.value.length;k=So([e.edges,()=>{var N,p;return(p=(N=e.edges)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setEdges(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=So([o.edges,()=>o.edges.value.length],([N])=>{var p;(p=e.edges)!=null&&p.value&&Array.isArray(e.edges.value)&&(k==null||k.pause(),e.edges.value=[...N],t.nextTick(()=>{k==null||k.resume()}))},{immediate:E}),t.onScopeDispose(()=>{k==null||k.stop(),_==null||_.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ut(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ut(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ut(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ut(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ut(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const k=async _=>{let E=_;typeof n.autoConnect=="function"&&(E=await n.autoConnect(_)),E!==!1&&o.addEdges([E])};t.watch(()=>n.autoConnect,()=>{ut(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(_,E,N)=>{_?o.onConnect(k):o.hooks.value.connect.off(k),N(()=>{o.hooks.value.connect.off(k)})},{immediate:!0})})},f=()=>{const k=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const _ of Object.keys(n)){const E=_;if(!k.includes(E)){const N=t.toRef(()=>n[E]),p=o[E];t.isRef(p)&&i.run(()=>{t.watch(N,b=>{ut(b)&&(p.value=b)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),h(),f()})()}),()=>i.stop()}function lN(){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=>Ii(e.message))}}function sN(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),ai(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),ai(r.removeHasEmitListeners)}});function i(a){var r;const l=cN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function cN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function lf(){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:Pl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:gi.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:Xn.Bezier,style:{}},connectionMode:un.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:wi()?"Meta":"Control",zoomActivationKeyCode:wi()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:lN(),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 dN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function uN(e,n,o){const i=aN(e),a=U=>{const F=U??[];e.hooks.updateNodeInternals.trigger(F)},r=U=>C0(U,e.nodes,e.edges),l=U=>v0(U,e.nodes,e.edges),s=U=>eo(U,e.edges),c=({id:U,type:F,nodeId:H})=>{var Z;const X=U?`-${F}-${U}`:`-${F}`;return Array.from(((Z=e.connectionLookup.get(`${H}${X}`))==null?void 0:Z.values())??[])},d=U=>{if(U)return n.value.get(U)},u=U=>{if(U)return o.value.get(U)},m=(U,F,H)=>{var Z,X;const Ne=[];for(const me of U){const Se={id:me.id,type:"position",dragging:H,from:me.from};if(F&&(Se.position=me.position,me.parentNode)){const ve=d(me.parentNode);Se.position={x:Se.position.x-(((Z=ve==null?void 0:ve.computedPosition)==null?void 0:Z.x)??0),y:Se.position.y-(((X=ve==null?void 0:ve.computedPosition)==null?void 0:X.y)??0)}}Ne.push(Se)}Ne!=null&&Ne.length&&e.hooks.nodesChange.trigger(Ne)},h=U=>{if(!e.vueFlowRef)return;const F=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!F)return;const H=window.getComputedStyle(F),{m22:Z}=new window.DOMMatrixReadOnly(H.transform),X=[];for(const Ne of U){const me=Ne,Se=d(me.id);if(Se){const ve=Oa(me.nodeElement);if(!!(ve.width&&ve.height&&(Se.dimensions.width!==ve.width||Se.dimensions.height!==ve.height||me.forceUpdate))){const q=me.nodeElement.getBoundingClientRect();Se.dimensions=ve,Se.handleBounds.source=Wm("source",me.nodeElement,q,Z,Se.id),Se.handleBounds.target=Wm("target",me.nodeElement,q,Z,Se.id),X.push({id:Se.id,type:"dimensions",dimensions:ve})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),X.length&&e.hooks.nodesChange.trigger(X)},f=(U,F)=>{const H=new Set,Z=new Set;for(const me of U)Qn(me)?H.add(me.id):An(me)&&Z.add(me.id);const X=Tn(n.value,H,!0),Ne=Tn(o.value,Z);if(e.multiSelectionActive){for(const me of H)X.push($n(me,F));for(const me of Z)Ne.push($n(me,F))}X.length&&e.hooks.nodesChange.trigger(X),Ne.length&&e.hooks.edgesChange.trigger(Ne)},y=U=>{if(e.multiSelectionActive){const F=U.map(H=>$n(H.id,!0));e.hooks.nodesChange.trigger(F);return}e.hooks.nodesChange.trigger(Tn(n.value,new Set(U.map(F=>F.id)),!0)),e.hooks.edgesChange.trigger(Tn(o.value))},k=U=>{if(e.multiSelectionActive){const F=U.map(H=>$n(H.id,!0));e.hooks.edgesChange.trigger(F);return}e.hooks.edgesChange.trigger(Tn(o.value,new Set(U.map(F=>F.id)))),e.hooks.nodesChange.trigger(Tn(n.value,new Set,!0))},_=U=>{f(U,!0)},E=U=>{const H=(U||e.nodes).map(Z=>(Z.selected=!1,$n(Z.id,!1)));e.hooks.nodesChange.trigger(H)},N=U=>{const H=(U||e.edges).map(Z=>(Z.selected=!1,$n(Z.id,!1)));e.hooks.edgesChange.trigger(H)},p=U=>{if(!U||!U.length)return f([],!1);const F=U.reduce((H,Z)=>{const X=$n(Z.id,!1);return Qn(Z)?H.nodes.push(X):H.edges.push(X),H},{nodes:[],edges:[]});F.nodes.length&&e.hooks.nodesChange.trigger(F.nodes),F.edges.length&&e.hooks.edgesChange.trigger(F.edges)},b=U=>{var F;(F=e.d3Zoom)==null||F.scaleExtent([U,e.maxZoom]),e.minZoom=U},w=U=>{var F;(F=e.d3Zoom)==null||F.scaleExtent([e.minZoom,U]),e.maxZoom=U},A=U=>{var F;(F=e.d3Zoom)==null||F.translateExtent(U),e.translateExtent=U},$=U=>{e.nodeExtent=U,a()},L=U=>{var F;(F=e.d3Zoom)==null||F.clickDistance(U)},T=U=>{e.nodesDraggable=U,e.nodesConnectable=U,e.elementsSelectable=U},S=U=>{const F=U instanceof Function?U(e.nodes):U;!e.initialized&&!F.length||(e.nodes=Jm(F,d,e.hooks.error.trigger))},C=U=>{const F=U instanceof Function?U(e.edges):U;if(!e.initialized&&!F.length)return;const H=Zl(F,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Xl(e.connectionLookup,o.value,H),e.edges=H},M=U=>{const F=U instanceof Function?U([...e.nodes,...e.edges]):U;!e.initialized&&!F.length||(S(F.filter(Qn)),C(F.filter(An)))},B=U=>{let F=U instanceof Function?U(e.nodes):U;F=Array.isArray(F)?F:[F];const H=Jm(F,d,e.hooks.error.trigger),Z=[];for(const X of H)Z.push(Om(X));Z.length&&e.hooks.nodesChange.trigger(Z)},g=U=>{let F=U instanceof Function?U(e.edges):U;F=Array.isArray(F)?F:[F];const H=Zl(F,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Z=[];for(const X of H)Z.push(Om(X));Z.length&&e.hooks.edgesChange.trigger(Z)},I=(U,F=!0,H=!1)=>{const Z=U instanceof Function?U(e.nodes):U,X=Array.isArray(Z)?Z:[Z],Ne=[],me=[];function Se(G){const q=s(G);for(const Y of q)(!ut(Y.deletable)||Y.deletable)&&me.push(Pm(Y.id,Y.source,Y.target,Y.sourceHandle,Y.targetHandle))}function ve(G){const q=[];for(const Y of e.nodes)Y.parentNode===G&&q.push(Y);if(q.length){for(const Y of q)Ne.push(Lm(Y.id));F&&Se(q);for(const Y of q)ve(Y.id)}}for(const G of X){const q=typeof G=="string"?d(G):G;q&&(ut(q.deletable)&&!q.deletable||(Ne.push(Lm(q.id)),F&&Se([q]),H&&ve(q.id)))}me.length&&e.hooks.edgesChange.trigger(me),Ne.length&&e.hooks.nodesChange.trigger(Ne)},v=U=>{const F=U instanceof Function?U(e.edges):U,H=Array.isArray(F)?F:[F],Z=[];for(const X of H){const Ne=typeof X=="string"?u(X):X;Ne&&(ut(Ne.deletable)&&!Ne.deletable||Z.push(Pm(typeof X=="string"?X:X.id,Ne.source,Ne.target,Ne.sourceHandle,Ne.targetHandle)))}e.hooks.edgesChange.trigger(Z)},O=(U,F,H=!0)=>{const Z=u(U.id);if(!Z)return!1;const X=e.edges.indexOf(Z),Ne=q0(U,F,Z,H,e.hooks.error.trigger);if(Ne){const[me]=Zl([Ne],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Se,ve)=>ve===X?me:Se),Xl(e.connectionLookup,o.value,[me]),me}return!1},x=(U,F,H={replace:!1})=>{const Z=u(U);if(!Z)return;const X=typeof F=="function"?F(Z):F;Z.data=H.replace?X:{...Z.data,...X}},z=U=>Dm(U,e.nodes),j=U=>{const F=Dm(U,e.edges);return Xl(e.connectionLookup,o.value,F),F},ne=(U,F,H={replace:!1})=>{const Z=d(U);if(!Z)return;const X=typeof F=="function"?F(Z):F;H.replace?e.nodes.splice(e.nodes.indexOf(Z),1,X):Object.assign(Z,X)},de=(U,F,H={replace:!1})=>{const Z=d(U);if(!Z)return;const X=typeof F=="function"?F(Z):F;Z.data=H.replace?X:{...Z.data,...X}},pe=(U,F,H=!1)=>{H?e.connectionClickStartHandle=U:e.connectionStartHandle=U,e.connectionEndHandle=null,e.connectionStatus=null,F&&(e.connectionPosition=F)},he=(U,F=null,H=null)=>{e.connectionStartHandle&&(e.connectionPosition=U,e.connectionEndHandle=F,e.connectionStatus=H)},fe=(U,F)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,F?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ye=U=>{const F=w0(U),H=F?null:_i(U)?U:d(U.id);return!F&&!H?[null,null,F]:[F?U:Ba(H),H,F]},_e=(U,F=!0,H=e.nodes)=>{const[Z,X,Ne]=ye(U);if(!Z)return[];const me=[];for(const Se of H||e.nodes){if(!Ne&&(Se.id===X.id||!Se.computedPosition))continue;const ve=Ba(Se),G=Da(ve,Z);(F&&G>0||G>=ve.width*ve.height||G>=Number(Z.width)*Number(Z.height))&&me.push(Se)}return me},Re=(U,F,H=!0)=>{const[Z]=ye(U);if(!Z)return!1;const X=Da(Z,F);return H&&X>0||X>=Number(Z.width)*Number(Z.height)},ce=U=>{const{viewport:F,dimensions:H,d3Zoom:Z,d3Selection:X,translateExtent:Ne}=e;if(!Z||!X||!U.x&&!U.y)return!1;const me=Mo.translate(F.x+U.x,F.y+U.y).scale(F.zoom),Se=[[0,0],[H.width,H.height]],ve=Z.constrain()(me,Se,Ne),G=e.viewport.x!==ve.x||e.viewport.y!==ve.y||e.viewport.zoom!==ve.k;return Z.transform(X,ve),G},le=U=>{const F=U instanceof Function?U(e):U,H=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ut(F.defaultEdgeOptions)&&(e.defaultEdgeOptions=F.defaultEdgeOptions);const Z=F.modelValue||F.nodes||F.edges?[]:void 0;Z&&(F.modelValue&&Z.push(...F.modelValue),F.nodes&&Z.push(...F.nodes),F.edges&&Z.push(...F.edges),M(Z));const X=()=>{ut(F.maxZoom)&&w(F.maxZoom),ut(F.minZoom)&&b(F.minZoom),ut(F.translateExtent)&&A(F.translateExtent)};for(const Ne of Object.keys(F)){const me=Ne,Se=F[me];![...dN,...H].includes(me)&&ut(Se)&&(e[me]=Se)}bl(()=>e.d3Zoom).not.toBeNull().then(X),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:h,setElements:M,setNodes:S,setEdges:C,addNodes:B,addEdges:g,removeNodes:I,removeEdges:v,findNode:d,findEdge:u,updateEdge:O,updateEdgeData:x,updateNode:ne,updateNodeData:de,applyEdgeChanges:j,applyNodeChanges:z,addSelectedElements:_,addSelectedNodes:y,addSelectedEdges:k,setMinZoom:b,setMaxZoom:w,setTranslateExtent:A,setNodeExtent:$,setPaneClickDistance:L,removeSelectedElements:p,removeSelectedNodes:E,removeSelectedEdges:N,startConnection:pe,updateConnection:he,endConnection:fe,setInteractive:T,setState:le,getIntersectingNodes:_e,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Re,panBy:ce,fitView:U=>i.value.fitView(U),zoomIn:U=>i.value.zoomIn(U),zoomOut:U=>i.value.zoomOut(U),zoomTo:(U,F)=>i.value.zoomTo(U,F),setViewport:(U,F)=>i.value.setViewport(U,F),setTransform:(U,F)=>i.value.setTransform(U,F),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(U,F,H)=>i.value.setCenter(U,F,H),fitBounds:(U,F)=>i.value.fitBounds(U,F),project:U=>i.value.project(U),screenToFlowCoordinate:U=>i.value.screenToFlowCoordinate(U),flowToScreenCoordinate:U=>i.value.flowToScreenCoordinate(U),toObject:()=>{const U=[],F=[];for(const H of e.nodes){const{computedPosition:Z,handleBounds:X,selected:Ne,dimensions:me,isParent:Se,resizing:ve,dragging:G,events:q,...Y}=H;U.push(Y)}for(const H of e.edges){const{selected:Z,sourceNode:X,targetNode:Ne,events:me,...Se}=H;F.push(Se)}return JSON.parse(JSON.stringify({nodes:U,edges:F,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:U=>new Promise(F=>{const{nodes:H,edges:Z,position:X,zoom:Ne,viewport:me}=U;H&&S(H),Z&&C(Z);const[Se,ve]=me!=null&&me.x&&(me!=null&&me.y)?[me.x,me.y]:X??[null,null];if(Se&&ve){const G=(me==null?void 0:me.zoom)||Ne||e.viewport.zoom;return bl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Se,y:ve,zoom:G}).then(()=>{F(!0)})})}else F(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const U=lf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const F=Mo.translate(U.defaultViewport.x??0,U.defaultViewport.y??0).scale(Zn(U.defaultViewport.zoom??1,U.minZoom,U.maxZoom)),H=e.viewportRef.getBoundingClientRect(),Z=[[0,0],[H.width,H.height]],X=e.d3Zoom.constrain()(F,Z,U.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}le(U)},$destroy:()=>{}}}const mN=["data-id","data-handleid","data-nodeid","data-handlepos"],fN={name:"Handle",compatConfig:{MODE:3}},to=t.defineComponent({...fN,props:{id:{default:null},type:{},position:{default:()=>Me.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}=qe(),{id:f,node:y,nodeEl:k,connectedEdges:_}=af(),E=t.ref(),N=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),p=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),b=t.toRef(()=>{var C,M,B,g,I,v;return((C=l.value)==null?void 0:C.nodeId)===f&&((M=l.value)==null?void 0:M.id)===e.id&&((B=l.value)==null?void 0:B.type)===i.value||((g=c.value)==null?void 0:g.nodeId)===f&&((I=c.value)==null?void 0:I.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),w=t.toRef(()=>{var C,M,B;return((C=s.value)==null?void 0:C.nodeId)===f&&((M=s.value)==null?void 0:M.id)===e.id&&((B=s.value)==null?void 0:B.type)===i.value}),{handlePointerDown:A,handleClick:$}=of({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),L=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(C=>{const M=C[`${i.value}Handle`];return C[i.value]!==f?!1:M?M===e.id:!0}):typeof e.connectable=="number"?_.value.filter(C=>{const M=C[`${i.value}Handle`];return C[i.value]!==f?!1:M?M===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,_.value):ut(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var C;if(!y.dimensions.width||!y.dimensions.height)return;const M=(C=y.handleBounds[i.value])==null?void 0:C.find(z=>z.id===e.id);if(!d.value||M)return;const B=d.value.querySelector(".vue-flow__transformationpane");if(!k.value||!E.value||!B||!e.id)return;const g=k.value.getBoundingClientRect(),I=E.value.getBoundingClientRect(),v=window.getComputedStyle(B),{m22:O}=new window.DOMMatrixReadOnly(v.transform),x={id:e.id,position:e.position,x:(I.left-g.left)/O,y:(I.top-g.top)/O,type:i.value,nodeId:f,...Oa(E.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],x]});function T(C){const M=Yl(C);L.value&&N.value&&(M&&C.button===0||!M)&&A(C)}function S(C){!f||!s.value&&!N.value||L.value&&$(C)}return n({handleClick:$,handlePointerDown:A,onClick:S,onPointerDown:T}),(C,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:E,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":C.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${C.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(h),i.value,{connectable:L.value,connecting:w.value,connectablestart:N.value,connectableend:p.value,connectionindicator:L.value&&(N.value&&!b.value||p.value&&b.value)}]]),onMousedown:T,onTouchstartPassive:T,onClick:S},[t.renderSlot(C.$slots,"default",{id:C.id})],42,mN))}}),ja=function({sourcePosition:e=Me.Bottom,targetPosition:n=Me.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(to,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(to,{type:"source",position:e,connectable:i,isValidConnection:r})]};ja.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],ja.inheritAttrs=!1,ja.compatConfig={MODE:3};const pN=ja,Ka=function({targetPosition:e=Me.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(to,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};Ka.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ka.inheritAttrs=!1,Ka.compatConfig={MODE:3};const hN=Ka,Ga=function({sourcePosition:e=Me.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(to,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ga.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ga.inheritAttrs=!1,Ga.compatConfig={MODE:3};const yN=Ga,gN=["transform"],bN=["width","height","x","y","rx","ry"],_N=["y"],kN={name:"EdgeText",compatConfig:{MODE:3}},EN=t.defineComponent({...kN,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,bN)):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,_N)],8,gN))}}),NN=["id","d","marker-end","marker-start"],wN=["d","stroke-width"],IN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ya=t.defineComponent({...IN,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,NN),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,wN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(EN,{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 sf({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 cf({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 qa(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function df({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Me.Left:l=n-qa(n-i,r),s=o;break;case Me.Right:l=n+qa(i-n,r),s=o;break;case Me.Top:l=n,s=o-qa(o-a,r);break;case Me.Bottom:l=n,s=o+qa(a-o,r);break}return[l,s]}function uf(e){const{sourceX:n,sourceY:o,sourcePosition:i=Me.Bottom,targetX:a,targetY:r,targetPosition:l=Me.Top,curvature:s=.25}=e,[c,d]=df({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=df({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[h,f,y,k]=cf({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,f,y,k]}function mf({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Me.Left:case Me.Right:r=.5*(n+i),l=o;break;case Me.Top:case Me.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function ff(e){const{sourceX:n,sourceY:o,sourcePosition:i=Me.Bottom,targetX:a,targetY:r,targetPosition:l=Me.Top}=e,[s,c]=mf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=mf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,h,f,y]=cf({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,f,y]}const pf={[Me.Left]:{x:-1,y:0},[Me.Right]:{x:1,y:0},[Me.Top]:{x:0,y:-1},[Me.Bottom]:{x:0,y:1}};function vN({source:e,sourcePosition:n=Me.Bottom,target:o}){return n===Me.Left||n===Me.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 hf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function CN({source:e,sourcePosition:n=Me.Bottom,target:o,targetPosition:i=Me.Top,center:a,offset:r}){const l=pf[n],s=pf[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=vN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",h=u[m];let f,y,k;const _={x:0,y:0},E={x:0,y:0},[N,p,b,w]=sf({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??N,k=a.y??p;const $=[{x:y,y:c.y},{x:y,y:d.y}],L=[{x:c.x,y:k},{x:d.x,y:k}];l[m]===h?f=m==="x"?$:L:f=m==="x"?L:$}else{const $=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===h?L:$:f=l.y===h?$:L,n===i){const B=Math.abs(e[m]-o[m]);if(B<=r){const g=Math.min(r-1,r-B);l[m]===h?_[m]=(c[m]>e[m]?-1:1)*g:E[m]=(d[m]>o[m]?-1:1)*g}}if(n!==i){const B=m==="x"?"y":"x",g=l[m]===s[B],I=c[B]>d[B],v=c[B]<d[B];(l[m]===1&&(!g&&I||g&&v)||l[m]!==1&&(!g&&v||g&&I))&&(f=m==="x"?$:L)}const T={x:c.x+_.x,y:c.y+_.y},S={x:d.x+E.x,y:d.y+E.y},C=Math.max(Math.abs(T.x-f[0].x),Math.abs(S.x-f[0].x)),M=Math.max(Math.abs(T.y-f[0].y),Math.abs(S.y-f[0].y));C>=M?(y=(T.x+S.x)/2,k=f[0].y):(y=f[0].x,k=(T.y+S.y)/2)}return[[e,{x:c.x+_.x,y:c.y+_.y},...f,{x:d.x+E.x,y:d.y+E.y},o],y,k,b,w]}function xN(e,n,o,i){const a=Math.min(hf(e,n)/2,hf(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 es(e){const{sourceX:n,sourceY:o,sourcePosition:i=Me.Bottom,targetX:a,targetY:r,targetPosition:l=Me.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,h,f,y,k]=CN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((E,N,p)=>{let b;return p>0&&p<m.length-1?b=xN(m[p-1],N,m[p+1],s):b=`${p===0?"M":"L"}${N.x} ${N.y}`,E+=b,E},""),h,f,y,k]}function SN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=sf({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const RN=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]=SN(e);return t.h(Ya,{path:o,labelX:i,labelY:a,...n,...e})}}}),yf=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]=es({...e,sourcePosition:e.sourcePosition??Me.Bottom,targetPosition:e.targetPosition??Me.Top});return t.h(Ya,{path:o,labelX:i,labelY:a,...n,...e})}}}),AN=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(yf,{...e,...n,borderRadius:0})}}),$N=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]=uf({...e,sourcePosition:e.sourcePosition??Me.Bottom,targetPosition:e.targetPosition??Me.Top});return t.h(Ya,{path:o,labelX:i,labelY:a,...n,...e})}}}),TN=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]=ff({...e,sourcePosition:e.sourcePosition??Me.Bottom,targetPosition:e.targetPosition??Me.Top});return t.h(Ya,{path:o,labelX:i,labelY:a,...n,...e})}}}),MN={input:yN,default:pN,output:hN},VN={default:$N,straight:RN,step:AN,smoothstep:yf,simplebezier:TN};function BN(e,n,o){const i=t.computed(()=>k=>n.value.get(k)),a=t.computed(()=>k=>o.value.get(k)),r=t.computed(()=>{const k={...VN,...e.edgeTypes},_=Object.keys(k);for(const E of e.edges)E.type&&!_.includes(E.type)&&(k[E.type]=E.type);return k}),l=t.computed(()=>{const k={...MN,...e.nodeTypes},_=Object.keys(k);for(const E of e.nodes)E.type&&!_.includes(E.type)&&(k[E.type]=E.type);return k}),s=t.computed(()=>e.onlyRenderVisibleElements?$m(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 k=[];for(const _ of e.edges){const E=n.value.get(_.source),N=n.value.get(_.target);D0({sourcePos:E.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:E.dimensions.width,sourceHeight:E.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&k.push(_)}return k}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const k=[];for(const _ of e.nodes)_.selected&&k.push(_);return k}),m=t.computed(()=>{const k=[];for(const _ of e.edges)_.selected&&k.push(_);return k}),h=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const k=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&_.handleBounds!==void 0&&k.push(_);return k}),y=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:h,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:y}}class no{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)??no.instance;return no.instance=i??new no,o&&(o.config.globalProperties.$vueFlowStorage=no.instance),no.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=lf(),a=t.reactive(i),r={};for(const[h,f]of Object.entries(a.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=f.on}const l={};for(const[h,f]of Object.entries(a.hooks))l[h]=f.trigger;const s=t.computed(()=>{const h=new Map;for(const f of a.nodes)h.set(f.id,f);return h}),c=t.computed(()=>{const h=new Map;for(const f of a.edges)h.set(f.id,f);return h}),d=BN(a,s,c),u=uN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...T_(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 qe(e){const n=no.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(Qm,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,f)=>{const y=_=>{d.applyNodeChanges(_)},k=_=>{d.applyEdgeChanges(_)};m?(d.onNodesChange(y),d.onEdgesChange(k)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(k)),f(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(k)})},{immediate:!0}),ai(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ii(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Qm,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ft(dt.USEVUEFLOW_OPTIONS))}return s}function DN(e){const{emits:n,dimensions:o}=qe();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=Oa(e.value);(s.width===0||s.height===0)&&n.error(new ft(dt.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 ON={name:"UserSelection",compatConfig:{MODE:3}},LN=t.defineComponent({...ON,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))}}),PN=["tabIndex"],zN={name:"NodesSelection",compatConfig:{MODE:3}},FN=t.defineComponent({...zN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=qe(),s=rf(),c=t.ref(null),d=nf({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(()=>Ul(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 f(y){r.value||Vo[y.key]&&(y.preventDefault(),s({x:Vo[y.key].x,y:Vo[y.key].y},y.shiftKey))}return(y,k)=>!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:f},null,46,PN)],6)):t.createCommentVNode("",!0)}});function UN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const HN={name:"Pane",compatConfig:{MODE:3}},jN=t.defineComponent({...HN,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:f,selectionMode:y,deleteKeyCode:k,multiSelectionKeyCode:_,multiSelectionActive:E,edgeLookup:N,nodeLookup:p,connectionLookup:b,defaultEdgeOptions:w,connectionStartHandle:A,panOnDrag:$}=qe(),L=t.shallowRef(null),T=t.shallowRef(new Set),S=t.shallowRef(new Set),C=t.shallowRef(null),M=t.toRef(()=>c.value&&(e.isSelecting||r.value)),B=t.toRef(()=>A.value!==null);let g=!1,I=!1;const v=bi(k,{actInsideInputWithModifier:!1}),O=bi(_);t.watch(v,fe=>{fe&&(h(m.value),f(u.value),d.value=!1)}),t.watch(O,fe=>{E.value=fe});function x(fe,ye){return _e=>{_e.target===ye&&(fe==null||fe(_e))}}function z(fe){if(g||B.value){g=!1;return}a.paneClick(fe),l(),d.value=!1}function j(fe){var ye;if(Array.isArray($.value)&&((ye=$.value)!=null&&ye.includes(2))){fe.preventDefault();return}a.paneContextMenu(fe)}function ne(fe){a.paneScroll(fe)}function de(fe){var ye,_e,Re;if(C.value=((ye=n.value)==null?void 0:ye.getBoundingClientRect())??null,!c.value||!e.isSelecting||fe.button!==0||fe.target!==L.value||!C.value)return;(Re=(_e=fe.target)==null?void 0:_e.setPointerCapture)==null||Re.call(_e,fe.pointerId);const{x:ce,y:le}=UN(fe,C.value);I=!0,g=!1,l(),s.value={width:0,height:0,startX:ce,startY:le,x:ce,y:le},a.selectionStart(fe)}function pe(fe){var ye;if(!C.value||!s.value)return;g=!0;const{x:_e,y:Re}=Xt(fe,C.value),{startX:ce=0,startY:le=0}=s.value,ae={startX:ce,startY:le,x:_e<ce?_e:ce,y:Re<le?Re:le,width:Math.abs(_e-ce),height:Math.abs(Re-le)},se=T.value,ue=S.value;T.value=new Set($m(o.value,ae,i.value,y.value===Pl.Partial,!0).map(F=>F.id)),S.value=new Set;const U=((ye=w.value)==null?void 0:ye.selectable)??!0;for(const F of T.value){const H=b.value.get(F);if(H)for(const{edgeId:Z}of H.values()){const X=N.value.get(Z);X&&(X.selectable??U)&&S.value.add(Z)}}if(!Zm(se,T.value)){const F=Tn(p.value,T.value,!0);a.nodesChange(F)}if(!Zm(ue,S.value)){const F=Tn(N.value,S.value);a.edgesChange(F)}s.value=ae,r.value=!0,d.value=!1}function he(fe){var ye;fe.button!==0||!I||((ye=fe.target)==null||ye.releasePointerCapture(fe.pointerId),!r.value&&s.value&&fe.target===L.value&&z(fe),r.value=!1,s.value=null,d.value=T.value.size>0,a.selectionEnd(fe),e.selectionKeyPressed&&(g=!1),I=!1)}return(fe,ye)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:L,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:fe.isSelecting}]),onClick:ye[0]||(ye[0]=_e=>M.value?void 0:x(z,L.value)(_e)),onContextmenu:ye[1]||(ye[1]=_e=>x(j,L.value)(_e)),onWheelPassive:ye[2]||(ye[2]=_e=>x(ne,L.value)(_e)),onPointerenter:ye[3]||(ye[3]=_e=>M.value?void 0:t.unref(a).paneMouseEnter(_e)),onPointerdown:ye[4]||(ye[4]=_e=>M.value?de(_e):t.unref(a).paneMouseMove(_e)),onPointermove:ye[5]||(ye[5]=_e=>M.value?pe(_e):t.unref(a).paneMouseMove(_e)),onPointerup:ye[6]||(ye[6]=_e=>M.value?he(_e):void 0),onPointerleave:ye[7]||(ye[7]=_e=>t.unref(a).paneMouseLeave(_e))},[t.renderSlot(fe.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(LN,{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(FN,{key:1})):t.createCommentVNode("",!0)],34))}}),KN={name:"Transform",compatConfig:{MODE:3}},GN=t.defineComponent({...KN,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=qe(),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))}}),YN={name:"Viewport",compatConfig:{MODE:3}},qN=t.defineComponent({...YN,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:f,zoomOnScroll:y,preventScrolling:k,noWheelClassName:_,noPanClassName:E,emits:N,connectionStartHandle:p,userSelectionActive:b,paneDragging:w,d3Zoom:A,d3Selection:$,d3ZoomHandler:L,viewport:T,viewportRef:S,paneClickDistance:C}=qe();DN(S);const M=t.shallowRef(!1),B=t.shallowRef(!1);let g=null,I=!1,v=0,O={x:0,y:0,zoom:0};const x=bi(s),z=bi(l),j=bi(r),ne=t.toRef(()=>(!z.value||z.value&&l.value===!0)&&(x.value||m.value)),de=t.toRef(()=>x.value||c.value),pe=t.toRef(()=>l.value===!0&&ne.value!==!0),he=t.toRef(()=>z.value&&l.value!==!0||b.value||pe.value),fe=t.toRef(()=>p.value!==null);t.onMounted(()=>{if(!S.value){Ii("Viewport element is missing");return}const le=S.value,ae=le.getBoundingClientRect(),se=y0().clickDistance(C.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Mt(le).call(se),U=ue.on("wheel.zoom"),F=Mo.translate(i.value.x??0,i.value.y??0).scale(Zn(i.value.zoom??1,n.value,o.value)),H=[[0,0],[ae.width,ae.height]],Z=se.constrain()(F,H,a.value);se.transform(ue,Z),se.wheelDelta(Hl),A.value=se,$.value=ue,L.value=U,T.value={x:Z.x,y:Z.y,zoom:Z.k},se.on("start",X=>{var Ne;if(!X.sourceEvent)return null;v=X.sourceEvent.button,M.value=!0;const me=Re(X.transform);((Ne=X.sourceEvent)==null?void 0:Ne.type)==="mousedown"&&(w.value=!0),O=me,N.viewportChangeStart(me),N.moveStart({event:X,flowTransform:me})}),se.on("end",X=>{if(!X.sourceEvent)return null;if(M.value=!1,w.value=!1,ye(ne.value,v??0)&&!I&&N.paneContextMenu(X.sourceEvent),I=!1,_e(O,X.transform)){const Ne=Re(X.transform);O=Ne,N.viewportChangeEnd(Ne),N.moveEnd({event:X,flowTransform:Ne})}}),se.filter(X=>{var Ne;const me=j.value||y.value,Se=f.value&&X.ctrlKey,ve=X.button,G=X.type==="wheel";if(ve===1&&X.type==="mousedown"&&(ce(X,"vue-flow__node")||ce(X,"vue-flow__edge")))return!0;if(!ne.value&&!me&&!de.value&&!h.value&&!f.value||b.value||fe.value&&!G||!h.value&&X.type==="dblclick"||ce(X,_.value)&&G||ce(X,E.value)&&(!G||de.value&&G&&!j.value)||!f.value&&X.ctrlKey&&G||!me&&!de.value&&!Se&&G)return!1;if(!f&&X.type==="touchstart"&&((Ne=X.touches)==null?void 0:Ne.length)>1)return X.preventDefault(),!1;if(!ne.value&&(X.type==="mousedown"||X.type==="touchstart")||pe.value&&Array.isArray(m.value)&&m.value.includes(0)&&ve===0||Array.isArray(m.value)&&!m.value.includes(ve)&&(X.type==="mousedown"||X.type==="touchstart"))return!1;const q=Array.isArray(m.value)&&m.value.includes(ve)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!ve||ve<=1;return(!X.ctrlKey||x.value||G)&&q}),t.watch([b,ne],()=>{b.value&&!M.value?se.on("zoom",null):b.value||se.on("zoom",X=>{T.value={x:X.transform.x,y:X.transform.y,zoom:X.transform.k};const Ne=Re(X.transform);I=ye(ne.value,v??0),N.viewportChange(Ne),N.move({event:X,flowTransform:Ne})})},{immediate:!0}),t.watch([b,de,d,j,f,k,_],()=>{de.value&&!j.value&&!b.value?ue.on("wheel.zoom",X=>{if(ce(X,_.value))return!1;const Ne=j.value||y.value,me=f.value&&X.ctrlKey;if(!(!k.value||de.value||Ne||me))return!1;X.preventDefault(),X.stopImmediatePropagation();const ve=ue.property("__zoom").k||1,G=wi();if(!x.value&&X.ctrlKey&&f.value&&G){const Ve=Yt(X),Le=Hl(X),oe=ve*2**Le;se.scaleTo(ue,oe,Ve,X);return}const q=X.deltaMode===1?20:1;let Y=d.value===gi.Vertical?0:X.deltaX*q,xe=d.value===gi.Horizontal?0:X.deltaY*q;!G&&X.shiftKey&&d.value!==gi.Vertical&&!Y&&xe&&(Y=xe,xe=0),se.translateBy(ue,-(Y/ve)*u.value,-(xe/ve)*u.value);const Be=Re(ue.property("__zoom"));g&&clearTimeout(g),B.value?(N.move({event:X,flowTransform:Be}),N.viewportChange(Be),g=setTimeout(()=>{N.moveEnd({event:X,flowTransform:Be}),N.viewportChangeEnd(Be),B.value=!1},150)):(B.value=!0,N.moveStart({event:X,flowTransform:Be}),N.viewportChangeStart(Be))},{passive:!1}):typeof U<"u"&&ue.on("wheel.zoom",function(X,Ne){const me=!k.value&&X.type==="wheel"&&!X.ctrlKey,Se=j.value||y.value,ve=f.value&&X.ctrlKey;if(!Se&&!c.value&&!ve&&X.type==="wheel"||me||ce(X,_.value))return null;X.preventDefault(),U.call(this,X,Ne)},{passive:!1})},{immediate:!0})});function ye(le,ae){return ae===2&&Array.isArray(le)&&le.includes(2)}function _e(le,ae){return le.x!==ae.x&&!Number.isNaN(ae.x)||le.y!==ae.y&&!Number.isNaN(ae.y)||le.zoom!==ae.k&&!Number.isNaN(ae.k)}function Re(le){return{x:le.x,y:le.y,zoom:le.k}}function ce(le,ae){return le.target.closest(`.${ae}`)}return(le,ae)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:S,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(jN,{"is-selecting":he.value,"selection-key-pressed":t.unref(z),class:t.normalizeClass({connecting:fe.value,dragging:t.unref(w),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(GN,null,{default:t.withCtx(()=>[t.renderSlot(le.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),WN=["id"],JN=["id"],XN=["id"],ZN={name:"A11yDescriptions",compatConfig:{MODE:3}},QN=t.defineComponent({...ZN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=qe();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(Em)}-${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,WN),t.createElementVNode("div",{id:`${t.unref(Nm)}-${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,JN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(N0)}-${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,XN))],64))}});function ew(){const e=qe();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function tw(e,n,o){return o===Me.Left?e-n:o===Me.Right?e+n:e}function nw(e,n,o){return o===Me.Top?e-n:o===Me.Bottom?e+n:e}const ts=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Me.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:tw(n,e,i),cy:nw(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ts.props=["radius","centerX","centerY","position","type"],ts.compatConfig={MODE:3};const gf=ts,ow=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:f,disableKeyboardA11y:y,elementsSelectable:k,edgesUpdatable:_,edgesFocusable:E,hooks:N}=qe(),p=t.computed(()=>u(e.id)),{emit:b,on:w}=Z0(p.value,r),A=t.inject(Fa),$=t.getCurrentInstance(),L=t.ref(!1),T=t.ref(!1),S=t.ref(""),C=t.ref(null),M=t.ref("source"),B=t.ref(null),g=t.toRef(()=>typeof p.value.selectable>"u"?k.value:p.value.selectable),I=t.toRef(()=>typeof p.value.updatable>"u"?_.value:p.value.updatable),v=t.toRef(()=>typeof p.value.focusable>"u"?E.value:p.value.focusable);t.provide(W0,e.id),t.provide(J0,B);const O=t.computed(()=>p.value.class instanceof Function?p.value.class(p.value):p.value.class),x=t.computed(()=>p.value.style instanceof Function?p.value.style(p.value):p.value.style),z=t.computed(()=>{const F=p.value.type||"default",H=A==null?void 0:A[`edge-${F}`];if(H)return H;let Z=p.value.template??c.value[F];if(typeof Z=="string"&&$){const X=Object.keys($.appContext.components);X&&X.includes(F)&&(Z=t.resolveComponent(F,!1))}return Z&&typeof Z!="string"?Z:(r.error(new ft(dt.EDGE_TYPE_MISSING,Z)),!1)}),{handlePointerDown:j}=of({nodeId:S,handleId:C,type:M,isValidConnection:h,edgeUpdaterType:M,onEdgeUpdate:pe,onEdgeUpdateEnd:he});return()=>{const F=m(p.value.source),H=m(p.value.target),Z="pathOptions"in p.value?p.value.pathOptions:{};if(!F&&!H)return r.error(new ft(dt.EDGE_SOURCE_TARGET_MISSING,p.value.id,p.value.source,p.value.target)),null;if(!F)return r.error(new ft(dt.EDGE_SOURCE_MISSING,p.value.id,p.value.source)),null;if(!H)return r.error(new ft(dt.EDGE_TARGET_MISSING,p.value.id,p.value.target)),null;if(!p.value||p.value.hidden||F.hidden||H.hidden)return null;let X;i.value===un.Strict?X=F.handleBounds.source:X=[...F.handleBounds.source||[],...F.handleBounds.target||[]];const Ne=Hm(X,p.value.sourceHandle);let me;i.value===un.Strict?me=H.handleBounds.target:me=[...H.handleBounds.target||[],...H.handleBounds.source||[]];const Se=Hm(me,p.value.targetHandle),ve=(Ne==null?void 0:Ne.position)||Me.Bottom,G=(Se==null?void 0:Se.position)||Me.Top,{x:q,y:Y}=Do(F,Ne,ve),{x:xe,y:Be}=Do(H,Se,G);return p.value.sourceX=q,p.value.sourceY=Y,p.value.targetX=xe,p.value.targetY=Be,t.h("g",{ref:B,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${z.value===!1?"default":p.value.type||"default"}`,s.value,O.value,{updating:L.value,selected:p.value.selected,animated:p.value.animated,inactive:!g.value&&!N.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":p.value.ariaLabel===null?void 0:p.value.ariaLabel??`Edge from ${p.value.source} to ${p.value.target}`,"aria-describedby":v.value?`${Nm}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...p.value.domAttributes,onClick:ye,onContextmenu:_e,onDblclick:Re,onMouseenter:ce,onMousemove:le,onMouseleave:ae,onKeyDown:v.value?U:void 0},[T.value?null:t.h(z.value===!1?c.value.default:z.value,{id:e.id,sourceNode:F,targetNode:H,source:p.value.source,target:p.value.target,type:p.value.type,updatable:I.value,selected:p.value.selected,animated:p.value.animated,label:p.value.label,labelStyle:p.value.labelStyle,labelShowBg:p.value.labelShowBg,labelBgStyle:p.value.labelBgStyle,labelBgPadding:p.value.labelBgPadding,labelBgBorderRadius:p.value.labelBgBorderRadius,data:p.value.data,events:{...p.value.events,...w},style:x.value,markerStart:`url('#${Ni(p.value.markerStart,n)}')`,markerEnd:`url('#${Ni(p.value.markerEnd,n)}')`,sourcePosition:ve,targetPosition:G,sourceX:q,sourceY:Y,targetX:xe,targetY:Be,sourceHandleId:p.value.sourceHandle,targetHandleId:p.value.targetHandle,interactionWidth:p.value.interactionWidth,...Z}),[I.value==="source"||I.value===!0?[t.h("g",{onMousedown:se,onMouseenter:ne,onMouseout:de},t.h(gf,{position:ve,centerX:q,centerY:Y,radius:a.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:ne,onMouseout:de},t.h(gf,{position:G,centerX:xe,centerY:Be,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ne(){L.value=!0}function de(){L.value=!1}function pe(F,H){b.update({event:F,edge:p.value,connection:H})}function he(F){b.updateEnd({event:F,edge:p.value}),T.value=!1}function fe(F,H){F.button===0&&(T.value=!0,S.value=H?p.value.target:p.value.source,C.value=(H?p.value.targetHandle:p.value.sourceHandle)??null,M.value=H?"target":"source",b.updateStart({event:F,edge:p.value}),j(F))}function ye(F){var H;const Z={event:F,edge:p.value};g.value&&(l.value=!1,p.value.selected&&f.value?(d([p.value]),(H=B.value)==null||H.blur()):o([p.value])),b.click(Z)}function _e(F){b.contextMenu({event:F,edge:p.value})}function Re(F){b.doubleClick({event:F,edge:p.value})}function ce(F){b.mouseEnter({event:F,edge:p.value})}function le(F){b.mouseMove({event:F,edge:p.value})}function ae(F){b.mouseLeave({event:F,edge:p.value})}function se(F){fe(F,!0)}function ue(F){fe(F,!1)}function U(F){var H;!y.value&&wm.includes(F.key)&&g.value&&(F.key==="Escape"?((H=B.value)==null||H.blur(),d([u(e.id)])):o([u(e.id)]))}}}),iw=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}=qe(),h=(e=t.inject(Fa))==null?void 0:e["connection-line"],f=t.computed(()=>{var N;return m((N=i.value)==null?void 0:N.nodeId)}),y=t.computed(()=>{var N;return m((N=a.value)==null?void 0:N.nodeId)??null}),k=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),_=t.computed(()=>c.value.markerStart?`url(#${Ni(c.value.markerStart,n)})`:""),E=t.computed(()=>c.value.markerEnd?`url(#${Ni(c.value.markerEnd,n)})`:"");return()=>{var N,p,b;if(!f.value||!i.value)return null;const w=i.value.id,A=i.value.type,$=f.value.handleBounds;let L=($==null?void 0:$[A])??[];if(o.value===un.Loose){const x=($==null?void 0:$[A==="source"?"target":"source"])??[];L=[...L,...x]}if(!L)return null;const T=(w?L.find(x=>x.id===w):L[0])??null,S=(T==null?void 0:T.position)??Me.Top,{x:C,y:M}=Do(f.value,T,S);let B=null;y.value&&(o.value===un.Strict?B=((N=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:N.find(x=>{var z;return x.id===((z=a.value)==null?void 0:z.id)}))||null:B=((p=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:p.find(x=>{var z;return x.id===((z=a.value)==null?void 0:z.id)}))||null);const g=((b=a.value)==null?void 0:b.position)??(S?Wl[S]:null);if(!S||!g)return null;const I=l.value??c.value.type??Xn.Bezier;let v="";const O={sourceX:C,sourceY:M,sourcePosition:S,targetX:k.value.x,targetY:k.value.y,targetPosition:g};return I===Xn.Bezier?[v]=uf(O):I===Xn.Step?[v]=es({...O,borderRadius:0}):I===Xn.SmoothStep?[v]=es(O):I===Xn.SimpleBezier?[v]=ff(O):v=`M${C},${M} ${k.value.x},${k.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:C,sourceY:M,sourcePosition:S,targetX:k.value.x,targetY:k.value.y,targetPosition:g,sourceNode:f.value,sourceHandle:T,targetNode:y.value,targetHandle:B,markerEnd:E.value,markerStart:_.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":E.value,"marker-start":_.value})))}}}),aw=["id","markerWidth","markerHeight","markerUnits","orient"],rw={name:"MarkerType",compatConfig:{MODE:3}},lw=t.defineComponent({...rw,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(zl).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(zl).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,aw))}}),sw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},cw={name:"MarkerDefinitions",compatConfig:{MODE:3}},dw=t.defineComponent({...cw,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=qe(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Ni(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",sw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(lw,{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))])]))}}),uw={name:"Edges",compatConfig:{MODE:3}},mw=t.defineComponent({...uw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=qe();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(dw),(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(O0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(ow),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(iw))],64))}}),fw=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:f,disableKeyboardA11y:y,ariaLiveMessage:k,snapToGrid:_,snapGrid:E,nodeDragThreshold:N,nodesDraggable:p,elementsSelectable:b,nodesConnectable:w,nodesFocusable:A,hooks:$}=qe(),L=t.ref(null);t.provide(tf,L),t.provide(ef,e.id);const T=t.inject(Fa),S=t.getCurrentInstance(),C=rf(),{node:M,parentNode:B}=af(e.id),{emit:g,on:I}=nN(M,l),v=t.toRef(()=>typeof M.draggable>"u"?p.value:M.draggable),O=t.toRef(()=>typeof M.selectable>"u"?b.value:M.selectable),x=t.toRef(()=>typeof M.connectable>"u"?w.value:M.connectable),z=t.toRef(()=>typeof M.focusable>"u"?A.value:M.focusable),j=t.computed(()=>O.value||v.value||$.value.nodeClick.hasListeners()||$.value.nodeDoubleClick.hasListeners()||$.value.nodeMouseEnter.hasListeners()||$.value.nodeMouseMove.hasListeners()||$.value.nodeMouseLeave.hasListeners()),ne=t.toRef(()=>!!M.dimensions.width&&!!M.dimensions.height),de=t.computed(()=>{const H=M.type||"default",Z=T==null?void 0:T[`node-${H}`];if(Z)return Z;let X=M.template||m.value[H];if(typeof X=="string"&&S){const Ne=Object.keys(S.appContext.components);Ne&&Ne.includes(H)&&(X=t.resolveComponent(H,!1))}return X&&typeof X!="string"?X:(l.error(new ft(dt.NODE_TYPE_MISSING,X)),!1)}),pe=nf({id:e.id,el:L,disabled:()=>!v.value,selectable:O,dragHandle:()=>M.dragHandle,onStart(H){g.dragStart(H)},onDrag(H){g.drag(H)},onStop(H){g.dragStop(H)},onClick(H){U(H)}}),he=t.computed(()=>M.class instanceof Function?M.class(M):M.class),fe=t.computed(()=>{const H=(M.style instanceof Function?M.style(M):M.style)||{},Z=M.width instanceof Function?M.width(M):M.width,X=M.height instanceof Function?M.height(M):M.height;return!H.width&&Z&&(H.width=typeof Z=="string"?Z:`${Z}px`),!H.height&&X&&(H.height=typeof X=="string"?X:`${X}px`),H}),ye=t.toRef(()=>Number(M.zIndex??fe.value.zIndex??0));return u(H=>{(H.includes(e.id)||!H.length)&&Re()}),t.onMounted(()=>{t.watch(()=>M.hidden,(H=!1,Z,X)=>{!H&&L.value&&(e.resizeObserver.observe(L.value),X(()=>{L.value&&e.resizeObserver.unobserve(L.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>M.type,()=>M.sourcePosition,()=>M.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])})}),t.watch([()=>M.position.x,()=>M.position.y,()=>{var H;return(H=B.value)==null?void 0:H.computedPosition.x},()=>{var H;return(H=B.value)==null?void 0:H.computedPosition.y},()=>{var H;return(H=B.value)==null?void 0:H.computedPosition.z},ye,()=>M.selected,()=>M.dimensions.height,()=>M.dimensions.width,()=>{var H;return(H=B.value)==null?void 0:H.dimensions.height},()=>{var H;return(H=B.value)==null?void 0:H.dimensions.width}],([H,Z,X,Ne,me,Se])=>{const ve={x:H,y:Z,z:Se+(f.value&&M.selected?1e3:0)};typeof X<"u"&&typeof Ne<"u"?M.computedPosition=$0({x:X,y:Ne,z:me},ve):M.computedPosition=ve},{flush:"post",immediate:!0}),t.watch([()=>M.extent,h],([H,Z],[X,Ne])=>{(H!==X||Z!==Ne)&&_e()}),M.extent==="parent"||typeof M.extent=="object"&&"range"in M.extent&&M.extent.range==="parent"?bl(()=>ne).toBe(!0).then(_e):_e(),()=>M.hidden?null:t.h("div",{ref:L,"data-id":M.id,class:["vue-flow__node",`vue-flow__node-${de.value===!1?"default":M.type||"default"}`,{[o.value]:v.value,dragging:pe==null?void 0:pe.value,draggable:v.value,selected:M.selected,selectable:O.value,parent:M.isParent},he.value],style:{visibility:ne.value?"visible":"hidden",zIndex:M.computedPosition.z??ye.value,transform:`translate(${M.computedPosition.x}px,${M.computedPosition.y}px)`,pointerEvents:j.value?"all":"none",...fe.value},tabIndex:z.value?0:void 0,role:z.value?"group":void 0,"aria-describedby":y.value?void 0:`${Em}-${n}`,"aria-label":M.ariaLabel,"aria-roledescription":"node",...M.domAttributes,onMouseenter:ce,onMousemove:le,onMouseleave:ae,onContextmenu:se,onClick:U,onDblclick:ue,onKeydown:F},[t.h(de.value===!1?m.value.default:de.value,{id:M.id,type:M.type,data:M.data,events:{...M.events,...I},selected:M.selected,resizing:M.resizing,dragging:pe.value,connectable:x.value,position:M.computedPosition,dimensions:M.dimensions,isValidTargetPos:M.isValidTargetPos,isValidSourcePos:M.isValidSourcePos,parent:M.parentNode,parentNodeId:M.parentNode,zIndex:M.computedPosition.z??ye.value,targetPosition:M.targetPosition,sourcePosition:M.sourcePosition,label:M.label,dragHandle:M.dragHandle,onUpdateNodeInternals:Re})]);function _e(){const H=M.computedPosition,{computedPosition:Z,position:X}=Gl(M,_.value?za(H,E.value):H,l.error,h.value,B.value);(M.computedPosition.x!==Z.x||M.computedPosition.y!==Z.y)&&(M.computedPosition={...M.computedPosition,...Z}),(M.position.x!==X.x||M.position.y!==X.y)&&(M.position=X)}function Re(){L.value&&d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])}function ce(H){pe!=null&&pe.value||g.mouseEnter({event:H,node:M})}function le(H){pe!=null&&pe.value||g.mouseMove({event:H,node:M})}function ae(H){pe!=null&&pe.value||g.mouseLeave({event:H,node:M})}function se(H){return g.contextMenu({event:H,node:M})}function ue(H){return g.doubleClick({event:H,node:M})}function U(H){O.value&&(!i.value||!v.value||N.value>0)&&Jl(M,r.value,c,s,a,!1,L.value),g.click({event:H,node:M})}function F(H){if(!(Fl(H)||y.value))if(wm.includes(H.key)&&O.value){const Z=H.key==="Escape";Jl(M,r.value,c,s,a,Z,L.value)}else v.value&&M.selected&&Vo[H.key]&&(H.preventDefault(),k.value=`Moved selected node ${H.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.position.x}, y: ${~~M.position.y}`,C({x:Vo[H.key].x,y:Vo[H.key].y},H.shiftKey))}}});function pw(e={includeHiddenNodes:!1}){const{nodes:n}=qe();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 hw={class:"vue-flow__nodes vue-flow__container"},yw={name:"Nodes",compatConfig:{MODE:3}},gw=t.defineComponent({...yw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=qe(),a=pw(),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",hw,[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 f=(t.openBlock(),t.createBlock(t.unref(fw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=h,f},s,0),128)):t.createCommentVNode("",!0)]))}});function bw(){const{emits:e}=qe();t.onMounted(()=>{if(qm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ft(dt.MISSING_STYLES))}})}const _w=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),kw={name:"VueFlow",compatConfig:{MODE:3}},Ew=t.defineComponent({...kw,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=_l(i,"modelValue",o),l=_l(i,"nodes",o),s=_l(i,"edges",o),c=qe(i),d=rN({modelValue:r,nodes:l,edges:s},i,c);return sN(o,c.hooks),ew(),bw(),t.provide(Fa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(qN,null,{default:t.withCtx(()=>[t.createVNode(mw),_w,t.createVNode(gw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(QN)],512))}}),Nw={name:"Panel",compatConfig:{MODE:3}},bf=t.defineComponent({...Nw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=qe(),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))}}),ww=["width","height","innerHTML"],Iw=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,ww))}}),We=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},$e=We(Iw,[["__scopeId","data-v-05aac699"]]),oo=["red","amber","green","teal","blue","indigo","violet","pink"],_f={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 vw(e){return typeof e=="string"&&e in _f}const Cw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},xw=.15;function Sw(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 Rw(e){if(typeof e!="string")return null;const n=Sw(e);if(!n||n.s<xw)return null;let o=null,i=1/0;for(const a of oo){const r=Math.abs(n.h-Cw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function bt(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(vw(n))return n;const o=e==null?void 0:e.properties;return Rw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function ns(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Aw={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)"},$w={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 kf(e,n=!1){return e?n?$w[e]:Aw[e]:null}function io(e){return _f[e]}function Oo(e){return`var(--em-swatch-${e}-bar)`}function Tw(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 Mw(e,n){const o=Tw(n);return o?e(o):n.split("-")[1]??n}function Vw(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 Ef(e,n){const o=Vw(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 Bw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Dw={class:"em-inline-issue__msgs"},ao=We(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",Dw,[(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(Ef)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Ow=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Lw={key:0,class:"em-mlang__dot"},Pw=["id","role","aria-labelledby"],zw=["title"],mn=We(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 E=o.defaultLang;return E&&o.languages.includes(E)?E:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const E=o.activeLang;return E&&o.languages.includes(E)?E:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(E){var N,p;return!!((p=(N=o.modelValue)==null?void 0:N[E])!=null&&p.trim())}const d=E=>`${o.name}-tab-${E}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function h(E){var b,w;const N=o.languages,p=N[(E+N.length)%N.length];p&&(l.value=p,await t.nextTick(),(w=(b=m.value)==null?void 0:b.querySelectorAll('[role="tab"]')[N.indexOf(p)])==null||w.focus())}function f(E){h(o.languages.indexOf(s.value)+E)}const y=t.computed(()=>o.languages.filter(E=>{var N,p;return E!==s.value&&!!((p=(N=o.modelValue)==null?void 0:N[E])!=null&&p.trim())})),k=t.computed(()=>{var E;return((E=o.modelValue)==null?void 0:E[s.value])??""});function _(E){const N={...o.modelValue};E.trim()===""?delete N[s.value]:N[s.value]=E,i("update:modelValue",N)}return(E,N)=>(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,p=>(t.openBlock(),t.createElementBlock("span",{id:d(p),key:p,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===p}]),role:"tab","aria-selected":s.value===p,"aria-controls":u.value,tabindex:s.value===p?0:-1,onClick:b=>l.value=p,onKeydown:[t.withKeys(t.withModifiers(b=>l.value=p,["prevent"]),["enter"]),t.withKeys(t.withModifiers(b=>l.value=p,["prevent"]),["space"]),N[0]||(N[0]=t.withKeys(t.withModifiers(b=>f(-1),["prevent"]),["left"])),N[1]||(N[1]=t.withKeys(t.withModifiers(b=>f(1),["prevent"]),["right"])),N[2]||(N[2]=t.withKeys(t.withModifiers(b=>h(0),["prevent"]),["home"])),N[3]||(N[3]=t.withKeys(t.withModifiers(b=>h(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(p),1),c(p)?(t.openBlock(),t.createElementBlock("span",Lw,"•")):t.createCommentVNode("",!0)],42,Ow))),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":k.value,"onUpdate:modelValue":_},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":k.value,"onUpdate:modelValue":_},null,8,["name","placeholder","model-value"]))],8,Pw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,zw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Fw=["disabled"],Uw={class:"em-panel__sub-label"},Hw={class:"em-field"},jw={class:"em-field"},Kw={class:"em-field"},Gw={class:"em-class"},Yw={class:"em-field"},qw={class:"em-field"},Ww={class:"em-field"},Jw={class:"em-field"},Xw={class:"em-multilang"},Zw={class:"em-multilang"},Qw={class:"em-jpa"},eI={class:"em-field"},tI={class:"em-field"},nI={class:"em-field"},oI=["title"],iI={class:"em-swatch"},aI={class:"em-swatch__row"},rI=["title"],lI=["title","onClick"],Nf=We(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(B=>B.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(B=>B.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var B;return bt(((B=l.value)==null?void 0:B.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=B=>B;function h(B){return B==="inherit"?a.t("em.common.inherit"):B}function f(B){r.value&&a.updateEntity(r.value.modelId,B)}function y(B,g,I){var O;const v=((O=r.value)==null?void 0:O.table)??{physicalName:""};f(B==="physicalName"?{table:{...v,physicalName:I}}:{table:{...v,logicalName:{...v.logicalName,[g]:I}}})}function k(B){f({description:Object.keys(B).length?B:void 0})}function _(B,g){var I;f({jpaAttrs:{...(I=r.value)==null?void 0:I.jpaAttrs,[B]:g}})}function E(B,g){_(B,g)}const N=t.computed(()=>{var B,g;return((g=(B=r.value)==null?void 0:B.jpaAttrs)==null?void 0:g.discriminatorType)??"inherit"}),p=t.computed(()=>{var B,g;return!((g=(B=r.value)==null?void 0:B.jpaAttrs)!=null&&g.useDiscriminator)});function b(B){_("discriminatorType",B==="inherit"?void 0:B)}function w(B){f({hasPersonalInfo:B})}function A(B){f({referenceOnly:B?!0:void 0})}function $(B){f({superClass:B.trim()||void 0})}function L(B){f({schema:B.trim()||void 0})}function T(B){f({abstractClass:B})}const S=t.computed(()=>{var B,g;return((g=(B=r.value)==null?void 0:B.declarationOfInterfaces)==null?void 0:g.join(", "))??""});function C(B){const g=B.split(",").map(I=>I.trim()).filter(Boolean);f({declarationOfInterfaces:g.length?g:void 0})}function M(B){r.value&&a.setEntitySwatch(r.value.modelId,B)}return(B,g)=>{var I,v,O;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:g[0]||(g[0]=x=>i("toggle"))},[t.createElementVNode("span",Uw,[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(ao,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Hw,[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":g[1]||(g[1]=x=>f({name:x}))},null,8,["model-value"])]),t.createElementVNode("label",jw,[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(Yo),"onUpdate:modelValue":g[2]||(g[2]=x=>f({stereotype:x}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Kw,[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":g[3]||(g[3]=x=>f({packageName:x}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Gw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Yw,[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":g[4]||(g[4]=x=>$(x))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",qw,[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":S.value,"onUpdate:modelValue":g[5]||(g[5]=x=>C(x))},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":g[6]||(g[6]=x=>T(x))},null,8,["label","model-value"])]),t.createElementVNode("label",Ww,[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":((I=r.value.table)==null?void 0:I.physicalName)??"","onUpdate:modelValue":g[7]||(g[7]=x=>y("physicalName",null,x))},null,8,["model-value"])]),t.createElementVNode("label",Jw,[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":g[8]||(g[8]=x=>L(x))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",Xw,[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,x=>{var z,j;return t.openBlock(),t.createElementBlock("label",{key:x,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(x),1),t.createVNode(t.unref(ee.BSTextInput),{name:`ent-logical-${x}`,width:"100%","model-value":((j=(z=r.value.table)==null?void 0:z.logicalName)==null?void 0:j[x])??"","onUpdate:modelValue":ne=>y("logicalName",x,ne)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",Zw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":k},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Qw,[g[13]||(g[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,x=>{var z;return t.createVNode(t.unref(ee.BSCheckbox),{key:x.key,name:`jpa-${x.key}`,class:"em-check",label:x.label,"model-value":!!((z=r.value.jpaAttrs)!=null&&z[x.key]),"onUpdate:modelValue":j=>E(x.key,j)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",eI,[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:p.value,"model-value":((v=r.value.jpaAttrs)==null?void 0:v.discriminatorColumnName)??"","onUpdate:modelValue":g[9]||(g[9]=x=>_("discriminatorColumnName",x.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",tI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(ee.BSSelect),{disabled:p.value,"model-value":N.value,items:u,"value-provider":m,"label-provider":h,"onUpdate:modelValue":g[10]||(g[10]=x=>x&&b(x))},null,8,["disabled","model-value"])]),t.createElementVNode("label",nI,[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:p.value,"model-value":(O=r.value.jpaAttrs)==null?void 0:O.discriminatorLength,"onUpdate:modelValue":g[11]||(g[11]=x=>_("discriminatorLength",x||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":w},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,oI),t.createElementVNode("fieldset",iI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",aI,[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:g[12]||(g[12]=x=>M(null))},"∅",10,rI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),x=>(t.openBlock(),t.createElementBlock("button",{key:x,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===x}]),style:t.normalizeStyle({background:t.unref(Oo)(x)}),title:t.unref(a).t(t.unref(io)(x)),onClick:z=>M(x)},null,14,lI))),128))])])],64)):t.createCommentVNode("",!0)],8,Fw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),sI=["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"],wf=["inherit","true","false"],Wa="__OWN__";function If(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,V){o.value&&e.updateAttribute(o.value.modelId,K.modelId,V)}function c(K){if(!o.value)return;const V=ko(e.state.logical,o.value.modelId,K.modelId);return V&&Gr(K,V)?V:void 0}function d(K){return!!c(K)}function u(K){return d(K)?K.derivedIdFieldName??"":K.name??""}function m(K){const V=c(K);if(!V)return e.t("em.attr.namePlaceholder");const W=new Map(e.state.logical.entities.map(Ce=>[Ce.modelId,Ce]));return Yr({...K,derivedIdFieldName:void 0},V,W)||e.t("em.attr.namePlaceholder")}function h(K,V){d(K)?s(K,{derivedIdFieldName:V||void 0}):s(K,{name:V})}function f(K){return!!o.value&&!!ko(e.state.logical,o.value.modelId,K.modelId)}function y(K,V){s(K,{naturalId:V||void 0,naturalIdMutable:V?K.naturalIdMutable:void 0})}function k(){return{naturalId:void 0,naturalIdMutable:void 0}}function _(K,V){s(K,{identifier:V,...V?k():{}})}function E(K,V){s(K,{transient:V||void 0,...V?k():{}})}function N(K){return!!K.transient||K.attrType==="RELATION_REF"}function p(K){return zi(K)}function b(K,V=0){var W;return((W=Fi(K,o.value,e.state.logical.entities,e.state.logical.associations,V))==null?void 0:W.physicalName)||void 0}const w=K=>K.value,A=K=>K.label;function $(K,V){if(!V)return;const W=v.value.find(Ce=>Ce.type===V);if(W){const Ce=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};s(K,{type:V,customType:void 0,dbAttrs:[{...Ce,dataType:W.dataType,length:W.length,scale:W.scale}]});return}s(K,V===an?{type:V}:{type:V,customType:void 0})}function L(K,V){s(K,{customType:V.trim()===""?void 0:V})}function T(K,V){if(K.attrType==="RELATION_REF")return;const Ce={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...V};V.dataType!==void 0&&!$r.has(Ce.dataType)&&(Ce.scale=void 0),s(K,{dbAttrs:[Ce]})}function S(K){var V;return $r.has(((V=K.dbAttrs[0])==null?void 0:V.dataType)??"")}function C(K){return!S(K)&&!p(K)&&!N(K)?e.t("em.attr.scaleTypeHint"):void 0}function M(K,V){T(K,{logicalName:Object.keys(V).length?V:void 0})}function B(K,V){s(K,{description:Object.keys(V).length?V:void 0})}function g(K){return K.personalInfoAttributeType??"none"}function I(K,V){s(K,{personalInfoAttributeType:V==="none"?void 0:V})}const v=t.computed(()=>e.predefinedCustomTypeCatalog.value),O=t.computed(()=>e.embeddableCatalog.value);function x(K){var V,W,Ce;return((V=K.label)==null?void 0:V[e.userLanguage.value])??((W=K.label)==null?void 0:W.ko)??((Ce=K.label)==null?void 0:Ce.en)??K.type}const z=t.computed(()=>e.groupCodeCatalog.value);function j(K){var V;return((V=z.value.find(W=>W.groupCode===K.groupCode))==null?void 0:V.codes)??[]}function ne(K){return["none",...j(K)]}function de(K){return K==="none"?"none":K.code}function pe(K){var W,Ce,ze;if(K==="none")return e.t("em.common.noneParen");const V=((W=K.label)==null?void 0:W[e.userLanguage.value])??((Ce=K.label)==null?void 0:Ce.ko)??((ze=K.label)==null?void 0:ze.en);return V?`${K.code} (${V})`:K.code}function he(K,V){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,V)}function fe(K,V){s(K,{defaultValue:V==="none"?void 0:V})}function ye(K,V){s(K,{defaultValue:V.trim()===""?void 0:V})}function _e(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}function Re(K,V,W){const Ce=K.dbAttrs.map((ze,Ie)=>{if(Ie!==V)return ze;const J={...ze,...W};for(const He of Object.keys(W))W[He]===void 0&&delete J[He];return J});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,Ce)}function ce(K,V,W){Re(K,V,{logicalName:Object.keys(W).length?W:void 0})}function le(K,V){var ze,Ie,J;if(K.attrType==="EMBED_PREDEF"){const He=(ze=e.embeddableCatalog.value.find(ot=>ot.type===K.type))==null?void 0:ze.fields[V];return He?{name:He.name,physicalName:He.physicalName,dataType:He.dataType,length:He.length,scale:He.scale,shareable:He.shareable,logicalName:He.logicalName}:void 0}const W=(Ie=K.embedded)==null?void 0:Ie.embeddableRef;if(!W)return;const Ce=(J=e.state.logical.entities.find(He=>He.modelId===W))==null?void 0:J.attributes.flatMap(He=>He.dbAttrs)[V];return Ce?{physicalName:Ce.physicalName,dataType:Ce.dataType,length:Ce.length,scale:Ce.scale,logicalName:Ce.logicalName}:void 0}function ae(K,V){var W,Ce;return((W=le(K,V))==null?void 0:W.dataType)||((Ce=K.dbAttrs[V])==null?void 0:Ce.dataType)||""}function se(K,V){var W,Ce;return((W=le(K,V))==null?void 0:W.length)??((Ce=K.dbAttrs[V])==null?void 0:Ce.length)}function ue(K,V){var W,Ce;return((W=le(K,V))==null?void 0:W.scale)??((Ce=K.dbAttrs[V])==null?void 0:Ce.scale)}const U=wf;function F(K){return K==="inherit"?e.t("em.common.inherit"):K}function H(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function Z(K,V,W){Re(K,V,{updatable:W==="inherit"?void 0:W==="true"})}function X(K,V){T(K,{updatable:V==="inherit"?void 0:V==="true"})}const Ne=wf;function me(K){return K==="inherit"?e.t("em.common.inherit"):K}function Se(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function ve(K,V,W){Re(K,V,{insertable:W==="inherit"?void 0:W==="true"})}function G(K,V){T(K,{insertable:V==="inherit"?void 0:V==="true"})}const q=t.computed(()=>o.value?Ir(o.value,e.state.logical.entities):[]),Y=t.computed(()=>fo(q.value.flatMap(K=>K.attributes.flatMap(V=>V.dbAttrs)))),xe=t.computed(()=>q.value.flatMap(K=>K.attributes.filter(V=>V.attrType==="NORMAL"&&V.dbAttrs.length===1&&V.dbAttrs[0]).map(V=>{var W;return{modelId:V.dbAttrs[0].modelId,physical:V.dbAttrs[0].physicalName||V.name,isCurrency:V.type==="Currency",ownerName:K.modelId===((W=o.value)==null?void 0:W.modelId)?void 0:K.name}})));function Be(){const K=[...xe.value].sort((V,W)=>Number(W.isCurrency)-Number(V.isCurrency));return[Wa,...K.map(V=>V.modelId)]}function Ve(K){if(K===Wa)return e.t("em.attr.sharedOwn");const V=xe.value.find(Ce=>Ce.modelId===K);if(!V)return K;const W=V.ownerName?`${V.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:W,physical:V.physical,mode:V.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function Le(K){return(K==null?void 0:K.sharedColumnRef)??Wa}function oe(K,V,W){Re(K,V,{sharedColumnRef:W===Wa?void 0:W})}function we(K){return(K==null?void 0:K.sharedColumnRef)!=null}function Fe(K){var V;return((V=Pn(K,Y.value))==null?void 0:V.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:sI,piiLabel:r,idn:l,setAttr:s,isDerivedIdRow:d,rowName:u,rowNamePlaceholder:m,setRowName:h,isManagedFk:f,setNaturalId:y,clearNaturalIdPatch:k,setIdentifier:_,setTransient:E,dbLocked:N,fkDerived:p,fkOriginPhysical:b,typeValueOf:w,typeLabelOf:A,setAttrType:$,setAttrCustomType:L,setDb:T,scaleApplicable:S,scaleHint:C,setDbLogical:M,setAttrDescription:B,attrPiiValue:g,setAttrPii:I,predefinedCustomTypeCatalog:v,embeddableCatalog:O,predefinedLabel:x,groupCodeCatalog:z,attrGroupCodes:j,attrCodeItems:ne,codeValueOf:de,codeLabelOf:pe,setAttrGroupCode:he,setAttrCode:fe,setAttrDefaultValue:ye,isEmbedExpanded:_e,setDbAt:Re,setDbLogicalAt:ce,embedColMeta:le,fixedDataType:ae,fixedLength:se,fixedScale:ue,updatableItems:U,updatableLabel:F,updatableValue:H,setUpdatableAt:Z,setUpdatable:X,insertableItems:Ne,insertableLabel:me,insertableValue:Se,setInsertableAt:ve,setInsertable:G,scopeEntities:q,columnsById:Y,sharedCandidates:xe,sharedItems:Be,sharedLabel:Ve,sharedValue:Le,setSharedAt:oe,isShared:we,sharedPhysical:Fe}}const vf={"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.derivedIdNote":"Scalar @Id field name for derived identity (@MapsId). Edit the association field name by clicking the relation; leave blank to derive from the parent PK column name.","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"},Cf={"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.derivedIdNote":"派生識別(@MapsId)のスカラー @Id フィールド名です。関連フィールド名は関連線をクリックして編集し、空欄にすると親 PK の物理名から派生します。","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":"未指定"},xf={"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.derivedIdNote":"파생 식별(@MapsId) 스칼라 @Id 필드명입니다. 연관 필드명은 관계선을 클릭해 편집하며, 비우면 부모 PK 물리명에서 파생됩니다.","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":"미지정"},cI=["ko","en","ja"],os={ko:xf,en:vf,ja:Cf};function Dt(e,n,o){let a=(os[e]??os.ko)[n]??os.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const Sf=["ko","en","ja","zh"];function dI(e){if(e)for(const n of Sf){const o=e[n];if(o)return o}}function is(e){const n=dI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function uI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Sf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const mI=["aria-expanded","placeholder"],fI=["aria-selected","onClick","onMouseenter"],pI={key:0,class:"gcc__opt gcc__opt--empty"},Rf=We(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(T,S)=>Dt(o.locale??"ko",T,S),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)),f=t.computed(()=>h.value?is(h.value):"");t.watch(f,T=>{d.value||(c.value=T)},{immediate:!0});const y=t.computed(()=>c.value===f.value?o.items:uI(o.items,c.value));function k(){var S;const T=(S=r.value)==null?void 0:S.getBoundingClientRect();T&&(m.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function _(){d.value=!0,k(),u.value=Math.max(0,y.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),document.addEventListener("mousedown",L)}function E(){d.value=!1,window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),document.removeEventListener("mousedown",L)}t.onBeforeUnmount(E);function N(){_(),t.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function p(){d.value||_(),u.value=0}function b(T){i("update:modelValue",T.groupCode),c.value=is(T),E()}function w(){i("update:modelValue",void 0),c.value="",E()}function A(){c.value.trim()===""?w():(c.value=f.value,E())}function $(T){var S;if(T.key==="ArrowDown")d.value||_(),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 C=y.value[u.value];C&&b(C),T.preventDefault()}else T.key==="Escape"&&(c.value=f.value,E(),(S=l.value)==null||S.blur())}function L(T){var C,M;const S=T.target;!((C=r.value)!=null&&C.contains(S))&&!((M=s.value)!=null&&M.contains(S))&&A()}return(T,S)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":S[0]||(S[0]=C=>c.value=C),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:N,onInput:p,onKeydown:$},null,40,mI),[[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:S[1]||(S[1]=t.withModifiers(()=>{},["prevent"])),onClick:w},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(C,M)=>(t.openBlock(),t.createElementBlock("li",{key:C.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":M===u.value,"is-selected":C.groupCode===e.modelValue}]),role:"option","aria-selected":C.groupCode===e.modelValue,onMousedown:S[2]||(S[2]=t.withModifiers(()=>{},["prevent"])),onClick:B=>b(C),onMouseenter:B=>u.value=M},t.toDisplayString(t.unref(is)(C)),43,fI))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",pI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),hI=["aria-labelledby"],yI=["aria-checked","tabindex","onClick","onKeydown"],Af=We(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,yI))),128))],8,hI))}}),[["__scopeId","data-v-5c793bbb"]]),gI=["disabled"],bI={class:"em-aw__toolbar"},_I={class:"em-aw__count"},kI={class:"em-aw__scroll"},EI={class:"em-aw__table"},NI={class:"c-name"},wI={class:"c-type"},II={class:"c-logical"},vI=["id"],CI={class:"c-col"},xI={class:"c-constraints"},SI={class:"c-del"},RI={class:"c-expand"},AI=["title","onClick","onKeydown"],$I=["title"],TI=["title"],MI={key:1,class:"em-aw__muted"},VI=["title"],BI=["title"],DI=["title"],OI={class:"em-aw__cflags"},LI=["title"],PI={colspan:"8"},zI={class:"em-aw__detail"},FI={class:"em-aw__dgroup"},UI=["title"],HI={class:"em-aw__df"},jI={class:"em-aw__df"},KI={class:"em-aw__dgroup"},GI={key:0,class:"em-aw__dgroup"},YI={class:"em-aw__df"},qI={key:0,class:"em-aw__df"},WI={class:"em-aw__df"},JI={class:"em-aw__dgroup em-aw__ddesc"},XI={class:"c-expand"},ZI={class:"em-aw__caret is-static","aria-hidden":"true"},QI={class:"c-del"},ev={class:"c-expand"},tv=["title","onClick","onKeydown"],nv={class:"em-aw__embed-label"},ov=["title"],iv=["title"],av={class:"em-aw__ro"},rv=["title"],lv={class:"em-aw__ro"},sv=["title"],cv={class:"em-aw__ro"},dv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},uv={colspan:"8"},mv={class:"em-aw__detail"},fv={class:"em-aw__dgroup"},pv={key:0,class:"em-aw__df"},hv={class:"em-aw__df"},yv={class:"em-aw__df"},gv={key:0},bv={colspan:"99",class:"em-aw__empty"},_v=6,kv=5,Ev=We(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,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:h,setRowName:f,isManagedFk:y,setNaturalId:k,setIdentifier:_,setTransient:E,dbLocked:N,fkDerived:p,fkOriginPhysical:b,typeValueOf:w,typeLabelOf:A,setAttrType:$,setAttrCustomType:L,setDb:T,scaleApplicable:S,scaleHint:C,setDbLogical:M,attrPiiValue:B,setAttrPii:g,predefinedCustomTypeCatalog:I,embeddableCatalog:v,predefinedLabel:O,groupCodeCatalog:x,attrGroupCodes:z,attrCodeItems:j,codeValueOf:ne,codeLabelOf:de,setAttrGroupCode:pe,setAttrCode:he,setAttrDefaultValue:fe,setAttrDescription:ye,isEmbedExpanded:_e,setDbAt:Re,setDbLogicalAt:ce,embedColMeta:le,fixedDataType:ae,fixedLength:se,fixedScale:ue,updatableItems:U,updatableLabel:F,updatableValue:H,setUpdatableAt:Z,setUpdatable:X,insertableItems:Ne,insertableLabel:me,insertableValue:Se,setInsertableAt:ve,setInsertable:G,sharedItems:q,sharedLabel:Y,sharedValue:xe,setSharedAt:Be,isShared:Ve,sharedPhysical:Le}=If(o,()=>n.entityId),oe=t.computed(()=>{var ze;return[...((ze=i.value)==null?void 0:ze.attributes)??[]].sort((Ie,J)=>Ie.order-J.order)}),we=t.computed(()=>{var ze;return(((ze=i.value)==null?void 0:ze.attributes)??[]).filter(Ie=>Ie.attrType!=="DIVIDER").length}),Fe=t.ref(new Set);function K(ze){return Fe.value.has(ze)}function V(ze){const Ie=new Set(Fe.value);Ie.has(ze)?Ie.delete(ze):Ie.add(ze),Fe.value=Ie}const W=t.ref(o.userLanguage.value);function Ce(ze){!ze||!i.value||o.addPredefinedEmbed(i.value.modelId,ze)}return(ze,Ie)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",bI,[t.createElementVNode("span",_I,t.toDisplayString(t.unref(o).t("em.attr.section",{n:we.value})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ie[0]||(Ie[0]=J=>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:Ie[1]||(Ie[1]=J=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(v).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(v),"value-provider":J=>J.type,"label-provider":t.unref(O),"onUpdate:modelValue":Ce},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",kI,[t.createElementVNode("table",EI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[Ie[3]||(Ie[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",NI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",wI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",II,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,vI),t.createVNode(Af,{modelValue:W.value,"onUpdate:modelValue":Ie[2]||(Ie[2]=J=>W.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",CI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),Ie[4]||(Ie[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),Ie[5]||(Ie[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",xI,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),Ie[6]||(Ie[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe.value,J=>{var He,ot,bn,Ue,Ge,Q,kt,_n,kn,St;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)}])},[Ie[7]||(Ie[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-divlabel-${J.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":J.name,"onUpdate:modelValue":ge=>t.unref(d)(J,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:_v,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",SI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,J.modelId)},null,8,["onClick"])])],2)):t.unref(_e)(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",XI,[t.createElementVNode("span",ZI,[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${J.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":J.name,"onUpdate:modelValue":ge=>t.unref(d)(J,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-type-${J.modelId}`,width:"100%",disabled:"","model-value":J.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:kv,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:J.dbAttrs.length})),1),t.createElementVNode("td",QI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>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,(ge,at)=>{var en,zt,tn,Ft,ke,lt,En,Nn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ge.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":K(ge.modelId)}])},[t.createElementVNode("td",ev,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":K(ge.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(K(ge.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:D=>V(ge.modelId),onKeydown:[t.withKeys(t.withModifiers(D=>V(ge.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(D=>V(ge.modelId),["prevent"]),["space"])]},[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,tv)]),t.createElementVNode("td",nv,"↳ "+t.toDisplayString(((en=t.unref(le)(J,at))==null?void 0:en.name)??((zt=t.unref(le)(J,at))==null?void 0:zt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:at+1})),1),Ie[14]||(Ie[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(mn,{name:`aw-embed-logical-${ge.modelId}`,languages:t.unref(o).languages.value,"active-lang":W.value,placeholder:((Ft=(tn=t.unref(le)(J,at))==null?void 0:tn.logicalName)==null?void 0:Ft[W.value])??((lt=(ke=t.unref(le)(J,at))==null?void 0:ke.logicalName)==null?void 0:lt.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ge.logicalName,"onUpdate:modelValue":D=>t.unref(ce)(J,at,D)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(Ve)(ge)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-embed-col-${ge.modelId}`,width:"100%",disabled:t.unref(Ve)(ge),placeholder:((En=t.unref(le)(J,at))==null?void 0:En.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Ve)(ge)?t.unref(Le)(ge):ge.physicalName,"onUpdate:modelValue":D=>t.unref(Re)(J,at,{physicalName:D})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(ao,{controller:t.unref(o),"ref-id":ge.modelId},null,8,["controller","ref-id"])],8,ov),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",av,t.toDisplayString(t.unref(ae)(J,at)),1)],8,iv),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",lv,t.toDisplayString(t.unref(se)(J,at)??""),1)],8,rv),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",cv,t.toDisplayString(t.unref(ue)(J,at)!=null?`scale ${t.unref(ue)(J,at)}`:""),1)],8,sv),Ie[15]||(Ie[15]=t.createElementVNode("td",null,null,-1))],2),K(ge.modelId)?(t.openBlock(),t.createElementBlock("tr",dv,[Ie[18]||(Ie[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",uv,[t.createElementVNode("div",mv,[t.createElementVNode("fieldset",fv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(Nn=t.unref(le)(J,at))!=null&&Nn.shareable?(t.openBlock(),t.createElementBlock("label",pv,[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(xe)(ge),items:t.unref(q)(),"value-provider":t.unref(c),"label-provider":t.unref(Y),"onUpdate:modelValue":D=>D&&t.unref(Be)(J,at,D)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",hv,[Ie[16]||(Ie[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(Ve)(ge),"model-value":t.unref(Ve)(ge)?"false":t.unref(Se)(ge),items:t.unref(Ne),"value-provider":t.unref(c),"label-provider":t.unref(me),"onUpdate:modelValue":D=>D&&t.unref(ve)(J,at,D)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",yv,[Ie[17]||(Ie[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(Ve)(ge),"model-value":t.unref(Ve)(ge)?"false":t.unref(H)(ge),items:t.unref(U),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":D=>D&&t.unref(Z)(J,at,D)},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":K(J.modelId)})},[t.createElementVNode("td",RI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":K(J.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(K(J.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>V(J.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>V(J.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>V(J.modelId),["prevent"]),["space"])]},[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,AI)]),t.createElementVNode("td",{title:t.unref(u)(J)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${J.modelId}`,width:"100%",placeholder:t.unref(h)(J),"model-value":t.unref(m)(J),"onUpdate:modelValue":ge=>t.unref(f)(J,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,$I),t.createElementVNode("td",{title:t.unref(p)(J)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.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(p)(J),items:t.unref(rc)(J.type,t.unref(I)),"value-provider":t.unref(w),"label-provider":t.unref(A),"model-value":J.type,"onUpdate:modelValue":ge=>t.unref($)(J,ge)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),J.type===t.unref(an)&&!t.unref(p)(J)?(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:0,name:`aw-customtype-${J.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":J.customType??"","onUpdate:modelValue":ge=>t.unref(L)(J,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,TI),t.createElementVNode("td",null,[J.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(mn,{key:0,name:`aw-logical-${J.modelId}`,languages:t.unref(o).languages.value,"active-lang":W.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(He=J.dbAttrs[0])==null?void 0:He.logicalName,"onUpdate:modelValue":ge=>t.unref(M)(J,ge)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",MI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-col-${J.modelId}`,width:"100%",placeholder:t.unref(b)(J)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(N)(J),"model-value":((ot=J.dbAttrs[0])==null?void 0:ot.physicalName)??"","onUpdate:modelValue":ge=>t.unref(T)(J,{physicalName:ge})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(ao,{controller:t.unref(o),"ref-id":(bn=J.dbAttrs[0])==null?void 0:bn.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(p)(J)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-dtype-${J.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(N)(J)||t.unref(p)(J),items:t.unref(oc)(((Ue=J.dbAttrs[0])==null?void 0:Ue.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Ar),"model-value":((Ge=J.dbAttrs[0])==null?void 0:Ge.dataType)??"","onUpdate:modelValue":ge=>ge&&t.unref(T)(J,{dataType:ge})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,VI),t.createElementVNode("td",{title:t.unref(p)(J)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-len-${J.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(N)(J)||t.unref(p)(J),"model-value":(Q=J.dbAttrs[0])==null?void 0:Q.length,"onUpdate:modelValue":ge=>t.unref(T)(J,{length:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,BI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(p)(J)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",OI,[t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-pk-${J.modelId}`,label:"PK","model-value":J.identifier,disabled:t.unref(a)||t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(_)(J,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nn-${J.modelId}`,label:"NN","model-value":J.notNull,disabled:t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(d)(J,{notNull:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-uq-${J.modelId}`,label:"UQ","model-value":!!((kt=J.dbAttrs[0])!=null&&kt.unique),disabled:t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(T)(J,{unique:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,DI),t.createElementVNode("td",{class:"c-del",title:t.unref(y)(J)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,J.modelId)},null,8,["onClick"])],8,LI)],2),K(J.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(J.modelId)}])},[Ie[13]||(Ie[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",PI,[t.createElementVNode("div",zI,[t.createElementVNode("fieldset",FI,[Ie[11]||(Ie[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(C)(J)},[Ie[8]||(Ie[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-scale-${J.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(N)(J)||t.unref(p)(J)||!t.unref(S)(J),"model-value":(_n=J.dbAttrs[0])==null?void 0:_n.scale,"onUpdate:modelValue":ge=>t.unref(T)(J,{scale:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,UI),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-ai-${J.modelId}`,label:"Auto Increment","model-value":!!((kn=J.dbAttrs[0])!=null&&kn.autoIncrement),disabled:t.unref(N)(J)||t.unref(p)(J)||!J.identifier,"onUpdate:modelValue":ge=>t.unref(T)(J,{autoIncrement:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",HI,[Ie[9]||(Ie[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-ins-${J.modelId}`,width:"110px",disabled:t.unref(N)(J),"model-value":t.unref(Se)(J.dbAttrs[0]),items:t.unref(Ne),"value-provider":t.unref(c),"label-provider":t.unref(me),"onUpdate:modelValue":ge=>ge&&t.unref(G)(J,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",jI,[Ie[10]||(Ie[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-upd-${J.modelId}`,width:"110px",disabled:t.unref(N)(J),"model-value":t.unref(H)(J.dbAttrs[0]),items:t.unref(U),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":ge=>ge&&t.unref(X)(J,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",KI,[Ie[12]||(Ie[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-tr-${J.modelId}`,label:"@Transient","model-value":!!J.transient,disabled:J.identifier||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(E)(J,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nid-${J.modelId}`,label:"@NaturalId","model-value":!!J.naturalId,disabled:J.identifier||t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(k)(J,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${J.modelId}`,label:"mutable","model-value":!!J.naturalIdMutable,disabled:t.unref(N)(J)||!J.naturalId,"onUpdate:modelValue":ge=>t.unref(d)(J,{naturalIdMutable:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-mv-${J.modelId}`,label:"Multi-Value (Set)","model-value":!!((St=J.dbAttrs[0])!=null&&St.multiValue),disabled:t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(T)(J,{multiValue:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(p)(J)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",GI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",YI,[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(B)(J),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":ge=>ge&&t.unref(g)(J,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(x).length?(t.openBlock(),t.createElementBlock("label",qI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Rf,{"model-value":J.groupCode,items:t.unref(x),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ge=>t.unref(pe)(J,ge)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",WI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(z)(J).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"150px","model-value":J.defaultValue??"none",items:t.unref(j)(J),"value-provider":t.unref(ne),"label-provider":t.unref(de),"onUpdate:modelValue":ge=>ge&&t.unref(he)(J,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`aw-default-${J.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":J.defaultValue??"","onUpdate:modelValue":ge=>t.unref(fe)(J,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",JI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(mn,{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":ge=>t.unref(ye)(J,ge)},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",gv,[t.createElementVNode("td",bv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,gI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-65126a6b"]]);function as(e,n){return n&&n!==e?`${e} (${n})`:e}function $f(e,n,o){const i=e.dbAttrs[n];return i?qo(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function Tf(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}):as(o,$f(e,0,n))}function Mf(e,n){var l;if(Ln(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?as(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 as(i,$f(o,r<0?0:r,n))}const Nv=["disabled"],wv={class:"em-idxw__list"},Iv={class:"em-idxw__list-head"},vv=["aria-label"],Cv=["aria-current","onClick","onKeydown"],xv={class:"em-idxw__item-name"},Sv={key:0,class:"em-idxw__badge"},Rv={class:"em-idxw__item-cnt"},Av={key:0,class:"em-idxw__empty"},$v={key:0,class:"em-idxw__edit"},Tv={class:"em-idxw__form"},Mv={class:"em-field em-idxw__name"},Vv={class:"em-field"},Bv=["value","placeholder"],Dv={class:"em-idxw__transfer"},Ov={class:"em-idxw__pane"},Lv={class:"em-idxw__pane-head"},Pv=["aria-label"],zv=["aria-pressed","onClick","onKeydown"],Fv=["title"],Uv={key:0,class:"em-idxw__empty"},Hv={class:"em-idxw__arrows"},jv={class:"em-idxw__pane"},Kv={class:"em-idxw__pane-head"},Gv={class:"em-idxw__col-name"},Yv=["title"],qv={class:"em-idxw__col-ops"},Wv=["title","disabled","onClick"],Jv=["title","disabled","onClick"],Xv=["title","onClick"],Zv={key:0,class:"em-idxw__empty"},Qv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},eC=We(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(g=>g.modelId===n.entityId)??null),a=t.computed(()=>{var g;return((g=i.value)==null?void 0:g.indexes)??[]}),r=t.computed(()=>{var g;return((g=i.value)==null?void 0:g.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,g=>{var I;g.some(v=>v.modelId===s.value)||(s.value=((I=g[0])==null?void 0:I.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(g=>g.modelId===s.value)??null),d=t.computed(()=>i.value?Go(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>On(r.value)),m=g=>u.value.canon(g),h=t.computed(()=>{var g;return new Set((((g=c.value)==null?void 0:g.columns)??[]).map(I=>m(I.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 y(g){return Tf(g,f.value)}function k(g){return g.physicalName&&g.physicalName!==g.field?`${g.field} (${g.physicalName})`:g.field}function _(g){return Mf(g,f.value)}const E=t.computed(()=>[...r.value.filter(g=>g.dbAttrs.length>0&&!h.value.has(m(g.modelId))).map(g=>({ref:g.modelId,label:y(g),inherited:!1})),...d.value.filter(g=>!h.value.has(m(g.modelId))).map(g=>({ref:g.modelId,label:k(g),inherited:!0}))]),N=t.ref(new Set);t.watch(s,()=>N.value=new Set);function p(g){return Ln(g)}function b(g,I){i.value&&o.updateIndex(i.value.modelId,g,I)}function w(){var I;if(!i.value)return;const g=De();o.addIndex(i.value.modelId,{modelId:g,name:`idx_${(((I=i.value.indexes)==null?void 0:I.length)??0)+1}`,unique:!1,columns:[]}),s.value=g}function A(g){i.value&&o.removeIndex(i.value.modelId,g)}function $(g){c.value&&b(c.value.modelId,{parameters:g.trim()===""?void 0:g})}function L(g){const I=new Set(N.value);I.has(g)?I.delete(g):I.add(g),N.value=I}function T(){const g=c.value;if(!g||!N.value.size)return;const I=[...N.value].map(v=>({columnRef:v,descending:!1}));b(g.modelId,{columns:[...g.columns,...I]}),N.value=new Set}function S(g){const I=c.value;I&&b(I.modelId,{columns:I.columns.filter((v,O)=>O!==g)})}function C(g,I){const v=c.value;v&&b(v.modelId,{columns:v.columns.map((O,x)=>x===g?{...O,descending:I}:O)})}function M(g,I){const v=c.value;if(!v)return;const O=g+I;if(O<0||O>=v.columns.length)return;const x=[...v.columns];[x[g],x[O]]=[x[O],x[g]],b(v.modelId,{columns:x}),B(O,I)}async function B(g,I){var j,ne;await t.nextTick();const v=(j=l.value)==null?void 0:j.querySelectorAll(".em-idxw__col--idx")[g];if(!v)return;const O=de=>v.querySelector(`[data-move="${de}"]`),x=O(I<0?"up":"down"),z=O(I<0?"down":"up");(ne=x&&!x.disabled?x:z)==null||ne.focus()}return(g,I)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",wv,[t.createElementVNode("div",Iv,[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:w},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:O=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(O=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",xv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",Sv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",Rv,t.toDisplayString(v.columns.length),1)],42,Cv))),128))],8,vv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Av,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",$v,[t.createElementVNode("div",Tv,[t.createElementVNode("label",Mv,[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":I[0]||(I[0]=v=>b(c.value.modelId,{name:v}))},null,8,["model-value"]),t.createVNode(ao,{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":I[1]||(I[1]=v=>b(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:I[2]||(I[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:I[3]||(I[3]=v=>$(v.target.value))},null,40,Bv)]),t.createElementVNode("div",Dv,[t.createElementVNode("div",Ov,[t.createElementVNode("div",Lv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:E.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:E.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":N.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":N.value.has(v.ref),onClick:O=>L(v.ref),onKeydown:[t.withKeys(t.withModifiers(O=>L(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>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,Fv)):t.createCommentVNode("",!0)],42,zv))),128))],8,Pv),E.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Uv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",Hv,[t.createVNode(t.unref(ee.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!N.value.size,onClick:T},null,8,["caption","disabled"])]),t.createElementVNode("div",jv,[t.createElementVNode("div",Kv,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,O)=>(t.openBlock(),t.createElementBlock("li",{key:O,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",Gv,[t.createTextVNode(t.toDisplayString(_(v.columnRef)),1),p(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,Yv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idxw-desc-${O}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":x=>C(O,x)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",qv,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:O===0,onClick:x=>M(O,-1)},"↑",8,Wv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:O===c.value.columns.length-1,onClick:x=>M(O,1)},"↓",8,Jv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:x=>S(O)},"✕",8,Xv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Zv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",Qv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,Nv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),tC={class:"em-op-src"},nC=["placeholder"],oC={class:"em-op-src__actions"},Vf=We(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",tC,[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,nC),[[t.vModelText,a.value]]),t.createElementVNode("div",oC,[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"]]),iC=["disabled"],aC={class:"em-ow__toolbar"},rC={class:"em-ow__count"},lC={class:"em-ow__scroll"},sC={class:"em-ow__table"},cC={class:"c-name"},dC={class:"c-desc"},uC=["id"],mC={class:"c-pii"},fC={class:"c-src"},pC={class:"c-del"},hC={key:0},yC={colspan:"6",class:"em-ow__empty"},gC=We(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(_=>_.modelId===n.entityId)??null),r=t.computed(()=>{var _;return[...((_=a.value)==null?void 0:_.operations)??[]].sort((E,N)=>E.order-N.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(_){return _==="none"?o.t("em.common.noneParen"):_}const u=_=>_;function m(_,E){a.value&&o.updateOperation(a.value.modelId,_.modelId,E)}function h(_,E){m(_,{description:Object.keys(E).length?E:void 0})}function f(_){return _.personalInfoAttributeType??"none"}function y(_,E){m(_,{personalInfoAttributeType:E==="none"?void 0:E})}function k(_){i.openModal({component:Vf,bind:{operationName:_.name,sourceCode:_.sourceCode??"",locale:o.uiLocale.value,onSave:E=>m(_,{sourceCode:E})}})}return(_,E)=>{var N,p;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",aC,[t.createElementVNode("span",rC,t.toDisplayString(t.unref(o).t("em.op.section",{n:((N=a.value.operations)==null?void 0:N.length)??0})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:E[0]||(E[0]=b=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",lC,[t.createElementVNode("table",sC,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",cC,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),E[2]||(E[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",dC,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,uC),t.createVNode(Af,{modelValue:l.value,"onUpdate:modelValue":E[1]||(E[1]=b=>l.value=b),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",mC,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",fC,t.toDisplayString(t.unref(o).t("em.op.body")),1),E[3]||(E[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,b=>(t.openBlock(),t.createElementBlock("tr",{key:b.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`ow-name-${b.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":b.name,"onUpdate:modelValue":w=>m(b,{name:w})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":b.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":w=>w&&m(b,{visibility:w})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(mn,{name:`ow-desc-${b.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":b.description,"onUpdate:modelValue":w=>h(b,w)},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(b),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":w=>w&&y(b,w)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t(b.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:w=>k(b)},null,8,["caption","onClick"])]),t.createElementVNode("td",pC,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeOperation(a.value.modelId,b.modelId)},null,8,["onClick"])])]))),128)),(p=a.value.operations)!=null&&p.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",hC,[t.createElementVNode("td",yC,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,iC)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),bC={class:"em-detail__tabs"},_C=["onClick"],kC={key:0,class:"em-detail__lock"},EC=["disabled"],NC={key:0,class:"em-detail__narrow"},wC=We(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",bC,[(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,_C)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",kC,[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",NC,[t.createVNode(Nf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(Ev,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(eC,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(gC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,EC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Ja(e,n,o){e.openModal({component:wC,bind:{controller:t.markRaw(n),entityId:o}})}function fn(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=>pd(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 Gd(l,r))i.push(ma(a,s.indexRef,{columns:s.columns}))}return i}function Xa(e,n,o,i){var c;const a=[];a.push(...fn(n,o.remove,i));for(const d of o.update)a.push(Kt(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(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,y)=>f.order-y.order)[0];h&&a.push(Tt(d.modelId,"end2",{attributeRef:h.modelId}))}return a}function Lo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function vi(e,n,o){const i=[];for(const[a,r]of Ic(e,n,De))i.push(...Xa(e,a,r,o));for(const a of Yd(e,n,De))i.push(Kt(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function IC(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Xr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return qd(e,n,r).map(l=>Kt(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function Bf(e,n,o){return Wd(e,n,o).map(i=>Kt(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function vC(e,n,o){const i=new Set(o.remove);return Lo(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 Za(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of vc(e,r,De)){const c=i.get(l);i.set(l,c?wc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...Xa(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 Df(e){return nn(e).map(n=>({...n.col,modelId:De()}))}function xC(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),h=new Set(o.attributes.map(y=>y.name));let f="id";for(let y=2;h.has(f);y++)f=`id${y}`;a={modelId:De(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:De(),physicalName:f.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 f=e.associations.find(E=>E.modelId===h.embedded.associationRef);if(!f)continue;const y=f.end1.entityRef===m.modelId,k=y?f.end1:f.end2,_=y?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:h.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:k.multiplicity,navigable:k.navigable,composition:!1},end2:{entityRef:n,multiplicity:_.multiplicity,navigable:_.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(f=>f.ownerId===m.modelId).map(f=>f.dispId));return h.size?{...m,attributes:m.attributes.filter(f=>!h.has(f.modelId))}:m}),associations:e.associations.map(m=>{const h=r.find(f=>f.assocId===m.modelId);return h?{...m,end1:h.end1,end2:h.end2}:m})},s=Xo(l,n,De);for(const m of r){const h=s.add.find(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===m.assocId});h&&(m.end2.attributeRef=h.modelId)}const c=[];for(const m of r)i.push(...fn(m.ownerId,[m.dispId],c)),i.push(ua(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Xa(l,n,s,c));const d=vC(l,n,s);return i.push(...vi(d,n,c)),i.push(...Ot(e,c)),i}function SC(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(p=>p.modelId===c);if(!d||d.attributes.some(p=>{var b;return((b=p.embedded)==null?void 0:b.associationRef)===r.modelId}))continue;const u=De(),m=Rt(d.attributes),h=new Set(d.attributes.map(p=>p.name)),f=a(o.name);let y=f;for(let p=2;h.has(y);p++)y=`${f}${p}`;const k=o.attributes.filter(p=>!p.identifier&&!p.derivedFrom).flatMap(p=>p.dbAttrs).map(p=>({...p,modelId:De()})),_={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:k,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(jt(c,_));const E=l?"end2":"end1",N=l?"end1":"end2";i.push(ua(r.modelId,{identifying:!1,[E]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:De()},[N]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Of(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=[dd(n,o),...i.map(u=>vo(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(f=>f.associationRef===m.modelId);h&&h.waypoints.length&&c.push(Cd(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const h=e.layout.notes.find(f=>f.modelId===m);h&&c.push(ii(m,{x:h.geo.location.x+l,y:h.geo.location.y+s}))}}return c}function RC(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=De(),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]},f=Xo(h,s,De),y=f.add[0];y&&(m.end2.attributeRef=y.modelId);const k={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},_=da(m,k),E=Xa(h,s,f,[]);return i(E.length?Qe("관계 추가",[_,...E]):_),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=De(),m=De(),h=De(),f=Rt(c.attributes),y=Df(d),k=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),_=new Set(c.attributes.map(A=>A.name)),E=k(d.name);let N=E;for(let A=2;_.has(N);A++)N=`${E}${A}`;const p={modelId:m,name:N,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},b={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}},w={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(Qe("임베드 추가",[jt(l,p),da(b,w)])),u},setEmbedCardinality(l,s){var E;if(r(l))return;const c=n.logical.associations.find(N=>N.modelId===l);if(!c)return;let d,u;for(const N of n.logical.entities){const p=N.attributes.find(b=>{var w;return((w=b.embedded)==null?void 0:w.associationRef)===l&&b.attrType==="EMBED_OWN"});if(p){d=N.modelId,u=p;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,h=c.end2.entityRef===m?"end2":"end1",f=c[h];if(f.multiplicity===s)return;const y=N=>N==="ZERO_OR_MORE_INSTANCES"||N==="ONE_OR_MORE_INSTANCES",k=y(f.multiplicity),_=y(s);if(k===_){i(Tt(l,h,{multiplicity:s}));return}if(_)i(Qe("임베드 컬렉션 전환",[Kt(d,u.modelId,{dbAttrs:[]}),Tt(l,h,{multiplicity:s,jpa:{...f.jpa,collectionType:((E=f.jpa)==null?void 0:E.collectionType)??"LIST"}})]));else{const N=n.logical.entities.find(p=>p.modelId===m);if(!N)return;i(Qe("임베드 단일 전환",[Kt(d,u.modelId,{dbAttrs:Df(N)}),Tt(l,h,{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=Ed(l);if(!s){i(c);return}for(const f of n.logical.entities){const y=f.attributes.find(k=>{var _;return((_=k.embedded)==null?void 0:_.associationRef)===l});if(y){const k=[];i(Qe("임베드 삭제",[c,...fn(f.modelId,[y.modelId],k),...Ot(n.logical,k)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],h=Za(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(k=>k.modelId===s.end1.entityRef),y=f==null?void 0:f.attributes.find(k=>k.modelId===s.end1.attributeRef&&k.attrType==="RELATION_REF");y&&h.push(...fn(f.modelId,[y.modelId],m))}h.push(...Ot(n.logical,m)),i(h.length?Qe("관계 삭제",[c,...h]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=ua(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=[],f=Za(m,[u],h);f.push(...Ot(n.logical,h)),i(f.length?Qe("식별 관계 변경",[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),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 f=Ki(d.end2.multiplicity),y=d.end1.navFieldNameHint||Yi(m.name,f),k=ho(y,new Set(u.attributes.map(p=>p.name))),_=De(),E=Rt(u.attributes),N={modelId:_,name:k,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:E,dbAttrs:[]};i(Qe("inverse nav 추가",[jt(d.end1.entityRef,N),Tt(l,"end1",{...c,attributeRef:_,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,y=u.attributes.find(N=>N.modelId===f&&N.attrType==="RELATION_REF"),k=Tt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),_=[],E=y?fn(d.end1.entityRef,[f],_):[];i(y?Qe("inverse nav 제거",[...E,k,...Ot(n.logical,_)]):k);return}}}i(Tt(l,s,c))}}}function AC(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 f=Kt(u,m,h),y=Lo(n.logical,u,E=>E.map(N=>N.modelId===m?{...N,...h}:N)),k=[],_=vi(y,u,k);_.push(...Ot(n.logical,k)),i(_.length?Qe("속성 수정",[f,..._]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const h=r.value.find(N=>N.type===m),f=n.logical.entities.find(N=>N.modelId===u);if(!h||!f)return null;const y=Rt(f.attributes),k=De(),_=h.fields.map(()=>({modelId:De(),physicalName:"",dataType:""})),E={modelId:k,name:h.defaultName,type:h.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:_};return i(jt(u,E)),k},addAttribute(u,m={}){if(!o.value||a(u))return null;const h=n.logical.entities.find(w=>w.modelId===u),f=h?Rt(h.attributes):0,y=m.modelId??De(),k=m.name??`field${f}`,_={modelId:y,name:k,type:m.type??Tr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:De(),physicalName:k,dataType:"VARCHAR"}],...m},E=jt(u,_),N=Lo(n.logical,u,w=>[...w,_]),p=[],b=vi(N,u,p);return b.push(...Ot(n.logical,p)),i(b.length?Qe("속성 추가",[E,...b]):E),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(k=>k.modelId===u),h=m?Rt(m.attributes):0,f=De();return i(jt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:h,dbAttrs:[]})),f},updateAttribute(u,m,h){d(u,m,h)},setAttributeGroupCode(u,m,h){d(u,m,{groupCode:h,type:h?zn:Tr})},setEmbedColumns(u,m,h){var N,p;if(a(u))return;const f=Kt(u,m,{dbAttrs:h}),y=(N=n.logical.entities.find(b=>b.modelId===u))==null?void 0:N.attributes.find(b=>b.modelId===m),k=(p=y==null?void 0:y.embedded)==null?void 0:p.associationRef,_=k?n.logical.associations.find(b=>b.modelId===k):void 0,E=[];_&&k&&(_.end1.legacyEmbedRaw&&E.push(Tt(k,"end1",{legacyEmbedRaw:void 0})),_.end2.legacyEmbedRaw&&E.push(Tt(k,"end2",{legacyEmbedRaw:void 0}))),i(E.length?Qe("임베드 컬럼 수정",[f,...E]):f)},removeAttribute(u,m){if(a(u))return;if(ko(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const h=[],f=fn(u,[m],h),y=Lo(n.logical,u,E=>E.filter(N=>N.modelId!==m)),k=[...vi(y,u,h),...Ot(n.logical,h),...Bf(n.logical,u,[m])],_=[...f,...k];i(_.length===1?_[0]:Qe("속성 삭제",_))},removeAttributes(u,m){var N;if(!m.length||a(u))return;const h=m.filter(p=>!ko(n.logical,u,p));if(h.length<m.length&&s(l("em.attr.fkDeleteHint")),!h.length)return;const f=[],y=fn(u,h,f),k=new Set(h),_=Lo(n.logical,u,p=>p.filter(b=>!k.has(b.modelId))),E=[...y,...vi(_,u,f),...Ot(n.logical,f),...Bf(n.logical,u,h)];i(E.length===1?E[0]:Qe("속성 삭제",E)),((N=c.value)==null?void 0:N.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,h){i(la(u,m,h))},setAttributeSwatches(u,m,h){m.length&&(m.length===1?i(la(u,m[0],h)):i(Qe("속성 색상",m.map(f=>la(u,f,h)))))},reorderAttributes(u,m,h){if(!m.length||a(u))return;const f=sl(u,m,h),y=IC(n.logical,u,m,h);i(y.length?Qe("속성 재정렬",[f,...y]):f)}}}function $C(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=De(),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=De();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=De()}for(const a of n.indexes??[]){a.modelId=De();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=De();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const TC=220;function MC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||TC));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 rs=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function VC(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const k=c.filter(_=>n.logical.entities.some(E=>E.modelId===_));if(k.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:k}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const k=n.logical.entities.find(E=>E.modelId===d.entityId);if(!k)return;const _=[...k.attributes].sort((E,N)=>E.order-N.order).filter(E=>d.ids.includes(E.modelId));if(!_.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:_}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(k=>k.modelId===u),h=n.layout.entityLayouts.find(k=>k.entityRef===u);if(!m)return;const f=(h==null?void 0:h.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(h){const{entityRef:k,geo:_,locked:E,...N}=h;Object.keys(N).length&&(y=N)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,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 f=a.value;if(!f)return[];const y=n.logical.entities.find(b=>b.modelId===f);if(!y)return[];const k=new Set(y.attributes.map(b=>b.name)),_=new Set(y.attributes.flatMap(b=>b.dbAttrs.map(w=>w.physicalName))),E=Rt(y.attributes),N=[],p=c.attributes.map((b,w)=>{const A=JSON.parse(JSON.stringify(b));A.modelId=De();for(const $ of A.dbAttrs)$.modelId=De();k.has(A.name)&&(A.name=ho(`${A.name}_copy`,k)),k.add(A.name);for(const $ of A.dbAttrs)$.physicalName&&_.has($.physicalName)&&($.physicalName=ho(`${$.physicalName}_copy`,_)),$.physicalName&&_.add($.physicalName);return A.order=E+w,N.push(A.modelId),jt(f,A)});return l(p.length===1?p[0]:Qe("속성 붙여넣기",p)),i.value={kind:"attribute",entityId:f,ids:N,anchor:N[N.length-1]},[]}const{clone:d,idMap:u}=$C(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 f={...c.layoutExtras},y=k=>u.get(k);f.attributeStyles&&(f.attributeStyles=oa(f.attributeStyles,y)),f.operationStyles&&(f.operationStyles=oa(f.operationStyles,y)),h=f}return l(ra(d,m,h)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Gc(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",f=h==="append-right"?MC(n.layout,m.layout):h.offset,y=new Map(m.layout.entityLayouts.map(p=>[p.entityRef,p])),k=new Map(m.layout.associationLayouts.map(p=>[p.associationRef,p])),_=new Map(m.layout.groupLayouts.map(p=>[p.groupRef,p])),E=[];let N=80;for(const p of m.logical.entities){const b=y.get(p.modelId),w=b?{location:rs(b.geo.location,f),size:{...b.geo.size}}:{location:{x:N+=40,y:80},size:{width:220,height:140}};let A;if(b){const{entityRef:$,geo:L,locked:T,...S}=b;A=S}E.push(ra(p,w,A))}for(const p of m.logical.associations){const b=k.get(p.modelId),w=b?{...b,waypoints:b.waypoints.map(A=>rs(A,f))}:{associationRef:p.modelId,waypoints:[]};E.push(da(p,w))}for(const p of m.logical.groups){const b=_.get(p.modelId),w=b?{location:rs(b.geo.location,f),size:{...b.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(b){const{groupRef:$,geo:L,locked:T,memberNoteRefs:S,...C}=b;A=C}E.push(sa(p,w,A))}return l(Qe("다이어그램 가져오기",E)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(p=>p.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=De(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:De(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:De(),physicalName:"id",dataType:"BIGINT"}]}]};return i(ra(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(nd(s,c))},updateEntity(s,c){if(a(s))return;const d=td(s,c),u=n.logical.entities.find(f=>f.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 f=u.attributes.filter(p=>p.identifier&&!p.derivedFrom).map(p=>Kt(s,p.modelId,{identifier:!1})),y=Lo({...n.logical,entities:n.logical.entities.map(p=>p.modelId===s?{...p,stereotype:"JPA_EMBEDDABLE"}:p)},s,p=>p.map(b=>b.identifier&&!b.derivedFrom?{...b,identifier:!1}:b)),k=[],_=Za(y,[s],k);_.push(...Ot(n.logical,k));const E=SC(n.logical,s),N=[d,...f,..._,...E];i(N.length>1?Qe("임베더블 변환",N):d);return}if(h){const f=xC(n.logical,s),y=[d,...f];i(y.length>1?Qe("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(vo(s,c))},resizeEntity(s,c){a(s)||i(od(s,c))},removeEntity(s){if(a(s))return;const c=ed(s);if(!n.logical.entities.find(_=>_.modelId===s)){i(c);return}const u=n.logical.associations.filter(_=>_.end1.entityRef===s||_.end2.entityRef===s),m=new Set(u.map(_=>_.modelId)),h=[],f=[];for(const _ of n.logical.entities)if(_.modelId!==s)for(const E of _.attributes)E.embedded&&m.has(E.embedded.associationRef)&&h.push(...fn(_.modelId,[E.modelId],f));for(const _ of u){if(_.end1.entityRef===s||!_.end1.attributeRef)continue;const E=n.logical.entities.find(p=>p.modelId===_.end1.entityRef),N=E==null?void 0:E.attributes.find(p=>p.modelId===_.end1.attributeRef&&p.attrType==="RELATION_REF");N&&h.push(...fn(E.modelId,[N.modelId],f))}const y={...n.logical,entities:n.logical.entities.filter(_=>_.modelId!==s),associations:n.logical.associations.filter(_=>!m.has(_.modelId))},k=new Set(u.filter(_=>_.end1.entityRef===s&&_.end2.entityRef!==s).map(_=>_.end2.entityRef));h.push(...Za(y,[...k],f)),h.push(...Ot(n.logical,f.filter(_=>_.entityId!==s))),i(h.length?Qe("엔티티 삭제",[c,...h]):c)},setEntitySwatch(s,c){i(id(s,c))},setEntityCollapsed(s,c){i(ad(s,c))},setEntityLocked(s,c){i(rd(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(ll(!0))},expandAll(){i(ll(!1))}}}function DC(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(E=>n.layout.entityLayouts.find(N=>N.entityRef===E)).filter(E=>!!E);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,h=1/0,f=-1/0,y=-1/0;for(const E of u){const N=E.geo.size.width||220,p=E.geo.size.height||140;m=Math.min(m,E.geo.location.x),h=Math.min(h,E.geo.location.y),f=Math.max(f,E.geo.location.x+N),y=Math.max(y,E.geo.location.y+p)}const k=40,_=28;return{location:{x:m-k,y:h-k-_},size:{width:f-m+k*2,height:y-h+k*2+_}}}return{dragGroup(d,u,m){l(d)||i(Qe("그룹 이동",Of(n,d,u,m)))},resizeGroup(d,u){l(d)||i(ud(d,u))},setGroupSwatch(d,u){i(md(d,u))},setGroupLocked(d,u){i(fd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(ld(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const k of d)y.memberEntityRefs.includes(k)&&m.push(ca(y.modelId,k));const h=De(),f={modelId:h,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(sa(f,c(d))),i(Qe("그룹 생성",m)),a.value=null,h},addEmptyGroup(d,u){if(!o.value)return null;const m=De();return i(sa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(sd(d))},dropEntity(d,u,m){var y;if(r(d))return;const h=((y=n.logical.groups.find(k=>k.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,f=[vo(d,u)];h!==m&&(h&&f.push(ca(h,d)),m&&f.push(cd(m,d))),i(Qe("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(ca(u.modelId,d))},dropNote(d,u,m){var y;const h=((y=n.layout.groupLayouts.find(k=>{var _;return(_=k.memberNoteRefs)==null?void 0:_.includes(d)}))==null?void 0:y.groupRef)??null,f=[ii(d,u)];h!==m&&(h&&f.push(Bd(h,d)),m&&f.push(Vd(m,d))),i(Qe("이동",f))}}}function OC(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(k,_){if(d(),!o.value||!e.opTransport)return;const E=new Hd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:N=>{i.value=!1,a.value=N},onError:e.onOpError});E.seed((_==null?void 0:_.revSeed)??{}),c=E.attach(k),s=E}const m=t.computed(()=>o.value&&r!==void 0),h=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function y(k){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let _;try{_=await l(k)}catch(E){return{ok:!1,reason:E instanceof Error?E.message:String(E)}}return _.ok&&h.value++,_}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:y,reloadRequest:h}}function LC(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=De();return o(Rd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(Ad(i))},moveNote(i,a){o(ii(i,a))},resizeNote(i,a){o($d(i,a))},setNoteMemo(i,a){o(Td(i,a))},setNoteSwatch(i,a){o(Md(i,a))},addNoteConnection(i,a){o(Dd(i,a))},removeNoteConnection(i,a){o(Od(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Ld(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Pd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(zd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Fd(i,a))}}}function PC(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,f=(h==null?void 0:h.kind)==="attribute"&&h.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const b=h.ids.includes(u),w=b?h.ids.filter($=>$!==u):[...h.ids,u];if(!w.length){o.value=null;return}const A=b&&h.anchor===u?w[w.length-1]:b?h.anchor:u;o.value={kind:"attribute",entityId:d,ids:w,anchor:A};return}const y=n.logical.entities.find(b=>b.modelId===d),k=[...(y==null?void 0:y.attributes)??[]].sort((b,w)=>b.order-w.order).map(b=>b.modelId),_=k.indexOf(h.anchor),E=k.indexOf(u);if(_<0||E<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[N,p]=_<=E?[_,E]:[E,_];o.value={kind:"attribute",entityId:d,ids:k.slice(N,p+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(k=>k.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const h=m.attributes.findIndex(k=>k.modelId===u.anchor);if(h<0)return!1;const f=Math.min(Math.max(h+d,0),m.attributes.length-1);if(f===h)return!0;const y=m.attributes[f].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(b=>b.modelId===u.entityId);if(!m)return!1;const h=m.attributes,f=new Set(u.ids),y=h.map((b,w)=>f.has(b.modelId)?w:-1).filter(b=>b>=0);if(!y.length)return!1;const k=Math.min(...y),_=h.filter(b=>!f.has(b.modelId)),E=h.slice(0,k).filter(b=>!f.has(b.modelId)).length;let N;if(d<0){if(E<=0)return!0;N=E-1}else{if(_.length-E<=0)return!0;N=E+1}if(r(u.entityId))return!0;const p=h.filter(b=>f.has(b.modelId)).map(b=>b.modelId);return a(sl(u.entityId,p,N)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const h=new Set(n.logical.entities.map(N=>N.modelId)),f=new Set(n.logical.groups.map(N=>N.modelId)),y=new Set(n.layout.notes.map(N=>N.modelId)),k=new Set;for(const N of d){if(!f.has(N))continue;const p=n.logical.groups.find(b=>b.modelId===N);for(const b of(p==null?void 0:p.memberEntityRefs)??[])k.add(b)}const _=[],E=[];for(const N of d)if(f.has(N)){if(s(N))continue;const p=n.layout.groupLayouts.find($=>$.groupRef===N);if(!p)continue;const b=n.logical.groups.find($=>$.modelId===N),w=((b==null?void 0:b.memberEntityRefs)??[]).map($=>{var T;const L=((T=n.layout.entityLayouts.find(S=>S.entityRef===$))==null?void 0:T.geo.location)??{x:0,y:0};return{id:$,location:{x:L.x+u,y:L.y+m}}}),A={x:p.geo.location.x+u,y:p.geo.location.y+m};_.push(Qe("그룹 이동",Of(n,N,A,w))),E.push("g:"+N)}else if(h.has(N)){if(k.has(N)||l(N))continue;const p=n.layout.entityLayouts.find(b=>b.entityRef===N);if(!p)continue;_.push(vo(N,{x:p.geo.location.x+u,y:p.geo.location.y+m})),E.push("e:"+N)}else if(y.has(N)){const p=n.layout.notes.find(b=>b.modelId===N);if(!p)continue;_.push(ii(N,{x:p.geo.location.x+u,y:p.geo.location.y+m})),E.push("n:"+N)}return _.length?(a(Qe("이동",_,"nudge:"+E.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const ro=Symbol("editorController");function Lf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function zC(e=Lf(),n={}){var we,Fe,K;const o=t.reactive(e);let i=new rl(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=(V,W)=>Dt(u.value,V,W),h=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),k=t.ref(n.flagEntitiesWithoutRelations??!1),_=t.ref(!1),E=t.ref(!1),N=t.ref(!1),p=t.ref(0),b=t.ref(null);let w=0;const A=V=>{if(n.onNotice){n.onNotice(V);return}b.value={text:V,id:++w}},$=t.ref(((we=n.meta)==null?void 0:we.schemaVersion)??1),L=t.ref(((Fe=n.meta)==null?void 0:Fe.opWriteEnabled)??!1),T=t.ref(((K=n.meta)==null?void 0:K.referenceOnly)??!1),S=t.computed(()=>$.value>=2&&L.value),C=t.ref(!($.value>=2&&L.value===!1)),M=t.ref("LOGICAL_PHYSICAL"),B=t.ref("straight"),g=t.ref(!0),I=t.ref(!0),v=t.ref(null),O=t.computed(()=>{var V;return((V=v.value)==null?void 0:V.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),x=t.computed(()=>{var V;return((V=v.value)==null?void 0:V.kind)==="attribute"?v.value.ids:[]}),z=t.computed(()=>{var V,W;return((V=v.value)==null?void 0:V.kind)==="entity"?v.value.id:((W=v.value)==null?void 0:W.kind)==="attribute"?v.value.entityId:null}),j=t.ref(null),ne=t.ref(null),de=t.ref(null),pe=t.ref(null),he=OC({state:o,opMode:S,editable:C,opConflict:de,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function fe(){i.onChange(()=>{_.value=i.canUndo,E.value=i.canRedo,N.value=i.isDirty,p.value++})}fe(),he.setupOpAdapter(i,n.meta);const ye=t.computed(()=>Vs(o.logical,o.layout)),_e=t.computed(()=>({reservedWords:h.value,selectableDataTypes:f.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:k.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Re=()=>Cr(o.logical,T.value),ce=n.validationDebounceMs??250;let le,ae=()=>{};if(ce>0){const V=t.shallowRef(Qi(Re(),_e.value));let W;ae=()=>{W!==void 0&&(clearTimeout(W),W=void 0),V.value=Qi(Re(),_e.value)},t.watch([p,_e,T],()=>{W!==void 0&&clearTimeout(W),W=setTimeout(ae,ce)},{flush:"sync"}),le=t.computed(()=>V.value)}else le=t.computed(()=>Qi(Re(),_e.value));const se=t.computed(()=>{const V=new Map;for(const W of le.value){if(!W.targetRef)continue;const Ce=V.get(W.targetRef);Ce?Ce.push(W):V.set(W.targetRef,[W])}return V}),ue=1500,U=new Map,F=V=>{const W=Date.now();W-(U.get(V)??0)<ue||(U.set(V,W),A(V))},H=V=>{if(!pe.value){if(!C.value){F(m("em.notice.readOnly"));return}try{i.execute(V)}catch(W){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${V.label}):`,W),C.value=!1,pe.value={label:V.label}}}},Z=V=>o.layout.entityLayouts.some(W=>W.entityRef===V&&!!W.locked),X=V=>o.layout.groupLayouts.some(W=>W.groupRef===V&&!!W.locked),Ne=V=>{const W=o.logical.associations.find(Ce=>Ce.modelId===V);return!!W&&(Z(W.end1.entityRef)||Z(W.end2.entityRef))},me=V=>Z(V)?(F(m("em.notice.entityLocked")),!0):!1,Se=V=>X(V)?(F(m("em.notice.groupLocked")),!0):!1,ve=V=>Ne(V)?(F(m("em.notice.assocLocked")),!0):!1,G=VC({state:o,clipboard:ne,selection:v,inspectedEntityId:z,editable:C,run:H}),q=PC({state:o,selection:v,focusRequest:j,run:H,gateEntityLocked:me,isEntityLockedFn:Z,isGroupLockedFn:X}),Y=BC({state:o,editable:C,run:H,gateEntityLocked:me,isEntityLockedFn:Z,isAssocLockedFn:Ne}),xe=AC({state:o,editable:C,run:H,gateEntityLocked:me,embeddableCatalog:a,t:m,emitGateNotice:F,selection:v}),Be=DC({state:o,editable:C,run:H,selection:v,gateEntityLocked:me,gateGroupLocked:Se,isGroupLockedFn:X}),Ve=LC({editable:C,run:H}),Le=RC({state:o,editable:C,run:H,gateEntityLocked:me,gateAssocLocked:ve});return{state:o,resolved:ye,issues:le,issuesByRef:se,flagEntitiesWithoutRelations:k,canUndo:_,canRedo:E,dirty:N,revision:p,notice:b,editable:C,schemaVersion:$,opWriteEnabled:L,opMode:S,opConflict:de,commandFailure:pe,historyTransport:he.historyTransport,historyAvailable:he.historyAvailable,restoreTransport:he.restoreTransport,restoreAvailable:he.restoreAvailable,restoreToSeq:he.restoreToSeq,reloadRequest:he.reloadRequest,displayMode:M,routingMode:B,showGrid:g,showMinimap:I,selection:v,selectedAttr:O,selectedAttrIds:x,inspectedEntityId:z,focusRequest:j,clipboard:ne,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:T,uiLocale:u,t:m,selectableDataTypes:f,setEditable(V){C.value=V&&S.value},setEmbeddableCatalog(V){a.value=V},setGroupCodeCatalog(V){r.value=V},setPredefinedCustomTypeCatalog(V){l.value=V},setSuperClassCatalog(V){s.value=V},selectAttribute:q.selectAttribute,moveAttributeFocus:q.moveAttributeFocus,nudgeSelectedAttributes:q.nudgeSelectedAttributes,nudgeNodes:q.nudgeNodes,requestFocus:q.requestFocus,deleteSelection(){if(!C.value)return!1;const V=v.value;if(!V)return!1;if(V.kind==="attribute"){if(me(V.entityId))return!1;const W=V.ids;if(!W.length)return!1;W.length===1?xe.removeAttribute(V.entityId,W[0]):xe.removeAttributes(V.entityId,W)}else if(V.kind==="entity"){if(me(V.id))return!1;Y.removeEntity(V.id)}else if(V.kind==="note")Ve.removeNote(V.id);else if(V.kind==="group"){if(Se(V.id))return!1;Be.removeGroup(V.id)}else Le.removeAssociation(V.id);return v.value=null,!0},undo:()=>{C.value&&i.undo()},redo:()=>{C.value&&i.redo()},markSaved:()=>{C.value&&(he.flush(),i.markSavePoint())},loadDiagram(V,W){he.teardownOpAdapter(),o.logical=V.logical,o.layout=V.layout,i=new rl(o),fe(),$.value=(W==null?void 0:W.schemaVersion)??1,L.value=(W==null?void 0:W.opWriteEnabled)??!1,T.value=(W==null?void 0:W.referenceOnly)??!1,C.value=!($.value>=2&&L.value===!1),de.value=null,pe.value=null,v.value=null,_.value=i.canUndo,E.value=i.canRedo,N.value=i.isDirty,he.setupOpAdapter(i,W),ae()},flush:he.flush,whenOpsSettled:he.whenOpsSettled,addEntity:Y.addEntity,renameEntity:Y.renameEntity,updateEntity:Y.updateEntity,moveEntity:Y.moveEntity,resizeEntity:Y.resizeEntity,removeEntity:Y.removeEntity,setEntitySwatch:Y.setEntitySwatch,setEntityCollapsed:Y.setEntityCollapsed,setEntityLocked:Y.setEntityLocked,isEntityLocked:Y.isEntityLocked,isAssociationLocked:Y.isAssociationLocked,collapseAll:Y.collapseAll,expandAll:Y.expandAll,setAttributeSwatch:xe.setAttributeSwatch,dragGroup:Be.dragGroup,resizeGroup:Be.resizeGroup,setGroupSwatch:Be.setGroupSwatch,setGroupLocked:Be.setGroupLocked,isGroupLocked:Be.isGroupLocked,updateGroup:Be.updateGroup,createGroup:Be.createGroup,addEmptyGroup:Be.addEmptyGroup,removeGroup:Be.removeGroup,dropEntity:Be.dropEntity,ungroupEntity:Be.ungroupEntity,dropNote:Be.dropNote,addPredefinedEmbed:xe.addPredefinedEmbed,addAttribute:xe.addAttribute,addDivider:xe.addDivider,updateAttribute:xe.updateAttribute,setAttributeGroupCode:xe.setAttributeGroupCode,setEmbedColumns:xe.setEmbedColumns,removeAttribute:xe.removeAttribute,removeAttributes:xe.removeAttributes,setAttributeSwatches:xe.setAttributeSwatches,reorderAttributes:xe.reorderAttributes,addIndex(V,W){me(V)||H(Nd(V,W))},updateIndex(V,W,Ce){me(V)||H(ma(V,W,Ce))},removeIndex(V,W){me(V)||H(wd(V,W))},addOperation(V,W={}){if(!C.value||me(V))return null;const Ce=o.logical.entities.find(He=>He.modelId===V),ze=Ce!=null&&Ce.operations?Rt(Ce.operations):0,Ie=W.modelId??De(),J={modelId:Ie,name:W.name??`method${ze}`,visibility:W.visibility??"PACKAGE",order:ze,...W};return H(yd(V,J)),Ie},updateOperation(V,W,Ce){me(V)||H(gd(V,W,Ce))},removeOperation(V,W){me(V)||H(bd(V,W))},reorderOperations(V,W,Ce){!W.length||me(V)||H(_d(V,W,Ce))},setOperationSwatch(V,W,Ce){H(kd(V,W,Ce))},addAssociation:Le.addAssociation,addEmbedAssociation:Le.addEmbedAssociation,setEmbedCardinality:Le.setEmbedCardinality,removeAssociation:Le.removeAssociation,setAssociationIdentifying:Le.setAssociationIdentifying,updateAssociationEnd:Le.updateAssociationEnd,hasQuickFix(V){if(!C.value)return!1;const W=jr(V,o.logical);return W?W.kind==="setEndCascades"?!Ne(W.assocRef):!Z(W.entityRef):!1},applyQuickFix(V){if(!C.value)return!1;const W=jr(V,o.logical);if(!W)return!1;if(W.kind==="setIndexColumns")return me(W.entityRef)?!1:(H(ma(W.entityRef,W.indexRef,{columns:W.columns})),!0);if(ve(W.assocRef))return!1;const Ce=o.logical.associations.find(ze=>ze.modelId===W.assocRef);return Ce?(H(Tt(W.assocRef,W.which,{jpa:{...Ce[W.which].jpa,cascadeTypes:W.cascades}})),!0):!1},moveWaypoint(V,W,Ce){H(Id(V,W,Ce))},addWaypoint(V,W,Ce){H(Sd(V,W,Ce))},removeWaypoint(V,W){H(vd(V,W))},clearWaypoints(V){H(xd(V))},addNote:Ve.addNote,removeNote:Ve.removeNote,moveNote:Ve.moveNote,resizeNote:Ve.resizeNote,setNoteMemo:Ve.setNoteMemo,setNoteSwatch:Ve.setNoteSwatch,addNoteConnection:Ve.addNoteConnection,removeNoteConnection:Ve.removeNoteConnection,moveNoteConnectionWaypoint:Ve.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:Ve.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:Ve.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:Ve.clearNoteConnectionWaypoints,autoLayout(){const V=Bs(o.logical,o.layout);V.length&&H(Qe("자동 배치",V.map(W=>vo(W.id,W.location))))},copy:G.copy,paste:G.paste,importEntities:G.importEntities}}const Qa=Symbol("groupHover"),Pf=Symbol("groupDrag"),Po=Symbol("relationHighlight"),zf=Symbol("diffOverlay"),Ff=Symbol("nodeInternals"),Uf=Symbol("columnResolution");function FC(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 Hf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!FC(e[o],n[o]))return!1;return!0}function UC(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(!Hf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function HC(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function jC(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||!HC(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!UC(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Hf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function KC(){let e;return(n,o)=>e=GC(n,o,e)}function GC(e,n,o){const i=e.entities,a=new Map;let r=null;const l=()=>r??(r=new Map(i.map(s=>[s.modelId,s])));for(const s of i){const c=new Map,d=new Map,u=new Map;let m=null;const h=()=>m??(m=fo(vn(s,i)));for(const E of s.attributes){if(zi(E)){const w=E.dbAttrs[0];if(!(w!=null&&w.physicalName&&(w!=null&&w.dataType))){const A=Fi(E,s,i,e.associations);A&&c.set(E.modelId,{...E,dbAttrs:[{...w,physicalName:(w==null?void 0:w.physicalName)||A.physicalName,dataType:(w==null?void 0:w.dataType)||A.dataType,length:(w==null?void 0:w.length)??A.length,scale:(w==null?void 0:w.scale)??A.scale},...E.dbAttrs.slice(1)]})}}if(E.identifier&&E.attrType==="RELATION_OWN"){const w=ko(e,s.modelId,E.modelId);if(w&&Gr(E,w)){const A=c.get(E.modelId)??E,$=E.derivedIdFieldName||Yr({...E,derivedIdFieldName:void 0},w,l());$&&c.set(E.modelId,{...A,derivedIdFieldName:$})}}const N=Mr(E,e.associations);if(N&&u.set(E.modelId,N),!E.attrType.startsWith("EMBED")||E.dbAttrs.length===0)continue;if(E.attrType!=="EMBED_PREDEF"){const w=h();d.set(E.modelId,E.dbAttrs.map((A,$)=>{const L=Pn(A,w);return L?{...A,physicalName:L.physicalName}:on(E,A,$,s,e)}));continue}const p=n==null?void 0:n.find(w=>w.type===E.type);if(!p)continue;const b=h();d.set(E.modelId,E.dbAttrs.map((w,A)=>{const $=p.fields[A],L=Pn(w,b);return L?{...w,physicalName:L.physicalName,logicalName:w.logicalName??($==null?void 0:$.logicalName),dataType:w.dataType||($==null?void 0:$.dataType)||""}:$?{...w,physicalName:w.physicalName||$.physicalName,logicalName:w.logicalName??$.logicalName,dataType:w.dataType||$.dataType,length:w.length??$.length}:w}))}const f=new Map,y=new Map;for(const E of s.attributes){const N=d.get(E.modelId);if(N)for(let p=0;p<N.length;p++){const b=`${E.attrType}\0${E.type??""}\0${p}`,w={attrId:E.modelId,slot:p,name:N[p].physicalName??""},A=y.get(b);A?A.push(w):y.set(b,[w])}}for(const E of y.values()){if(E.length<2)continue;const N=new Map;for(const p of E)N.set(p.name,(N.get(p.name)??0)+1);for(const p of E){if((N.get(p.name)??0)<2)continue;const b=f.get(p.attrId);b?b.add(p.slot):f.set(p.attrId,new Set([p.slot]))}}const k={effectiveAttrs:c,embedCols:d,collectionTypes:u,redundantSlots:f},_=o==null?void 0:o.get(s.modelId);a.set(s.modelId,_&&jC(k,_)?_:k)}return a}const jf=Symbol("embedSlotCollapse"),Kf=(e,n)=>`${e}:${n}`,Gf="all:",Yf="one:",qf=e=>`${Gf}${e}`,Wf=(e,n)=>`${Yf}${e}:${n}`,YC=e=>!e.startsWith(Gf)&&!e.startsWith(Yf),qC=["title"],WC={key:0,class:"em-sel","aria-hidden":"true"},JC=["title","aria-expanded","disabled"],XC={class:"em-entity__stereotype"},ZC={key:1,class:"em-entity__name"},QC=["title","aria-expanded"],ex={"aria-hidden":"true"},tx=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],nx=["onPointerdown"],ox={key:1,class:"em-entity__divider-label"},ix=["title"],ax={class:"em-key-slot"},rx={class:"em-key-slot"},lx=["title","aria-expanded","onClick"],sx=["title","onClick"],cx=["title","aria-expanded","onClick"],dx={key:2,class:"em-entity__type"},ux=["onClick"],mx={class:"em-entity__attrname"},fx={class:"em-entity__type"},px={key:1,class:"em-entity__embed-summary"},hx=["title"],yx=["data-op"],gx=["onPointerdown"],bx={class:"em-entity__op-vis","aria-hidden":"true"},_x=["title"],kx={key:4,class:"em-entity__footer"},Jf=We(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(ro,null),i=(R,P)=>o?o.t(R,P):Dt("ko",R,P),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=ee.useModal();function l(){o&&Ja(r,o,n.id)}const s=t.inject(Qa,null),c=t.inject(Po,null),d=t.inject(zf,null),u=t.computed(()=>{var R;return((R=d==null?void 0:d.marks.value)==null?void 0:R.get(n.id))??null}),m=t.inject(Uf,null),h=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(jf,void 0),y=t.inject(Ff,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const k=t.computed(()=>!!o&&o.editable.value);function _(){s&&(s.value=n.data.groupRef??null)}function E(){c==null||c.setEntityHover(n.id)}function N(){c==null||c.setEntityHover(null)}const p=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),b=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!p.value),w=t.computed(()=>{var R;return((R=o==null?void 0:o.selection.value)==null?void 0:R.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!w.value),$=t.computed(()=>{var R;return o&&((R=o.selectedAttr.value)==null?void 0:R.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),L=t.computed(()=>$.value.size>0);function T(R,P){const te=P.shiftKey?"range":P.metaKey||P.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,R.modelId,te)}const S=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!w.value),C=t.computed(()=>n.data.entity),M=t.computed(()=>Hh(C.value,o==null?void 0:o.referenceOnlyDocument.value)),B=t.computed(()=>[...C.value.attributes].sort((R,P)=>R.order-P.order)),g=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),I=t.computed(()=>n.data.collapsed??!1),v=t.computed(()=>n.data.locked??!1),O=t.computed(()=>k.value&&!v.value);function x(){k.value&&(o==null||o.setEntityCollapsed(n.id,!I.value))}const z=t.computed(()=>g.value==="PHYSICAL"||g.value==="LOGICAL_PHYSICAL"),j=t.computed(()=>{const R=g.value==="PHYSICAL"||g.value==="LOGICAL_PHYSICAL",P={};for(const te of B.value){const Ee=te.attrType.startsWith("RELATION")&&te.dbAttrs.length>0;P[te.modelId]={pk:te.identifier,fk:Ee&&R,required:te.notNull&&!te.identifier}}return P});function ne(R){if(!R)return"";const P=[];return R.pk&&R.fk?P.push(i("em.node.keyPfk")):R.pk?P.push(i("em.node.keyPk")):R.fk&&P.push(i("em.node.keyFk")),R.required&&P.push(i("em.node.required")),P.join(" · ")}const de=t.computed(()=>{const R=ns(bt(n.data.style)),P={};return R&&(P["--em-header-bg"]=R.bar,P["--em-header-fg"]=R.barOn),P});function pe(R){var P,te;return(te=ns(bt((P=n.data.attributeStyles)==null?void 0:P[R.modelId])))==null?void 0:te.text}const he=t.computed(()=>[...C.value.operations??[]].sort((R,P)=>R.order-P.order)),fe=t.computed(()=>g.value==="CLASS"&&he.value.length>0),ye={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function _e(R){return R?ye[R]:"~"}function Re(R){var P,te;return(te=ns(bt((P=n.data.operationStyles)==null?void 0:P[R.modelId])))==null?void 0:te.text}function ce(R,P,te){switch(g.value){case"CLASS":return[{text:R}];case"PHYSICAL":return[{text:te||R}];case"LOGICAL":return[P?{text:P}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const Ee=P?{text:P}:{text:i("em.node.logicalMissing"),missing:!0};return te?[Ee,{text:` · ${te}`}]:[Ee]}}}function le(R){var P;return((P=h.value)==null?void 0:P.effectiveAttrs.get(R.modelId))??R}function ae(R){var te,Ee,ie;if(ue(R))return[{text:R.name}];const P=le(R);return ce(se(R),(Ee=(te=P.dbAttrs[0])==null?void 0:te.logicalName)==null?void 0:Ee[a.value],((ie=P.dbAttrs[0])==null?void 0:ie.physicalName)??"")}function se(R){return le(R).derivedIdFieldName||R.name}function ue(R){return R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0}function U(R){return R.attrType==="DIVIDER"}function F(R){var P;return((P=h.value)==null?void 0:P.embedCols.get(R.modelId))??R.dbAttrs}function H(R){var P;return(P=h.value)==null?void 0:P.redundantSlots.get(R.modelId)}const Z=t.computed(()=>(f==null?void 0:f.isCollapsed(qf(n.id)))??!1),X=t.computed(()=>Z.value&&z.value?B.value.reduce((R,P)=>ue(P)?R+F(P).length:R,0):0),Ne=t.computed(()=>B.value.some(R=>ue(R)));function me(R){const P=H(R);return!P||P.size===0?!1:f?f.isCollapsed(Kf(n.id,R.modelId)):!1}function Se(R){var P;return me(R)?((P=H(R))==null?void 0:P.size)??0:0}function ve(R){return f?f.isCollapsed(Wf(n.id,R.modelId)):!1}function G(R){var P;return!z.value||Z.value?null:ve(R)?"attr":(((P=H(R))==null?void 0:P.size)??0)>0?"slot":null}function q(R){return!Z.value&&ue(R)}function Y(R){return ve(R)?F(R).length:0}function xe(R){if(Z.value||ve(R))return[];const P=F(R);if(!me(R))return P;const te=H(R);return P.filter((Ee,ie)=>!te.has(ie))}function Be(R){f==null||f.toggle(Kf(n.id,R.modelId))}function Ve(R){f==null||f.toggle(Wf(n.id,R.modelId))}function Le(){f==null||f.toggle(qf(n.id))}function oe(R){var P;return ce(R.physicalName,(P=R.logicalName)==null?void 0:P[a.value],R.physicalName)}function we(R){var te;const P=(te=h.value)==null?void 0:te.collectionTypes.get(R.modelId);return Vr(g.value,le(R),P)}const Fe=t.computed(()=>{const R={};for(const P of B.value)R[P.modelId]=we(P);return R}),K=t.computed(()=>{var R,P,te;return ce(C.value.name,(P=(R=C.value.table)==null?void 0:R.logicalName)==null?void 0:P[a.value],((te=C.value.table)==null?void 0:te.physicalName)??"")}),V=t.ref(!1),W=t.ref(""),Ce=t.ref(null);async function ze(){var R,P;O.value&&(W.value=C.value.name,V.value=!0,await t.nextTick(),(R=Ce.value)==null||R.focus(),(P=Ce.value)==null||P.select())}function Ie(){if(!V.value)return;V.value=!1;const R=W.value.trim();R&&R!==C.value.name&&(o==null||o.renameEntity(n.id,R))}function J(){o==null||o.addAttribute(n.id)}function He(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:ot,findNode:bn}=qe(),Ue=t.ref(null),Ge=t.computed(()=>{const R=Ue.value??n.data.size;return R?{width:`${R.width}px`,minHeight:`${R.height}px`}:void 0});let Q=null;function kt(R){var Ee,ie,re;if(!O.value)return;R.stopPropagation();const P=(Ee=bn(n.id))==null?void 0:Ee.dimensions,te=ot({x:R.clientX,y:R.clientY});Q={fx:te.x,fy:te.y,w:(P==null?void 0:P.width)??((ie=n.data.size)==null?void 0:ie.width)??200,h:(P==null?void 0:P.height)??((re=n.data.size)==null?void 0:re.height)??120},R.target.setPointerCapture(R.pointerId)}function _n(R){if(!Q)return;const P=ot({x:R.clientX,y:R.clientY});Ue.value={width:Math.max(40,Q.w+(P.x-Q.fx)),height:Math.max(40,Q.h+(P.y-Q.fy))}}function kn(R){var P,te,Ee;if(Q&&Ue.value&&o){const ie=(P=bn(n.id))==null?void 0:P.dimensions;o.resizeEntity(n.id,{width:Math.round((ie==null?void 0:ie.width)??Ue.value.width),height:Math.round((ie==null?void 0:ie.height)??Ue.value.height)})}Q=null,Ue.value=null,(Ee=(te=R.target).releasePointerCapture)==null||Ee.call(te,R.pointerId)}const St=t.ref(null),ge=t.ref(null);function at(R,P){if(!O.value)return;P.stopPropagation(),P.preventDefault();const te=$.value,Ee=te.has(R.modelId)?new Set(te):new Set([R.modelId]);ge.value={ids:Ee,dropIndex:-1,lineY:0},P.target.setPointerCapture(P.pointerId)}function en(R){if(!ge.value||!St.value)return;const P=Array.from(St.value.querySelectorAll(".em-entity__row"));if(!P.length)return;let te=P.length;for(let re=0;re<P.length;re++){const Te=P[re].getBoundingClientRect();if(R.clientY<Te.top+Te.height/2){te=re;break}}const Ee=P[P.length-1],ie=te<P.length?P[te].offsetTop:Ee.offsetTop+Ee.offsetHeight;ge.value={...ge.value,dropIndex:te,lineY:ie}}function zt(){const R=ge.value;if(ge.value=null,!R||R.dropIndex<0)return;const P=B.value,te=P.filter(Oe=>R.ids.has(Oe.modelId)).map(Oe=>Oe.modelId),Ee=P.filter((Oe,je)=>R.ids.has(Oe.modelId)&&je<R.dropIndex).length,ie=R.dropIndex-Ee,re=P.filter(Oe=>!R.ids.has(Oe.modelId)).map(Oe=>Oe.modelId);[...re.slice(0,ie),...te,...re.slice(ie)].join(",")!==P.map(Oe=>Oe.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,te,ie))}function tn(){ge.value=null}const Ft=t.ref(null),ke=t.ref(null);function lt(R,P){O.value&&(P.stopPropagation(),P.preventDefault(),ke.value={id:R.modelId,dropIndex:-1,lineY:0},P.target.setPointerCapture(P.pointerId))}function En(R){if(!ke.value||!Ft.value)return;const P=Array.from(Ft.value.querySelectorAll(".em-entity__op-row"));if(!P.length)return;let te=P.length;for(let re=0;re<P.length;re++){const Te=P[re].getBoundingClientRect();if(R.clientY<Te.top+Te.height/2){te=re;break}}const Ee=P[P.length-1],ie=te<P.length?P[te].offsetTop:Ee.offsetTop+Ee.offsetHeight;ke.value={...ke.value,dropIndex:te,lineY:ie}}function Nn(){const R=ke.value;if(ke.value=null,!R||R.dropIndex<0)return;const te=he.value.findIndex(ie=>ie.modelId===R.id);if(te<0)return;const Ee=R.dropIndex-(te<R.dropIndex?1:0);Ee!==te&&(o==null||o.reorderOperations(n.id,[R.id],Ee))}function D(){ke.value=null}return(R,P)=>{var te,Ee;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":p.value,"is-related":b.value,"is-dimmed":S.value,"is-selected":w.value,"is-multi-selected":A.value,"has-focused-attr":L.value,"is-locked":v.value,"is-reference-only":M.value,"is-diff-added":((te=u.value)==null?void 0:te.verb)==="added","is-diff-modified":((Ee=u.value)==null?void 0:Ee.verb)==="modified"}]),tabindex:"-1",title:M.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(Ge.value),onPointerdown:_,onMouseenter:E,onMouseleave:N,onDblclick:l},[w.value?(t.openBlock(),t.createElementBlock("div",WC,[...P[11]||(P[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(de.value),onDblclick:t.withModifiers(ze,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(I.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!I.value,disabled:!k.value,onClick:t.withModifiers(x,["stop"]),onPointerdown:P[0]||(P[0]=t.withModifiers(()=>{},["stop"])),onDblclick:P[1]||(P[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(I.value?"▸":"▾"),41,JC),t.createElementVNode("span",XC,"«"+t.toDisplayString(t.unref(Yo)(C.value.stereotype))+"»",1),V.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ce,"onUpdate:modelValue":P[2]||(P[2]=ie=>W.value=ie),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Ie,["enter"]),P[3]||(P[3]=t.withKeys(ie=>V.value=!1,["esc"]))],onBlur:Ie,onPointerdown:P[4]||(P[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,W.value]]):(t.openBlock(),t.createElementBlock("span",ZC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(K.value,(ie,re)=>(t.openBlock(),t.createElementBlock("span",{key:re,class:t.normalizeClass({"em-entity__missing":ie.missing})},t.toDisplayString(ie.text),3))),128))])),!I.value&&z.value&&Ne.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:Z.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!Z.value,onClick:t.withModifiers(Le,["stop"]),onPointerdown:P[5]||(P[5]=t.withModifiers(()=>{},["stop"])),onDblclick:P[6]||(P[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode($e,{name:"table",size:11}),t.createElementVNode("span",ex,t.toDisplayString(Z.value?"▸":"▾"),1)],40,QC)):t.createCommentVNode("",!0),v.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),I.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:St,class:"em-entity__attrs"},[ge.value&&ge.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ge.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.value,ie=>{var re,Te,Oe,je,st,tt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ie.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":$.value.has(ie.modelId),"is-dragging":(re=ge.value)==null?void 0:re.ids.has(ie.modelId),"is-embed":ue(ie),"is-divider":U(ie),"has-embed-badge":!!G(ie),nodrag:U(ie)&&O.value,"is-diff-changed":!!((Te=u.value)!=null&&Te.changedAttributeIds.has(ie.modelId))}]),"data-attr":ie.modelId,onClick:t.withModifiers(Ke=>T(ie,Ke),["stop"]),onPointerdown:Ke=>U(ie)?at(ie,Ke):void 0,onPointermove:Ke=>U(ie)?en(Ke):void 0,onPointerup:Ke=>U(ie)?zt():void 0,onPointercancel:Ke=>U(ie)?tn():void 0},[O.value&&!U(ie)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ke=>at(ie,Ke),onPointermove:en,onPointerup:zt,onPointercancel:tn,onClick:P[7]||(P[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,nx)):t.createCommentVNode("",!0),U(ie)?(t.openBlock(),t.createElementBlock("span",ox,t.toDisplayString(ie.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(to),{id:`l:${ie.modelId}`,type:"target",position:t.unref(Me).Left,class:"em-handle",title:O.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:ne(j.value[ie.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",ax,[(Oe=j.value[ie.modelId])!=null&&Oe.pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:12,class:"em-key is-pk"})):(je=j.value[ie.modelId])!=null&&je.required?(t.openBlock(),t.createBlock($e,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",rx,[z.value&&q(ie)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:ve(ie)?i("em.node.embedAttrShow",{count:Y(ie)}):i("em.node.embedAttrHide"),"aria-expanded":!ve(ie),onClick:t.withModifiers(Ke=>Ve(ie),["stop"]),onPointerdown:P[8]||(P[8]=t.withModifiers(()=>{},["stop"])),onDblclick:P[9]||(P[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(ve(ie)?"▸":"▾"),41,lx)):ue(ie)?(t.openBlock(),t.createBlock($e,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(st=j.value[ie.modelId])!=null&&st.fk?(t.openBlock(),t.createBlock($e,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,ix),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:pe(ie)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ae(ie),(Ke,Xe)=>(t.openBlock(),t.createElementBlock("span",{key:Xe,class:t.normalizeClass({"em-entity__missing":Ke.missing})},t.toDisplayString(Ke.text),3))),128))],4),G(ie)==="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:Y(ie)}),onClick:t.withModifiers(Ke=>Ve(ie),["stop"])},"+"+t.toDisplayString(Y(ie)),9,sx)):G(ie)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:me(ie)?i("em.node.embedRepeatedShow",{count:((tt=H(ie))==null?void 0:tt.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!me(ie),onClick:t.withModifiers(Ke=>Be(ie),["stop"])},t.toDisplayString(me(ie)?`+${Se(ie)}`:"−"),9,cx)):t.createCommentVNode("",!0),Fe.value[ie.modelId]?(t.openBlock(),t.createElementBlock("span",dx,t.toDisplayString(Fe.value[ie.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(to),{id:`r:${ie.modelId}`,type:"source",position:t.unref(Me).Right,class:"em-handle",title:O.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,tx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ue(ie)&&z.value?xe(ie):[],Ke=>(t.openBlock(),t.createElementBlock("li",{key:`${ie.modelId}:${Ke.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":$.value.has(ie.modelId)}]),onClick:t.withModifiers(Xe=>T(ie,Xe),["stop"])},[P[12]||(P[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",mx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe(Ke),(Xe,Ye)=>(t.openBlock(),t.createElementBlock("span",{key:Ye,class:t.normalizeClass({"em-entity__missing":Xe.missing})},t.toDisplayString(Xe.text),3))),128))]),t.createElementVNode("span",fx,t.toDisplayString(Ke.dataType),1)],10,ux))),128))],64)}),128)),X.value?(t.openBlock(),t.createElementBlock("li",px,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(Le,["stop"])},[t.createVNode($e,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:X.value})),1)],8,hx)])):t.createCommentVNode("",!0)],512)),!I.value&&fe.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ft,class:"em-entity__ops"},[ke.value&&ke.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ke.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he.value,ie=>{var re,Te;return t.openBlock(),t.createElementBlock("li",{key:ie.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((re=ke.value)==null?void 0:re.id)===ie.modelId,"is-diff-changed":!!((Te=u.value)!=null&&Te.changedOperationIds.has(ie.modelId))}]),"data-op":ie.modelId},[O.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Oe=>lt(ie,Oe),onPointermove:En,onPointerup:Nn,onPointercancel:D,onClick:P[10]||(P[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,gx)):t.createCommentVNode("",!0),t.createElementVNode("span",bx,t.toDisplayString(_e(ie.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:Re(ie)})},t.toDisplayString(ie.name)+"()",5)],10,yx)}),128))],512)):he.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:he.value.length})},[t.createVNode($e,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:he.value.length})),1)],8,_x)):t.createCommentVNode("",!0),O.value?(t.openBlock(),t.createElementBlock("footer",kx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:J},t.toDisplayString(i("em.node.addAttr")),1),P[13]||(P[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),O.value&&!V.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:kt,onPointermove:_n,onPointerup:kn},null,32)):t.createCommentVNode("",!0)],46,qC)}}}),[["__scopeId","data-v-c2868bd8"]]),Ex={key:0,class:"em-sel","aria-hidden":"true"},Nx={class:"em-group__label"},wx={class:"em-group__name"},Ix={key:0,class:"em-group__pkg"},vx={key:1,class:"em-group__flag"},Xf=We(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(()=>bt(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(ro,null),s=(C,M)=>l?l.t(C,M):Dt("ko",C,M),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var C;return!!n.id&&((C=l==null?void 0:l.selection.value)==null?void 0:C.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Qa,null),h=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Po,null);function y(){n.id&&(f==null||f.setGroupHover(n.id))}function k(){f==null||f.setGroupHover(null)}const _=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),E=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:N,findNode:p}=qe();let b=null,w=null;function A(C){var g;if(!n.id||!c.value)return;C.stopPropagation();const M=((g=p(n.id))==null?void 0:g.dimensions)??{width:400,height:300},B=N({x:C.clientX,y:C.clientY});b={fx:B.x,fy:B.y,w:M.width,h:M.height},C.target.setPointerCapture(C.pointerId)}function $(C){if(!b||!n.id)return;const M=N({x:C.clientX,y:C.clientY});w={width:Math.max(160,b.w+(M.x-b.fx)),height:Math.max(120,b.h+(M.y-b.fy))};const B=p(n.id);B&&(B.style={width:`${w.width}px`,height:`${w.height}px`})}function L(C){var M,B;b&&w&&n.id&&l&&l.resizeGroup(n.id,w),b=null,w=null,(B=(M=C.target).releasePointerCapture)==null||B.call(M,C.pointerId)}const T=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),S=t.computed(()=>{const C=o.value.name;return(C==null?void 0:C[T.value])||(C==null?void 0:C.ko)||(C==null?void 0:C.en)||(C==null?void 0:C.ja)||(C==null?void 0:C.zh)||o.value.packageName||s("em.group.fallback")});return(C,M)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":h.value,"is-hover-origin":_.value,"is-dimmed":E.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:k},[d.value?(t.openBlock(),t.createElementBlock("div",Ex,[...M[0]||(M[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",Nx,[t.createElementVNode("span",wx,t.toDisplayString(S.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Ix,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",vx,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:A,onPointermove:$,onPointerup:L},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),Cx={key:0,class:"em-sel","aria-hidden":"true"},xx={key:2,class:"em-note__text"},Zf=We(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(ro,null),i=t.inject(Qa,null),a=t.inject(Po,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>bt(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 g;return((g=a==null?void 0:a.source.value)==null?void 0:g.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!h.value),y=t.computed(()=>{var g;return((g=o==null?void 0:o.selection.value)==null?void 0:g.kind)==="note"&&o.selection.value.id===n.id}),k=t.computed(()=>!!n.selected&&!y.value),_=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),E=[{id:"n-top",pos:Me.Top},{id:"n-right",pos:Me.Right},{id:"n-bottom",pos:Me.Bottom},{id:"n-left",pos:Me.Left}],N=t.ref(!1),p=t.ref(""),b=t.ref(null);async function w(){var g;l.value&&(p.value=r.value.memo,N.value=!0,await t.nextTick(),(g=b.value)==null||g.focus())}function A(){N.value&&(N.value=!1,p.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,p.value)))}const{screenToFlowCoordinate:$,findNode:L}=qe();let T=null,S=null;function C(g){var O;if(!l.value)return;g.stopPropagation();const I=((O=L(n.id))==null?void 0:O.dimensions)??r.value.geo.size,v=$({x:g.clientX,y:g.clientY});T={fx:v.x,fy:v.y,w:I.width,h:I.height},g.target.setPointerCapture(g.pointerId)}function M(g){if(!T)return;const I=$({x:g.clientX,y:g.clientY});S={width:Math.max(140,T.w+(I.x-T.fx)),height:Math.max(60,T.h+(I.y-T.fy))};const v=L(n.id);v&&(v.style={width:`${S.width}px`,height:`${S.height}px`})}function B(g){var I,v;T&&S&&o&&o.resizeNote(n.id,S),T=null,S=null,(v=(I=g.target).releasePointerCapture)==null||v.call(I,g.pointerId)}return(g,I)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":f.value,"is-dimmed":_.value,"is-selected":y.value,"is-multi-selected":k.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:w,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",Cx,[...I[4]||(I[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),N.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:b,"onUpdate:modelValue":I[0]||(I[0]=v=>p.value=v),class:"em-note__edit nodrag",onBlur:A,onKeydown:I[1]||(I[1]=t.withKeys(v=>N.value=!1,["esc"])),onPointerdown:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,p.value]]):(t.openBlock(),t.createElementBlock("div",xx,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(E,v=>t.createVNode(t.unref(to),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:I[3]||(I[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!N.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:C,onPointermove:M,onPointerup:B},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function er(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 zo=.5;function Qf(e,n,o,i,a,r){const l=er(n),s=er(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 f=(_,E)=>{(Math.abs(_.x-h.x)>=zo||Math.abs(_.y-h.y)>=zo)&&(m.push({a:h,b:_,seg:E}),h=_)};f(c,0);let y=l.x!==0,k=c;for(let _=1;_<u.length;_++){const E=u[_],N=_<=o.length?_-1:o.length,p=Math.abs(E.x-k.x)<zo,b=Math.abs(E.y-k.y)<zo;p&&b||(p?(f(E,N),y=!1):b?(f(E,N),y=!0):y?(f({x:k.x,y:E.y},N),f(E,N),y=!0):(f({x:E.x,y:k.y},N),f(E,N),y=!1),k=E)}return f(i,o.length),m}function ep(e,n,o,i,a,r=20){const l=Qf(e,n,o,i,a,r);let s=`M ${_t(e.x)},${_t(e.y)}`;for(const c of l)s+=` L ${_t(c.b.x)},${_t(c.b.y)}`;return s}const Sx=14;function tp(e,n,o,i,a,r=20){return Qf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=Sx).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function _t(e){return Math.round(e*100)/100}const Rx=36;function Ax(e,n,o=Rx){const i=Math.max(e.x,n.x)+o;return`M ${_t(e.x)},${_t(e.y)} L ${_t(i)},${_t(e.y)} L ${_t(i)},${_t(n.y)} L ${_t(n.x)},${_t(n.y)}`}function np(e,n,o){const i=[e,...n,o];let a=`M ${_t(i[0].x)},${_t(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${_t(i[r].x)},${_t(i[r].y)}`;return a}function $x(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function op(e,n){const o=$x(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<zo&&Math.abs(l)<zo)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 ip(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 ap(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 Tx=20,Mx=22,Vx=7,Bx=22,rp=31,lp=7,Dx=20,sp=11,cp=11,Ox=rp+lp;function Lx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Px(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function tr(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 dp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function nr(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function up(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:dp(e,n);return[nr(o,a,r-Math.PI/2),nr(o,a,r+Math.PI/2)]}function mp(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 fp(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=tr(e,n,Tx),[d,u]=up(e,n,c,Mx);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}),Lx(o.multiplicity)){const m=tr(e,n,rp);r.push({cx:m.x,cy:m.y,r:lp})}if(Px(o.multiplicity)){const m=tr(e,n,Vx),[h,f]=up(e,n,m,Bx);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.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=tr(e,n,Dx),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=dp(e,n),m=nr(d,sp/2,u-Math.PI/2),h=nr(d,sp/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=mp(s,c,cp,!0),u=mp(s,c,cp,!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 pp=200,hp=120,ls=24;function yp(e){var a,r;if(!e)return{x:0,y:0,width:pp,height:hp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||pp,i=((r=e.dimensions)==null?void 0:r.height)||hp;return{x:n.x,y:n.y,width:o,height:i}}function gp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function bp(e){const n=t.computed(()=>yp(e.sourceNode())),o=t.computed(()=>yp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,y;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,h=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(h-m)<ls){const k=(m+h)/2;m=k-ls/2,h=k+ls/2}return{source:{x:u,y:m},target:{x:u,y:h}}}),r=t.computed(()=>e.waypoints()[0]??gp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??gp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ip(n.value,d,r.value.x):op(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ip(o.value,d,l.value.x):op(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 ss=Symbol("waypointController"),zx=["d"],Fx=["d"],Ux=["d"],Hx=["x1","y1","x2","y2"],jx=["cx","cy","r"],Kx=["x","y"],Gx=["x","y"],Yx=["cx","cy","onDblclick"],qx=["x","y","onPointerdown","onDblclick"],_p=We(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=qe(),i=t.inject(ss),a=t.inject(ro,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Pf,null),s=t.inject(Po,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var ae;return((ae=a==null?void 0:a.selection.value)==null?void 0:ae.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 ae=l==null?void 0:l.value;if(!ae||!a)return null;const se=a.resolved.value.entities,ue=F=>{var H;return(H=se.find(Z=>Z.entity.modelId===F))==null?void 0:H.groupRef},U=n.data.association;return ue(U.end1.entityRef)===ae.groupId&&ue(U.end2.entityRef)===ae.groupId?{dx:ae.dx,dy:ae.dy}:null}),h=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),y=t.ref({x:0,y:0}),k=t.computed(()=>{const ae=m.value;return h.value.map((se,ue)=>ue===f.value?y.value:ae?{x:se.x+ae.dx,y:se.y+ae.dy}:se)}),_=t.computed(()=>{var ae;return!!((ae=n.sourceNode.data)!=null&&ae.collapsed)}),E=t.computed(()=>{var ae;return!!((ae=n.targetNode.data)!=null&&ae.collapsed)}),{source:N,target:p,sourceSide:b,targetSide:w,isSelf:A}=bp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>k.value,sourceRowY:()=>n.data.sourceColumnRef&&!_.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!E.value?n.targetY:void 0}),$=Ox+4,L=t.computed(()=>A.value?Ax(N.value,p.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?ep(N.value,b.value,k.value,p.value,w.value,$):np(N.value,k.value,p.value)),T=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?tp(N.value,b.value,k.value,p.value,w.value,$):ap(N.value,k.value,p.value).map((ae,se)=>({point:ae,segIndex:se}))),S=t.computed(()=>A.value||!r.value?[]:k.value),C=Gi;function M(ae,se){f.value=ae,y.value={...h.value[ae]},se.target.setPointerCapture(se.pointerId),se.stopPropagation()}function B(ae){if(f.value<0)return;const se=o({x:ae.clientX,y:ae.clientY});y.value={x:se.x,y:se.y}}function g(ae){var se,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...y.value}),f.value=-1,(ue=(se=ae.target).releasePointerCapture)==null||ue.call(se,ae.pointerId)}function I(ae,se){se.stopPropagation(),i==null||i.removePoint(n.id,ae)}function v(ae,se){if(!i)return;const ue=o({x:se.clientX,y:se.clientY});i.insertPoint(n.id,ae,{x:ue.x,y:ue.y})}const O=t.computed(()=>C(n.data.association.end1.multiplicity)),x=t.computed(()=>C(n.data.association.end2.multiplicity)),z=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),j=t.computed(()=>z.value==="class"),ne=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ae=er(b.value);return{x:N.value.x+ae.x*10,y:N.value.y+ae.y*10}}return k.value[0]??p.value}),de=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const se=er(w.value);return{x:p.value.x+se.x*10,y:p.value.y+se.y*10}}const ae=k.value;return ae[ae.length-1]??N.value}),pe=t.computed(()=>{const ae=n.data.association;return{multiplicity:ae.end1.multiplicity,navigable:ae.end1.navigable,composition:ae.end1.composition,otherNavigable:ae.end2.navigable}}),he=t.computed(()=>{const ae=n.data.association;return{multiplicity:ae.end2.multiplicity,navigable:ae.end2.navigable,composition:ae.end2.composition,otherNavigable:ae.end1.navigable}}),fe=t.computed(()=>fp(N.value,ne.value,pe.value,z.value)),ye=t.computed(()=>fp(p.value,de.value,he.value,z.value)),_e=t.computed(()=>[...fe.value.lines,...ye.value.lines]),Re=t.computed(()=>[...fe.value.circles,...ye.value.circles]),ce=t.computed(()=>[...fe.value.polygons,...ye.value.polygons].map(ae=>`M${ae.points.map(se=>`${se.x},${se.y}`).join(" L")} Z`)),le=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ae,se)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:L.value,fill:"none",class:"em-edge__hit"},null,8,zx),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,Fx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,(ue,U)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${U}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",le.value])},null,10,Ux))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,(ue,U)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${U}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",le.value])},null,10,Hx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Re.value,(ue,U)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${U}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",le.value])},null,10,jx))),128)),j.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(N).x+8,y:t.unref(N).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(O.value),11,Kx),t.createElementVNode("text",{x:t.unref(p).x-8,y:t.unref(p).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(x.value),11,Gx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(ue,U)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${U}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(F=>v(ue.segIndex,F),["stop"])},null,42,Yx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,(ue,U)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${U}`,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:F=>M(U,F),onPointermove:B,onPointerup:g,onDblclick:F=>I(U,F)},null,42,qx))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var pn=(e=>(e.Lines="lines",e.Dots="dots",e))(pn||{});const kp=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]}`})},Ep=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};pn.Lines+"",pn.Dots+"";const Wx={[pn.Dots]:"#81818a",[pn.Lines]:"#eee"},Jx=["id","x","y","width","height","patternTransform"],Xx={key:2,height:"100",width:"100"},Zx=["fill"],Qx=["x","y","fill"],eS={name:"Background",compatConfig:{MODE:3}},tS=t.defineComponent({...eS,props:{id:{},variant:{default:()=>pn.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}=qe(),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],f=[m*l||1+d[0]/2,h*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||Wx[e.variant||pn.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(pn).Lines?(t.openBlock(),t.createBlock(t.unref(kp),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(pn).Dots?(t.openBlock(),t.createBlock(t.unref(Ep),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",Xx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Zx)])):t.createCommentVNode("",!0)])],8,Jx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Qx),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),nS={name:"ControlButton",compatConfig:{MODE:3}},oS=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},iS={type:"button",class:"vue-flow__controls-button"};function aS(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",iS,[t.renderSlot(e.$slots,"default")])}const lo=oS(nS,[["render",aS]]),rS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},lS=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function sS(e,n){return t.openBlock(),t.createElementBlock("svg",rS,lS)}const cS={render:sS},dS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},uS=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function mS(e,n){return t.openBlock(),t.createElementBlock("svg",dS,uS)}const fS={render:mS},pS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},hS=[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 yS(e,n){return t.openBlock(),t.createElementBlock("svg",pS,hS)}const gS={render:yS},bS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},_S=[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 kS(e,n){return t.openBlock(),t.createElementBlock("svg",bS,_S)}const ES={render:kS},NS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},wS=[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 IS(e,n){return t.openBlock(),t.createElementBlock("svg",NS,wS)}const vS={render:IS},CS={name:"Controls",compatConfig:{MODE:3}},xS=t.defineComponent({...CS,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>_m.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}=qe(),h=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function k(){l(),n("zoomIn")}function _(){s(),n("zoomOut")}function E(){c(e.fitViewParams),n("fitView")}function N(){r(!h.value),n("interactionChange",!h.value)}return(p,b)=>(t.openBlock(),t.createBlock(t.unref(bf),{class:"vue-flow__controls",position:p.position},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"top"),p.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(p.$slots,"control-zoom-in",{},()=>[t.createVNode(lo,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:k},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(cS))))])]),_:3},8,["disabled"])]),t.renderSlot(p.$slots,"control-zoom-out",{},()=>[t.createVNode(lo,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(fS))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),p.showFitView?t.renderSlot(p.$slots,"control-fit-view",{key:1},()=>[t.createVNode(lo,{class:"vue-flow__controls-fitview",onClick:E},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(gS))))])]),_:3})]):t.createCommentVNode("",!0),p.showInteractive?t.renderSlot(p.$slots,"control-interactive",{key:2},()=>[p.showInteractive?(t.openBlock(),t.createBlock(lo,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:t.withCtx(()=>[h.value?t.renderSlot(p.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(vS))))]):t.createCommentVNode("",!0),h.value?t.createCommentVNode("",!0):t.renderSlot(p.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(ES))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(p.$slots,"default")]),_:3},8,["position"]))}});var SS={value:()=>{}};function cs(){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 or(o)}function or(e){this._=e}function RS(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}})}or.prototype=cs.prototype={constructor:or,on:function(e,n){var o=this._,i=RS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=AS(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]=Np(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Np(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 or(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 AS(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Np(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=SS,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ds="http://www.w3.org/1999/xhtml";const wp={svg:"http://www.w3.org/2000/svg",xhtml:ds,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ir(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),wp.hasOwnProperty(n)?{space:wp[n],local:e}:e}function $S(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ds&&n.documentElement.namespaceURI===ds?n.createElement(e):n.createElementNS(o,e)}}function TS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ip(e){var n=ir(e);return(n.local?TS:$S)(n)}function MS(){}function us(e){return e==null?MS:function(){return this.querySelector(e)}}function VS(e){typeof e!="function"&&(e=us(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 xt(i,this._parents)}function BS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function DS(){return[]}function vp(e){return e==null?DS:function(){return this.querySelectorAll(e)}}function OS(e){return function(){return BS(e.apply(this,arguments))}}function LS(e){typeof e=="function"?e=OS(e):e=vp(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 xt(i,a)}function Cp(e){return function(){return this.matches(e)}}function xp(e){return function(n){return n.matches(e)}}var PS=Array.prototype.find;function zS(e){return function(){return PS.call(this.children,e)}}function FS(){return this.firstElementChild}function US(e){return this.select(e==null?FS:zS(typeof e=="function"?e:xp(e)))}var HS=Array.prototype.filter;function jS(){return Array.from(this.children)}function KS(e){return function(){return HS.call(this.children,e)}}function GS(e){return this.selectAll(e==null?jS:KS(typeof e=="function"?e:xp(e)))}function YS(e){typeof e!="function"&&(e=Cp(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 xt(i,this._parents)}function Sp(e){return new Array(e.length)}function qS(){return new xt(this._enter||this._groups.map(Sp),this._parents)}function ar(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ar.prototype={constructor:ar,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 WS(e){return function(){return e}}function JS(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 ar(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function XS(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(h[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 ar(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function ZS(e){return e.__data__}function QS(e,n){if(!arguments.length)return Array.from(this,ZS);var o=n?XS:JS,i=this._parents,a=this._groups;typeof e!="function"&&(e=WS(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,f=eR(e.call(u,u&&u.__data__,d,i)),y=f.length,k=s[d]=new Array(y),_=l[d]=new Array(y),E=c[d]=new Array(h);o(u,m,k,_,E,f,n);for(var N=0,p=0,b,w;N<y;++N)if(b=k[N]){for(N>=p&&(p=N+1);!(w=_[p])&&++p<y;);b._next=w||null}}return l=new xt(l,i),l._enter=s,l._exit=c,l}function eR(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function tR(){return new xt(this._exit||this._groups.map(Sp),this._parents)}function nR(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 oR(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),f,y=0;y<m;++y)(f=d[y]||u[y])&&(h[y]=f);for(;c<a;++c)s[c]=o[c];return new xt(s,this._parents)}function iR(){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 aR(e){e||(e=rR);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 xt(a,this._parents).order()}function rR(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function lR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sR(){return Array.from(this)}function cR(){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 dR(){let e=0;for(const n of this)++e;return e}function uR(){return!this.node()}function mR(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 fR(e){return function(){this.removeAttribute(e)}}function pR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hR(e,n){return function(){this.setAttribute(e,n)}}function yR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function gR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function bR(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 _R(e,n){var o=ir(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?pR:fR:typeof n=="function"?o.local?bR:gR:o.local?yR:hR)(o,n))}function Rp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kR(e){return function(){this.style.removeProperty(e)}}function ER(e,n,o){return function(){this.style.setProperty(e,n,o)}}function NR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function wR(e,n,o){return arguments.length>1?this.each((n==null?kR:typeof n=="function"?NR:ER)(e,n,o??"")):Fo(this.node(),e)}function Fo(e,n){return e.style.getPropertyValue(n)||Rp(e).getComputedStyle(e,null).getPropertyValue(n)}function IR(e){return function(){delete this[e]}}function vR(e,n){return function(){this[e]=n}}function CR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function xR(e,n){return arguments.length>1?this.each((n==null?IR:typeof n=="function"?CR:vR)(e,n)):this.node()[e]}function Ap(e){return e.trim().split(/^|\s+/)}function ms(e){return e.classList||new $p(e)}function $p(e){this._node=e,this._names=Ap(e.getAttribute("class")||"")}$p.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 Tp(e,n){for(var o=ms(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Mp(e,n){for(var o=ms(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function SR(e){return function(){Tp(this,e)}}function RR(e){return function(){Mp(this,e)}}function AR(e,n){return function(){(n.apply(this,arguments)?Tp:Mp)(this,e)}}function $R(e,n){var o=Ap(e+"");if(arguments.length<2){for(var i=ms(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?AR:n?SR:RR)(o,n))}function TR(){this.textContent=""}function MR(e){return function(){this.textContent=e}}function VR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function BR(e){return arguments.length?this.each(e==null?TR:(typeof e=="function"?VR:MR)(e)):this.node().textContent}function DR(){this.innerHTML=""}function OR(e){return function(){this.innerHTML=e}}function LR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function PR(e){return arguments.length?this.each(e==null?DR:(typeof e=="function"?LR:OR)(e)):this.node().innerHTML}function zR(){this.nextSibling&&this.parentNode.appendChild(this)}function FR(){return this.each(zR)}function UR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function HR(){return this.each(UR)}function jR(e){var n=typeof e=="function"?e:Ip(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function KR(){return null}function GR(e,n){var o=typeof e=="function"?e:Ip(e),i=n==null?KR:typeof n=="function"?n:us(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function YR(){var e=this.parentNode;e&&e.removeChild(this)}function qR(){return this.each(YR)}function WR(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function JR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function XR(e){return this.select(e?JR:WR)}function ZR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function QR(e){return function(n){e.call(this,n,this.__data__)}}function eA(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 tA(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 nA(e,n,o){return function(){var i=this.__on,a,r=QR(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 oA(e,n,o){var i=eA(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?nA:tA,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Vp(e,n,o){var i=Rp(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 iA(e,n){return function(){return Vp(this,e,n)}}function aA(e,n){return function(){return Vp(this,e,n.apply(this,arguments))}}function rA(e,n){return this.each((typeof n=="function"?aA:iA)(e,n))}function*lA(){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 Bp=[null];function xt(e,n){this._groups=e,this._parents=n}function Ci(){return new xt([[document.documentElement]],Bp)}function sA(){return this}xt.prototype=Ci.prototype={constructor:xt,select:VS,selectAll:LS,selectChild:US,selectChildren:GS,filter:YS,data:QS,enter:qS,exit:tR,join:nR,merge:oR,selection:sA,order:iR,sort:aR,call:lR,nodes:sR,node:cR,size:dR,empty:uR,each:mR,attr:_R,style:wR,property:xR,classed:$R,text:BR,html:PR,raise:FR,lower:HR,append:jR,insert:GR,remove:qR,clone:XR,datum:ZR,on:oA,dispatch:rA,[Symbol.iterator]:lA};function Vn(e){return typeof e=="string"?new xt([[document.querySelector(e)]],[document.documentElement]):new xt([[e]],Bp)}function cA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Bn(e,n){if(e=cA(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 fs={capture:!0,passive:!1};function ps(e){e.preventDefault(),e.stopImmediatePropagation()}function dA(e){var n=e.document.documentElement,o=Vn(e).on("dragstart.drag",ps,fs);"onselectstart"in n?o.on("selectstart.drag",ps,fs):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function uA(e,n){var o=e.document.documentElement,i=Vn(e).on("dragstart.drag",null);n&&(i.on("click.drag",ps,fs),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 hs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Dp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function xi(){}var Si=.7,rr=1/Si,Uo="\\s*([+-]?\\d+)\\s*",Ri="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mA=/^#([0-9a-f]{3,8})$/,fA=new RegExp(`^rgb\\(${Uo},${Uo},${Uo}\\)$`),pA=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),hA=new RegExp(`^rgba\\(${Uo},${Uo},${Uo},${Ri}\\)$`),yA=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${Ri}\\)$`),gA=new RegExp(`^hsl\\(${Ri},${Zt},${Zt}\\)$`),bA=new RegExp(`^hsla\\(${Ri},${Zt},${Zt},${Ri}\\)$`),Op={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};hs(xi,Ai,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Lp,formatHex:Lp,formatHex8:_A,formatHsl:kA,formatRgb:Pp,toString:Pp});function Lp(){return this.rgb().formatHex()}function _A(){return this.rgb().formatHex8()}function kA(){return jp(this).formatHsl()}function Pp(){return this.rgb().formatRgb()}function Ai(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=mA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?zp(n):o===3?new wt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?lr(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?lr(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=fA.exec(e))?new wt(n[1],n[2],n[3],1):(n=pA.exec(e))?new wt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=hA.exec(e))?lr(n[1],n[2],n[3],n[4]):(n=yA.exec(e))?lr(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=gA.exec(e))?Hp(n[1],n[2]/100,n[3]/100,1):(n=bA.exec(e))?Hp(n[1],n[2]/100,n[3]/100,n[4]):Op.hasOwnProperty(e)?zp(Op[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function zp(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function lr(e,n,o,i){return i<=0&&(e=n=o=NaN),new wt(e,n,o,i)}function EA(e){return e instanceof xi||(e=Ai(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function ys(e,n,o,i){return arguments.length===1?EA(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}hs(wt,ys,Dp(xi,{brighter(e){return e=e==null?rr:Math.pow(rr,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Si:Math.pow(Si,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(so(this.r),so(this.g),so(this.b),sr(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:Fp,formatHex:Fp,formatHex8:NA,formatRgb:Up,toString:Up}));function Fp(){return`#${co(this.r)}${co(this.g)}${co(this.b)}`}function NA(){return`#${co(this.r)}${co(this.g)}${co(this.b)}${co((isNaN(this.opacity)?1:this.opacity)*255)}`}function Up(){const e=sr(this.opacity);return`${e===1?"rgb(":"rgba("}${so(this.r)}, ${so(this.g)}, ${so(this.b)}${e===1?")":`, ${e})`}`}function sr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function so(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function co(e){return e=so(e),(e<16?"0":"")+e.toString(16)}function Hp(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 jp(e){if(e instanceof Lt)return new Lt(e.h,e.s,e.l,e.opacity);if(e instanceof xi||(e=Ai(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 wA(e,n,o,i){return arguments.length===1?jp(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}hs(Lt,wA,Dp(xi,{brighter(e){return e=e==null?rr:Math.pow(rr,e),new Lt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Si:Math.pow(Si,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 wt(gs(e>=240?e-240:e+120,a,i),gs(e,a,i),gs(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Lt(Kp(this.h),cr(this.s),cr(this.l),sr(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=sr(this.opacity);return`${e===1?"hsl(":"hsla("}${Kp(this.h)}, ${cr(this.s)*100}%, ${cr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Kp(e){return e=(e||0)%360,e<0?e+360:e}function cr(e){return Math.max(0,Math.min(1,e||0))}function gs(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 Gp=e=>()=>e;function IA(e,n){return function(o){return e+o*n}}function vA(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 CA(e){return(e=+e)==1?Yp:function(n,o){return o-n?vA(n,o,e):Gp(isNaN(n)?o:n)}}function Yp(e,n){var o=n-e;return o?IA(e,o):Gp(isNaN(e)?n:e)}const qp=(function e(n){var o=CA(n);function i(a,r){var l=o((a=ys(a)).r,(r=ys(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Yp(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 Dn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var bs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_s=new RegExp(bs.source,"g");function xA(e){return function(){return e}}function SA(e){return function(n){return e(n)+""}}function RA(e,n){var o=bs.lastIndex=_s.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=bs.exec(e))&&(a=_s.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:Dn(i,a)})),o=_s.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?SA(c[0].x):xA(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 Wp=180/Math.PI,ks={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Jp(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)*Wp,skewX:Math.atan(c)*Wp,scaleX:l,scaleY:s}}var dr;function AA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?ks:Jp(n.a,n.b,n.c,n.d,n.e,n.f)}function $A(e){return e==null||(dr||(dr=document.createElementNS("http://www.w3.org/2000/svg","g")),dr.setAttribute("transform",e),!(e=dr.transform.baseVal.consolidate()))?ks:(e=e.matrix,Jp(e.a,e.b,e.c,e.d,e.e,e.f))}function Xp(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,f,y){if(d!==m||u!==h){var k=f.push("translate(",null,n,null,o);y.push({i:k-4,x:Dn(d,m)},{i:k-2,x:Dn(u,h)})}else(m||h)&&f.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:Dn(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:Dn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,f,y){if(d!==m||u!==h){var k=f.push(a(f)+"scale(",null,",",null,")");y.push({i:k-4,x:Dn(d,m)},{i:k-2,x:Dn(u,h)})}else(m!==1||h!==1)&&f.push(a(f)+"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(f){for(var y=-1,k=h.length,_;++y<k;)m[(_=h[y]).i]=_.x(f);return m.join("")}}}var TA=Xp(AA,"px, ","px)","deg)"),MA=Xp($A,", ",")",")"),VA=1e-12;function Zp(e){return((e=Math.exp(e))+1/e)/2}function BA(e){return((e=Math.exp(e))-1/e)/2}function DA(e){return((e=Math.exp(2*e))-1)/(e+1)}const OA=(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],f=u-s,y=m-c,k=f*f+y*y,_,E;if(k<VA)E=Math.log(h/d)/n,_=function($){return[s+$*f,c+$*y,d*Math.exp(n*$*E)]};else{var N=Math.sqrt(k),p=(h*h-d*d+i*k)/(2*d*o*N),b=(h*h-d*d-i*k)/(2*h*o*N),w=Math.log(Math.sqrt(p*p+1)-p),A=Math.log(Math.sqrt(b*b+1)-b);E=(A-w)/n,_=function($){var L=$*E,T=Zp(w),S=d/(o*N)*(T*DA(n*L+w)-BA(w));return[s+S*f,c+S*y,d*T/Zp(n*L+w)]}}return _.duration=E*1e3*n/Math.SQRT2,_}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 Ho=0,$i=0,Ti=0,Qp=1e3,ur,Mi,mr=0,uo=0,fr=0,Vi=typeof performance=="object"&&performance.now?performance:Date,eh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Es(){return uo||(eh(LA),uo=Vi.now()+fr)}function LA(){uo=0}function pr(){this._call=this._time=this._next=null}pr.prototype=th.prototype={constructor:pr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Es():+o)+(n==null?0:+n),!this._next&&Mi!==this&&(Mi?Mi._next=this:ur=this,Mi=this),this._call=e,this._time=o,Ns()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ns())}};function th(e,n,o){var i=new pr;return i.restart(e,n,o),i}function PA(){Es(),++Ho;for(var e=ur,n;e;)(n=uo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Ho}function nh(){uo=(mr=Vi.now())+fr,Ho=$i=0;try{PA()}finally{Ho=0,FA(),uo=0}}function zA(){var e=Vi.now(),n=e-mr;n>Qp&&(fr-=n,mr=e)}function FA(){for(var e,n=ur,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:ur=o);Mi=e,Ns(i)}function Ns(e){if(!Ho){$i&&($i=clearTimeout($i));var n=e-uo;n>24?(e<1/0&&($i=setTimeout(nh,e-Vi.now()-fr)),Ti&&(Ti=clearInterval(Ti))):(Ti||(mr=Vi.now(),Ti=setInterval(zA,Qp)),Ho=1,eh(nh))}}function oh(e,n,o){var i=new pr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var UA=cs("start","end","cancel","interrupt"),HA=[],ih=0,ah=1,ws=2,hr=3,rh=4,Is=5,yr=6;function gr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;jA(e,o,{name:n,index:i,group:a,on:UA,tween:HA,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:ih})}function vs(e,n){var o=Pt(e,n);if(o.state>ih)throw new Error("too late; already scheduled");return o}function Qt(e,n){var o=Pt(e,n);if(o.state>hr)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 jA(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=th(r,0,o.time);function r(d){o.state=ah,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,f;if(o.state!==ah)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===hr)return oh(l);f.state===rh?(f.state=yr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=yr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(oh(function(){o.state===hr&&(o.state=rh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ws,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ws){for(o.state=hr,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++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=Is,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Is&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=yr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function br(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>ws&&i.state<Is,i.state=yr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function KA(e){return this.each(function(){br(this,e)})}function GA(e,n){var o,i;return function(){var a=Qt(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 YA(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Qt(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 qA(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?GA:YA)(o,e,n))}function Cs(e,n,o){var i=e._id;return e.each(function(){var a=Qt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Pt(a,i).value[n]}}function lh(e,n){var o;return(typeof n=="number"?Dn:n instanceof Ai?qp:(o=Ai(n))?(n=o,qp):RA)(e,n)}function WA(e){return function(){this.removeAttribute(e)}}function JA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function XA(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 ZA(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 QA(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 e$(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 t$(e,n){var o=ir(e),i=o==="transform"?MA:lh;return this.attrTween(e,typeof n=="function"?(o.local?e$:QA)(o,i,Cs(this,"attr."+e,n)):n==null?(o.local?JA:WA)(o):(o.local?ZA:XA)(o,i,n))}function n$(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function o$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function i$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&o$(e,r)),o}return a._value=n,a}function a$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&n$(e,r)),o}return a._value=n,a}function r$(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=ir(e);return this.tween(o,(i.local?i$:a$)(i,n))}function l$(e,n){return function(){vs(this,e).delay=+n.apply(this,arguments)}}function s$(e,n){return n=+n,function(){vs(this,e).delay=n}}function c$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?l$:s$)(n,e)):Pt(this.node(),n).delay}function d$(e,n){return function(){Qt(this,e).duration=+n.apply(this,arguments)}}function u$(e,n){return n=+n,function(){Qt(this,e).duration=n}}function m$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?d$:u$)(n,e)):Pt(this.node(),n).duration}function f$(e,n){if(typeof n!="function")throw new Error;return function(){Qt(this,e).ease=n}}function p$(e){var n=this._id;return arguments.length?this.each(f$(n,e)):Pt(this.node(),n).ease}function h$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Qt(this,e).ease=o}}function y$(e){if(typeof e!="function")throw new Error;return this.each(h$(this._id,e))}function g$(e){typeof e!="function"&&(e=Cp(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 hn(i,this._parents,this._name,this._id)}function b$(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,f=0;f<u;++f)(h=c[f]||d[f])&&(m[f]=h);for(;s<i;++s)l[s]=n[s];return new hn(l,this._parents,this._name,this._id)}function _$(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 k$(e,n,o){var i,a,r=_$(n)?vs:Qt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function E$(e,n){var o=this._id;return arguments.length<2?Pt(this.node(),o).on.on(e):this.each(k$(o,e,n))}function N$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function w$(){return this.on("end.remove",N$(this._id))}function I$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=us(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,gr(d[h],n,o,h,d,Pt(u,o)));return new hn(r,this._parents,n,o)}function v$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=vp(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),f,y=Pt(u,o),k=0,_=h.length;k<_;++k)(f=h[k])&&gr(f,n,o,k,h,y);r.push(h),l.push(u)}return new hn(r,l,n,o)}var C$=Ci.prototype.constructor;function x$(){return new C$(this._groups,this._parents)}function S$(e,n){var o,i,a;return function(){var r=Fo(this,e),l=(this.style.removeProperty(e),Fo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function sh(e){return function(){this.style.removeProperty(e)}}function R$(e,n,o){var i,a=o+"",r;return function(){var l=Fo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function A$(e,n,o){var i,a,r;return function(){var l=Fo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Fo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function $$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Qt(this,e),d=c.on,u=c.value[r]==null?s||(s=sh(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function T$(e,n,o){var i=(e+="")=="transform"?TA:lh;return n==null?this.styleTween(e,S$(e,i)).on("end.style."+e,sh(e)):typeof n=="function"?this.styleTween(e,A$(e,i,Cs(this,"style."+e,n))).each($$(this._id,e)):this.styleTween(e,R$(e,i,n),o).on("end.style."+e,null)}function M$(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)&&M$(e,l,o)),i}return r._value=n,r}function B$(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 D$(e){return function(){this.textContent=e}}function O$(e){return function(){var n=e(this);this.textContent=n??""}}function L$(e){return this.tween("text",typeof e=="function"?O$(Cs(this,"text",e)):D$(e==null?"":e+""))}function P$(e){return function(n){this.textContent=e.call(this,n)}}function z$(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&P$(a)),n}return i._value=e,i}function F$(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,z$(e))}function U$(){for(var e=this._name,n=this._id,o=ch(),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);gr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new hn(i,this._parents,e,o)}function H$(){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=Qt(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 j$=0;function hn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function ch(){return++j$}var yn=Ci.prototype;hn.prototype={constructor:hn,select:I$,selectAll:v$,selectChild:yn.selectChild,selectChildren:yn.selectChildren,filter:g$,merge:b$,selection:x$,transition:U$,call:yn.call,nodes:yn.nodes,node:yn.node,size:yn.size,empty:yn.empty,each:yn.each,on:E$,attr:t$,attrTween:r$,style:T$,styleTween:B$,text:L$,textTween:F$,remove:w$,tween:qA,delay:c$,duration:m$,ease:p$,easeVarying:y$,end:H$,[Symbol.iterator]:yn[Symbol.iterator]};function K$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var G$={time:null,delay:0,duration:250,ease:K$};function Y$(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 q$(e){var n,o;e instanceof hn?(n=e._id,e=e._name):(n=ch(),(o=G$).time=Es(),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])&&gr(c,e,n,d,l,o||Y$(c,n));return new hn(i,this._parents,e,n)}Ci.prototype.interrupt=KA,Ci.prototype.transition=q$;const _r=e=>()=>e;function W$(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 gn(e,n,o){this.k=e,this.x=n,this.y=o}gn.prototype={constructor:gn,scale:function(e){return e===1?this:new gn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new gn(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 xs=new gn(1,0,0);gn.prototype;function Ss(e){e.stopImmediatePropagation()}function Bi(e){e.preventDefault(),e.stopImmediatePropagation()}function J$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function X$(){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 dh(){return this.__zoom||xs}function Z$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Q$(){return navigator.maxTouchPoints||"ontouchstart"in this}function eT(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 tT(){var e=J$,n=X$,o=eT,i=Z$,a=Q$,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=OA,d=cs("start","zoom","end"),u,m,h,f=500,y=150,k=0,_=10;function E(g){g.property("__zoom",dh).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(g,I,v,O){var x=g.selection?g.selection():g;x.property("__zoom",dh),g!==x?w(g,I,v,O):x.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},E.scaleBy=function(g,I,v,O){E.scaleTo(g,function(){var x=this.__zoom.k,z=typeof I=="function"?I.apply(this,arguments):I;return x*z},v,O)},E.scaleTo=function(g,I,v,O){E.transform(g,function(){var x=n.apply(this,arguments),z=this.__zoom,j=v==null?b(x):typeof v=="function"?v.apply(this,arguments):v,ne=z.invert(j),de=typeof I=="function"?I.apply(this,arguments):I;return o(p(N(z,de),j,ne),x,l)},v,O)},E.translateBy=function(g,I,v,O){E.transform(g,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,O)},E.translateTo=function(g,I,v,O,x){E.transform(g,function(){var z=n.apply(this,arguments),j=this.__zoom,ne=O==null?b(z):typeof O=="function"?O.apply(this,arguments):O;return o(xs.translate(ne[0],ne[1]).scale(j.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),z,l)},O,x)};function N(g,I){return I=Math.max(r[0],Math.min(r[1],I)),I===g.k?g:new gn(I,g.x,g.y)}function p(g,I,v){var O=I[0]-v[0]*g.k,x=I[1]-v[1]*g.k;return O===g.x&&x===g.y?g:new gn(g.k,O,x)}function b(g){return[(+g[0][0]+ +g[1][0])/2,(+g[0][1]+ +g[1][1])/2]}function w(g,I,v,O){g.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var x=this,z=arguments,j=A(x,z).event(O),ne=n.apply(x,z),de=v==null?b(ne):typeof v=="function"?v.apply(x,z):v,pe=Math.max(ne[1][0]-ne[0][0],ne[1][1]-ne[0][1]),he=x.__zoom,fe=typeof I=="function"?I.apply(x,z):I,ye=c(he.invert(de).concat(pe/he.k),fe.invert(de).concat(pe/fe.k));return function(_e){if(_e===1)_e=fe;else{var Re=ye(_e),ce=pe/Re[2];_e=new gn(ce,de[0]-Re[0]*ce,de[1]-Re[1]*ce)}j.zoom(null,_e)}})}function A(g,I,v){return!v&&g.__zooming||new $(g,I)}function $(g,I){this.that=g,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(g,I),this.taps=0}$.prototype={event:function(g){return g&&(this.sourceEvent=g),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(g,I){return this.mouse&&g!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&g!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&g!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(g){var I=Vn(this.that).datum();d.call(g,this.that,new W$(g,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),I)}};function L(g,...I){if(!e.apply(this,arguments))return;var v=A(this,I).event(g),O=this.__zoom,x=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),z=Bn(g);if(v.wheel)(v.mouse[0][0]!==z[0]||v.mouse[0][1]!==z[1])&&(v.mouse[1]=O.invert(v.mouse[0]=z)),clearTimeout(v.wheel);else{if(O.k===x)return;v.mouse=[z,O.invert(z)],br(this),v.start()}Bi(g),v.wheel=setTimeout(j,y),v.zoom("mouse",o(p(N(O,x),v.mouse[0],v.mouse[1]),v.extent,l));function j(){v.wheel=null,v.end()}}function T(g,...I){if(h||!e.apply(this,arguments))return;var v=g.currentTarget,O=A(this,I,!0).event(g),x=Vn(g.view).on("mousemove.zoom",de,!0).on("mouseup.zoom",pe,!0),z=Bn(g,v),j=g.clientX,ne=g.clientY;dA(g.view),Ss(g),O.mouse=[z,this.__zoom.invert(z)],br(this),O.start();function de(he){if(Bi(he),!O.moved){var fe=he.clientX-j,ye=he.clientY-ne;O.moved=fe*fe+ye*ye>k}O.event(he).zoom("mouse",o(p(O.that.__zoom,O.mouse[0]=Bn(he,v),O.mouse[1]),O.extent,l))}function pe(he){x.on("mousemove.zoom mouseup.zoom",null),uA(he.view,O.moved),Bi(he),O.event(he).end()}}function S(g,...I){if(e.apply(this,arguments)){var v=this.__zoom,O=Bn(g.changedTouches?g.changedTouches[0]:g,this),x=v.invert(O),z=v.k*(g.shiftKey?.5:2),j=o(p(N(v,z),O,x),n.apply(this,I),l);Bi(g),s>0?Vn(this).transition().duration(s).call(w,j,O,g):Vn(this).call(E.transform,j,O,g)}}function C(g,...I){if(e.apply(this,arguments)){var v=g.touches,O=v.length,x=A(this,I,g.changedTouches.length===O).event(g),z,j,ne,de;for(Ss(g),j=0;j<O;++j)ne=v[j],de=Bn(ne,this),de=[de,this.__zoom.invert(de),ne.identifier],x.touch0?!x.touch1&&x.touch0[2]!==de[2]&&(x.touch1=de,x.taps=0):(x.touch0=de,z=!0,x.taps=1+!!u);u&&(u=clearTimeout(u)),z&&(x.taps<2&&(m=de[0],u=setTimeout(function(){u=null},f)),br(this),x.start())}}function M(g,...I){if(this.__zooming){var v=A(this,I).event(g),O=g.changedTouches,x=O.length,z,j,ne,de;for(Bi(g),z=0;z<x;++z)j=O[z],ne=Bn(j,this),v.touch0&&v.touch0[2]===j.identifier?v.touch0[0]=ne:v.touch1&&v.touch1[2]===j.identifier&&(v.touch1[0]=ne);if(j=v.that.__zoom,v.touch1){var pe=v.touch0[0],he=v.touch0[1],fe=v.touch1[0],ye=v.touch1[1],_e=(_e=fe[0]-pe[0])*_e+(_e=fe[1]-pe[1])*_e,Re=(Re=ye[0]-he[0])*Re+(Re=ye[1]-he[1])*Re;j=N(j,Math.sqrt(_e/Re)),ne=[(pe[0]+fe[0])/2,(pe[1]+fe[1])/2],de=[(he[0]+ye[0])/2,(he[1]+ye[1])/2]}else if(v.touch0)ne=v.touch0[0],de=v.touch0[1];else return;v.zoom("touch",o(p(j,ne,de),v.extent,l))}}function B(g,...I){if(this.__zooming){var v=A(this,I).event(g),O=g.changedTouches,x=O.length,z,j;for(Ss(g),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),z=0;z<x;++z)j=O[z],v.touch0&&v.touch0[2]===j.identifier?delete v.touch0:v.touch1&&v.touch1[2]===j.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&&(j=Bn(j,this),Math.hypot(m[0]-j[0],m[1]-j[1])<_)){var ne=Vn(this).on("dblclick.zoom");ne&&ne.apply(this,arguments)}}}return E.wheelDelta=function(g){return arguments.length?(i=typeof g=="function"?g:_r(+g),E):i},E.filter=function(g){return arguments.length?(e=typeof g=="function"?g:_r(!!g),E):e},E.touchable=function(g){return arguments.length?(a=typeof g=="function"?g:_r(!!g),E):a},E.extent=function(g){return arguments.length?(n=typeof g=="function"?g:_r([[+g[0][0],+g[0][1]],[+g[1][0],+g[1][1]]]),E):n},E.scaleExtent=function(g){return arguments.length?(r[0]=+g[0],r[1]=+g[1],E):[r[0],r[1]]},E.translateExtent=function(g){return arguments.length?(l[0][0]=+g[0][0],l[1][0]=+g[1][0],l[0][1]=+g[0][1],l[1][1]=+g[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(g){return arguments.length?(o=g,E):o},E.duration=function(g){return arguments.length?(s=+g,E):s},E.interpolate=function(g){return arguments.length?(c=g,E):c},E.on=function(){var g=d.on.apply(d,arguments);return g===d?E:g},E.clickDistance=function(g){return arguments.length?(k=(g=+g)*g,E):Math.sqrt(k)},E.tapDistance=function(g){return arguments.length?(_=+g,E):_},E}const uh=Symbol("MiniMapSlots"),nT=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],oT={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},iT=t.defineComponent({...oT,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(uh),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,nT))],64)):t.createCommentVNode("",!0)}}),aT=["width","height","viewBox","aria-labelledby"],rT=["id"],lT=["d","fill","stroke","stroke-width"],sT={name:"MiniMap",compatConfig:{MODE:3}},cT=t.defineComponent({...sT,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:f,getNodesInitialized:y}=qe(),k=t.ref();t.provide(uh,o);const _=t.toRef(()=>{var x;return e.width??((x=i.style)==null?void 0:x.width)??a}),E=t.toRef(()=>{var x;return e.height??((x=i.style)==null?void 0:x.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",p=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),b=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),w=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=t.computed(()=>Ul(y.value.filter(x=>!x.hidden))),$=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(()=>y.value&&y.value.length?S0(A.value,$.value):$.value),T=t.computed(()=>{const x=L.value.width/_.value,z=L.value.height/E.value;return Math.max(x,z)}),S=t.computed(()=>{const x=T.value*_.value,z=T.value*E.value,j=e.offsetScale*T.value;return{offset:j,x:L.value.x-(x-L.value.width)/2-j,y:L.value.y-(z-L.value.height)/2-j,width:x+j*2,height:z+j*2}}),C=t.computed(()=>!S.value.x||!S.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 kt extends Error{constructor(n,...o){var i;super((i=ef[n])==null?void 0:i.call(ef,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function rs(e){return"clientX"in e}function U0(e){return"sourceEvent"in e}function cn(e,n){const o=rs(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 H0(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 Xa(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const j0=()=>!0;function ls(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function K0(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())Ya(a,Ga(r))>0&&i.push(r);return i}const G0=250;function Y0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=K0(e,o,n+G0);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}=Ho(d,m,m.position,!0),y=Math.sqrt((p-e.x)**2+(f-e.y)**2);y>n||(y<s?(l=[{...m,x:p,y:f}],s=y):y===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 tf(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=j0},u,m,p,f){const y=r==="target",_=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:g,y:b}=cn(e),E=l.elementFromPoint(g,b),h=E!=null&&E.classList.contains(`${s}-flow__handle`)?E:_,N={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const w=nf(void 0,h),C=h.getAttribute("data-nodeid"),S=h.getAttribute("data-handleid"),V=h.classList.contains("connectable"),$=h.classList.contains("connectableend");if(!C||!w)return N;const R={source:y?C:i,sourceHandle:y?S:a,target:y?i:C,targetHandle:y?a:S};N.connection=R;const T=V&&$&&(o===En.Strict?y&&w==="source"||!y&&w==="target":C!==i||S!==a);N.isValid=T&&d(R,{nodes:m,edges:u,sourceNode:p(R.source),targetNode:p(R.target)}),N.toHandle=of(C,w,S,f,o,!0)}return N}function nf(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function q0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function W0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function of(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===En.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,...Ho(d,m,m.position,!0)}:m}const ss={[De.Left]:De.Right,[De.Right]:De.Left,[De.Top]:De.Bottom,[De.Bottom]:De.Top},J0=["production","prod"];function Ti(e,...n){af()&&console.warn(`[Vue Flow]: ${e}`,...n)}function af(){return!J0.includes(process.env.NODE_ENV||"")}function rf(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,...qa(l)}}):null}function cs(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 gt(e){return typeof t.unref(e)<"u"}function X0(e,n,o,i){if(!e||!e.source||!e.target)return o(new kt(yt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Dn(e)?a=e:a={...e,id:Lm(e)},a=Dm(a,void 0,i),$0(a,n)?!1:a}function Z0(e,n,o,i,a){if(!n.source||!n.target)return a(new kt(yt.EDGE_INVALID,e.id)),!1;if(!o)return a(new kt(yt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Lm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function lf(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!ro(l)){o(new kt(yt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=x0(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 kt(yt.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 sf(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 ds(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}`;sf("source",c,u,e,a,l),sf("target",c,d,e,r,s)}}function cf(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function us(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=Dn(d)?d:X0(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new kt(yt.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new kt(yt.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new kt(yt.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new kt(yt.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...Dm(u,f,r),sourceNode:m,targetNode:p})}return c}const df=Symbol("vueFlow"),uf=Symbol("nodeId"),mf=Symbol("nodeRef"),Q0=Symbol("edgeId"),eN=Symbol("edgeRef"),Za=Symbol("slots");function ff(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:y,nodesSelectionActive:_,selectNodesOnDrag:g,removeSelectedElements:b,addSelectedNodes:E,updateNodePositions:h,emits:N}=et(),{onStart:w,onDrag:C,onStop:S,onClick:V,el:$,disabled:R,id:x,selectable:T,dragHandle:M}=e,k=t.shallowRef(!1);let v=[],I,O=null,A={x:void 0,y:void 0},L={x:0,y:0},H=null,oe=!1,ue=!1,be=0,pe=!1;const he=oN(),_e=({x:ae,y:me})=>{A={x:ae,y:me};let P=!1;if(v=v.map(D=>{const z={x:ae-D.distance.x,y:me-D.distance.y},{computedPosition:Q}=as(D,o.value?Xa(z,i.value):z,N.error,l.value,D.parentNode?f(D.parentNode):void 0);return P=P||D.position.x!==Q.x||D.position.y!==Q.y,D.position=Q,D}),ue=ue||P,!!P&&(h(v,!0,!0),k.value=!0,H)){const[D,z]=is({id:x,dragItems:v,findNode:f});C({event:H,node:D,nodes:z})}},ye=()=>{if(!O)return;const[ae,me]=Km(L,O,u.value);if(ae!==0||me!==0){const P={x:(A.x??0)-ae/c.value.zoom,y:(A.y??0)-me/c.value.zoom};p({x:ae,y:me})&&_e(P)}be=requestAnimationFrame(ye)},Ae=(ae,me)=>{oe=!0;const P=f(x);!g.value&&!y.value&&P&&(P.selected||b()),P&&t.toValue(T)&&g.value&&cs(P,y.value,E,b,_,!1,me);const D=he(ae.sourceEvent);if(A=D,v=D0(r.value,m.value,D,x),v.length){const[z,Q]=is({id:x,dragItems:v,findNode:f});w({event:ae.sourceEvent,node:z,nodes:Q})}},Fe=(ae,me)=>{var P;ae.sourceEvent.type==="touchmove"&&ae.sourceEvent.touches.length>1||(ue=!1,s.value===0&&Ae(ae,me),A=he(ae.sourceEvent),O=((P=n.value)==null?void 0:P.getBoundingClientRect())||null,L=cn(ae.sourceEvent,O))},se=(ae,me)=>{const P=he(ae.sourceEvent);if(!pe&&oe&&d.value&&(pe=!0,ye()),!oe){const D=P.xSnapped-(A.x??0),z=P.ySnapped-(A.y??0);Math.sqrt(D*D+z*z)>s.value&&Ae(ae,me)}(A.x!==P.xSnapped||A.y!==P.ySnapped)&&v.length&&oe&&(H=ae.sourceEvent,L=cn(ae.sourceEvent,O),_e(P))},ne=ae=>{let me=!1;if(!oe&&!k.value&&!y.value){const P=ae.sourceEvent,D=he(P),z=D.xSnapped-(A.x??0),Q=D.ySnapped-(A.y??0),ee=Math.sqrt(z*z+Q*Q);ee!==0&&ee<=s.value&&(V==null||V(P),me=!0)}if(v.length&&!me){ue&&(h(v,!1,!1),ue=!1);const[P,D]=is({id:x,dragItems:v,findNode:f});S({event:ae.sourceEvent,node:P,nodes:D})}v=[],k.value=!1,pe=!1,oe=!1,A={x:void 0,y:void 0},cancelAnimationFrame(be)};return t.watch([()=>t.toValue(R),$],([ae,me],P,D)=>{if(me){const z=jt(me);ae||(I=SE().on("start",Q=>Fe(Q,me)).on("drag",Q=>se(Q,me)).on("end",Q=>ne(Q)).filter(Q=>{const ee=Q.target,we=t.toValue(M);return!Q.button&&(!a.value||!Xm(ee,`.${a.value}`,me)&&(!we||Xm(ee,we,me)))}),z.call(I)),D(()=>{z.on(".drag",null),I&&(I.on("start",null),I.on("drag",null),I.on("end",null))})}}),k}function tN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),updateStart:Me(),update:Me(),updateEnd:Me()}}function nN(e,n){const o=tN();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 oN(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=et();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=U0(a)?a.sourceEvent:a,{x:c,y:d}=cn(s,l),u=Ri({x:c,y:d},e.value),{x:m,y:p}=o.value?Xa(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function Qa(){return!0}function pf({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:y,autoPanSpeed:_,findNode:g,panBy:b,startConnection:E,updateConnection:h,endConnection:N,emits:w,viewport:C,edges:S,nodes:V,isValidConnection:$,nodeLookup:R}=et();let x=null,T=!1,M=null;function k(I){var O;const A=t.toValue(o)==="target",L=rs(I),H=Bm(I.target),oe=I.currentTarget;if(oe&&(L&&I.button===0||!L)){let ue=function(Ce){P=cn(Ce,ne),_e=Y0(Ri(P,C.value,!1,[1,1]),u.value,R.value,Q),D||(z(),D=!0);const Y=tf(Ce,{handle:_e,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:A?"target":"source",isValidConnection:he,doc:H,lib:"vue",flowId:s,nodeLookup:R.value},S.value,V.value,g,R.value);M=Y.handleDomNode,x=Y.connection,T=W0(!!_e,Y.isValid);const X={...xe,isValid:T,to:Y.toHandle&&T?xi({x:Y.toHandle.x,y:Y.toHandle.y},C.value):P,toHandle:Y.toHandle,toPosition:T&&Y.toHandle?Y.toHandle.position:ss[Q.position],toNode:Y.toHandle?R.value.get(Y.toHandle.nodeId):null};if(T&&_e&&(xe!=null&&xe.toHandle)&&X.toHandle&&xe.toHandle.type===X.toHandle.type&&xe.toHandle.nodeId===X.toHandle.nodeId&&xe.toHandle.id===X.toHandle.id&&xe.to.x===X.to.x&&xe.to.y===X.to.y)return;const q=_e??Y.toHandle;if(h(q&&T?xi({x:q.x,y:q.y},C.value):P,q,q0(!!q,T)),xe=X,!_e&&!T&&!M)return ls(me);x&&x.source!==x.target&&M&&(ls(me),me=M,M.classList.add("connecting","vue-flow__handle-connecting"),M.classList.toggle("valid",!!T),M.classList.toggle("vue-flow__handle-valid",!!T))},be=function(Ce){"touches"in Ce&&Ce.touches.length>0||((_e||M)&&x&&T&&(r?r(Ce,x):w.connect(x)),w.connectEnd(Ce),a&&(l==null||l(Ce)),ls(me),cancelAnimationFrame(ye),N(Ce),D=!1,T=!1,x=null,M=null,H.removeEventListener("mousemove",ue),H.removeEventListener("mouseup",be),H.removeEventListener("touchmove",ue),H.removeEventListener("touchend",be))};const pe=g(t.toValue(n));let he=t.toValue(i)||$.value||Qa;!he&&pe&&(he=(A?pe.isValidSourcePos:pe.isValidTargetPos)||Qa);let _e,ye=0;const{x:Ae,y:Fe}=cn(I),se=nf(t.toValue(a),oe),ne=(O=c.value)==null?void 0:O.getBoundingClientRect();if(!ne||!se)return;const ae=of(t.toValue(n),se,t.toValue(e),R.value,d.value);if(!ae)return;let me,P=cn(I,ne),D=!1;const z=()=>{if(!y.value)return;const[Ce,Y]=Km(P,ne,_.value);b({x:Ce,y:Y}),ye=requestAnimationFrame(z)},Q={...ae,nodeId:t.toValue(n),type:se,position:ae.position},ee=R.value.get(t.toValue(n)),de={inProgress:!0,isValid:null,from:Ho(ee,Q,De.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ee,to:P,toHandle:null,toPosition:ss[Q.position],toNode:null};E({nodeId:t.toValue(n),id:t.toValue(e),type:se,position:(oe==null?void 0:oe.getAttribute("data-handlepos"))||De.Top,...P},{x:Ae-ne.left,y:Fe-ne.top}),w.connectStart({event:I,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:se});let xe=de;H.addEventListener("mousemove",ue),H.addEventListener("mouseup",be),H.addEventListener("touchmove",ue),H.addEventListener("touchend",be)}}function v(I){var O,A;if(!m.value)return;const L=t.toValue(o)==="target";if(!p.value){w.clickConnectStart({event:I,nodeId:t.toValue(n),handleId:t.toValue(e)}),E({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:De.Top,...cn(I)},void 0,!0);return}let H=t.toValue(i)||$.value||Qa;const oe=g(t.toValue(n));if(!H&&oe&&(H=(L?oe.isValidSourcePos:oe.isValidTargetPos)||Qa),oe&&(typeof oe.connectable>"u"?f.value:oe.connectable)===!1)return;const ue=Bm(I.target),be=tf(I,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:De.Top,...cn(I)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:H,doc:ue,lib:"vue",flowId:s,nodeLookup:R.value},S.value,V.value,g,R.value),pe=((O=be.connection)==null?void 0:O.source)===((A=be.connection)==null?void 0:A.target);be.isValid&&be.connection&&!pe&&w.connect(be.connection),w.clickConnectEnd(I),N(I,!0)}return{handlePointerDown:k,handleClick:v}}function iN(){return t.inject(uf,"")}function hf(e){const n=e??iN()??"",o=t.inject(mf,t.ref(null)),{findNode:i,edges:a,emits:r}=et(),l=i(n);return l||r.error(new kt(yt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>lo([l],a.value))}}function aN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),dragStart:Me(),drag:Me(),dragStop:Me()}}function rN(e,n){const o=aN();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 yf(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=et();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,y=c.y*m*p,_=[];for(const g of e.value)if(g.draggable||l&&typeof g.draggable>"u"){const b={x:g.computedPosition.x+f,y:g.computedPosition.y+y},{position:E}=as(g,b,s.error,n.value,g.parentNode?i(g.parentNode):void 0);_.push({id:g.id,position:E,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(_,!0,!1)}}const er=.1,lN=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Pn(){return Ti("Viewport not initialized yet."),Promise.resolve(!1)}const sN={zoomIn:Pn,zoomOut:Pn,zoomTo:Pn,fitView:Pn,setCenter:Pn,fitBounds:Pn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Pn,setTransform:Pn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function cN(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?_i:Da).scaleBy(ms(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}=Vm({x:-i,y:-a},e.translateExtent),m=zo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?_i:Da).transform(ms(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"?_i:Da).scaleTo(ms(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:er,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=ts(s),{x:d,y:u,zoom:m}=Um(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??er);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:er})=>{const{x:l,y:s,zoom:c}=Um(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??er);return o(l,s,c,r)},project:a=>Ri(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 Ri(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 xi(s,e.viewport)}return{x:0,y:0}}}:sN)}function ms(e,n=0,o=lN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function dN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let _,g,b=!!(o.nodes.value.length||o.edges.value.length);_=Bo([e.modelValue,()=>{var E,h;return(h=(E=e.modelValue)==null?void 0:E.value)==null?void 0:h.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setElements(E),!g&&!b&&E.length?b=!0:g==null||g.resume())}),g=Bo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([E,h])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...E,...h],t.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let _,g,b=!!o.nodes.value.length;_=Bo([e.nodes,()=>{var E,h;return(h=(E=e.nodes)==null?void 0:E.value)==null?void 0:h.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setNodes(E),!g&&!b&&E.length?b=!0:g==null||g.resume())}),g=Bo([o.nodes,()=>o.nodes.value.length],([E])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...E],t.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let _,g,b=!!o.edges.value.length;_=Bo([e.edges,()=>{var E,h;return(h=(E=e.edges)==null?void 0:E.value)==null?void 0:h.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setEdges(E),!g&&!b&&E.length?b=!0:g==null||g.resume())}),g=Bo([o.edges,()=>o.edges.value.length],([E])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...E],t.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&>(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&>(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&>(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&>(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{gt(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const _=async g=>{let b=g;typeof n.autoConnect=="function"&&(b=await n.autoConnect(g)),b!==!1&&o.addEdges([b])};t.watch(()=>n.autoConnect,()=>{gt(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(g,b,E)=>{g?o.onConnect(_):o.hooks.value.connect.off(_),E(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},f=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(n)){const b=g;if(!_.includes(b)){const E=t.toRef(()=>n[b]),h=o[b];t.isRef(h)&&i.run(()=>{t.watch(E,N=>{gt(N)&&(h.value=N)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function uN(){return{edgesChange:Me(),nodesChange:Me(),nodeDoubleClick:Me(),nodeClick:Me(),nodeMouseEnter:Me(),nodeMouseMove:Me(),nodeMouseLeave:Me(),nodeContextMenu:Me(),nodeDragStart:Me(),nodeDrag:Me(),nodeDragStop:Me(),nodesInitialized:Me(),miniMapNodeClick:Me(),miniMapNodeDoubleClick:Me(),miniMapNodeMouseEnter:Me(),miniMapNodeMouseMove:Me(),miniMapNodeMouseLeave:Me(),connect:Me(),connectStart:Me(),connectEnd:Me(),clickConnectStart:Me(),clickConnectEnd:Me(),paneReady:Me(),init:Me(),move:Me(),moveStart:Me(),moveEnd:Me(),selectionDragStart:Me(),selectionDrag:Me(),selectionDragStop:Me(),selectionContextMenu:Me(),selectionStart:Me(),selectionEnd:Me(),viewportChangeStart:Me(),viewportChange:Me(),viewportChangeEnd:Me(),paneScroll:Me(),paneClick:Me(),paneContextMenu:Me(),paneMouseEnter:Me(),paneMouseMove:Me(),paneMouseLeave:Me(),edgeContextMenu:Me(),edgeMouseEnter:Me(),edgeMouseMove:Me(),edgeMouseLeave:Me(),edgeDoubleClick:Me(),edgeClick:Me(),edgeUpdateStart:Me(),edgeUpdate:Me(),edgeUpdateEnd:Me(),updateNodeInternals:Me(),error:Me(e=>Ti(e.message))}}function mN(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),fi(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),fi(r.removeHasEmitListeners)}});function i(a){var r;const l=fN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function fN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function gf(){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:Zl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:vi.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:io.Bezier,style:{}},connectionMode:En.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:uN(),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 pN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function hN(e,n,o){const i=cN(e),a=P=>{const D=P??[];e.hooks.updateNodeInternals.trigger(D)},r=P=>A0(P,e.nodes,e.edges),l=P=>R0(P,e.nodes,e.edges),s=P=>lo(P,e.edges),c=({id:P,type:D,nodeId:z})=>{var Q;const ee=P?`-${D}-${P}`:`-${D}`;return Array.from(((Q=e.connectionLookup.get(`${z}${ee}`))==null?void 0:Q.values())??[])},d=P=>{if(P)return n.value.get(P)},u=P=>{if(P)return o.value.get(P)},m=(P,D,z)=>{var Q,ee;const we=[];for(const de of P){const xe={id:de.id,type:"position",dragging:z,from:de.from};if(D&&(xe.position=de.position,de.parentNode)){const Ce=d(de.parentNode);xe.position={x:xe.position.x-(((Q=Ce==null?void 0:Ce.computedPosition)==null?void 0:Q.x)??0),y:xe.position.y-(((ee=Ce==null?void 0:Ce.computedPosition)==null?void 0:ee.y)??0)}}we.push(xe)}we!=null&&we.length&&e.hooks.nodesChange.trigger(we)},p=P=>{if(!e.vueFlowRef)return;const D=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!D)return;const z=window.getComputedStyle(D),{m22:Q}=new window.DOMMatrixReadOnly(z.transform),ee=[];for(const we of P){const de=we,xe=d(de.id);if(xe){const Ce=qa(de.nodeElement);if(!!(Ce.width&&Ce.height&&(xe.dimensions.width!==Ce.width||xe.dimensions.height!==Ce.height||de.forceUpdate))){const X=de.nodeElement.getBoundingClientRect();xe.dimensions=Ce,xe.handleBounds.source=rf("source",de.nodeElement,X,Q,xe.id),xe.handleBounds.target=rf("target",de.nodeElement,X,Q,xe.id),ee.push({id:xe.id,type:"dimensions",dimensions:Ce})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),ee.length&&e.hooks.nodesChange.trigger(ee)},f=(P,D)=>{const z=new Set,Q=new Set;for(const de of P)ro(de)?z.add(de.id):Dn(de)&&Q.add(de.id);const ee=Ln(n.value,z,!0),we=Ln(o.value,Q);if(e.multiSelectionActive){for(const de of z)ee.push(On(de,D));for(const de of Q)we.push(On(de,D))}ee.length&&e.hooks.nodesChange.trigger(ee),we.length&&e.hooks.edgesChange.trigger(we)},y=P=>{if(e.multiSelectionActive){const D=P.map(z=>On(z.id,!0));e.hooks.nodesChange.trigger(D);return}e.hooks.nodesChange.trigger(Ln(n.value,new Set(P.map(D=>D.id)),!0)),e.hooks.edgesChange.trigger(Ln(o.value))},_=P=>{if(e.multiSelectionActive){const D=P.map(z=>On(z.id,!0));e.hooks.edgesChange.trigger(D);return}e.hooks.edgesChange.trigger(Ln(o.value,new Set(P.map(D=>D.id)))),e.hooks.nodesChange.trigger(Ln(n.value,new Set,!0))},g=P=>{f(P,!0)},b=P=>{const z=(P||e.nodes).map(Q=>(Q.selected=!1,On(Q.id,!1)));e.hooks.nodesChange.trigger(z)},E=P=>{const z=(P||e.edges).map(Q=>(Q.selected=!1,On(Q.id,!1)));e.hooks.edgesChange.trigger(z)},h=P=>{if(!P||!P.length)return f([],!1);const D=P.reduce((z,Q)=>{const ee=On(Q.id,!1);return ro(Q)?z.nodes.push(ee):z.edges.push(ee),z},{nodes:[],edges:[]});D.nodes.length&&e.hooks.nodesChange.trigger(D.nodes),D.edges.length&&e.hooks.edgesChange.trigger(D.edges)},N=P=>{var D;(D=e.d3Zoom)==null||D.scaleExtent([P,e.maxZoom]),e.minZoom=P},w=P=>{var D;(D=e.d3Zoom)==null||D.scaleExtent([e.minZoom,P]),e.maxZoom=P},C=P=>{var D;(D=e.d3Zoom)==null||D.translateExtent(P),e.translateExtent=P},S=P=>{e.nodeExtent=P,a()},V=P=>{var D;(D=e.d3Zoom)==null||D.clickDistance(P)},$=P=>{e.nodesDraggable=P,e.nodesConnectable=P,e.elementsSelectable=P},R=P=>{const D=P instanceof Function?P(e.nodes):P;!e.initialized&&!D.length||(e.nodes=lf(D,d,e.hooks.error.trigger))},x=P=>{const D=P instanceof Function?P(e.edges):P;if(!e.initialized&&!D.length)return;const z=us(D,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ds(e.connectionLookup,o.value,z),e.edges=z},T=P=>{const D=P instanceof Function?P([...e.nodes,...e.edges]):P;!e.initialized&&!D.length||(R(D.filter(ro)),x(D.filter(Dn)))},M=P=>{let D=P instanceof Function?P(e.nodes):P;D=Array.isArray(D)?D:[D];const z=lf(D,d,e.hooks.error.trigger),Q=[];for(const ee of z)Q.push(Ym(ee));Q.length&&e.hooks.nodesChange.trigger(Q)},k=P=>{let D=P instanceof Function?P(e.edges):P;D=Array.isArray(D)?D:[D];const z=us(D,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const ee of z)Q.push(Ym(ee));Q.length&&e.hooks.edgesChange.trigger(Q)},v=(P,D=!0,z=!1)=>{const Q=P instanceof Function?P(e.nodes):P,ee=Array.isArray(Q)?Q:[Q],we=[],de=[];function xe(Y){const X=s(Y);for(const q of X)(!gt(q.deletable)||q.deletable)&&de.push(Wm(q.id,q.source,q.target,q.sourceHandle,q.targetHandle))}function Ce(Y){const X=[];for(const q of e.nodes)q.parentNode===Y&&X.push(q);if(X.length){for(const q of X)we.push(qm(q.id));D&&xe(X);for(const q of X)Ce(q.id)}}for(const Y of ee){const X=typeof Y=="string"?d(Y):Y;X&&(gt(X.deletable)&&!X.deletable||(we.push(qm(X.id)),D&&xe([X]),z&&Ce(X.id)))}de.length&&e.hooks.edgesChange.trigger(de),we.length&&e.hooks.nodesChange.trigger(we)},I=P=>{const D=P instanceof Function?P(e.edges):P,z=Array.isArray(D)?D:[D],Q=[];for(const ee of z){const we=typeof ee=="string"?u(ee):ee;we&&(gt(we.deletable)&&!we.deletable||Q.push(Wm(typeof ee=="string"?ee:ee.id,we.source,we.target,we.sourceHandle,we.targetHandle)))}e.hooks.edgesChange.trigger(Q)},O=(P,D,z=!0)=>{const Q=u(P.id);if(!Q)return!1;const ee=e.edges.indexOf(Q),we=Z0(P,D,Q,z,e.hooks.error.trigger);if(we){const[de]=us([we],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((xe,Ce)=>Ce===ee?de:xe),ds(e.connectionLookup,o.value,[de]),de}return!1},A=(P,D,z={replace:!1})=>{const Q=u(P);if(!Q)return;const ee=typeof D=="function"?D(Q):D;Q.data=z.replace?ee:{...Q.data,...ee}},L=P=>Gm(P,e.nodes),H=P=>{const D=Gm(P,e.edges);return ds(e.connectionLookup,o.value,D),D},oe=(P,D,z={replace:!1})=>{const Q=d(P);if(!Q)return;const ee=typeof D=="function"?D(Q):D;z.replace?e.nodes.splice(e.nodes.indexOf(Q),1,ee):Object.assign(Q,ee)},ue=(P,D,z={replace:!1})=>{const Q=d(P);if(!Q)return;const ee=typeof D=="function"?D(Q):D;Q.data=z.replace?ee:{...Q.data,...ee}},be=(P,D,z=!1)=>{z?e.connectionClickStartHandle=P:e.connectionStartHandle=P,e.connectionEndHandle=null,e.connectionStatus=null,D&&(e.connectionPosition=D)},pe=(P,D=null,z=null)=>{e.connectionStartHandle&&(e.connectionPosition=P,e.connectionEndHandle=D,e.connectionStatus=z)},he=(P,D)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,D?e.connectionClickStartHandle=null:e.connectionStartHandle=null},_e=P=>{const D=S0(P),z=D?null:Si(P)?P:d(P.id);return!D&&!z?[null,null,D]:[D?P:Ga(z),z,D]},ye=(P,D=!0,z=e.nodes)=>{const[Q,ee,we]=_e(P);if(!Q)return[];const de=[];for(const xe of z||e.nodes){if(!we&&(xe.id===ee.id||!xe.computedPosition))continue;const Ce=Ga(xe),Y=Ya(Ce,Q);(D&&Y>0||Y>=Ce.width*Ce.height||Y>=Number(Q.width)*Number(Q.height))&&de.push(xe)}return de},Ae=(P,D,z=!0)=>{const[Q]=_e(P);if(!Q)return!1;const ee=Ya(Q,D);return z&&ee>0||ee>=Number(Q.width)*Number(Q.height)},Fe=P=>{const{viewport:D,dimensions:z,d3Zoom:Q,d3Selection:ee,translateExtent:we}=e;if(!Q||!ee||!P.x&&!P.y)return!1;const de=zo.translate(D.x+P.x,D.y+P.y).scale(D.zoom),xe=[[0,0],[z.width,z.height]],Ce=Q.constrain()(de,xe,we),Y=e.viewport.x!==Ce.x||e.viewport.y!==Ce.y||e.viewport.zoom!==Ce.k;return Q.transform(ee,Ce),Y},se=P=>{const D=P instanceof Function?P(e):P,z=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];gt(D.defaultEdgeOptions)&&(e.defaultEdgeOptions=D.defaultEdgeOptions);const Q=D.modelValue||D.nodes||D.edges?[]:void 0;Q&&(D.modelValue&&Q.push(...D.modelValue),D.nodes&&Q.push(...D.nodes),D.edges&&Q.push(...D.edges),T(Q));const ee=()=>{gt(D.maxZoom)&&w(D.maxZoom),gt(D.minZoom)&&N(D.minZoom),gt(D.translateExtent)&&C(D.translateExtent)};for(const we of Object.keys(D)){const de=we,xe=D[de];![...pN,...z].includes(de)&>(xe)&&(e[de]=xe)}$l(()=>e.d3Zoom).not.toBeNull().then(ee),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:T,setNodes:R,setEdges:x,addNodes:M,addEdges:k,removeNodes:v,removeEdges:I,findNode:d,findEdge:u,updateEdge:O,updateEdgeData:A,updateNode:oe,updateNodeData:ue,applyEdgeChanges:H,applyNodeChanges:L,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:_,setMinZoom:N,setMaxZoom:w,setTranslateExtent:C,setNodeExtent:S,setPaneClickDistance:V,removeSelectedElements:h,removeSelectedNodes:b,removeSelectedEdges:E,startConnection:be,updateConnection:pe,endConnection:he,setInteractive:$,setState:se,getIntersectingNodes:ye,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ae,panBy:Fe,fitView:P=>i.value.fitView(P),zoomIn:P=>i.value.zoomIn(P),zoomOut:P=>i.value.zoomOut(P),zoomTo:(P,D)=>i.value.zoomTo(P,D),setViewport:(P,D)=>i.value.setViewport(P,D),setTransform:(P,D)=>i.value.setTransform(P,D),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(P,D,z)=>i.value.setCenter(P,D,z),fitBounds:(P,D)=>i.value.fitBounds(P,D),project:P=>i.value.project(P),screenToFlowCoordinate:P=>i.value.screenToFlowCoordinate(P),flowToScreenCoordinate:P=>i.value.flowToScreenCoordinate(P),toObject:()=>{const P=[],D=[];for(const z of e.nodes){const{computedPosition:Q,handleBounds:ee,selected:we,dimensions:de,isParent:xe,resizing:Ce,dragging:Y,events:X,...q}=z;P.push(q)}for(const z of e.edges){const{selected:Q,sourceNode:ee,targetNode:we,events:de,...xe}=z;D.push(xe)}return JSON.parse(JSON.stringify({nodes:P,edges:D,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:P=>new Promise(D=>{const{nodes:z,edges:Q,position:ee,zoom:we,viewport:de}=P;z&&R(z),Q&&x(Q);const[xe,Ce]=de!=null&&de.x&&(de!=null&&de.y)?[de.x,de.y]:ee??[null,null];if(xe&&Ce){const Y=(de==null?void 0:de.zoom)||we||e.viewport.zoom;return $l(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:xe,y:Ce,zoom:Y}).then(()=>{D(!0)})})}else D(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const P=gf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const D=zo.translate(P.defaultViewport.x??0,P.defaultViewport.y??0).scale(ao(P.defaultViewport.zoom??1,P.minZoom,P.maxZoom)),z=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[z.width,z.height]],ee=e.d3Zoom.constrain()(D,Q,P.translateExtent);e.d3Zoom.transform(e.d3Selection,ee)}se(P)},$destroy:()=>{}}}const yN=["data-id","data-handleid","data-nodeid","data-handlepos"],gN={name:"Handle",compatConfig:{MODE:3}},so=t.defineComponent({...gN,props:{id:{default:null},type:{},position:{default:()=>De.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}=et(),{id:f,node:y,nodeEl:_,connectedEdges:g}=hf(),b=t.ref(),E=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=t.toRef(()=>{var x,T,M,k,v,I;return((x=l.value)==null?void 0:x.nodeId)===f&&((T=l.value)==null?void 0:T.id)===e.id&&((M=l.value)==null?void 0:M.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===f&&((v=c.value)==null?void 0:v.id)===e.id&&((I=c.value)==null?void 0:I.type)===i.value}),w=t.toRef(()=>{var x,T,M;return((x=s.value)==null?void 0:x.nodeId)===f&&((T=s.value)==null?void 0:T.id)===e.id&&((M=s.value)==null?void 0:M.type)===i.value}),{handlePointerDown:C,handleClick:S}=pf({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),V=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(x=>{const T=x[`${i.value}Handle`];return x[i.value]!==f?!1:T?T===e.id:!0}):typeof e.connectable=="number"?g.value.filter(x=>{const T=x[`${i.value}Handle`];return x[i.value]!==f?!1:T?T===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,g.value):gt(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var x;if(!y.dimensions.width||!y.dimensions.height)return;const T=(x=y.handleBounds[i.value])==null?void 0:x.find(L=>L.id===e.id);if(!d.value||T)return;const M=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!b.value||!M||!e.id)return;const k=_.value.getBoundingClientRect(),v=b.value.getBoundingClientRect(),I=window.getComputedStyle(M),{m22:O}=new window.DOMMatrixReadOnly(I.transform),A={id:e.id,position:e.position,x:(v.left-k.left)/O,y:(v.top-k.top)/O,type:i.value,nodeId:f,...qa(b.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],A]});function $(x){const T=rs(x);V.value&&E.value&&(T&&x.button===0||!T)&&C(x)}function R(x){!f||!s.value&&!E.value||V.value&&S(x)}return n({handleClick:S,handlePointerDown:C,onClick:R,onPointerDown:$}),(x,T)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":x.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${x.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:V.value,connecting:w.value,connectablestart:E.value,connectableend:h.value,connectionindicator:V.value&&(E.value&&!N.value||h.value&&N.value)}]]),onMousedown:$,onTouchstartPassive:$,onClick:R},[t.renderSlot(x.$slots,"default",{id:x.id})],42,yN))}}),tr=function({sourcePosition:e=De.Bottom,targetPosition:n=De.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(so,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(so,{type:"source",position:e,connectable:i,isValidConnection:r})]};tr.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],tr.inheritAttrs=!1,tr.compatConfig={MODE:3};const bN=tr,nr=function({targetPosition:e=De.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(so,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};nr.props=["targetPosition","label","isValidTargetPos","connectable","data"],nr.inheritAttrs=!1,nr.compatConfig={MODE:3};const _N=nr,or=function({sourcePosition:e=De.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(so,{type:"source",position:e,connectable:o,isValidConnection:i})]};or.props=["sourcePosition","label","isValidSourcePos","connectable","data"],or.inheritAttrs=!1,or.compatConfig={MODE:3};const kN=or,EN=["transform"],NN=["width","height","x","y","rx","ry"],wN=["y"],IN={name:"EdgeText",compatConfig:{MODE:3}},vN=t.defineComponent({...IN,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,NN)):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,wN)],8,EN))}}),CN=["id","d","marker-end","marker-start"],SN=["d","stroke-width"],xN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ir=t.defineComponent({...xN,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,CN),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(vN,{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 bf({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 _f({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 ar(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function kf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case De.Left:l=n-ar(n-i,r),s=o;break;case De.Right:l=n+ar(i-n,r),s=o;break;case De.Top:l=n,s=o-ar(o-a,r);break;case De.Bottom:l=n,s=o+ar(a-o,r);break}return[l,s]}function Ef(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top,curvature:s=.25}=e,[c,d]=kf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=kf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,y,_]=_f({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,y,_]}function Nf({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case De.Left:case De.Right:r=.5*(n+i),l=o;break;case De.Top:case De.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function wf(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top}=e,[s,c]=Nf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=Nf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,y]=_f({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,y]}const If={[De.Left]:{x:-1,y:0},[De.Right]:{x:1,y:0},[De.Top]:{x:0,y:-1},[De.Bottom]:{x:0,y:1}};function RN({source:e,sourcePosition:n=De.Bottom,target:o}){return n===De.Left||n===De.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 vf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function AN({source:e,sourcePosition:n=De.Bottom,target:o,targetPosition:i=De.Top,center:a,offset:r}){const l=If[n],s=If[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=RN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,y,_;const g={x:0,y:0},b={x:0,y:0},[E,h,N,w]=bf({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??E,_=a.y??h;const S=[{x:y,y:c.y},{x:y,y:d.y}],V=[{x:c.x,y:_},{x:d.x,y:_}];l[m]===p?f=m==="x"?S:V:f=m==="x"?V:S}else{const S=[{x:c.x,y:d.y}],V=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?V:S:f=l.y===p?S:V,n===i){const M=Math.abs(e[m]-o[m]);if(M<=r){const k=Math.min(r-1,r-M);l[m]===p?g[m]=(c[m]>e[m]?-1:1)*k:b[m]=(d[m]>o[m]?-1:1)*k}}if(n!==i){const M=m==="x"?"y":"x",k=l[m]===s[M],v=c[M]>d[M],I=c[M]<d[M];(l[m]===1&&(!k&&v||k&&I)||l[m]!==1&&(!k&&I||k&&v))&&(f=m==="x"?S:V)}const $={x:c.x+g.x,y:c.y+g.y},R={x:d.x+b.x,y:d.y+b.y},x=Math.max(Math.abs($.x-f[0].x),Math.abs(R.x-f[0].x)),T=Math.max(Math.abs($.y-f[0].y),Math.abs(R.y-f[0].y));x>=T?(y=($.x+R.x)/2,_=f[0].y):(y=f[0].x,_=($.y+R.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...f,{x:d.x+b.x,y:d.y+b.y},o],y,_,N,w]}function $N(e,n,o,i){const a=Math.min(vf(e,n)/2,vf(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 fs(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,y,_]=AN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((b,E,h)=>{let N;return h>0&&h<m.length-1?N=$N(m[h-1],E,m[h+1],s):N=`${h===0?"M":"L"}${E.x} ${E.y}`,b+=N,b},""),p,f,y,_]}function TN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=bf({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const MN=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]=TN(e);return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),Cf=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]=fs({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),VN=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(Cf,{...e,...n,borderRadius:0})}}),BN=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]=Ef({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),DN=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]=wf({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),ON={input:kN,default:bN,output:_N},LN={default:BN,straight:MN,step:VN,smoothstep:Cf,simplebezier:DN};function PN(e,n,o){const i=t.computed(()=>_=>n.value.get(_)),a=t.computed(()=>_=>o.value.get(_)),r=t.computed(()=>{const _={...LN,...e.edgeTypes},g=Object.keys(_);for(const b of e.edges)b.type&&!g.includes(b.type)&&(_[b.type]=b.type);return _}),l=t.computed(()=>{const _={...ON,...e.nodeTypes},g=Object.keys(_);for(const b of e.nodes)b.type&&!g.includes(b.type)&&(_[b.type]=b.type);return _}),s=t.computed(()=>e.onlyRenderVisibleElements?Fm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const g of e.edges){const b=n.value.get(g.source),E=n.value.get(g.target);z0({sourcePos:b.computedPosition||{x:0,y:0},targetPos:E.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:E.dimensions.width,targetHeight:E.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(g)}return _}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const _=[];for(const g of e.nodes)g.selected&&_.push(g);return _}),m=t.computed(()=>{const _=[];for(const g of e.edges)g.selected&&_.push(g);return _}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const _=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&_.push(g);return _}),y=t.computed(()=>s.value.length>0&&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:y}}class co{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)??co.instance;return co.instance=i??new co,o&&(o.config.globalProperties.$vueFlowStorage=co.instance),co.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=gf(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const y=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[y]=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=PN(a,s,c),u=hN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...D_(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 et(e){const n=co.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(df,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 y=g=>{d.applyNodeChanges(g)},_=g=>{d.applyEdgeChanges(g)};m?(d.onNodesChange(y),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(_)),f(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),fi(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ti(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(df,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new kt(yt.USEVUEFLOW_OPTIONS))}return s}function zN(e){const{emits:n,dimensions:o}=et();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=qa(e.value);(s.width===0||s.height===0)&&n.error(new kt(yt.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 FN={name:"UserSelection",compatConfig:{MODE:3}},UN=t.defineComponent({...FN,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))}}),HN=["tabIndex"],jN={name:"NodesSelection",compatConfig:{MODE:3}},KN=t.defineComponent({...jN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=et(),s=yf(),c=t.ref(null),d=ff({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(()=>ts(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(y){n.selectionContextMenu({event:y,nodes:i.value})}function f(y){r.value||Fo[y.key]&&(y.preventDefault(),s({x:Fo[y.key].x,y:Fo[y.key].y},y.shiftKey))}return(y,_)=>!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,HN)],6)):t.createCommentVNode("",!0)}});function GN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const YN={name:"Pane",compatConfig:{MODE:3}},qN=t.defineComponent({...YN,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:y,deleteKeyCode:_,multiSelectionKeyCode:g,multiSelectionActive:b,edgeLookup:E,nodeLookup:h,connectionLookup:N,defaultEdgeOptions:w,connectionStartHandle:C,panOnDrag:S}=et(),V=t.shallowRef(null),$=t.shallowRef(new Set),R=t.shallowRef(new Set),x=t.shallowRef(null),T=t.toRef(()=>c.value&&(e.isSelecting||r.value)),M=t.toRef(()=>C.value!==null);let k=!1,v=!1;const I=Ci(_,{actInsideInputWithModifier:!1}),O=Ci(g);t.watch(I,he=>{he&&(p(m.value),f(u.value),d.value=!1)}),t.watch(O,he=>{b.value=he});function A(he,_e){return ye=>{ye.target===_e&&(he==null||he(ye))}}function L(he){if(k||M.value){k=!1;return}a.paneClick(he),l(),d.value=!1}function H(he){var _e;if(Array.isArray(S.value)&&((_e=S.value)!=null&&_e.includes(2))){he.preventDefault();return}a.paneContextMenu(he)}function oe(he){a.paneScroll(he)}function ue(he){var _e,ye,Ae;if(x.value=((_e=n.value)==null?void 0:_e.getBoundingClientRect())??null,!c.value||!e.isSelecting||he.button!==0||he.target!==V.value||!x.value)return;(Ae=(ye=he.target)==null?void 0:ye.setPointerCapture)==null||Ae.call(ye,he.pointerId);const{x:Fe,y:se}=GN(he,x.value);v=!0,k=!1,l(),s.value={width:0,height:0,startX:Fe,startY:se,x:Fe,y:se},a.selectionStart(he)}function be(he){var _e;if(!x.value||!s.value)return;k=!0;const{x:ye,y:Ae}=cn(he,x.value),{startX:Fe=0,startY:se=0}=s.value,ne={startX:Fe,startY:se,x:ye<Fe?ye:Fe,y:Ae<se?Ae:se,width:Math.abs(ye-Fe),height:Math.abs(Ae-se)},ae=$.value,me=R.value;$.value=new Set(Fm(o.value,ne,i.value,y.value===Zl.Partial,!0).map(D=>D.id)),R.value=new Set;const P=((_e=w.value)==null?void 0:_e.selectable)??!0;for(const D of $.value){const z=N.value.get(D);if(z)for(const{edgeId:Q}of z.values()){const ee=E.value.get(Q);ee&&(ee.selectable??P)&&R.value.add(Q)}}if(!cf(ae,$.value)){const D=Ln(h.value,$.value,!0);a.nodesChange(D)}if(!cf(me,R.value)){const D=Ln(E.value,R.value);a.edgesChange(D)}s.value=ne,r.value=!0,d.value=!1}function pe(he){var _e;he.button!==0||!v||((_e=he.target)==null||_e.releasePointerCapture(he.pointerId),!r.value&&s.value&&he.target===V.value&&L(he),r.value=!1,s.value=null,d.value=$.value.size>0,a.selectionEnd(he),e.selectionKeyPressed&&(k=!1),v=!1)}return(he,_e)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:V,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:he.isSelecting}]),onClick:_e[0]||(_e[0]=ye=>T.value?void 0:A(L,V.value)(ye)),onContextmenu:_e[1]||(_e[1]=ye=>A(H,V.value)(ye)),onWheelPassive:_e[2]||(_e[2]=ye=>A(oe,V.value)(ye)),onPointerenter:_e[3]||(_e[3]=ye=>T.value?void 0:t.unref(a).paneMouseEnter(ye)),onPointerdown:_e[4]||(_e[4]=ye=>T.value?ue(ye):t.unref(a).paneMouseMove(ye)),onPointermove:_e[5]||(_e[5]=ye=>T.value?be(ye):t.unref(a).paneMouseMove(ye)),onPointerup:_e[6]||(_e[6]=ye=>T.value?pe(ye):void 0),onPointerleave:_e[7]||(_e[7]=ye=>t.unref(a).paneMouseLeave(ye))},[t.renderSlot(he.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(UN,{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(KN,{key:1})):t.createCommentVNode("",!0)],34))}}),WN={name:"Transform",compatConfig:{MODE:3}},JN=t.defineComponent({...WN,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=et(),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))}}),XN={name:"Viewport",compatConfig:{MODE:3}},ZN=t.defineComponent({...XN,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:y,preventScrolling:_,noWheelClassName:g,noPanClassName:b,emits:E,connectionStartHandle:h,userSelectionActive:N,paneDragging:w,d3Zoom:C,d3Selection:S,d3ZoomHandler:V,viewport:$,viewportRef:R,paneClickDistance:x}=et();zN(R);const T=t.shallowRef(!1),M=t.shallowRef(!1);let k=null,v=!1,I=0,O={x:0,y:0,zoom:0};const A=Ci(s),L=Ci(l),H=Ci(r),oe=t.toRef(()=>(!L.value||L.value&&l.value===!0)&&(A.value||m.value)),ue=t.toRef(()=>A.value||c.value),be=t.toRef(()=>l.value===!0&&oe.value!==!0),pe=t.toRef(()=>L.value&&l.value!==!0||N.value||be.value),he=t.toRef(()=>h.value!==null);t.onMounted(()=>{if(!R.value){Ti("Viewport element is missing");return}const se=R.value,ne=se.getBoundingClientRect(),ae=k0().clickDistance(x.value).scaleExtent([n.value,o.value]).translateExtent(a.value),me=jt(se).call(ae),P=me.on("wheel.zoom"),D=zo.translate(i.value.x??0,i.value.y??0).scale(ao(i.value.zoom??1,n.value,o.value)),z=[[0,0],[ne.width,ne.height]],Q=ae.constrain()(D,z,a.value);ae.transform(me,Q),ae.wheelDelta(ns),C.value=ae,S.value=me,V.value=P,$.value={x:Q.x,y:Q.y,zoom:Q.k},ae.on("start",ee=>{var we;if(!ee.sourceEvent)return null;I=ee.sourceEvent.button,T.value=!0;const de=Ae(ee.transform);((we=ee.sourceEvent)==null?void 0:we.type)==="mousedown"&&(w.value=!0),O=de,E.viewportChangeStart(de),E.moveStart({event:ee,flowTransform:de})}),ae.on("end",ee=>{if(!ee.sourceEvent)return null;if(T.value=!1,w.value=!1,_e(oe.value,I??0)&&!v&&E.paneContextMenu(ee.sourceEvent),v=!1,ye(O,ee.transform)){const we=Ae(ee.transform);O=we,E.viewportChangeEnd(we),E.moveEnd({event:ee,flowTransform:we})}}),ae.filter(ee=>{var we;const de=H.value||y.value,xe=f.value&&ee.ctrlKey,Ce=ee.button,Y=ee.type==="wheel";if(Ce===1&&ee.type==="mousedown"&&(Fe(ee,"vue-flow__node")||Fe(ee,"vue-flow__edge")))return!0;if(!oe.value&&!de&&!ue.value&&!p.value&&!f.value||N.value||he.value&&!Y||!p.value&&ee.type==="dblclick"||Fe(ee,g.value)&&Y||Fe(ee,b.value)&&(!Y||ue.value&&Y&&!H.value)||!f.value&&ee.ctrlKey&&Y||!de&&!ue.value&&!xe&&Y)return!1;if(!f&&ee.type==="touchstart"&&((we=ee.touches)==null?void 0:we.length)>1)return ee.preventDefault(),!1;if(!oe.value&&(ee.type==="mousedown"||ee.type==="touchstart")||be.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ce===0||Array.isArray(m.value)&&!m.value.includes(Ce)&&(ee.type==="mousedown"||ee.type==="touchstart"))return!1;const X=Array.isArray(m.value)&&m.value.includes(Ce)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ce||Ce<=1;return(!ee.ctrlKey||A.value||Y)&&X}),t.watch([N,oe],()=>{N.value&&!T.value?ae.on("zoom",null):N.value||ae.on("zoom",ee=>{$.value={x:ee.transform.x,y:ee.transform.y,zoom:ee.transform.k};const we=Ae(ee.transform);v=_e(oe.value,I??0),E.viewportChange(we),E.move({event:ee,flowTransform:we})})},{immediate:!0}),t.watch([N,ue,d,H,f,_,g],()=>{ue.value&&!H.value&&!N.value?me.on("wheel.zoom",ee=>{if(Fe(ee,g.value))return!1;const we=H.value||y.value,de=f.value&&ee.ctrlKey;if(!(!_.value||ue.value||we||de))return!1;ee.preventDefault(),ee.stopImmediatePropagation();const Ce=me.property("__zoom").k||1,Y=$i();if(!A.value&&ee.ctrlKey&&f.value&&Y){const ze=an(ee),Ue=ns(ee),ie=Ce*2**Ue;ae.scaleTo(me,ie,ze,ee);return}const X=ee.deltaMode===1?20:1;let q=d.value===vi.Vertical?0:ee.deltaX*X,Ie=d.value===vi.Horizontal?0:ee.deltaY*X;!Y&&ee.shiftKey&&d.value!==vi.Vertical&&!q&&Ie&&(q=Ie,Ie=0),ae.translateBy(me,-(q/Ce)*u.value,-(Ie/Ce)*u.value);const Be=Ae(me.property("__zoom"));k&&clearTimeout(k),M.value?(E.move({event:ee,flowTransform:Be}),E.viewportChange(Be),k=setTimeout(()=>{E.moveEnd({event:ee,flowTransform:Be}),E.viewportChangeEnd(Be),M.value=!1},150)):(M.value=!0,E.moveStart({event:ee,flowTransform:Be}),E.viewportChangeStart(Be))},{passive:!1}):typeof P<"u"&&me.on("wheel.zoom",function(ee,we){const de=!_.value&&ee.type==="wheel"&&!ee.ctrlKey,xe=H.value||y.value,Ce=f.value&&ee.ctrlKey;if(!xe&&!c.value&&!Ce&&ee.type==="wheel"||de||Fe(ee,g.value))return null;ee.preventDefault(),P.call(this,ee,we)},{passive:!1})},{immediate:!0})});function _e(se,ne){return ne===2&&Array.isArray(se)&&se.includes(2)}function ye(se,ne){return se.x!==ne.x&&!Number.isNaN(ne.x)||se.y!==ne.y&&!Number.isNaN(ne.y)||se.zoom!==ne.k&&!Number.isNaN(ne.k)}function Ae(se){return{x:se.x,y:se.y,zoom:se.k}}function Fe(se,ne){return se.target.closest(`.${ne}`)}return(se,ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:R,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(qN,{"is-selecting":pe.value,"selection-key-pressed":t.unref(L),class:t.normalizeClass({connecting:he.value,dragging:t.unref(w),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(JN,null,{default:t.withCtx(()=>[t.renderSlot(se.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),QN=["id"],ew=["id"],tw=["id"],nw={name:"A11yDescriptions",compatConfig:{MODE:3}},ow=t.defineComponent({...nw,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=et();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref($m)}-${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,QN),t.createElementVNode("div",{id:`${t.unref(Tm)}-${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,ew),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(C0)}-${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,tw))],64))}});function iw(){const e=et();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function aw(e,n,o){return o===De.Left?e-n:o===De.Right?e+n:e}function rw(e,n,o){return o===De.Top?e-n:o===De.Bottom?e+n:e}const ps=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=De.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:aw(n,e,i),cy:rw(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ps.props=["radius","centerX","centerY","position","type"],ps.compatConfig={MODE:3};const Sf=ps,lw=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:y,elementsSelectable:_,edgesUpdatable:g,edgesFocusable:b,hooks:E}=et(),h=t.computed(()=>u(e.id)),{emit:N,on:w}=nN(h.value,r),C=t.inject(Za),S=t.getCurrentInstance(),V=t.ref(!1),$=t.ref(!1),R=t.ref(""),x=t.ref(null),T=t.ref("source"),M=t.ref(null),k=t.toRef(()=>typeof h.value.selectable>"u"?_.value:h.value.selectable),v=t.toRef(()=>typeof h.value.updatable>"u"?g.value:h.value.updatable),I=t.toRef(()=>typeof h.value.focusable>"u"?b.value:h.value.focusable);t.provide(Q0,e.id),t.provide(eN,M);const O=t.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),A=t.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),L=t.computed(()=>{const D=h.value.type||"default",z=C==null?void 0:C[`edge-${D}`];if(z)return z;let Q=h.value.template??c.value[D];if(typeof Q=="string"&&S){const ee=Object.keys(S.appContext.components);ee&&ee.includes(D)&&(Q=t.resolveComponent(D,!1))}return Q&&typeof Q!="string"?Q:(r.error(new kt(yt.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:H}=pf({nodeId:R,handleId:x,type:T,isValidConnection:p,edgeUpdaterType:T,onEdgeUpdate:be,onEdgeUpdateEnd:pe});return()=>{const D=m(h.value.source),z=m(h.value.target),Q="pathOptions"in h.value?h.value.pathOptions:{};if(!D&&!z)return r.error(new kt(yt.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!D)return r.error(new kt(yt.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!z)return r.error(new kt(yt.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||D.hidden||z.hidden)return null;let ee;i.value===En.Strict?ee=D.handleBounds.source:ee=[...D.handleBounds.source||[],...D.handleBounds.target||[]];const we=Qm(ee,h.value.sourceHandle);let de;i.value===En.Strict?de=z.handleBounds.target:de=[...z.handleBounds.target||[],...z.handleBounds.source||[]];const xe=Qm(de,h.value.targetHandle),Ce=(we==null?void 0:we.position)||De.Bottom,Y=(xe==null?void 0:xe.position)||De.Top,{x:X,y:q}=Ho(D,we,Ce),{x:Ie,y:Be}=Ho(z,xe,Y);return h.value.sourceX=X,h.value.sourceY=q,h.value.targetX=Ie,h.value.targetY=Be,t.h("g",{ref:M,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${L.value===!1?"default":h.value.type||"default"}`,s.value,O.value,{updating:V.value,selected:h.value.selected,animated:h.value.animated,inactive:!k.value&&!E.value.edgeClick.hasListeners()}],tabIndex:I.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":I.value?`${Tm}-${n}`:void 0,"aria-roledescription":"edge",role:I.value?"group":"img",...h.value.domAttributes,onClick:_e,onContextmenu:ye,onDblclick:Ae,onMouseenter:Fe,onMousemove:se,onMouseleave:ne,onKeyDown:I.value?P:void 0},[$.value?null:t.h(L.value===!1?c.value.default:L.value,{id:e.id,sourceNode:D,targetNode:z,source:h.value.source,target:h.value.target,type:h.value.type,updatable:v.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...w},style:A.value,markerStart:`url('#${Ai(h.value.markerStart,n)}')`,markerEnd:`url('#${Ai(h.value.markerEnd,n)}')`,sourcePosition:Ce,targetPosition:Y,sourceX:X,sourceY:q,targetX:Ie,targetY:Be,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...Q}),[v.value==="source"||v.value===!0?[t.h("g",{onMousedown:ae,onMouseenter:oe,onMouseout:ue},t.h(Sf,{position:Ce,centerX:X,centerY:q,radius:a.value,type:"source","data-type":"source"}))]:null,v.value==="target"||v.value===!0?[t.h("g",{onMousedown:me,onMouseenter:oe,onMouseout:ue},t.h(Sf,{position:Y,centerX:Ie,centerY:Be,radius:a.value,type:"target","data-type":"target"}))]:null]])};function oe(){V.value=!0}function ue(){V.value=!1}function be(D,z){N.update({event:D,edge:h.value,connection:z})}function pe(D){N.updateEnd({event:D,edge:h.value}),$.value=!1}function he(D,z){D.button===0&&($.value=!0,R.value=z?h.value.target:h.value.source,x.value=(z?h.value.targetHandle:h.value.sourceHandle)??null,T.value=z?"target":"source",N.updateStart({event:D,edge:h.value}),H(D))}function _e(D){var z;const Q={event:D,edge:h.value};k.value&&(l.value=!1,h.value.selected&&f.value?(d([h.value]),(z=M.value)==null||z.blur()):o([h.value])),N.click(Q)}function ye(D){N.contextMenu({event:D,edge:h.value})}function Ae(D){N.doubleClick({event:D,edge:h.value})}function Fe(D){N.mouseEnter({event:D,edge:h.value})}function se(D){N.mouseMove({event:D,edge:h.value})}function ne(D){N.mouseLeave({event:D,edge:h.value})}function ae(D){he(D,!0)}function me(D){he(D,!1)}function P(D){var z;!y.value&&Mm.includes(D.key)&&k.value&&(D.key==="Escape"?((z=M.value)==null||z.blur(),d([u(e.id)])):o([u(e.id)]))}}}),sw=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}=et(),p=(e=t.inject(Za))==null?void 0:e["connection-line"],f=t.computed(()=>{var E;return m((E=i.value)==null?void 0:E.nodeId)}),y=t.computed(()=>{var E;return m((E=a.value)==null?void 0:E.nodeId)??null}),_=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),g=t.computed(()=>c.value.markerStart?`url(#${Ai(c.value.markerStart,n)})`:""),b=t.computed(()=>c.value.markerEnd?`url(#${Ai(c.value.markerEnd,n)})`:"");return()=>{var E,h,N;if(!f.value||!i.value)return null;const w=i.value.id,C=i.value.type,S=f.value.handleBounds;let V=(S==null?void 0:S[C])??[];if(o.value===En.Loose){const A=(S==null?void 0:S[C==="source"?"target":"source"])??[];V=[...V,...A]}if(!V)return null;const $=(w?V.find(A=>A.id===w):V[0])??null,R=($==null?void 0:$.position)??De.Top,{x,y:T}=Ho(f.value,$,R);let M=null;y.value&&(o.value===En.Strict?M=((E=y.value.handleBounds[C==="source"?"target":"source"])==null?void 0:E.find(A=>{var L;return A.id===((L=a.value)==null?void 0:L.id)}))||null:M=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(A=>{var L;return A.id===((L=a.value)==null?void 0:L.id)}))||null);const k=((N=a.value)==null?void 0:N.position)??(R?ss[R]:null);if(!R||!k)return null;const v=l.value??c.value.type??io.Bezier;let I="";const O={sourceX:x,sourceY:T,sourcePosition:R,targetX:_.value.x,targetY:_.value.y,targetPosition:k};return v===io.Bezier?[I]=Ef(O):v===io.Step?[I]=fs({...O,borderRadius:0}):v===io.SmoothStep?[I]=fs(O):v===io.SimpleBezier?[I]=wf(O):I=`M${x},${T} ${_.value.x},${_.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:x,sourceY:T,sourcePosition:R,targetX:_.value.x,targetY:_.value.y,targetPosition:k,sourceNode:f.value,sourceHandle:$,targetNode:y.value,targetHandle:M,markerEnd:b.value,markerStart:g.value,connectionStatus:d.value}):t.h("path",{d:I,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":g.value})))}}}),cw=["id","markerWidth","markerHeight","markerUnits","orient"],dw={name:"MarkerType",compatConfig:{MODE:3}},uw=t.defineComponent({...dw,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(Ql).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(Ql).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,cw))}}),mw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},fw={name:"MarkerDefinitions",compatConfig:{MODE:3}},pw=t.defineComponent({...fw,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=et(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Ai(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",mw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(uw,{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))])]))}}),hw={name:"Edges",compatConfig:{MODE:3}},yw=t.defineComponent({...hw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=et();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(pw),(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(F0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(lw),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(sw))],64))}}),gw=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:y,ariaLiveMessage:_,snapToGrid:g,snapGrid:b,nodeDragThreshold:E,nodesDraggable:h,elementsSelectable:N,nodesConnectable:w,nodesFocusable:C,hooks:S}=et(),V=t.ref(null);t.provide(mf,V),t.provide(uf,e.id);const $=t.inject(Za),R=t.getCurrentInstance(),x=yf(),{node:T,parentNode:M}=hf(e.id),{emit:k,on:v}=rN(T,l),I=t.toRef(()=>typeof T.draggable>"u"?h.value:T.draggable),O=t.toRef(()=>typeof T.selectable>"u"?N.value:T.selectable),A=t.toRef(()=>typeof T.connectable>"u"?w.value:T.connectable),L=t.toRef(()=>typeof T.focusable>"u"?C.value:T.focusable),H=t.computed(()=>O.value||I.value||S.value.nodeClick.hasListeners()||S.value.nodeDoubleClick.hasListeners()||S.value.nodeMouseEnter.hasListeners()||S.value.nodeMouseMove.hasListeners()||S.value.nodeMouseLeave.hasListeners()),oe=t.toRef(()=>!!T.dimensions.width&&!!T.dimensions.height),ue=t.computed(()=>{const z=T.type||"default",Q=$==null?void 0:$[`node-${z}`];if(Q)return Q;let ee=T.template||m.value[z];if(typeof ee=="string"&&R){const we=Object.keys(R.appContext.components);we&&we.includes(z)&&(ee=t.resolveComponent(z,!1))}return ee&&typeof ee!="string"?ee:(l.error(new kt(yt.NODE_TYPE_MISSING,ee)),!1)}),be=ff({id:e.id,el:V,disabled:()=>!I.value,selectable:O,dragHandle:()=>T.dragHandle,onStart(z){k.dragStart(z)},onDrag(z){k.drag(z)},onStop(z){k.dragStop(z)},onClick(z){P(z)}}),pe=t.computed(()=>T.class instanceof Function?T.class(T):T.class),he=t.computed(()=>{const z=(T.style instanceof Function?T.style(T):T.style)||{},Q=T.width instanceof Function?T.width(T):T.width,ee=T.height instanceof Function?T.height(T):T.height;return!z.width&&Q&&(z.width=typeof Q=="string"?Q:`${Q}px`),!z.height&&ee&&(z.height=typeof ee=="string"?ee:`${ee}px`),z}),_e=t.toRef(()=>Number(T.zIndex??he.value.zIndex??0));return u(z=>{(z.includes(e.id)||!z.length)&&Ae()}),t.onMounted(()=>{t.watch(()=>T.hidden,(z=!1,Q,ee)=>{!z&&V.value&&(e.resizeObserver.observe(V.value),ee(()=>{V.value&&e.resizeObserver.unobserve(V.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>T.type,()=>T.sourcePosition,()=>T.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:V.value,forceUpdate:!0}])})}),t.watch([()=>T.position.x,()=>T.position.y,()=>{var z;return(z=M.value)==null?void 0:z.computedPosition.x},()=>{var z;return(z=M.value)==null?void 0:z.computedPosition.y},()=>{var z;return(z=M.value)==null?void 0:z.computedPosition.z},_e,()=>T.selected,()=>T.dimensions.height,()=>T.dimensions.width,()=>{var z;return(z=M.value)==null?void 0:z.dimensions.height},()=>{var z;return(z=M.value)==null?void 0:z.dimensions.width}],([z,Q,ee,we,de,xe])=>{const Ce={x:z,y:Q,z:xe+(f.value&&T.selected?1e3:0)};typeof ee<"u"&&typeof we<"u"?T.computedPosition=B0({x:ee,y:we,z:de},Ce):T.computedPosition=Ce},{flush:"post",immediate:!0}),t.watch([()=>T.extent,p],([z,Q],[ee,we])=>{(z!==ee||Q!==we)&&ye()}),T.extent==="parent"||typeof T.extent=="object"&&"range"in T.extent&&T.extent.range==="parent"?$l(()=>oe).toBe(!0).then(ye):ye(),()=>T.hidden?null:t.h("div",{ref:V,"data-id":T.id,class:["vue-flow__node",`vue-flow__node-${ue.value===!1?"default":T.type||"default"}`,{[o.value]:I.value,dragging:be==null?void 0:be.value,draggable:I.value,selected:T.selected,selectable:O.value,parent:T.isParent},pe.value],style:{visibility:oe.value?"visible":"hidden",zIndex:T.computedPosition.z??_e.value,transform:`translate(${T.computedPosition.x}px,${T.computedPosition.y}px)`,pointerEvents:H.value?"all":"none",...he.value},tabIndex:L.value?0:void 0,role:L.value?"group":void 0,"aria-describedby":y.value?void 0:`${$m}-${n}`,"aria-label":T.ariaLabel,"aria-roledescription":"node",...T.domAttributes,onMouseenter:Fe,onMousemove:se,onMouseleave:ne,onContextmenu:ae,onClick:P,onDblclick:me,onKeydown:D},[t.h(ue.value===!1?m.value.default:ue.value,{id:T.id,type:T.type,data:T.data,events:{...T.events,...v},selected:T.selected,resizing:T.resizing,dragging:be.value,connectable:A.value,position:T.computedPosition,dimensions:T.dimensions,isValidTargetPos:T.isValidTargetPos,isValidSourcePos:T.isValidSourcePos,parent:T.parentNode,parentNodeId:T.parentNode,zIndex:T.computedPosition.z??_e.value,targetPosition:T.targetPosition,sourcePosition:T.sourcePosition,label:T.label,dragHandle:T.dragHandle,onUpdateNodeInternals:Ae})]);function ye(){const z=T.computedPosition,{computedPosition:Q,position:ee}=as(T,g.value?Xa(z,b.value):z,l.error,p.value,M.value);(T.computedPosition.x!==Q.x||T.computedPosition.y!==Q.y)&&(T.computedPosition={...T.computedPosition,...Q}),(T.position.x!==ee.x||T.position.y!==ee.y)&&(T.position=ee)}function Ae(){V.value&&d([{id:e.id,nodeElement:V.value,forceUpdate:!0}])}function Fe(z){be!=null&&be.value||k.mouseEnter({event:z,node:T})}function se(z){be!=null&&be.value||k.mouseMove({event:z,node:T})}function ne(z){be!=null&&be.value||k.mouseLeave({event:z,node:T})}function ae(z){return k.contextMenu({event:z,node:T})}function me(z){return k.doubleClick({event:z,node:T})}function P(z){O.value&&(!i.value||!I.value||E.value>0)&&cs(T,r.value,c,s,a,!1,V.value),k.click({event:z,node:T})}function D(z){if(!(es(z)||y.value))if(Mm.includes(z.key)&&O.value){const Q=z.key==="Escape";cs(T,r.value,c,s,a,Q,V.value)}else I.value&&T.selected&&Fo[z.key]&&(z.preventDefault(),_.value=`Moved selected node ${z.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~T.position.x}, y: ${~~T.position.y}`,x({x:Fo[z.key].x,y:Fo[z.key].y},z.shiftKey))}}});function bw(e={includeHiddenNodes:!1}){const{nodes:n}=et();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 _w={class:"vue-flow__nodes vue-flow__container"},kw={name:"Nodes",compatConfig:{MODE:3}},Ew=t.defineComponent({...kw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=et(),a=bw(),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",_w,[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(gw),{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 Nw(){const{emits:e}=et();t.onMounted(()=>{if(af()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new kt(yt.MISSING_STYLES))}})}const ww=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Iw={name:"VueFlow",compatConfig:{MODE:3}},vw=t.defineComponent({...Iw,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=Tl(i,"modelValue",o),l=Tl(i,"nodes",o),s=Tl(i,"edges",o),c=et(i),d=dN({modelValue:r,nodes:l,edges:s},i,c);return mN(o,c.hooks),iw(),Nw(),t.provide(Za,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(yw),ww,t.createVNode(Ew),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(ow)],512))}}),Cw={name:"Panel",compatConfig:{MODE:3}},xf=t.defineComponent({...Cw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=et(),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"],xw=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))}}),tt=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ve=tt(xw,[["__scopeId","data-v-05aac699"]]),uo=["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 Rw(e){return typeof e=="string"&&e in Rf}const Aw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},$w=.15;function Tw(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 Mw(e){if(typeof e!="string")return null;const n=Tw(e);if(!n||n.s<$w)return null;let o=null,i=1/0;for(const a of uo){const r=Math.abs(n.h-Aw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function St(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(Rw(n))return n;const o=e==null?void 0:e.properties;return Mw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function hs(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Vw={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)"},Bw={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 Af(e,n=!1){return e?n?Bw[e]:Vw[e]:null}function mo(e){return Rf[e]}function jo(e){return`var(--em-swatch-${e}-bar)`}function Dw(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 Ow(e,n){const o=Dw(n);return o?e(o):n.split("-")[1]??n}function Lw(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 $f(e,n){const o=Lw(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 Pw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const zw={class:"em-inline-issue__msgs"},fo=tt(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(Ve,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",zw,[(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($f)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Fw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Uw={key:0,class:"em-mlang__dot"},Hw=["id","role","aria-labelledby"],jw=["title"],Yt=tt(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 b=o.defaultLang;return b&&o.languages.includes(b)?b:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const b=o.activeLang;return b&&o.languages.includes(b)?b:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(b){var E,h;return!!((h=(E=o.modelValue)==null?void 0:E[b])!=null&&h.trim())}const d=b=>`${o.name}-tab-${b}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(b){var N,w;const E=o.languages,h=E[(b+E.length)%E.length];h&&(l.value=h,await t.nextTick(),(w=(N=m.value)==null?void 0:N.querySelectorAll('[role="tab"]')[E.indexOf(h)])==null||w.focus())}function f(b){p(o.languages.indexOf(s.value)+b)}const y=t.computed(()=>o.languages.filter(b=>{var E,h;return b!==s.value&&!!((h=(E=o.modelValue)==null?void 0:E[b])!=null&&h.trim())})),_=t.computed(()=>{var b;return((b=o.modelValue)==null?void 0:b[s.value])??""});function g(b){const E={...o.modelValue};b.trim()===""?delete E[s.value]:E[s.value]=b,i("update:modelValue",E)}return(b,E)=>(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,h=>(t.openBlock(),t.createElementBlock("span",{id:d(h),key:h,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===h}]),role:"tab","aria-selected":s.value===h,"aria-controls":u.value,tabindex:s.value===h?0:-1,onClick:N=>l.value=h,onKeydown:[t.withKeys(t.withModifiers(N=>l.value=h,["prevent"]),["enter"]),t.withKeys(t.withModifiers(N=>l.value=h,["prevent"]),["space"]),E[0]||(E[0]=t.withKeys(t.withModifiers(N=>f(-1),["prevent"]),["left"])),E[1]||(E[1]=t.withKeys(t.withModifiers(N=>f(1),["prevent"]),["right"])),E[2]||(E[2]=t.withKeys(t.withModifiers(N=>p(0),["prevent"]),["home"])),E[3]||(E[3]=t.withKeys(t.withModifiers(N=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(h),1),c(h)?(t.openBlock(),t.createElementBlock("span",Uw,"•")):t.createCommentVNode("",!0)],42,Fw))),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":_.value,"onUpdate:modelValue":g},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":_.value,"onUpdate:modelValue":g},null,8,["name","placeholder","model-value"]))],8,Hw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,jw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Kw=["disabled"],Gw={class:"em-panel__sub-label"},Yw={class:"em-field"},qw={class:"em-field"},Ww={class:"em-field"},Jw={class:"em-class"},Xw={class:"em-field"},Zw={class:"em-field"},Qw={class:"em-field"},eI={class:"em-field"},tI={class:"em-multilang"},nI={class:"em-multilang"},oI={class:"em-jpa"},iI={class:"em-field"},aI={class:"em-field"},rI={class:"em-field"},lI=["title"],sI={class:"em-swatch"},cI={class:"em-swatch__row"},dI=["title"],uI=["title","onClick"],Tf=tt(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(M=>M.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(M=>M.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var M;return St(((M=l.value)==null?void 0:M.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],m=M=>M;function p(M){return M==="inherit"?a.t("em.common.inherit"):M}function f(M){r.value&&a.updateEntity(r.value.modelId,M)}function y(M,k,v){var O;const I=((O=r.value)==null?void 0:O.table)??{physicalName:""};f(M==="physicalName"?{table:{...I,physicalName:v}}:{table:{...I,logicalName:{...I.logicalName,[k]:v}}})}function _(M){f({description:Object.keys(M).length?M:void 0})}function g(M,k){var v;f({jpaAttrs:{...(v=r.value)==null?void 0:v.jpaAttrs,[M]:k}})}function b(M,k){g(M,k)}const E=t.computed(()=>{var M,k;return((k=(M=r.value)==null?void 0:M.jpaAttrs)==null?void 0:k.discriminatorType)??"inherit"}),h=t.computed(()=>{var M,k;return!((k=(M=r.value)==null?void 0:M.jpaAttrs)!=null&&k.useDiscriminator)});function N(M){g("discriminatorType",M==="inherit"?void 0:M)}function w(M){f({hasPersonalInfo:M})}function C(M){f({referenceOnly:M?!0:void 0})}function S(M){f({superClass:M.trim()||void 0})}function V(M){f({schema:M.trim()||void 0})}function $(M){f({abstractClass:M})}const R=t.computed(()=>{var M,k;return((k=(M=r.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:k.join(", "))??""});function x(M){const k=M.split(",").map(v=>v.trim()).filter(Boolean);f({declarationOfInterfaces:k.length?k:void 0})}function T(M){r.value&&a.setEntitySwatch(r.value.modelId,M)}return(M,k)=>{var v,I,O;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:k[0]||(k[0]=A=>i("toggle"))},[t.createElementVNode("span",Gw,[t.createVNode(Ve,{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(fo,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Yw,[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":k[1]||(k[1]=A=>f({name:A}))},null,8,["model-value"])]),t.createElementVNode("label",qw,[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(ei),"onUpdate:modelValue":k[2]||(k[2]=A=>f({stereotype:A}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Ww,[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":k[3]||(k[3]=A=>f({packageName:A}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Xw,[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":k[4]||(k[4]=A=>S(A))},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(te.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":R.value,"onUpdate:modelValue":k[5]||(k[5]=A=>x(A))},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":k[6]||(k[6]=A=>$(A))},null,8,["label","model-value"])]),t.createElementVNode("label",Qw,[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":((v=r.value.table)==null?void 0:v.physicalName)??"","onUpdate:modelValue":k[7]||(k[7]=A=>y("physicalName",null,A))},null,8,["model-value"])]),t.createElementVNode("label",eI,[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":k[8]||(k[8]=A=>V(A))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",tI,[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,A=>{var L,H;return t.openBlock(),t.createElementBlock("label",{key:A,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(A),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${A}`,width:"100%","model-value":((H=(L=r.value.table)==null?void 0:L.logicalName)==null?void 0:H[A])??"","onUpdate:modelValue":oe=>y("logicalName",A,oe)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",nI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":_},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",oI,[k[13]||(k[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,A=>{var L;return t.createVNode(t.unref(te.BSCheckbox),{key:A.key,name:`jpa-${A.key}`,class:"em-check",label:A.label,"model-value":!!((L=r.value.jpaAttrs)!=null&&L[A.key]),"onUpdate:modelValue":H=>b(A.key,H)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",iI,[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:h.value,"model-value":((I=r.value.jpaAttrs)==null?void 0:I.discriminatorColumnName)??"","onUpdate:modelValue":k[9]||(k[9]=A=>g("discriminatorColumnName",A.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",aI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(te.BSSelect),{disabled:h.value,"model-value":E.value,items:u,"value-provider":m,"label-provider":p,"onUpdate:modelValue":k[10]||(k[10]=A=>A&&N(A))},null,8,["disabled","model-value"])]),t.createElementVNode("label",rI,[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:h.value,"model-value":(O=r.value.jpaAttrs)==null?void 0:O.discriminatorLength,"onUpdate:modelValue":k[11]||(k[11]=A=>g("discriminatorLength",A||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":w},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(te.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":C},null,8,["label","model-value"])],8,lI),t.createElementVNode("fieldset",sI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",cI,[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:k[12]||(k[12]=A=>T(null))},"∅",10,dI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),A=>(t.openBlock(),t.createElementBlock("button",{key:A,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===A}]),style:t.normalizeStyle({background:t.unref(jo)(A)}),title:t.unref(a).t(t.unref(mo)(A)),onClick:L=>T(A)},null,14,uI))),128))])])],64)):t.createCommentVNode("",!0)],8,Kw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),mI=["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"],Mf=["inherit","true","false"],rr="__OWN__";function Vf(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,le){o.value&&e.updateAttribute(o.value.modelId,K.modelId,le)}const c=t.computed(()=>Dr(e.state.logical.associations));function d(K){if(!o.value)return;const le=So(e.state.logical,o.value.modelId,K.modelId);return le&&ua(K,le)?le:void 0}function u(K){return!!d(K)}function m(K){return u(K)?K.derivedIdFieldName??"":K.name??""}function p(K){const le=d(K);if(!le)return e.t("em.attr.namePlaceholder");const Re=new Map(e.state.logical.entities.map(ke=>[ke.modelId,ke]));return rl({...K,derivedIdFieldName:void 0},le,Re)||e.t("em.attr.namePlaceholder")}function f(K,le){u(K)?s(K,{derivedIdFieldName:le||void 0}):s(K,{name:le})}function y(K){return K.name??""}function _(K,le){s(K,{name:le})}function g(K){return!!o.value&&Or(K,o.value,c.value)}function b(K){var ke,U;const le=(ke=K.derivedFrom)==null?void 0:ke.associationRef,Re=(U=o.value)==null?void 0:U.attributes.find(bt=>{var vt;return bt.attrType==="RELATION_OWN"&&((vt=bt.derivedFrom)==null?void 0:vt.associationRef)===le&&c.value.has(bt.modelId)});return e.t("em.attr.joinColumnOnlyNote",{anchor:(Re==null?void 0:Re.name)||e.t("em.attr.nameless")})}function E(K){return!!o.value&&!!So(e.state.logical,o.value.modelId,K.modelId)}function h(K,le){s(K,{naturalId:le||void 0,naturalIdMutable:le?K.naturalIdMutable:void 0})}function N(){return{naturalId:void 0,naturalIdMutable:void 0}}function w(K,le){s(K,{identifier:le,...le?N():{}})}function C(K,le){s(K,{transient:le||void 0,...le?N():{}})}function S(K){return!!K.transient||K.attrType==="RELATION_REF"}function V(K){return Wi(K)}function $(K,le=0){var Re;return((Re=Kn(K,o.value,e.state.logical.entities,e.state.logical.associations,le))==null?void 0:Re.physicalName)||void 0}const R=K=>K.value,x=K=>K.label;function T(K,le){if(!le)return;const Re=oe.value.find(ke=>ke.type===le);if(Re){const ke=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};s(K,{type:le,customType:void 0,dbAttrs:[{...ke,dataType:Re.dataType,length:Re.length,scale:Re.scale}]});return}s(K,le===hn?{type:le}:{type:le,customType:void 0})}function M(K,le){s(K,{customType:le.trim()===""?void 0:le})}function k(K,le){if(K.attrType==="RELATION_REF")return;const ke={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...le};le.dataType!==void 0&&!Kr.has(ke.dataType)&&(ke.scale=void 0),s(K,{dbAttrs:[ke]})}function v(K){var le;return Kr.has(((le=K.dbAttrs[0])==null?void 0:le.dataType)??"")}function I(K){return!v(K)&&!V(K)&&!S(K)?e.t("em.attr.scaleTypeHint"):void 0}function O(K,le){k(K,{logicalName:Object.keys(le).length?le:void 0})}function A(K,le){s(K,{description:Object.keys(le).length?le:void 0})}function L(K){return K.personalInfoAttributeType??"none"}function H(K,le){s(K,{personalInfoAttributeType:le==="none"?void 0:le})}const oe=t.computed(()=>e.predefinedCustomTypeCatalog.value),ue=t.computed(()=>e.embeddableCatalog.value);function be(K){var le,Re,ke;return((le=K.label)==null?void 0:le[e.userLanguage.value])??((Re=K.label)==null?void 0:Re.ko)??((ke=K.label)==null?void 0:ke.en)??K.type}const pe=t.computed(()=>e.groupCodeCatalog.value);function he(K){var le;return((le=pe.value.find(Re=>Re.groupCode===K.groupCode))==null?void 0:le.codes)??[]}function _e(K){return["none",...he(K)]}function ye(K){return K==="none"?"none":K.code}function Ae(K){var Re,ke,U;if(K==="none")return e.t("em.common.noneParen");const le=((Re=K.label)==null?void 0:Re[e.userLanguage.value])??((ke=K.label)==null?void 0:ke.ko)??((U=K.label)==null?void 0:U.en);return le?`${K.code} (${le})`:K.code}function Fe(K,le){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,le)}function se(K,le){s(K,{defaultValue:le==="none"?void 0:le})}function ne(K,le){s(K,{defaultValue:le.trim()===""?void 0:le})}function ae(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}const me=mn;function P(K){return ae(K)||me(K)}function D(K,le,Re){const ke=K.dbAttrs.map((U,bt)=>{if(bt!==le)return U;const vt={...U,...Re};for(const ot of Object.keys(Re))Re[ot]===void 0&&delete vt[ot];return vt});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,ke)}function z(K,le,Re){D(K,le,{logicalName:Object.keys(Re).length?Re:void 0})}function Q(K,le){var U,bt,vt;if(me(K)){const ot=Kn(K,o.value,e.state.logical.entities,e.state.logical.associations,le);return ot?{physicalName:ot.physicalName,dataType:ot.dataType,length:ot.length,scale:ot.scale,logicalName:ot.logicalName}:void 0}if(K.attrType==="EMBED_PREDEF"){const ot=(U=e.embeddableCatalog.value.find(Ge=>Ge.type===K.type))==null?void 0:U.fields[le];return ot?{name:ot.name,physicalName:ot.physicalName,dataType:ot.dataType,length:ot.length,scale:ot.scale,shareable:ot.shareable,logicalName:ot.logicalName}:void 0}const Re=(bt=K.embedded)==null?void 0:bt.embeddableRef;if(!Re)return;const ke=(vt=e.state.logical.entities.find(ot=>ot.modelId===Re))==null?void 0:vt.attributes.flatMap(ot=>ot.dbAttrs)[le];return ke?{physicalName:ke.physicalName,dataType:ke.dataType,length:ke.length,scale:ke.scale,logicalName:ke.logicalName}:void 0}function ee(K,le){var Re,ke;return((Re=Q(K,le))==null?void 0:Re.dataType)||((ke=K.dbAttrs[le])==null?void 0:ke.dataType)||""}function we(K,le){var Re,ke;return((Re=Q(K,le))==null?void 0:Re.length)??((ke=K.dbAttrs[le])==null?void 0:ke.length)}function de(K,le){var Re,ke;return((Re=Q(K,le))==null?void 0:Re.scale)??((ke=K.dbAttrs[le])==null?void 0:ke.scale)}function xe(K){return e.t(me(K)?"em.attr.fkFixedHint":"em.attr.embedFixedHint")}const Ce=Mf;function Y(K){return K==="inherit"?e.t("em.common.inherit"):K}function X(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function q(K,le,Re){D(K,le,{updatable:Re==="inherit"?void 0:Re==="true"})}function Ie(K,le){k(K,{updatable:le==="inherit"?void 0:le==="true"})}const Be=Mf;function ze(K){return K==="inherit"?e.t("em.common.inherit"):K}function Ue(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function ie(K,le,Re){D(K,le,{insertable:Re==="inherit"?void 0:Re==="true"})}function Se(K,le){k(K,{insertable:le==="inherit"?void 0:le==="true"})}const je=t.computed(()=>o.value?Lr(o.value,e.state.logical.entities):[]),Ze=t.computed(()=>ko(je.value.flatMap(K=>K.attributes.flatMap(le=>le.dbAttrs)))),J=t.computed(()=>je.value.flatMap(K=>K.attributes.filter(le=>le.attrType==="NORMAL"&&le.dbAttrs.length===1&&le.dbAttrs[0]).map(le=>{var Re;return{modelId:le.dbAttrs[0].modelId,physical:le.dbAttrs[0].physicalName||le.name,isCurrency:le.type==="Currency",ownerName:K.modelId===((Re=o.value)==null?void 0:Re.modelId)?void 0:K.name}})));function re(){const K=[...J.value].sort((le,Re)=>Number(Re.isCurrency)-Number(le.isCurrency));return[rr,...K.map(le=>le.modelId)]}function Ke(K){if(K===rr)return e.t("em.attr.sharedOwn");const le=J.value.find(ke=>ke.modelId===K);if(!le)return K;const Re=le.ownerName?`${le.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:Re,physical:le.physical,mode:le.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function st(K){return(K==null?void 0:K.sharedColumnRef)??rr}function qe(K,le,Re){D(K,le,{sharedColumnRef:Re===rr?void 0:Re})}function nt(K){return(K==null?void 0:K.sharedColumnRef)!=null}function We(K){var le;return((le=Gn(K,Ze.value))==null?void 0:le.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:mI,piiLabel:r,idn:l,setAttr:s,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:p,setRowName:f,assocFieldName:y,setAssocFieldName:_,nameLocked:g,nameLockedHint:b,isManagedFk:E,setNaturalId:h,clearNaturalIdPatch:N,setIdentifier:w,setTransient:C,dbLocked:S,fkDerived:V,fkOriginPhysical:$,typeValueOf:R,typeLabelOf:x,setAttrType:T,setAttrCustomType:M,setDb:k,scaleApplicable:v,scaleHint:I,setDbLogical:O,setAttrDescription:A,attrPiiValue:L,setAttrPii:H,predefinedCustomTypeCatalog:oe,embeddableCatalog:ue,predefinedLabel:be,groupCodeCatalog:pe,attrGroupCodes:he,attrCodeItems:_e,codeValueOf:ye,codeLabelOf:Ae,setAttrGroupCode:Fe,setAttrCode:se,setAttrDefaultValue:ne,isEmbedExpanded:ae,isMultiColFk:me,hasColumnSlots:P,setDbAt:D,setDbLogicalAt:z,colSlotMeta:Q,fixedDataType:ee,fixedLength:we,fixedScale:de,slotFixedHint:xe,updatableItems:Ce,updatableLabel:Y,updatableValue:X,setUpdatableAt:q,setUpdatable:Ie,insertableItems:Be,insertableLabel:ze,insertableValue:Ue,setInsertableAt:ie,setInsertable:Se,scopeEntities:je,columnsById:Ze,sharedCandidates:J,sharedItems:re,sharedLabel:Ke,sharedValue:st,setSharedAt:qe,isShared:nt,sharedPhysical:We}}const Bf={"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.fkFixedHint":"Inherited from the parent PK column — its shape follows the parent.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.derivedIdField":"Derived @Id field","em.attr.assocField":"Association field (@MapsId)","em.attr.derivedIdNote":"This attribute emits **two Java fields** — the name box above is the scalar @Id field (leave empty to derive it from the parent PK column), and this is the @MapsId association field. The same value is also editable from the relationship inspector.","em.attr.joinColumnOnlyNote":"Sibling column of a composite foreign key — JPA emits one field per association, so this name is never generated. Edit the field name on «{anchor}».","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.fkChildCols":"Composite foreign key — {n} 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.derivedIdRow":"Scalar @Id field emitted by a derived identifier (@MapsId). The model stores a single association attribute; edit it from that attribute’s inspector.","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 sub-column in this entity","em.node.embedAllShow":"Expand all collapsed sub-columns","em.node.embedAllSummary":"{n} sub-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"},Df={"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.fkFixedHint":"親のPKカラムから継承された値です — 形状は親に従います。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.derivedIdField":"派生識別 @Id フィールド","em.attr.assocField":"関連フィールド名(@MapsId)","em.attr.derivedIdNote":"この属性は**2つの Java フィールド**を出力します — 上の名前欄はスカラー @Id のフィールド名(空欄なら親 PK の物理名から派生)で、こちらは @MapsId 関連フィールド名です。同じ値は関連線のインスペクタからも編集できます。","em.attr.joinColumnOnlyNote":"複合外部キーの兄弟カラムです — JPAのフィールドは関連ごとに1つだけなので、この名前は出力されません。フィールド名は«{anchor}»で編集してください。","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.fkChildCols":"複合外部キー — カラム {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.derivedIdRow":"派生識別(@MapsId)が出力するスカラー @Id フィールドです — モデルには関連属性ひとつとして保存され、編集はその属性のインスペクタで行います。","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":"未指定"},Of={"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.fkFixedHint":"부모 PK 컬럼에서 상속된 값입니다 — 형상은 부모를 따릅니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.derivedIdField":"파생 식별 @Id 필드","em.attr.assocField":"연관 필드명(@MapsId)","em.attr.derivedIdNote":"이 속성은 **두 Java 필드**를 냅니다 — 위 이름 칸은 스칼라 @Id 필드명(비우면 부모 PK 물리명에서 파생)이고, 여기는 @MapsId 연관 필드명입니다. 같은 값을 관계선 인스펙터에서도 편집할 수 있습니다.","em.attr.joinColumnOnlyNote":"복합 외래키의 형제 컬럼입니다 — JPA 필드는 관계당 하나뿐이라 이 이름은 방출되지 않습니다. 필드명은 «{anchor}»에서 편집하세요.","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.fkChildCols":"복합 외래키 — 컬럼 {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.derivedIdRow":"파생 식별(@MapsId)이 방출하는 스칼라 @Id 필드입니다 — 모델에는 연관 속성 하나로 저장되며, 편집은 그 속성의 인스펙터에서 합니다.","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":"미지정"},fI=["ko","en","ja"],ys={ko:Of,en:Bf,ja:Df};function qt(e,n,o){let a=(ys[e]??ys.ko)[n]??ys.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const Lf=["ko","en","ja","zh"];function pI(e){if(e)for(const n of Lf){const o=e[n];if(o)return o}}function gs(e){const n=pI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function hI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Lf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const yI=["aria-expanded","placeholder"],gI=["aria-selected","onClick","onMouseenter"],bI={key:0,class:"gcc__opt gcc__opt--empty"},Pf=tt(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=($,R)=>qt(o.locale??"ko",$,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($=>$.groupCode===o.modelValue)),f=t.computed(()=>p.value?gs(p.value):"");t.watch(f,$=>{d.value||(c.value=$)},{immediate:!0});const y=t.computed(()=>c.value===f.value?o.items:hI(o.items,c.value));function _(){var R;const $=(R=r.value)==null?void 0:R.getBoundingClientRect();$&&(m.value={left:`${$.left}px`,top:`${$.bottom}px`,width:`${$.width}px`})}function g(){d.value=!0,_(),u.value=Math.max(0,y.value.findIndex($=>$.groupCode===o.modelValue)),window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),document.addEventListener("mousedown",V)}function b(){d.value=!1,window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_),document.removeEventListener("mousedown",V)}t.onBeforeUnmount(b);function E(){g(),t.nextTick(()=>{var $;return($=l.value)==null?void 0:$.select()})}function h(){d.value||g(),u.value=0}function N($){i("update:modelValue",$.groupCode),c.value=gs($),b()}function w(){i("update:modelValue",void 0),c.value="",b()}function C(){c.value.trim()===""?w():(c.value=f.value,b())}function S($){var R;if($.key==="ArrowDown")d.value||g(),u.value=Math.min(u.value+1,y.value.length-1),$.preventDefault();else if($.key==="ArrowUp")u.value=Math.max(u.value-1,0),$.preventDefault();else if($.key==="Enter"){const x=y.value[u.value];x&&N(x),$.preventDefault()}else $.key==="Escape"&&(c.value=f.value,b(),(R=l.value)==null||R.blur())}function V($){var x,T;const R=$.target;!((x=r.value)!=null&&x.contains(R))&&!((T=s.value)!=null&&T.contains(R))&&C()}return($,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]=x=>c.value=x),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:E,onInput:h,onKeydown:S},null,40,yI),[[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:w},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(x,T)=>(t.openBlock(),t.createElementBlock("li",{key:x.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":T===u.value,"is-selected":x.groupCode===e.modelValue}]),role:"option","aria-selected":x.groupCode===e.modelValue,onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["prevent"])),onClick:M=>N(x),onMouseenter:M=>u.value=T},t.toDisplayString(t.unref(gs)(x)),43,gI))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",bI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),_I=["aria-labelledby"],kI=["aria-checked","tabindex","onClick","onKeydown"],zf=tt(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,kI))),128))],8,_I))}}),[["__scopeId","data-v-5c793bbb"]]),EI=["disabled"],NI={class:"em-aw__toolbar"},wI={class:"em-aw__count"},II={class:"em-aw__scroll"},vI={class:"em-aw__table"},CI={class:"c-name"},SI={class:"c-type"},xI={class:"c-logical"},RI=["id"],AI={class:"c-col"},$I={class:"c-constraints"},TI={class:"c-del"},MI={class:"c-expand"},VI=["title","onClick","onKeydown"],BI=["title"],DI=["title"],OI={key:1,class:"em-aw__muted"},LI=["title"],PI=["title"],zI=["title"],FI={class:"em-aw__cflags"},UI=["title"],HI={key:0,class:"em-aw__embed-col"},jI={class:"em-aw__embed-label"},KI=["title"],GI={colspan:"8"},YI={class:"em-aw__detail"},qI={class:"em-aw__dgroup"},WI=["title"],JI={class:"em-aw__df"},XI={class:"em-aw__df"},ZI={class:"em-aw__dgroup"},QI={key:0,class:"em-aw__dgroup"},ev={class:"em-aw__df"},tv={key:0,class:"em-aw__df"},nv={class:"em-aw__df"},ov={class:"em-aw__dgroup em-aw__ddesc"},iv={class:"c-expand"},av=["title","onClick","onKeydown"],rv={key:1,class:"em-aw__caret is-static","aria-hidden":"true"},lv=["title"],sv=["title"],cv=["colspan"],dv=["title"],uv={class:"em-aw__cflags"},mv=["title"],fv={colspan:"8"},pv={class:"em-aw__detail"},hv={class:"em-aw__dgroup em-aw__ddesc"},yv={class:"c-expand"},gv=["title","onClick","onKeydown"],bv={class:"em-aw__embed-label"},_v=["title"],kv=["title"],Ev={class:"em-aw__ro"},Nv=["title"],wv={class:"em-aw__ro"},Iv=["title"],vv={class:"em-aw__ro"},Cv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},Sv={colspan:"8"},xv={class:"em-aw__detail"},Rv={class:"em-aw__dgroup"},Av={key:0,class:"em-aw__df"},$v={class:"em-aw__df"},Tv={class:"em-aw__df"},Mv={key:0},Vv={colspan:"99",class:"em-aw__empty"},Bv=6,Ff=5,Dv=tt(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,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:p,setRowName:f,assocFieldName:y,setAssocFieldName:_,nameLocked:g,nameLockedHint:b,isManagedFk:E,setNaturalId:h,setIdentifier:N,setTransient:w,dbLocked:C,fkDerived:S,fkOriginPhysical:V,typeValueOf:$,typeLabelOf:R,setAttrType:x,setAttrCustomType:T,setDb:M,scaleApplicable:k,scaleHint:v,setDbLogical:I,attrPiiValue:O,setAttrPii:A,predefinedCustomTypeCatalog:L,embeddableCatalog:H,predefinedLabel:oe,groupCodeCatalog:ue,attrGroupCodes:be,attrCodeItems:pe,codeValueOf:he,codeLabelOf:_e,setAttrGroupCode:ye,setAttrCode:Ae,setAttrDefaultValue:Fe,setAttrDescription:se,hasColumnSlots:ne,isMultiColFk:ae,setDbAt:me,setDbLogicalAt:P,colSlotMeta:D,fixedDataType:z,fixedLength:Q,fixedScale:ee,slotFixedHint:we,updatableItems:de,updatableLabel:xe,updatableValue:Ce,setUpdatableAt:Y,setUpdatable:X,insertableItems:q,insertableLabel:Ie,insertableValue:Be,setInsertableAt:ze,setInsertable:Ue,sharedItems:ie,sharedLabel:Se,sharedValue:je,setSharedAt:Ze,isShared:J,sharedPhysical:re}=Vf(o,()=>n.entityId),Ke=t.computed(()=>{var Re;return[...((Re=i.value)==null?void 0:Re.attributes)??[]].sort((ke,U)=>ke.order-U.order)}),st=t.computed(()=>{var Re;return(((Re=i.value)==null?void 0:Re.attributes)??[]).filter(ke=>ke.attrType!=="DIVIDER").length}),qe=t.ref(new Set);function nt(Re){return qe.value.has(Re)}function We(Re){const ke=new Set(qe.value);ke.has(Re)?ke.delete(Re):ke.add(Re),qe.value=ke}const K=t.ref(o.userLanguage.value);function le(Re){!Re||!i.value||o.addPredefinedEmbed(i.value.modelId,Re)}return(Re,ke)=>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",wI,t.toDisplayString(t.unref(o).t("em.attr.section",{n:st.value})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:ke[0]||(ke[0]=U=>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:ke[1]||(ke[1]=U=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(H).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(H),"value-provider":U=>U.type,"label-provider":t.unref(oe),"onUpdate:modelValue":le},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",II,[t.createElementVNode("table",vI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[ke[3]||(ke[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",CI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",SI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",xI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,RI),t.createVNode(zf,{modelValue:K.value,"onUpdate:modelValue":ke[2]||(ke[2]=U=>K.value=U),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",AI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),ke[4]||(ke[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),ke[5]||(ke[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",$I,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),ke[6]||(ke[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ke.value,U=>{var bt,vt,ot,Ge,Xe,Z,Rt,$t,Sn,At;return t.openBlock(),t.createElementBlock(t.Fragment,{key:U.modelId},[U.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(U.modelId)}])},[ke[7]||(ke[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-divlabel-${U.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":U.name,"onUpdate:modelValue":ge=>t.unref(d)(U,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:Bv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",TI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,U.modelId)},null,8,["onClick"])])],2)):t.unref(ne)(U)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(U.modelId)}])},[t.createElementVNode("td",iv,[t.unref(ae)(U)?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["em-aw__caret",{"is-open":nt(U.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(U.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>We(U.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>We(U.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>We(U.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,av)):(t.openBlock(),t.createElementBlock("span",rv,[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})]))]),t.createElementVNode("td",{title:t.unref(g)(U)?t.unref(b)(U):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${U.modelId}`,width:"100%",disabled:t.unref(g)(U),placeholder:t.unref(p)(U),"model-value":t.unref(m)(U),"onUpdate:modelValue":ge=>t.unref(f)(U,ge)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,lv),t.createElementVNode("td",{title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${U.modelId}`,width:"100%",disabled:"","model-value":U.type},null,8,["name","model-value"])],8,sv),t.createElementVNode("td",{colspan:t.unref(ae)(U)?Ff-1:Ff,class:"em-aw__embed-note"},t.toDisplayString(t.unref(ae)(U)?t.unref(o).t("em.attr.fkChildCols",{n:U.dbAttrs.length}):t.unref(o).t("em.attr.embedChildCols",{n:U.dbAttrs.length})),9,cv),t.unref(ae)(U)?(t.openBlock(),t.createElementBlock("td",{key:0,class:"c-constraints",title:t.unref(o).t("em.attr.fkDerivedNote")},[t.createElementVNode("div",uv,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${U.modelId}`,label:"PK","model-value":U.identifier,disabled:"","onUpdate:modelValue":ge=>t.unref(N)(U,ge)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${U.modelId}`,label:"NN","model-value":U.notNull,disabled:"","onUpdate:modelValue":ge=>t.unref(d)(U,{notNull:ge})},null,8,["name","model-value","onUpdate:modelValue"])])],8,dv)):t.createCommentVNode("",!0),t.createElementVNode("td",{class:"c-del",title:t.unref(E)(U)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,U.modelId)},null,8,["onClick"])],8,mv)],2),t.unref(ae)(U)&&nt(U.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(U.modelId)}])},[ke[15]||(ke[15]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",fv,[t.createElementVNode("div",pv,[t.createElementVNode("fieldset",hv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`aw-desc-${U.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":U.description,"onUpdate:modelValue":ge=>t.unref(se)(U,ge)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(U.dbAttrs,(ge,ft)=>{var xn,Zt,B,F,j,fe,Te,Oe;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ge.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":nt(ge.modelId)}])},[t.createElementVNode("td",yv,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":nt(ge.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(ge.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:ce=>We(ge.modelId),onKeydown:[t.withKeys(t.withModifiers(ce=>We(ge.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ce=>We(ge.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,gv)]),t.createElementVNode("td",bv,"↳ "+t.toDisplayString(((xn=t.unref(D)(U,ft))==null?void 0:xn.name)??((Zt=t.unref(D)(U,ft))==null?void 0:Zt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:ft+1})),1),ke[16]||(ke[16]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(Yt,{name:`aw-embed-logical-${ge.modelId}`,languages:t.unref(o).languages.value,"active-lang":K.value,placeholder:((F=(B=t.unref(D)(U,ft))==null?void 0:B.logicalName)==null?void 0:F[K.value])??((fe=(j=t.unref(D)(U,ft))==null?void 0:j.logicalName)==null?void 0:fe.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ge.logicalName,"onUpdate:modelValue":ce=>t.unref(P)(U,ft,ce)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(J)(ge)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-embed-col-${ge.modelId}`,width:"100%",disabled:t.unref(J)(ge),placeholder:((Te=t.unref(D)(U,ft))==null?void 0:Te.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(J)(ge)?t.unref(re)(ge):ge.physicalName,"onUpdate:modelValue":ce=>t.unref(me)(U,ft,{physicalName:ce})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(fo,{controller:t.unref(o),"ref-id":ge.modelId},null,8,["controller","ref-id"])],8,_v),t.createElementVNode("td",{title:t.unref(we)(U)},[t.createElementVNode("span",Ev,t.toDisplayString(t.unref(z)(U,ft)),1)],8,kv),t.createElementVNode("td",{title:t.unref(we)(U)},[t.createElementVNode("span",wv,t.toDisplayString(t.unref(Q)(U,ft)??""),1)],8,Nv),t.createElementVNode("td",{class:"c-constraints",title:t.unref(we)(U)},[t.createElementVNode("span",vv,t.toDisplayString(t.unref(ee)(U,ft)!=null?`scale ${t.unref(ee)(U,ft)}`:""),1)],8,Iv),ke[17]||(ke[17]=t.createElementVNode("td",null,null,-1))],2),nt(ge.modelId)?(t.openBlock(),t.createElementBlock("tr",Cv,[ke[20]||(ke[20]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",Sv,[t.createElementVNode("div",xv,[t.createElementVNode("fieldset",Rv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(Oe=t.unref(D)(U,ft))!=null&&Oe.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(te.BSSelect),{width:"150px","model-value":t.unref(je)(ge),items:t.unref(ie)(),"value-provider":t.unref(c),"label-provider":t.unref(Se),"onUpdate:modelValue":ce=>ce&&t.unref(Ze)(U,ft,ce)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",$v,[ke[18]||(ke[18]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(J)(ge),"model-value":t.unref(J)(ge)?"false":t.unref(Be)(ge),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":ce=>ce&&t.unref(ze)(U,ft,ce)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",Tv,[ke[19]||(ke[19]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(J)(ge),"model-value":t.unref(J)(ge)?"false":t.unref(Ce)(ge),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":ce=>ce&&t.unref(Y)(U,ft,ce)},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(U.modelId),"em-aw__open":nt(U.modelId)})},[t.createElementVNode("td",MI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":nt(U.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(U.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>We(U.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>We(U.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>We(U.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,VI)]),t.createElementVNode("td",{title:t.unref(g)(U)?t.unref(b)(U):t.unref(u)(U)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${U.modelId}`,width:"100%",disabled:t.unref(g)(U),placeholder:t.unref(p)(U),"model-value":t.unref(m)(U),"onUpdate:modelValue":ge=>t.unref(f)(U,ge)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,BI),t.createElementVNode("td",{title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${U.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!U.groupCode||U.attrType==="RELATION_REF"||t.unref(S)(U),items:t.unref(_c)(U.type,t.unref(L)),"value-provider":t.unref($),"label-provider":t.unref(R),"model-value":U.type,"onUpdate:modelValue":ge=>t.unref(x)(U,ge)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),U.type===t.unref(hn)&&!t.unref(S)(U)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${U.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":U.customType??"","onUpdate:modelValue":ge=>t.unref(T)(U,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,DI),t.createElementVNode("td",null,[U.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Yt,{key:0,name:`aw-logical-${U.modelId}`,languages:t.unref(o).languages.value,"active-lang":K.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(bt=U.dbAttrs[0])==null?void 0:bt.logicalName,"onUpdate:modelValue":ge=>t.unref(I)(U,ge)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",OI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${U.modelId}`,width:"100%",placeholder:t.unref(V)(U)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(C)(U),"model-value":((vt=U.dbAttrs[0])==null?void 0:vt.physicalName)??"","onUpdate:modelValue":ge=>t.unref(M)(U,{physicalName:ge})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(fo,{controller:t.unref(o),"ref-id":(ot=U.dbAttrs[0])==null?void 0:ot.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${U.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(C)(U)||t.unref(S)(U),items:t.unref(yc)(((Ge=U.dbAttrs[0])==null?void 0:Ge.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(jr),"model-value":((Xe=U.dbAttrs[0])==null?void 0:Xe.dataType)??"","onUpdate:modelValue":ge=>ge&&t.unref(M)(U,{dataType:ge})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,LI),t.createElementVNode("td",{title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${U.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(C)(U)||t.unref(S)(U),"model-value":(Z=U.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":ge=>t.unref(M)(U,{length:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,PI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",FI,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${U.modelId}`,label:"PK","model-value":U.identifier,disabled:t.unref(a)||t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(N)(U,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${U.modelId}`,label:"NN","model-value":U.notNull,disabled:t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(d)(U,{notNull:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${U.modelId}`,label:"UQ","model-value":!!((Rt=U.dbAttrs[0])!=null&&Rt.unique),disabled:t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(M)(U,{unique:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,zI),t.createElementVNode("td",{class:"c-del",title:t.unref(E)(U)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,U.modelId)},null,8,["onClick"])],8,UI)],2),t.unref(u)(U)?(t.openBlock(),t.createElementBlock("tr",HI,[ke[8]||(ke[8]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",jI,"↳ "+t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("td",{colspan:"7",title:t.unref(o).t("em.attr.derivedIdNote")},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-assocname-${U.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(y)(U),"onUpdate:modelValue":ge=>t.unref(_)(U,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,KI)])):t.createCommentVNode("",!0),nt(U.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(U.modelId)}])},[ke[14]||(ke[14]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",GI,[t.createElementVNode("div",YI,[t.createElementVNode("fieldset",qI,[ke[12]||(ke[12]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(v)(U)},[ke[9]||(ke[9]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${U.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(C)(U)||t.unref(S)(U)||!t.unref(k)(U),"model-value":($t=U.dbAttrs[0])==null?void 0:$t.scale,"onUpdate:modelValue":ge=>t.unref(M)(U,{scale:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,WI),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${U.modelId}`,label:"Auto Increment","model-value":!!((Sn=U.dbAttrs[0])!=null&&Sn.autoIncrement),disabled:t.unref(C)(U)||t.unref(S)(U)||!U.identifier,"onUpdate:modelValue":ge=>t.unref(M)(U,{autoIncrement:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",JI,[ke[10]||(ke[10]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${U.modelId}`,width:"110px",disabled:t.unref(C)(U),"model-value":t.unref(Be)(U.dbAttrs[0]),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":ge=>ge&&t.unref(Ue)(U,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",XI,[ke[11]||(ke[11]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${U.modelId}`,width:"110px",disabled:t.unref(C)(U),"model-value":t.unref(Ce)(U.dbAttrs[0]),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":ge=>ge&&t.unref(X)(U,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",ZI,[ke[13]||(ke[13]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${U.modelId}`,label:"@Transient","model-value":!!U.transient,disabled:U.identifier||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(w)(U,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${U.modelId}`,label:"@NaturalId","model-value":!!U.naturalId,disabled:U.identifier||t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(h)(U,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${U.modelId}`,label:"mutable","model-value":!!U.naturalIdMutable,disabled:t.unref(C)(U)||!U.naturalId,"onUpdate:modelValue":ge=>t.unref(d)(U,{naturalIdMutable:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${U.modelId}`,label:"Multi-Value (Set)","model-value":!!((At=U.dbAttrs[0])!=null&&At.multiValue),disabled:t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(M)(U,{multiValue:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(S)(U)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",QI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",ev,[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(O)(U),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":ge=>ge&&t.unref(A)(U,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(ue).length?(t.openBlock(),t.createElementBlock("label",tv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Pf,{"model-value":U.groupCode,items:t.unref(ue),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ge=>t.unref(ye)(U,ge)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",nv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(be)(U).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":U.defaultValue??"none",items:t.unref(pe)(U),"value-provider":t.unref(he),"label-provider":t.unref(_e),"onUpdate:modelValue":ge=>ge&&t.unref(Ae)(U,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`aw-default-${U.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":U.defaultValue??"","onUpdate:modelValue":ge=>t.unref(Fe)(U,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",ov,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`aw-desc-${U.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":U.description,"onUpdate:modelValue":ge=>t.unref(se)(U,ge)},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",Mv,[t.createElementVNode("td",Vv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,EI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-36c8c727"]]);function bs(e,n){return n&&n!==e?`${e} (${n})`:e}function Uf(e,n,o){const i=e.dbAttrs[n];return i?ni(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function Hf(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}):bs(o,Uf(e,0,n))}function jf(e,n){var l;if(jn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?bs(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 bs(i,Uf(o,r<0?0:r,n))}const Ov=["disabled"],Lv={class:"em-idxw__list"},Pv={class:"em-idxw__list-head"},zv=["aria-label"],Fv=["aria-current","onClick","onKeydown"],Uv={class:"em-idxw__item-name"},Hv={key:0,class:"em-idxw__badge"},jv={class:"em-idxw__item-cnt"},Kv={key:0,class:"em-idxw__empty"},Gv={key:0,class:"em-idxw__edit"},Yv={class:"em-idxw__form"},qv={class:"em-field em-idxw__name"},Wv={class:"em-field"},Jv=["value","placeholder"],Xv={class:"em-idxw__transfer"},Zv={class:"em-idxw__pane"},Qv={class:"em-idxw__pane-head"},eC=["aria-label"],tC=["aria-pressed","onClick","onKeydown"],nC=["title"],oC={key:0,class:"em-idxw__empty"},iC={class:"em-idxw__arrows"},aC={class:"em-idxw__pane"},rC={class:"em-idxw__pane-head"},lC={class:"em-idxw__col-name"},sC=["title"],cC={class:"em-idxw__col-ops"},dC=["title","disabled","onClick"],uC=["title","disabled","onClick"],mC=["title","onClick"],fC={key:0,class:"em-idxw__empty"},pC={key:1,class:"em-idxw__edit em-idxw__edit--empty"},hC=tt(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(k=>k.modelId===n.entityId)??null),a=t.computed(()=>{var k;return((k=i.value)==null?void 0:k.indexes)??[]}),r=t.computed(()=>{var k;return((k=i.value)==null?void 0:k.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,k=>{var v;k.some(I=>I.modelId===s.value)||(s.value=((v=k[0])==null?void 0:v.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(k=>k.modelId===s.value)??null),d=t.computed(()=>i.value?Qo(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Hn(r.value)),m=k=>u.value.canon(k),p=t.computed(()=>{var k;return new Set((((k=c.value)==null?void 0:k.columns)??[]).map(v=>m(v.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 y(k){return Hf(k,f.value)}function _(k){return k.physicalName&&k.physicalName!==k.field?`${k.field} (${k.physicalName})`:k.field}function g(k){return jf(k,f.value)}const b=t.computed(()=>[...r.value.filter(k=>k.dbAttrs.length>0&&!p.value.has(m(k.modelId))).map(k=>({ref:k.modelId,label:y(k),inherited:!1})),...d.value.filter(k=>!p.value.has(m(k.modelId))).map(k=>({ref:k.modelId,label:_(k),inherited:!0}))]),E=t.ref(new Set);t.watch(s,()=>E.value=new Set);function h(k){return jn(k)}function N(k,v){i.value&&o.updateIndex(i.value.modelId,k,v)}function w(){var v;if(!i.value)return;const k=Pe();o.addIndex(i.value.modelId,{modelId:k,name:`idx_${(((v=i.value.indexes)==null?void 0:v.length)??0)+1}`,unique:!1,columns:[]}),s.value=k}function C(k){i.value&&o.removeIndex(i.value.modelId,k)}function S(k){c.value&&N(c.value.modelId,{parameters:k.trim()===""?void 0:k})}function V(k){const v=new Set(E.value);v.has(k)?v.delete(k):v.add(k),E.value=v}function $(){const k=c.value;if(!k||!E.value.size)return;const v=[...E.value].map(I=>({columnRef:I,descending:!1}));N(k.modelId,{columns:[...k.columns,...v]}),E.value=new Set}function R(k){const v=c.value;v&&N(v.modelId,{columns:v.columns.filter((I,O)=>O!==k)})}function x(k,v){const I=c.value;I&&N(I.modelId,{columns:I.columns.map((O,A)=>A===k?{...O,descending:v}:O)})}function T(k,v){const I=c.value;if(!I)return;const O=k+v;if(O<0||O>=I.columns.length)return;const A=[...I.columns];[A[k],A[O]]=[A[O],A[k]],N(I.modelId,{columns:A}),M(O,v)}async function M(k,v){var H,oe;await t.nextTick();const I=(H=l.value)==null?void 0:H.querySelectorAll(".em-idxw__col--idx")[k];if(!I)return;const O=ue=>I.querySelector(`[data-move="${ue}"]`),A=O(v<0?"up":"down"),L=O(v<0?"down":"up");(oe=A&&!A.disabled?A:L)==null||oe.focus()}return(k,v)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",Lv,[t.createElementVNode("div",Pv,[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:w},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,I=>(t.openBlock(),t.createElementBlock("li",{key:I.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":I.modelId===s.value}]),role:"button",tabindex:"0","aria-current":I.modelId===s.value?"true":void 0,onClick:O=>s.value=I.modelId,onKeydown:[t.withKeys(t.withModifiers(O=>s.value=I.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>s.value=I.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",Uv,t.toDisplayString(I.name||t.unref(o).t("em.attr.nameless")),1),I.unique?(t.openBlock(),t.createElementBlock("span",Hv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",jv,t.toDisplayString(I.columns.length),1)],42,Fv))),128))],8,zv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Kv,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Gv,[t.createElementVNode("div",Yv,[t.createElementVNode("label",qv,[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":v[0]||(v[0]=I=>N(c.value.modelId,{name:I}))},null,8,["model-value"]),t.createVNode(fo,{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":v[1]||(v[1]=I=>N(c.value.modelId,{unique:I}))},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:v[2]||(v[2]=I=>C(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",Wv,[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:v[3]||(v[3]=I=>S(I.target.value))},null,40,Jv)]),t.createElementVNode("div",Xv,[t.createElementVNode("div",Zv,[t.createElementVNode("div",Qv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:b.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:b.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":E.value.has(I.ref)}]),role:"button",tabindex:"0","aria-pressed":E.value.has(I.ref),onClick:O=>V(I.ref),onKeydown:[t.withKeys(t.withModifiers(O=>V(I.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>V(I.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(I.label),1),I.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,nC)):t.createCommentVNode("",!0)],42,tC))),128))],8,eC),b.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",oC,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",iC,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!E.value.size,onClick:$},null,8,["caption","disabled"])]),t.createElementVNode("div",aC,[t.createElementVNode("div",rC,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,(I,O)=>(t.openBlock(),t.createElementBlock("li",{key:O,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",lC,[t.createTextVNode(t.toDisplayString(g(I.columnRef)),1),h(I.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,sC)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${O}`,class:"em-check",label:"DESC","model-value":I.descending,"onUpdate:modelValue":A=>x(O,A)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",cC,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:O===0,onClick:A=>T(O,-1)},"↑",8,dC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:O===c.value.columns.length-1,onClick:A=>T(O,1)},"↓",8,uC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:A=>R(O)},"✕",8,mC)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",fC,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",pC,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,Ov)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),yC={class:"em-op-src"},gC=["placeholder"],bC={class:"em-op-src__actions"},Kf=tt(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(l,s)=>qt(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",yC,[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,gC),[[t.vModelText,a.value]]),t.createElementVNode("div",bC,[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"]]),_C=["disabled"],kC={class:"em-ow__toolbar"},EC={class:"em-ow__count"},NC={class:"em-ow__scroll"},wC={class:"em-ow__table"},IC={class:"c-name"},vC={class:"c-desc"},CC=["id"],SC={class:"c-pii"},xC={class:"c-src"},RC={class:"c-del"},AC={key:0},$C={colspan:"6",class:"em-ow__empty"},TC=tt(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(g=>g.modelId===n.entityId)??null),r=t.computed(()=>{var g;return[...((g=a.value)==null?void 0:g.operations)??[]].sort((b,E)=>b.order-E.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(g){return g==="none"?o.t("em.common.noneParen"):g}const u=g=>g;function m(g,b){a.value&&o.updateOperation(a.value.modelId,g.modelId,b)}function p(g,b){m(g,{description:Object.keys(b).length?b:void 0})}function f(g){return g.personalInfoAttributeType??"none"}function y(g,b){m(g,{personalInfoAttributeType:b==="none"?void 0:b})}function _(g){i.openModal({component:Kf,bind:{operationName:g.name,sourceCode:g.sourceCode??"",locale:o.uiLocale.value,onSave:b=>m(g,{sourceCode:b})}})}return(g,b)=>{var E,h;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",kC,[t.createElementVNode("span",EC,t.toDisplayString(t.unref(o).t("em.op.section",{n:((E=a.value.operations)==null?void 0:E.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:b[0]||(b[0]=N=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",NC,[t.createElementVNode("table",wC,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",IC,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),b[2]||(b[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",vC,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,CC),t.createVNode(zf,{modelValue:l.value,"onUpdate:modelValue":b[1]||(b[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",SC,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",xC,t.toDisplayString(t.unref(o).t("em.op.body")),1),b[3]||(b[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":w=>m(N,{name:w})},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":w=>w&&m(N,{visibility:w})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(Yt,{name:`ow-desc-${N.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":N.description,"onUpdate:modelValue":w=>p(N,w)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":f(N),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":w=>w&&y(N,w)},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:w=>_(N)},null,8,["caption","onClick"])]),t.createElementVNode("td",RC,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])]))),128)),(h=a.value.operations)!=null&&h.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",AC,[t.createElementVNode("td",$C,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,_C)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),MC={class:"em-detail__tabs"},VC=["onClick"],BC={key:0,class:"em-detail__lock"},DC=["disabled"],OC={key:0,class:"em-detail__narrow"},LC=tt(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",MC,[(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,VC)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",BC,[t.createVNode(Ve,{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",OC,[t.createVNode(Tf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(Dv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(hC,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(TC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,DC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function lr(e,n,o){e.openModal({component:LC,bind:{controller:t.markRaw(n),entityId:o}})}function Nn(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=>Id(e,r))}function Wt(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 nu(l,r))i.push(wa(a,s.indexRef,{columns:s.columns}))}return i}function sr(e,n,o,i){var c;const a=[];a.push(...Nn(n,o.remove,i));for(const d of o.update)a.push(nn(n,d.attributeId,d.patch));for(const d of o.add)a.push(tn(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 y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,y)=>f.order-y.order)[0];p&&a.push(Ht(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function Ko(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Mi(e,n,o){const i=[];for(const[a,r]of Dc(e,n,Pe))i.push(...sr(e,a,r,o));for(const a of ou(e,n,Pe))i.push(nn(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function PC(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=dl([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return iu(e,n,r).map(l=>nn(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function Gf(e,n,o){return au(e,n,o).map(i=>nn(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function zC(e,n,o){const i=new Set(o.remove);return Ko(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 cr(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of Oc(e,r,Pe)){const c=i.get(l);i.set(l,c?Bc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...sr(e,r,FC(l),o));return a}function FC(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 Yf(e){return fn(e).map(n=>({...n.col,modelId:Pe()}))}function UC(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=zt(o.attributes),p=new Set(o.attributes.map(y=>y.name));let f="id";for(let y=2;p.has(f);y++)f=`id${y}`;a={modelId:Pe(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Pe(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(tn(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(b=>b.modelId===p.embedded.associationRef);if(!f)continue;const y=f.end1.entityRef===m.modelId,_=y?f.end1:f.end2,g=y?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:_.multiplicity,navigable:_.navigable,composition:!1},end2:{entityRef:n,multiplicity:g.multiplicity,navigable:g.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=ai(l,n,Pe);for(const m of r){const p=s.add.find(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...Nn(m.ownerId,[m.dispId],c)),i.push(Na(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...sr(l,n,s,c));const d=zC(l,n,s);return i.push(...Mi(d,n,c)),i.push(...Wt(e,c)),i}function HC(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(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var N;return((N=h.embedded)==null?void 0:N.associationRef)===r.modelId}))continue;const u=Pe(),m=zt(d.attributes),p=new Set(d.attributes.map(h=>h.name)),f=a(o.name);let y=f;for(let h=2;p.has(y);h++)y=`${f}${h}`;const _=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:Pe()})),g={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:_,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(tn(c,g));const b=l?"end2":"end1",E=l?"end1":"end2";i.push(Na(r.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Pe()},[E]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function qf(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=[kd(n,o),...i.map(u=>To(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(Dd(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(mi(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}function jC(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=Pe(),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=ai(p,s,Pe),y=f.add[0];y&&(m.end2.attributeRef=y.modelId);const _={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},g=Ea(m,_),b=sr(p,s,f,[]);return i(b.length?rt("관계 추가",[g,...b]):g),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(C=>C.modelId===l),d=n.logical.entities.find(C=>C.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Pe(),m=Pe(),p=Pe(),f=zt(c.attributes),y=Yf(d),_=C=>C&&C.charAt(0).toLowerCase()+C.slice(1),g=new Set(c.attributes.map(C=>C.name)),b=_(d.name);let E=b;for(let C=2;g.has(E);C++)E=`${b}${C}`;const h={modelId:m,name:E,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},N={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}},w={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(rt("임베드 추가",[tn(l,h),Ea(N,w)])),u},setEmbedCardinality(l,s){var b;if(r(l))return;const c=n.logical.associations.find(E=>E.modelId===l);if(!c)return;let d,u;for(const E of n.logical.entities){const h=E.attributes.find(N=>{var w;return((w=N.embedded)==null?void 0:w.associationRef)===l&&N.attrType==="EMBED_OWN"});if(h){d=E.modelId,u=h;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 y=E=>E==="ZERO_OR_MORE_INSTANCES"||E==="ONE_OR_MORE_INSTANCES",_=y(f.multiplicity),g=y(s);if(_===g){i(Ht(l,p,{multiplicity:s}));return}if(g)i(rt("임베드 컬렉션 전환",[nn(d,u.modelId,{dbAttrs:[]}),Ht(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((b=f.jpa)==null?void 0:b.collectionType)??"LIST"}})]));else{const E=n.logical.entities.find(h=>h.modelId===m);if(!E)return;i(rt("임베드 단일 전환",[nn(d,u.modelId,{dbAttrs:Yf(E)}),Ht(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=$d(l);if(!s){i(c);return}for(const f of n.logical.entities){const y=f.attributes.find(_=>{var g;return((g=_.embedded)==null?void 0:g.associationRef)===l});if(y){const _=[];i(rt("임베드 삭제",[c,...Nn(f.modelId,[y.modelId],_),...Wt(n.logical,_)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=cr(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(_=>_.modelId===s.end1.entityRef),y=f==null?void 0:f.attributes.find(_=>_.modelId===s.end1.attributeRef&&_.attrType==="RELATION_REF");y&&p.push(...Nn(f.modelId,[y.modelId],m))}p.push(...Wt(n.logical,m)),i(p.length?rt("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=Na(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)},p=[],f=cr(m,[u],p);f.push(...Wt(n.logical,p)),i(f.length?rt("식별 관계 변경",[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=Qi(d.end2.multiplicity),y=d.end1.navFieldNameHint||ta(m.name,f),_=No(y,new Set(u.attributes.map(h=>h.name))),g=Pe(),b=zt(u.attributes),E={modelId:g,name:_,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:b,dbAttrs:[]};i(rt("inverse nav 추가",[tn(d.end1.entityRef,E),Ht(l,"end1",{...c,attributeRef:g,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,y=u.attributes.find(E=>E.modelId===f&&E.attrType==="RELATION_REF"),_=Ht(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),g=[],b=y?Nn(d.end1.entityRef,[f],g):[];i(y?rt("inverse nav 제거",[...b,_,...Wt(n.logical,g)]):_);return}}}i(Ht(l,s,c))}}}function KC(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=nn(u,m,p),y=Ko(n.logical,u,b=>b.map(E=>E.modelId===m?{...E,...p}:E)),_=[],g=Mi(y,u,_);g.push(...Wt(n.logical,_)),i(g.length?rt("속성 수정",[f,...g]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(E=>E.type===m),f=n.logical.entities.find(E=>E.modelId===u);if(!p||!f)return null;const y=zt(f.attributes),_=Pe(),g=p.fields.map(()=>({modelId:Pe(),physicalName:"",dataType:""})),b={modelId:_,name:p.defaultName,type:p.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:g};return i(tn(u,b)),_},addAttribute(u,m={}){if(!o.value||a(u))return null;const p=n.logical.entities.find(w=>w.modelId===u),f=p?zt(p.attributes):0,y=m.modelId??Pe(),_=m.name??`field${f}`,g={modelId:y,name:_,type:m.type??Gr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Pe(),physicalName:_,dataType:"VARCHAR"}],...m},b=tn(u,g),E=Ko(n.logical,u,w=>[...w,g]),h=[],N=Mi(E,u,h);return N.push(...Wt(n.logical,h)),i(N.length?rt("속성 추가",[b,...N]):b),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(_=>_.modelId===u),p=m?zt(m.attributes):0,f=Pe();return i(tn(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?Yn:Gr})},setEmbedColumns(u,m,p){var E,h;if(a(u))return;const f=nn(u,m,{dbAttrs:p}),y=(E=n.logical.entities.find(N=>N.modelId===u))==null?void 0:E.attributes.find(N=>N.modelId===m),_=(h=y==null?void 0:y.embedded)==null?void 0:h.associationRef,g=_?n.logical.associations.find(N=>N.modelId===_):void 0,b=[];g&&_&&(g.end1.legacyEmbedRaw&&b.push(Ht(_,"end1",{legacyEmbedRaw:void 0})),g.end2.legacyEmbedRaw&&b.push(Ht(_,"end2",{legacyEmbedRaw:void 0}))),i(b.length?rt("임베드 컬럼 수정",[f,...b]):f)},removeAttribute(u,m){if(a(u))return;if(So(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=Nn(u,[m],p),y=Ko(n.logical,u,b=>b.filter(E=>E.modelId!==m)),_=[...Mi(y,u,p),...Wt(n.logical,p),...Gf(n.logical,u,[m])],g=[...f,..._];i(g.length===1?g[0]:rt("속성 삭제",g))},removeAttributes(u,m){var E;if(!m.length||a(u))return;const p=m.filter(h=>!So(n.logical,u,h));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],y=Nn(u,p,f),_=new Set(p),g=Ko(n.logical,u,h=>h.filter(N=>!_.has(N.modelId))),b=[...y,...Mi(g,u,f),...Wt(n.logical,f),...Gf(n.logical,u,p)];i(b.length===1?b[0]:rt("속성 삭제",b)),((E=c.value)==null?void 0:E.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,p){i(ba(u,m,p))},setAttributeSwatches(u,m,p){m.length&&(m.length===1?i(ba(u,m[0],p)):i(rt("속성 색상",m.map(f=>ba(u,f,p)))))},reorderAttributes(u,m,p){if(!m.length||a(u))return;const f=El(u,m,p),y=PC(n.logical,u,m,p);i(y.length?rt("속성 재정렬",[f,...y]):f)}}}function GC(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Pe(),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=Pe();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Pe()}for(const a of n.indexes??[]){a.modelId=Pe();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Pe();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const YC=220;function qC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||YC));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 _s=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function WC(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const _=c.filter(g=>n.logical.entities.some(b=>b.modelId===g));if(_.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:_}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const _=n.logical.entities.find(b=>b.modelId===d.entityId);if(!_)return;const g=[..._.attributes].sort((b,E)=>b.order-E.order).filter(b=>d.ids.includes(b.modelId));if(!g.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:g}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(_=>_.modelId===u),p=n.layout.entityLayouts.find(_=>_.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(p){const{entityRef:_,geo:g,locked:b,...E}=p;Object.keys(E).length&&(y=E)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,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 f=a.value;if(!f)return[];const y=n.logical.entities.find(N=>N.modelId===f);if(!y)return[];const _=new Set(y.attributes.map(N=>N.name)),g=new Set(y.attributes.flatMap(N=>N.dbAttrs.map(w=>w.physicalName))),b=zt(y.attributes),E=[],h=c.attributes.map((N,w)=>{const C=JSON.parse(JSON.stringify(N));C.modelId=Pe();for(const S of C.dbAttrs)S.modelId=Pe();_.has(C.name)&&(C.name=No(`${C.name}_copy`,_)),_.add(C.name);for(const S of C.dbAttrs)S.physicalName&&g.has(S.physicalName)&&(S.physicalName=No(`${S.physicalName}_copy`,g)),S.physicalName&&g.add(S.physicalName);return C.order=b+w,E.push(C.modelId),tn(f,C)});return l(h.length===1?h[0]:rt("속성 붙여넣기",h)),i.value={kind:"attribute",entityId:f,ids:E,anchor:E[E.length-1]},[]}const{clone:d,idMap:u}=GC(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},y=_=>u.get(_);f.attributeStyles&&(f.attributeStyles=pa(f.attributeStyles,y)),f.operationStyles&&(f.operationStyles=pa(f.operationStyles,y)),p=f}return l(ga(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=nd(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"?qC(n.layout,m.layout):p.offset,y=new Map(m.layout.entityLayouts.map(h=>[h.entityRef,h])),_=new Map(m.layout.associationLayouts.map(h=>[h.associationRef,h])),g=new Map(m.layout.groupLayouts.map(h=>[h.groupRef,h])),b=[];let E=80;for(const h of m.logical.entities){const N=y.get(h.modelId),w=N?{location:_s(N.geo.location,f),size:{...N.geo.size}}:{location:{x:E+=40,y:80},size:{width:220,height:140}};let C;if(N){const{entityRef:S,geo:V,locked:$,...R}=N;C=R}b.push(ga(h,w,C))}for(const h of m.logical.associations){const N=_.get(h.modelId),w=N?{...N,waypoints:N.waypoints.map(C=>_s(C,f))}:{associationRef:h.modelId,waypoints:[]};b.push(Ea(h,w))}for(const h of m.logical.groups){const N=g.get(h.modelId),w=N?{location:_s(N.geo.location,f),size:{...N.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let C;if(N){const{groupRef:S,geo:V,locked:$,memberNoteRefs:R,...x}=N;C=x}b.push(_a(h,w,C))}return l(rt("다이어그램 가져오기",b)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(h=>h.modelId)}};return s}function JC(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=Pe(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Pe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Pe(),physicalName:"id",dataType:"BIGINT"}]}]};return i(ga(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(md(s,c))},updateEntity(s,c){if(a(s))return;const d=ud(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(h=>h.identifier&&!h.derivedFrom).map(h=>nn(s,h.modelId,{identifier:!1})),y=Ko({...n.logical,entities:n.logical.entities.map(h=>h.modelId===s?{...h,stereotype:"JPA_EMBEDDABLE"}:h)},s,h=>h.map(N=>N.identifier&&!N.derivedFrom?{...N,identifier:!1}:N)),_=[],g=cr(y,[s],_);g.push(...Wt(n.logical,_));const b=HC(n.logical,s),E=[d,...f,...g,...b];i(E.length>1?rt("임베더블 변환",E):d);return}if(p){const f=UC(n.logical,s),y=[d,...f];i(y.length>1?rt("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(To(s,c))},resizeEntity(s,c){a(s)||i(fd(s,c))},removeEntity(s){if(a(s))return;const c=dd(s);if(!n.logical.entities.find(g=>g.modelId===s)){i(c);return}const u=n.logical.associations.filter(g=>g.end1.entityRef===s||g.end2.entityRef===s),m=new Set(u.map(g=>g.modelId)),p=[],f=[];for(const g of n.logical.entities)if(g.modelId!==s)for(const b of g.attributes)b.embedded&&m.has(b.embedded.associationRef)&&p.push(...Nn(g.modelId,[b.modelId],f));for(const g of u){if(g.end1.entityRef===s||!g.end1.attributeRef)continue;const b=n.logical.entities.find(h=>h.modelId===g.end1.entityRef),E=b==null?void 0:b.attributes.find(h=>h.modelId===g.end1.attributeRef&&h.attrType==="RELATION_REF");E&&p.push(...Nn(b.modelId,[E.modelId],f))}const y={...n.logical,entities:n.logical.entities.filter(g=>g.modelId!==s),associations:n.logical.associations.filter(g=>!m.has(g.modelId))},_=new Set(u.filter(g=>g.end1.entityRef===s&&g.end2.entityRef!==s).map(g=>g.end2.entityRef));p.push(...cr(y,[..._],f)),p.push(...Wt(n.logical,f.filter(g=>g.entityId!==s))),i(p.length?rt("엔티티 삭제",[c,...p]):c)},setEntitySwatch(s,c){i(pd(s,c))},setEntityCollapsed(s,c){i(hd(s,c))},setEntityLocked(s,c){i(yd(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(kl(!0))},expandAll(){i(kl(!1))}}}function XC(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(b=>n.layout.entityLayouts.find(E=>E.entityRef===b)).filter(b=>!!b);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,y=-1/0;for(const b of u){const E=b.geo.size.width||220,h=b.geo.size.height||140;m=Math.min(m,b.geo.location.x),p=Math.min(p,b.geo.location.y),f=Math.max(f,b.geo.location.x+E),y=Math.max(y,b.geo.location.y+h)}const _=40,g=28;return{location:{x:m-_,y:p-_-g},size:{width:f-m+_*2,height:y-p+_*2+g}}}return{dragGroup(d,u,m){l(d)||i(rt("그룹 이동",qf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Ed(d,u))},setGroupSwatch(d,u){i(Nd(d,u))},setGroupLocked(d,u){i(wd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(gd(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const _ of d)y.memberEntityRefs.includes(_)&&m.push(ka(y.modelId,_));const p=Pe(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(_a(f,c(d))),i(rt("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Pe();return i(_a({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(bd(d))},dropEntity(d,u,m){var y;if(r(d))return;const p=((y=n.logical.groups.find(_=>_.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,f=[To(d,u)];p!==m&&(p&&f.push(ka(p,d)),m&&f.push(_d(m,d))),i(rt("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(ka(u.modelId,d))},dropNote(d,u,m){var y;const p=((y=n.layout.groupLayouts.find(_=>{var g;return(g=_.memberNoteRefs)==null?void 0:g.includes(d)}))==null?void 0:y.groupRef)??null,f=[mi(d,u)];p!==m&&(p&&f.push(Kd(p,d)),m&&f.push(jd(m,d))),i(rt("이동",f))}}}function ZC(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){if(d(),!o.value||!e.opTransport)return;const b=new Qd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:E=>{i.value=!1,a.value=E},onError:e.onOpError});b.seed((g==null?void 0:g.revSeed)??{}),c=b.attach(_),s=b}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 y(_){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let g;try{g=await l(_)}catch(b){return{ok:!1,reason:b instanceof Error?b.message:String(b)}}return g.ok&&p.value++,g}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:y,reloadRequest:p}}function QC(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Pe();return o(Pd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(zd(i))},moveNote(i,a){o(mi(i,a))},resizeNote(i,a){o(Fd(i,a))},setNoteMemo(i,a){o(Ud(i,a))},setNoteSwatch(i,a){o(Hd(i,a))},addNoteConnection(i,a){o(Gd(i,a))},removeNoteConnection(i,a){o(Yd(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(qd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Wd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Jd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Xd(i,a))}}}function eS(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 N=p.ids.includes(u),w=N?p.ids.filter(S=>S!==u):[...p.ids,u];if(!w.length){o.value=null;return}const C=N&&p.anchor===u?w[w.length-1]:N?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:w,anchor:C};return}const y=n.logical.entities.find(N=>N.modelId===d),_=[...(y==null?void 0:y.attributes)??[]].sort((N,w)=>N.order-w.order).map(N=>N.modelId),g=_.indexOf(p.anchor),b=_.indexOf(u);if(g<0||b<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[E,h]=g<=b?[g,b]:[b,g];o.value={kind:"attribute",entityId:d,ids:_.slice(E,h+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(_=>_.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(_=>_.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 y=m.attributes[f].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 p=m.attributes,f=new Set(u.ids),y=p.map((N,w)=>f.has(N.modelId)?w:-1).filter(N=>N>=0);if(!y.length)return!1;const _=Math.min(...y),g=p.filter(N=>!f.has(N.modelId)),b=p.slice(0,_).filter(N=>!f.has(N.modelId)).length;let E;if(d<0){if(b<=0)return!0;E=b-1}else{if(g.length-b<=0)return!0;E=b+1}if(r(u.entityId))return!0;const h=p.filter(N=>f.has(N.modelId)).map(N=>N.modelId);return a(El(u.entityId,h,E)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(E=>E.modelId)),f=new Set(n.logical.groups.map(E=>E.modelId)),y=new Set(n.layout.notes.map(E=>E.modelId)),_=new Set;for(const E of d){if(!f.has(E))continue;const h=n.logical.groups.find(N=>N.modelId===E);for(const N of(h==null?void 0:h.memberEntityRefs)??[])_.add(N)}const g=[],b=[];for(const E of d)if(f.has(E)){if(s(E))continue;const h=n.layout.groupLayouts.find(S=>S.groupRef===E);if(!h)continue;const N=n.logical.groups.find(S=>S.modelId===E),w=((N==null?void 0:N.memberEntityRefs)??[]).map(S=>{var $;const V=(($=n.layout.entityLayouts.find(R=>R.entityRef===S))==null?void 0:$.geo.location)??{x:0,y:0};return{id:S,location:{x:V.x+u,y:V.y+m}}}),C={x:h.geo.location.x+u,y:h.geo.location.y+m};g.push(rt("그룹 이동",qf(n,E,C,w))),b.push("g:"+E)}else if(p.has(E)){if(_.has(E)||l(E))continue;const h=n.layout.entityLayouts.find(N=>N.entityRef===E);if(!h)continue;g.push(To(E,{x:h.geo.location.x+u,y:h.geo.location.y+m})),b.push("e:"+E)}else if(y.has(E)){const h=n.layout.notes.find(N=>N.modelId===E);if(!h)continue;g.push(mi(E,{x:h.geo.location.x+u,y:h.geo.location.y+m})),b.push("n:"+E)}return g.length?(a(rt("이동",g,"nudge:"+b.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const po=Symbol("editorController");function Wf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function tS(e=Wf(),n={}){var Se,je,Ze;const o=t.reactive(e);let i=new _l(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=(J,re)=>qt(u.value,J,re),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),_=t.ref(n.flagEntitiesWithoutRelations??!1),g=t.ref(!1),b=t.ref(!1),E=t.ref(!1),h=t.ref(0),N=t.ref(null);let w=0;const C=J=>{if(n.onNotice){n.onNotice(J);return}N.value={text:J,id:++w}},S=t.ref(((Se=n.meta)==null?void 0:Se.schemaVersion)??1),V=t.ref(((je=n.meta)==null?void 0:je.opWriteEnabled)??!1),$=t.ref(((Ze=n.meta)==null?void 0:Ze.referenceOnly)??!1),R=t.computed(()=>S.value>=2&&V.value),x=t.ref(!(S.value>=2&&V.value===!1)),T=t.ref("LOGICAL_PHYSICAL"),M=t.ref("straight"),k=t.ref(!0),v=t.ref(!0),I=t.ref(null),O=t.computed(()=>{var J;return((J=I.value)==null?void 0:J.kind)==="attribute"?{entityId:I.value.entityId,attrId:I.value.anchor}:null}),A=t.computed(()=>{var J;return((J=I.value)==null?void 0:J.kind)==="attribute"?I.value.ids:[]}),L=t.computed(()=>{var J,re;return((J=I.value)==null?void 0:J.kind)==="entity"?I.value.id:((re=I.value)==null?void 0:re.kind)==="attribute"?I.value.entityId:null}),H=t.ref(null),oe=t.ref(null),ue=t.ref(null),be=t.ref(null),pe=ZC({state:o,opMode:R,editable:x,opConflict:ue,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function he(){i.onChange(()=>{g.value=i.canUndo,b.value=i.canRedo,E.value=i.isDirty,h.value++})}he(),pe.setupOpAdapter(i,n.meta);const _e=t.computed(()=>Ys(o.logical,o.layout)),ye=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:_.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Ae=()=>zr(o.logical,$.value),Fe=n.validationDebounceMs??250;let se,ne=()=>{};if(Fe>0){const J=t.shallowRef(sa(Ae(),ye.value));let re;ne=()=>{re!==void 0&&(clearTimeout(re),re=void 0),J.value=sa(Ae(),ye.value)},t.watch([h,ye,$],()=>{re!==void 0&&clearTimeout(re),re=setTimeout(ne,Fe)},{flush:"sync"}),se=t.computed(()=>J.value)}else se=t.computed(()=>sa(Ae(),ye.value));const ae=t.computed(()=>{const J=new Map;for(const re of se.value){if(!re.targetRef)continue;const Ke=J.get(re.targetRef);Ke?Ke.push(re):J.set(re.targetRef,[re])}return J}),me=1500,P=new Map,D=J=>{const re=Date.now();re-(P.get(J)??0)<me||(P.set(J,re),C(J))},z=J=>{if(!be.value){if(!x.value){D(m("em.notice.readOnly"));return}try{i.execute(J)}catch(re){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${J.label}):`,re),x.value=!1,be.value={label:J.label}}}},Q=J=>o.layout.entityLayouts.some(re=>re.entityRef===J&&!!re.locked),ee=J=>o.layout.groupLayouts.some(re=>re.groupRef===J&&!!re.locked),we=J=>{const re=o.logical.associations.find(Ke=>Ke.modelId===J);return!!re&&(Q(re.end1.entityRef)||Q(re.end2.entityRef))},de=J=>Q(J)?(D(m("em.notice.entityLocked")),!0):!1,xe=J=>ee(J)?(D(m("em.notice.groupLocked")),!0):!1,Ce=J=>we(J)?(D(m("em.notice.assocLocked")),!0):!1,Y=WC({state:o,clipboard:oe,selection:I,inspectedEntityId:L,editable:x,run:z}),X=eS({state:o,selection:I,focusRequest:H,run:z,gateEntityLocked:de,isEntityLockedFn:Q,isGroupLockedFn:ee}),q=JC({state:o,editable:x,run:z,gateEntityLocked:de,isEntityLockedFn:Q,isAssocLockedFn:we}),Ie=KC({state:o,editable:x,run:z,gateEntityLocked:de,embeddableCatalog:a,t:m,emitGateNotice:D,selection:I}),Be=XC({state:o,editable:x,run:z,selection:I,gateEntityLocked:de,gateGroupLocked:xe,isGroupLockedFn:ee}),ze=QC({editable:x,run:z}),Ue=jC({state:o,editable:x,run:z,gateEntityLocked:de,gateAssocLocked:Ce});return{state:o,resolved:_e,issues:se,issuesByRef:ae,flagEntitiesWithoutRelations:_,canUndo:g,canRedo:b,dirty:E,revision:h,notice:N,editable:x,schemaVersion:S,opWriteEnabled:V,opMode:R,opConflict:ue,commandFailure:be,historyTransport:pe.historyTransport,historyAvailable:pe.historyAvailable,restoreTransport:pe.restoreTransport,restoreAvailable:pe.restoreAvailable,restoreToSeq:pe.restoreToSeq,reloadRequest:pe.reloadRequest,displayMode:T,routingMode:M,showGrid:k,showMinimap:v,selection:I,selectedAttr:O,selectedAttrIds:A,inspectedEntityId:L,focusRequest:H,clipboard:oe,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:$,uiLocale:u,t:m,selectableDataTypes:f,setEditable(J){x.value=J&&R.value},setEmbeddableCatalog(J){a.value=J},setGroupCodeCatalog(J){r.value=J},setPredefinedCustomTypeCatalog(J){l.value=J},setSuperClassCatalog(J){s.value=J},selectAttribute:X.selectAttribute,moveAttributeFocus:X.moveAttributeFocus,nudgeSelectedAttributes:X.nudgeSelectedAttributes,nudgeNodes:X.nudgeNodes,requestFocus:X.requestFocus,deleteSelection(){if(!x.value)return!1;const J=I.value;if(!J)return!1;if(J.kind==="attribute"){if(de(J.entityId))return!1;const re=J.ids;if(!re.length)return!1;re.length===1?Ie.removeAttribute(J.entityId,re[0]):Ie.removeAttributes(J.entityId,re)}else if(J.kind==="entity"){if(de(J.id))return!1;q.removeEntity(J.id)}else if(J.kind==="note")ze.removeNote(J.id);else if(J.kind==="group"){if(xe(J.id))return!1;Be.removeGroup(J.id)}else Ue.removeAssociation(J.id);return I.value=null,!0},undo:()=>{x.value&&i.undo()},redo:()=>{x.value&&i.redo()},markSaved:()=>{x.value&&(pe.flush(),i.markSavePoint())},loadDiagram(J,re){pe.teardownOpAdapter(),o.logical=J.logical,o.layout=J.layout,i=new _l(o),he(),S.value=(re==null?void 0:re.schemaVersion)??1,V.value=(re==null?void 0:re.opWriteEnabled)??!1,$.value=(re==null?void 0:re.referenceOnly)??!1,x.value=!(S.value>=2&&V.value===!1),ue.value=null,be.value=null,I.value=null,g.value=i.canUndo,b.value=i.canRedo,E.value=i.isDirty,pe.setupOpAdapter(i,re),ne()},flush:pe.flush,whenOpsSettled:pe.whenOpsSettled,addEntity:q.addEntity,renameEntity:q.renameEntity,updateEntity:q.updateEntity,moveEntity:q.moveEntity,resizeEntity:q.resizeEntity,removeEntity:q.removeEntity,setEntitySwatch:q.setEntitySwatch,setEntityCollapsed:q.setEntityCollapsed,setEntityLocked:q.setEntityLocked,isEntityLocked:q.isEntityLocked,isAssociationLocked:q.isAssociationLocked,collapseAll:q.collapseAll,expandAll:q.expandAll,setAttributeSwatch:Ie.setAttributeSwatch,dragGroup:Be.dragGroup,resizeGroup:Be.resizeGroup,setGroupSwatch:Be.setGroupSwatch,setGroupLocked:Be.setGroupLocked,isGroupLocked:Be.isGroupLocked,updateGroup:Be.updateGroup,createGroup:Be.createGroup,addEmptyGroup:Be.addEmptyGroup,removeGroup:Be.removeGroup,dropEntity:Be.dropEntity,ungroupEntity:Be.ungroupEntity,dropNote:Be.dropNote,addPredefinedEmbed:Ie.addPredefinedEmbed,addAttribute:Ie.addAttribute,addDivider:Ie.addDivider,updateAttribute:Ie.updateAttribute,setAttributeGroupCode:Ie.setAttributeGroupCode,setEmbedColumns:Ie.setEmbedColumns,removeAttribute:Ie.removeAttribute,removeAttributes:Ie.removeAttributes,setAttributeSwatches:Ie.setAttributeSwatches,reorderAttributes:Ie.reorderAttributes,addIndex(J,re){de(J)||z(Td(J,re))},updateIndex(J,re,Ke){de(J)||z(wa(J,re,Ke))},removeIndex(J,re){de(J)||z(Md(J,re))},addOperation(J,re={}){if(!x.value||de(J))return null;const Ke=o.logical.entities.find(We=>We.modelId===J),st=Ke!=null&&Ke.operations?zt(Ke.operations):0,qe=re.modelId??Pe(),nt={modelId:qe,name:re.name??`method${st}`,visibility:re.visibility??"PACKAGE",order:st,...re};return z(Cd(J,nt)),qe},updateOperation(J,re,Ke){de(J)||z(Sd(J,re,Ke))},removeOperation(J,re){de(J)||z(xd(J,re))},reorderOperations(J,re,Ke){!re.length||de(J)||z(Rd(J,re,Ke))},setOperationSwatch(J,re,Ke){z(Ad(J,re,Ke))},addAssociation:Ue.addAssociation,addEmbedAssociation:Ue.addEmbedAssociation,setEmbedCardinality:Ue.setEmbedCardinality,removeAssociation:Ue.removeAssociation,setAssociationIdentifying:Ue.setAssociationIdentifying,updateAssociationEnd:Ue.updateAssociationEnd,hasQuickFix(J){if(!x.value)return!1;const re=ol(J,o.logical);return re?re.kind==="setEndCascades"?!we(re.assocRef):!Q(re.entityRef):!1},applyQuickFix(J){if(!x.value)return!1;const re=ol(J,o.logical);if(!re)return!1;if(re.kind==="setIndexColumns")return de(re.entityRef)?!1:(z(wa(re.entityRef,re.indexRef,{columns:re.columns})),!0);if(Ce(re.assocRef))return!1;const Ke=o.logical.associations.find(st=>st.modelId===re.assocRef);return Ke?(z(Ht(re.assocRef,re.which,{jpa:{...Ke[re.which].jpa,cascadeTypes:re.cascades}})),!0):!1},moveWaypoint(J,re,Ke){z(Vd(J,re,Ke))},addWaypoint(J,re,Ke){z(Ld(J,re,Ke))},removeWaypoint(J,re){z(Bd(J,re))},clearWaypoints(J){z(Od(J))},addNote:ze.addNote,removeNote:ze.removeNote,moveNote:ze.moveNote,resizeNote:ze.resizeNote,setNoteMemo:ze.setNoteMemo,setNoteSwatch:ze.setNoteSwatch,addNoteConnection:ze.addNoteConnection,removeNoteConnection:ze.removeNoteConnection,moveNoteConnectionWaypoint:ze.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:ze.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:ze.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:ze.clearNoteConnectionWaypoints,autoLayout(){const J=qs(o.logical,o.layout);J.length&&z(rt("자동 배치",J.map(re=>To(re.id,re.location))))},copy:Y.copy,paste:Y.paste,importEntities:Y.importEntities}}const dr=Symbol("groupHover"),Jf=Symbol("groupDrag"),Go=Symbol("relationHighlight"),Xf=Symbol("diffOverlay"),Zf=Symbol("nodeInternals"),Qf=Symbol("columnResolution");function nS(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 ep(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!nS(e[o],n[o]))return!1;return!0}function tp(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(!ep(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function oS(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function iS(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||!oS(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!tp(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!ep(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!!aS(e.classRows,n.classRows)}function aS(e,n){if(e===n)return!0;if(!e||!n||e.length!==n.length)return!1;for(let o=0;o<e.length;o++){const i=e[o],a=n[o];if(i.synthetic!==a.synthetic||i.sourceAttrId!==a.sourceAttrId||i.targetName!==a.targetName||i.collection!==a.collection||i.attr!==a.attr&&!tp(i.attr,a.attr))return!1}return!0}function rS(){let e;return(n,o)=>e=lS(n,o,e)}function lS(e,n,o){const i=e.entities,a=new Map;let r=null;const l=()=>r??(r=new Map(i.map(s=>[s.modelId,s])));for(const s of i){const c=new Map,d=new Map,u=new Map;let m=null;const p=()=>m??(m=ko($n(s,i)));for(const E of s.attributes){if(Wi(E)){const C=E.dbAttrs[0];if(!(C!=null&&C.physicalName&&(C!=null&&C.dataType))){const S=Kn(E,s,i,e.associations);S&&c.set(E.modelId,{...E,dbAttrs:[{...C,physicalName:(C==null?void 0:C.physicalName)||S.physicalName,dataType:(C==null?void 0:C.dataType)||S.dataType,length:(C==null?void 0:C.length)??S.length,scale:(C==null?void 0:C.scale)??S.scale},...E.dbAttrs.slice(1)]})}}if(E.identifier&&E.attrType==="RELATION_OWN"){const C=So(e,s.modelId,E.modelId);if(C&&ua(E,C)){const S=c.get(E.modelId)??E,V=E.derivedIdFieldName||rl({...E,derivedIdFieldName:void 0},C,l());V&&c.set(E.modelId,{...S,derivedIdFieldName:V})}}const h=na(E,e.associations);if(h&&u.set(E.modelId,h),mn(E)){d.set(E.modelId,E.dbAttrs.map((C,S)=>{const V=Kn(E,s,i,e.associations,S);return V?{...C,physicalName:C.physicalName||V.physicalName,dataType:C.dataType||V.dataType,length:C.length??V.length,scale:C.scale??V.scale}:C}));continue}if(!E.attrType.startsWith("EMBED")||E.dbAttrs.length===0)continue;if(E.attrType!=="EMBED_PREDEF"){const C=p();d.set(E.modelId,E.dbAttrs.map((S,V)=>{const $=Gn(S,C);return $?{...S,physicalName:$.physicalName}:pn(E,S,V,s,e)}));continue}const N=n==null?void 0:n.find(C=>C.type===E.type);if(!N)continue;const w=p();d.set(E.modelId,E.dbAttrs.map((C,S)=>{const V=N.fields[S],$=Gn(C,w);return $?{...C,physicalName:$.physicalName,logicalName:C.logicalName??(V==null?void 0:V.logicalName),dataType:C.dataType||(V==null?void 0:V.dataType)||""}:V?{...C,physicalName:C.physicalName||V.physicalName,logicalName:C.logicalName??V.logicalName,dataType:C.dataType||V.dataType,length:C.length??V.length}:C}))}const f=new Map,y=new Map;for(const E of s.attributes){const h=d.get(E.modelId);if(h)for(let N=0;N<h.length;N++){const w=`${E.attrType}\0${E.type??""}\0${N}`,C={attrId:E.modelId,slot:N,name:h[N].physicalName??""},S=y.get(w);S?S.push(C):y.set(w,[C])}}for(const E of y.values()){if(E.length<2)continue;const h=new Map;for(const N of E)h.set(N.name,(h.get(N.name)??0)+1);for(const N of E){if((h.get(N.name)??0)<2)continue;const w=f.get(N.attrId);w?w.add(N.slot):f.set(N.attrId,new Set([N.slot]))}}const _=ll(s,e).fields.map(E=>{var h;return{attr:E.attr,synthetic:E.synthetic,sourceAttrId:E.sourceAttr.modelId,targetName:(h=E.target)==null?void 0:h.name,collection:E.collection}}),g={effectiveAttrs:c,embedCols:d,collectionTypes:u,redundantSlots:f,classRows:_},b=o==null?void 0:o.get(s.modelId);a.set(s.modelId,b&&iS(g,b)?b:g)}return a}const np=Symbol("embedSlotCollapse"),op=(e,n)=>`${e}:${n}`,ip="all:",ap="one:",rp="fk:",lp=e=>`${ip}${e}`,sS=(e,n)=>`${ap}${e}:${n}`,cS=(e,n)=>`${rp}${e}:${n}`,dS=e=>e.startsWith(rp)||!e.startsWith(ip)&&!e.startsWith(ap),uS=["title"],mS={key:0,class:"em-sel","aria-hidden":"true"},fS=["title","aria-expanded","disabled"],pS={class:"em-entity__stereotype"},hS={key:1,class:"em-entity__name"},yS=["title","aria-expanded"],gS={"aria-hidden":"true"},bS=["data-attr","title","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],_S=["onPointerdown"],kS={key:1,class:"em-entity__divider-label"},ES=["title"],NS={class:"em-key-slot"},wS={class:"em-key-slot"},IS=["title","aria-expanded","onClick"],vS=["title","onClick"],CS=["title","aria-expanded","onClick"],SS={key:2,class:"em-entity__type"},xS=["onClick"],RS={class:"em-entity__attrname"},AS={class:"em-entity__type"},$S={key:1,class:"em-entity__embed-summary"},TS=["title"],MS=["data-op"],VS=["onPointerdown"],BS={class:"em-entity__op-vis","aria-hidden":"true"},DS=["title"],OS={key:4,class:"em-entity__footer"},sp=tt(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(po,null),i=(G,W)=>o?o.t(G,W):qt("ko",G,W),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=te.useModal();function l(){o&&lr(r,o,n.id)}const s=t.inject(dr,null),c=t.inject(Go,null),d=t.inject(Xf,null),u=t.computed(()=>{var G;return((G=d==null?void 0:d.marks.value)==null?void 0:G.get(n.id))??null}),m=t.inject(Qf,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(np,void 0),y=t.inject(Zf,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const _=t.computed(()=>!!o&&o.editable.value);function g(){s&&(s.value=n.data.groupRef??null)}function b(){c==null||c.setEntityHover(n.id)}function E(){c==null||c.setEntityHover(null)}const h=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),N=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!h.value),w=t.computed(()=>{var G;return((G=o==null?void 0:o.selection.value)==null?void 0:G.kind)==="entity"&&o.selection.value.id===n.id}),C=t.computed(()=>!!n.selected&&!w.value),S=t.computed(()=>{var G;return o&&((G=o.selectedAttr.value)==null?void 0:G.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),V=t.computed(()=>S.value.size>0);function $(G,W){const ve=W.shiftKey?"range":W.metaKey||W.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,O(G),ve)}const R=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!w.value),x=t.computed(()=>n.data.entity),T=t.computed(()=>qh(x.value,o==null?void 0:o.referenceOnlyDocument.value)),M=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),k=t.computed(()=>{var G;if(M.value==="CLASS"){const W=(G=p.value)==null?void 0:G.classRows;if(W)return W.map(ve=>ve.attr)}return[...x.value.attributes].sort((W,ve)=>W.order-ve.order)}),v=t.computed(()=>{var W;const G=M.value==="CLASS"?(W=p.value)==null?void 0:W.classRows:void 0;return new Set((G??[]).filter(ve=>ve.synthetic).map(ve=>ve.attr.modelId))});function I(G){return v.value.has(G.modelId)}function O(G){return H.value.get(G.modelId)??G.modelId}function A(G){return S.value.has(O(G))}function L(G){var W;return!!((W=u.value)!=null&&W.changedAttributeIds.has(O(G)))}const H=t.computed(()=>{var W;const G=new Map;if(M.value!=="CLASS")return G;for(const ve of((W=p.value)==null?void 0:W.classRows)??[])ve.synthetic&&G.set(ve.attr.modelId,ve.sourceAttrId);return G}),oe=t.computed(()=>{var ve;const G=new Map,W=M.value==="CLASS";for(const $e of((ve=p.value)==null?void 0:ve.classRows)??[])!W&&!mn($e.attr)||($e.targetName||$e.collection)&&G.set($e.attr.modelId,{targetName:$e.targetName,collection:$e.collection});return G}),ue=t.computed(()=>n.data.collapsed??!1),be=t.computed(()=>n.data.locked??!1),pe=t.computed(()=>_.value&&!be.value);function he(){_.value&&(o==null||o.setEntityCollapsed(n.id,!ue.value))}const _e=t.computed(()=>M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL"),ye=t.computed(()=>{const G=M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL",W={};for(const ve of k.value){const $e=ve.attrType.startsWith("RELATION")&&ve.dbAttrs.length>0;W[ve.modelId]={pk:ve.identifier,fk:$e&&G,required:ve.notNull&&!ve.identifier}}return W});function Ae(G){if(!G)return"";const W=[];return G.pk&&G.fk?W.push(i("em.node.keyPfk")):G.pk?W.push(i("em.node.keyPk")):G.fk&&W.push(i("em.node.keyFk")),G.required&&W.push(i("em.node.required")),W.join(" · ")}const Fe=t.computed(()=>{const G=hs(St(n.data.style)),W={};return G&&(W["--em-header-bg"]=G.bar,W["--em-header-fg"]=G.barOn),W});function se(G){var W,ve;return(ve=hs(St((W=n.data.attributeStyles)==null?void 0:W[G.modelId])))==null?void 0:ve.text}const ne=t.computed(()=>[...x.value.operations??[]].sort((G,W)=>G.order-W.order)),ae=t.computed(()=>M.value==="CLASS"&&ne.value.length>0),me={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function P(G){return G?me[G]:"~"}function D(G){var W,ve;return(ve=hs(St((W=n.data.operationStyles)==null?void 0:W[G.modelId])))==null?void 0:ve.text}function z(G,W,ve){switch(M.value){case"CLASS":return[{text:G}];case"PHYSICAL":return[{text:ve||G}];case"LOGICAL":return[W?{text:W}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const $e=W?{text:W}:{text:i("em.node.logicalMissing"),missing:!0};return ve?[$e,{text:` · ${ve}`}]:[$e]}}}function Q(G){var W;return((W=p.value)==null?void 0:W.effectiveAttrs.get(G.modelId))??G}function ee(G){var ve,$e,Ee;if(Ce(G))return[{text:G.name}];const W=Q(G);return z(we(G),($e=(ve=W.dbAttrs[0])==null?void 0:ve.logicalName)==null?void 0:$e[a.value],((Ee=W.dbAttrs[0])==null?void 0:Ee.physicalName)??"")}function we(G){return M.value==="CLASS"?G.name:Q(G).derivedIdFieldName||G.name}function de(G){return G.attrType.startsWith("EMBED")&&G.dbAttrs.length>0}const xe=mn;function Ce(G){return de(G)||xe(G)}function Y(G){return xe(G)?cS(n.id,G.modelId):sS(n.id,G.modelId)}function X(G){return G.attrType==="DIVIDER"}function q(G){var W;return((W=p.value)==null?void 0:W.embedCols.get(G.modelId))??G.dbAttrs}function Ie(G){var W;return(W=p.value)==null?void 0:W.redundantSlots.get(G.modelId)}const Be=t.computed(()=>(f==null?void 0:f.isCollapsed(lp(n.id)))??!1),ze=t.computed(()=>Be.value&&_e.value?k.value.reduce((G,W)=>Ce(W)?G+q(W).length:G,0):0),Ue=t.computed(()=>k.value.some(G=>Ce(G)));function ie(G){const W=Ie(G);return!W||W.size===0?!1:f?f.isCollapsed(op(n.id,G.modelId)):!1}function Se(G){var W;return ie(G)?((W=Ie(G))==null?void 0:W.size)??0:0}function je(G){return f?f.isCollapsed(Y(G)):!1}function Ze(G){var W;return!_e.value||Be.value?null:je(G)?"attr":(((W=Ie(G))==null?void 0:W.size)??0)>0?"slot":null}function J(G){return!Be.value&&Ce(G)}function re(G){return je(G)?q(G).length:0}function Ke(G){if(Be.value||je(G))return[];const W=q(G);if(!ie(G))return W;const ve=Ie(G);return W.filter(($e,Ee)=>!ve.has(Ee))}function st(G){f==null||f.toggle(op(n.id,G.modelId))}function qe(G){f==null||f.toggle(Y(G))}function nt(){f==null||f.toggle(lp(n.id))}function We(G){var W;return z(G.physicalName,(W=G.logicalName)==null?void 0:W[a.value],G.physicalName)}function K(G){var $e;const W=oe.value.get(G.modelId),ve=(W==null?void 0:W.collection)??(($e=p.value)==null?void 0:$e.collectionTypes.get(G.modelId));return Yr(M.value,Q(G),ve,W==null?void 0:W.targetName)}const le=t.computed(()=>{const G={};for(const W of k.value)G[W.modelId]=K(W);return G}),Re=t.computed(()=>{var G,W,ve;return z(x.value.name,(W=(G=x.value.table)==null?void 0:G.logicalName)==null?void 0:W[a.value],((ve=x.value.table)==null?void 0:ve.physicalName)??"")}),ke=t.ref(!1),U=t.ref(""),bt=t.ref(null);async function vt(){var G,W;pe.value&&(U.value=x.value.name,ke.value=!0,await t.nextTick(),(G=bt.value)==null||G.focus(),(W=bt.value)==null||W.select())}function ot(){if(!ke.value)return;ke.value=!1;const G=U.value.trim();G&&G!==x.value.name&&(o==null||o.renameEntity(n.id,G))}function Ge(){o==null||o.addAttribute(n.id)}function Xe(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:Z,findNode:Rt}=et(),$t=t.ref(null),Sn=t.computed(()=>{const G=$t.value??n.data.size;return G?{width:`${G.width}px`,minHeight:`${G.height}px`}:void 0});let At=null;function ge(G){var $e,Ee,Qe;if(!pe.value)return;G.stopPropagation();const W=($e=Rt(n.id))==null?void 0:$e.dimensions,ve=Z({x:G.clientX,y:G.clientY});At={fx:ve.x,fy:ve.y,w:(W==null?void 0:W.width)??((Ee=n.data.size)==null?void 0:Ee.width)??200,h:(W==null?void 0:W.height)??((Qe=n.data.size)==null?void 0:Qe.height)??120},G.target.setPointerCapture(G.pointerId)}function ft(G){if(!At)return;const W=Z({x:G.clientX,y:G.clientY});$t.value={width:Math.max(40,At.w+(W.x-At.fx)),height:Math.max(40,At.h+(W.y-At.fy))}}function xn(G){var W,ve,$e;if(At&&$t.value&&o){const Ee=(W=Rt(n.id))==null?void 0:W.dimensions;o.resizeEntity(n.id,{width:Math.round((Ee==null?void 0:Ee.width)??$t.value.width),height:Math.round((Ee==null?void 0:Ee.height)??$t.value.height)})}At=null,$t.value=null,($e=(ve=G.target).releasePointerCapture)==null||$e.call(ve,G.pointerId)}const Zt=t.ref(null),B=t.ref(null);function F(G,W){if(!pe.value)return;W.stopPropagation(),W.preventDefault();const ve=S.value,$e=ve.has(G.modelId)?new Set(ve):new Set([G.modelId]);B.value={ids:$e,dropIndex:-1,lineY:0},W.target.setPointerCapture(W.pointerId)}function j(G){if(!B.value||!Zt.value)return;const W=Array.from(Zt.value.querySelectorAll(".em-entity__row"));if(!W.length)return;let ve=W.length;for(let Qe=0;Qe<W.length;Qe++){const Tt=W[Qe].getBoundingClientRect();if(G.clientY<Tt.top+Tt.height/2){ve=Qe;break}}const $e=W[W.length-1],Ee=ve<W.length?W[ve].offsetTop:$e.offsetTop+$e.offsetHeight;B.value={...B.value,dropIndex:ve,lineY:Ee}}function fe(){const G=B.value;if(B.value=null,!G||G.dropIndex<0)return;const W=k.value,ve=W.filter(Et=>G.ids.has(Et.modelId)).map(Et=>Et.modelId),$e=W.filter((Et,_o)=>G.ids.has(Et.modelId)&&_o<G.dropIndex).length,Ee=G.dropIndex-$e,Qe=W.filter(Et=>!G.ids.has(Et.modelId)).map(Et=>Et.modelId);[...Qe.slice(0,Ee),...ve,...Qe.slice(Ee)].join(",")!==W.map(Et=>Et.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,ve,Ee))}function Te(){B.value=null}const Oe=t.ref(null),ce=t.ref(null);function Le(G,W){pe.value&&(W.stopPropagation(),W.preventDefault(),ce.value={id:G.modelId,dropIndex:-1,lineY:0},W.target.setPointerCapture(W.pointerId))}function Ye(G){if(!ce.value||!Oe.value)return;const W=Array.from(Oe.value.querySelectorAll(".em-entity__op-row"));if(!W.length)return;let ve=W.length;for(let Qe=0;Qe<W.length;Qe++){const Tt=W[Qe].getBoundingClientRect();if(G.clientY<Tt.top+Tt.height/2){ve=Qe;break}}const $e=W[W.length-1],Ee=ve<W.length?W[ve].offsetTop:$e.offsetTop+$e.offsetHeight;ce.value={...ce.value,dropIndex:ve,lineY:Ee}}function Je(){const G=ce.value;if(ce.value=null,!G||G.dropIndex<0)return;const ve=ne.value.findIndex(Ee=>Ee.modelId===G.id);if(ve<0)return;const $e=G.dropIndex-(ve<G.dropIndex?1:0);$e!==ve&&(o==null||o.reorderOperations(n.id,[G.id],$e))}function ut(){ce.value=null}return(G,W)=>{var ve,$e;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":h.value,"is-related":N.value,"is-dimmed":R.value,"is-selected":w.value,"is-multi-selected":C.value,"has-focused-attr":V.value,"is-locked":be.value,"is-reference-only":T.value,"is-diff-added":((ve=u.value)==null?void 0:ve.verb)==="added","is-diff-modified":(($e=u.value)==null?void 0:$e.verb)==="modified"}]),tabindex:"-1",title:T.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(Sn.value),onPointerdown:g,onMouseenter:b,onMouseleave:E,onDblclick:l},[w.value?(t.openBlock(),t.createElementBlock("div",mS,[...W[11]||(W[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(Fe.value),onDblclick:t.withModifiers(vt,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(ue.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!ue.value,disabled:!_.value,onClick:t.withModifiers(he,["stop"]),onPointerdown:W[0]||(W[0]=t.withModifiers(()=>{},["stop"])),onDblclick:W[1]||(W[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(ue.value?"▸":"▾"),41,fS),t.createElementVNode("span",pS,"«"+t.toDisplayString(t.unref(ei)(x.value.stereotype))+"»",1),ke.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:bt,"onUpdate:modelValue":W[2]||(W[2]=Ee=>U.value=Ee),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(ot,["enter"]),W[3]||(W[3]=t.withKeys(Ee=>ke.value=!1,["esc"]))],onBlur:ot,onPointerdown:W[4]||(W[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,U.value]]):(t.openBlock(),t.createElementBlock("span",hS,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Re.value,(Ee,Qe)=>(t.openBlock(),t.createElementBlock("span",{key:Qe,class:t.normalizeClass({"em-entity__missing":Ee.missing})},t.toDisplayString(Ee.text),3))),128))])),!ue.value&&_e.value&&Ue.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:Be.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!Be.value,onClick:t.withModifiers(nt,["stop"]),onPointerdown:W[5]||(W[5]=t.withModifiers(()=>{},["stop"])),onDblclick:W[6]||(W[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ve,{name:"table",size:11}),t.createElementVNode("span",gS,t.toDisplayString(Be.value?"▸":"▾"),1)],40,yS)):t.createCommentVNode("",!0),be.value?(t.openBlock(),t.createBlock(Ve,{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),ue.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:Zt,class:"em-entity__attrs"},[B.value&&B.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${B.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,Ee=>{var Qe,Tt,Et,_o,Gi;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":A(Ee),"is-dragging":(Qe=B.value)==null?void 0:Qe.ids.has(Ee.modelId),"is-embed":Ce(Ee),"is-divider":X(Ee),"has-embed-badge":!!Ze(Ee),nodrag:X(Ee)&&pe.value,"is-diff-changed":L(Ee),"is-synthetic":I(Ee)}]),"data-attr":Ee.modelId,title:I(Ee)?i("em.node.derivedIdRow"):void 0,onClick:t.withModifiers(pt=>$(Ee,pt),["stop"]),onPointerdown:pt=>X(Ee)?F(Ee,pt):void 0,onPointermove:pt=>X(Ee)?j(pt):void 0,onPointerup:pt=>X(Ee)?fe():void 0,onPointercancel:pt=>X(Ee)?Te():void 0},[pe.value&&!X(Ee)&&!I(Ee)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:pt=>F(Ee,pt),onPointermove:j,onPointerup:fe,onPointercancel:Te,onClick:W[7]||(W[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,_S)):t.createCommentVNode("",!0),X(Ee)?(t.openBlock(),t.createElementBlock("span",kS,t.toDisplayString(Ee.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(so),{id:`l:${Ee.modelId}`,type:"target",position:t.unref(De).Left,class:"em-handle",title:pe.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:Ae(ye.value[Ee.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",NS,[(Tt=ye.value[Ee.modelId])!=null&&Tt.pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Et=ye.value[Ee.modelId])!=null&&Et.required?(t.openBlock(),t.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",wS,[_e.value&&J(Ee)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:je(Ee)?i("em.node.embedAttrShow",{count:re(Ee)}):i("em.node.embedAttrHide"),"aria-expanded":!je(Ee),onClick:t.withModifiers(pt=>qe(Ee),["stop"]),onPointerdown:W[8]||(W[8]=t.withModifiers(()=>{},["stop"])),onDblclick:W[9]||(W[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(je(Ee)?"▸":"▾"),41,IS)):Ce(Ee)?(t.openBlock(),t.createBlock(Ve,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(_o=ye.value[Ee.modelId])!=null&&_o.fk?(t.openBlock(),t.createBlock(Ve,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,ES),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:se(Ee)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ee(Ee),(pt,Rn)=>(t.openBlock(),t.createElementBlock("span",{key:Rn,class:t.normalizeClass({"em-entity__missing":pt.missing})},t.toDisplayString(pt.text),3))),128))],4),Ze(Ee)==="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:re(Ee)}),onClick:t.withModifiers(pt=>qe(Ee),["stop"])},"+"+t.toDisplayString(re(Ee)),9,vS)):Ze(Ee)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:ie(Ee)?i("em.node.embedRepeatedShow",{count:((Gi=Ie(Ee))==null?void 0:Gi.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!ie(Ee),onClick:t.withModifiers(pt=>st(Ee),["stop"])},t.toDisplayString(ie(Ee)?`+${Se(Ee)}`:"−"),9,CS)):t.createCommentVNode("",!0),le.value[Ee.modelId]?(t.openBlock(),t.createElementBlock("span",SS,t.toDisplayString(le.value[Ee.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(so),{id:`r:${Ee.modelId}`,type:"source",position:t.unref(De).Right,class:"em-handle",title:pe.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,bS),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ce(Ee)&&_e.value?Ke(Ee):[],pt=>(t.openBlock(),t.createElementBlock("li",{key:`${Ee.modelId}:${pt.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":A(Ee)}]),onClick:t.withModifiers(Rn=>$(Ee,Rn),["stop"])},[W[12]||(W[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",RS,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(We(pt),(Rn,Mr)=>(t.openBlock(),t.createElementBlock("span",{key:Mr,class:t.normalizeClass({"em-entity__missing":Rn.missing})},t.toDisplayString(Rn.text),3))),128))]),t.createElementVNode("span",AS,t.toDisplayString(pt.dataType),1)],10,xS))),128))],64)}),128)),ze.value?(t.openBlock(),t.createElementBlock("li",$S,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(nt,["stop"])},[t.createVNode(Ve,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:ze.value})),1)],8,TS)])):t.createCommentVNode("",!0)],512)),!ue.value&&ae.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Oe,class:"em-entity__ops"},[ce.value&&ce.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ce.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ne.value,Ee=>{var Qe,Tt;return t.openBlock(),t.createElementBlock("li",{key:Ee.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Qe=ce.value)==null?void 0:Qe.id)===Ee.modelId,"is-diff-changed":!!((Tt=u.value)!=null&&Tt.changedOperationIds.has(Ee.modelId))}]),"data-op":Ee.modelId},[pe.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Et=>Le(Ee,Et),onPointermove:Ye,onPointerup:Je,onPointercancel:ut,onClick:W[10]||(W[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,VS)):t.createCommentVNode("",!0),t.createElementVNode("span",BS,t.toDisplayString(P(Ee.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:D(Ee)})},t.toDisplayString(Ee.name)+"()",5)],10,MS)}),128))],512)):ne.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ne.value.length})},[t.createVNode(Ve,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ne.value.length})),1)],8,DS)):t.createCommentVNode("",!0),pe.value?(t.openBlock(),t.createElementBlock("footer",OS,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Ge},t.toDisplayString(i("em.node.addAttr")),1),W[13]||(W[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:Xe},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),pe.value&&!ke.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:ge,onPointermove:ft,onPointerup:xn},null,32)):t.createCommentVNode("",!0)],46,uS)}}}),[["__scopeId","data-v-79399400"]]),LS={key:0,class:"em-sel","aria-hidden":"true"},PS={class:"em-group__label"},zS={class:"em-group__name"},FS={key:0,class:"em-group__pkg"},US={key:1,class:"em-group__flag"},cp=tt(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(()=>St(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(po,null),s=(x,T)=>l?l.t(x,T):qt("ko",x,T),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var x;return!!n.id&&((x=l==null?void 0:l.selection.value)==null?void 0:x.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(dr,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Go,null);function y(){n.id&&(f==null||f.setGroupHover(n.id))}function _(){f==null||f.setGroupHover(null)}const g=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),b=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:E,findNode:h}=et();let N=null,w=null;function C(x){var k;if(!n.id||!c.value)return;x.stopPropagation();const T=((k=h(n.id))==null?void 0:k.dimensions)??{width:400,height:300},M=E({x:x.clientX,y:x.clientY});N={fx:M.x,fy:M.y,w:T.width,h:T.height},x.target.setPointerCapture(x.pointerId)}function S(x){if(!N||!n.id)return;const T=E({x:x.clientX,y:x.clientY});w={width:Math.max(160,N.w+(T.x-N.fx)),height:Math.max(120,N.h+(T.y-N.fy))};const M=h(n.id);M&&(M.style={width:`${w.width}px`,height:`${w.height}px`})}function V(x){var T,M;N&&w&&n.id&&l&&l.resizeGroup(n.id,w),N=null,w=null,(M=(T=x.target).releasePointerCapture)==null||M.call(T,x.pointerId)}const $=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),R=t.computed(()=>{const x=o.value.name;return(x==null?void 0:x[$.value])||(x==null?void 0:x.ko)||(x==null?void 0:x.en)||(x==null?void 0:x.ja)||(x==null?void 0:x.zh)||o.value.packageName||s("em.group.fallback")});return(x,T)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":g.value,"is-dimmed":b.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:_},[d.value?(t.openBlock(),t.createElementBlock("div",LS,[...T[0]||(T[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",PS,[t.createElementVNode("span",zS,t.toDisplayString(R.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",FS,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",US,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ve,{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:C,onPointermove:S,onPointerup:V},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),HS={key:0,class:"em-sel","aria-hidden":"true"},jS={key:2,class:"em-note__text"},dp=tt(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(po,null),i=t.inject(dr,null),a=t.inject(Go,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>St(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 k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),y=t.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===n.id}),_=t.computed(()=>!!n.selected&&!y.value),g=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),b=[{id:"n-top",pos:De.Top},{id:"n-right",pos:De.Right},{id:"n-bottom",pos:De.Bottom},{id:"n-left",pos:De.Left}],E=t.ref(!1),h=t.ref(""),N=t.ref(null);async function w(){var k;l.value&&(h.value=r.value.memo,E.value=!0,await t.nextTick(),(k=N.value)==null||k.focus())}function C(){E.value&&(E.value=!1,h.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,h.value)))}const{screenToFlowCoordinate:S,findNode:V}=et();let $=null,R=null;function x(k){var O;if(!l.value)return;k.stopPropagation();const v=((O=V(n.id))==null?void 0:O.dimensions)??r.value.geo.size,I=S({x:k.clientX,y:k.clientY});$={fx:I.x,fy:I.y,w:v.width,h:v.height},k.target.setPointerCapture(k.pointerId)}function T(k){if(!$)return;const v=S({x:k.clientX,y:k.clientY});R={width:Math.max(140,$.w+(v.x-$.fx)),height:Math.max(60,$.h+(v.y-$.fy))};const I=V(n.id);I&&(I.style={width:`${R.width}px`,height:`${R.height}px`})}function M(k){var v,I;$&&R&&o&&o.resizeNote(n.id,R),$=null,R=null,(I=(v=k.target).releasePointerCapture)==null||I.call(v,k.pointerId)}return(k,v)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":g.value,"is-selected":y.value,"is-multi-selected":_.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:w,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",HS,[...v[4]||(v[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),E.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:N,"onUpdate:modelValue":v[0]||(v[0]=I=>h.value=I),class:"em-note__edit nodrag",onBlur:C,onKeydown:v[1]||(v[1]=t.withKeys(I=>E.value=!1,["esc"])),onPointerdown:v[2]||(v[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,h.value]]):(t.openBlock(),t.createElementBlock("div",jS,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(b,I=>t.createVNode(t.unref(so),{id:I.id,key:I.id,type:"source",position:I.pos,class:"em-note-handle",onPointerdown:v[3]||(v[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!E.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:x,onPointermove:T,onPointerup:M},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function ur(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 Yo=.5;function up(e,n,o,i,a,r){const l=ur(n),s=ur(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=(g,b)=>{(Math.abs(g.x-p.x)>=Yo||Math.abs(g.y-p.y)>=Yo)&&(m.push({a:p,b:g,seg:b}),p=g)};f(c,0);let y=l.x!==0,_=c;for(let g=1;g<u.length;g++){const b=u[g],E=g<=o.length?g-1:o.length,h=Math.abs(b.x-_.x)<Yo,N=Math.abs(b.y-_.y)<Yo;h&&N||(h?(f(b,E),y=!1):N?(f(b,E),y=!0):y?(f({x:_.x,y:b.y},E),f(b,E),y=!0):(f({x:b.x,y:_.y},E),f(b,E),y=!1),_=b)}return f(i,o.length),m}function mp(e,n,o,i,a,r=20){const l=up(e,n,o,i,a,r);let s=`M ${xt(e.x)},${xt(e.y)}`;for(const c of l)s+=` L ${xt(c.b.x)},${xt(c.b.y)}`;return s}const KS=14;function fp(e,n,o,i,a,r=20){return up(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=KS).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function xt(e){return Math.round(e*100)/100}const GS=36;function YS(e,n,o=GS){const i=Math.max(e.x,n.x)+o;return`M ${xt(e.x)},${xt(e.y)} L ${xt(i)},${xt(e.y)} L ${xt(i)},${xt(n.y)} L ${xt(n.x)},${xt(n.y)}`}function pp(e,n,o){const i=[e,...n,o];let a=`M ${xt(i[0].x)},${xt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${xt(i[r].x)},${xt(i[r].y)}`;return a}function qS(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function hp(e,n){const o=qS(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Yo&&Math.abs(l)<Yo)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 yp(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 gp(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 WS=20,JS=22,XS=7,ZS=22,bp=31,_p=7,QS=20,kp=11,Ep=11,ex=bp+_p;function tx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function nx(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function mr(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 Np(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function fr(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function wp(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Np(e,n);return[fr(o,a,r-Math.PI/2),fr(o,a,r+Math.PI/2)]}function Ip(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 vp(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=mr(e,n,WS),[d,u]=wp(e,n,c,JS);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}),tx(o.multiplicity)){const m=mr(e,n,bp);r.push({cx:m.x,cy:m.y,r:_p})}if(nx(o.multiplicity)){const m=mr(e,n,XS),[p,f]=wp(e,n,m,ZS);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=mr(e,n,QS),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Np(e,n),m=fr(d,kp/2,u-Math.PI/2),p=fr(d,kp/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=Ip(s,c,Ep,!0),u=Ip(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 Cp=200,Sp=120,ks=24;function xp(e){var a,r;if(!e)return{x:0,y:0,width:Cp,height:Sp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Cp,i=((r=e.dimensions)==null?void 0:r.height)||Sp;return{x:n.x,y:n.y,width:o,height:i}}function Rp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ap(e){const n=t.computed(()=>xp(e.sourceNode())),o=t.computed(()=>xp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,y;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=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<ks){const _=(m+p)/2;m=_-ks/2,p=_+ks/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??Rp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Rp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?yp(n.value,d,r.value.x):hp(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?yp(o.value,d,l.value.x):hp(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 Es=Symbol("waypointController"),ox=["d"],ix=["d"],ax=["d"],rx=["x1","y1","x2","y2"],lx=["cx","cy","r"],sx=["x","y"],cx=["x","y"],dx=["cx","cy","onDblclick"],ux=["x","y","onPointerdown","onDblclick"],$p=tt(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=et(),i=t.inject(Es),a=t.inject(po,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Jf,null),s=t.inject(Go,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var ne;return((ne=a==null?void 0:a.selection.value)==null?void 0:ne.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 ne=l==null?void 0:l.value;if(!ne||!a)return null;const ae=a.resolved.value.entities,me=D=>{var z;return(z=ae.find(Q=>Q.entity.modelId===D))==null?void 0:z.groupRef},P=n.data.association;return me(P.end1.entityRef)===ne.groupId&&me(P.end2.entityRef)===ne.groupId?{dx:ne.dx,dy:ne.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),y=t.ref({x:0,y:0}),_=t.computed(()=>{const ne=m.value;return p.value.map((ae,me)=>me===f.value?y.value:ne?{x:ae.x+ne.dx,y:ae.y+ne.dy}:ae)}),g=t.computed(()=>{var ne;return!!((ne=n.sourceNode.data)!=null&&ne.collapsed)}),b=t.computed(()=>{var ne;return!!((ne=n.targetNode.data)!=null&&ne.collapsed)}),{source:E,target:h,sourceSide:N,targetSide:w,isSelf:C}=Ap({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>_.value,sourceRowY:()=>n.data.sourceColumnRef&&!g.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!b.value?n.targetY:void 0}),S=ex+4,V=t.computed(()=>C.value?YS(E.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?mp(E.value,N.value,_.value,h.value,w.value,S):pp(E.value,_.value,h.value)),$=t.computed(()=>C.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?fp(E.value,N.value,_.value,h.value,w.value,S):gp(E.value,_.value,h.value).map((ne,ae)=>({point:ne,segIndex:ae}))),R=t.computed(()=>C.value||!r.value?[]:_.value),x=ea;function T(ne,ae){f.value=ne,y.value={...p.value[ne]},ae.target.setPointerCapture(ae.pointerId),ae.stopPropagation()}function M(ne){if(f.value<0)return;const ae=o({x:ne.clientX,y:ne.clientY});y.value={x:ae.x,y:ae.y}}function k(ne){var ae,me;f.value>=0&&i&&i.movePoint(n.id,f.value,{...y.value}),f.value=-1,(me=(ae=ne.target).releasePointerCapture)==null||me.call(ae,ne.pointerId)}function v(ne,ae){ae.stopPropagation(),i==null||i.removePoint(n.id,ne)}function I(ne,ae){if(!i)return;const me=o({x:ae.clientX,y:ae.clientY});i.insertPoint(n.id,ne,{x:me.x,y:me.y})}const O=t.computed(()=>x(n.data.association.end1.multiplicity)),A=t.computed(()=>x(n.data.association.end2.multiplicity)),L=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),H=t.computed(()=>L.value==="class"),oe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ne=ur(N.value);return{x:E.value.x+ne.x*10,y:E.value.y+ne.y*10}}return _.value[0]??h.value}),ue=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ae=ur(w.value);return{x:h.value.x+ae.x*10,y:h.value.y+ae.y*10}}const ne=_.value;return ne[ne.length-1]??E.value}),be=t.computed(()=>{const ne=n.data.association;return{multiplicity:ne.end1.multiplicity,navigable:ne.end1.navigable,composition:ne.end1.composition,otherNavigable:ne.end2.navigable}}),pe=t.computed(()=>{const ne=n.data.association;return{multiplicity:ne.end2.multiplicity,navigable:ne.end2.navigable,composition:ne.end2.composition,otherNavigable:ne.end1.navigable}}),he=t.computed(()=>vp(E.value,oe.value,be.value,L.value)),_e=t.computed(()=>vp(h.value,ue.value,pe.value,L.value)),ye=t.computed(()=>[...he.value.lines,..._e.value.lines]),Ae=t.computed(()=>[...he.value.circles,..._e.value.circles]),Fe=t.computed(()=>[...he.value.polygons,..._e.value.polygons].map(ne=>`M${ne.points.map(ae=>`${ae.x},${ae.y}`).join(" L")} Z`)),se=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ne,ae)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:V.value,fill:"none",class:"em-edge__hit"},null,8,ox),t.createElementVNode("path",{d:V.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,ix),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Fe.value,(me,P)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${P}`,d:me,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",se.value])},null,10,ax))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ye.value,(me,P)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${P}`,x1:me.x1,y1:me.y1,x2:me.x2,y2:me.y2,class:t.normalizeClass(["em-edge__marker",se.value])},null,10,rx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ae.value,(me,P)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${P}`,cx:me.cx,cy:me.cy,r:me.r,class:t.normalizeClass(["em-edge__marker",se.value])},null,10,lx))),128)),H.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(E).x+8,y:t.unref(E).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(O.value),11,sx),t.createElementVNode("text",{x:t.unref(h).x-8,y:t.unref(h).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(A.value),11,cx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList($.value,(me,P)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${P}`,cx:me.point.x,cy:me.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(D=>I(me.segIndex,D),["stop"])},null,42,dx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.value,(me,P)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${P}`,x:me.x-5,y:me.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:D=>T(P,D),onPointermove:M,onPointerup:k,onDblclick:D=>v(P,D)},null,42,ux))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var wn=(e=>(e.Lines="lines",e.Dots="dots",e))(wn||{});const Tp=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})};wn.Lines+"",wn.Dots+"";const mx={[wn.Dots]:"#81818a",[wn.Lines]:"#eee"},fx=["id","x","y","width","height","patternTransform"],px={key:2,height:"100",width:"100"},hx=["fill"],yx=["x","y","fill"],gx={name:"Background",compatConfig:{MODE:3}},bx=t.defineComponent({...gx,props:{id:{},variant:{default:()=>wn.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}=et(),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||mx[e.variant||wn.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(wn).Lines?(t.openBlock(),t.createBlock(t.unref(Tp),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(wn).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",px,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,hx)])):t.createCommentVNode("",!0)])],8,fx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,yx),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),_x={name:"ControlButton",compatConfig:{MODE:3}},kx=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ex={type:"button",class:"vue-flow__controls-button"};function Nx(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",Ex,[t.renderSlot(e.$slots,"default")])}const ho=kx(_x,[["render",Nx]]),wx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Ix=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function vx(e,n){return t.openBlock(),t.createElementBlock("svg",wx,Ix)}const Cx={render:vx},Sx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},xx=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Rx(e,n){return t.openBlock(),t.createElementBlock("svg",Sx,xx)}const Ax={render:Rx},$x={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Tx=[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 Mx(e,n){return t.openBlock(),t.createElementBlock("svg",$x,Tx)}const Vx={render:Mx},Bx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Dx=[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 Ox(e,n){return t.openBlock(),t.createElementBlock("svg",Bx,Dx)}const Lx={render:Ox},Px={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},zx=[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 Fx(e,n){return t.openBlock(),t.createElementBlock("svg",Px,zx)}const Ux={render:Fx},Hx={name:"Controls",compatConfig:{MODE:3}},jx=t.defineComponent({...Hx,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}=et(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function _(){l(),n("zoomIn")}function g(){s(),n("zoomOut")}function b(){c(e.fitViewParams),n("fitView")}function E(){r(!p.value),n("interactionChange",!p.value)}return(h,N)=>(t.openBlock(),t.createBlock(t.unref(xf),{class:"vue-flow__controls",position:h.position},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"top"),h.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(h.$slots,"control-zoom-in",{},()=>[t.createVNode(ho,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Cx))))])]),_:3},8,["disabled"])]),t.renderSlot(h.$slots,"control-zoom-out",{},()=>[t.createVNode(ho,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ax))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),h.showFitView?t.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[t.createVNode(ho,{class:"vue-flow__controls-fitview",onClick:b},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Vx))))])]),_:3})]):t.createCommentVNode("",!0),h.showInteractive?t.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(t.openBlock(),t.createBlock(ho,{key:0,class:"vue-flow__controls-interactive",onClick:E},{default:t.withCtx(()=>[p.value?t.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ux))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Lx))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var Kx={value:()=>{}};function Ns(){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 pr(o)}function pr(e){this._=e}function Gx(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}})}pr.prototype=Ns.prototype={constructor:pr,on:function(e,n){var o=this._,i=Gx(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Yx(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]=Vp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Vp(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 pr(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 Yx(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Vp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=Kx,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ws="http://www.w3.org/1999/xhtml";const Bp={svg:"http://www.w3.org/2000/svg",xhtml:ws,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Bp.hasOwnProperty(n)?{space:Bp[n],local:e}:e}function qx(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ws&&n.documentElement.namespaceURI===ws?n.createElement(e):n.createElementNS(o,e)}}function Wx(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Dp(e){var n=hr(e);return(n.local?Wx:qx)(n)}function Jx(){}function Is(e){return e==null?Jx:function(){return this.querySelector(e)}}function Xx(e){typeof e!="function"&&(e=Is(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 Pt(i,this._parents)}function Zx(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Qx(){return[]}function Op(e){return e==null?Qx:function(){return this.querySelectorAll(e)}}function eR(e){return function(){return Zx(e.apply(this,arguments))}}function tR(e){typeof e=="function"?e=eR(e):e=Op(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 Pt(i,a)}function Lp(e){return function(){return this.matches(e)}}function Pp(e){return function(n){return n.matches(e)}}var nR=Array.prototype.find;function oR(e){return function(){return nR.call(this.children,e)}}function iR(){return this.firstElementChild}function aR(e){return this.select(e==null?iR:oR(typeof e=="function"?e:Pp(e)))}var rR=Array.prototype.filter;function lR(){return Array.from(this.children)}function sR(e){return function(){return rR.call(this.children,e)}}function cR(e){return this.selectAll(e==null?lR:sR(typeof e=="function"?e:Pp(e)))}function dR(e){typeof e!="function"&&(e=Lp(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 Pt(i,this._parents)}function zp(e){return new Array(e.length)}function uR(){return new Pt(this._enter||this._groups.map(zp),this._parents)}function yr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}yr.prototype={constructor:yr,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 mR(e){return function(){return e}}function fR(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 yr(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function pR(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 yr(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function hR(e){return e.__data__}function yR(e,n){if(!arguments.length)return Array.from(this,hR);var o=n?pR:fR,i=this._parents,a=this._groups;typeof e!="function"&&(e=mR(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=gR(e.call(u,u&&u.__data__,d,i)),y=f.length,_=s[d]=new Array(y),g=l[d]=new Array(y),b=c[d]=new Array(p);o(u,m,_,g,b,f,n);for(var E=0,h=0,N,w;E<y;++E)if(N=_[E]){for(E>=h&&(h=E+1);!(w=g[h])&&++h<y;);N._next=w||null}}return l=new Pt(l,i),l._enter=s,l._exit=c,l}function gR(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bR(){return new Pt(this._exit||this._groups.map(zp),this._parents)}function _R(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 kR(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,y=0;y<m;++y)(f=d[y]||u[y])&&(p[y]=f);for(;c<a;++c)s[c]=o[c];return new Pt(s,this._parents)}function ER(){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 NR(e){e||(e=wR);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 Pt(a,this._parents).order()}function wR(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function IR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function vR(){return Array.from(this)}function CR(){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 SR(){let e=0;for(const n of this)++e;return e}function xR(){return!this.node()}function RR(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 AR(e){return function(){this.removeAttribute(e)}}function $R(e){return function(){this.removeAttributeNS(e.space,e.local)}}function TR(e,n){return function(){this.setAttribute(e,n)}}function MR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function VR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function BR(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=hr(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?$R:AR:typeof n=="function"?o.local?BR:VR:o.local?MR:TR)(o,n))}function Fp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function OR(e){return function(){this.style.removeProperty(e)}}function LR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function PR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function zR(e,n,o){return arguments.length>1?this.each((n==null?OR:typeof n=="function"?PR:LR)(e,n,o??"")):qo(this.node(),e)}function qo(e,n){return e.style.getPropertyValue(n)||Fp(e).getComputedStyle(e,null).getPropertyValue(n)}function FR(e){return function(){delete this[e]}}function UR(e,n){return function(){this[e]=n}}function HR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function jR(e,n){return arguments.length>1?this.each((n==null?FR:typeof n=="function"?HR:UR)(e,n)):this.node()[e]}function Up(e){return e.trim().split(/^|\s+/)}function vs(e){return e.classList||new Hp(e)}function Hp(e){this._node=e,this._names=Up(e.getAttribute("class")||"")}Hp.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 jp(e,n){for(var o=vs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Kp(e,n){for(var o=vs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function KR(e){return function(){jp(this,e)}}function GR(e){return function(){Kp(this,e)}}function YR(e,n){return function(){(n.apply(this,arguments)?jp:Kp)(this,e)}}function qR(e,n){var o=Up(e+"");if(arguments.length<2){for(var i=vs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?YR:n?KR:GR)(o,n))}function WR(){this.textContent=""}function JR(e){return function(){this.textContent=e}}function XR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function ZR(e){return arguments.length?this.each(e==null?WR:(typeof e=="function"?XR:JR)(e)):this.node().textContent}function QR(){this.innerHTML=""}function eA(e){return function(){this.innerHTML=e}}function tA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function nA(e){return arguments.length?this.each(e==null?QR:(typeof e=="function"?tA:eA)(e)):this.node().innerHTML}function oA(){this.nextSibling&&this.parentNode.appendChild(this)}function iA(){return this.each(oA)}function aA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rA(){return this.each(aA)}function lA(e){var n=typeof e=="function"?e:Dp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function sA(){return null}function cA(e,n){var o=typeof e=="function"?e:Dp(e),i=n==null?sA:typeof n=="function"?n:Is(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function dA(){var e=this.parentNode;e&&e.removeChild(this)}function uA(){return this.each(dA)}function mA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function fA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function pA(e){return this.select(e?fA:mA)}function hA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function yA(e){return function(n){e.call(this,n,this.__data__)}}function gA(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 bA(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 _A(e,n,o){return function(){var i=this.__on,a,r=yA(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 kA(e,n,o){var i=gA(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?_A:bA,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Gp(e,n,o){var i=Fp(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 EA(e,n){return function(){return Gp(this,e,n)}}function NA(e,n){return function(){return Gp(this,e,n.apply(this,arguments))}}function wA(e,n){return this.each((typeof n=="function"?NA:EA)(e,n))}function*IA(){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 Yp=[null];function Pt(e,n){this._groups=e,this._parents=n}function Vi(){return new Pt([[document.documentElement]],Yp)}function vA(){return this}Pt.prototype=Vi.prototype={constructor:Pt,select:Xx,selectAll:tR,selectChild:aR,selectChildren:cR,filter:dR,data:yR,enter:uR,exit:bR,join:_R,merge:kR,selection:vA,order:ER,sort:NR,call:IR,nodes:vR,node:CR,size:SR,empty:xR,each:RR,attr:DR,style:zR,property:jR,classed:qR,text:ZR,html:nA,raise:iA,lower:rA,append:lA,insert:cA,remove:uA,clone:pA,datum:hA,on:kA,dispatch:wA,[Symbol.iterator]:IA};function zn(e){return typeof e=="string"?new Pt([[document.querySelector(e)]],[document.documentElement]):new Pt([[e]],Yp)}function CA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Fn(e,n){if(e=CA(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 Cs={capture:!0,passive:!1};function Ss(e){e.preventDefault(),e.stopImmediatePropagation()}function SA(e){var n=e.document.documentElement,o=zn(e).on("dragstart.drag",Ss,Cs);"onselectstart"in n?o.on("selectstart.drag",Ss,Cs):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function xA(e,n){var o=e.document.documentElement,i=zn(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ss,Cs),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 xs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function qp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Bi(){}var Di=.7,gr=1/Di,Wo="\\s*([+-]?\\d+)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",RA=/^#([0-9a-f]{3,8})$/,AA=new RegExp(`^rgb\\(${Wo},${Wo},${Wo}\\)$`),$A=new RegExp(`^rgb\\(${dn},${dn},${dn}\\)$`),TA=new RegExp(`^rgba\\(${Wo},${Wo},${Wo},${Oi}\\)$`),MA=new RegExp(`^rgba\\(${dn},${dn},${dn},${Oi}\\)$`),VA=new RegExp(`^hsl\\(${Oi},${dn},${dn}\\)$`),BA=new RegExp(`^hsla\\(${Oi},${dn},${dn},${Oi}\\)$`),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};xs(Bi,Li,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Jp,formatHex:Jp,formatHex8:DA,formatHsl:OA,formatRgb:Xp,toString:Xp});function Jp(){return this.rgb().formatHex()}function DA(){return this.rgb().formatHex8()}function OA(){return nh(this).formatHsl()}function Xp(){return this.rgb().formatRgb()}function Li(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=RA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Zp(n):o===3?new Bt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?br(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?br(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=AA.exec(e))?new Bt(n[1],n[2],n[3],1):(n=$A.exec(e))?new Bt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=TA.exec(e))?br(n[1],n[2],n[3],n[4]):(n=MA.exec(e))?br(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=VA.exec(e))?th(n[1],n[2]/100,n[3]/100,1):(n=BA.exec(e))?th(n[1],n[2]/100,n[3]/100,n[4]):Wp.hasOwnProperty(e)?Zp(Wp[e]):e==="transparent"?new Bt(NaN,NaN,NaN,0):null}function Zp(e){return new Bt(e>>16&255,e>>8&255,e&255,1)}function br(e,n,o,i){return i<=0&&(e=n=o=NaN),new Bt(e,n,o,i)}function LA(e){return e instanceof Bi||(e=Li(e)),e?(e=e.rgb(),new Bt(e.r,e.g,e.b,e.opacity)):new Bt}function Rs(e,n,o,i){return arguments.length===1?LA(e):new Bt(e,n,o,i??1)}function Bt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}xs(Bt,Rs,qp(Bi,{brighter(e){return e=e==null?gr:Math.pow(gr,e),new Bt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Di:Math.pow(Di,e),new Bt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Bt(yo(this.r),yo(this.g),yo(this.b),_r(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:Qp,formatHex:Qp,formatHex8:PA,formatRgb:eh,toString:eh}));function Qp(){return`#${go(this.r)}${go(this.g)}${go(this.b)}`}function PA(){return`#${go(this.r)}${go(this.g)}${go(this.b)}${go((isNaN(this.opacity)?1:this.opacity)*255)}`}function eh(){const e=_r(this.opacity);return`${e===1?"rgb(":"rgba("}${yo(this.r)}, ${yo(this.g)}, ${yo(this.b)}${e===1?")":`, ${e})`}`}function _r(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function go(e){return e=yo(e),(e<16?"0":"")+e.toString(16)}function th(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Jt(e,n,o,i)}function nh(e){if(e instanceof Jt)return new Jt(e.h,e.s,e.l,e.opacity);if(e instanceof Bi||(e=Li(e)),!e)return new Jt;if(e instanceof Jt)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 Jt(l,s,c,e.opacity)}function zA(e,n,o,i){return arguments.length===1?nh(e):new Jt(e,n,o,i??1)}function Jt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}xs(Jt,zA,qp(Bi,{brighter(e){return e=e==null?gr:Math.pow(gr,e),new Jt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Di:Math.pow(Di,e),new Jt(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 Bt(As(e>=240?e-240:e+120,a,i),As(e,a,i),As(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Jt(oh(this.h),kr(this.s),kr(this.l),_r(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=_r(this.opacity);return`${e===1?"hsl(":"hsla("}${oh(this.h)}, ${kr(this.s)*100}%, ${kr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function oh(e){return e=(e||0)%360,e<0?e+360:e}function kr(e){return Math.max(0,Math.min(1,e||0))}function As(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 ih=e=>()=>e;function FA(e,n){return function(o){return e+o*n}}function UA(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 HA(e){return(e=+e)==1?ah:function(n,o){return o-n?UA(n,o,e):ih(isNaN(n)?o:n)}}function ah(e,n){var o=n-e;return o?FA(e,o):ih(isNaN(e)?n:e)}const rh=(function e(n){var o=HA(n);function i(a,r){var l=o((a=Rs(a)).r,(r=Rs(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=ah(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 Un(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var $s=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ts=new RegExp($s.source,"g");function jA(e){return function(){return e}}function KA(e){return function(n){return e(n)+""}}function GA(e,n){var o=$s.lastIndex=Ts.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=$s.exec(e))&&(a=Ts.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:Un(i,a)})),o=Ts.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?KA(c[0].x):jA(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 lh=180/Math.PI,Ms={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function sh(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)*lh,skewX:Math.atan(c)*lh,scaleX:l,scaleY:s}}var Er;function YA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Ms:sh(n.a,n.b,n.c,n.d,n.e,n.f)}function qA(e){return e==null||(Er||(Er=document.createElementNS("http://www.w3.org/2000/svg","g")),Er.setAttribute("transform",e),!(e=Er.transform.baseVal.consolidate()))?Ms:(e=e.matrix,sh(e.a,e.b,e.c,e.d,e.e,e.f))}function ch(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,y){if(d!==m||u!==p){var _=f.push("translate(",null,n,null,o);y.push({i:_-4,x:Un(d,m)},{i:_-2,x:Un(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:Un(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:Un(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,y){if(d!==m||u!==p){var _=f.push(a(f)+"scale(",null,",",null,")");y.push({i:_-4,x:Un(d,m)},{i:_-2,x:Un(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 y=-1,_=p.length,g;++y<_;)m[(g=p[y]).i]=g.x(f);return m.join("")}}}var WA=ch(YA,"px, ","px)","deg)"),JA=ch(qA,", ",")",")"),XA=1e-12;function dh(e){return((e=Math.exp(e))+1/e)/2}function ZA(e){return((e=Math.exp(e))-1/e)/2}function QA(e){return((e=Math.exp(2*e))-1)/(e+1)}const e$=(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,y=m-c,_=f*f+y*y,g,b;if(_<XA)b=Math.log(p/d)/n,g=function(S){return[s+S*f,c+S*y,d*Math.exp(n*S*b)]};else{var E=Math.sqrt(_),h=(p*p-d*d+i*_)/(2*d*o*E),N=(p*p-d*d-i*_)/(2*p*o*E),w=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(N*N+1)-N);b=(C-w)/n,g=function(S){var V=S*b,$=dh(w),R=d/(o*E)*($*QA(n*V+w)-ZA(w));return[s+R*f,c+R*y,d*$/dh(n*V+w)]}}return g.duration=b*1e3*n/Math.SQRT2,g}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 Jo=0,Pi=0,zi=0,uh=1e3,Nr,Fi,wr=0,bo=0,Ir=0,Ui=typeof performance=="object"&&performance.now?performance:Date,mh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vs(){return bo||(mh(t$),bo=Ui.now()+Ir)}function t$(){bo=0}function vr(){this._call=this._time=this._next=null}vr.prototype=fh.prototype={constructor:vr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Vs():+o)+(n==null?0:+n),!this._next&&Fi!==this&&(Fi?Fi._next=this:Nr=this,Fi=this),this._call=e,this._time=o,Bs()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bs())}};function fh(e,n,o){var i=new vr;return i.restart(e,n,o),i}function n$(){Vs(),++Jo;for(var e=Nr,n;e;)(n=bo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Jo}function ph(){bo=(wr=Ui.now())+Ir,Jo=Pi=0;try{n$()}finally{Jo=0,i$(),bo=0}}function o$(){var e=Ui.now(),n=e-wr;n>uh&&(Ir-=n,wr=e)}function i$(){for(var e,n=Nr,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:Nr=o);Fi=e,Bs(i)}function Bs(e){if(!Jo){Pi&&(Pi=clearTimeout(Pi));var n=e-bo;n>24?(e<1/0&&(Pi=setTimeout(ph,e-Ui.now()-Ir)),zi&&(zi=clearInterval(zi))):(zi||(wr=Ui.now(),zi=setInterval(o$,uh)),Jo=1,mh(ph))}}function hh(e,n,o){var i=new vr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var a$=Ns("start","end","cancel","interrupt"),r$=[],yh=0,gh=1,Ds=2,Cr=3,bh=4,Os=5,Sr=6;function xr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;l$(e,o,{name:n,index:i,group:a,on:a$,tween:r$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:yh})}function Ls(e,n){var o=Xt(e,n);if(o.state>yh)throw new Error("too late; already scheduled");return o}function un(e,n){var o=Xt(e,n);if(o.state>Cr)throw new Error("too late; already running");return o}function Xt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function l$(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=fh(r,0,o.time);function r(d){o.state=gh,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!==gh)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Cr)return hh(l);f.state===bh?(f.state=Sr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Sr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(hh(function(){o.state===Cr&&(o.state=bh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Ds,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ds){for(o.state=Cr,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=Os,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===Os&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Sr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Rr(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>Ds&&i.state<Os,i.state=Sr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function s$(e){return this.each(function(){Rr(this,e)})}function c$(e,n){var o,i;return function(){var a=un(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 d$(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=un(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 u$(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Xt(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?c$:d$)(o,e,n))}function Ps(e,n,o){var i=e._id;return e.each(function(){var a=un(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Xt(a,i).value[n]}}function _h(e,n){var o;return(typeof n=="number"?Un:n instanceof Li?rh:(o=Li(n))?(n=o,rh):GA)(e,n)}function m$(e){return function(){this.removeAttribute(e)}}function f$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function p$(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 h$(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 y$(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 g$(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 b$(e,n){var o=hr(e),i=o==="transform"?JA:_h;return this.attrTween(e,typeof n=="function"?(o.local?g$:y$)(o,i,Ps(this,"attr."+e,n)):n==null?(o.local?f$:m$)(o):(o.local?h$:p$)(o,i,n))}function _$(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function k$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function E$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&k$(e,r)),o}return a._value=n,a}function N$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&_$(e,r)),o}return a._value=n,a}function w$(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=hr(e);return this.tween(o,(i.local?E$:N$)(i,n))}function I$(e,n){return function(){Ls(this,e).delay=+n.apply(this,arguments)}}function v$(e,n){return n=+n,function(){Ls(this,e).delay=n}}function C$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?I$:v$)(n,e)):Xt(this.node(),n).delay}function S$(e,n){return function(){un(this,e).duration=+n.apply(this,arguments)}}function x$(e,n){return n=+n,function(){un(this,e).duration=n}}function R$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?S$:x$)(n,e)):Xt(this.node(),n).duration}function A$(e,n){if(typeof n!="function")throw new Error;return function(){un(this,e).ease=n}}function $$(e){var n=this._id;return arguments.length?this.each(A$(n,e)):Xt(this.node(),n).ease}function T$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;un(this,e).ease=o}}function M$(e){if(typeof e!="function")throw new Error;return this.each(T$(this._id,e))}function V$(e){typeof e!="function"&&(e=Lp(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 In(i,this._parents,this._name,this._id)}function B$(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 In(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 O$(e,n,o){var i,a,r=D$(n)?Ls:un;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function L$(e,n){var o=this._id;return arguments.length<2?Xt(this.node(),o).on.on(e):this.each(O$(o,e,n))}function P$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function z$(){return this.on("end.remove",P$(this._id))}function F$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Is(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,xr(d[p],n,o,p,d,Xt(u,o)));return new In(r,this._parents,n,o)}function U$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Op(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,y=Xt(u,o),_=0,g=p.length;_<g;++_)(f=p[_])&&xr(f,n,o,_,p,y);r.push(p),l.push(u)}return new In(r,l,n,o)}var H$=Vi.prototype.constructor;function j$(){return new H$(this._groups,this._parents)}function K$(e,n){var o,i,a;return function(){var r=qo(this,e),l=(this.style.removeProperty(e),qo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function kh(e){return function(){this.style.removeProperty(e)}}function G$(e,n,o){var i,a=o+"",r;return function(){var l=qo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function Y$(e,n,o){var i,a,r;return function(){var l=qo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),qo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function q$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=un(this,e),d=c.on,u=c.value[r]==null?s||(s=kh(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:_h;return n==null?this.styleTween(e,K$(e,i)).on("end.style."+e,kh(e)):typeof n=="function"?this.styleTween(e,Y$(e,i,Ps(this,"style."+e,n))).each(q$(this._id,e)):this.styleTween(e,G$(e,i,n),o).on("end.style."+e,null)}function J$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function X$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&J$(e,l,o)),i}return r._value=n,r}function Z$(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,X$(e,n,o??""))}function Q$(e){return function(){this.textContent=e}}function eT(e){return function(){var n=e(this);this.textContent=n??""}}function tT(e){return this.tween("text",typeof e=="function"?eT(Ps(this,"text",e)):Q$(e==null?"":e+""))}function nT(e){return function(n){this.textContent=e.call(this,n)}}function oT(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&nT(a)),n}return i._value=e,i}function iT(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,oT(e))}function aT(){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=Xt(c,n);xr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new In(i,this._parents,e,o)}function rT(){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=un(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 lT=0;function In(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Eh(){return++lT}var vn=Vi.prototype;In.prototype={constructor:In,select:F$,selectAll:U$,selectChild:vn.selectChild,selectChildren:vn.selectChildren,filter:V$,merge:B$,selection:j$,transition:aT,call:vn.call,nodes:vn.nodes,node:vn.node,size:vn.size,empty:vn.empty,each:vn.each,on:L$,attr:b$,attrTween:w$,style:W$,styleTween:Z$,text:tT,textTween:iT,remove:z$,tween:u$,delay:C$,duration:R$,ease:$$,easeVarying:M$,end:rT,[Symbol.iterator]:vn[Symbol.iterator]};function sT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cT={time:null,delay:0,duration:250,ease:sT};function dT(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 uT(e){var n,o;e instanceof In?(n=e._id,e=e._name):(n=Eh(),(o=cT).time=Vs(),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])&&xr(c,e,n,d,l,o||dT(c,n));return new In(i,this._parents,e,n)}Vi.prototype.interrupt=s$,Vi.prototype.transition=uT;const Ar=e=>()=>e;function mT(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 Cn(e,n,o){this.k=e,this.x=n,this.y=o}Cn.prototype={constructor:Cn,scale:function(e){return e===1?this:new Cn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Cn(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 zs=new Cn(1,0,0);Cn.prototype;function Fs(e){e.stopImmediatePropagation()}function Hi(e){e.preventDefault(),e.stopImmediatePropagation()}function fT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pT(){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 Nh(){return this.__zoom||zs}function hT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yT(){return navigator.maxTouchPoints||"ontouchstart"in this}function gT(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 bT(){var e=fT,n=pT,o=gT,i=hT,a=yT,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=e$,d=Ns("start","zoom","end"),u,m,p,f=500,y=150,_=0,g=10;function b(k){k.property("__zoom",Nh).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",x).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(k,v,I,O){var A=k.selection?k.selection():k;A.property("__zoom",Nh),k!==A?w(k,v,I,O):A.interrupt().each(function(){C(this,arguments).event(O).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},b.scaleBy=function(k,v,I,O){b.scaleTo(k,function(){var A=this.__zoom.k,L=typeof v=="function"?v.apply(this,arguments):v;return A*L},I,O)},b.scaleTo=function(k,v,I,O){b.transform(k,function(){var A=n.apply(this,arguments),L=this.__zoom,H=I==null?N(A):typeof I=="function"?I.apply(this,arguments):I,oe=L.invert(H),ue=typeof v=="function"?v.apply(this,arguments):v;return o(h(E(L,ue),H,oe),A,l)},I,O)},b.translateBy=function(k,v,I,O){b.transform(k,function(){return o(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof I=="function"?I.apply(this,arguments):I),n.apply(this,arguments),l)},null,O)},b.translateTo=function(k,v,I,O,A){b.transform(k,function(){var L=n.apply(this,arguments),H=this.__zoom,oe=O==null?N(L):typeof O=="function"?O.apply(this,arguments):O;return o(zs.translate(oe[0],oe[1]).scale(H.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof I=="function"?-I.apply(this,arguments):-I),L,l)},O,A)};function E(k,v){return v=Math.max(r[0],Math.min(r[1],v)),v===k.k?k:new Cn(v,k.x,k.y)}function h(k,v,I){var O=v[0]-I[0]*k.k,A=v[1]-I[1]*k.k;return O===k.x&&A===k.y?k:new Cn(k.k,O,A)}function N(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function w(k,v,I,O){k.on("start.zoom",function(){C(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(O).end()}).tween("zoom",function(){var A=this,L=arguments,H=C(A,L).event(O),oe=n.apply(A,L),ue=I==null?N(oe):typeof I=="function"?I.apply(A,L):I,be=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),pe=A.__zoom,he=typeof v=="function"?v.apply(A,L):v,_e=c(pe.invert(ue).concat(be/pe.k),he.invert(ue).concat(be/he.k));return function(ye){if(ye===1)ye=he;else{var Ae=_e(ye),Fe=be/Ae[2];ye=new Cn(Fe,ue[0]-Ae[0]*Fe,ue[1]-Ae[1]*Fe)}H.zoom(null,ye)}})}function C(k,v,I){return!I&&k.__zooming||new S(k,v)}function S(k,v){this.that=k,this.args=v,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,v),this.taps=0}S.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,v){return this.mouse&&k!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var v=zn(this.that).datum();d.call(k,this.that,new mT(k,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),v)}};function V(k,...v){if(!e.apply(this,arguments))return;var I=C(this,v).event(k),O=this.__zoom,A=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),L=Fn(k);if(I.wheel)(I.mouse[0][0]!==L[0]||I.mouse[0][1]!==L[1])&&(I.mouse[1]=O.invert(I.mouse[0]=L)),clearTimeout(I.wheel);else{if(O.k===A)return;I.mouse=[L,O.invert(L)],Rr(this),I.start()}Hi(k),I.wheel=setTimeout(H,y),I.zoom("mouse",o(h(E(O,A),I.mouse[0],I.mouse[1]),I.extent,l));function H(){I.wheel=null,I.end()}}function $(k,...v){if(p||!e.apply(this,arguments))return;var I=k.currentTarget,O=C(this,v,!0).event(k),A=zn(k.view).on("mousemove.zoom",ue,!0).on("mouseup.zoom",be,!0),L=Fn(k,I),H=k.clientX,oe=k.clientY;SA(k.view),Fs(k),O.mouse=[L,this.__zoom.invert(L)],Rr(this),O.start();function ue(pe){if(Hi(pe),!O.moved){var he=pe.clientX-H,_e=pe.clientY-oe;O.moved=he*he+_e*_e>_}O.event(pe).zoom("mouse",o(h(O.that.__zoom,O.mouse[0]=Fn(pe,I),O.mouse[1]),O.extent,l))}function be(pe){A.on("mousemove.zoom mouseup.zoom",null),xA(pe.view,O.moved),Hi(pe),O.event(pe).end()}}function R(k,...v){if(e.apply(this,arguments)){var I=this.__zoom,O=Fn(k.changedTouches?k.changedTouches[0]:k,this),A=I.invert(O),L=I.k*(k.shiftKey?.5:2),H=o(h(E(I,L),O,A),n.apply(this,v),l);Hi(k),s>0?zn(this).transition().duration(s).call(w,H,O,k):zn(this).call(b.transform,H,O,k)}}function x(k,...v){if(e.apply(this,arguments)){var I=k.touches,O=I.length,A=C(this,v,k.changedTouches.length===O).event(k),L,H,oe,ue;for(Fs(k),H=0;H<O;++H)oe=I[H],ue=Fn(oe,this),ue=[ue,this.__zoom.invert(ue),oe.identifier],A.touch0?!A.touch1&&A.touch0[2]!==ue[2]&&(A.touch1=ue,A.taps=0):(A.touch0=ue,L=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),L&&(A.taps<2&&(m=ue[0],u=setTimeout(function(){u=null},f)),Rr(this),A.start())}}function T(k,...v){if(this.__zooming){var I=C(this,v).event(k),O=k.changedTouches,A=O.length,L,H,oe,ue;for(Hi(k),L=0;L<A;++L)H=O[L],oe=Fn(H,this),I.touch0&&I.touch0[2]===H.identifier?I.touch0[0]=oe:I.touch1&&I.touch1[2]===H.identifier&&(I.touch1[0]=oe);if(H=I.that.__zoom,I.touch1){var be=I.touch0[0],pe=I.touch0[1],he=I.touch1[0],_e=I.touch1[1],ye=(ye=he[0]-be[0])*ye+(ye=he[1]-be[1])*ye,Ae=(Ae=_e[0]-pe[0])*Ae+(Ae=_e[1]-pe[1])*Ae;H=E(H,Math.sqrt(ye/Ae)),oe=[(be[0]+he[0])/2,(be[1]+he[1])/2],ue=[(pe[0]+_e[0])/2,(pe[1]+_e[1])/2]}else if(I.touch0)oe=I.touch0[0],ue=I.touch0[1];else return;I.zoom("touch",o(h(H,oe,ue),I.extent,l))}}function M(k,...v){if(this.__zooming){var I=C(this,v).event(k),O=k.changedTouches,A=O.length,L,H;for(Fs(k),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),L=0;L<A;++L)H=O[L],I.touch0&&I.touch0[2]===H.identifier?delete I.touch0:I.touch1&&I.touch1[2]===H.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(H=Fn(H,this),Math.hypot(m[0]-H[0],m[1]-H[1])<g)){var oe=zn(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return b.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ar(+k),b):i},b.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ar(!!k),b):e},b.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Ar(!!k),b):a},b.extent=function(k){return arguments.length?(n=typeof k=="function"?k:Ar([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),b):n},b.scaleExtent=function(k){return arguments.length?(r[0]=+k[0],r[1]=+k[1],b):[r[0],r[1]]},b.translateExtent=function(k){return arguments.length?(l[0][0]=+k[0][0],l[1][0]=+k[1][0],l[0][1]=+k[0][1],l[1][1]=+k[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(k){return arguments.length?(o=k,b):o},b.duration=function(k){return arguments.length?(s=+k,b):s},b.interpolate=function(k){return arguments.length?(c=k,b):c},b.on=function(){var k=d.on.apply(d,arguments);return k===d?b:k},b.clickDistance=function(k){return arguments.length?(_=(k=+k)*k,b):Math.sqrt(_)},b.tapDistance=function(k){return arguments.length?(g=+k,b):g},b}const wh=Symbol("MiniMapSlots"),_T=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],kT={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},ET=t.defineComponent({...kT,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(wh),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,_T))],64)):t.createCommentVNode("",!0)}}),NT=["width","height","viewBox","aria-labelledby"],wT=["id"],IT=["d","fill","stroke","stroke-width"],vT={name:"MiniMap",compatConfig:{MODE:3}},CT=t.defineComponent({...vT,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:y}=et(),_=t.ref();t.provide(wh,o);const g=t.toRef(()=>{var A;return e.width??((A=i.style)==null?void 0:A.width)??a}),b=t.toRef(()=>{var A;return e.height??((A=i.style)==null?void 0:A.height)??r}),E=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),w=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),C=t.computed(()=>ts(y.value.filter(A=>!A.hidden))),S=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})),V=t.computed(()=>y.value&&y.value.length?T0(C.value,S.value):S.value),$=t.computed(()=>{const A=V.value.width/g.value,L=V.value.height/b.value;return Math.max(A,L)}),R=t.computed(()=>{const A=$.value*g.value,L=$.value*b.value,H=e.offsetScale*$.value;return{offset:H,x:V.value.x-(A-V.value.width)/2-H,y:V.value.y-(L-V.value.height)/2-H,width:A+H*2,height:L+H*2}}),x=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${S.value.x+e.maskBorderRadius},${S.value.y}
|
|
58
|
+
h${S.value.width-2*e.maskBorderRadius}
|
|
59
59
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
|
|
60
|
-
v${
|
|
60
|
+
v${S.value.height-2*e.maskBorderRadius}
|
|
61
61
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
|
|
62
|
-
h${-(
|
|
62
|
+
h${-(S.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(x=>{if(k.value){const z=Vn(k.value),j=pe=>{if(pe.sourceEvent.type!=="wheel"||!h.value||!f.value)return;const he=pe.sourceEvent.ctrlKey&&wi()?10:1,fe=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*e.zoomStep,ye=c.value.zoom*2**(fe*he);f.value.scaleTo(h.value,ye)},ne=pe=>{if(pe.sourceEvent.type!=="mousemove"||!h.value||!f.value)return;const he=T.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),fe={x:c.value.x-pe.sourceEvent.movementX*he,y:c.value.y-pe.sourceEvent.movementY*he},ye=[[0,0],[u.value.width,u.value.height]],_e=xs.translate(fe.x,fe.y).scale(c.value.zoom),Re=f.value.constrain()(_e,ye,d.value);f.value.transform(h.value,Re)},de=tT().wheelDelta(pe=>Hl(pe)*(e.zoomStep/10)).on("zoom",e.pannable?ne:()=>{}).on("zoom.wheel",e.zoomable?j:()=>{});z.call(de),x(()=>{z.on("zoom",null)})}},{flush:"post"});function M(x){const[z,j]=Bn(x);n("click",{event:x,position:{x:z,y:j}})}function B(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeClick(j),n("nodeClick",j)}function g(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeDoubleClick(j),n("nodeDblclick",j)}function I(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeMouseEnter(j),n("nodeMouseenter",j)}function v(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeMouseMove(j),n("nodeMousemove",j)}function O(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeMouseLeave(j),n("nodeMouseleave",j)}return(x,z)=>(t.openBlock(),t.createBlock(t.unref(bf),{position:x.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:x.pannable,zoomable:x.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:k,width:_.value,height:E.value,viewBox:[S.value.x,S.value.y,S.value.width,S.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:M},[x.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(x.ariaLabel),9,rT)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),j=>(t.openBlock(),t.createBlock(iT,{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(w.value(j)),color:p.value(j),"border-radius":x.nodeBorderRadius,"stroke-color":b.value(j),"stroke-width":x.nodeStrokeWidth,"shape-rendering":t.unref(N),type:j.type,hidden:j.hidden,onClick:ne=>B(ne,j),onDblclick:ne=>g(ne,j),onMouseenter:ne=>I(ne,j),onMousemove:ne=>v(ne,j),onMouseleave:ne=>O(ne,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:C.value,fill:x.maskColor,stroke:x.maskStrokeColor,"stroke-width":x.maskStrokeWidth,"fill-rule":"evenodd"},null,8,lT)],8,aT))]),_:1},8,["position","class"]))}}),dT=["d"],uT=["cx","cy","onDblclick"],mT=["x","y","onPointerdown","onDblclick"],fT=We(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=qe(),i=t.inject(ss),a=t.inject(ro,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Po,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,T)=>T===d.value?u.value:L)),{source:h,target:f,sourceSide:y,targetSide:k}=bp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),_=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?ep(h.value,y.value,m.value,f.value,k.value):np(h.value,m.value,f.value)),E=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?tp(h.value,y.value,m.value,f.value,k.value):ap(h.value,m.value,f.value).map((L,T)=>({point:L,segIndex:T})):[]),N=t.computed(()=>r.value?m.value:[]);function p(L,T){d.value=L,u.value={...c.value[L]},T.target.setPointerCapture(T.pointerId),T.stopPropagation()}function b(L){if(d.value<0)return;const T=o({x:L.clientX,y:L.clientY});u.value={x:T.x,y:T.y}}function w(L){var T,S;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(S=(T=L.target).releasePointerCapture)==null||S.call(T,L.pointerId)}function A(L,T){T.stopPropagation(),i==null||i.removePoint(n.id,L)}function $(L,T){if(!i)return;const S=o({x:T.clientX,y:T.clientY});i.insertPoint(n.id,L,{x:S.x,y:S.y})}return(L,T)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:_.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,dT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(S,C)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${C}`,cx:S.point.x,cy:S.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(M=>$(S.segIndex,M),["stop"])},null,42,uT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,(S,C)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${C}`,x:S.x-5,y:S.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:M=>p(C,M),onPointermove:b,onPointerup:w,onDblclick:M=>A(C,M)},null,42,mT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),pT=["data-theme"],hT={key:0,class:"em-ctx__sep",role:"separator"},yT=["aria-label"],gT={class:"em-ctx__swatches-label","aria-hidden":"true"},bT={class:"em-ctx__chips",role:"none"},_T=["aria-checked","aria-label","title","onClick"],kT=["aria-checked","aria-label","title","onClick"],ET=["disabled","onClick"],NT={class:"em-ctx__icon"},wT={class:"em-ctx__caption"},IT=We(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(p,b)=>Dt(o.locale??"ko",p,b),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(p,b){var $,L;r.value=b,l.value=($=p.target)!=null&&$.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=p.clientX,c.y=p.clientY,a.value=!0,window.addEventListener("keydown",_),window.addEventListener("resize",h),await t.nextTick();const w=s.value;if(!w)return;const A=w.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 h(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",_),window.removeEventListener("resize",h);const p=d;d=null,p!=null&&p.isConnected&&p.focus()}function f(){const p=s.value;if(!p)return[];const b=[];for(const w of Array.from(p.children))if(w.classList.contains("em-ctx__item"))w.disabled||b.push(w);else if(w.classList.contains("em-ctx__swatches")){const A=Array.from(w.querySelectorAll(".em-ctx__chip"));A.length&&b.push(A.find($=>$===document.activeElement)??A[0])}return b}function y(p){var $;const b=f();if(!b.length)return;const w=b.indexOf(document.activeElement),A=w<0?p>0?0:b.length-1:(w+p+b.length)%b.length;($=b[A])==null||$.focus()}function k(p){var $,L;const b=($=document.activeElement)==null?void 0:$.closest(".em-ctx__swatches");if(!b)return!1;const w=Array.from(b.querySelectorAll(".em-ctx__chip")),A=w.indexOf(document.activeElement);return A<0?!1:((L=w[(A+p+w.length)%w.length])==null||L.focus(),!0)}function _(p){var b,w;switch(p.key){case"Escape":p.stopPropagation(),h();return;case"ArrowDown":p.preventDefault(),y(1);return;case"ArrowUp":p.preventDefault(),y(-1);return;case"ArrowRight":k(1)&&p.preventDefault();return;case"ArrowLeft":k(-1)&&p.preventDefault();return;case"Home":p.preventDefault(),(b=f()[0])==null||b.focus();return;case"End":{p.preventDefault();const A=f();(w=A[A.length-1])==null||w.focus();return}case"Tab":p.preventDefault(),y(p.shiftKey?-1:1)}}function E(p){p.disabled||(p.handler(),h())}function N(p,b){p.onPick(b),h()}return t.onBeforeUnmount(h),n({open:m,close:h}),(p,b)=>(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:b[0]||(b[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(w,A)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:A},[w.type==="separator"?(t.openBlock(),t.createElementBlock("div",hT)):w.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":w.caption},[t.createElementVNode("span",gT,t.toDisplayString(w.caption),1),t.createElementVNode("div",bT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":w.current===null}]),role:"menuitemradio","aria-checked":w.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:$=>N(w,null)},null,10,_T),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":w.current===$}]),style:t.normalizeStyle({background:t.unref(Oo)($)}),role:"menuitemradio","aria-checked":w.current===$,"aria-label":i(t.unref(io)($)),title:i(t.unref(io)($)),onClick:L=>N(w,$)},null,14,kT))),128))])],8,yT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":w.danger,"is-disabled":w.disabled}]),disabled:w.disabled,role:"menuitem",onClick:$=>E(w)},[t.createElementVNode("span",NT,[w.icon?(t.openBlock(),t.createBlock($e,{key:0,name:w.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",wT,t.toDisplayString(w.caption),1)],10,ET))],64))),128))],36)],8,pT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function mh(e,n){return n?`${e}:${n}`:e}function fh(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(mh(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 vT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=mh(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 ph(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(fh(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=fh(e.storageKey,s)),t.watch(o,s=>vT(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 Rs=[".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 jo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function CT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function xT(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 k=n(y.left,y.top+y.height/2);return[{...i,x:k.x,y:k.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,h=0;const f=()=>{const y=d.trim();if(y){const k=n(m,(u+h)/2);c.push({...i,x:k.x,y:k.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const k=a.getBoundingClientRect();u===null||Math.abs(k.top-u)>1?(f(),u=k.top,m=k.left,h=k.bottom,d=s[y]):(d+=s[y],h=Math.max(h,k.bottom))}return f(),c}function kr(e,n){const o=[];for(const i of e.querySelectorAll("*"))CT(i)&&(i.closest(Rs)||jo(i)&&o.push(...xT(i,n)));return o}function Di(e){return Math.round(e*100)/100}function ST(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Rs)||!jo(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="${Di(r.x)}" y="${Di(r.y)}" width="${Di(l.x-r.x)}" height="${Di(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 RT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!jo(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=>Di(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 hh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Rs)||!jo(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 Oi(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 As(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 AT(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,y)=>e.screenToFlowCoordinate({x:f,y}),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 y=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!y||!jo(y))continue;const k=y.firstElementChild;if(k)if(f.type==="group"){const _=Oi(k,o);As(s,_),i.push({..._,texts:[]});const E=k.querySelector(".em-group__label");E&&i.push({...Oi(E,o),stroke:"none",texts:[]}),i.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:kr(k,o)})}else if(f.type==="note"){const _={...Oi(k,o),texts:kr(k,o),lines:hh(k,k,o)};As(s,_),r.push(_)}else{const _=Oi(k,o);As(s,_);const E=_.radius??{tl:0,tr:0};a.push({..._,stroke:"none",texts:[]});const N=k.querySelector(".em-entity__header");if(N){const p=Oi(N,o);a.push({x:_.x,y:_.y,w:_.w,h:p.y+p.h-_.y,fill:p.fill,stroke:"none",radius:{tl:E.tl,tr:E.tr,br:0,bl:0},texts:[]})}a.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:kr(k,o),lines:hh(k,k,o),icons:ST(k,o)}),a.push({..._,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const y=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!jo(y))continue;const k=y.getAttribute("d");if(!k)continue;const _=getComputedStyle(y),E=_.strokeDasharray,N=RT(f);l.push({d:k,stroke:_.stroke,strokeWidth:parseFloat(_.strokeWidth)||1.5,strokeDasharray:E&&E!=="none"?E:void 0,labels:kr(f,o),markers:N.length?N: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 $s(e){return bc(AT(e))}function yh(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 gh(e,n="diagram.svg"){const o=$s(e);yh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function $T(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 bh(e,n="diagram.png",o=2){const i=$s(e),{w:a,h:r}=$T(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 변환 실패");yh(u,n)}finally{URL.revokeObjectURL(l)}}const TT={class:"em-shortcuts"},MT={class:"em-shortcuts__list"},VT={class:"em-shortcuts__title"},BT={class:"em-shortcuts__keys"},DT={class:"em-shortcuts__kbd"},OT={key:0,class:"em-shortcuts__plus"},LT={class:"em-shortcuts__desc"},PT={class:"em-shortcuts__actions"},_h=We(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",TT,[t.createElementVNode("div",MT,[(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",BT,[(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",DT,t.toDisplayString(m),1),h<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",OT,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",LT,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",PT,[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 Ko(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function zT(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 FT=["aria-label"],UT=["aria-activedescendant","aria-label","placeholder"],HT={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},jT=["aria-label"],KT={class:"em-cmdk__section","aria-hidden":"true"},GT=["id","aria-selected","onMouseenter","onClick"],YT={class:"em-cmdk__label"},qT={key:0,class:"em-cmdk__tag"},WT={key:1,class:"em-cmdk__sub"},JT=["aria-label"],XT={class:"em-cmdk__section","aria-hidden":"true"},ZT=["id","aria-selected","aria-disabled","onMouseenter","onClick"],QT={class:"em-cmdk__label"},eM={key:1,class:"em-cmdk__empty"},tM=We(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 w=c.value,A=a.state.logical.entities.map(L=>{var T,S,C,M,B,g;return{type:"goto",kind:"entity",id:L.modelId,label:((S=(T=L.table)==null?void 0:T.logicalName)==null?void 0:S[w])||L.name,sub:(C=L.table)==null?void 0:C.physicalName,match:Ko(L.name,(B=(M=L.table)==null?void 0:M.logicalName)==null?void 0:B[w],(g=L.table)==null?void 0:g.physicalName)??""}}),$=a.state.logical.groups.map(L=>{var T,S,C,M;return{type:"goto",kind:"group",id:L.modelId,label:((T=L.name)==null?void 0:T[w])||((S=L.name)==null?void 0:S.ko)||L.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:Ko((C=L.name)==null?void 0:C[w],(M=L.name)==null?void 0:M.ko,L.packageName)??""}});return[...A,...$]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const w=[];a.editable.value&&(w.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),w.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),w.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),w.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),w.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),w.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),w.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),w.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"])w.push({type:"action",id:`dm-${A}`,label:a.t(u[A]),run:()=>a.displayMode.value=A});return w});function h(w,A){return w.label.toLowerCase().includes(A)}const f=t.computed(()=>{const w=r.value.trim().toLowerCase();return w?d.value.filter(A=>A.match.includes(w)):d.value}),y=t.computed(()=>{const w=r.value.trim().toLowerCase();return w?m.value.filter(A=>h(A,w)):m.value}),k=t.computed(()=>[...f.value,...y.value]);t.watch([f,y],()=>{l.value=0});function _(w){return k.value.indexOf(w)}const E=w=>`em-cmdk-opt-${w}`,N=t.computed(()=>k.value[l.value]?E(l.value):void 0);t.watch(l,async()=>{var A;await t.nextTick();const w=N.value;w&&((A=document.getElementById(w))==null||A.scrollIntoView({block:"nearest"}))});function p(w){if(w.type==="goto")a.selection.value={kind:w.kind,id:w.id},a.requestFocus(w.id);else{if(w.disabled)return;w.run()}i("close")}function b(w){if(w.key==="Escape"){i("close"),w.preventDefault();return}if(w.key==="ArrowDown"){l.value=Math.min(l.value+1,k.value.length-1),w.preventDefault();return}if(w.key==="ArrowUp"){l.value=Math.max(l.value-1,0),w.preventDefault();return}if(w.key==="Enter"){const A=k.value[l.value];A&&p(A),w.preventDefault();return}w.key==="Tab"&&w.preventDefault()}return t.nextTick(()=>{var w;return(w=s.value)==null?void 0:w.focus()}),(w,A)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:A[1]||(A[1]=t.withModifiers($=>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]=$=>r.value=$),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":N.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:b},null,40,UT),[[t.vModelText,r.value]]),t.createElementVNode("div",HT,[k.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",KT,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,$=>(t.openBlock(),t.createElementBlock("button",{id:E(_($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":_($)===l.value}]),role:"option","aria-selected":_($)===l.value,onMouseenter:L=>l.value=_($),onClick:L=>p($)},[t.createElementVNode("span",YT,t.toDisplayString($.label),1),$.tag?(t.openBlock(),t.createElementBlock("span",qT,t.toDisplayString($.tag),1)):$.sub?(t.openBlock(),t.createElementBlock("span",WT,t.toDisplayString($.sub),1)):t.createCommentVNode("",!0)],42,GT))),128))],8,jT)):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",XT,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,$=>(t.openBlock(),t.createElementBlock("button",{id:E(_($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":_($)===l.value,"is-disabled":$.disabled}]),role:"option","aria-selected":_($)===l.value,"aria-disabled":$.disabled||void 0,onMouseenter:L=>l.value=_($),onClick:L=>p($)},[t.createElementVNode("span",QT,t.toDisplayString($.label),1)],42,ZT))),128))],8,JT)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",eM,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,FT)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function nM(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const oM={key:0,class:"em-canvas__empty","aria-hidden":"true"},iM={class:"em-canvas__empty-title"},aM=["innerHTML"],rM=["innerHTML"],lM=["innerHTML"],sM={key:1,class:"em-canvas__empty-title"},cM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},dM={class:"em-conflict-banner__body"},uM={class:"em-conflict-banner__title"},mM={class:"em-conflict-banner__detail"},fM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Ts="nc:",kh=We(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(D){l.value=D,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,D=>{D&&c(D.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 D=nM(i.opConflict.value);return D?{title:i.t(D.titleKey),detail:i.t(D.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),h={x:0,y:0};function f(D){h.x=D.clientX,h.y=D.clientY}const y=t.ref(null);t.provide(Qa,y);const k=t.ref(null);t.provide(Pf,k);const _=t.ref(null),E=t.computed(()=>{const D=_.value,R=new Set;if(!D)return R;if(D.kind==="entity")R.add(D.id);else if(D.kind==="group"){const P=i.resolved.value.groups.find(te=>te.group.modelId===D.id);for(const te of(P==null?void 0:P.group.memberEntityRefs)??[])R.add(te)}return R}),N=t.computed(()=>{const D=_.value,R=new Set(E.value),P=new Set,te=new Set;if(!D)return{related:R,edges:P,notes:te};if(D.kind==="note"){te.add(D.id);for(const ie of i.resolved.value.noteConnections)ie.noteRef===D.id&&R.add(ie.targetRef);return{related:R,edges:P,notes:te}}const Ee=E.value;if(!Ee.size)return{related:R,edges:P,notes:te};for(const ie of i.resolved.value.associations){const{end1:re,end2:Te}=ie.association;(Ee.has(re.entityRef)||Ee.has(Te.entityRef))&&(P.add(ie.association.modelId),R.add(re.entityRef),R.add(Te.entityRef))}for(const ie of i.resolved.value.noteConnections)R.has(ie.targetRef)&&te.add(ie.noteRef);return{related:R,edges:P,notes:te}});t.provide(Po,{source:_,active:t.computed(()=>_.value!==null),primaryEntityIds:E,relatedEntityIds:t.computed(()=>N.value.related),relatedEdgeIds:t.computed(()=>N.value.edges),relatedNoteIds:t.computed(()=>N.value.notes),hoverGroupId:t.computed(()=>{var D;return((D=_.value)==null?void 0:D.kind)==="group"?_.value.id:null}),setEntityHover:D=>{k.value||m.value||(_.value=D?{kind:"entity",id:D}:null)},setGroupHover:D=>{k.value||m.value||(_.value=D?{kind:"group",id:D}:null)},setNoteHover:D=>{k.value||m.value||(_.value=D?{kind:"note",id:D}:null)}}),t.provide(ro,i);const p=KC(),b=t.computed(()=>p(i.state.logical,i.embeddableCatalog.value));t.provide(Uf,b);const w=ph({expandableKeys:()=>[],defaultCollapsed:YC,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(jf,{isCollapsed:w.isCollapsed,toggle:w.toggle}),t.provide(zf,{marks:t.toRef(o,"diffMarks")});function A(D,R){return`${Ts}${D}:${R}`}function $(D){if(!D.startsWith(Ts))return null;const[R,P]=D.slice(Ts.length).split(":");return R&&P?{noteRef:R,targetRef:P}:null}t.provide(ss,{points:D=>{var P,te;const R=$(D);return R?((P=i.resolved.value.noteConnections.find(Ee=>Ee.noteRef===R.noteRef&&Ee.targetRef===R.targetRef))==null?void 0:P.waypoints)??[]:((te=i.resolved.value.associations.find(Ee=>Ee.association.modelId===D))==null?void 0:te.waypoints)??[]},movePoint:(D,R,P)=>{const te=$(D);te?i.moveNoteConnectionWaypoint(te.noteRef,te.targetRef,R,P):i.moveWaypoint(D,R,P)},insertPoint:(D,R,P)=>{const te=$(D);te?i.addNoteConnectionWaypoint(te.noteRef,te.targetRef,R,P):i.addWaypoint(D,R,P)},removePoint:(D,R)=>{const P=$(D);P?i.removeNoteConnectionWaypoint(P.noteRef,P.targetRef,R):i.removeWaypoint(D,R)}});const L=qe(),{nodes:T,edges:S,findNode:C,findEdge:M,addNodes:B,addEdges:g,removeNodes:I,removeEdges:v,fitView:O,setCenter:x,getViewport:z,screenToFlowCoordinate:j,getSelectedNodes:ne,updateNodeInternals:de}=L,pe=t.ref(!1);async function he(D){pe.value=!0,await t.nextTick(),await new Promise(R=>requestAnimationFrame(()=>R(null)));try{return await D()}finally{pe.value=!1}}async function fe(){try{await he(()=>gh(L))}catch(D){console.error("[entity-modeler] SVG export failed",D),c(i.t("em.canvas.exportFailed"))}}async function ye(){try{await he(()=>bh(L))}catch(D){console.error("[entity-modeler] PNG export failed",D),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:fe,exportPng:ye,fitView:O});const _e=t.computed(()=>i.resolved.value.entities.length===0);function Re(){const D=z(),{width:R,height:P}=L.dimensions.value;return{x:(R/2-D.x)/D.zoom,y:(P/2-D.y)/D.zoom}}function ce(){const D=Re();i.addEntity("NewEntity",{x:D.x,y:D.y})}function le(){const D=Re();i.addNote("메모",{x:D.x,y:D.y})}function ae(D){for(const R of i.resolved.value.groups){const{location:P,size:te}=R.geo;if(D.x>=P.x&&D.x<=P.x+te.width&&D.y>=P.y&&D.y<=P.y+te.height)return R.group.modelId}return null}function se(D,R){return D.x===R.x&&D.y===R.y}function ue(D,R){return(D==null?void 0:D.width)===(R==null?void 0:R.width)&&(D==null?void 0:D.height)===(R==null?void 0:R.height)}function U(D,R){return D.entity===R.entity&&D.displayMode===R.displayMode&&D.collapsed===R.collapsed&&D.locked===R.locked&&D.groupRef===R.groupRef&&ue(D.size,R.size)&&D.style===R.style&&D.attributeStyles===R.attributeStyles&&D.operationStyles===R.operationStyles}function F(D,R){const P=Object.keys(D);if(P.length!==Object.keys(R).length)return!1;for(const te of P)if(te==="geo"){const Ee=D.geo,ie=R.geo;if(!se(Ee.location,ie.location)||!ue(Ee.size,ie.size))return!1}else if(D[te]!==R[te])return!1;return!0}function H(){const D=i.resolved.value,R=new Map(D.groups.map(re=>[re.group.modelId,re.geo])),P=new Set(D.groups.map(re=>re.group.modelId)),te=new Set([...P,...D.entities.map(re=>re.entity.modelId),...D.notes.map(re=>re.note.modelId)]);for(const re of[...T.value])te.has(re.id)||I([re.id]);for(const re of D.groups){const Te=re.group.modelId,Oe={width:`${re.geo.size.width}px`,height:`${re.geo.size.height}px`},je={group:re.group,style:re.style,locked:re.locked},st=re.locked?!1:void 0,tt=C(Te);if(tt){se(tt.position,re.geo.location)||(tt.position={...re.geo.location});const Ke=tt.data;(Ke.group!==je.group||Ke.style!==je.style||Ke.locked!==je.locked)&&(tt.data=je);const Xe=tt.style;((Xe==null?void 0:Xe.width)!==Oe.width||(Xe==null?void 0:Xe.height)!==Oe.height)&&(tt.style=Oe),tt.draggable!==st&&(tt.draggable=st)}else B([{id:Te,type:"group",position:{...re.geo.location},draggable:st,style:Oe,data:je}])}for(const re of D.entities){const Te=re.entity.modelId,Oe=re.groupRef&&P.has(re.groupRef)?re.groupRef:void 0,je={entity:re.entity,displayMode:i.displayMode.value,collapsed:re.collapsed,locked:re.locked,groupRef:Oe,size:re.geo.size,style:re.style,attributeStyles:re.attributeStyles,operationStyles:re.operationStyles},st=re.locked?!1:void 0,tt=re.locked?!1:void 0,Ke=Oe?R.get(Oe):void 0,Xe=Ke?{x:re.geo.location.x-Ke.location.x,y:re.geo.location.y-Ke.location.y}:{...re.geo.location},Ye=C(Te);Ye?(se(Ye.position,Xe)||(Ye.position=Xe),U(Ye.data,je)||(Ye.data=je),Ye.parentNode!==Oe&&(Ye.parentNode=Oe),Ye.draggable!==st&&(Ye.draggable=st),Ye.connectable!==tt&&(Ye.connectable=tt)):B([{id:Te,type:"entity",position:Xe,parentNode:Oe,draggable:st,connectable:tt,data:je}])}for(const re of D.notes){const Te=re.note,Oe=Te.modelId,je=re.groupRef&&P.has(re.groupRef)?re.groupRef:void 0,st={note:Te,groupRef:je},tt={width:`${Te.geo.size.width}px`,height:`${Te.geo.size.height}px`},Ke=je?R.get(je):void 0,Xe=Ke?{x:Te.geo.location.x-Ke.location.x,y:Te.geo.location.y-Ke.location.y}:{...Te.geo.location},Ye=C(Oe);if(Ye){se(Ye.position,Xe)||(Ye.position=Xe);const mo=Ye.data;(mo.groupRef!==je||!F(mo.note,Te))&&(Ye.data=st);const wn=Ye.style;((wn==null?void 0:wn.width)!==tt.width||(wn==null?void 0:wn.height)!==tt.height)&&(Ye.style=tt),Ye.parentNode!==je&&(Ye.parentNode=je)}else B([{id:Oe,type:"note",position:Xe,parentNode:je,style:tt,data:st}])}const Ee=new Map(D.associations.map(re=>[re.association.modelId,re])),ie=new Set(D.noteConnections.map(re=>A(re.noteRef,re.targetRef)));for(const re of[...S.value])!Ee.has(re.id)&&!ie.has(re.id)&&v([re.id]);for(const[re,Te]of Ee){const Oe={id:re,type:"association",source:Te.association.end1.entityRef,target:Te.association.end2.entityRef,sourceHandle:Te.sourceColumnRef?`r:${Te.sourceColumnRef}`:void 0,targetHandle:Te.targetColumnRef?`l:${Te.targetColumnRef}`:void 0,data:{association:Te.association,sourceColumnRef:Te.sourceColumnRef,targetColumnRef:Te.targetColumnRef}},je=M(re);if(je){const st=je.data;(st.association!==Oe.data.association||st.sourceColumnRef!==Oe.data.sourceColumnRef||st.targetColumnRef!==Oe.data.targetColumnRef)&&(je.data=Oe.data),je.sourceHandle!==Oe.sourceHandle&&(je.sourceHandle=Oe.sourceHandle),je.targetHandle!==Oe.targetHandle&&(je.targetHandle=Oe.targetHandle)}else g([Oe])}for(const re of D.noteConnections){const Te=A(re.noteRef,re.targetRef),Oe={noteRef:re.noteRef,targetRef:re.targetRef};M(Te)||g([{id:Te,type:"note-connection",source:re.noteRef,target:re.targetRef,data:Oe}])}}const Z=new Set;let X=!1,Ne=!1;const me=new Map;function Se(D){const R=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(D)}"]`);if(!R)return null;let P=`${R.offsetHeight}`;for(const te of R.querySelectorAll(".em-entity__row"))P+=`|${te.dataset.attr}:${te.offsetTop}`;return P}function ve(){Ne=!1;const D=X;X=!1;const R=[...Z];if(Z.clear(),D){de();for(const te of T.value){const Ee=Se(te.id);Ee!==null&&me.set(te.id,Ee)}return}const P=[];for(const te of R){const Ee=Se(te);if(Ee===null){me.delete(te);continue}me.get(te)!==Ee&&(me.set(te,Ee),P.push(te))}P.length&&de(P)}function G(D){if(D)for(const R of D)Z.add(R);else X=!0;Ne||(Ne=!0,t.nextTick(()=>requestAnimationFrame(ve)))}t.provide(Ff,{mark:D=>G([D])});function q(){const D=ne.value.map(P=>P.id);if(D.length)return D;const R=i.selection.value;return R&&(R.kind==="entity"||R.kind==="note"||R.kind==="group")?[R.id]:[]}function Y(){return ne.value.filter(D=>D.type==="entity").map(D=>D.id)}function xe(){return ne.value.filter(D=>D.type==="group").map(D=>D.id)}function Be(D){var R;return[...((R=i.state.logical.groups.find(P=>P.modelId===D))==null?void 0:R.memberEntityRefs)??[]]}function Ve(){const D=xe().flatMap(Be);return[...new Set([...Y(),...D])]}function Le(){return xe().length>0||Y().length>1}function oe(){Le()?i.copy(Ve()):i.copy()}async function we(D){if(!D.length)return;await t.nextTick();const R=ne.value;R.length&&L.removeSelectedNodes(R);const P=D.map(te=>C(te)).filter(te=>!!te);P.length&&L.addSelectedNodes(P)}function Fe(D){if(Le()&&Y().includes(D)){const R=Ve();return{caption:i.t("em.ctx.copyN",{n:R.length}),icon:"copy",handler:()=>i.copy(R)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D},i.copy()}}}function K(D){var Ee;const R=D.target;if(R&&(R.tagName==="INPUT"||R.tagName==="TEXTAREA"||R.isContentEditable))return;if(D.key==="?"){a.openModal({component:_h,bind:{locale:i.uiLocale.value}}),D.preventDefault();return}if((D.metaKey||D.ctrlKey)&&D.key.toLowerCase()==="k"){r.value=!0,D.preventDefault();return}if(!i.editable.value){(D.metaKey||D.ctrlKey)&&D.key.toLowerCase()==="c"&&(oe(),D.preventDefault());return}if(D.key==="Delete"||D.key==="Backspace"){i.deleteSelection()&&D.preventDefault();return}if(D.key==="ArrowUp"||D.key==="ArrowDown"||D.key==="ArrowLeft"||D.key==="ArrowRight"){if(((Ee=i.selection.value)==null?void 0:Ee.kind)==="attribute"){if(D.key==="ArrowUp"||D.key==="ArrowDown"){const Oe=D.key==="ArrowDown"?1:-1;(D.altKey?i.nudgeSelectedAttributes(Oe):i.moveAttributeFocus(Oe))&&D.preventDefault()}return}const ie=D.shiftKey?10:1,re=D.key==="ArrowLeft"?-ie:D.key==="ArrowRight"?ie:0,Te=D.key==="ArrowUp"?-ie:D.key==="ArrowDown"?ie:0;i.nudgeNodes(q(),re,Te)&&D.preventDefault();return}if(!(D.metaKey||D.ctrlKey))return;const te=D.key.toLowerCase();te==="c"?(oe(),D.preventDefault()):te==="v"?(we(i.paste()),D.preventDefault()):te==="z"&&(D.shiftKey?i.redo():i.undo(),D.preventDefault())}t.onMounted(async()=>{H(),await t.nextTick(),O(),G(),window.addEventListener("keydown",K),window.addEventListener("pointerup",V),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",K),window.removeEventListener("pointerup",V),window.removeEventListener("pointermove",f)});function V(){y.value=null}function W(){m.value=!0,_.value=null}function Ce(){var te;m.value=!1;const D=(te=document.elementFromPoint(h.x,h.y))==null?void 0:te.closest(".vue-flow__node"),R=D==null?void 0:D.dataset.id;if(!R){_.value=null;return}const P=D.classList.contains("vue-flow__node-group")?"group":D.classList.contains("vue-flow__node-note")?"note":"entity";_.value={kind:P,id:R}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],H),t.watch(()=>i.resolved.value,D=>{const R=_.value;if(!R)return;(R.kind==="entity"?D.entities.some(te=>te.entity.modelId===R.id):R.kind==="group"?D.groups.some(te=>te.group.modelId===R.id):D.notes.some(te=>te.note.modelId===R.id))||(_.value=null)});function ze(D){const R=D.computedPosition??D.position,P=D.dimensions??{width:0,height:0};return{x:R.x+P.width/2,y:R.y+P.height/2}}function Ie(D){const R=D.node;if(R){if(_.value=null,R.type==="group"){const P=i.resolved.value.groups.find(te=>te.group.modelId===R.id);k.value=P?{groupId:R.id,dx:R.position.x-P.geo.location.x,dy:R.position.y-P.geo.location.y}:null,y.value=null;return}if(R.type!=="entity"&&R.type!=="note"){y.value=null;return}y.value=ae(ze(R))}}function J(D){var te;y.value=null,k.value=null;const R=(te=D.nodes)!=null&&te.length?D.nodes:[D.node],P=R.filter(Ee=>(Ee==null?void 0:Ee.type)==="group");if(P.length){for(const Ee of P){if(!Ee)continue;const ie=i.resolved.value.entities.filter(re=>re.groupRef===Ee.id).map(re=>{const Te=C(re.entity.modelId),Oe=(Te==null?void 0:Te.computedPosition)??(Te==null?void 0:Te.position)??{x:0,y:0};return{id:re.entity.modelId,location:{x:Oe.x,y:Oe.y}}});i.dragGroup(Ee.id,{x:Ee.position.x,y:Ee.position.y},ie)}return}for(const Ee of R){if(!Ee||Ee.type==="group")continue;const ie=Ee.computedPosition??Ee.position,re=Ee.dimensions??{width:0,height:0},Te={x:ie.x+re.width/2,y:ie.y+re.height/2};Ee.type==="note"?i.dropNote(Ee.id,{x:ie.x,y:ie.y},ae(Te)):i.dropEntity(Ee.id,{x:ie.x,y:ie.y},ae(Te))}}function He(D){var Oe,je,st,tt,Ke;if(!i.editable.value||!D.source||!D.target)return;const R=((Oe=C(D.source))==null?void 0:Oe.type)==="note",P=((je=C(D.target))==null?void 0:je.type)==="note";if(R||P){if(R&&P)return;const Xe=R?D.source:D.target,Ye=R?D.target:D.source;((st=C(Ye))==null?void 0:st.type)==="entity"&&i.addNoteConnection(Xe,Ye);return}const te=Xe=>{var Ye;return(Ye=i.state.logical.entities.find(mo=>mo.modelId===Xe))==null?void 0:Ye.stereotype},Ee=te(D.source)==="JPA_EMBEDDABLE",ie=te(D.target)==="JPA_EMBEDDABLE";if(Ee||ie){if(Ee&&ie)return;const Xe=Ee?D.source:D.target,Ye=Ee?D.target:D.source;i.addEmbedAssociation(Ye,Xe);return}const re=(tt=D.sourceHandle)!=null&&tt.startsWith("r:")?D.sourceHandle.slice(2):void 0,Te=(Ke=D.targetHandle)!=null&&Ke.startsWith("l:")?D.targetHandle.slice(2):void 0;i.addAssociation(D.source,D.target,re,Te)}const ot=t.ref(null);function bn(D,R){var te;const P=i.state.layout.entityLayouts.find(Ee=>Ee.entityRef===D);return bt((te=P==null?void 0:P.attributeStyles)==null?void 0:te[R])}function Ue(D,R){var te;const P=i.state.layout.entityLayouts.find(Ee=>Ee.entityRef===D);return bt((te=P==null?void 0:P.operationStyles)==null?void 0:te[R])}function Ge(D){var R;return bt((R=i.state.layout.groupLayouts.find(P=>P.groupRef===D))==null?void 0:R.style)}function Q(D){var R;return bt((R=i.state.layout.notes.find(P=>P.modelId===D))==null?void 0:R.style)}function kt(D){var Ee,ie;if(D.preventDefault(),!i.editable.value)return;const R=()=>j({x:D.clientX,y:D.clientY}),P=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const re=R();i.addEntity("NewEntity",{x:re.x,y:re.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const re=R();i.addNote("메모",{x:re.x,y:re.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const re=R();i.addEmptyGroup({x:re.x,y:re.y})}}],te=(Ee=i.clipboard.value)==null?void 0:Ee.kind;(te==="entity"||te==="entities")&&P.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>we(i.paste())}),i.resolved.value.entities.length>0&&P.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()}),(ie=ot.value)==null||ie.open(D,P)}function _n({event:D,node:R}){var Oe,je,st,tt,Ke,Xe,Ye,mo,wn,vh,Ch,xh,Sh,Rh,Ah,$h,Th,Mh,Vh;const P=D;if(P.preventDefault(),!i.editable.value){if(R.type==="group"||R.type==="note")return;const Je=(je=(Oe=P.target)==null?void 0:Oe.closest("[data-attr]"))==null?void 0:je.dataset.attr;if(Je){const ct=i.selection.value;(ct==null?void 0:ct.kind)==="attribute"&&ct.entityId===R.id&&ct.ids.includes(Je)||i.selectAttribute(R.id,Je);const In=((st=i.selection.value)==null?void 0:st.kind)==="attribute"&&i.selection.value.entityId===R.id?[...i.selection.value.ids]:[Je];(tt=ot.value)==null||tt.open(P,[{caption:In.length>1?i.t("em.ctx.copyN",{n:In.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(Ke=ot.value)==null||Ke.open(P,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Ja(a,i,R.id)},Fe(R.id)]);return}if(R.type==="group"){const Je=i.isGroupLocked(R.id),ct=[];Je||ct.push({type:"swatches",caption:i.t("em.common.color"),current:Ge(R.id),onPick:In=>i.setGroupSwatch(R.id,In)},{type:"separator"});const pt=Le()&&xe().includes(R.id)?Ve():Be(R.id);pt.length&&ct.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(pt)}),ct.push({caption:Je?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Je?"unlock":"lock",handler:()=>i.setGroupLocked(R.id,!Je)}),Je||ct.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(R.id)}),(Xe=ot.value)==null||Xe.open(P,ct);return}if(R.type==="note"){(Ye=ot.value)==null||Ye.open(P,[{type:"swatches",caption:i.t("em.common.color"),current:Q(R.id),onPick:Je=>i.setNoteSwatch(R.id,Je)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(R.id)}]);return}const te=(wn=(mo=P.target)==null?void 0:mo.closest("[data-attr]"))==null?void 0:wn.dataset.attr;if(te){const Je=i.selection.value;(Je==null?void 0:Je.kind)==="attribute"&&Je.entityId===R.id&&Je.ids.includes(te)||i.selectAttribute(R.id,te);const pt=((vh=i.selection.value)==null?void 0:vh.kind)==="attribute"&&i.selection.value.entityId===R.id?[...i.selection.value.ids]:[te];if(i.isEntityLocked(R.id)){(Ch=ot.value)==null||Ch.open(P,[{caption:pt.length>1?i.t("em.ctx.copyN",{n:pt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const In=pt.length>1,Ms=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(R.id)},{type:"swatches",caption:In?i.t("em.ctx.colorN",{n:pt.length}):i.t("em.common.color"),current:In?null:bn(R.id,te),onPick:bD=>i.setAttributeSwatches(R.id,pt,bD)},{type:"separator"},{caption:In?i.t("em.ctx.copyN",{n:pt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Li=i.clipboard.value;(Li==null?void 0:Li.kind)==="attribute"&&Ms.push({caption:Li.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Li.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:R.id},i.paste()}}),Ms.push({type:"separator"},{caption:In?i.t("em.ctx.deleteAttrN",{n:pt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(R.id,pt)}),(xh=ot.value)==null||xh.open(P,Ms);return}const Ee=(Rh=(Sh=P.target)==null?void 0:Sh.closest("[data-op]"))==null?void 0:Rh.dataset.op;if(Ee){if(i.isEntityLocked(R.id))return;(Ah=ot.value)==null||Ah.open(P,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(R.id)},{type:"swatches",caption:i.t("em.common.color"),current:Ue(R.id,Ee),onPick:Je=>i.setOperationSwatch(R.id,Ee,Je)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(R.id,Ee)}]);return}const ie=i.resolved.value.entities.find(Je=>Je.entity.modelId===R.id),re=!!(ie!=null&&ie.locked),Te=[{caption:re?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Ja(a,i,R.id)}];if(!re){Te.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(R.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(R.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const ct=ne.value.filter(pt=>pt.type==="entity").map(pt=>pt.id);i.createGroup(ct.includes(R.id)&&ct.length?ct:[R.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(R.id,R.id)});const Je=i.embeddableCatalog.value;if(Je.length){Te.push({type:"separator"});for(const ct of Je){const pt=(($h=ct.label)==null?void 0:$h[i.userLanguage.value])??((Th=ct.label)==null?void 0:Th.ko)??((Mh=ct.label)==null?void 0:Mh.en)??ct.type;Te.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:pt}),icon:"link",handler:()=>i.addPredefinedEmbed(R.id,ct.type)})}}}if(Te.push({type:"separator"}),Te.push({caption:ie!=null&&ie.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:ie!=null&&ie.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(R.id,!(ie!=null&&ie.collapsed))}),ie!=null&&ie.groupRef&&!re&&Te.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(R.id)}),Te.push({caption:re?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:re?"unlock":"lock",handler:()=>i.setEntityLocked(R.id,!re)}),Te.push(Fe(R.id)),!re){const Je=i.clipboard.value;(Je==null?void 0:Je.kind)==="attribute"&&Te.push({caption:Je.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Je.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:R.id},i.paste()}}),Te.push({type:"separator"}),Te.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(R.id)})}(Vh=ot.value)==null||Vh.open(P,Te)}function kn({event:D,edge:R}){var ie,re;const P=D;if(P.preventDefault(),!i.editable.value)return;const te=$(R.id);if(te){(ie=ot.value)==null||ie.open(P,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(te.noteRef,te.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(te.noteRef,te.targetRef)}]);return}const Ee=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(R.id)}];i.isAssociationLocked(R.id)||Ee.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(R.id)}),(re=ot.value)==null||re.open(P,Ee)}function St(D){return D==="group"?"group":D==="note"?"note":"entity"}function ge({node:D}){if(ne.value.length>1){i.selection.value=null;return}i.selection.value={kind:St(D.type),id:D.id}}function at({nodes:D}){D.length>1&&(i.selection.value=null)}function en({edge:D}){const R=$(D.id);i.selection.value=R?{kind:"note",id:R.noteRef}:{kind:"association",id:D.id}}function zt(D){const R=i.selection.value;return!!R&&R.kind!=="attribute"&&R.id===D.id}function tn(D){var R,P;return zt(D)?D.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":D.type==="note"?"var(--em-note-soft)":D.type==="group"?kf(bt((R=D.data)==null?void 0:R.style),!0)??"var(--em-mm-group)":kf(bt((P=D.data)==null?void 0:P.style))??"var(--em-mm-entity)"}function Ft(D){return zt(D)?"var(--em-selection)":D.type==="note"?"var(--em-note-accent)":D.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ke(D,R){x(D,R,{zoom:z().zoom,duration:350})}t.watch(()=>i.focusRequest.value,D=>{if(!D)return;const R=C(D.id);if(!R)return;const P=R.computedPosition??R.position,te=R.dimensions??{width:0,height:0};ke(P.x+te.width/2,P.y+te.height/2)});function lt({position:D}){ke(D.x,D.y)}function En({node:D}){i.selection.value={kind:St(D.type),id:D.id};const R=D.computedPosition??D.position,P=D.dimensions??{width:0,height:0};ke(R.x+P.width/2,R.y+P.height/2)}function Nn({node:D}){O({nodes:[D.id],duration:350,maxZoom:1.2,padding:.6})}return(D,R)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(Ew),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!pe.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(un).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:W,onMoveEnd:Ce,onConnect:He,onConnectStart:R[1]||(R[1]=P=>u.value=!0),onConnectEnd:R[2]||(R[2]=P=>u.value=!1),onNodeDrag:Ie,onNodeDragStop:J,onNodeClick:ge,onEdgeClick:en,onSelectionChange:at,onPaneClick:R[3]||(R[3]=P=>t.unref(i).selection.value=null),onPaneContextMenu:kt,onNodeContextMenu:_n,onEdgeContextMenu:kn},{"node-group":t.withCtx(P=>[t.createVNode(Xf,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),"node-entity":t.withCtx(P=>[t.createVNode(Jf,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),"node-note":t.withCtx(P=>[t.createVNode(Zf,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),"edge-association":t.withCtx(P=>[t.createVNode(_p,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),"edge-note-connection":t.withCtx(P=>[t.createVNode(fT,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(tS),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(xS),{"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(lo),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:ce},{default:t.withCtx(()=>[t.createVNode($e,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(lo),{title:t.unref(i).t("em.ctx.addNote"),onClick:le},{default:t.withCtx(()=>[t.createVNode($e,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(lo),{title:t.unref(i).t("em.palette.autoLayout"),onClick:R[0]||(R[0]=P=>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(cT),{key:1,pannable:"",width:224,height:160,"node-color":tn,"node-stroke-color":Ft,"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:lt,onNodeClick:En,onNodeDblclick:Nn})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),_e.value?(t.openBlock(),t.createElementBlock("div",oM,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",iM,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,aM),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,rM),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,lM)],64)):(t.openBlock(),t.createElementBlock("p",sM,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(tM,{key:1,controller:t.unref(i),onClose:R[4]||(R[4]=P=>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",cM,[t.createVNode($e,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",dM,[t.createElementVNode("strong",uM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",mM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(IT,{ref_key:"menuRef",ref:ot,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",fM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),pM={class:"em-explorer em-scroll-overlay"},hM={class:"em-explorer__search"},yM=["placeholder","aria-label"],gM=["aria-label","title"],bM={key:0,class:"em-explorer__empty"},_M=["aria-label"],kM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],EM=["onClick"],NM=["title"],wM={class:"em-key-slot"},IM={class:"em-key-slot"},vM={class:"em-explorer__label"},CM={key:2,class:"em-explorer__sr"},Eh=We(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.computed(()=>{var _e,Re;const B=i.resolved.value,g=i.displayMode.value,I=i.userLanguage.value,v=ce=>{var le,ae,se;return Ui(g,ce.name,(ae=(le=ce.table)==null?void 0:le.logicalName)==null?void 0:ae[I],(se=ce.table)==null?void 0:se.physicalName,i.t("em.node.logicalMissing"))},O=g==="PHYSICAL"||g==="LOGICAL_PHYSICAL",x=ce=>{const le=ce.attrType.startsWith("RELATION")&&ce.dbAttrs.length>0;return{icon:ce.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:ce.identifier,fk:le&&O}}},z=ce=>ce.attrType.startsWith("EMBED")&&ce.dbAttrs.length>0,j=g==="PHYSICAL"||g==="LOGICAL_PHYSICAL",ne=ce=>{if(ce.attrType!=="EMBED_PREDEF")return ce.dbAttrs;const le=i.embeddableCatalog.value.find(ae=>ae.type===ce.type);return le?ce.dbAttrs.map((ae,se)=>{const ue=le.fields[se];return ue?{...ae,physicalName:ae.physicalName||ue.physicalName,logicalName:ae.logicalName??ue.logicalName,dataType:ae.dataType||ue.dataType,length:ae.length??ue.length}:ae}):ce.dbAttrs},de=(ce,le)=>{var U,F,H,Z,X,Ne,me,Se,ve;const ae={entityId:le,attrId:ce.modelId};if(z(ce)){const G=Vr(g,ce);return{key:`attr:${ce.modelId}`,label:ce.name+(G?` : ${G}`:""),icon:"table",attrRef:ae,focusId:le,matchText:Ko(ce.name,(F=(U=ce.dbAttrs[0])==null?void 0:U.logicalName)==null?void 0:F[I],(H=ce.dbAttrs[0])==null?void 0:H.physicalName),children:j?ne(ce).map(q=>{var Y,xe;return{key:`attr:${ce.modelId}:col:${q.modelId}`,label:Ui(g,q.physicalName,(Y=q.logicalName)==null?void 0:Y[I],q.physicalName,i.t("em.node.logicalMissing"))+(q.dataType?` : ${q.dataType}`:""),icon:"field",attrRef:ae,focusId:le,matchText:Ko(q.physicalName,(xe=q.logicalName)==null?void 0:xe[I]),children:[]}}):[]}}const se=Mr(ce,i.state.logical.associations),ue=Vr(g,ce,se);return{key:`attr:${ce.modelId}`,label:Ui(g,ce.name,(X=(Z=ce.dbAttrs[0])==null?void 0:Z.logicalName)==null?void 0:X[I],(Ne=ce.dbAttrs[0])==null?void 0:Ne.physicalName,i.t("em.node.logicalMissing"))+(ue?` : ${ue}`:""),...x(ce),attrRef:ae,focusId:le,matchText:Ko(ce.name,(Se=(me=ce.dbAttrs[0])==null?void 0:me.logicalName)==null?void 0:Se[I],(ve=ce.dbAttrs[0])==null?void 0:ve.physicalName),children:[]}},pe=ce=>{var se,ue,U;const le=ce.entity,ae=[...le.attributes].sort((F,H)=>F.order-H.order);return{key:`entity:${le.modelId}`,label:v(le),icon:"table",selectKind:"entity",selectId:le.modelId,focusId:le.modelId,matchText:Ko(le.name,(ue=(se=le.table)==null?void 0:se.logicalName)==null?void 0:ue[I],(U=le.table)==null?void 0:U.physicalName),children:ae.map(F=>de(F,le.modelId))}},he=new Map,fe=[];for(const ce of B.entities)if(ce.groupRef){const le=he.get(ce.groupRef)??[];le.push(ce),he.set(ce.groupRef,le)}else fe.push(ce);const ye=[];for(const ce of B.groups){const le=ce.group;ye.push({key:`group:${le.modelId}`,label:((_e=le.name)==null?void 0:_e[I])||((Re=le.name)==null?void 0:Re.ko)||le.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:le.modelId,children:(he.get(le.modelId)??[]).map(pe)})}for(const ce of fe)ye.push(pe(ce));if(B.associations.length){const ce=new Map(B.entities.map(le=>[le.entity.modelId,v(le.entity)]));ye.push({key:"section:associations",label:i.t("em.explorer.associations",{n:B.associations.length}),icon:"arrow-lr",children:B.associations.map(le=>{const ae=le.association,se=ce.get(ae.end1.entityRef)??ae.end1.entityRef,ue=ce.get(ae.end2.entityRef)??ae.end2.entityRef;return{key:`assoc:${ae.modelId}`,label:`${se} — ${ue}`,icon:"arrow-lr",selectKind:"association",selectId:ae.modelId,children:[]}})})}return B.notes.length&&ye.push({key:"section:notes",label:i.t("em.explorer.notes",{n:B.notes.length}),icon:"note",children:B.notes.map(({note:ce})=>{var le;return{key:`note:${ce.modelId}`,label:((le=ce.memo.split(`
|
|
66
|
-
`)[0])==null?void 0:le.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:ye}});function l(B){return B?B.pk&&B.fk?i.t("em.node.keyPfk"):B.pk?i.t("em.node.keyPk"):B.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const B=[],g=I=>{if(I.children.length){I.key!=="root"&&B.push(I.key);for(const v of I.children)g(v)}};return g(r.value),B}),c=B=>B.startsWith("entity:")||B==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:h}=ph({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),y=t.ref(null),k=t.computed(()=>f.value.trim().length>0),_=t.computed(()=>{const B=[];if(k.value){const I=zT(r.value,f.value.trim().toLowerCase()),v=(O,x,z,j,ne)=>{if(!I.has(O.key))return;B.push({node:O,depth:x,parentKey:z,posinset:j,setsize:ne});const de=O.children.filter(pe=>I.has(pe.key));de.forEach((pe,he)=>v(pe,x+1,O.key,he+1,de.length))};return v(r.value,0,null,1,1),B}const g=(I,v,O,x,z)=>{B.push({node:I,depth:v,parentKey:O,posinset:x,setsize:z}),d(I.key)||I.children.forEach((j,ne)=>g(j,v+1,I.key,ne+1,I.children.length))};return g(r.value,0,null,1,1),B}),E=t.ref(null),N=t.ref(null),p=t.computed(()=>{var g;const B=_.value;return N.value&&B.some(I=>I.node.key===N.value)?N.value:((g=B[0])==null?void 0:g.node.key)??null}),b=B=>!k.value&&d(B);async function w(B){var g,I;B&&(N.value=B,await t.nextTick(),(I=(g=E.value)==null?void 0:g.querySelector(`[data-key="${B}"]`))==null||I.focus())}function A(B,g){var O,x,z,j,ne;const I=_.value,v=I.findIndex(de=>de.node.key===g.node.key);switch(B.key){case"ArrowDown":B.preventDefault(),w((O=I[v+1])==null?void 0:O.node.key);return;case"ArrowUp":B.preventDefault(),w((x=I[v-1])==null?void 0:x.node.key);return;case"Home":B.preventDefault(),w((z=I[0])==null?void 0:z.node.key);return;case"End":B.preventDefault(),w((j=I[I.length-1])==null?void 0:j.node.key);return;case"ArrowRight":if(B.preventDefault(),!g.node.children.length)return;b(g.node.key)?u(g.node.key):w((ne=I[v+1])==null?void 0:ne.node.key);return;case"ArrowLeft":B.preventDefault(),g.node.children.length&&!b(g.node.key)?u(g.node.key):w(g.parentKey);return;case"Enter":case" ":B.preventDefault(),C(g.node,B);return;case"F2":B.preventDefault(),M(g.node)}}const $=t.computed(()=>k.value&&_.value.length<=1);function L(B){var v;if(B.key!=="/"||B.metaKey||B.ctrlKey||B.altKey||B.shiftKey)return;const g=B.target,I=g==null?void 0:g.tagName;I==="INPUT"||I==="TEXTAREA"||I==="SELECT"||g!=null&&g.isContentEditable||(B.preventDefault(),(v=y.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",L)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",L)),n({toggleAll:m,allExpanded:h,hasExpandable:t.computed(()=>s.value.length>0)});function T(B){const g=i.selection.value;return B.attrRef?(g==null?void 0:g.kind)==="attribute"&&g.entityId===B.attrRef.entityId&&g.ids.includes(B.attrRef.attrId):!!g&&g.kind!=="attribute"&&!!B.selectId&&B.selectKind===g.kind&&B.selectId===g.id}function S(B){const g=i.selection.value;return B.selectKind==="entity"&&(g==null?void 0:g.kind)==="attribute"&&g.entityId===B.selectId}function C(B,g){if(B.attrRef){const I=g.shiftKey?"range":g.metaKey||g.ctrlKey?"toggle":"replace";i.selectAttribute(B.attrRef.entityId,B.attrRef.attrId,I)}else B.selectKind&&B.selectId&&(i.selection.value={kind:B.selectKind,id:B.selectId});B.focusId&&i.requestFocus(B.focusId)}function M(B){B.selectKind==="entity"&&B.selectId&&Ja(a,i,B.selectId)}return(B,g)=>(t.openBlock(),t.createElementBlock("section",pM,[t.createElementVNode("div",hM,[t.createVNode($e,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":g[0]||(g[0]=I=>f.value=I),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:g[1]||(g[1]=t.withKeys(I=>f.value="",["esc"]))},null,40,yM),[[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:g[2]||(g[2]=I=>f.value="")},[t.createVNode($e,{name:"x",size:13})],8,gM)):t.createCommentVNode("",!0)]),$.value?(t.openBlock(),t.createElementBlock("p",bM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:E,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(_.value,I=>(t.openBlock(),t.createElementBlock("div",{key:I.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":T(I.node),"is-focus-parent":S(I.node),"is-selectable":!!I.node.selectKind||!!I.node.attrRef||!!I.node.focusId}]),"data-key":I.node.key,role:"treeitem","aria-level":I.depth+1,"aria-posinset":I.posinset,"aria-setsize":I.setsize,"aria-expanded":I.node.children.length?!b(I.node.key):void 0,"aria-selected":T(I.node),tabindex:I.node.key===p.value?0:-1,style:t.normalizeStyle({paddingLeft:4+I.depth*14+"px"}),onClick:v=>C(I.node,v),onDblclick:v=>M(I.node),onFocus:v=>N.value=I.node.key,onKeydown:v=>A(v,I)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!I.node.children.length,"is-open":!b(I.node.key)}]),onClick:t.withModifiers(v=>I.node.children.length&&t.unref(u)(I.node.key),["stop"])},[I.node.children.length?(t.openBlock(),t.createBlock($e,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,EM),I.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(I.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",wM,[I.node.keyMarks.pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:14,class:"em-key is-pk"})):I.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock($e,{key:1,class:"em-explorer__icon",name:I.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",IM,[I.node.keyMarks.fk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,NM)):(t.openBlock(),t.createBlock($e,{key:1,class:"em-explorer__icon",name:I.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",vM,t.toDisplayString(I.node.label),1),l(I.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",CM,t.toDisplayString(l(I.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,kM))),128))],8,_M)]))}}),[["__scopeId","data-v-e5303c65"]]),xM={class:"em-text-export"},SM=["id","aria-selected","tabindex","onClick"],RM=["aria-labelledby"],AM={class:"em-text-export__actions"},$M=We(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(m,h)=>Dt(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,f;a.value=m,await t.nextTick(),(f=(h=l.value)==null?void 0:h.querySelectorAll('[role="tab"]')[m])==null||f.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),ee.showNotification(i("em.export.copied"),"info")}catch{ee.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),h=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(h);try{const y=document.createElement("a");y.href=f,y.download=m.filename,document.body.appendChild(y),y.click(),y.remove()}finally{URL.revokeObjectURL(f)}}return(m,h)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",xM,[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,y)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${y}`,key:f.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:k=>a.value=y,onKeydown:[h[0]||(h[0]=t.withKeys(t.withModifiers(k=>c(-1),["prevent"]),["left"])),h[1]||(h[1]=t.withKeys(t.withModifiers(k=>c(1),["prevent"]),["right"])),h[2]||(h[2]=t.withKeys(t.withModifiers(k=>s(0),["prevent"]),["home"])),h[3]||(h[3]=t.withKeys(t.withModifiers(k=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,SM))),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,RM),t.createElementVNode("div",AM,[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:h[4]||(h[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),TM={class:"em-text-import"},MM=["aria-label"],VM=["aria-checked","tabindex","onClick"],BM=["placeholder"],DM={class:"em-text-import__status"},OM={class:"em-text-import__ok"},LM={key:0,class:"em-text-import__warn"},PM={key:1,class:"em-text-import__err"},zM={key:2,class:"em-text-import__err"},FM={key:3,class:"em-text-import__err"},UM={class:"em-text-import__actions"},HM=We(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(k,_)=>Dt(n.locale??"ko",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(k){var E,N;const _=l[(k+l.length)%l.length];_&&(r.value=_.key,await t.nextTick(),(N=(E=s.value)==null?void 0:E.querySelectorAll('[role="radio"]')[l.indexOf(_)])==null||N.focus())}function d(k){c(l.findIndex(_=>_.key===r.value)+k)}function u(k){return k?k.startsWith("{")?"json":/\berdiagram\b/i.test(k)?"mermaid":/\bcreate\s+table\b/i.test(k)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),h=t.computed(()=>{const k=a.value.trim();if(!k)return{status:"empty"};const _=m.value;if(!_)return{status:"unknown"};try{let E,N=[];return _==="json"?E=yc(k):_==="mermaid"?E=sc(k):(E=mc(k),N=Br(k).warnings),E.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:E,warnings:N}}catch(E){return{status:"error",message:E instanceof Error?E.message:String(E)}}}),f=t.computed(()=>h.value.status==="ok");function y(){const k=h.value;k.status!=="ok"||!k.source||(n.onImport(k.source),o.close())}return(k,_)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",TM,[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,E=>t.createElementVNode("button",{key:E.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":E.key===r.value}]),"aria-checked":E.key===r.value,tabindex:E.key===r.value?0:-1,onClick:N=>r.value=E.key,onKeydown:[_[0]||(_[0]=t.withKeys(t.withModifiers(N=>d(-1),["prevent"]),["left"])),_[1]||(_[1]=t.withKeys(t.withModifiers(N=>d(1),["prevent"]),["right"])),_[2]||(_[2]=t.withKeys(t.withModifiers(N=>c(0),["prevent"]),["home"])),_[3]||(_[3]=t.withKeys(t.withModifiers(N=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(E.labelKey)),43,VM)),64))],8,MM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":_[4]||(_[4]=E=>a.value=E),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,BM),[[t.vModelText,a.value]]),t.createElementVNode("div",DM,[h.value.status==="ok"&&h.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",OM,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",LM," ⚠ "+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",PM,t.toDisplayString(i("em.import.error",{message:h.value.message??""})),1)):h.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",zM,t.toDisplayString(i("em.import.unknownFormat")),1)):h.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",FM,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",UM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:y},null,8,["caption","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:_[5]||(_[5]=E=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),jM={class:"em-toolbar"},KM=["title"],GM={class:"em-toolbar__mode"},Nh=We(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: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(k=>k.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=Cr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:$M,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:qs(y,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:xr(y,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:xr(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:fc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:hc(y,i.state.layout),filename:"diagram.json"}]}})}function h(){r.openModal({component:HM,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(k=>k.modelId))}}})}function f(){r.openModal({component:_h,bind:{locale:i.uiLocale.value}})}return(y,k)=>(t.openBlock(),t.createElementBlock("div",jM,[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,KM)):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:k[0]||(k[0]=_=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode($e,{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:k[1]||(k[1]=_=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode($e,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),k[9]||(k[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",GM,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(ee.BSSelect),{modelValue:s.value,"onUpdate:modelValue":k[2]||(k[2]=_=>s.value=_),items:l,"value-provider":_=>_.v,"label-provider":_=>t.unref(i).t(_.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($e,{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:k[3]||(k[3]=_=>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(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:k[4]||(k[4]=_=>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(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($e,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),k[10]||(k[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:h},{left:t.withCtx(()=>[t.createVNode($e,{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($e,{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:k[5]||(k[5]=_=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode($e,{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:k[6]||(k[6]=_=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode($e,{name:"camera",size:16})]),_:1},8,["tooltip"]),k[11]||(k[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:k[7]||(k[7]=_=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode($e,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),k[8]||(k[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($e,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),YM=["title"],qM=["title"],WM=["disabled","aria-pressed"],JM=["disabled","aria-pressed"],XM=We(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($e,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,YM)):(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,WM),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,JM)],10,qM))}}),[["__scopeId","data-v-2b5162b7"]]),ZM=["disabled"],QM={class:"em-panel__sub"},e2={class:"em-nav"},t2={key:0,class:"em-nav__divider","aria-hidden":"true"},n2={key:1},o2=["onClick","onKeydown"],i2={class:"em-nav__name"},a2=["title"],r2={key:0,class:"em-panel__note"},l2=["data-attr-block"],s2={class:"em-attr__row"},c2=["title"],d2={key:0,class:"em-attr__row"},u2={key:1,class:"em-attr__navhint"},m2={key:0,class:"em-attr__navhint"},f2={class:"em-attr__row"},p2={class:"em-attr__row"},h2=["title"],y2={class:"em-attr__flags"},g2={class:"em-attr__pii"},b2={class:"em-attr__pii"},_2={key:1,class:"em-attr__pii"},k2={key:2,class:"em-attr__pii em-attr__codetop"},E2={class:"em-multilang"},N2={key:3,class:"em-embed-cols"},w2={class:"em-embed-col__label"},I2={class:"em-attr__row"},v2=["title"],C2=["title"],x2=["title"],S2={class:"em-attr__row"},R2={key:0,class:"em-embed-upd"},A2={key:1,class:"em-attr__navhint"},$2={class:"em-embed-upd"},T2={class:"em-embed-upd"},M2={class:"em-swatch__row em-attr__swatch"},V2=["title","onClick"],B2=["title","onClick"],D2={key:0,class:"em-attr__swatch-hint"},O2=We(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,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:h,setRowName:f,isManagedFk:y,setNaturalId:k,setIdentifier:_,setTransient:E,dbLocked:N,fkDerived:p,fkOriginPhysical:b,typeValueOf:w,typeLabelOf:A,setAttrType:$,setAttrCustomType:L,setDb:T,scaleApplicable:S,scaleHint:C,setDbLogical:M,setAttrDescription:B,attrPiiValue:g,setAttrPii:I,predefinedCustomTypeCatalog:v,embeddableCatalog:O,predefinedLabel:x,groupCodeCatalog:z,attrGroupCodes:j,attrCodeItems:ne,codeValueOf:de,codeLabelOf:pe,setAttrGroupCode:he,setAttrCode:fe,setAttrDefaultValue:ye,isEmbedExpanded:_e,setDbAt:Re,setDbLogicalAt:ce,embedColMeta:le,fixedDataType:ae,fixedLength:se,fixedScale:ue,updatableItems:U,updatableLabel:F,updatableValue:H,setUpdatableAt:Z,setUpdatable:X,insertableItems:Ne,insertableLabel:me,insertableValue:Se,setInsertableAt:ve,setInsertable:G,sharedItems:q,sharedLabel:Y,sharedValue:xe,setSharedAt:Be,isShared:Ve,sharedPhysical:Le}=If(o,()=>n.entityId),oe=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Ue=>Ue.entityRef===i.value.modelId)??null:null),we=t.computed(()=>{var Ue;return((Ue=i.value)==null?void 0:Ue.attributes.filter(Ge=>Ge.attrType!=="DIVIDER"))??[]}),Fe=t.computed(()=>{var Ue;return((Ue=i.value)==null?void 0:Ue.attributes)??[]}),K=t.computed(()=>we.value.filter(Ue=>r.value.has(Ue.modelId)));function V(Ue){return{pk:Ue.identifier,fk:Ue.attrType.startsWith("RELATION")&&Ue.dbAttrs.length>0,required:Ue.notNull&&!Ue.identifier}}function W(Ue){const Ge=V(Ue),Q=[Ge.pk&&"PK",Ge.fk&&"FK",Ge.required&&"NOT NULL"].filter(Boolean);return Q.length?Q.join(" · "):void 0}function Ce(Ue,Ge){i.value&&o.selectAttribute(i.value.modelId,Ue.modelId,Ge.shiftKey?"range":Ge.metaKey||Ge.ctrlKey?"toggle":"replace")}function ze(Ue){var Ge,Q;return bt((Q=(Ge=oe.value)==null?void 0:Ge.attributeStyles)==null?void 0:Q[Ue.modelId])}function Ie(Ue){return r.value.size>1&&r.value.has(Ue.modelId)}function J(Ue,Ge){if(!i.value)return;const Q=Ie(Ue)?o.selectedAttrIds.value:[Ue.modelId];o.setAttributeSwatches(i.value.modelId,Q,Ge)}const He=t.ref(void 0);function ot(Ue){if(!Ue||!i.value)return;const Ge=o.addPredefinedEmbed(i.value.modelId,Ue);Ge&&o.selectAttribute(i.value.modelId,Ge),He.value=void 0}function bn(){if(!i.value)return;const Ue=o.addAttribute(i.value.modelId);Ue&&o.selectAttribute(i.value.modelId,Ue)}return(Ue,Ge)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",QM,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:we.value.length}))+" ",1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:bn},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":He.value,items:t.unref(O),"value-provider":Q=>Q.type,"label-provider":t.unref(x),"onUpdate:modelValue":ot},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",e2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Fe.value,Q=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Q.modelId},[Q.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",t2,[...Ge[0]||(Ge[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",n2,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Q.modelId)}]),role:"button",tabindex:"0",onClick:kt=>Ce(Q,kt),onKeydown:[t.withKeys(t.withModifiers(kt=>Ce(Q,kt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(kt=>Ce(Q,kt),["prevent"]),["space"])]},[t.createElementVNode("span",i2,t.toDisplayString(Q.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:W(Q)},[V(Q).pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):V(Q).required?(t.openBlock(),t.createBlock($e,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),V(Q).fk?(t.openBlock(),t.createBlock($e,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,a2)],42,o2)]))],64))),128))]),we.value.length&&!K.value.length?(t.openBlock(),t.createElementBlock("p",r2,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(K.value,Q=>{var kt,_n,kn,St,ge,at,en,zt,tn,Ft;return t.openBlock(),t.createElementBlock("div",{key:Q.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(Q.modelId)}]),"data-attr-block":Q.modelId},[t.createElementVNode("div",s2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-name-${Q.modelId}`,width:"100%",title:t.unref(u)(Q)?t.unref(o).t("em.attr.derivedIdNote"):void 0,placeholder:t.unref(h)(Q),"model-value":t.unref(m)(Q),"onUpdate:modelValue":ke=>t.unref(f)(Q,ke)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-type-${Q.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Q.attrType.startsWith("EMBED")||!!Q.groupCode||Q.attrType==="RELATION_REF"||t.unref(p)(Q),items:t.unref(rc)(Q.type,t.unref(v)),"value-provider":t.unref(w),"label-provider":t.unref(A),"model-value":Q.type,"onUpdate:modelValue":ke=>t.unref($)(Q,ke)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(y)(Q)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ke=>t.unref(o).removeAttribute(t.unref(i).modelId,Q.modelId)},null,8,["onClick"])],8,c2)]),Q.type===t.unref(an)&&!t.unref(p)(Q)?(t.openBlock(),t.createElementBlock("div",d2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-customtype-${Q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Q.customType??"","onUpdate:modelValue":ke=>t.unref(L)(Q,ke)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),Q.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",u2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(_e)(Q)?(t.openBlock(),t.createElementBlock("div",N2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.dbAttrs,(ke,lt)=>{var En,Nn,D,R,P,te,Ee,ie;return t.openBlock(),t.createElementBlock("div",{key:ke.modelId,class:"em-embed-col"},[t.createElementVNode("span",w2,t.toDisplayString(((En=t.unref(le)(Q,lt))==null?void 0:En.name)??((Nn=t.unref(le)(Q,lt))==null?void 0:Nn.physicalName)??t.unref(o).t("em.attr.colFallback",{n:lt+1})),1),t.createElementVNode("div",I2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`embed-col-${ke.modelId}`,width:"100%",disabled:t.unref(Ve)(ke),placeholder:((D=t.unref(le)(Q,lt))==null?void 0:D.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Ve)(ke)?t.unref(Le)(ke):ke.physicalName,"onUpdate:modelValue":re=>t.unref(Re)(Q,lt,{physicalName:re})},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-${ke.modelId}`,width:"84px",disabled:"","model-value":t.unref(ae)(Q,lt)},null,8,["name","model-value"])],8,v2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-len-${ke.modelId}`,width:"48px",disabled:"","model-value":t.unref(se)(Q,lt)},null,8,["name","model-value"])],8,C2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-scale-${ke.modelId}`,width:"48px",disabled:"","model-value":t.unref(ue)(Q,lt)},null,8,["name","model-value"])],8,x2)]),t.createVNode(ao,{controller:t.unref(o),"ref-id":ke.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",S2,[t.createVNode(mn,{class:"grow",name:`embed-logical-${ke.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((P=(R=t.unref(le)(Q,lt))==null?void 0:R.logicalName)==null?void 0:P[t.unref(o).userLanguage.value])??((Ee=(te=t.unref(le)(Q,lt))==null?void 0:te.logicalName)==null?void 0:Ee.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ke.logicalName,"onUpdate:modelValue":re=>t.unref(ce)(Q,lt,re)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(ie=t.unref(le)(Q,lt))!=null&&ie.shareable?(t.openBlock(),t.createElementBlock("label",R2,[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(xe)(ke),items:t.unref(q)(),"value-provider":t.unref(c),"label-provider":t.unref(Y),"onUpdate:modelValue":re=>re&&t.unref(Be)(Q,lt,re)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(Ve)(ke)?(t.openBlock(),t.createElementBlock("p",A2,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",$2,[Ge[3]||(Ge[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(Ve)(ke),"model-value":t.unref(Ve)(ke)?"false":t.unref(Se)(ke),items:t.unref(Ne),"value-provider":t.unref(c),"label-provider":t.unref(me),"onUpdate:modelValue":re=>re&&t.unref(ve)(Q,lt,re)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",T2,[Ge[4]||(Ge[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(Ve)(ke),"model-value":t.unref(Ve)(ke)?"false":t.unref(H)(ke),items:t.unref(U),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":re=>re&&t.unref(Z)(Q,lt,re)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.unref(p)(Q)?(t.openBlock(),t.createElementBlock("p",m2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",f2,[t.createVNode(mn,{class:"grow",name:`attr-logical-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(kt=Q.dbAttrs[0])==null?void 0:kt.logicalName,"onUpdate:modelValue":ke=>t.unref(M)(Q,ke)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",p2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-col-${Q.modelId}`,width:"100%",placeholder:t.unref(b)(Q)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(N)(Q),"model-value":((_n=Q.dbAttrs[0])==null?void 0:_n.physicalName)??"","onUpdate:modelValue":ke=>t.unref(T)(Q,{physicalName:ke})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-dtype-${Q.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(N)(Q)||t.unref(p)(Q),items:t.unref(oc)(((kn=Q.dbAttrs[0])==null?void 0:kn.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Ar),"model-value":((St=Q.dbAttrs[0])==null?void 0:St.dataType)??"","onUpdate:modelValue":ke=>ke&&t.unref(T)(Q,{dataType:ke})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-len-${Q.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(N)(Q)||t.unref(p)(Q),"model-value":(ge=Q.dbAttrs[0])==null?void 0:ge.length,"onUpdate:modelValue":ke=>t.unref(T)(Q,{length:ke||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(C)(Q)},[t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-scale-${Q.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(N)(Q)||t.unref(p)(Q)||!t.unref(S)(Q),"model-value":(at=Q.dbAttrs[0])==null?void 0:at.scale,"onUpdate:modelValue":ke=>t.unref(T)(Q,{scale:ke||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,h2)]),t.createVNode(ao,{controller:t.unref(o),"ref-id":(en=Q.dbAttrs[0])==null?void 0:en.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",y2,[t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-pk-${Q.modelId}`,label:"Primary Key","model-value":Q.identifier,disabled:t.unref(a)||t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(_)(Q,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nn-${Q.modelId}`,label:"Not Null","model-value":Q.notNull,disabled:t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(d)(Q,{notNull:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-uq-${Q.modelId}`,label:"Unique","model-value":!!((zt=Q.dbAttrs[0])!=null&&zt.unique),disabled:t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(T)(Q,{unique:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-ai-${Q.modelId}`,label:"Auto Increment","model-value":!!((tn=Q.dbAttrs[0])!=null&&tn.autoIncrement),disabled:t.unref(N)(Q)||t.unref(p)(Q)||!Q.identifier,"onUpdate:modelValue":ke=>t.unref(T)(Q,{autoIncrement:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-tr-${Q.modelId}`,label:"@Transient","model-value":!!Q.transient,disabled:Q.identifier||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(E)(Q,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nid-${Q.modelId}`,label:"@NaturalId","model-value":!!Q.naturalId,disabled:Q.identifier||t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(k)(Q,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Q.modelId}`,label:"mutable","model-value":!!Q.naturalIdMutable,disabled:t.unref(N)(Q)||!Q.naturalId,"onUpdate:modelValue":ke=>t.unref(d)(Q,{naturalIdMutable:ke||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-mv-${Q.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ft=Q.dbAttrs[0])!=null&&Ft.multiValue),disabled:t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(T)(Q,{multiValue:ke||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",g2,[Ge[1]||(Ge[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(N)(Q),"model-value":t.unref(Se)(Q.dbAttrs[0]),items:t.unref(Ne),"value-provider":t.unref(c),"label-provider":t.unref(me),"onUpdate:modelValue":ke=>ke&&t.unref(G)(Q,ke)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",b2,[Ge[2]||(Ge[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(N)(Q),"model-value":t.unref(H)(Q.dbAttrs[0]),items:t.unref(U),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":ke=>ke&&t.unref(X)(Q,ke)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(p)(Q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",_2,[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(g)(Q),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":ke=>ke&&t.unref(I)(Q,ke)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(z).length&&!t.unref(p)(Q)?(t.openBlock(),t.createElementBlock("label",k2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Rf,{"model-value":Q.groupCode,items:t.unref(z),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ke=>t.unref(he)(Q,ke)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(p)(Q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(z).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(j)(Q).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"100%","model-value":Q.defaultValue??"none",items:t.unref(ne)(Q),"value-provider":t.unref(de),"label-provider":t.unref(pe),"onUpdate:modelValue":ke=>ke&&t.unref(fe)(Q,ke)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`attr-default-${Q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Q.defaultValue??"","onUpdate:modelValue":ke=>t.unref(ye)(Q,ke)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",E2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`attr-desc-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Q.description,"onUpdate:modelValue":ke=>t.unref(B)(Q,ke)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",M2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ze(Q)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:ke=>J(Q,null)},"∅",10,V2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),ke=>(t.openBlock(),t.createElementBlock("button",{key:ke,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ze(Q)===ke}]),style:t.normalizeStyle({background:t.unref(Oo)(ke)}),title:t.unref(o).t(t.unref(io)(ke)),onClick:lt=>J(Q,ke)},null,14,B2))),128)),Ie(Q)?(t.openBlock(),t.createElementBlock("span",D2,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,l2)}),128))],8,ZM)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-6cf88fea"]]),L2=["disabled"],P2={class:"em-panel__sub-label"},z2={class:"em-attr__row"},F2={class:"em-field em-idx-params"},U2=["value","placeholder","onChange"],H2=We(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(w=>w.modelId===o.entityId)??null),l=t.computed(()=>r.value?Go(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var w;return On(((w=r.value)==null?void 0:w.attributes)??[])}),c=w=>s.value.canon(w),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 w;return[...(((w=r.value)==null?void 0:w.attributes)??[]).filter(A=>A.dbAttrs.length>0).map(A=>({value:A.modelId,label:Tf(A,d.value)})),...l.value.map(A=>({value:A.modelId,label:a.t("em.index.inherited",{field:A.field})}))]});function m(w,A){var S;const $=new Set(w.columns.filter((C,M)=>M!==A).map(C=>c(C.columnRef))),L=u.value.filter(C=>!$.has(c(C.value))),T=(S=w.columns[A])==null?void 0:S.columnRef;return T&&!L.some(C=>C.value===T)&&L.push({value:T,label:h(T)}),L}function h(w){return Mf(w,d.value)}function f(w){const A=new Set(w.columns.map($=>c($.columnRef)));return u.value.filter($=>!A.has(c($.value)))}function y(){var A;if(!r.value)return;const w=u.value[0];a.addIndex(r.value.modelId,{modelId:De(),name:`idx_${(((A=r.value.indexes)==null?void 0:A.length)??0)+1}`,unique:!1,columns:w?[{columnRef:w.value,descending:!1}]:[]})}function k(w,A){r.value&&a.updateIndex(r.value.modelId,w,A)}function _(w){const A=f(w)[0];A&&k(w.modelId,{columns:[...w.columns,{columnRef:A.value,descending:!1}]})}function E(w,A,$){k(w.modelId,{columns:w.columns.map((L,T)=>T===A?{...L,columnRef:$}:L)})}function N(w,A,$){k(w.modelId,{columns:w.columns.map((L,T)=>T===A?{...L,descending:$}:L)})}function p(w,A){k(w.modelId,{columns:w.columns.filter(($,L)=>L!==A)})}function b(w,A){k(w.modelId,{parameters:A.trim()===""?void 0:A})}return(w,A)=>{var $;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",P2,[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:(($=r.value.indexes)==null?void 0:$.length)??0})),1)]),t.createVNode(t.unref(ee.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??[],L=>(t.openBlock(),t.createElementBlock("div",{key:L.modelId,class:"em-attr"},[t.createElementVNode("div",z2,[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":T=>k(L.modelId,{name:T})},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":T=>k(L.modelId,{unique:T})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:T=>t.unref(a).removeIndex(r.value.modelId,L.modelId)},null,8,["onClick"])]),t.createVNode(ao,{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,(T,S)=>(t.openBlock(),t.createElementBlock("div",{key:S,class:"em-attr__row"},[t.createVNode(t.unref(ee.BSSelect),{class:"grow","model-value":T.columnRef,items:m(L,S),"value-provider":C=>C.value,"label-provider":C=>C.label,"onUpdate:modelValue":C=>C&&E(L,S,C)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-${L.modelId}-desc-${S}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":C=>N(L,S,C)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:"−",onClick:C=>p(L,S)},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:T=>_(L)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",F2,[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:T=>b(L,T.target.value)},null,40,U2)])]))),128)):t.createCommentVNode("",!0)],8,L2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),j2=["disabled"],K2={class:"em-panel__sub-label"},G2={class:"em-attr__row"},Y2={class:"em-attr__row"},q2={class:"em-multilang"},W2={class:"em-attr__pii"},J2={class:"em-swatch__row em-attr__swatch"},X2=["title","onClick"],Z2=["title","onClick"],Q2=We(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(p=>p.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(p=>p.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(p){return p==="none"?a.t("em.common.noneParen"):p}const m=p=>p;function h(p,b){l.value&&a.updateOperation(l.value.modelId,p.modelId,b)}function f(p,b){h(p,{description:Object.keys(b).length?b:void 0})}function y(p){return p.personalInfoAttributeType??"none"}function k(p,b){h(p,{personalInfoAttributeType:b==="none"?void 0:b})}function _(p){var b,w;return bt((w=(b=s.value)==null?void 0:b.operationStyles)==null?void 0:w[p.modelId])}function E(p,b){l.value&&a.setOperationSwatch(l.value.modelId,p.modelId,b)}function N(p){r.openModal({component:Vf,bind:{operationName:p.name,sourceCode:p.sourceCode??"",locale:a.uiLocale.value,onSave:b=>h(p,{sourceCode:b})}})}return(p,b)=>{var w;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:b[1]||(b[1]=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.op.section",{n:((w=l.value.operations)==null?void 0:w.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:b[0]||(b[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",G2,[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":$=>h(A,{name:$})},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":$=>$&&h(A,{visibility:$})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>t.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),t.createElementVNode("div",Y2,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:$=>N(A)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",q2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(mn,{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":$=>f(A,$)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",W2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":y(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":$=>$&&k(A,$)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",J2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(A)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:$=>E(A,null)},"∅",10,X2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":_(A)===$}]),style:t.normalizeStyle({background:t.unref(Oo)($)}),title:t.unref(a).t(t.unref(io)($)),onClick:L=>E(A,$)},null,14,Z2))),128))])]))),128)):t.createCommentVNode("",!0)],8,j2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),eV=["title"],tV={class:"em-panel__head"},nV={class:"em-panel__head-row"},oV=["title"],iV={class:"em-panel__context"},aV={key:0,class:"em-panel__lock"},rV=["disabled"],lV={key:0,class:"em-panel__note"},sV={key:1,class:"em-panel__note"},cV={key:2,class:"em-jpa"},dV={class:"em-field"},uV={class:"em-field"},mV={class:"em-field"},fV={key:0,class:"em-field"},pV={class:"em-panel__note"},hV={class:"em-panel__sub"},yV={class:"em-field"},gV={class:"em-field"},bV={class:"em-jpa"},_V={key:0,class:"em-panel__note"},kV={key:1,class:"em-panel__note"},EV={class:"em-jpa"},NV={class:"em-field"},wV={key:0,class:"em-panel__note"},IV={class:"em-field"},vV={class:"em-multilang"},CV={class:"em-field"},xV=["value"],SV={class:"em-field"},RV={class:"em-swatch"},AV={class:"em-swatch__row"},$V=["title"],TV=["title","onClick"],MV={class:"em-panel__note"},VV={class:"em-field"},BV=["value"],DV={class:"em-swatch"},OV={class:"em-swatch__row"},LV=["title"],PV=["title","onClick"],wh=We(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 G;return(G=r.value)==null?void 0:G.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const G=c.value;return G?l.state.logical.entities.find(q=>q.modelId===G)??null:null}),u=t.computed(()=>{const G=s.value;if((G==null?void 0:G.kind)==="association")return l.isAssociationLocked(G.id);const q=c.value;return!!q&&l.isEntityLocked(q)}),m=t.computed(()=>{var G;return((G=l.selectedAttr.value)==null?void 0:G.attrId)??null}),h=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),y=t.ref({});t.watch(f,()=>{y.value={}});function k(G){return y.value[G]??f.value}function _(G){y.value={...y.value,[G]:!k(G)}}const E=t.computed(()=>{var Y;const G=d.value;if(!G)return l.t("em.entity.fallback");const q=(Y=G.table)==null?void 0:Y.physicalName;return q?`${G.name} (${q})`:G.name}),N=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="association"?l.state.logical.associations.find(q=>q.modelId===G.id)??null:null}),p=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="group"?l.state.logical.groups.find(q=>q.modelId===G.id)??null:null}),b=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="note"?l.state.layout.notes.find(q=>q.modelId===G.id)??null:null}),w=t.computed(()=>{var q,Y;const G=(q=p.value)==null?void 0:q.name;return(G==null?void 0:G[l.userLanguage.value])||(G==null?void 0:G.ko)||(G==null?void 0:G.en)||(G==null?void 0:G.ja)||(G==null?void 0:G.zh)||((Y=p.value)==null?void 0:Y.packageName)||l.t("em.group.fallback")}),A=t.computed(()=>{if(d.value){const G=h.value.size;if(G>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:G});if(m.value){const q=d.value.attributes.find(Y=>Y.modelId===m.value);return(q==null?void 0:q.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(q==null?void 0:q.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(N.value){const G=q=>{var Y;return((Y=l.state.logical.entities.find(xe=>xe.modelId===q))==null?void 0:Y.name)??q};return l.t("em.inspector.ctxAssoc",{a:G(N.value.end1.entityRef),b:G(N.value.end2.entityRef)})}return p.value?l.t("em.inspector.ctxGroup",{name:w.value}):b.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),$=["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"],T={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},S=G=>{const q=T[G];return q?l.t(q):G},C=G=>{var q;return((q=l.state.logical.entities.find(Y=>Y.modelId===G))==null?void 0:q.name)??G},M=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],B=["LIST","SET"],g=["inherit","LAZY","EAGER"],I=G=>G;function v(G){return G==="inherit"?l.t("em.common.inherit"):G}const O=t.computed(()=>!!N.value&&N.value.end1.entityRef===N.value.end2.entityRef);function x(G,q){N.value&&l.updateAssociationEnd(N.value.modelId,G,q)}function z(G){return ae.value?G:G==="end1"?"end2":"end1"}function j(G){var Be;const q=(Be=N.value)==null?void 0:Be[G];if(!(q!=null&&q.attributeRef))return;const Y=l.state.logical.entities.find(Ve=>Ve.modelId===q.entityRef),xe=Y==null?void 0:Y.attributes.find(Ve=>Ve.modelId===q.attributeRef);return xe&&(xe.attrType==="RELATION_OWN"||xe.attrType==="RELATION_REF")?xe.name:void 0}function ne(G,q){var xe;const Y=(xe=N.value)==null?void 0:xe[G];Y!=null&&Y.attributeRef&&l.updateAttribute(Y.entityRef,Y.attributeRef,{name:q})}function de(G){var Ve;const q=j(G);if(q!==void 0)return q;const Y=(Ve=N.value)==null?void 0:Ve[G];if(Y!=null&&Y.navFieldNameHint)return Y.navFieldNameHint;const xe=G==="end1"?"end2":"end1",Be=l.state.logical.entities.find(Le=>{var oe;return Le.modelId===((oe=N.value)==null?void 0:oe[xe].entityRef)});return Be?Yi(Be.name,Ki(N.value[xe].multiplicity)):""}function pe(G){return!!ae.value||j(G)!==void 0}function he(G){N.value&&!O.value&&l.setAssociationIdentifying(N.value.modelId,G)}function fe(G){var q,Y,xe;return!!((xe=(Y=(q=N.value)==null?void 0:q[G].jpa)==null?void 0:Y.cascadeTypes)!=null&&xe.includes("ALL"))}function ye(G,q,Y){var Ve,Le;const xe=(Ve=N.value)==null?void 0:Ve[G];if(q==="ALL"&&Y){x(G,{jpa:{...xe==null?void 0:xe.jpa,cascadeTypes:["ALL"]}});return}const Be=new Set(((Le=xe==null?void 0:xe.jpa)==null?void 0:Le.cascadeTypes)??[]);Y?Be.add(q):Be.delete(q),x(G,{jpa:{...xe==null?void 0:xe.jpa,cascadeTypes:[...Be]}})}function _e(G,q){var xe;const Y=(xe=N.value)==null?void 0:xe[G];x(G,{jpa:{...Y==null?void 0:Y.jpa,...q}})}function Re(G){var q,Y;return((Y=(q=N.value)==null?void 0:q[G].jpa)==null?void 0:Y.fetchType)??"inherit"}function ce(G,q){_e(G,{fetchType:q==="inherit"?void 0:q})}function le(G){var Y;const q=(Y=N.value)==null?void 0:Y[G==="end1"?"end2":"end1"];return(q==null?void 0:q.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(q==null?void 0:q.multiplicity)==="ONE_OR_MORE_INSTANCES"}const ae=t.computed(()=>{const G=N.value;if(!G)return null;for(const q of l.state.logical.entities){const Y=q.attributes.find(Le=>{var oe;return((oe=Le.embedded)==null?void 0:oe.associationRef)===G.modelId&&Le.attrType==="EMBED_OWN"});if(!Y)continue;const xe=G.end2.entityRef===Y.embedded.embeddableRef?"end2":"end1",Be=G[xe].multiplicity,Ve=G[xe].jpa;return{which:xe,cardinality:Be,isCollection:Be==="ZERO_OR_MORE_INSTANCES"||Be==="ONE_OR_MORE_INSTANCES",collectionType:(Ve==null?void 0:Ve.collectionType)??"LIST",collectionTable:(Ve==null?void 0:Ve.collectionTable)??"",orderColumn:(Ve==null?void 0:Ve.orderColumn)??""}}return null});function se(G){N.value&&l.setEmbedCardinality(N.value.modelId,G)}function ue(G){const q=ae.value;q&&_e(q.which,G==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function U(G){const q=ae.value;q&&_e(q.which,{collectionTable:G.trim()||void 0})}function F(G){const q=ae.value;q&&_e(q.which,{orderColumn:G.trim()||void 0})}function H(G){p.value&&l.updateGroup(p.value.modelId,G)}function Z(G,q){var Y;H({name:{...(Y=p.value)==null?void 0:Y.name,[G]:q}})}const X=t.computed(()=>{var G;return p.value?bt((G=l.state.layout.groupLayouts.find(q=>q.groupRef===p.value.modelId))==null?void 0:G.style):null});function Ne(G){p.value&&l.setGroupSwatch(p.value.modelId,G)}function me(G){b.value&&l.setNoteMemo(b.value.modelId,G)}const Se=t.computed(()=>{var G;return bt((G=b.value)==null?void 0:G.style)});function ve(G){b.value&&l.setNoteSwatch(b.value.modelId,G)}return(G,q)=>(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:q[0]||(q[0]=(...Y)=>e.startResize&&e.startResize(...Y))},null,42,eV),t.createElementVNode("header",tV,[t.createElementVNode("div",nV,[q[14]||(q[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:q[1]||(q[1]=Y=>a("collapse"))},[t.createVNode($e,{name:"panel-right-close",size:16})],8,oV)]),t.createElementVNode("p",iV,t.toDisplayString(A.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",aV,[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:q[2]||(q[2]=Y=>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(Nf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:k("basics"),title:E.value,onToggle:q[3]||(q[3]=Y=>_("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(O2,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(H2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:k("index"),onToggle:q[4]||(q[4]=Y=>_("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(Q2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:k("ops"),onToggle:q[5]||(q[5]=Y=>_("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),N.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":!!N.value.identifying,disabled:O.value||!!ae.value,"onUpdate:modelValue":he},null,8,["label","model-value","disabled"]),O.value?(t.openBlock(),t.createElementBlock("p",lV,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):ae.value?(t.openBlock(),t.createElementBlock("p",sV,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),ae.value?(t.openBlock(),t.createElementBlock("fieldset",cV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",dV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":ae.value.cardinality,items:L,"value-provider":I,"label-provider":S,"onUpdate:modelValue":q[6]||(q[6]=Y=>Y&&se(Y))},null,8,["model-value"])]),ae.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",uV,[q[15]||(q[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(ee.BSSelect),{"model-value":ae.value.collectionType,items:B,"value-provider":I,"label-provider":I,"onUpdate:modelValue":q[7]||(q[7]=Y=>Y&&ue(Y))},null,8,["model-value"])]),t.createElementVNode("label",mV,[q[16]||(q[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":ae.value.collectionTable,"onUpdate:modelValue":U},null,8,["placeholder","model-value"])]),ae.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",fV,[q[17]||(q[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":ae.value.orderColumn,"onUpdate:modelValue":F},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",pV,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],Y=>{var xe,Be,Ve;return t.withDirectives(t.createElementVNode("div",{key:Y,class:"em-end"},[t.createElementVNode("h4",hV,t.toDisplayString(Y)+" → "+t.toDisplayString(C(N.value[Y].entityRef)),1),ae.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",yV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":N.value[Y].multiplicity,items:$,"value-provider":I,"label-provider":t.unref(Gi),"onUpdate:modelValue":Le=>x(Y,{multiplicity:Le})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(Y)}-navigable`,class:"em-check",label:"navigable",title:z(Y)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:z(Y)==="end2","model-value":z(Y)==="end2"?!0:N.value[z(Y)].navigable,"onUpdate:modelValue":Le=>x(z(Y),{navigable:Le})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",gV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(ee.BSTextInput),{name:`${z(Y)}-navname`,width:"100%",disabled:!pe(z(Y)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":de(z(Y)),"onUpdate:modelValue":Le=>ne(z(Y),Le)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(Y)}-composition`,class:"em-check",label:"composition","model-value":N.value[z(Y)].composition,"onUpdate:modelValue":Le=>x(z(Y),{composition:Le})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",bV,[q[18]||(q[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(M,Le=>{var oe,we;return t.createVNode(t.unref(ee.BSCheckbox),{key:Le,name:`${z(Y)}-cascade-${Le}`,class:"em-check",label:Le,"model-value":!!((we=(oe=N.value[z(Y)].jpa)==null?void 0:oe.cascadeTypes)!=null&&we.includes(Le)),disabled:!pe(z(Y))||Le!=="ALL"&&fe(z(Y)),"onUpdate:modelValue":Fe=>ye(z(Y),Le,Fe)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),pe(z(Y))?fe(z(Y))?(t.openBlock(),t.createElementBlock("p",kV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",_V,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",EV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",NV,[q[19]||(q[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(ee.BSSelect),{disabled:!pe(z(Y)),"model-value":Re(z(Y)),items:g,"value-provider":I,"label-provider":v,"onUpdate:modelValue":Le=>Le&&ce(z(Y),Le)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(Y)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((xe=N.value[z(Y)].jpa)!=null&&xe.orphanRemoval),disabled:!pe(z(Y))||le(Y),"onUpdate:modelValue":Le=>_e(z(Y),{orphanRemoval:Le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),le(Y)&&((Be=N.value[z(Y)].jpa)!=null&&Be.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",wV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",IV,[q[20]||(q[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:`${z(Y)}-orderby`,width:"100%",disabled:!pe(z(Y)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((Ve=N.value[z(Y)].jpa)==null?void 0:Ve.orderBy)??"","onUpdate:modelValue":Le=>_e(z(Y),{orderBy:Le.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!ae.value||Y===ae.value.which]])}),64))],64)):t.createCommentVNode("",!0),p.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",vV,[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,Y=>{var xe;return t.openBlock(),t.createElementBlock("label",{key:Y,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(Y),1),t.createVNode(t.unref(ee.BSTextInput),{name:`grp-name-${Y}`,width:"100%","model-value":((xe=p.value.name)==null?void 0:xe[Y])??"","onUpdate:modelValue":Be=>Z(Y,Be)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",CV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:p.value.description??"",rows:"3",onChange:q[8]||(q[8]=Y=>H({description:Y.target.value}))},null,40,xV)]),t.createElementVNode("label",SV,[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":p.value.packageName??"","onUpdate:modelValue":q[9]||(q[9]=Y=>H({packageName:Y}))},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":p.value.excludeDDLGeneration,"onUpdate:modelValue":q[10]||(q[10]=Y=>H({excludeDDLGeneration:Y}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",RV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",AV,[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:q[11]||(q[11]=Y=>Ne(null))},"∅",10,$V),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),Y=>(t.openBlock(),t.createElementBlock("button",{key:Y,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":X.value===Y}]),style:t.normalizeStyle({background:t.unref(Oo)(Y)}),title:t.unref(l).t(t.unref(io)(Y)),onClick:xe=>Ne(Y)},null,14,TV))),128))])]),t.createElementVNode("p",MV,t.toDisplayString(t.unref(l).t("em.group.members",{n:p.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),b.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:b.value.memo,rows:"6",onChange:q[12]||(q[12]=Y=>me(Y.target.value))},null,40,BV)]),t.createElementVNode("fieldset",DV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",OV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Se.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:q[13]||(q[13]=Y=>ve(null))},"∅",10,LV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),Y=>(t.openBlock(),t.createElementBlock("button",{key:Y,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Se.value===Y}]),style:t.normalizeStyle({background:t.unref(Oo)(Y)}),title:t.unref(l).t(t.unref(io)(Y)),onClick:xe=>ve(Y)},null,14,PV))),128))])])],64)):t.createCommentVNode("",!0)],8,rV)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),zV=["title"],FV={class:"em-validation__title"},UV=["title","onClick"],HV={key:0,class:"em-validation__body"},jV={class:"em-validation__opt"},KV={key:0,class:"em-validation__empty"},GV={key:1,class:"em-validation__empty"},YV={key:2,class:"em-validation__list"},qV=["onClick"],WV={class:"em-validation__item-msg"},JV={key:0,class:"em-validation__item-entity"},XV=["title","onClick"],ZV=["title"],QV=We(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 k=new Map;for(const _ of o.state.logical.entities)k.set(_.modelId,_.name);return k});function r(k){const _=Bw(k);if(!_)return null;const E=a.value.get(_);return E===void 0?null:E.trim()===""?o.t("em.validation.nameless"):E}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 k={error:0,warning:0,info:0};for(const _ of i.value)k[_.severity]++;return k}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(k=>c.value[k.severity]).slice().sort((k,_)=>l[k.severity].order-l[_.severity].order)),u=t.computed(()=>d.value.map(k=>({issue:k,entityName:r(k),message:Ef(o.t,k),category:Mw(o.t,k.ruleId)}))),m=t.ref(!1);function h(k){c.value[k]=!c.value[k]}function f(k){if(!m.value){m.value=!0;return}h(k)}function y(k){k.targetRef&&o.requestFocus(k.targetRef)}return(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:_[1]||(_[1]=E=>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",FV,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,zV),t.createElementVNode("div",{class:"em-validation__counts",onClick:_[0]||(_[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],E=>t.createElementVNode("button",{key:E,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${E}`,{"is-off":!c.value[E]}]]),title:m.value?t.unref(o).t(c.value[E]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[E].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:N=>f(E)},[t.createVNode($e,{name:l[E].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[E]),1)],10,UV)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",HV,[t.createElementVNode("label",jV,[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":_[2]||(_[2]=E=>t.unref(o).flagEntitiesWithoutRelations.value=E)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",KV,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",GV,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",YV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:E,entityName:N,message:p,category:b},w)=>(t.openBlock(),t.createElementBlock("li",{key:`${E.ruleId}:${E.targetRef??"model"}:${w}`,class:t.normalizeClass(["em-validation__item",[`is-${E.severity}`,{"is-clickable":!!E.targetRef}]]),onClick:A=>y(E)},[t.createVNode($e,{name:l[E.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",WV,[N?(t.openBlock(),t.createElementBlock("span",JV,t.toDisplayString(N),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(p),1)]),t.unref(o).hasQuickFix(E)?(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(E),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,XV)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:E.ruleId},t.toDisplayString(b),9,ZV)],10,qV))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),eB={class:"em-history"},tB={class:"em-history__head"},nB={class:"em-history__title"},oB={class:"em-history__head-actions"},iB=["title","disabled"],aB=["title"],rB={class:"em-history__filters"},lB={class:"em-history__filter"},sB={class:"em-history__filters em-history__filters--period"},cB={class:"em-history__filter-label"},dB=["title","aria-label","max"],uB=["title","aria-label","min"],mB=["title"],fB={key:0,class:"em-history__diffbar"},pB={class:"em-history__diffbar-range"},hB={class:"em-history__diffbar-count"},yB={class:"em-history__body"},gB={key:0,class:"em-history__empty"},bB={key:1,class:"em-history__diff-list"},_B=["onClick"],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={key:1,class:"em-history__empty"},xB={key:2,class:"em-history__empty is-error"},SB={key:3,class:"em-history__empty"},RB={key:4,class:"em-history__list"},AB=["onClick"],$B={class:"em-history__summary"},TB={class:"em-history__seq"},MB={class:"em-history__gmeta"},VB={class:"em-history__who"},BB={key:0,class:"em-history__time"},DB={key:1,class:"em-history__restored-from"},OB=["onClick"],LB={key:0,class:"em-history__detail"},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__preview"},GB=["disabled"],YB={key:0,class:"em-history__diff-list is-preview"},qB={class:"em-history__action-head"},WB={class:"em-history__action-name"},JB={key:0,class:"em-history__fields"},XB={class:"em-history__fname"},ZB={key:0,class:"em-history__old"},QB={class:"em-history__val"},eD={class:"em-history__confirm-row"},tD={class:"em-history__confirm-msg"},nD=["disabled","onClick"],oD=["disabled"],iD=["onClick"],Er=50,aD=We(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((oe,we)=>we.seq>oe?we.seq:oe,-1/0));async function u(oe){if(a.historyTransport){l.value=!0,s.value=null;try{const we=!(oe!=null&&oe.full)&&r.value.length>0&&Number.isFinite(d.value),Fe=await a.historyTransport(we?d.value:void 0);if(!we)r.value=Fe;else if(Fe.length){const K=new Set(r.value.map(W=>W.seq)),V=Fe.filter(W=>!K.has(W.seq));V.length&&(r.value=[...r.value,...V])}c.value=!0}catch(we){s.value=we instanceof Error?we.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const h=t.ref(null),f=t.ref(null);t.watch(()=>o.open,oe=>{oe?m():(h.value=null,f.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 k=t.computed(()=>new Map(a.state.logical.entities.map(oe=>[oe.modelId,oe]))),_=t.computed(()=>new Map(a.state.logical.associations.map(oe=>[oe.modelId,oe]))),E=t.computed(()=>{const oe=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(we=>{var Fe,K;return[we.modelId,we.packageName||((Fe=we.name)==null?void 0:Fe[oe])||((K=we.name)==null?void 0:K.ko)||we.modelId]}))});function N(oe){var V,W,Ce,ze,Ie,J,He;const we=_.value.get(oe);if(!we)return a.t("em.history.assocFallback");if((V=we.description)!=null&&V.trim())return we.description.trim();const Fe=(ze=(Ce=k.value.get((W=we.end1)==null?void 0:W.entityRef))==null?void 0:Ce.name)==null?void 0:ze.trim(),K=(He=(J=k.value.get((Ie=we.end2)==null?void 0:Ie.entityRef))==null?void 0:J.name)==null?void 0:He.trim();return Fe&&K?`${Fe}→${K}`:a.t("em.history.assocFallback")}function p(oe){var we,Fe,K,V;if(oe.kind==="entity")return((Fe=(we=k.value.get(oe.ref))==null?void 0:we.name)==null?void 0:Fe.trim())||a.t("em.attr.nameless");if(oe.kind==="attribute"||oe.kind==="operation"||oe.kind==="index"){const W=oe.entityRef?k.value.get(oe.entityRef):void 0,ze=((oe.kind==="attribute"?W==null?void 0:W.attributes:oe.kind==="operation"?W==null?void 0:W.operations:W==null?void 0:W.indexes)??[]).find(J=>J.modelId===oe.ref),Ie=(K=W==null?void 0:W.name)==null?void 0:K.trim();return`${Ie?Ie+".":""}${((V=ze==null?void 0:ze.name)==null?void 0:V.trim())||oe.ref}`}return oe.kind==="association"?N(oe.ref):oe.kind==="associationEnd"?`${N(oe.ref)}(${oe.end})`:oe.kind==="group"?a.t("em.history.groupSubject",{name:E.value.get(oe.ref)??oe.ref}):oe.ref}const b={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},w={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},A=t.ref("all"),$=[{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:oe=>{oe&&(A.value=oe)}}),T=t.computed(()=>il(r.value)),S=t.computed(()=>T.value.length?T.value[0].seq:null),C=t.computed(()=>A.value==="all"?T.value:T.value.filter(oe=>(oe.kind??"edit")===A.value)),M=t.ref(Er),B=t.ref(""),g=t.ref(""),I=t.computed(()=>!!B.value||!!g.value);function v(){B.value="",g.value=""}const O=t.computed(()=>{const oe=B.value?new Date(`${B.value}T00:00:00`).getTime():null,we=g.value?new Date(`${g.value}T23:59:59.999`).getTime():null;return oe==null&&we==null?C.value:C.value.filter(Fe=>{if(Fe.ts==null)return!1;const K=new Date(Fe.ts).getTime();return!(isNaN(K)||oe!=null&&K<oe||we!=null&&K>we)})}),x=t.computed(()=>O.value.slice(0,M.value)),z=t.computed(()=>Math.max(0,O.value.length-M.value));function j(){M.value+=Er}t.watch([A,B,g],()=>{M.value=Er}),t.watch(()=>o.open,oe=>{oe&&(M.value=Er,v())});function ne(oe){return oe===void 0?"—":oe===null?a.t("em.history.emptyValue"):typeof oe=="object"?JSON.stringify(oe):String(oe)}function de(oe){const we=p(oe.subject);if(oe.verb==="add")return a.t("em.history.summaryAdd",{name:we});if(oe.verb==="remove")return a.t("em.history.summaryRemove",{name:we});if(oe.fields.length===1){const Fe=oe.fields[0];return`${we}.${Fe.field} ${Fe.oldValue!==void 0?ne(Fe.oldValue)+"→":""}${ne(Fe.value)}`}return a.t("em.history.summaryFields",{name:we,n:oe.fields.length})}function pe(oe){return oe.actions.length===0?a.t("em.history.noChange"):oe.actions.length===1?de(oe.actions[0]):a.t("em.history.summaryMore",{summary:de(oe.actions[0]),n:oe.actions.length-1})}const he=t.ref(new Set);function fe(oe){const we=new Set(he.value);we.has(oe)?we.delete(oe):we.add(oe),he.value=we}function ye(oe){if(oe==null)return"";const we=new Date(oe);return isNaN(we.getTime())?String(oe):we.toLocaleString()}function _e(oe){const we=oe.author,Fe=oe.origin;return we&&Fe?`${we}(${Fe})`:we||(Fe?`(${Fe})`:"—")}const Re=t.computed(()=>h.value==null?null:al(r.value,{fromSeq:h.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Re.value?Zc(Re.value):null,oe=>i("diffChange",oe));function ce(oe){h.value=oe,f.value=null,q.value=null}function le(){h.value=null,f.value=null}const ae=t.computed(()=>T.value.map(oe=>oe.seq)),se=t.computed(()=>S.value??1/0),ue=t.computed(()=>f.value??se.value),U=t.computed(()=>f.value??se.value),F=t.computed(()=>ae.value.filter(oe=>oe<ue.value).map(oe=>({v:oe}))),H=t.computed(()=>ae.value.filter(oe=>h.value!=null&&oe>h.value).map(oe=>({v:oe})));function Z(oe){oe!=null&&(h.value=oe,f.value!=null&&f.value<=oe&&(f.value=null))}function X(oe){oe!=null&&(f.value=oe>=se.value?null:oe)}function Ne(oe){return oe>=se.value?a.t("em.history.diff.current"):`#${oe}`}function me(oe){return oe.kind==="entity"?k.value.has(oe.ref)?oe.ref:null:(oe.kind==="attribute"||oe.kind==="operation"||oe.kind==="index")&&oe.entityRef?k.value.has(oe.entityRef)?oe.entityRef:null:oe.kind==="group"&&E.value.has(oe.ref)?oe.ref:null}function Se(oe){const we=me(oe);we&&a.requestFocus(we)}const ve={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},G={added:"add",modified:"update",removed:"remove"},q=t.ref(null),Y=t.ref(!1),xe=t.computed(()=>q.value==null?null:al(r.value,{fromSeq:q.value})),Be=t.ref(!1);function Ve(oe){q.value=oe,Be.value=!1}async function Le(oe){Y.value=!0;try{const we=await a.restoreToSeq(oe);we.ok?(h.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:we.reason??a.t("em.history.unknown")})}finally{Y.value=!1,q.value=null}}return(oe,we)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Fe,K;return[t.withDirectives(t.createElementVNode("section",eB,[t.createElementVNode("header",tB,[t.createElementVNode("div",nB,[t.createVNode($e,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",oB,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:we[0]||(we[0]=V=>u({full:!0}))},[t.createVNode($e,{name:"redo",size:15})],8,iB),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:we[1]||(we[1]=V=>i("close"))},[t.createVNode($e,{name:"panel-close",size:15})],8,aB)])]),t.createElementVNode("div",rB,[t.createElementVNode("label",lB,[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":we[2]||(we[2]=V=>L.value=V),items:$,"value-provider":V=>V.v,"label-provider":V=>t.unref(a).t(V.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",sB,[t.createElementVNode("span",cB,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:g.value||void 0,"onUpdate:modelValue":we[3]||(we[3]=V=>B.value=V)},null,8,dB),[[t.vModelText,B.value]]),we[9]||(we[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:B.value||void 0,"onUpdate:modelValue":we[4]||(we[4]=V=>g.value=V)},null,8,uB),[[t.vModelText,g.value]]),I.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($e,{name:"x",size:12})],8,mB)):t.createCommentVNode("",!0)]),h.value!=null?(t.openBlock(),t.createElementBlock("div",fB,[t.createElementVNode("div",pB,[t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":h.value??void 0,items:F.value,"value-provider":V=>V.v,"label-provider":V=>`#${V.v}`,"onUpdate:modelValue":we[5]||(we[5]=V=>Z(V??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(ee.BSSelect),{class:"em-history__range-sel","model-value":U.value,items:H.value,"value-provider":V=>V.v,"label-provider":V=>Ne(V.v),"onUpdate:modelValue":we[6]||(we[6]=V=>X(V??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",hB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Fe=Re.value)==null?void 0:Fe.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:le},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",yB,[h.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(K=Re.value)!=null&&K.entries.length?(t.openBlock(),t.createElementBlock("ul",bB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Re.value.entries,(V,W)=>(t.openBlock(),t.createElementBlock("li",{key:W,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!me(V.subject)}]),onClick:Ce=>Se(V.subject)},[t.createElementVNode("div",kB,[t.createVNode($e,{name:b[V.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",EB,t.toDisplayString(p(V.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${G[V.verb]}`])},t.toDisplayString(t.unref(a).t(ve[V.verb])),3)]),V.fields.length?(t.openBlock(),t.createElementBlock("ul",NB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.fields,(Ce,ze)=>(t.openBlock(),t.createElementBlock("li",{key:ze,class:"em-history__field"},[t.createElementVNode("span",wB,t.toDisplayString(Ce.field),1),Ce.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",IB,t.toDisplayString(ne(Ce.oldValue)),1)):t.createCommentVNode("",!0),Ce.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(ne(Ce.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,_B))),128))])):(t.openBlock(),t.createElementBlock("p",gB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",CB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",xB,t.toDisplayString(s.value),1)):O.value.length===0?(t.openBlock(),t.createElementBlock("p",SB,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",RB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,V=>{var W,Ce,ze;return t.openBlock(),t.createElementBlock("li",{key:V.seq,class:t.normalizeClass(["em-history__group",[`is-${V.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Ie=>fe(V.seq)},[t.createVNode($e,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":he.value.has(V.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${V.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(V.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",$B,t.toDisplayString(pe(V)),1),t.createElementVNode("span",TB,"#"+t.toDisplayString(V.seq),1)],8,AB),t.createElementVNode("div",MB,[t.createElementVNode("span",VB,t.toDisplayString(_e(V)),1),V.ts?(t.openBlock(),t.createElementBlock("span",BB,t.toDisplayString(ye(V.ts)),1)):t.createCommentVNode("",!0),V.kind==="restore"&&V.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",DB,"← #"+t.toDisplayString(V.restoredFromSeq),1)):t.createCommentVNode("",!0),V.seq!==S.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Ie=>ce(V.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,OB)):t.createCommentVNode("",!0)]),he.value.has(V.seq)?(t.openBlock(),t.createElementBlock("div",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.actions,(Ie,J)=>(t.openBlock(),t.createElementBlock("div",{key:J,class:"em-history__action"},[t.createElementVNode("div",PB,[t.createVNode($e,{name:b[Ie.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",zB,t.toDisplayString(p(Ie.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Ie.verb}`])},t.toDisplayString(t.unref(a).t(w[Ie.verb])),3)]),Ie.fields.length?(t.openBlock(),t.createElementBlock("ul",FB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.fields,(He,ot)=>(t.openBlock(),t.createElementBlock("li",{key:ot,class:"em-history__field"},[t.createElementVNode("span",UB,t.toDisplayString(He.field),1),He.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",HB,t.toDisplayString(ne(He.oldValue)),1)):t.createCommentVNode("",!0),He.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",jB,t.toDisplayString(ne(He.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&V.seq!==S.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":q.value===V.seq}])},[q.value===V.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",KB,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((W=xe.value)!=null&&W.entries.length),onClick:we[7]||(we[7]=Ie=>Be.value=!Be.value)},[t.createVNode($e,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Be.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Ce=xe.value)!=null&&Ce.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:xe.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,GB),Be.value&&((ze=xe.value)!=null&&ze.entries.length)?(t.openBlock(),t.createElementBlock("ul",YB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(xe.value.entries,(Ie,J)=>(t.openBlock(),t.createElementBlock("li",{key:J,class:"em-history__diff-entry"},[t.createElementVNode("div",qB,[t.createVNode($e,{name:b[Ie.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",WB,t.toDisplayString(p(Ie.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${G[Ie.verb]}`])},t.toDisplayString(t.unref(a).t(ve[Ie.verb])),3)]),Ie.fields.length?(t.openBlock(),t.createElementBlock("ul",JB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.fields,(He,ot)=>(t.openBlock(),t.createElementBlock("li",{key:ot,class:"em-history__field"},[t.createElementVNode("span",XB,t.toDisplayString(He.field),1),He.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",ZB,t.toDisplayString(ne(He.oldValue)),1)):t.createCommentVNode("",!0),He.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",QB,t.toDisplayString(ne(He.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",eD,[t.createElementVNode("span",tD,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:Y.value,onClick:Ie=>Le(V.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,nD),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:Y.value,onClick:we[8]||(we[8]=Ie=>q.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,oD)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Ie=>Ve(V.seq)},[t.createVNode($e,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,iD))],2)):t.createCommentVNode("",!0)],2)}),128))])),h.value==null&&z.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:z.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function rD(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 Ih(e){const n=t.ref(rD(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 lD={class:"em-modeler"},sD={class:"em-modeler__body"},cD={class:"em-drawer__inner"},dD={class:"em-drawer__head"},uD={class:"em-drawer__actions"},mD=["title"],fD=["title"],pD=["title"],hD=["title"],yD=["title"],gD=We(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(b){t.nextTick(()=>{const w=b();w&&("focusCollapse"in w?w.focusCollapse():w.focus())})}function c(b){n.value=b,s(()=>b?i.value:a.value)}function d(b){o.value=b,s(()=>b?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:h,dragging:f,startResize:y}=Ih({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:k,dragging:_,startResize:E}=Ih({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),N=t.ref(null),p=t.ref(null);return(b,w)=>{var A,$,L;return t.openBlock(),t.createElementBlock("div",lD,[t.createVNode(Nh,{controller:e.controller,"history-open":u.value,onExportSvg:w[0]||(w[0]=T=>{var S;return(S=N.value)==null?void 0:S.exportSvg()}),onExportPng:w[1]||(w[1]=T=>{var S;return(S=N.value)==null?void 0:S.exportPng()}),onToggleHistory:w[2]||(w[2]=T=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",sD,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(h)+"px"})},[t.createElementVNode("div",cD,[t.createElementVNode("header",dD,[w[11]||(w[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",uD,[(A=p.value)!=null&&A.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t(($=p.value)!=null&&$.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:w[3]||(w[3]=T=>{var S;return(S=p.value)==null?void 0:S.toggleAll()})},[t.createVNode($e,{name:(L=p.value)!=null&&L.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,mD)):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:w[4]||(w[4]=T=>c(!1))},[t.createVNode($e,{name:"panel-close",size:16})],8,fD)])]),t.createVNode(Eh,{ref_key:"explorer",ref:p,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:w[5]||(w[5]=(...T)=>t.unref(y)&&t.unref(y)(...T))},null,42,pD),[[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:w[6]||(w[6]=T=>c(!0))},[t.createVNode($e,{name:"panel-open",size:18})],8,hD),[[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(h)-6+"px"})},[t.createVNode(kh,{ref_key:"canvas",ref:N,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(wh,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(k),resizing:t.unref(_),"start-resize":t.unref(E),onCollapse:w[7]||(w[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:w[8]||(w[8]=T=>d(!0))},[t.createVNode($e,{name:"panel-right-open",size:18})],8,yD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(aD,{controller:e.controller,open:u.value,onClose:w[9]||(w[9]=T=>u.value=!1),onDiffChange:w[10]||(w[10]=T=>m.value=T)},null,8,["controller","open"])]),t.createVNode(QV,{controller:e.controller,"panel-width":t.unref(k),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=Ub,be.AssociationEdge=_p,be.CUSTOM_TYPE_VALUE=an,be.CommandStack=rl,be.DEFAULT_JAVA_TYPE=Tr,be.DIAGRAM_JSON_FORMAT=Or,be.DIAGRAM_JSON_VERSION=Lr,be.DiagramCanvas=kh,be.DiagramExplorer=Eh,be.EDITOR=ro,be.EditModeToggle=XM,be.EditorToolbar=Nh,be.EntityModeler=gD,be.EntityNode=Jf,be.GROUP_CODE_ENUM_VALUE=zn,be.GroupNode=Xf,be.INHERITED_REF_PREFIX=Pi,be.InvalidDiagramJsonError=Un,be.JAVA_TYPES=Jo,be.NoteNode=Zf,be.OpSyncAdapter=Hd,be.PHYSICAL_NAME_MAX_LENGTH=Zo,be.PropertyPanel=wh,be.RevCache=Ud,be.SELECTABLE_JAVA_TYPES=ac,be.SYMBOLIC_OP_KINDS=jd,be.SYMBOLIC_OP_SCHEMA=cu,be.UI_LOCALES=cI,be.applyDocumentReferenceOnly=Cr,be.buildAgentBatch=Hb,be.buildDiagramSvg=$s,be.buildDiffMarks=Zc,be.collectSharedColumns=vn,be.commands=Wg,be.computeAutoLayout=Bs,be.createEditorController=zC,be.dedupeModelIds=wg,be.defaultMermaidDialect=Gh,be.defaultSqlDialect=Iy,be.diagramToJson=hc,be.displayLabel=Ui,be.emptyState=Lf,be.entityModelToDdl=fc,be.entityModelToMermaid=xr,be.entityModelToText=qs,be.exportDiagramPng=bh,be.exportDiagramSvg=gh,be.fromPersisted=_u,be.isGeneratable=Ac,be.isInheritedColumnRef=Ln,be.javaTypeLabel=yo,be.makeInheritedColumnRef=Ls,be.mergeDiagram=Gc,be.mermaidErToImportSource=sc,be.migrateLegacyMoney=Ng,be.multiplicityLabel=Gi,be.newId=De,be.packEntityBoxes=Nr,be.parseDiagramJson=yc,be.parseInheritedColumnRef=wr,be.parseMermaidEr=lc,be.parseSqlDdl=Br,be.planHealBackfillOps=w_,be.projectActionLog=il,be.projectEntityAudit=Jc,be.projectFieldAudit=Cn,be.projectInheritedColumns=Go,be.projectSeqDiff=al,be.renderDiagramSvg=bc,be.resolveColumnPhysicalName=qo,be.resolveDiagram=Vs,be.resolveEffectiveColumn=on,be.resolveQuickFix=jr,be.resolveSharedColumn=Pn,be.resolveSymbolicOps=wb,be.restoreDeepEqual=Hn,be.scaffoldEntityJava=Xy,be.sharedColumnScopeEntities=Ir,be.sqlDdlToImportSource=mc,be.stereotypeLabel=Yo,be.synthesizeRestoreOps=Bg,be.toPersisted=k_,be.toPersistedV2=E_,be.translate=Dt,be.uiMessagesEn=vf,be.uiMessagesJa=Cf,be.uiMessagesKo=xf,be.validateModel=Qi,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|
|
64
|
+
v${-(S.value.height-2*e.maskBorderRadius)}
|
|
65
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(A=>{if(_.value){const L=zn(_.value),H=be=>{if(be.sourceEvent.type!=="wheel"||!p.value||!f.value)return;const pe=be.sourceEvent.ctrlKey&&$i()?10:1,he=-be.sourceEvent.deltaY*(be.sourceEvent.deltaMode===1?.05:be.sourceEvent.deltaMode?1:.002)*e.zoomStep,_e=c.value.zoom*2**(he*pe);f.value.scaleTo(p.value,_e)},oe=be=>{if(be.sourceEvent.type!=="mousemove"||!p.value||!f.value)return;const pe=$.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),he={x:c.value.x-be.sourceEvent.movementX*pe,y:c.value.y-be.sourceEvent.movementY*pe},_e=[[0,0],[u.value.width,u.value.height]],ye=zs.translate(he.x,he.y).scale(c.value.zoom),Ae=f.value.constrain()(ye,_e,d.value);f.value.transform(p.value,Ae)},ue=bT().wheelDelta(be=>ns(be)*(e.zoomStep/10)).on("zoom",e.pannable?oe:()=>{}).on("zoom.wheel",e.zoomable?H:()=>{});L.call(ue),A(()=>{L.on("zoom",null)})}},{flush:"post"});function T(A){const[L,H]=Fn(A);n("click",{event:A,position:{x:L,y:H}})}function M(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeClick(H),n("nodeClick",H)}function k(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeDoubleClick(H),n("nodeDblclick",H)}function v(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeMouseEnter(H),n("nodeMouseenter",H)}function I(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeMouseMove(H),n("nodeMousemove",H)}function O(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeMouseLeave(H),n("nodeMouseleave",H)}return(A,L)=>(t.openBlock(),t.createBlock(t.unref(xf),{position:A.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:A.pannable,zoomable:A.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:_,width:g.value,height:b.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:T},[A.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(A.ariaLabel),9,wT)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),H=>(t.openBlock(),t.createBlock(ET,{id:H.id,key:H.id,f:"",position:H.computedPosition,dimensions:H.dimensions,selected:H.selected,dragging:H.dragging,style:t.normalizeStyle(H.style),class:t.normalizeClass(w.value(H)),color:h.value(H),"border-radius":A.nodeBorderRadius,"stroke-color":N.value(H),"stroke-width":A.nodeStrokeWidth,"shape-rendering":t.unref(E),type:H.type,hidden:H.hidden,onClick:oe=>M(oe,H),onDblclick:oe=>k(oe,H),onMouseenter:oe=>v(oe,H),onMousemove:oe=>I(oe,H),onMouseleave:oe=>O(oe,H)},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:x.value,fill:A.maskColor,stroke:A.maskStrokeColor,"stroke-width":A.maskStrokeWidth,"fill-rule":"evenodd"},null,8,IT)],8,NT))]),_:1},8,["position","class"]))}}),ST=["d"],xT=["cx","cy","onDblclick"],RT=["x","y","onPointerdown","onDblclick"],AT=tt(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=et(),i=t.inject(Es),a=t.inject(po,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Go,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((V,$)=>$===d.value?u.value:V)),{source:p,target:f,sourceSide:y,targetSide:_}=Ap({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),g=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?mp(p.value,y.value,m.value,f.value,_.value):pp(p.value,m.value,f.value)),b=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?fp(p.value,y.value,m.value,f.value,_.value):gp(p.value,m.value,f.value).map((V,$)=>({point:V,segIndex:$})):[]),E=t.computed(()=>r.value?m.value:[]);function h(V,$){d.value=V,u.value={...c.value[V]},$.target.setPointerCapture($.pointerId),$.stopPropagation()}function N(V){if(d.value<0)return;const $=o({x:V.clientX,y:V.clientY});u.value={x:$.x,y:$.y}}function w(V){var $,R;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(R=($=V.target).releasePointerCapture)==null||R.call($,V.pointerId)}function C(V,$){$.stopPropagation(),i==null||i.removePoint(n.id,V)}function S(V,$){if(!i)return;const R=o({x:$.clientX,y:$.clientY});i.insertPoint(n.id,V,{x:R.x,y:R.y})}return(V,$)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:g.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,ST),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,(R,x)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${x}`,cx:R.point.x,cy:R.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(T=>S(R.segIndex,T),["stop"])},null,42,xT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(R,x)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${x}`,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:T=>h(x,T),onPointermove:N,onPointerup:w,onDblclick:T=>C(x,T)},null,42,RT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),$T=["data-theme"],TT={key:0,class:"em-ctx__sep",role:"separator"},MT=["aria-label"],VT={class:"em-ctx__swatches-label","aria-hidden":"true"},BT={class:"em-ctx__chips",role:"none"},DT=["aria-checked","aria-label","title","onClick"],OT=["aria-checked","aria-label","title","onClick"],LT=["disabled","onClick"],PT={class:"em-ctx__icon"},zT={class:"em-ctx__caption"},FT=tt(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(h,N)=>qt(o.locale??"ko",h,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(h,N){var S,V;r.value=N,l.value=(S=h.target)!=null&&S.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=h.clientX,c.y=h.clientY,a.value=!0,window.addEventListener("keydown",g),window.addEventListener("resize",p),await t.nextTick();const w=s.value;if(!w)return;const C=w.getBoundingClientRect();c.x+C.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-C.width)),c.y+C.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-C.height)),(V=f()[0])==null||V.focus()}function p(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",g),window.removeEventListener("resize",p);const h=d;d=null,h!=null&&h.isConnected&&h.focus()}function f(){const h=s.value;if(!h)return[];const N=[];for(const w of Array.from(h.children))if(w.classList.contains("em-ctx__item"))w.disabled||N.push(w);else if(w.classList.contains("em-ctx__swatches")){const C=Array.from(w.querySelectorAll(".em-ctx__chip"));C.length&&N.push(C.find(S=>S===document.activeElement)??C[0])}return N}function y(h){var S;const N=f();if(!N.length)return;const w=N.indexOf(document.activeElement),C=w<0?h>0?0:N.length-1:(w+h+N.length)%N.length;(S=N[C])==null||S.focus()}function _(h){var S,V;const N=(S=document.activeElement)==null?void 0:S.closest(".em-ctx__swatches");if(!N)return!1;const w=Array.from(N.querySelectorAll(".em-ctx__chip")),C=w.indexOf(document.activeElement);return C<0?!1:((V=w[(C+h+w.length)%w.length])==null||V.focus(),!0)}function g(h){var N,w;switch(h.key){case"Escape":h.stopPropagation(),p();return;case"ArrowDown":h.preventDefault(),y(1);return;case"ArrowUp":h.preventDefault(),y(-1);return;case"ArrowRight":_(1)&&h.preventDefault();return;case"ArrowLeft":_(-1)&&h.preventDefault();return;case"Home":h.preventDefault(),(N=f()[0])==null||N.focus();return;case"End":{h.preventDefault();const C=f();(w=C[C.length-1])==null||w.focus();return}case"Tab":h.preventDefault(),y(h.shiftKey?-1:1)}}function b(h){h.disabled||(h.handler(),p())}function E(h,N){h.onPick(N),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(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: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:N[0]||(N[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(w,C)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:C},[w.type==="separator"?(t.openBlock(),t.createElementBlock("div",TT)):w.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":w.caption},[t.createElementVNode("span",VT,t.toDisplayString(w.caption),1),t.createElementVNode("div",BT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":w.current===null}]),role:"menuitemradio","aria-checked":w.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:S=>E(w,null)},null,10,DT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),S=>(t.openBlock(),t.createElementBlock("button",{key:S,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":w.current===S}]),style:t.normalizeStyle({background:t.unref(jo)(S)}),role:"menuitemradio","aria-checked":w.current===S,"aria-label":i(t.unref(mo)(S)),title:i(t.unref(mo)(S)),onClick:V=>E(w,S)},null,14,OT))),128))])],8,MT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":w.danger,"is-disabled":w.disabled}]),disabled:w.disabled,role:"menuitem",onClick:S=>b(w)},[t.createElementVNode("span",PT,[w.icon?(t.openBlock(),t.createBlock(Ve,{key:0,name:w.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",zT,t.toDisplayString(w.caption),1)],10,LT))],64))),128))],36)],8,$T)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function Ih(e,n){return n?`${e}:${n}`:e}function vh(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(Ih(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 UT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=Ih(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 Ch(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(vh(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=vh(e.storageKey,s)),t.watch(o,s=>UT(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 Us=[".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 Xo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function HT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function jT(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 _=n(y.left,y.top+y.height/2);return[{...i,x:_.x,y:_.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,p=0;const f=()=>{const y=d.trim();if(y){const _=n(m,(u+p)/2);c.push({...i,x:_.x,y:_.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const _=a.getBoundingClientRect();u===null||Math.abs(_.top-u)>1?(f(),u=_.top,m=_.left,p=_.bottom,d=s[y]):(d+=s[y],p=Math.max(p,_.bottom))}return f(),c}function $r(e,n){const o=[];for(const i of e.querySelectorAll("*"))HT(i)&&(i.closest(Us)||Xo(i)&&o.push(...jT(i,n)));return o}function ji(e){return Math.round(e*100)/100}function KT(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Us)||!Xo(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="${ji(r.x)}" y="${ji(r.y)}" width="${ji(l.x-r.x)}" height="${ji(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 GT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Xo(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=>ji(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 Sh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Us)||!Xo(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 Ki(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 Hs(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 YT(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,y)=>e.screenToFlowCoordinate({x:f,y}),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 y=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!y||!Xo(y))continue;const _=y.firstElementChild;if(_)if(f.type==="group"){const g=Ki(_,o);Hs(s,g),i.push({...g,texts:[]});const b=_.querySelector(".em-group__label");b&&i.push({...Ki(b,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:$r(_,o)})}else if(f.type==="note"){const g={...Ki(_,o),texts:$r(_,o),lines:Sh(_,_,o)};Hs(s,g),r.push(g)}else{const g=Ki(_,o);Hs(s,g);const b=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const E=_.querySelector(".em-entity__header");if(E){const h=Ki(E,o);a.push({x:g.x,y:g.y,w:g.w,h:h.y+h.h-g.y,fill:h.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:$r(_,o),lines:Sh(_,_,o),icons:KT(_,o)}),a.push({...g,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const y=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!Xo(y))continue;const _=y.getAttribute("d");if(!_)continue;const g=getComputedStyle(y),b=g.strokeDasharray,E=GT(f);l.push({d:_,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:$r(f,o),markers:E.length?E: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 js(e){return $c(YT(e))}function xh(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 Rh(e,n="diagram.svg"){const o=js(e);xh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function qT(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 Ah(e,n="diagram.png",o=2){const i=js(e),{w:a,h:r}=qT(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 변환 실패");xh(u,n)}finally{URL.revokeObjectURL(l)}}const WT={class:"em-shortcuts"},JT={class:"em-shortcuts__list"},XT={class:"em-shortcuts__title"},ZT={class:"em-shortcuts__keys"},QT={class:"em-shortcuts__kbd"},eM={key:0,class:"em-shortcuts__plus"},tM={class:"em-shortcuts__desc"},nM={class:"em-shortcuts__actions"},$h=tt(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(s,c)=>qt(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",WT,[t.createElementVNode("div",JT,[(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",XT,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",ZT,[(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",QT,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",eM,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",tM,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",nM,[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 oM(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 iM=["aria-label"],aM=["aria-activedescendant","aria-label","placeholder"],rM={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},lM=["aria-label"],sM={class:"em-cmdk__section","aria-hidden":"true"},cM=["id","aria-selected","onMouseenter","onClick"],dM={class:"em-cmdk__label"},uM={key:0,class:"em-cmdk__tag"},mM={key:1,class:"em-cmdk__sub"},fM=["aria-label"],pM={class:"em-cmdk__section","aria-hidden":"true"},hM=["id","aria-selected","aria-disabled","onMouseenter","onClick"],yM={class:"em-cmdk__label"},gM={key:1,class:"em-cmdk__empty"},bM=tt(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 w=c.value,C=a.state.logical.entities.map(V=>{var $,R,x,T,M,k;return{type:"goto",kind:"entity",id:V.modelId,label:((R=($=V.table)==null?void 0:$.logicalName)==null?void 0:R[w])||V.name,sub:(x=V.table)==null?void 0:x.physicalName,match:Zo(V.name,(M=(T=V.table)==null?void 0:T.logicalName)==null?void 0:M[w],(k=V.table)==null?void 0:k.physicalName)??""}}),S=a.state.logical.groups.map(V=>{var $,R,x,T;return{type:"goto",kind:"group",id:V.modelId,label:(($=V.name)==null?void 0:$[w])||((R=V.name)==null?void 0:R.ko)||V.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:Zo((x=V.name)==null?void 0:x[w],(T=V.name)==null?void 0:T.ko,V.packageName)??""}});return[...C,...S]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const w=[];a.editable.value&&(w.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),w.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),w.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),w.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),w.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),w.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),w.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),w.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const C of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])w.push({type:"action",id:`dm-${C}`,label:a.t(u[C]),run:()=>a.displayMode.value=C});return w});function p(w,C){return w.label.toLowerCase().includes(C)}const f=t.computed(()=>{const w=r.value.trim().toLowerCase();return w?d.value.filter(C=>C.match.includes(w)):d.value}),y=t.computed(()=>{const w=r.value.trim().toLowerCase();return w?m.value.filter(C=>p(C,w)):m.value}),_=t.computed(()=>[...f.value,...y.value]);t.watch([f,y],()=>{l.value=0});function g(w){return _.value.indexOf(w)}const b=w=>`em-cmdk-opt-${w}`,E=t.computed(()=>_.value[l.value]?b(l.value):void 0);t.watch(l,async()=>{var C;await t.nextTick();const w=E.value;w&&((C=document.getElementById(w))==null||C.scrollIntoView({block:"nearest"}))});function h(w){if(w.type==="goto")a.selection.value={kind:w.kind,id:w.id},a.requestFocus(w.id);else{if(w.disabled)return;w.run()}i("close")}function N(w){if(w.key==="Escape"){i("close"),w.preventDefault();return}if(w.key==="ArrowDown"){l.value=Math.min(l.value+1,_.value.length-1),w.preventDefault();return}if(w.key==="ArrowUp"){l.value=Math.max(l.value-1,0),w.preventDefault();return}if(w.key==="Enter"){const C=_.value[l.value];C&&h(C),w.preventDefault();return}w.key==="Tab"&&w.preventDefault()}return t.nextTick(()=>{var w;return(w=s.value)==null?void 0:w.focus()}),(w,C)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:C[1]||(C[1]=t.withModifiers(S=>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":C[0]||(C[0]=S=>r.value=S),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":E.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:N},null,40,aM),[[t.vModelText,r.value]]),t.createElementVNode("div",rM,[_.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",sM,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,S=>(t.openBlock(),t.createElementBlock("button",{id:b(g(S)),key:S.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g(S)===l.value}]),role:"option","aria-selected":g(S)===l.value,onMouseenter:V=>l.value=g(S),onClick:V=>h(S)},[t.createElementVNode("span",dM,t.toDisplayString(S.label),1),S.tag?(t.openBlock(),t.createElementBlock("span",uM,t.toDisplayString(S.tag),1)):S.sub?(t.openBlock(),t.createElementBlock("span",mM,t.toDisplayString(S.sub),1)):t.createCommentVNode("",!0)],42,cM))),128))],8,lM)):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",pM,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,S=>(t.openBlock(),t.createElementBlock("button",{id:b(g(S)),key:S.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g(S)===l.value,"is-disabled":S.disabled}]),role:"option","aria-selected":g(S)===l.value,"aria-disabled":S.disabled||void 0,onMouseenter:V=>l.value=g(S),onClick:V=>h(S)},[t.createElementVNode("span",yM,t.toDisplayString(S.label),1)],42,hM))),128))],8,fM)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",gM,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,iM)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function _M(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const kM={key:0,class:"em-canvas__empty","aria-hidden":"true"},EM={class:"em-canvas__empty-title"},NM=["innerHTML"],wM=["innerHTML"],IM=["innerHTML"],vM={key:1,class:"em-canvas__empty-title"},CM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},SM={class:"em-conflict-banner__body"},xM={class:"em-conflict-banner__title"},RM={class:"em-conflict-banner__detail"},AM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Ks="nc:",Th=tt(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(B){l.value=B,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,B=>{B&&c(B.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 B=_M(i.opConflict.value);return B?{title:i.t(B.titleKey),detail:i.t(B.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(B){p.x=B.clientX,p.y=B.clientY}const y=t.ref(null);t.provide(dr,y);const _=t.ref(null);t.provide(Jf,_);const g=t.ref(null),b=t.computed(()=>{const B=g.value,F=new Set;if(!B)return F;if(B.kind==="entity")F.add(B.id);else if(B.kind==="group"){const j=i.resolved.value.groups.find(fe=>fe.group.modelId===B.id);for(const fe of(j==null?void 0:j.group.memberEntityRefs)??[])F.add(fe)}return F}),E=t.computed(()=>{const B=g.value,F=new Set(b.value),j=new Set,fe=new Set;if(!B)return{related:F,edges:j,notes:fe};if(B.kind==="note"){fe.add(B.id);for(const Oe of i.resolved.value.noteConnections)Oe.noteRef===B.id&&F.add(Oe.targetRef);return{related:F,edges:j,notes:fe}}const Te=b.value;if(!Te.size)return{related:F,edges:j,notes:fe};for(const Oe of i.resolved.value.associations){const{end1:ce,end2:Le}=Oe.association;(Te.has(ce.entityRef)||Te.has(Le.entityRef))&&(j.add(Oe.association.modelId),F.add(ce.entityRef),F.add(Le.entityRef))}for(const Oe of i.resolved.value.noteConnections)F.has(Oe.targetRef)&&fe.add(Oe.noteRef);return{related:F,edges:j,notes:fe}});t.provide(Go,{source:g,active:t.computed(()=>g.value!==null),primaryEntityIds:b,relatedEntityIds:t.computed(()=>E.value.related),relatedEdgeIds:t.computed(()=>E.value.edges),relatedNoteIds:t.computed(()=>E.value.notes),hoverGroupId:t.computed(()=>{var B;return((B=g.value)==null?void 0:B.kind)==="group"?g.value.id:null}),setEntityHover:B=>{_.value||m.value||(g.value=B?{kind:"entity",id:B}:null)},setGroupHover:B=>{_.value||m.value||(g.value=B?{kind:"group",id:B}:null)},setNoteHover:B=>{_.value||m.value||(g.value=B?{kind:"note",id:B}:null)}}),t.provide(po,i);const h=rS(),N=t.computed(()=>h(i.state.logical,i.embeddableCatalog.value));t.provide(Qf,N);const w=Ch({expandableKeys:()=>[],defaultCollapsed:dS,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(np,{isCollapsed:w.isCollapsed,toggle:w.toggle}),t.provide(Xf,{marks:t.toRef(o,"diffMarks")});function C(B,F){return`${Ks}${B}:${F}`}function S(B){if(!B.startsWith(Ks))return null;const[F,j]=B.slice(Ks.length).split(":");return F&&j?{noteRef:F,targetRef:j}:null}t.provide(Es,{points:B=>{var j,fe;const F=S(B);return F?((j=i.resolved.value.noteConnections.find(Te=>Te.noteRef===F.noteRef&&Te.targetRef===F.targetRef))==null?void 0:j.waypoints)??[]:((fe=i.resolved.value.associations.find(Te=>Te.association.modelId===B))==null?void 0:fe.waypoints)??[]},movePoint:(B,F,j)=>{const fe=S(B);fe?i.moveNoteConnectionWaypoint(fe.noteRef,fe.targetRef,F,j):i.moveWaypoint(B,F,j)},insertPoint:(B,F,j)=>{const fe=S(B);fe?i.addNoteConnectionWaypoint(fe.noteRef,fe.targetRef,F,j):i.addWaypoint(B,F,j)},removePoint:(B,F)=>{const j=S(B);j?i.removeNoteConnectionWaypoint(j.noteRef,j.targetRef,F):i.removeWaypoint(B,F)}});const V=et(),{nodes:$,edges:R,findNode:x,findEdge:T,addNodes:M,addEdges:k,removeNodes:v,removeEdges:I,fitView:O,setCenter:A,getViewport:L,screenToFlowCoordinate:H,getSelectedNodes:oe,updateNodeInternals:ue}=V,be=t.ref(!1);async function pe(B){be.value=!0,await t.nextTick(),await new Promise(F=>requestAnimationFrame(()=>F(null)));try{return await B()}finally{be.value=!1}}async function he(){try{await pe(()=>Rh(V))}catch(B){console.error("[entity-modeler] SVG export failed",B),c(i.t("em.canvas.exportFailed"))}}async function _e(){try{await pe(()=>Ah(V))}catch(B){console.error("[entity-modeler] PNG export failed",B),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:he,exportPng:_e,fitView:O});const ye=t.computed(()=>i.resolved.value.entities.length===0);function Ae(){const B=L(),{width:F,height:j}=V.dimensions.value;return{x:(F/2-B.x)/B.zoom,y:(j/2-B.y)/B.zoom}}function Fe(){const B=Ae();i.addEntity("NewEntity",{x:B.x,y:B.y})}function se(){const B=Ae();i.addNote("메모",{x:B.x,y:B.y})}function ne(B){for(const F of i.resolved.value.groups){const{location:j,size:fe}=F.geo;if(B.x>=j.x&&B.x<=j.x+fe.width&&B.y>=j.y&&B.y<=j.y+fe.height)return F.group.modelId}return null}function ae(B,F){return B.x===F.x&&B.y===F.y}function me(B,F){return(B==null?void 0:B.width)===(F==null?void 0:F.width)&&(B==null?void 0:B.height)===(F==null?void 0:F.height)}function P(B,F){return B.entity===F.entity&&B.displayMode===F.displayMode&&B.collapsed===F.collapsed&&B.locked===F.locked&&B.groupRef===F.groupRef&&me(B.size,F.size)&&B.style===F.style&&B.attributeStyles===F.attributeStyles&&B.operationStyles===F.operationStyles}function D(B,F){const j=Object.keys(B);if(j.length!==Object.keys(F).length)return!1;for(const fe of j)if(fe==="geo"){const Te=B.geo,Oe=F.geo;if(!ae(Te.location,Oe.location)||!me(Te.size,Oe.size))return!1}else if(B[fe]!==F[fe])return!1;return!0}function z(){const B=i.resolved.value,F=new Map(B.groups.map(ce=>[ce.group.modelId,ce.geo])),j=new Set(B.groups.map(ce=>ce.group.modelId)),fe=new Set([...j,...B.entities.map(ce=>ce.entity.modelId),...B.notes.map(ce=>ce.note.modelId)]);for(const ce of[...$.value])fe.has(ce.id)||v([ce.id]);for(const ce of B.groups){const Le=ce.group.modelId,Ye={width:`${ce.geo.size.width}px`,height:`${ce.geo.size.height}px`},Je={group:ce.group,style:ce.style,locked:ce.locked},ut=ce.locked?!1:void 0,G=x(Le);if(G){ae(G.position,ce.geo.location)||(G.position={...ce.geo.location});const W=G.data;(W.group!==Je.group||W.style!==Je.style||W.locked!==Je.locked)&&(G.data=Je);const ve=G.style;((ve==null?void 0:ve.width)!==Ye.width||(ve==null?void 0:ve.height)!==Ye.height)&&(G.style=Ye),G.draggable!==ut&&(G.draggable=ut)}else M([{id:Le,type:"group",position:{...ce.geo.location},draggable:ut,style:Ye,data:Je}])}for(const ce of B.entities){const Le=ce.entity.modelId,Ye=ce.groupRef&&j.has(ce.groupRef)?ce.groupRef:void 0,Je={entity:ce.entity,displayMode:i.displayMode.value,collapsed:ce.collapsed,locked:ce.locked,groupRef:Ye,size:ce.geo.size,style:ce.style,attributeStyles:ce.attributeStyles,operationStyles:ce.operationStyles},ut=ce.locked?!1:void 0,G=ce.locked?!1:void 0,W=Ye?F.get(Ye):void 0,ve=W?{x:ce.geo.location.x-W.location.x,y:ce.geo.location.y-W.location.y}:{...ce.geo.location},$e=x(Le);$e?(ae($e.position,ve)||($e.position=ve),P($e.data,Je)||($e.data=Je),$e.parentNode!==Ye&&($e.parentNode=Ye),$e.draggable!==ut&&($e.draggable=ut),$e.connectable!==G&&($e.connectable=G)):M([{id:Le,type:"entity",position:ve,parentNode:Ye,draggable:ut,connectable:G,data:Je}])}for(const ce of B.notes){const Le=ce.note,Ye=Le.modelId,Je=ce.groupRef&&j.has(ce.groupRef)?ce.groupRef:void 0,ut={note:Le,groupRef:Je},G={width:`${Le.geo.size.width}px`,height:`${Le.geo.size.height}px`},W=Je?F.get(Je):void 0,ve=W?{x:Le.geo.location.x-W.location.x,y:Le.geo.location.y-W.location.y}:{...Le.geo.location},$e=x(Ye);if($e){ae($e.position,ve)||($e.position=ve);const Ee=$e.data;(Ee.groupRef!==Je||!D(Ee.note,Le))&&($e.data=ut);const Qe=$e.style;((Qe==null?void 0:Qe.width)!==G.width||(Qe==null?void 0:Qe.height)!==G.height)&&($e.style=G),$e.parentNode!==Je&&($e.parentNode=Je)}else M([{id:Ye,type:"note",position:ve,parentNode:Je,style:G,data:ut}])}const Te=new Map(B.associations.map(ce=>[ce.association.modelId,ce])),Oe=new Set(B.noteConnections.map(ce=>C(ce.noteRef,ce.targetRef)));for(const ce of[...R.value])!Te.has(ce.id)&&!Oe.has(ce.id)&&I([ce.id]);for(const[ce,Le]of Te){const Ye={id:ce,type:"association",source:Le.association.end1.entityRef,target:Le.association.end2.entityRef,sourceHandle:Le.sourceColumnRef?`r:${Le.sourceColumnRef}`:void 0,targetHandle:Le.targetColumnRef?`l:${Le.targetColumnRef}`:void 0,data:{association:Le.association,sourceColumnRef:Le.sourceColumnRef,targetColumnRef:Le.targetColumnRef}},Je=T(ce);if(Je){const ut=Je.data;(ut.association!==Ye.data.association||ut.sourceColumnRef!==Ye.data.sourceColumnRef||ut.targetColumnRef!==Ye.data.targetColumnRef)&&(Je.data=Ye.data),Je.sourceHandle!==Ye.sourceHandle&&(Je.sourceHandle=Ye.sourceHandle),Je.targetHandle!==Ye.targetHandle&&(Je.targetHandle=Ye.targetHandle)}else k([Ye])}for(const ce of B.noteConnections){const Le=C(ce.noteRef,ce.targetRef),Ye={noteRef:ce.noteRef,targetRef:ce.targetRef};T(Le)||k([{id:Le,type:"note-connection",source:ce.noteRef,target:ce.targetRef,data:Ye}])}}const Q=new Set;let ee=!1,we=!1;const de=new Map;function xe(B){const F=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(B)}"]`);if(!F)return null;let j=`${F.offsetHeight}`;for(const fe of F.querySelectorAll(".em-entity__row"))j+=`|${fe.dataset.attr}:${fe.offsetTop}`;return j}function Ce(){we=!1;const B=ee;ee=!1;const F=[...Q];if(Q.clear(),B){ue();for(const fe of $.value){const Te=xe(fe.id);Te!==null&&de.set(fe.id,Te)}return}const j=[];for(const fe of F){const Te=xe(fe);if(Te===null){de.delete(fe);continue}de.get(fe)!==Te&&(de.set(fe,Te),j.push(fe))}j.length&&ue(j)}function Y(B){if(B)for(const F of B)Q.add(F);else ee=!0;we||(we=!0,t.nextTick(()=>requestAnimationFrame(Ce)))}t.provide(Zf,{mark:B=>Y([B])});function X(){const B=oe.value.map(j=>j.id);if(B.length)return B;const F=i.selection.value;return F&&(F.kind==="entity"||F.kind==="note"||F.kind==="group")?[F.id]:[]}function q(){return oe.value.filter(B=>B.type==="entity").map(B=>B.id)}function Ie(){return oe.value.filter(B=>B.type==="group").map(B=>B.id)}function Be(B){var F;return[...((F=i.state.logical.groups.find(j=>j.modelId===B))==null?void 0:F.memberEntityRefs)??[]]}function ze(){const B=Ie().flatMap(Be);return[...new Set([...q(),...B])]}function Ue(){return Ie().length>0||q().length>1}function ie(){Ue()?i.copy(ze()):i.copy()}async function Se(B){if(!B.length)return;await t.nextTick();const F=oe.value;F.length&&V.removeSelectedNodes(F);const j=B.map(fe=>x(fe)).filter(fe=>!!fe);j.length&&V.addSelectedNodes(j)}function je(B){if(Ue()&&q().includes(B)){const F=ze();return{caption:i.t("em.ctx.copyN",{n:F.length}),icon:"copy",handler:()=>i.copy(F)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:B},i.copy()}}}function Ze(B){var Te;const F=B.target;if(F&&(F.tagName==="INPUT"||F.tagName==="TEXTAREA"||F.isContentEditable))return;if(B.key==="?"){a.openModal({component:$h,bind:{locale:i.uiLocale.value}}),B.preventDefault();return}if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="k"){r.value=!0,B.preventDefault();return}if(!i.editable.value){(B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="c"&&(ie(),B.preventDefault());return}if(B.key==="Delete"||B.key==="Backspace"){i.deleteSelection()&&B.preventDefault();return}if(B.key==="ArrowUp"||B.key==="ArrowDown"||B.key==="ArrowLeft"||B.key==="ArrowRight"){if(((Te=i.selection.value)==null?void 0:Te.kind)==="attribute"){if(B.key==="ArrowUp"||B.key==="ArrowDown"){const Ye=B.key==="ArrowDown"?1:-1;(B.altKey?i.nudgeSelectedAttributes(Ye):i.moveAttributeFocus(Ye))&&B.preventDefault()}return}const Oe=B.shiftKey?10:1,ce=B.key==="ArrowLeft"?-Oe:B.key==="ArrowRight"?Oe:0,Le=B.key==="ArrowUp"?-Oe:B.key==="ArrowDown"?Oe:0;i.nudgeNodes(X(),ce,Le)&&B.preventDefault();return}if(!(B.metaKey||B.ctrlKey))return;const fe=B.key.toLowerCase();fe==="c"?(ie(),B.preventDefault()):fe==="v"?(Se(i.paste()),B.preventDefault()):fe==="z"&&(B.shiftKey?i.redo():i.undo(),B.preventDefault())}t.onMounted(async()=>{z(),await t.nextTick(),O(),Y(),window.addEventListener("keydown",Ze),window.addEventListener("pointerup",J),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ze),window.removeEventListener("pointerup",J),window.removeEventListener("pointermove",f)});function J(){y.value=null}function re(){m.value=!0,g.value=null}function Ke(){var fe;m.value=!1;const B=(fe=document.elementFromPoint(p.x,p.y))==null?void 0:fe.closest(".vue-flow__node"),F=B==null?void 0:B.dataset.id;if(!F){g.value=null;return}const j=B.classList.contains("vue-flow__node-group")?"group":B.classList.contains("vue-flow__node-note")?"note":"entity";g.value={kind:j,id:F}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],z),t.watch(()=>i.resolved.value,B=>{const F=g.value;if(!F)return;(F.kind==="entity"?B.entities.some(fe=>fe.entity.modelId===F.id):F.kind==="group"?B.groups.some(fe=>fe.group.modelId===F.id):B.notes.some(fe=>fe.note.modelId===F.id))||(g.value=null)});function st(B){const F=B.computedPosition??B.position,j=B.dimensions??{width:0,height:0};return{x:F.x+j.width/2,y:F.y+j.height/2}}function qe(B){const F=B.node;if(F){if(g.value=null,F.type==="group"){const j=i.resolved.value.groups.find(fe=>fe.group.modelId===F.id);_.value=j?{groupId:F.id,dx:F.position.x-j.geo.location.x,dy:F.position.y-j.geo.location.y}:null,y.value=null;return}if(F.type!=="entity"&&F.type!=="note"){y.value=null;return}y.value=ne(st(F))}}function nt(B){var fe;y.value=null,_.value=null;const F=(fe=B.nodes)!=null&&fe.length?B.nodes:[B.node],j=F.filter(Te=>(Te==null?void 0:Te.type)==="group");if(j.length){for(const Te of j){if(!Te)continue;const Oe=i.resolved.value.entities.filter(ce=>ce.groupRef===Te.id).map(ce=>{const Le=x(ce.entity.modelId),Ye=(Le==null?void 0:Le.computedPosition)??(Le==null?void 0:Le.position)??{x:0,y:0};return{id:ce.entity.modelId,location:{x:Ye.x,y:Ye.y}}});i.dragGroup(Te.id,{x:Te.position.x,y:Te.position.y},Oe)}return}for(const Te of F){if(!Te||Te.type==="group")continue;const Oe=Te.computedPosition??Te.position,ce=Te.dimensions??{width:0,height:0},Le={x:Oe.x+ce.width/2,y:Oe.y+ce.height/2};Te.type==="note"?i.dropNote(Te.id,{x:Oe.x,y:Oe.y},ne(Le)):i.dropEntity(Te.id,{x:Oe.x,y:Oe.y},ne(Le))}}function We(B){var Ye,Je,ut,G,W;if(!i.editable.value||!B.source||!B.target)return;const F=((Ye=x(B.source))==null?void 0:Ye.type)==="note",j=((Je=x(B.target))==null?void 0:Je.type)==="note";if(F||j){if(F&&j)return;const ve=F?B.source:B.target,$e=F?B.target:B.source;((ut=x($e))==null?void 0:ut.type)==="entity"&&i.addNoteConnection(ve,$e);return}const fe=ve=>{var $e;return($e=i.state.logical.entities.find(Ee=>Ee.modelId===ve))==null?void 0:$e.stereotype},Te=fe(B.source)==="JPA_EMBEDDABLE",Oe=fe(B.target)==="JPA_EMBEDDABLE";if(Te||Oe){if(Te&&Oe)return;const ve=Te?B.source:B.target,$e=Te?B.target:B.source;i.addEmbedAssociation($e,ve);return}const ce=(G=B.sourceHandle)!=null&&G.startsWith("r:")?B.sourceHandle.slice(2):void 0,Le=(W=B.targetHandle)!=null&&W.startsWith("l:")?B.targetHandle.slice(2):void 0;i.addAssociation(B.source,B.target,ce,Le)}const K=t.ref(null);function le(B,F){var fe;const j=i.state.layout.entityLayouts.find(Te=>Te.entityRef===B);return St((fe=j==null?void 0:j.attributeStyles)==null?void 0:fe[F])}function Re(B,F){var fe;const j=i.state.layout.entityLayouts.find(Te=>Te.entityRef===B);return St((fe=j==null?void 0:j.operationStyles)==null?void 0:fe[F])}function ke(B){var F;return St((F=i.state.layout.groupLayouts.find(j=>j.groupRef===B))==null?void 0:F.style)}function U(B){var F;return St((F=i.state.layout.notes.find(j=>j.modelId===B))==null?void 0:F.style)}function bt(B){var Te,Oe;if(B.preventDefault(),!i.editable.value)return;const F=()=>H({x:B.clientX,y:B.clientY}),j=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const ce=F();i.addEntity("NewEntity",{x:ce.x,y:ce.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const ce=F();i.addNote("메모",{x:ce.x,y:ce.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const ce=F();i.addEmptyGroup({x:ce.x,y:ce.y})}}],fe=(Te=i.clipboard.value)==null?void 0:Te.kind;(fe==="entity"||fe==="entities")&&j.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>Se(i.paste())}),i.resolved.value.entities.length>0&&j.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()}),(Oe=K.value)==null||Oe.open(B,j)}function vt({event:B,node:F}){var Ye,Je,ut,G,W,ve,$e,Ee,Qe,Tt,Et,_o,Gi,pt,Rn,Mr,Oh,Lh,Ph;const j=B;if(j.preventDefault(),!i.editable.value){if(F.type==="group"||F.type==="note")return;const it=(Je=(Ye=j.target)==null?void 0:Ye.closest("[data-attr]"))==null?void 0:Je.dataset.attr;if(it){const ht=i.selection.value;(ht==null?void 0:ht.kind)==="attribute"&&ht.entityId===F.id&&ht.ids.includes(it)||i.selectAttribute(F.id,it);const An=((ut=i.selection.value)==null?void 0:ut.kind)==="attribute"&&i.selection.value.entityId===F.id?[...i.selection.value.ids]:[it];(G=K.value)==null||G.open(j,[{caption:An.length>1?i.t("em.ctx.copyN",{n:An.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(W=K.value)==null||W.open(j,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>lr(a,i,F.id)},je(F.id)]);return}if(F.type==="group"){const it=i.isGroupLocked(F.id),ht=[];it||ht.push({type:"swatches",caption:i.t("em.common.color"),current:ke(F.id),onPick:An=>i.setGroupSwatch(F.id,An)},{type:"separator"});const Nt=Ue()&&Ie().includes(F.id)?ze():Be(F.id);Nt.length&&ht.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(Nt)}),ht.push({caption:it?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:it?"unlock":"lock",handler:()=>i.setGroupLocked(F.id,!it)}),it||ht.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(F.id)}),(ve=K.value)==null||ve.open(j,ht);return}if(F.type==="note"){($e=K.value)==null||$e.open(j,[{type:"swatches",caption:i.t("em.common.color"),current:U(F.id),onPick:it=>i.setNoteSwatch(F.id,it)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(F.id)}]);return}const fe=(Qe=(Ee=j.target)==null?void 0:Ee.closest("[data-attr]"))==null?void 0:Qe.dataset.attr;if(fe){const it=i.selection.value;(it==null?void 0:it.kind)==="attribute"&&it.entityId===F.id&&it.ids.includes(fe)||i.selectAttribute(F.id,fe);const Nt=((Tt=i.selection.value)==null?void 0:Tt.kind)==="attribute"&&i.selection.value.entityId===F.id?[...i.selection.value.ids]:[fe];if(i.isEntityLocked(F.id)){(Et=K.value)==null||Et.open(j,[{caption:Nt.length>1?i.t("em.ctx.copyN",{n:Nt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const An=Nt.length>1,Gs=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(F.id)},{type:"swatches",caption:An?i.t("em.ctx.colorN",{n:Nt.length}):i.t("em.common.color"),current:An?null:le(F.id,fe),onPick:jD=>i.setAttributeSwatches(F.id,Nt,jD)},{type:"separator"},{caption:An?i.t("em.ctx.copyN",{n:Nt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Yi=i.clipboard.value;(Yi==null?void 0:Yi.kind)==="attribute"&&Gs.push({caption:Yi.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Yi.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:F.id},i.paste()}}),Gs.push({type:"separator"},{caption:An?i.t("em.ctx.deleteAttrN",{n:Nt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(F.id,Nt)}),(_o=K.value)==null||_o.open(j,Gs);return}const Te=(pt=(Gi=j.target)==null?void 0:Gi.closest("[data-op]"))==null?void 0:pt.dataset.op;if(Te){if(i.isEntityLocked(F.id))return;(Rn=K.value)==null||Rn.open(j,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(F.id)},{type:"swatches",caption:i.t("em.common.color"),current:Re(F.id,Te),onPick:it=>i.setOperationSwatch(F.id,Te,it)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(F.id,Te)}]);return}const Oe=i.resolved.value.entities.find(it=>it.entity.modelId===F.id),ce=!!(Oe!=null&&Oe.locked),Le=[{caption:ce?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>lr(a,i,F.id)}];if(!ce){Le.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(F.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(F.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const ht=oe.value.filter(Nt=>Nt.type==="entity").map(Nt=>Nt.id);i.createGroup(ht.includes(F.id)&&ht.length?ht:[F.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(F.id,F.id)});const it=i.embeddableCatalog.value;if(it.length){Le.push({type:"separator"});for(const ht of it){const Nt=((Mr=ht.label)==null?void 0:Mr[i.userLanguage.value])??((Oh=ht.label)==null?void 0:Oh.ko)??((Lh=ht.label)==null?void 0:Lh.en)??ht.type;Le.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:Nt}),icon:"link",handler:()=>i.addPredefinedEmbed(F.id,ht.type)})}}}if(Le.push({type:"separator"}),Le.push({caption:Oe!=null&&Oe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Oe!=null&&Oe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(F.id,!(Oe!=null&&Oe.collapsed))}),Oe!=null&&Oe.groupRef&&!ce&&Le.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(F.id)}),Le.push({caption:ce?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:ce?"unlock":"lock",handler:()=>i.setEntityLocked(F.id,!ce)}),Le.push(je(F.id)),!ce){const it=i.clipboard.value;(it==null?void 0:it.kind)==="attribute"&&Le.push({caption:it.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:it.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:F.id},i.paste()}}),Le.push({type:"separator"}),Le.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(F.id)})}(Ph=K.value)==null||Ph.open(j,Le)}function ot({event:B,edge:F}){var Oe,ce;const j=B;if(j.preventDefault(),!i.editable.value)return;const fe=S(F.id);if(fe){(Oe=K.value)==null||Oe.open(j,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(fe.noteRef,fe.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(fe.noteRef,fe.targetRef)}]);return}const Te=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(F.id)}];i.isAssociationLocked(F.id)||Te.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(F.id)}),(ce=K.value)==null||ce.open(j,Te)}function Ge(B){return B==="group"?"group":B==="note"?"note":"entity"}function Xe({node:B}){if(oe.value.length>1){i.selection.value=null;return}i.selection.value={kind:Ge(B.type),id:B.id}}function Z({nodes:B}){B.length>1&&(i.selection.value=null)}function Rt({edge:B}){const F=S(B.id);i.selection.value=F?{kind:"note",id:F.noteRef}:{kind:"association",id:B.id}}function $t(B){const F=i.selection.value;return!!F&&F.kind!=="attribute"&&F.id===B.id}function Sn(B){var F,j;return $t(B)?B.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":B.type==="note"?"var(--em-note-soft)":B.type==="group"?Af(St((F=B.data)==null?void 0:F.style),!0)??"var(--em-mm-group)":Af(St((j=B.data)==null?void 0:j.style))??"var(--em-mm-entity)"}function At(B){return $t(B)?"var(--em-selection)":B.type==="note"?"var(--em-note-accent)":B.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ge(B,F){A(B,F,{zoom:L().zoom,duration:350})}t.watch(()=>i.focusRequest.value,B=>{if(!B)return;const F=x(B.id);if(!F)return;const j=F.computedPosition??F.position,fe=F.dimensions??{width:0,height:0};ge(j.x+fe.width/2,j.y+fe.height/2)});function ft({position:B}){ge(B.x,B.y)}function xn({node:B}){i.selection.value={kind:Ge(B.type),id:B.id};const F=B.computedPosition??B.position,j=B.dimensions??{width:0,height:0};ge(F.x+j.width/2,F.y+j.height/2)}function Zt({node:B}){O({nodes:[B.id],duration:350,maxZoom:1.2,padding:.6})}return(B,F)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(vw),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!be.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(En).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:re,onMoveEnd:Ke,onConnect:We,onConnectStart:F[1]||(F[1]=j=>u.value=!0),onConnectEnd:F[2]||(F[2]=j=>u.value=!1),onNodeDrag:qe,onNodeDragStop:nt,onNodeClick:Xe,onEdgeClick:Rt,onSelectionChange:Z,onPaneClick:F[3]||(F[3]=j=>t.unref(i).selection.value=null),onPaneContextMenu:bt,onNodeContextMenu:vt,onEdgeContextMenu:ot},{"node-group":t.withCtx(j=>[t.createVNode(cp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"node-entity":t.withCtx(j=>[t.createVNode(sp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"node-note":t.withCtx(j=>[t.createVNode(dp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"edge-association":t.withCtx(j=>[t.createVNode($p,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"edge-note-connection":t.withCtx(j=>[t.createVNode(AT,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(bx),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(jx),{"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(ho),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:Fe},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(ho),{title:t.unref(i).t("em.ctx.addNote"),onClick:se},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(ho),{title:t.unref(i).t("em.palette.autoLayout"),onClick:F[0]||(F[0]=j=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(CT),{key:1,pannable:"",width:224,height:160,"node-color":Sn,"node-stroke-color":At,"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:ft,onNodeClick:xn,onNodeDblclick:Zt})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ye.value?(t.openBlock(),t.createElementBlock("div",kM,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",EM,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,NM),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,wM),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,IM)],64)):(t.openBlock(),t.createElementBlock("p",vM,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(bM,{key:1,controller:t.unref(i),onClose:F[4]||(F[4]=j=>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",CM,[t.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",SM,[t.createElementVNode("strong",xM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",RM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(FT,{ref_key:"menuRef",ref:K,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",AM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),$M={class:"em-explorer em-scroll-overlay"},TM={class:"em-explorer__search"},MM=["placeholder","aria-label"],VM=["aria-label","title"],BM={key:0,class:"em-explorer__empty"},DM=["aria-label"],OM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],LM=["onClick"],PM=["title"],zM={class:"em-key-slot"},FM={class:"em-key-slot"},UM={class:"em-explorer__label"},HM={key:2,class:"em-explorer__sr"},Mh=tt(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=te.useModal(),r=t.computed(()=>{var Ae,Fe;const M=i.resolved.value,k=i.displayMode.value,v=i.userLanguage.value,I=se=>{var ne,ae,me;return Ji(k,se.name,(ae=(ne=se.table)==null?void 0:ne.logicalName)==null?void 0:ae[v],(me=se.table)==null?void 0:me.physicalName,i.t("em.node.logicalMissing"))},O=k==="PHYSICAL"||k==="LOGICAL_PHYSICAL",A=se=>{const ne=se.attrType.startsWith("RELATION")&&se.dbAttrs.length>0;return{icon:se.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:se.identifier,fk:ne&&O}}},L=se=>se.attrType.startsWith("EMBED")&&se.dbAttrs.length>0,H=se=>L(se)||mn(se),oe=k==="PHYSICAL"||k==="LOGICAL_PHYSICAL",ue=(se,ne)=>{if(mn(se)){const me=i.state.logical.entities,P=me.find(D=>D.modelId===ne);return se.dbAttrs.map((D,z)=>{const Q=Kn(se,P,me,i.state.logical.associations,z);return Q?{...D,physicalName:D.physicalName||Q.physicalName,logicalName:D.logicalName??Q.logicalName,dataType:D.dataType||Q.dataType}:D})}if(se.attrType!=="EMBED_PREDEF")return se.dbAttrs;const ae=i.embeddableCatalog.value.find(me=>me.type===se.type);return ae?se.dbAttrs.map((me,P)=>{const D=ae.fields[P];return D?{...me,physicalName:me.physicalName||D.physicalName,logicalName:me.logicalName??D.logicalName,dataType:me.dataType||D.dataType,length:me.length??D.length}:me}):se.dbAttrs},be=(se,ne,ae)=>{var z,Q,ee,we,de,xe,Ce,Y,X;const me={entityId:ne,attrId:se.modelId};if(H(se)){const q=Yr(k,se,ae==null?void 0:ae.collection,ae==null?void 0:ae.targetName);return{key:`attr:${se.modelId}`,label:se.name+(q?` : ${q}`:""),icon:"table",attrRef:me,focusId:ne,matchText:Zo(se.name,(Q=(z=se.dbAttrs[0])==null?void 0:z.logicalName)==null?void 0:Q[v],(ee=se.dbAttrs[0])==null?void 0:ee.physicalName),children:oe?ue(se,ne).map(Ie=>{var Be,ze;return{key:`attr:${se.modelId}:col:${Ie.modelId}`,label:Ji(k,Ie.physicalName,(Be=Ie.logicalName)==null?void 0:Be[v],Ie.physicalName,i.t("em.node.logicalMissing"))+(Ie.dataType?` : ${Ie.dataType}`:""),icon:"field",attrRef:me,focusId:ne,matchText:Zo(Ie.physicalName,(ze=Ie.logicalName)==null?void 0:ze[v]),children:[]}}):[]}}const P=(ae==null?void 0:ae.collection)??na(se,i.state.logical.associations),D=Yr(k,se,P,ae==null?void 0:ae.targetName);return{key:`attr:${se.modelId}`,label:Ji(k,se.name,(de=(we=se.dbAttrs[0])==null?void 0:we.logicalName)==null?void 0:de[v],(xe=se.dbAttrs[0])==null?void 0:xe.physicalName,i.t("em.node.logicalMissing"))+(D?` : ${D}`:""),...A(se),attrRef:me,focusId:ne,matchText:Zo(se.name,(Y=(Ce=se.dbAttrs[0])==null?void 0:Ce.logicalName)==null?void 0:Y[v],(X=se.dbAttrs[0])==null?void 0:X.physicalName),children:[]}},pe=se=>{var Q,ee,we;const ne=se.entity,ae=k==="CLASS",P=ae||ne.attributes.some(mn)?ll(ne,i.state.logical):void 0,D=ae&&P?P.fields.map(de=>de.attr):[...ne.attributes].sort((de,xe)=>de.order-xe.order),z=new Map(((P==null?void 0:P.fields)??[]).filter(de=>(ae||mn(de.attr))&&(de.target||de.collection)).map(de=>{var xe;return[de.attr.modelId,{targetName:(xe=de.target)==null?void 0:xe.name,collection:de.collection}]}));return{key:`entity:${ne.modelId}`,label:I(ne),icon:"table",selectKind:"entity",selectId:ne.modelId,focusId:ne.modelId,matchText:Zo(ne.name,(ee=(Q=ne.table)==null?void 0:Q.logicalName)==null?void 0:ee[v],(we=ne.table)==null?void 0:we.physicalName),children:D.map(de=>be(de,ne.modelId,z.get(de.modelId)))}},he=new Map,_e=[];for(const se of M.entities)if(se.groupRef){const ne=he.get(se.groupRef)??[];ne.push(se),he.set(se.groupRef,ne)}else _e.push(se);const ye=[];for(const se of M.groups){const ne=se.group;ye.push({key:`group:${ne.modelId}`,label:((Ae=ne.name)==null?void 0:Ae[v])||((Fe=ne.name)==null?void 0:Fe.ko)||ne.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:ne.modelId,children:(he.get(ne.modelId)??[]).map(pe)})}for(const se of _e)ye.push(pe(se));if(M.associations.length){const se=new Map(M.entities.map(ne=>[ne.entity.modelId,I(ne.entity)]));ye.push({key:"section:associations",label:i.t("em.explorer.associations",{n:M.associations.length}),icon:"arrow-lr",children:M.associations.map(ne=>{const ae=ne.association,me=se.get(ae.end1.entityRef)??ae.end1.entityRef,P=se.get(ae.end2.entityRef)??ae.end2.entityRef;return{key:`assoc:${ae.modelId}`,label:`${me} — ${P}`,icon:"arrow-lr",selectKind:"association",selectId:ae.modelId,children:[]}})})}return M.notes.length&&ye.push({key:"section:notes",label:i.t("em.explorer.notes",{n:M.notes.length}),icon:"note",children:M.notes.map(({note:se})=>{var ne;return{key:`note:${se.modelId}`,label:((ne=se.memo.split(`
|
|
66
|
+
`)[0])==null?void 0:ne.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:se.modelId,focusId:se.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:ye}});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=[],k=v=>{if(v.children.length){v.key!=="root"&&M.push(v.key);for(const I of v.children)k(I)}};return k(r.value),M}),c=M=>M.startsWith("entity:")||M==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=Ch({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),y=t.ref(null),_=t.computed(()=>f.value.trim().length>0),g=t.computed(()=>{const M=[];if(_.value){const v=oM(r.value,f.value.trim().toLowerCase()),I=(O,A,L,H,oe)=>{if(!v.has(O.key))return;M.push({node:O,depth:A,parentKey:L,posinset:H,setsize:oe});const ue=O.children.filter(be=>v.has(be.key));ue.forEach((be,pe)=>I(be,A+1,O.key,pe+1,ue.length))};return I(r.value,0,null,1,1),M}const k=(v,I,O,A,L)=>{M.push({node:v,depth:I,parentKey:O,posinset:A,setsize:L}),d(v.key)||v.children.forEach((H,oe)=>k(H,I+1,v.key,oe+1,v.children.length))};return k(r.value,0,null,1,1),M}),b=t.ref(null),E=t.ref(null),h=t.computed(()=>{var k;const M=g.value;return E.value&&M.some(v=>v.node.key===E.value)?E.value:((k=M[0])==null?void 0:k.node.key)??null}),N=M=>!_.value&&d(M);async function w(M){var k,v;M&&(E.value=M,await t.nextTick(),(v=(k=b.value)==null?void 0:k.querySelector(`[data-key="${M}"]`))==null||v.focus())}function C(M,k){var O,A,L,H,oe;const v=g.value,I=v.findIndex(ue=>ue.node.key===k.node.key);switch(M.key){case"ArrowDown":M.preventDefault(),w((O=v[I+1])==null?void 0:O.node.key);return;case"ArrowUp":M.preventDefault(),w((A=v[I-1])==null?void 0:A.node.key);return;case"Home":M.preventDefault(),w((L=v[0])==null?void 0:L.node.key);return;case"End":M.preventDefault(),w((H=v[v.length-1])==null?void 0:H.node.key);return;case"ArrowRight":if(M.preventDefault(),!k.node.children.length)return;N(k.node.key)?u(k.node.key):w((oe=v[I+1])==null?void 0:oe.node.key);return;case"ArrowLeft":M.preventDefault(),k.node.children.length&&!N(k.node.key)?u(k.node.key):w(k.parentKey);return;case"Enter":case" ":M.preventDefault(),x(k.node,M);return;case"F2":M.preventDefault(),T(k.node)}}const S=t.computed(()=>_.value&&g.value.length<=1);function V(M){var I;if(M.key!=="/"||M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;const k=M.target,v=k==null?void 0:k.tagName;v==="INPUT"||v==="TEXTAREA"||v==="SELECT"||k!=null&&k.isContentEditable||(M.preventDefault(),(I=y.value)==null||I.focus())}t.onMounted(()=>window.addEventListener("keydown",V)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",V)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function $(M){const k=i.selection.value;return M.attrRef?(k==null?void 0:k.kind)==="attribute"&&k.entityId===M.attrRef.entityId&&k.ids.includes(M.attrRef.attrId):!!k&&k.kind!=="attribute"&&!!M.selectId&&M.selectKind===k.kind&&M.selectId===k.id}function R(M){const k=i.selection.value;return M.selectKind==="entity"&&(k==null?void 0:k.kind)==="attribute"&&k.entityId===M.selectId}function x(M,k){if(M.attrRef){const v=k.shiftKey?"range":k.metaKey||k.ctrlKey?"toggle":"replace";i.selectAttribute(M.attrRef.entityId,M.attrRef.attrId,v)}else M.selectKind&&M.selectId&&(i.selection.value={kind:M.selectKind,id:M.selectId});M.focusId&&i.requestFocus(M.focusId)}function T(M){M.selectKind==="entity"&&M.selectId&&lr(a,i,M.selectId)}return(M,k)=>(t.openBlock(),t.createElementBlock("section",$M,[t.createElementVNode("div",TM,[t.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":k[0]||(k[0]=v=>f.value=v),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:k[1]||(k[1]=t.withKeys(v=>f.value="",["esc"]))},null,40,MM),[[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:k[2]||(k[2]=v=>f.value="")},[t.createVNode(Ve,{name:"x",size:13})],8,VM)):t.createCommentVNode("",!0)]),S.value?(t.openBlock(),t.createElementBlock("p",BM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:b,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(g.value,v=>(t.openBlock(),t.createElementBlock("div",{key:v.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":$(v.node),"is-focus-parent":R(v.node),"is-selectable":!!v.node.selectKind||!!v.node.attrRef||!!v.node.focusId}]),"data-key":v.node.key,role:"treeitem","aria-level":v.depth+1,"aria-posinset":v.posinset,"aria-setsize":v.setsize,"aria-expanded":v.node.children.length?!N(v.node.key):void 0,"aria-selected":$(v.node),tabindex:v.node.key===h.value?0:-1,style:t.normalizeStyle({paddingLeft:4+v.depth*14+"px"}),onClick:I=>x(v.node,I),onDblclick:I=>T(v.node),onFocus:I=>E.value=v.node.key,onKeydown:I=>C(I,v)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!v.node.children.length,"is-open":!N(v.node.key)}]),onClick:t.withModifiers(I=>v.node.children.length&&t.unref(u)(v.node.key),["stop"])},[v.node.children.length?(t.openBlock(),t.createBlock(Ve,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,LM),v.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(v.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",zM,[v.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):v.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:v.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",FM,[v.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,PM)):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:v.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",UM,t.toDisplayString(v.node.label),1),l(v.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",HM,t.toDisplayString(l(v.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,OM))),128))],8,DM)]))}}),[["__scopeId","data-v-63b45532"]]),jM={class:"em-text-export"},KM=["id","aria-selected","tabindex","onClick"],GM=["aria-labelledby"],YM={class:"em-text-export__actions"},qM=tt(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(m,p)=>qt(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),te.showNotification(i("em.export.copied"),"info")}catch{te.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 y=document.createElement("a");y.href=f,y.download=m.filename,document.body.appendChild(y),y.click(),y.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",jM,[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,y)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${y}`,key:f.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:_=>a.value=y,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(_=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(_=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(_=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(_=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,KM))),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,GM),t.createElementVNode("div",YM,[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:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),WM={class:"em-text-import"},JM=["aria-label"],XM=["aria-checked","tabindex","onClick"],ZM=["placeholder"],QM={class:"em-text-import__status"},e2={class:"em-text-import__ok"},t2={key:0,class:"em-text-import__warn"},n2={key:1,class:"em-text-import__err"},o2={key:2,class:"em-text-import__err"},i2={key:3,class:"em-text-import__err"},a2={class:"em-text-import__actions"},r2=tt(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(_,g)=>qt(n.locale??"ko",_,g),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(_){var b,E;const g=l[(_+l.length)%l.length];g&&(r.value=g.key,await t.nextTick(),(E=(b=s.value)==null?void 0:b.querySelectorAll('[role="radio"]')[l.indexOf(g)])==null||E.focus())}function d(_){c(l.findIndex(g=>g.key===r.value)+_)}function u(_){return _?_.startsWith("{")?"json":/\berdiagram\b/i.test(_)?"mermaid":/\bcreate\s+table\b/i.test(_)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const _=a.value.trim();if(!_)return{status:"empty"};const g=m.value;if(!g)return{status:"unknown"};try{let b,E=[];return g==="json"?b=Rc(_):g==="mermaid"?b=Ec(_):(b=vc(_),E=qr(_).warnings),b.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:b,warnings:E}}catch(b){return{status:"error",message:b instanceof Error?b.message:String(b)}}}),f=t.computed(()=>p.value.status==="ok");function y(){const _=p.value;_.status!=="ok"||!_.source||(n.onImport(_.source),o.close())}return(_,g)=>(t.openBlock(),t.createBlock(t.unref(te.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,b=>t.createElementVNode("button",{key:b.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":b.key===r.value}]),"aria-checked":b.key===r.value,tabindex:b.key===r.value?0:-1,onClick:E=>r.value=b.key,onKeydown:[g[0]||(g[0]=t.withKeys(t.withModifiers(E=>d(-1),["prevent"]),["left"])),g[1]||(g[1]=t.withKeys(t.withModifiers(E=>d(1),["prevent"]),["right"])),g[2]||(g[2]=t.withKeys(t.withModifiers(E=>c(0),["prevent"]),["home"])),g[3]||(g[3]=t.withKeys(t.withModifiers(E=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(b.labelKey)),43,XM)),64))],8,JM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":g[4]||(g[4]=b=>a.value=b),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,ZM),[[t.vModelText,a.value]]),t.createElementVNode("div",QM,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",e2,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",t2," ⚠ "+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",n2,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",o2,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",i2,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",a2,[t.createVNode(t.unref(te.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:y},null,8,["caption","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:g[5]||(g[5]=b=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),l2={class:"em-toolbar"},s2=["title"],c2={class:"em-toolbar__mode"},Vh=tt(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(_=>_.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=zr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:qM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:lc(y,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Fr(y,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Fr(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:Cc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:xc(y,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:r2,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(_=>_.modelId))}}})}function f(){r.openModal({component:$h,bind:{locale:i.uiLocale.value}})}return(y,_)=>(t.openBlock(),t.createElementBlock("div",l2,[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,s2)):t.createCommentVNode("",!0),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:_[0]||(_[0]=g=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ve,{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:_[1]||(_[1]=g=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),_[9]||(_[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",c2,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":_[2]||(_[2]=g=>s.value=g),items:l,"value-provider":g=>g.v,"label-provider":g=>t.unref(i).t(g.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(Ve,{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:_[3]||(_[3]=g=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ve,{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:_[4]||(_[4]=g=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ve,{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(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),_[10]||(_[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:p},{left:t.withCtx(()=>[t.createVNode(Ve,{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(Ve,{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:_[5]||(_[5]=g=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ve,{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:_[6]||(_[6]=g=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),_[11]||(_[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(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:_[7]||(_[7]=g=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),_[8]||(_[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:f},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),d2=["title"],u2=["title"],m2=["disabled","aria-pressed"],f2=["disabled","aria-pressed"],p2=tt(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=>qt(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(Ve,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,d2)):(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(Ve,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,m2),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(Ve,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,f2)],10,u2))}}),[["__scopeId","data-v-2b5162b7"]]),h2=["disabled"],y2={class:"em-panel__sub"},g2={class:"em-nav"},b2={key:0,class:"em-nav__divider","aria-hidden":"true"},_2={key:1},k2=["onClick","onKeydown"],E2={class:"em-nav__name"},N2=["title"],w2={key:0,class:"em-panel__note"},I2=["data-attr-block"],v2={key:0,class:"em-embed-col__label"},C2={class:"em-attr__row"},S2=["title"],x2={key:1,class:"em-attr__row"},R2={key:2,class:"em-embed-cols"},A2={class:"em-embed-col"},$2={class:"em-embed-col__label"},T2={class:"em-attr__row"},M2={class:"em-attr__navhint"},V2={key:3,class:"em-attr__navhint"},B2={key:0,class:"em-attr__navhint"},D2={class:"em-attr__row"},O2={class:"em-attr__row"},L2=["title"],P2={class:"em-attr__flags"},z2={class:"em-attr__pii"},F2={class:"em-attr__pii"},U2={key:1,class:"em-attr__pii"},H2={key:2,class:"em-attr__pii em-attr__codetop"},j2={class:"em-multilang"},K2={key:5,class:"em-embed-cols"},G2={key:0,class:"em-attr__navhint"},Y2={class:"em-embed-col__label"},q2={class:"em-attr__row"},W2=["title"],J2=["title"],X2=["title"],Z2={class:"em-attr__row"},Q2={key:0,class:"em-embed-upd"},eV={key:1,class:"em-attr__navhint"},tV={class:"em-embed-upd"},nV={class:"em-embed-upd"},oV={class:"em-attr__flags"},iV={class:"em-multilang"},aV={class:"em-swatch__row em-attr__swatch"},rV=["title","onClick"],lV=["title","onClick"],sV={key:0,class:"em-attr__swatch-hint"},cV=tt(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,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:p,setRowName:f,assocFieldName:y,setAssocFieldName:_,nameLocked:g,nameLockedHint:b,isManagedFk:E,setNaturalId:h,setIdentifier:N,setTransient:w,dbLocked:C,fkDerived:S,fkOriginPhysical:V,typeValueOf:$,typeLabelOf:R,setAttrType:x,setAttrCustomType:T,setDb:M,scaleApplicable:k,scaleHint:v,setDbLogical:I,setAttrDescription:O,attrPiiValue:A,setAttrPii:L,predefinedCustomTypeCatalog:H,embeddableCatalog:oe,predefinedLabel:ue,groupCodeCatalog:be,attrGroupCodes:pe,attrCodeItems:he,codeValueOf:_e,codeLabelOf:ye,setAttrGroupCode:Ae,setAttrCode:Fe,setAttrDefaultValue:se,hasColumnSlots:ne,isMultiColFk:ae,setDbAt:me,setDbLogicalAt:P,colSlotMeta:D,fixedDataType:z,fixedLength:Q,fixedScale:ee,slotFixedHint:we,updatableItems:de,updatableLabel:xe,updatableValue:Ce,setUpdatableAt:Y,setUpdatable:X,insertableItems:q,insertableLabel:Ie,insertableValue:Be,setInsertableAt:ze,setInsertable:Ue,sharedItems:ie,sharedLabel:Se,sharedValue:je,setSharedAt:Ze,isShared:J,sharedPhysical:re}=Vf(o,()=>n.entityId),Ke=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Ge=>Ge.entityRef===i.value.modelId)??null:null),st=t.computed(()=>{var Ge;return((Ge=i.value)==null?void 0:Ge.attributes.filter(Xe=>Xe.attrType!=="DIVIDER"))??[]}),qe=t.computed(()=>{var Ge;return((Ge=i.value)==null?void 0:Ge.attributes)??[]}),nt=t.computed(()=>st.value.filter(Ge=>r.value.has(Ge.modelId)));function We(Ge){return{pk:Ge.identifier,fk:Ge.attrType.startsWith("RELATION")&&Ge.dbAttrs.length>0,required:Ge.notNull&&!Ge.identifier}}function K(Ge){const Xe=We(Ge),Z=[Xe.pk&&"PK",Xe.fk&&"FK",Xe.required&&"NOT NULL"].filter(Boolean);return Z.length?Z.join(" · "):void 0}function le(Ge,Xe){i.value&&o.selectAttribute(i.value.modelId,Ge.modelId,Xe.shiftKey?"range":Xe.metaKey||Xe.ctrlKey?"toggle":"replace")}function Re(Ge){var Xe,Z;return St((Z=(Xe=Ke.value)==null?void 0:Xe.attributeStyles)==null?void 0:Z[Ge.modelId])}function ke(Ge){return r.value.size>1&&r.value.has(Ge.modelId)}function U(Ge,Xe){if(!i.value)return;const Z=ke(Ge)?o.selectedAttrIds.value:[Ge.modelId];o.setAttributeSwatches(i.value.modelId,Z,Xe)}const bt=t.ref(void 0);function vt(Ge){if(!Ge||!i.value)return;const Xe=o.addPredefinedEmbed(i.value.modelId,Ge);Xe&&o.selectAttribute(i.value.modelId,Xe),bt.value=void 0}function ot(){if(!i.value)return;const Ge=o.addAttribute(i.value.modelId);Ge&&o.selectAttribute(i.value.modelId,Ge)}return(Ge,Xe)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",y2,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:st.value.length}))+" ",1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:ot},null,8,["caption"]),t.unref(oe).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":bt.value,items:t.unref(oe),"value-provider":Z=>Z.type,"label-provider":t.unref(ue),"onUpdate:modelValue":vt},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",g2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(qe.value,Z=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[Z.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",b2,[...Xe[0]||(Xe[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",_2,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Z.modelId)}]),role:"button",tabindex:"0",onClick:Rt=>le(Z,Rt),onKeydown:[t.withKeys(t.withModifiers(Rt=>le(Z,Rt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Rt=>le(Z,Rt),["prevent"]),["space"])]},[t.createElementVNode("span",E2,t.toDisplayString(Z.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:K(Z)},[We(Z).pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):We(Z).required?(t.openBlock(),t.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),We(Z).fk?(t.openBlock(),t.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,N2)],42,k2)]))],64))),128))]),st.value.length&&!nt.value.length?(t.openBlock(),t.createElementBlock("p",w2,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(nt.value,Z=>{var Rt,$t,Sn,At,ge,ft,xn,Zt,B,F;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.unref(u)(Z)?(t.openBlock(),t.createElementBlock("span",v2,t.toDisplayString(t.unref(o).t("em.attr.derivedIdField")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",C2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-name-${Z.modelId}`,width:"100%",disabled:t.unref(g)(Z),title:t.unref(g)(Z)?t.unref(b)(Z):t.unref(u)(Z)?t.unref(o).t("em.attr.derivedIdNote"):void 0,placeholder:t.unref(p)(Z),"model-value":t.unref(m)(Z),"onUpdate:modelValue":j=>t.unref(f)(Z,j)},null,8,["name","disabled","title","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.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(S)(Z),items:t.unref(_c)(Z.type,t.unref(H)),"value-provider":t.unref($),"label-provider":t.unref(R),"model-value":Z.type,"onUpdate:modelValue":j=>t.unref(x)(Z,j)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(E)(Z)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:j=>t.unref(o).removeAttribute(t.unref(i).modelId,Z.modelId)},null,8,["onClick"])],8,S2)]),Z.type===t.unref(hn)&&!t.unref(S)(Z)?(t.openBlock(),t.createElementBlock("div",x2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-customtype-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Z.customType??"","onUpdate:modelValue":j=>t.unref(T)(Z,j)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(u)(Z)?(t.openBlock(),t.createElementBlock("div",R2,[t.createElementVNode("div",A2,[t.createElementVNode("span",$2,t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("div",T2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-assocname-${Z.modelId}`,width:"100%",title:t.unref(o).t("em.attr.derivedIdNote"),placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(y)(Z),"onUpdate:modelValue":j=>t.unref(_)(Z,j)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("p",M2,t.toDisplayString(t.unref(o).t("em.attr.derivedIdNote")),1)])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",V2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ne)(Z)?(t.openBlock(),t.createElementBlock("div",K2,[t.unref(ae)(Z)?(t.openBlock(),t.createElementBlock("p",G2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.dbAttrs,(j,fe)=>{var Te,Oe,ce,Le,Ye,Je,ut,G;return t.openBlock(),t.createElementBlock("div",{key:j.modelId,class:"em-embed-col"},[t.createElementVNode("span",Y2,t.toDisplayString(((Te=t.unref(D)(Z,fe))==null?void 0:Te.name)??((Oe=t.unref(D)(Z,fe))==null?void 0:Oe.physicalName)??t.unref(o).t("em.attr.colFallback",{n:fe+1})),1),t.createElementVNode("div",q2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`embed-col-${j.modelId}`,width:"100%",disabled:t.unref(J)(j),placeholder:((ce=t.unref(D)(Z,fe))==null?void 0:ce.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(J)(j)?t.unref(re)(j):j.physicalName,"onUpdate:modelValue":W=>t.unref(me)(Z,fe,{physicalName:W})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(we)(Z)},[t.createVNode(t.unref(te.BSTextInput),{name:`embed-dtype-${j.modelId}`,width:"84px",disabled:"","model-value":t.unref(z)(Z,fe)},null,8,["name","model-value"])],8,W2),t.createElementVNode("span",{title:t.unref(we)(Z)},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-len-${j.modelId}`,width:"48px",disabled:"","model-value":t.unref(Q)(Z,fe)},null,8,["name","model-value"])],8,J2),t.createElementVNode("span",{title:t.unref(we)(Z)},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-scale-${j.modelId}`,width:"48px",disabled:"","model-value":t.unref(ee)(Z,fe)},null,8,["name","model-value"])],8,X2)]),t.createVNode(fo,{controller:t.unref(o),"ref-id":j.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",Z2,[t.createVNode(Yt,{class:"grow",name:`embed-logical-${j.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Ye=(Le=t.unref(D)(Z,fe))==null?void 0:Le.logicalName)==null?void 0:Ye[t.unref(o).userLanguage.value])??((ut=(Je=t.unref(D)(Z,fe))==null?void 0:Je.logicalName)==null?void 0:ut.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":j.logicalName,"onUpdate:modelValue":W=>t.unref(P)(Z,fe,W)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(G=t.unref(D)(Z,fe))!=null&&G.shareable?(t.openBlock(),t.createElementBlock("label",Q2,[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(je)(j),items:t.unref(ie)(),"value-provider":t.unref(c),"label-provider":t.unref(Se),"onUpdate:modelValue":W=>W&&t.unref(Ze)(Z,fe,W)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(J)(j)?(t.openBlock(),t.createElementBlock("p",eV,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",tV,[Xe[3]||(Xe[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(J)(j),"model-value":t.unref(J)(j)?"false":t.unref(Be)(j),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":W=>W&&t.unref(ze)(Z,fe,W)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",nV,[Xe[4]||(Xe[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(J)(j),"model-value":t.unref(J)(j)?"false":t.unref(Ce)(j),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":W=>W&&t.unref(Y)(Z,fe,W)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128)),t.unref(ae)(Z)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",oV,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:"","onUpdate:modelValue":j=>t.unref(N)(Z,j)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:"","onUpdate:modelValue":j=>t.unref(d)(Z,{notNull:j})},null,8,["name","model-value","onUpdate:modelValue"])]),t.createElementVNode("fieldset",iV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{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":j=>t.unref(O)(Z,j)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[t.unref(S)(Z)?(t.openBlock(),t.createElementBlock("p",B2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",D2,[t.createVNode(Yt,{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":(Rt=Z.dbAttrs[0])==null?void 0:Rt.logicalName,"onUpdate:modelValue":j=>t.unref(I)(Z,j)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",O2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(V)(Z)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(C)(Z),"model-value":(($t=Z.dbAttrs[0])==null?void 0:$t.physicalName)??"","onUpdate:modelValue":j=>t.unref(M)(Z,{physicalName:j})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-dtype-${Z.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(C)(Z)||t.unref(S)(Z),items:t.unref(yc)(((Sn=Z.dbAttrs[0])==null?void 0:Sn.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(jr),"model-value":((At=Z.dbAttrs[0])==null?void 0:At.dataType)??"","onUpdate:modelValue":j=>j&&t.unref(M)(Z,{dataType:j})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSNumberInput),{name:`attr-len-${Z.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(C)(Z)||t.unref(S)(Z),"model-value":(ge=Z.dbAttrs[0])==null?void 0:ge.length,"onUpdate:modelValue":j=>t.unref(M)(Z,{length:j||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(v)(Z)},[t.createVNode(t.unref(te.BSNumberInput),{name:`attr-scale-${Z.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(C)(Z)||t.unref(S)(Z)||!t.unref(k)(Z),"model-value":(ft=Z.dbAttrs[0])==null?void 0:ft.scale,"onUpdate:modelValue":j=>t.unref(M)(Z,{scale:j||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,L2)]),t.createVNode(fo,{controller:t.unref(o),"ref-id":(xn=Z.dbAttrs[0])==null?void 0:xn.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",P2,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:t.unref(a)||t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(N)(Z,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(d)(Z,{notNull:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-uq-${Z.modelId}`,label:"Unique","model-value":!!((Zt=Z.dbAttrs[0])!=null&&Zt.unique),disabled:t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(M)(Z,{unique:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-ai-${Z.modelId}`,label:"Auto Increment","model-value":!!((B=Z.dbAttrs[0])!=null&&B.autoIncrement),disabled:t.unref(C)(Z)||t.unref(S)(Z)||!Z.identifier,"onUpdate:modelValue":j=>t.unref(M)(Z,{autoIncrement:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-tr-${Z.modelId}`,label:"@Transient","model-value":!!Z.transient,disabled:Z.identifier||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(w)(Z,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(h)(Z,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Z.modelId}`,label:"mutable","model-value":!!Z.naturalIdMutable,disabled:t.unref(C)(Z)||!Z.naturalId,"onUpdate:modelValue":j=>t.unref(d)(Z,{naturalIdMutable:j||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-mv-${Z.modelId}`,label:"Multi-Value (Set)","model-value":!!((F=Z.dbAttrs[0])!=null&&F.multiValue),disabled:t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(M)(Z,{multiValue:j||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",z2,[Xe[1]||(Xe[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(C)(Z),"model-value":t.unref(Be)(Z.dbAttrs[0]),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":j=>j&&t.unref(Ue)(Z,j)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",F2,[Xe[2]||(Xe[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(C)(Z),"model-value":t.unref(Ce)(Z.dbAttrs[0]),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":j=>j&&t.unref(X)(Z,j)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(S)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",U2,[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(A)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":j=>j&&t.unref(L)(Z,j)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(be).length&&!t.unref(S)(Z)?(t.openBlock(),t.createElementBlock("label",H2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Pf,{"model-value":Z.groupCode,items:t.unref(be),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":j=>t.unref(Ae)(Z,j)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(S)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(be).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(pe)(Z).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"100%","model-value":Z.defaultValue??"none",items:t.unref(he)(Z),"value-provider":t.unref(_e),"label-provider":t.unref(ye),"onUpdate:modelValue":j=>j&&t.unref(Fe)(Z,j)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`attr-default-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Z.defaultValue??"","onUpdate:modelValue":j=>t.unref(se)(Z,j)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",j2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{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":j=>t.unref(O)(Z,j)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",aV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Re(Z)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:j=>U(Z,null)},"∅",10,rV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),j=>(t.openBlock(),t.createElementBlock("button",{key:j,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Re(Z)===j}]),style:t.normalizeStyle({background:t.unref(jo)(j)}),title:t.unref(o).t(t.unref(mo)(j)),onClick:fe=>U(Z,j)},null,14,lV))),128)),ke(Z)?(t.openBlock(),t.createElementBlock("span",sV,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,I2)}),128))],8,h2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-af496d06"]]),dV=["disabled"],uV={class:"em-panel__sub-label"},mV={class:"em-attr__row"},fV={class:"em-field em-idx-params"},pV=["value","placeholder","onChange"],hV=tt(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(w=>w.modelId===o.entityId)??null),l=t.computed(()=>r.value?Qo(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var w;return Hn(((w=r.value)==null?void 0:w.attributes)??[])}),c=w=>s.value.canon(w),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 w;return[...(((w=r.value)==null?void 0:w.attributes)??[]).filter(C=>C.dbAttrs.length>0).map(C=>({value:C.modelId,label:Hf(C,d.value)})),...l.value.map(C=>({value:C.modelId,label:a.t("em.index.inherited",{field:C.field})}))]});function m(w,C){var R;const S=new Set(w.columns.filter((x,T)=>T!==C).map(x=>c(x.columnRef))),V=u.value.filter(x=>!S.has(c(x.value))),$=(R=w.columns[C])==null?void 0:R.columnRef;return $&&!V.some(x=>x.value===$)&&V.push({value:$,label:p($)}),V}function p(w){return jf(w,d.value)}function f(w){const C=new Set(w.columns.map(S=>c(S.columnRef)));return u.value.filter(S=>!C.has(c(S.value)))}function y(){var C;if(!r.value)return;const w=u.value[0];a.addIndex(r.value.modelId,{modelId:Pe(),name:`idx_${(((C=r.value.indexes)==null?void 0:C.length)??0)+1}`,unique:!1,columns:w?[{columnRef:w.value,descending:!1}]:[]})}function _(w,C){r.value&&a.updateIndex(r.value.modelId,w,C)}function g(w){const C=f(w)[0];C&&_(w.modelId,{columns:[...w.columns,{columnRef:C.value,descending:!1}]})}function b(w,C,S){_(w.modelId,{columns:w.columns.map((V,$)=>$===C?{...V,columnRef:S}:V)})}function E(w,C,S){_(w.modelId,{columns:w.columns.map((V,$)=>$===C?{...V,descending:S}:V)})}function h(w,C){_(w.modelId,{columns:w.columns.filter((S,V)=>V!==C)})}function N(w,C){_(w.modelId,{parameters:C.trim()===""?void 0:C})}return(w,C)=>{var S;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:C[0]||(C[0]=V=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",uV,[e.collapsible?(t.openBlock(),t.createBlock(Ve,{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:((S=r.value.indexes)==null?void 0:S.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??[],V=>(t.openBlock(),t.createElementBlock("div",{key:V.modelId,class:"em-attr"},[t.createElementVNode("div",mV,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`idx-name-${V.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":$=>_(V.modelId,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-uq-${V.modelId}`,class:"em-check",label:"UQ","model-value":V.unique,"onUpdate:modelValue":$=>_(V.modelId,{unique:$})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>t.unref(a).removeIndex(r.value.modelId,V.modelId)},null,8,["onClick"])]),t.createVNode(fo,{controller:t.unref(a),"ref-id":V.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.columns,($,R)=>(t.openBlock(),t.createElementBlock("div",{key:R,class:"em-attr__row"},[t.createVNode(t.unref(te.BSSelect),{class:"grow","model-value":$.columnRef,items:m(V,R),"value-provider":x=>x.value,"label-provider":x=>x.label,"onUpdate:modelValue":x=>x&&b(V,R,x)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-${V.modelId}-desc-${R}`,class:"em-check",label:"DESC","model-value":$.descending,"onUpdate:modelValue":x=>E(V,R,x)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:"−",onClick:x=>h(V,R)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(V).length,onClick:$=>g(V)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",fV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:V.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:$=>N(V,$.target.value)},null,40,pV)])]))),128)):t.createCommentVNode("",!0)],8,dV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),yV=["disabled"],gV={class:"em-panel__sub-label"},bV={class:"em-attr__row"},_V={class:"em-attr__row"},kV={class:"em-multilang"},EV={class:"em-attr__pii"},NV={class:"em-swatch__row em-attr__swatch"},wV=["title","onClick"],IV=["title","onClick"],vV=tt(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(h=>h.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(h=>h.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(h){return h==="none"?a.t("em.common.noneParen"):h}const m=h=>h;function p(h,N){l.value&&a.updateOperation(l.value.modelId,h.modelId,N)}function f(h,N){p(h,{description:Object.keys(N).length?N:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function _(h,N){p(h,{personalInfoAttributeType:N==="none"?void 0:N})}function g(h){var N,w;return St((w=(N=s.value)==null?void 0:N.operationStyles)==null?void 0:w[h.modelId])}function b(h,N){l.value&&a.setOperationSwatch(l.value.modelId,h.modelId,N)}function E(h){r.openModal({component:Kf,bind:{operationName:h.name,sourceCode:h.sourceCode??"",locale:a.uiLocale.value,onSave:N=>p(h,{sourceCode:N})}})}return(h,N)=>{var w;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]=C=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",gV,[e.collapsible?(t.openBlock(),t.createBlock(Ve,{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:((w=l.value.operations)==null?void 0:w.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(C=>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??[],C=>(t.openBlock(),t.createElementBlock("div",{key:C.modelId,class:"em-attr"},[t.createElementVNode("div",bV,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`op-name-${C.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":C.name,"onUpdate:modelValue":S=>p(C,{name:S})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{width:"96px","model-value":C.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":S=>S&&p(C,{visibility:S})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:S=>t.unref(a).removeOperation(l.value.modelId,C.modelId)},null,8,["onClick"])]),t.createElementVNode("div",_V,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t(C.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:S=>E(C)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",kV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`op-desc-${C.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":C.description,"onUpdate:modelValue":S=>f(C,S)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",EV,[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(C),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":S=>S&&_(C,S)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",NV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(C)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:S=>b(C,null)},"∅",10,wV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),S=>(t.openBlock(),t.createElementBlock("button",{key:S,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":g(C)===S}]),style:t.normalizeStyle({background:t.unref(jo)(S)}),title:t.unref(a).t(t.unref(mo)(S)),onClick:V=>b(C,S)},null,14,IV))),128))])]))),128)):t.createCommentVNode("",!0)],8,yV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),CV=["title"],SV={class:"em-panel__head"},xV={class:"em-panel__head-row"},RV=["title"],AV={class:"em-panel__context"},$V={key:0,class:"em-panel__lock"},TV=["disabled"],MV={key:0,class:"em-panel__note"},VV={key:1,class:"em-panel__note"},BV={key:2,class:"em-jpa"},DV={class:"em-field"},OV={class:"em-field"},LV={class:"em-field"},PV={key:0,class:"em-field"},zV={class:"em-panel__note"},FV={class:"em-panel__sub"},UV={class:"em-field"},HV={class:"em-field"},jV={class:"em-jpa"},KV={key:0,class:"em-panel__note"},GV={key:1,class:"em-panel__note"},YV={class:"em-jpa"},qV={class:"em-field"},WV={key:0,class:"em-panel__note"},JV={class:"em-field"},XV={class:"em-multilang"},ZV={class:"em-field"},QV=["value"],eB={class:"em-field"},tB={class:"em-swatch"},nB={class:"em-swatch__row"},oB=["title"],iB=["title","onClick"],aB={class:"em-panel__note"},rB={class:"em-field"},lB=["value"],sB={class:"em-swatch"},cB={class:"em-swatch__row"},dB=["title"],uB=["title","onClick"],Bh=tt(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(X=>X.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 X=c.value;return!!X&&l.isEntityLocked(X)}),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),y=t.ref({});t.watch(f,()=>{y.value={}});function _(Y){return y.value[Y]??f.value}function g(Y){y.value={...y.value,[Y]:!_(Y)}}const b=t.computed(()=>{var q;const Y=d.value;if(!Y)return l.t("em.entity.fallback");const X=(q=Y.table)==null?void 0:q.physicalName;return X?`${Y.name} (${X})`:Y.name}),E=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="association"?l.state.logical.associations.find(X=>X.modelId===Y.id)??null:null}),h=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="group"?l.state.logical.groups.find(X=>X.modelId===Y.id)??null:null}),N=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="note"?l.state.layout.notes.find(X=>X.modelId===Y.id)??null:null}),w=t.computed(()=>{var X,q;const Y=(X=h.value)==null?void 0:X.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)||((q=h.value)==null?void 0:q.packageName)||l.t("em.group.fallback")}),C=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 X=d.value.attributes.find(q=>q.modelId===m.value);return(X==null?void 0:X.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(X==null?void 0:X.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(E.value){const Y=X=>{var q;return((q=l.state.logical.entities.find(Ie=>Ie.modelId===X))==null?void 0:q.name)??X};return l.t("em.inspector.ctxAssoc",{a:Y(E.value.end1.entityRef),b:Y(E.value.end2.entityRef)})}return h.value?l.t("em.inspector.ctxGroup",{name:w.value}):N.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),S=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],V=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],$={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},R=Y=>{const X=$[Y];return X?l.t(X):Y},x=Y=>{var X;return((X=l.state.logical.entities.find(q=>q.modelId===Y))==null?void 0:X.name)??Y},T=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],M=["LIST","SET"],k=["inherit","LAZY","EAGER"],v=Y=>Y;function I(Y){return Y==="inherit"?l.t("em.common.inherit"):Y}const O=t.computed(()=>!!E.value&&E.value.end1.entityRef===E.value.end2.entityRef);function A(Y,X){E.value&&l.updateAssociationEnd(E.value.modelId,Y,X)}function L(Y){return ne.value?Y:Y==="end1"?"end2":"end1"}function H(Y){var Be;const X=(Be=E.value)==null?void 0:Be[Y];if(!(X!=null&&X.attributeRef))return;const q=l.state.logical.entities.find(ze=>ze.modelId===X.entityRef),Ie=q==null?void 0:q.attributes.find(ze=>ze.modelId===X.attributeRef);return Ie&&(Ie.attrType==="RELATION_OWN"||Ie.attrType==="RELATION_REF")?Ie.name:void 0}function oe(Y,X){var Ie;const q=(Ie=E.value)==null?void 0:Ie[Y];q!=null&&q.attributeRef&&l.updateAttribute(q.entityRef,q.attributeRef,{name:X})}function ue(Y){var ze;const X=H(Y);if(X!==void 0)return X;const q=(ze=E.value)==null?void 0:ze[Y];if(q!=null&&q.navFieldNameHint)return q.navFieldNameHint;const Ie=Y==="end1"?"end2":"end1",Be=l.state.logical.entities.find(Ue=>{var ie;return Ue.modelId===((ie=E.value)==null?void 0:ie[Ie].entityRef)});return Be?ta(Be.name,Qi(E.value[Ie].multiplicity)):""}function be(Y){return!!ne.value||H(Y)!==void 0}function pe(Y){E.value&&!O.value&&l.setAssociationIdentifying(E.value.modelId,Y)}function he(Y){var X,q,Ie;return!!((Ie=(q=(X=E.value)==null?void 0:X[Y].jpa)==null?void 0:q.cascadeTypes)!=null&&Ie.includes("ALL"))}function _e(Y,X,q){var ze,Ue;const Ie=(ze=E.value)==null?void 0:ze[Y];if(X==="ALL"&&q){A(Y,{jpa:{...Ie==null?void 0:Ie.jpa,cascadeTypes:["ALL"]}});return}const Be=new Set(((Ue=Ie==null?void 0:Ie.jpa)==null?void 0:Ue.cascadeTypes)??[]);q?Be.add(X):Be.delete(X),A(Y,{jpa:{...Ie==null?void 0:Ie.jpa,cascadeTypes:[...Be]}})}function ye(Y,X){var Ie;const q=(Ie=E.value)==null?void 0:Ie[Y];A(Y,{jpa:{...q==null?void 0:q.jpa,...X}})}function Ae(Y){var X,q;return((q=(X=E.value)==null?void 0:X[Y].jpa)==null?void 0:q.fetchType)??"inherit"}function Fe(Y,X){ye(Y,{fetchType:X==="inherit"?void 0:X})}function se(Y){var q;const X=(q=E.value)==null?void 0:q[Y==="end1"?"end2":"end1"];return(X==null?void 0:X.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(X==null?void 0:X.multiplicity)==="ONE_OR_MORE_INSTANCES"}const ne=t.computed(()=>{const Y=E.value;if(!Y)return null;for(const X of l.state.logical.entities){const q=X.attributes.find(Ue=>{var ie;return((ie=Ue.embedded)==null?void 0:ie.associationRef)===Y.modelId&&Ue.attrType==="EMBED_OWN"});if(!q)continue;const Ie=Y.end2.entityRef===q.embedded.embeddableRef?"end2":"end1",Be=Y[Ie].multiplicity,ze=Y[Ie].jpa;return{which:Ie,cardinality:Be,isCollection:Be==="ZERO_OR_MORE_INSTANCES"||Be==="ONE_OR_MORE_INSTANCES",collectionType:(ze==null?void 0:ze.collectionType)??"LIST",collectionTable:(ze==null?void 0:ze.collectionTable)??"",orderColumn:(ze==null?void 0:ze.orderColumn)??""}}return null});function ae(Y){E.value&&l.setEmbedCardinality(E.value.modelId,Y)}function me(Y){const X=ne.value;X&&ye(X.which,Y==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function P(Y){const X=ne.value;X&&ye(X.which,{collectionTable:Y.trim()||void 0})}function D(Y){const X=ne.value;X&&ye(X.which,{orderColumn:Y.trim()||void 0})}function z(Y){h.value&&l.updateGroup(h.value.modelId,Y)}function Q(Y,X){var q;z({name:{...(q=h.value)==null?void 0:q.name,[Y]:X}})}const ee=t.computed(()=>{var Y;return h.value?St((Y=l.state.layout.groupLayouts.find(X=>X.groupRef===h.value.modelId))==null?void 0:Y.style):null});function we(Y){h.value&&l.setGroupSwatch(h.value.modelId,Y)}function de(Y){N.value&&l.setNoteMemo(N.value.modelId,Y)}const xe=t.computed(()=>{var Y;return St((Y=N.value)==null?void 0:Y.style)});function Ce(Y){N.value&&l.setNoteSwatch(N.value.modelId,Y)}return(Y,X)=>(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:X[0]||(X[0]=(...q)=>e.startResize&&e.startResize(...q))},null,42,CV),t.createElementVNode("header",SV,[t.createElementVNode("div",xV,[X[14]||(X[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:X[1]||(X[1]=q=>a("collapse"))},[t.createVNode(Ve,{name:"panel-right-close",size:16})],8,RV)]),t.createElementVNode("p",AV,t.toDisplayString(C.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",$V,[t.createVNode(Ve,{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:X[2]||(X[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(Tf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("basics"),title:b.value,onToggle:X[3]||(X[3]=q=>g("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(cV,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(hV,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("index"),onToggle:X[4]||(X[4]=q=>g("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(vV,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("ops"),onToggle:X[5]||(X[5]=q=>g("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),E.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":!!E.value.identifying,disabled:O.value||!!ne.value,"onUpdate:modelValue":pe},null,8,["label","model-value","disabled"]),O.value?(t.openBlock(),t.createElementBlock("p",MV,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):ne.value?(t.openBlock(),t.createElementBlock("p",VV,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),ne.value?(t.openBlock(),t.createElementBlock("fieldset",BV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",DV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":ne.value.cardinality,items:V,"value-provider":v,"label-provider":R,"onUpdate:modelValue":X[6]||(X[6]=q=>q&&ae(q))},null,8,["model-value"])]),ne.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",OV,[X[15]||(X[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(te.BSSelect),{"model-value":ne.value.collectionType,items:M,"value-provider":v,"label-provider":v,"onUpdate:modelValue":X[7]||(X[7]=q=>q&&me(q))},null,8,["model-value"])]),t.createElementVNode("label",LV,[X[16]||(X[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":ne.value.collectionTable,"onUpdate:modelValue":P},null,8,["placeholder","model-value"])]),ne.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",PV,[X[17]||(X[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":ne.value.orderColumn,"onUpdate:modelValue":D},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",zV,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 Ie,Be,ze;return t.withDirectives(t.createElementVNode("div",{key:q,class:"em-end"},[t.createElementVNode("h4",FV,t.toDisplayString(q)+" → "+t.toDisplayString(x(E.value[q].entityRef)),1),ne.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",UV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":E.value[q].multiplicity,items:S,"value-provider":v,"label-provider":t.unref(ea),"onUpdate:modelValue":Ue=>A(q,{multiplicity:Ue})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${L(q)}-navigable`,class:"em-check",label:"navigable",title:L(q)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:L(q)==="end2","model-value":L(q)==="end2"?!0:E.value[L(q)].navigable,"onUpdate:modelValue":Ue=>A(L(q),{navigable:Ue})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",HV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(te.BSTextInput),{name:`${L(q)}-navname`,width:"100%",disabled:!be(L(q)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":ue(L(q)),"onUpdate:modelValue":Ue=>oe(L(q),Ue)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${L(q)}-composition`,class:"em-check",label:"composition","model-value":E.value[L(q)].composition,"onUpdate:modelValue":Ue=>A(L(q),{composition:Ue})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",jV,[X[18]||(X[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(T,Ue=>{var ie,Se;return t.createVNode(t.unref(te.BSCheckbox),{key:Ue,name:`${L(q)}-cascade-${Ue}`,class:"em-check",label:Ue,"model-value":!!((Se=(ie=E.value[L(q)].jpa)==null?void 0:ie.cascadeTypes)!=null&&Se.includes(Ue)),disabled:!be(L(q))||Ue!=="ALL"&&he(L(q)),"onUpdate:modelValue":je=>_e(L(q),Ue,je)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),be(L(q))?he(L(q))?(t.openBlock(),t.createElementBlock("p",GV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",KV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",YV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",qV,[X[19]||(X[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(te.BSSelect),{disabled:!be(L(q)),"model-value":Ae(L(q)),items:k,"value-provider":v,"label-provider":I,"onUpdate:modelValue":Ue=>Ue&&Fe(L(q),Ue)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${L(q)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Ie=E.value[L(q)].jpa)!=null&&Ie.orphanRemoval),disabled:!be(L(q))||se(q),"onUpdate:modelValue":Ue=>ye(L(q),{orphanRemoval:Ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),se(q)&&((Be=E.value[L(q)].jpa)!=null&&Be.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",WV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",JV,[X[20]||(X[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(te.BSTextInput),{name:`${L(q)}-orderby`,width:"100%",disabled:!be(L(q)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((ze=E.value[L(q)].jpa)==null?void 0:ze.orderBy)??"","onUpdate:modelValue":Ue=>ye(L(q),{orderBy:Ue.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!ne.value||q===ne.value.which]])}),64))],64)):t.createCommentVNode("",!0),h.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",XV,[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 Ie;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":((Ie=h.value.name)==null?void 0:Ie[q])??"","onUpdate:modelValue":Be=>Q(q,Be)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",ZV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:h.value.description??"",rows:"3",onChange:X[8]||(X[8]=q=>z({description:q.target.value}))},null,40,QV)]),t.createElementVNode("label",eB,[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":h.value.packageName??"","onUpdate:modelValue":X[9]||(X[9]=q=>z({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":h.value.excludeDDLGeneration,"onUpdate:modelValue":X[10]||(X[10]=q=>z({excludeDDLGeneration:q}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",tB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",nB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ee.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:X[11]||(X[11]=q=>we(null))},"∅",10,oB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),q=>(t.openBlock(),t.createElementBlock("button",{key:q,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ee.value===q}]),style:t.normalizeStyle({background:t.unref(jo)(q)}),title:t.unref(l).t(t.unref(mo)(q)),onClick:Ie=>we(q)},null,14,iB))),128))])]),t.createElementVNode("p",aB,t.toDisplayString(t.unref(l).t("em.group.members",{n:h.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",rB,[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:X[12]||(X[12]=q=>de(q.target.value))},null,40,lB)]),t.createElementVNode("fieldset",sB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",cB,[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:X[13]||(X[13]=q=>Ce(null))},"∅",10,dB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),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(jo)(q)}),title:t.unref(l).t(t.unref(mo)(q)),onClick:Ie=>Ce(q)},null,14,uB))),128))])])],64)):t.createCommentVNode("",!0)],8,TV)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),mB=["title"],fB={class:"em-validation__title"},pB=["title","onClick"],hB={key:0,class:"em-validation__body"},yB={class:"em-validation__opt"},gB={key:0,class:"em-validation__empty"},bB={key:1,class:"em-validation__empty"},_B={key:2,class:"em-validation__list"},kB=["onClick"],EB={class:"em-validation__item-msg"},NB={key:0,class:"em-validation__item-entity"},wB=["title","onClick"],IB=["title"],vB=tt(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 _=new Map;for(const g of o.state.logical.entities)_.set(g.modelId,g.name);return _});function r(_){const g=Pw(_);if(!g)return null;const b=a.value.get(g);return b===void 0?null:b.trim()===""?o.t("em.validation.nameless"):b}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 _={error:0,warning:0,info:0};for(const g of i.value)_[g.severity]++;return _}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(_=>c.value[_.severity]).slice().sort((_,g)=>l[_.severity].order-l[g.severity].order)),u=t.computed(()=>d.value.map(_=>({issue:_,entityName:r(_),message:$f(o.t,_),category:Ow(o.t,_.ruleId)}))),m=t.ref(!1);function p(_){c.value[_]=!c.value[_]}function f(_){if(!m.value){m.value=!0;return}p(_)}function y(_){_.targetRef&&o.requestFocus(_.targetRef)}return(_,g)=>(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:g[1]||(g[1]=b=>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(Ve,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",fB,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,mB),t.createElementVNode("div",{class:"em-validation__counts",onClick:g[0]||(g[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],b=>t.createElementVNode("button",{key:b,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!c.value[b]}]]),title:m.value?t.unref(o).t(c.value[b]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[b].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:E=>f(b)},[t.createVNode(Ve,{name:l[b].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[b]),1)],10,pB)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",hB,[t.createElementVNode("label",yB,[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":g[2]||(g[2]=b=>t.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",gB,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",bB,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",_B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:b,entityName:E,message:h,category:N},w)=>(t.openBlock(),t.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${w}`,class:t.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:C=>y(b)},[t.createVNode(Ve,{name:l[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",EB,[E?(t.openBlock(),t.createElementBlock("span",NB,t.toDisplayString(E),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(h),1)]),t.unref(o).hasQuickFix(b)?(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(C=>t.unref(o).applyQuickFix(b),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,wB)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},t.toDisplayString(N),9,IB)],10,kB))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),CB={class:"em-history"},SB={class:"em-history__head"},xB={class:"em-history__title"},RB={class:"em-history__head-actions"},AB=["title","disabled"],$B=["title"],TB={class:"em-history__filters"},MB={class:"em-history__filter"},VB={class:"em-history__filters em-history__filters--period"},BB={class:"em-history__filter-label"},DB=["title","aria-label","max"],OB=["title","aria-label","min"],LB=["title"],PB={key:0,class:"em-history__diffbar"},zB={class:"em-history__diffbar-range"},FB={class:"em-history__diffbar-count"},UB={class:"em-history__body"},HB={key:0,class:"em-history__empty"},jB={key:1,class:"em-history__diff-list"},KB=["onClick"],GB={class:"em-history__action-head"},YB={class:"em-history__action-name"},qB={key:0,class:"em-history__fields"},WB={class:"em-history__fname"},JB={key:0,class:"em-history__old"},XB={class:"em-history__val"},ZB={key:1,class:"em-history__empty"},QB={key:2,class:"em-history__empty is-error"},eD={key:3,class:"em-history__empty"},tD={key:4,class:"em-history__list"},nD=["onClick"],oD={class:"em-history__summary"},iD={class:"em-history__seq"},aD={class:"em-history__gmeta"},rD={class:"em-history__who"},lD={key:0,class:"em-history__time"},sD={key:1,class:"em-history__restored-from"},cD=["onClick"],dD={key:0,class:"em-history__detail"},uD={class:"em-history__action-head"},mD={class:"em-history__action-name"},fD={key:0,class:"em-history__fields"},pD={class:"em-history__fname"},hD={key:0,class:"em-history__old"},yD={class:"em-history__val"},gD={class:"em-history__preview"},bD=["disabled"],_D={key:0,class:"em-history__diff-list is-preview"},kD={class:"em-history__action-head"},ED={class:"em-history__action-name"},ND={key:0,class:"em-history__fields"},wD={class:"em-history__fname"},ID={key:0,class:"em-history__old"},vD={class:"em-history__val"},CD={class:"em-history__confirm-row"},SD={class:"em-history__confirm-msg"},xD=["disabled","onClick"],RD=["disabled"],AD=["onClick"],Tr=50,$D=tt(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((ie,Se)=>Se.seq>ie?Se.seq:ie,-1/0));async function u(ie){if(a.historyTransport){l.value=!0,s.value=null;try{const Se=!(ie!=null&&ie.full)&&r.value.length>0&&Number.isFinite(d.value),je=await a.historyTransport(Se?d.value:void 0);if(!Se)r.value=je;else if(je.length){const Ze=new Set(r.value.map(re=>re.seq)),J=je.filter(re=>!Ze.has(re.seq));J.length&&(r.value=[...r.value,...J])}c.value=!0}catch(Se){s.value=Se instanceof Error?Se.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,ie=>{ie?m():(p.value=null,f.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 _=t.computed(()=>new Map(a.state.logical.entities.map(ie=>[ie.modelId,ie]))),g=t.computed(()=>new Map(a.state.logical.associations.map(ie=>[ie.modelId,ie]))),b=t.computed(()=>{const ie=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(Se=>{var je,Ze;return[Se.modelId,Se.packageName||((je=Se.name)==null?void 0:je[ie])||((Ze=Se.name)==null?void 0:Ze.ko)||Se.modelId]}))});function E(ie){var J,re,Ke,st,qe,nt,We;const Se=g.value.get(ie);if(!Se)return a.t("em.history.assocFallback");if((J=Se.description)!=null&&J.trim())return Se.description.trim();const je=(st=(Ke=_.value.get((re=Se.end1)==null?void 0:re.entityRef))==null?void 0:Ke.name)==null?void 0:st.trim(),Ze=(We=(nt=_.value.get((qe=Se.end2)==null?void 0:qe.entityRef))==null?void 0:nt.name)==null?void 0:We.trim();return je&&Ze?`${je}→${Ze}`:a.t("em.history.assocFallback")}function h(ie){var Se,je,Ze,J;if(ie.kind==="entity")return((je=(Se=_.value.get(ie.ref))==null?void 0:Se.name)==null?void 0:je.trim())||a.t("em.attr.nameless");if(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index"){const re=ie.entityRef?_.value.get(ie.entityRef):void 0,st=((ie.kind==="attribute"?re==null?void 0:re.attributes:ie.kind==="operation"?re==null?void 0:re.operations:re==null?void 0:re.indexes)??[]).find(nt=>nt.modelId===ie.ref),qe=(Ze=re==null?void 0:re.name)==null?void 0:Ze.trim();return`${qe?qe+".":""}${((J=st==null?void 0:st.name)==null?void 0:J.trim())||ie.ref}`}return ie.kind==="association"?E(ie.ref):ie.kind==="associationEnd"?`${E(ie.ref)}(${ie.end})`:ie.kind==="group"?a.t("em.history.groupSubject",{name:b.value.get(ie.ref)??ie.ref}):ie.ref}const N={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},w={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},C=t.ref("all"),S=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],V=t.computed({get:()=>C.value,set:ie=>{ie&&(C.value=ie)}}),$=t.computed(()=>gl(r.value)),R=t.computed(()=>$.value.length?$.value[0].seq:null),x=t.computed(()=>C.value==="all"?$.value:$.value.filter(ie=>(ie.kind??"edit")===C.value)),T=t.ref(Tr),M=t.ref(""),k=t.ref(""),v=t.computed(()=>!!M.value||!!k.value);function I(){M.value="",k.value=""}const O=t.computed(()=>{const ie=M.value?new Date(`${M.value}T00:00:00`).getTime():null,Se=k.value?new Date(`${k.value}T23:59:59.999`).getTime():null;return ie==null&&Se==null?x.value:x.value.filter(je=>{if(je.ts==null)return!1;const Ze=new Date(je.ts).getTime();return!(isNaN(Ze)||ie!=null&&Ze<ie||Se!=null&&Ze>Se)})}),A=t.computed(()=>O.value.slice(0,T.value)),L=t.computed(()=>Math.max(0,O.value.length-T.value));function H(){T.value+=Tr}t.watch([C,M,k],()=>{T.value=Tr}),t.watch(()=>o.open,ie=>{ie&&(T.value=Tr,I())});function oe(ie){return ie===void 0?"—":ie===null?a.t("em.history.emptyValue"):typeof ie=="object"?JSON.stringify(ie):String(ie)}function ue(ie){const Se=h(ie.subject);if(ie.verb==="add")return a.t("em.history.summaryAdd",{name:Se});if(ie.verb==="remove")return a.t("em.history.summaryRemove",{name:Se});if(ie.fields.length===1){const je=ie.fields[0];return`${Se}.${je.field} ${je.oldValue!==void 0?oe(je.oldValue)+"→":""}${oe(je.value)}`}return a.t("em.history.summaryFields",{name:Se,n:ie.fields.length})}function be(ie){return ie.actions.length===0?a.t("em.history.noChange"):ie.actions.length===1?ue(ie.actions[0]):a.t("em.history.summaryMore",{summary:ue(ie.actions[0]),n:ie.actions.length-1})}const pe=t.ref(new Set);function he(ie){const Se=new Set(pe.value);Se.has(ie)?Se.delete(ie):Se.add(ie),pe.value=Se}function _e(ie){if(ie==null)return"";const Se=new Date(ie);return isNaN(Se.getTime())?String(ie):Se.toLocaleString()}function ye(ie){const Se=ie.author,je=ie.origin;return Se&&je?`${Se}(${je})`:Se||(je?`(${je})`:"—")}const Ae=t.computed(()=>p.value==null?null:bl(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Ae.value?sd(Ae.value):null,ie=>i("diffChange",ie));function Fe(ie){p.value=ie,f.value=null,X.value=null}function se(){p.value=null,f.value=null}const ne=t.computed(()=>$.value.map(ie=>ie.seq)),ae=t.computed(()=>R.value??1/0),me=t.computed(()=>f.value??ae.value),P=t.computed(()=>f.value??ae.value),D=t.computed(()=>ne.value.filter(ie=>ie<me.value).map(ie=>({v:ie}))),z=t.computed(()=>ne.value.filter(ie=>p.value!=null&&ie>p.value).map(ie=>({v:ie})));function Q(ie){ie!=null&&(p.value=ie,f.value!=null&&f.value<=ie&&(f.value=null))}function ee(ie){ie!=null&&(f.value=ie>=ae.value?null:ie)}function we(ie){return ie>=ae.value?a.t("em.history.diff.current"):`#${ie}`}function de(ie){return ie.kind==="entity"?_.value.has(ie.ref)?ie.ref:null:(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index")&&ie.entityRef?_.value.has(ie.entityRef)?ie.entityRef:null:ie.kind==="group"&&b.value.has(ie.ref)?ie.ref:null}function xe(ie){const Se=de(ie);Se&&a.requestFocus(Se)}const Ce={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},Y={added:"add",modified:"update",removed:"remove"},X=t.ref(null),q=t.ref(!1),Ie=t.computed(()=>X.value==null?null:bl(r.value,{fromSeq:X.value})),Be=t.ref(!1);function ze(ie){X.value=ie,Be.value=!1}async function Ue(ie){q.value=!0;try{const Se=await a.restoreToSeq(ie);Se.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:Se.reason??a.t("em.history.unknown")})}finally{q.value=!1,X.value=null}}return(ie,Se)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var je,Ze;return[t.withDirectives(t.createElementVNode("section",CB,[t.createElementVNode("header",SB,[t.createElementVNode("div",xB,[t.createVNode(Ve,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",RB,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:Se[0]||(Se[0]=J=>u({full:!0}))},[t.createVNode(Ve,{name:"redo",size:15})],8,AB),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:Se[1]||(Se[1]=J=>i("close"))},[t.createVNode(Ve,{name:"panel-close",size:15})],8,$B)])]),t.createElementVNode("div",TB,[t.createElementVNode("label",MB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(te.BSSelect),{modelValue:V.value,"onUpdate:modelValue":Se[2]||(Se[2]=J=>V.value=J),items:S,"value-provider":J=>J.v,"label-provider":J=>t.unref(a).t(J.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",VB,[t.createElementVNode("span",BB,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:k.value||void 0,"onUpdate:modelValue":Se[3]||(Se[3]=J=>M.value=J)},null,8,DB),[[t.vModelText,M.value]]),Se[9]||(Se[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":Se[4]||(Se[4]=J=>k.value=J)},null,8,OB),[[t.vModelText,k.value]]),v.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:I},[t.createVNode(Ve,{name:"x",size:12})],8,LB)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",PB,[t.createElementVNode("div",zB,[t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:D.value,"value-provider":J=>J.v,"label-provider":J=>`#${J.v}`,"onUpdate:modelValue":Se[5]||(Se[5]=J=>Q(J??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ve,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":P.value,items:z.value,"value-provider":J=>J.v,"label-provider":J=>we(J.v),"onUpdate:modelValue":Se[6]||(Se[6]=J=>ee(J??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",FB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((je=Ae.value)==null?void 0:je.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:se},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",UB,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ze=Ae.value)!=null&&Ze.entries.length?(t.openBlock(),t.createElementBlock("ul",jB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ae.value.entries,(J,re)=>(t.openBlock(),t.createElementBlock("li",{key:re,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!de(J.subject)}]),onClick:Ke=>xe(J.subject)},[t.createElementVNode("div",GB,[t.createVNode(Ve,{name:N[J.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",YB,t.toDisplayString(h(J.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[J.verb]}`])},t.toDisplayString(t.unref(a).t(Ce[J.verb])),3)]),J.fields.length?(t.openBlock(),t.createElementBlock("ul",qB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.fields,(Ke,st)=>(t.openBlock(),t.createElementBlock("li",{key:st,class:"em-history__field"},[t.createElementVNode("span",WB,t.toDisplayString(Ke.field),1),Ke.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",JB,t.toDisplayString(oe(Ke.oldValue)),1)):t.createCommentVNode("",!0),Ke.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",XB,t.toDisplayString(oe(Ke.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,KB))),128))])):(t.openBlock(),t.createElementBlock("p",HB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",ZB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",QB,t.toDisplayString(s.value),1)):O.value.length===0?(t.openBlock(),t.createElementBlock("p",eD,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",tD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(A.value,J=>{var re,Ke,st;return t.openBlock(),t.createElementBlock("li",{key:J.seq,class:t.normalizeClass(["em-history__group",[`is-${J.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:qe=>he(J.seq)},[t.createVNode(Ve,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":pe.value.has(J.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${J.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(J.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",oD,t.toDisplayString(be(J)),1),t.createElementVNode("span",iD,"#"+t.toDisplayString(J.seq),1)],8,nD),t.createElementVNode("div",aD,[t.createElementVNode("span",rD,t.toDisplayString(ye(J)),1),J.ts?(t.openBlock(),t.createElementBlock("span",lD,t.toDisplayString(_e(J.ts)),1)):t.createCommentVNode("",!0),J.kind==="restore"&&J.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",sD,"← #"+t.toDisplayString(J.restoredFromSeq),1)):t.createCommentVNode("",!0),J.seq!==R.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(qe=>Fe(J.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,cD)):t.createCommentVNode("",!0)]),pe.value.has(J.seq)?(t.openBlock(),t.createElementBlock("div",dD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.actions,(qe,nt)=>(t.openBlock(),t.createElementBlock("div",{key:nt,class:"em-history__action"},[t.createElementVNode("div",uD,[t.createVNode(Ve,{name:N[qe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",mD,t.toDisplayString(h(qe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${qe.verb}`])},t.toDisplayString(t.unref(a).t(w[qe.verb])),3)]),qe.fields.length?(t.openBlock(),t.createElementBlock("ul",fD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(qe.fields,(We,K)=>(t.openBlock(),t.createElementBlock("li",{key:K,class:"em-history__field"},[t.createElementVNode("span",pD,t.toDisplayString(We.field),1),We.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",hD,t.toDisplayString(oe(We.oldValue)),1)):t.createCommentVNode("",!0),We.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",yD,t.toDisplayString(oe(We.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&J.seq!==R.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":X.value===J.seq}])},[X.value===J.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",gD,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((re=Ie.value)!=null&&re.entries.length),onClick:Se[7]||(Se[7]=qe=>Be.value=!Be.value)},[t.createVNode(Ve,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Be.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Ke=Ie.value)!=null&&Ke.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:Ie.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,bD),Be.value&&((st=Ie.value)!=null&&st.entries.length)?(t.openBlock(),t.createElementBlock("ul",_D,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.value.entries,(qe,nt)=>(t.openBlock(),t.createElementBlock("li",{key:nt,class:"em-history__diff-entry"},[t.createElementVNode("div",kD,[t.createVNode(Ve,{name:N[qe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",ED,t.toDisplayString(h(qe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[qe.verb]}`])},t.toDisplayString(t.unref(a).t(Ce[qe.verb])),3)]),qe.fields.length?(t.openBlock(),t.createElementBlock("ul",ND,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(qe.fields,(We,K)=>(t.openBlock(),t.createElementBlock("li",{key:K,class:"em-history__field"},[t.createElementVNode("span",wD,t.toDisplayString(We.field),1),We.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",ID,t.toDisplayString(oe(We.oldValue)),1)):t.createCommentVNode("",!0),We.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",vD,t.toDisplayString(oe(We.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",CD,[t.createElementVNode("span",SD,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:q.value,onClick:qe=>Ue(J.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,xD),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:q.value,onClick:Se[8]||(Se[8]=qe=>X.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,RD)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:qe=>ze(J.seq)},[t.createVNode(Ve,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,AD))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&L.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:H},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:L.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function TD(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(TD(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 MD={class:"em-modeler"},VD={class:"em-modeler__body"},BD={class:"em-drawer__inner"},DD={class:"em-drawer__head"},OD={class:"em-drawer__actions"},LD=["title"],PD=["title"],zD=["title"],FD=["title"],UD=["title"],HD=tt(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 w=N();w&&("focusCollapse"in w?w.focusCollapse():w.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:p,dragging:f,startResize:y}=Dh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:_,dragging:g,startResize:b}=Dh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),E=t.ref(null),h=t.ref(null);return(N,w)=>{var C,S,V;return t.openBlock(),t.createElementBlock("div",MD,[t.createVNode(Vh,{controller:e.controller,"history-open":u.value,onExportSvg:w[0]||(w[0]=$=>{var R;return(R=E.value)==null?void 0:R.exportSvg()}),onExportPng:w[1]||(w[1]=$=>{var R;return(R=E.value)==null?void 0:R.exportPng()}),onToggleHistory:w[2]||(w[2]=$=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",VD,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",BD,[t.createElementVNode("header",DD,[w[11]||(w[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",OD,[(C=h.value)!=null&&C.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((S=h.value)!=null&&S.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:w[3]||(w[3]=$=>{var R;return(R=h.value)==null?void 0:R.toggleAll()})},[t.createVNode(Ve,{name:(V=h.value)!=null&&V.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,LD)):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:w[4]||(w[4]=$=>c(!1))},[t.createVNode(Ve,{name:"panel-close",size:16})],8,PD)])]),t.createVNode(Mh,{ref_key:"explorer",ref:h,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:w[5]||(w[5]=(...$)=>t.unref(y)&&t.unref(y)(...$))},null,42,zD),[[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:w[6]||(w[6]=$=>c(!0))},[t.createVNode(Ve,{name:"panel-open",size:18})],8,FD),[[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(Th,{ref_key:"canvas",ref:E,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(Bh,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(_),resizing:t.unref(g),"start-resize":t.unref(b),onCollapse:w[7]||(w[7]=$=>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:w[8]||(w[8]=$=>d(!0))},[t.createVNode(Ve,{name:"panel-right-open",size:18})],8,UD),[[t.vShow,!o.value]])]),_:1}),t.createVNode($D,{controller:e.controller,open:u.value,onClose:w[9]||(w[9]=$=>u.value=!1),onDiffChange:w[10]||(w[10]=$=>m.value=$)},null,8,["controller","open"])]),t.createVNode(vB,{controller:e.controller,"panel-width":t.unref(_),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=Gb,Ne.AssociationEdge=$p,Ne.CUSTOM_TYPE_VALUE=hn,Ne.CommandStack=_l,Ne.DEFAULT_JAVA_TYPE=Gr,Ne.DIAGRAM_JSON_FORMAT=Jr,Ne.DIAGRAM_JSON_VERSION=Xr,Ne.DiagramCanvas=Th,Ne.DiagramExplorer=Mh,Ne.EDITOR=po,Ne.EditModeToggle=p2,Ne.EditorToolbar=Vh,Ne.EntityModeler=HD,Ne.EntityNode=sp,Ne.GROUP_CODE_ENUM_VALUE=Yn,Ne.GroupNode=cp,Ne.INHERITED_REF_PREFIX=qi,Ne.InvalidDiagramJsonError=Wn,Ne.JAVA_TYPES=ii,Ne.NoteNode=dp,Ne.OpSyncAdapter=Qd,Ne.PHYSICAL_NAME_MAX_LENGTH=ri,Ne.PropertyPanel=Bh,Ne.RevCache=Zd,Ne.SELECTABLE_JAVA_TYPES=bc,Ne.SYMBOLIC_OP_KINDS=eu,Ne.SYMBOLIC_OP_SCHEMA=_u,Ne.UI_LOCALES=fI,Ne.applyDocumentReferenceOnly=zr,Ne.buildAgentBatch=Yb,Ne.buildDiagramSvg=js,Ne.buildDiffMarks=sd,Ne.collectSharedColumns=$n,Ne.commands=Qg,Ne.computeAutoLayout=qs,Ne.createEditorController=tS,Ne.dedupeModelIds=Sg,Ne.defaultMermaidDialect=Xh,Ne.defaultSqlDialect=Ry,Ne.diagramToJson=xc,Ne.displayLabel=Ji,Ne.emptyState=Wf,Ne.entityModelToDdl=Cc,Ne.entityModelToMermaid=Fr,Ne.entityModelToText=lc,Ne.exportDiagramPng=Ah,Ne.exportDiagramSvg=Rh,Ne.fromPersisted=Ru,Ne.isGeneratable=Uc,Ne.isInheritedColumnRef=jn,Ne.javaTypeLabel=wo,Ne.makeInheritedColumnRef=Xs,Ne.mergeDiagram=nd,Ne.mermaidErToImportSource=Ec,Ne.migrateLegacyMoney=Cg,Ne.multiplicityLabel=ea,Ne.newId=Pe,Ne.packEntityBoxes=Vr,Ne.parseDiagramJson=Rc,Ne.parseInheritedColumnRef=Br,Ne.parseMermaidEr=kc,Ne.parseSqlDdl=qr,Ne.planHealBackfillOps=S_,Ne.projectActionLog=gl,Ne.projectEntityAudit=rd,Ne.projectFieldAudit=Tn,Ne.projectInheritedColumns=Qo,Ne.projectSeqDiff=bl,Ne.renderDiagramSvg=$c,Ne.resolveColumnPhysicalName=ni,Ne.resolveDiagram=Ys,Ne.resolveEffectiveColumn=pn,Ne.resolveQuickFix=ol,Ne.resolveSharedColumn=Gn,Ne.resolveSymbolicOps=Sb,Ne.restoreDeepEqual=Jn,Ne.scaffoldEntityJava=ng,Ne.sharedColumnScopeEntities=Lr,Ne.sqlDdlToImportSource=vc,Ne.stereotypeLabel=ei,Ne.synthesizeRestoreOps=Pg,Ne.toPersisted=I_,Ne.toPersistedV2=v_,Ne.translate=qt,Ne.uiMessagesEn=Bf,Ne.uiMessagesJa=Df,Ne.uiMessagesKo=Of,Ne.validateModel=sa,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
|