@g1cloud/entity-modeler-next 5.1.8 → 5.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
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 qD=Object.defineProperty;var WD=(Ne,t,te)=>t in Ne?qD(Ne,t,{enumerable:!0,configurable:!0,writable:!0,value:te}):Ne[t]=te;var ct=(Ne,t,te)=>WD(Ne,typeof t!="symbol"?t+"":t,te);const Uh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Hh(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 qs(e,n,o={}){const i={...Uh,...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 _ of g.memberEntityRefs)s.set(_,g.modelId);const c=new Map;for(const g of n.groupLayouts)for(const _ of g.memberNoteRefs??[])c.set(_,g.groupRef);let d=0;const u=e.entities.map(g=>{const _=s.get(g.modelId),k=r.get(g.modelId);if(k){const E={location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}};return{entity:g,geo:E,collapsed:k.collapsed??!1,locked:k.locked??!1,groupRef:_,style:k.style,attributeStyles:k.attributeStyles,operationStyles:k.operationStyles}}const h=Hh(d++,i);return{entity:g,geo:h,collapsed:!1,locked:!1,groupRef:_}}),m=new Map(n.groupLayouts.map(g=>[g.groupRef,g])),p=e.groups.map(g=>{const _=m.get(g.modelId),k=_?{location:{x:_.geo.location.x,y:_.geo.location.y},size:{width:_.geo.size.width,height:_.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:k,style:_==null?void 0:_.style,locked:(_==null?void 0:_.locked)??!1}}),f=e.associations.map(g=>{const _=l.get(g.modelId);return{association:g,waypoints:(_==null?void 0:_.waypoints)??[],sourceColumnRef:_==null?void 0:_.sourceColumnRef,targetColumnRef:_==null?void 0:_.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)})),b=[];for(const g of n.notes)for(const _ of g.connections??[])a.has(_.targetRef)&&b.push({noteRef:g.modelId,targetRef:_.targetRef,waypoints:_.waypoints.map(k=>({x:k.x,y:k.y}))});return{entities:u,associations:f,groups:p,notes:y,noteConnections:b}}const jh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ws(e,n,o={}){const i={...jh,...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((b,g)=>{const _=g%y,k=Math.floor(g/y);r.push({id:b,location:{x:p.x+i.pad+_*i.cellWidth,y:p.y+i.pad+i.headerHeight+k*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const 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 Js={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Kh(e,n={}){const o={...Js,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Vr(e,n={}){const o={...Js,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Kh(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 Xs(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 Zs(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 ti(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:Zs(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 Gh={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function ni(e){return Gh[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 ko(s)[a];for(const m of o){const p=m.attributes.find(f=>f.modelId===c);if(p)return p.dbAttrs[a]??ko(s)[a]}}if(s)return ko(s)[a]}function ko(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 Yh(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=Qs(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function fn(e,n){return Qs(e,n,new Set)}function Qs(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=Yh(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 ec=e=>e==null||e.trim()==="";function tc(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=tc(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:qh(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 qh(e){return e!=null&&Object.values(e).some(n=>!ec(n))}function oi(e,n,o,i,a,r){var l;return ec(n.physicalName)?((l=tc(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function nc(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 Eo(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 oc="(미지정)",Wh="(이름 없음)",Xi=e=>e==null||String(e).trim()==="",Zi=e=>Xi(e)?Wh:String(e),ic=e=>Xi(e)?oc:String(e);function ac(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 oc}function rc(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Xi(n)?ic(e.physicalName):String(n),a=Xi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function lc(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function sc(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} «${ni(c.stereotype)}»${u?` [${u}]`:""}`);const m=Eo($n(c,e.entities)),p=g=>{var _;return g.sharedColumnRef?(_=Gn(g,m))==null?void 0:_.physicalName:void 0},f=[...c.attributes].sort((g,_)=>g.order-_.order);for(const g of f){if(g.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${g.name?` ${g.name} ${"─".repeat(8)}`:""}`);continue}const _=g.dbAttrs.map((A,B)=>pn(g,A,B,c,e,n)),k=[g.identifier?"PK":"",g.notNull?"NOT NULL":""].filter(Boolean),h=` - ${Zi(g.name)}: ${ic(g.type)}`,E=A=>A.length?` {${A.join(", ")}}`:"";if(_.length>1){a.push(`${h}${E(k)}`),_.forEach((A,B)=>{const $=nc(g,B,e,n);a.push(` · ${$?`${$} → `:""}${rc(A,p(A))}${E(lc(A))}`)});continue}const N=_[0],C=N?` → ${rc(N,p(N))}`:"";a.push(`${h}${C}${E([...k,...N?lc(N):[]])}`)}const y=Hn(c.attributes);for(const g of c.indexes??[]){const _=g.columns.map(k=>{var h,E;return`${((h=y.attributeOf(k.columnRef))==null?void 0:h.name)??((E=Br(k.columnRef))==null?void 0:E.field)??k.columnRef}${k.descending?" DESC":""}`}).join(", ");a.push(` index ${Zi(g.name)}${g.unique?" UNIQUE":""}: ${_}`)}const b=[...c.operations??[]].sort((g,_)=>g.order-_.order);for(const g of b){const _=g.visibility?` {${g.visibility}}`:"",k=(s=g.description)!=null&&s.ko?` — ${g.description.ko}`:"";a.push(` method ${Zi(g.name)}()${_}${k}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${ac(c.end1.multiplicity)} —— ${ac(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
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 WD=Object.defineProperty;var JD=(Ne,t,te)=>t in Ne?WD(Ne,t,{enumerable:!0,configurable:!0,writable:!0,value:te}):Ne[t]=te;var ct=(Ne,t,te)=>JD(Ne,typeof t!="symbol"?t+"":t,te);const Uh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Hh(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 qs(e,n,o={}){const i={...Uh,...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 _ of g.memberEntityRefs)s.set(_,g.modelId);const c=new Map;for(const g of n.groupLayouts)for(const _ of g.memberNoteRefs??[])c.set(_,g.groupRef);let d=0;const u=e.entities.map(g=>{const _=s.get(g.modelId),k=r.get(g.modelId);if(k){const E={location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}};return{entity:g,geo:E,collapsed:k.collapsed??!1,locked:k.locked??!1,groupRef:_,style:k.style,attributeStyles:k.attributeStyles,operationStyles:k.operationStyles}}const h=Hh(d++,i);return{entity:g,geo:h,collapsed:!1,locked:!1,groupRef:_}}),m=new Map(n.groupLayouts.map(g=>[g.groupRef,g])),p=e.groups.map(g=>{const _=m.get(g.modelId),k=_?{location:{x:_.geo.location.x,y:_.geo.location.y},size:{width:_.geo.size.width,height:_.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:k,style:_==null?void 0:_.style,locked:(_==null?void 0:_.locked)??!1}}),f=e.associations.map(g=>{const _=l.get(g.modelId);return{association:g,waypoints:(_==null?void 0:_.waypoints)??[],sourceColumnRef:_==null?void 0:_.sourceColumnRef,targetColumnRef:_==null?void 0:_.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)})),b=[];for(const g of n.notes)for(const _ of g.connections??[])a.has(_.targetRef)&&b.push({noteRef:g.modelId,targetRef:_.targetRef,waypoints:_.waypoints.map(k=>({x:k.x,y:k.y}))});return{entities:u,associations:f,groups:p,notes:y,noteConnections:b}}const jh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ws(e,n,o={}){const i={...jh,...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((b,g)=>{const _=g%y,k=Math.floor(g/y);r.push({id:b,location:{x:p.x+i.pad+_*i.cellWidth,y:p.y+i.pad+i.headerHeight+k*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const 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 Js={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Kh(e,n={}){const o={...Js,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Vr(e,n={}){const o={...Js,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Kh(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 Xs(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 Zs(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 ti(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:Zs(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 Gh={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function ni(e){return Gh[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 ko(s)[a];for(const m of o){const p=m.attributes.find(f=>f.modelId===c);if(p)return p.dbAttrs[a]??ko(s)[a]}}if(s)return ko(s)[a]}function ko(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 Yh(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=Qs(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function fn(e,n){return Qs(e,n,new Set)}function Qs(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=Yh(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 ec=e=>e==null||e.trim()==="";function tc(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=tc(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:qh(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 qh(e){return e!=null&&Object.values(e).some(n=>!ec(n))}function oi(e,n,o,i,a,r){var l;return ec(n.physicalName)?((l=tc(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function nc(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 Eo(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 oc="(미지정)",Wh="(이름 없음)",Xi=e=>e==null||String(e).trim()==="",Zi=e=>Xi(e)?Wh:String(e),ic=e=>Xi(e)?oc:String(e);function ac(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 oc}function rc(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Xi(n)?ic(e.physicalName):String(n),a=Xi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function lc(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function sc(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} «${ni(c.stereotype)}»${u?` [${u}]`:""}`);const m=Eo($n(c,e.entities)),p=g=>{var _;return g.sharedColumnRef?(_=Gn(g,m))==null?void 0:_.physicalName:void 0},f=[...c.attributes].sort((g,_)=>g.order-_.order);for(const g of f){if(g.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${g.name?` ${g.name} ${"─".repeat(8)}`:""}`);continue}const _=g.dbAttrs.map((A,B)=>pn(g,A,B,c,e,n)),k=[g.identifier?"PK":"",g.notNull?"NOT NULL":""].filter(Boolean),h=` - ${Zi(g.name)}: ${ic(g.type)}`,E=A=>A.length?` {${A.join(", ")}}`:"";if(_.length>1){a.push(`${h}${E(k)}`),_.forEach((A,B)=>{const $=nc(g,B,e,n);a.push(` · ${$?`${$} → `:""}${rc(A,p(A))}${E(lc(A))}`)});continue}const N=_[0],C=N?` → ${rc(N,p(N))}`:"";a.push(`${h}${C}${E([...k,...N?lc(N):[]])}`)}const y=Hn(c.attributes);for(const g of c.indexes??[]){const _=g.columns.map(k=>{var h,E;return`${((h=y.attributeOf(k.columnRef))==null?void 0:h.name)??((E=Br(k.columnRef))==null?void 0:E.field)??k.columnRef}${k.descending?" DESC":""}`}).join(", ");a.push(` index ${Zi(g.name)}${g.unique?" UNIQUE":""}: ${_}`)}const b=[...c.operations??[]].sort((g,_)=>g.order-_.order);for(const g of b){const _=g.visibility?` {${g.visibility}}`:"",k=(s=g.description)!=null&&s.ko?` — ${g.description.ko}`:"";a.push(` method ${Zi(g.name)}()${_}${k}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${ac(c.end1.multiplicity)} —— ${ac(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
2
2
  `).trim()}function No(e){return e.referenceOnly===!0}function Pr(e){const n=new Set;for(const o of e.entities)No(o)&&n.add(o.modelId);return n}function cc(e){return e.entities.filter(n=>!No(n))}function dc(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 Jh(e,n){return No(e)||n===!0}const Xh=e=>e&&e[0].toLowerCase()+e.slice(1);function Qi(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function uc(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 Zh(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=Xh(e);return n?Zh(o):o}function wo(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function Qh(e){return e==="CLASS"?"class":"er"}function Fr(e,n,o){const i=ey(e);return n==="class"?ly(i):iy(i,o)}function ey(e){const n=Pr(e);return n.size===0?e:{...e,entities:cc(e),associations:dc(e,n)}}function ii(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 mc(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=ii(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 ty(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const fc=ea;function Hr(e){return e!=null&&pc[e]!=null}const pc={NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"};function hc(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"?pc:o)[i]}function ny(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:nc(e,l,o,i),d=ii(s.dataType||e.type,"unknown"),u=ii(s.physicalName||c,"col"),m=s.length?`(${s.length}${s.scale!=null?`,${s.scale}`:""})`:"";a.push(oy(d,u,e,s.unique===!0,m,(p=s.logicalName)==null?void 0:p.ko))}),a}function oy(e,n,o,i,a,r){const l=[o.identifier?"PK":"",ty(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 iy(e,n){const o=mc(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 ny(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=`${hc(r.end1.multiplicity,"left")}--${hc(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
3
  `)}function ay(e){return e&&e!=="UNDEFINED"?ni(e):null}function ry(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function ly(e){const n=mc(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=ay(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(` +${ry(c.type)} ${ii(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${ii(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=sy(i),s=Ur(i.description),c=` ${a} "${fc(i.end1.multiplicity)}" ${l} "${fc(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
4
  `)}function sy(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Pe(){return crypto.randomUUID()}const yc=["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"],cy=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"]),dy=yc.filter(e=>!cy.has(e)),uy={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function jr(e){return uy[e]??e}const my=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Kr=new Set(["NUMERIC","DECIMAL"]);function gc(e,n=dy){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const hn="CustomType",Yn="GroupCodeEnum",Gr="String",ai=[{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"}],fy=new Map(ai.map(e=>[e.value,e.label]));function Io(e){return fy.get(e)??e}const py={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 bc(e){if(e)return py[e.toUpperCase()]}const hy={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"])},yy=new Map(ai.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function gy(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!yc.includes(i))return;const a=yy.get(o)??o,r=hy[a];if(r)return r.has(i)}const by=new Set([Yn,"CustomMoneyType"]),_c=ai.filter(e=>!by.has(e.value)).map(e=>e.value===hn?{...e,label:"CustomType (사용자정의)"}:e);function kc(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=[..._c,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:Io(e)},...i]:i}function _y(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"}<${Io(n.type)}>`:_y(n)?Io(n.type):e==="CLASS"?n.type===hn&&n.customType||Io(n.type):jr(((a=n.dbAttrs[0])==null?void 0:a.dataType)??"")}const ky={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},Ey={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function Ny(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(b=>{var g;return b.identifier&&(y==null||((g=b.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 wy(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 b=i.slice(0,y.index).trim();b&&(m=b)}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:bc(l)??"",attrType:"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[p]},foreignKey:c.has("FK")}}function Ec(e){const n=e.split(`
@@ -13,23 +13,23 @@ ${E}
13
13
  `),d.join(`
14
14
  `)].filter(m=>m.length).join(`
15
15
 
16
- `)}const Jr="entity-modeler-diagram",Xr=1;class Wn extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function Rc(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),So=e=>Array.isArray(e)?e:[];function Ac(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:So(o.associations),groups:So(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:So(a.entityLayouts),associationLayouts:So(a.associationLayouts),groupLayouts:So(a.groupLayouts),notes:So(a.notes)};return{logical:i,layout:r}}const Ly=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ot(e){return e.replace(Ly,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function He(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function $c(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 Py(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 zy(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 Fy(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=zy(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="${Fy(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(Py(l));for(const l of e.texts)r.push($c(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function Uy(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($c(i));return`<g>${o.join("")}</g>`}function Tc(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(Uy(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 Hy(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(),Mc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,jy=e=>e&&e[0].toLowerCase()+e.slice(1),Ky=e=>e&&e[0].toUpperCase()+e.slice(1);function Gy(e,n){return jy(e??"")+Ky(n??"")}function Yy(e,n){const o=wo(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 Vc(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&&!uc(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=Gy(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 qy(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 Wy(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 ri(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=>Vc(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),b=d.get(y);if(b){const g=qy(b,f,o);g&&i.update.push({attributeId:b.modelId,patch:g})}else{const g=Yy(f,m);m.add(g.name),i.add.push(Wy(g,p++,o))}}return i}function Bc(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 Jy(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function Dc(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 Oc(e,n,o=Qr){const i=new Map,a=Jy(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=ri(a,p,o);if(Mc(f))continue;const y=i.get(p);i.set(p,y?Dc(y,f):f);const b=a.entities.find(g=>g.modelId===p);b&&Bc(b,f),r.has(p)||(r.add(p),c.push(p))}}return i}function Lc(e,n,o=Qr){const i=[],a=ri(e,n,o);let r=e;Mc(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 Bc(s,a),s})});for(const[l,s]of Oc(r,n,o))i.push({entityId:l,plan:s});return i}function xo(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 li=63;function el(e){if(!e)return null;const n=e.length;return n>li?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 Ro(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Xy(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)),b=[...y].sort().join(" ");d.has(b)||(d.add(b),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 Pc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Zy(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function zc(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Qy(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 eg(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Qy(a,o))).size===1}function Fc(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,b,g,_,k,h,E;const o=[],i=new Map(e.entities.map(N=>[N.modelId,N])),a=new Map(e.associations.map(N=>[N.modelId,N])),r=Dr(e.associations),l=Pr(e),s=l.size===0?e.entities:cc(e),c=dc(e,l);for(const N of Fc(s,C=>C.name))for(const C of N){const A=N.filter(x=>x!==C),B=Pc(C)&&A.some(Pc),$=A.some(x=>!Hy(C,x,e));!B&&!$||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:C.modelId,params:{name:C.name,reason:B?"entity":"package"}})}for(const N of Fc(Zy(s),zc))if(new Set(N.map(C=>C.name)).size!==1&&!eg(N,e))for(const C of N)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:C.modelId,params:{name:zc(C)}});const d=s.flatMap(N=>(N.indexes??[]).map(C=>({e:N,ix:C})));for(const N of nl(d,C=>C.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:N.ix.modelId,contextRef:N.e.modelId,params:{name:N.ix.name}});for(const N of s){const C=N.attributes.filter(v=>v.attrType!=="DIVIDER");if(Ct(N.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:N.modelId}),N.stereotype==="JPA_ENTITY"&&!N.abstractClass&&(C.some(v=>v.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:N.modelId}),Ct((p=N.table)==null?void 0:p.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:N.modelId})),N.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:N.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:N.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:N.modelId,params:I.autoIncrement?{name:v.name}:{name:v.name,seq:I.sequenceName??""}});const A=C.filter(v=>v.identifier&&!v.transient);if(A.reduce((v,I)=>v+I.dbAttrs.length,0)>=2)for(const v of A)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:N.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:N.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:N.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:N.modelId,params:{name:v.name}});!N.abstractClass&&C.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:N.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&C.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:N.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:N.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,N,r);o.push({ruleId:I?"CHK-NAME-7":"CHK-NAME-4",severity:I?"error":"info",targetKind:"attribute",targetRef:v.modelId,contextRef:N.modelId,...I?{params:{attrType:v.attrType}}:{}})}const B=C.flatMap(v=>v.dbAttrs.map((I,L)=>({attr:v,index:L,col:I,eff:pn(v,I,L,N,e,n),name:oi(v,I,L,N,e,n)})).filter(I=>I.eff.sharedColumnRef==null));for(const v of nl(B,I=>I.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:v.col.modelId,contextRef:N.modelId,params:{name:v.name}});for(const v of B){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,N,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:N.modelId,params:{name:v.attr.name}})}for(const v of B){const I=v.col,L=el(I.physicalName);L!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:N.modelId,params:{max:li,len:L}}),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:N.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:N.modelId,params:{dataType:I.dataType}});const M=v.attr.transient||I.multiValue||v.attr.attrType.startsWith("EMBED")||v.attr.attrType.startsWith("RELATION")?void 0:gy(v.attr.type,I.dataType);M===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:N.modelId,params:{type:v.attr.type,dataType:tl(I)}}),M!==!1&&!Ct(I.dataType)&&my.has(I.dataType)&&!I.length&&(pn(v.attr,I,v.index,N,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:N.modelId,params:{dataType:I.dataType}}))}for(const v of B)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:N.modelId,params:{name:v.attr.name}}));if((f=n==null?void 0:n.embeddableCatalog)!=null&&f.length){const v=Eo($n(N,e.entities));for(const I of C){if(I.attrType!=="EMBED_PREDEF")continue;const L=n.embeddableCatalog.find(M=>M.type===I.type);L&&I.dbAttrs.forEach((M,V)=>{if(M.sharedColumnRef==null)return;const U=L.fields[V],oe=v.get(M.sharedColumnRef);if(!U||!oe)return;(oe.dataType!==U.dataType||(oe.length??null)!==(U.length??null)||(oe.scale??null)!==(U.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:M.modelId,contextRef:N.modelId,params:{targetType:tl(oe),metaName:U.name,metaType:tl(U)}})})}}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:N.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 L=a.get(v.embedded.associationRef),M=L==null?void 0:L.end1.entityRef===v.embedded.embeddableRef?L.end1:L.end2;if(M&&Ro(M.multiplicity))continue;const V=fn(I).length;v.dbAttrs.length!==V&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:v.modelId,contextRef:N.modelId,params:{name:v.name,embeddable:I.name,slots:v.dbAttrs.length,declared:V}})}const $=(y=N.table)==null?void 0:y.physicalName,x=el($);x!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:N.modelId,params:{max:li,len:x}}),n!=null&&n.reservedWords&&!Ct($)&&n.reservedWords.has($.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:N.modelId,params:{name:$}});const S=new Set;for(const v of N.attributes){S.add(v.modelId);for(const I of v.dbAttrs)S.add(I.modelId)}const T=new Set(ti(N,(n==null?void 0:n.superClassCatalog)??[]).map(v=>v.modelId)),R=(((b=n==null?void 0:n.superClassCatalog)==null?void 0:b.length)??0)>0,w=Hn(N.attributes);for(const v of N.indexes??[]){const I=el(v.name);I!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:N.modelId,params:{max:li,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:N.modelId,params:{name:v.name}});for(const L of v.columns){const M=L.columnRef;if(S.has(M)||T.has(M))continue;const V=jn(M);V&&!R||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:N.modelId,params:V?{name:v.name,field:((g=Br(M))==null?void 0:g.field)??M}:{name:v.name}})}v.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:N.modelId,params:{name:v.name}}),new Set(v.columns.map(L=>w.canon(L.columnRef))).size!==v.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:N.modelId,params:{name:v.name}})}}const u=new Map;for(const N of e.entities)for(const C of N.attributes)C.attrType==="EMBED_OWN"&&C.embedded&&u.set(C.embedded.associationRef,C);for(const N of c){if(Ro(N.end1.multiplicity)&&Ro(N.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:N.modelId}),u.has(N.modelId)&&N.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:N.modelId}),!u.has(N.modelId)){const C=!!N.end2.attributeRef&&(((k=(_=N.end2.jpa)==null?void 0:_.cascadeTypes)==null?void 0:k.length)??0)>0,A=!!N.end1.attributeRef&&N.end1.navigable&&(((E=(h=N.end1.jpa)==null?void 0:h.cascadeTypes)==null?void 0:E.length)??0)>0;C&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:N.modelId})}if(!u.has(N.modelId)&&N.end1.navigable&&N.end1.attributeRef){const C=i.get(N.end1.entityRef),A=C==null?void 0:C.attributes.some(x=>x.modelId===N.end1.attributeRef),B=i.get(N.end2.entityRef),$=Vc(e,N).length>0;A&&B&&$&&(N.end2.attributeRef&&B.attributes.some(S=>S.modelId===N.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:N.modelId,params:{child:B.name}}))}for(const C of["end1","end2"]){const A=N[C].jpa;if(!A)continue;const B=A.cascadeTypes??[];B.includes("ALL")&&B.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:N.modelId,params:{which:C}}),Ro(N[C].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:N.modelId,params:{which:C}}),A.orphanRemoval&&Ro(N[C==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:N.modelId,params:{which:C}}),!Ro(N[C].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:N.modelId,params:{which:C}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:N.modelId,params:{which:C}})}}const m=new Map(e.entities.map(N=>[N.modelId,N.name||N.modelId]));for(const N of Xy(s,c)){const C=[...N,N[0]].map(A=>m.get(A)??A).join(" → ");for(const A of N)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:C}})}if(n!=null&&n.flagEntitiesWithoutRelations){const N=new Set;for(const A of e.associations)N.add(A.end1.entityRef),N.add(A.end2.entityRef);const C=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const B of A.attributes)B.embedded&&(N.add(A.modelId),N.add(B.embedded.embeddableRef));if(!Ct(A.superClass)){N.add(A.modelId);const B=C.get(A.superClass);B&&N.add(B)}}for(const A of s)N.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function ol(e,n){var r,l;if(e.ruleId==="CHK-DSN-7")return tg(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(s=>s.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"]}:null}function tg(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 Ao="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"},ng={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function Uc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Qt(o)?null:o??ng[n]}const ca={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function og(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 Hc(e){return!(Qt(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function ig(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&&(No(l)||o.skipUngeneratable!==!1&&!Hc(l)||a.push(lg(l,e,o)))}return a}class jc{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(`${Ao}.${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 Rc(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),So=e=>Array.isArray(e)?e:[];function Ac(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:So(o.associations),groups:So(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:So(a.entityLayouts),associationLayouts:So(a.associationLayouts),groupLayouts:So(a.groupLayouts),notes:So(a.notes)};return{logical:i,layout:r}}const Ly=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ot(e){return e.replace(Ly,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function He(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function $c(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 Py(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 zy(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 Fy(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=zy(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="${Fy(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(Py(l));for(const l of e.texts)r.push($c(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function Uy(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($c(i));return`<g>${o.join("")}</g>`}function Tc(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(Uy(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 Hy(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(),Mc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,jy=e=>e&&e[0].toLowerCase()+e.slice(1),Ky=e=>e&&e[0].toUpperCase()+e.slice(1);function Gy(e,n){return jy(e??"")+Ky(n??"")}function Yy(e,n){const o=wo(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 Vc(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&&!uc(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=Gy(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 qy(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 Wy(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 ri(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=>Vc(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),b=d.get(y);if(b){const g=qy(b,f,o);g&&i.update.push({attributeId:b.modelId,patch:g})}else{const g=Yy(f,m);m.add(g.name),i.add.push(Wy(g,p++,o))}}return i}function Bc(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 Jy(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function Dc(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 Oc(e,n,o=Qr){const i=new Map,a=Jy(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=ri(a,p,o);if(Mc(f))continue;const y=i.get(p);i.set(p,y?Dc(y,f):f);const b=a.entities.find(g=>g.modelId===p);b&&Bc(b,f),r.has(p)||(r.add(p),c.push(p))}}return i}function Lc(e,n,o=Qr){const i=[],a=ri(e,n,o);let r=e;Mc(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 Bc(s,a),s})});for(const[l,s]of Oc(r,n,o))i.push({entityId:l,plan:s});return i}function xo(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 li=63;function el(e){if(!e)return null;const n=e.length;return n>li?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 Ro(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Xy(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)),b=[...y].sort().join(" ");d.has(b)||(d.add(b),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 Pc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Zy(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function zc(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Qy(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 eg(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Qy(a,o))).size===1}function Fc(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,b,g,_,k,h,E;const o=[],i=new Map(e.entities.map(N=>[N.modelId,N])),a=new Map(e.associations.map(N=>[N.modelId,N])),r=Dr(e.associations),l=Pr(e),s=l.size===0?e.entities:cc(e),c=dc(e,l);for(const N of Fc(s,C=>C.name))for(const C of N){const A=N.filter(x=>x!==C),B=Pc(C)&&A.some(Pc),$=A.some(x=>!Hy(C,x,e));!B&&!$||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:C.modelId,params:{name:C.name,reason:B?"entity":"package"}})}for(const N of Fc(Zy(s),zc))if(new Set(N.map(C=>C.name)).size!==1&&!eg(N,e))for(const C of N)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:C.modelId,params:{name:zc(C)}});const d=s.flatMap(N=>(N.indexes??[]).map(C=>({e:N,ix:C})));for(const N of nl(d,C=>C.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:N.ix.modelId,contextRef:N.e.modelId,params:{name:N.ix.name}});for(const N of s){const C=N.attributes.filter(v=>v.attrType!=="DIVIDER");if(Ct(N.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:N.modelId}),N.stereotype==="JPA_ENTITY"&&!N.abstractClass&&(C.some(v=>v.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:N.modelId}),Ct((p=N.table)==null?void 0:p.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:N.modelId})),N.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:N.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:N.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:N.modelId,params:I.autoIncrement?{name:v.name}:{name:v.name,seq:I.sequenceName??""}});const A=C.filter(v=>v.identifier&&!v.transient);if(A.reduce((v,I)=>v+I.dbAttrs.length,0)>=2)for(const v of A)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:N.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:N.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:N.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:N.modelId,params:{name:v.name}});!N.abstractClass&&C.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:N.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&C.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:N.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:N.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,N,r);o.push({ruleId:I?"CHK-NAME-7":"CHK-NAME-4",severity:I?"error":"info",targetKind:"attribute",targetRef:v.modelId,contextRef:N.modelId,...I?{params:{attrType:v.attrType}}:{}})}const B=C.flatMap(v=>v.dbAttrs.map((I,L)=>({attr:v,index:L,col:I,eff:pn(v,I,L,N,e,n),name:oi(v,I,L,N,e,n)})).filter(I=>I.eff.sharedColumnRef==null));for(const v of nl(B,I=>I.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:v.col.modelId,contextRef:N.modelId,params:{name:v.name}});for(const v of B){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,N,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:N.modelId,params:{name:v.attr.name}})}for(const v of B){const I=v.col,L=el(I.physicalName);L!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:N.modelId,params:{max:li,len:L}}),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:N.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:N.modelId,params:{dataType:I.dataType}});const M=v.attr.transient||I.multiValue||v.attr.attrType.startsWith("EMBED")||v.attr.attrType.startsWith("RELATION")?void 0:gy(v.attr.type,I.dataType);M===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:N.modelId,params:{type:v.attr.type,dataType:tl(I)}}),M!==!1&&!Ct(I.dataType)&&my.has(I.dataType)&&!I.length&&(pn(v.attr,I,v.index,N,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:N.modelId,params:{dataType:I.dataType}}))}for(const v of B)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:N.modelId,params:{name:v.attr.name}}));if((f=n==null?void 0:n.embeddableCatalog)!=null&&f.length){const v=Eo($n(N,e.entities));for(const I of C){if(I.attrType!=="EMBED_PREDEF")continue;const L=n.embeddableCatalog.find(M=>M.type===I.type);L&&I.dbAttrs.forEach((M,V)=>{if(M.sharedColumnRef==null)return;const U=L.fields[V],oe=v.get(M.sharedColumnRef);if(!U||!oe)return;(oe.dataType!==U.dataType||(oe.length??null)!==(U.length??null)||(oe.scale??null)!==(U.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:M.modelId,contextRef:N.modelId,params:{targetType:tl(oe),metaName:U.name,metaType:tl(U)}})})}}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:N.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 L=a.get(v.embedded.associationRef),M=L==null?void 0:L.end1.entityRef===v.embedded.embeddableRef?L.end1:L.end2;if(M&&Ro(M.multiplicity))continue;const V=fn(I).length;v.dbAttrs.length!==V&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:v.modelId,contextRef:N.modelId,params:{name:v.name,embeddable:I.name,slots:v.dbAttrs.length,declared:V}})}const $=(y=N.table)==null?void 0:y.physicalName,x=el($);x!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:N.modelId,params:{max:li,len:x}}),n!=null&&n.reservedWords&&!Ct($)&&n.reservedWords.has($.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:N.modelId,params:{name:$}});const S=new Set;for(const v of N.attributes){S.add(v.modelId);for(const I of v.dbAttrs)S.add(I.modelId)}const T=new Set(ti(N,(n==null?void 0:n.superClassCatalog)??[]).map(v=>v.modelId)),R=(((b=n==null?void 0:n.superClassCatalog)==null?void 0:b.length)??0)>0,w=Hn(N.attributes);for(const v of N.indexes??[]){const I=el(v.name);I!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:N.modelId,params:{max:li,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:N.modelId,params:{name:v.name}});for(const L of v.columns){const M=L.columnRef;if(S.has(M)||T.has(M))continue;const V=jn(M);V&&!R||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:N.modelId,params:V?{name:v.name,field:((g=Br(M))==null?void 0:g.field)??M}:{name:v.name}})}v.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:N.modelId,params:{name:v.name}}),new Set(v.columns.map(L=>w.canon(L.columnRef))).size!==v.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:N.modelId,params:{name:v.name}})}}const u=new Map;for(const N of e.entities)for(const C of N.attributes)C.attrType==="EMBED_OWN"&&C.embedded&&u.set(C.embedded.associationRef,C);for(const N of c){if(Ro(N.end1.multiplicity)&&Ro(N.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:N.modelId}),u.has(N.modelId)&&N.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:N.modelId}),!u.has(N.modelId)){const C=!!N.end2.attributeRef&&(((k=(_=N.end2.jpa)==null?void 0:_.cascadeTypes)==null?void 0:k.length)??0)>0,A=!!N.end1.attributeRef&&N.end1.navigable&&(((E=(h=N.end1.jpa)==null?void 0:h.cascadeTypes)==null?void 0:E.length)??0)>0;C&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:N.modelId})}if(!u.has(N.modelId)&&N.end1.navigable&&N.end1.attributeRef){const C=i.get(N.end1.entityRef),A=C==null?void 0:C.attributes.some(x=>x.modelId===N.end1.attributeRef),B=i.get(N.end2.entityRef),$=Vc(e,N).length>0;A&&B&&$&&(N.end2.attributeRef&&B.attributes.some(S=>S.modelId===N.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:N.modelId,params:{child:B.name}}))}for(const C of["end1","end2"]){const A=N[C].jpa;if(!A)continue;const B=A.cascadeTypes??[];B.includes("ALL")&&B.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:N.modelId,params:{which:C}}),Ro(N[C].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:N.modelId,params:{which:C}}),A.orphanRemoval&&Ro(N[C==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:N.modelId,params:{which:C}}),!Ro(N[C].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:N.modelId,params:{which:C}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:N.modelId,params:{which:C}})}}const m=new Map(e.entities.map(N=>[N.modelId,N.name||N.modelId]));for(const N of Xy(s,c)){const C=[...N,N[0]].map(A=>m.get(A)??A).join(" → ");for(const A of N)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:C}})}if(n!=null&&n.flagEntitiesWithoutRelations){const N=new Set;for(const A of e.associations)N.add(A.end1.entityRef),N.add(A.end2.entityRef);const C=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const B of A.attributes)B.embedded&&(N.add(A.modelId),N.add(B.embedded.embeddableRef));if(!Ct(A.superClass)){N.add(A.modelId);const B=C.get(A.superClass);B&&N.add(B)}}for(const A of s)N.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function ol(e,n){var r,l;if(e.ruleId==="CHK-DSN-7")return tg(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(s=>s.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"]}:null}function tg(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 Ao="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"},ng={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function Uc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Qt(o)?null:o??ng[n]}const ca={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function og(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 Hc(e){return!(Qt(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function ig(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&&(No(l)||o.skipUngeneratable!==!1&&!Hc(l)||a.push(sg(l,e,o)))}return a}class jc{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(`${Ao}.${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 Kc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Gc(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function $o(e,n){n&&(e.import(lt.lombokGetter),e.line(" @Getter"))}const ag=["ko","en","ja","zh"];function il(e,n){if(!e)return[];const o=ag.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=[...ai,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Yn){if(i){const c=[`${Ao}.Enumerated`,`${Ao}.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:[`${Ao}.Enumerated`,`${Ao}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===hn){const c=og(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=Uc(o,"money");return{type:"Money",primitive:!1,imports:c?[lt.money,`${Ao}.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 ua(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return{type: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{type:da(e.type,e.customType,o).type};const r=al(a);return r.length>=2?{type:`${a.name}PK`,pkOwner:a}:r.length===1?ua(r[0],n,o,new Set([...i,a.modelId])):{type:da(e.type,e.customType,o).type}}function Yc(e,n,o,i=new Set){return ua(e,n,o,i).type}function qc(e,n,o,i){return`${To(e,o,i)||si}.${e.name}.${n}`}function ma(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!fa(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 Gc(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function rg(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 Yc(r||e,i,a)}function ll(e,n,o){var y,b,g;const i=new Map(n.entities.map(_=>[_.modelId,_])),a=Dr(n.associations),r=new Map;for(const _ of n.associations)_.end2.attributeRef&&r.set(_.end2.attributeRef,{assoc:_,role:"owner"}),_.end1.attributeRef&&_.end1.navigable&&r.set(_.end1.attributeRef,{assoc:_,role:"inverse"});const l=al(e),s=new Set;for(const _ of l)ma(_,(y=r.get(_.modelId))==null?void 0:y.assoc)&&s.add(_.modelId);const c=new Set(l.filter(_=>_.attrType==="NORMAL").flatMap(_=>_.dbAttrs.map(k=>k.physicalName)).filter(Boolean)),d=[],u=[];for(const _ of l){if(!s.has(_.modelId))continue;const k=r.get(_.modelId).assoc,h=_.dbAttrs[0],E=(h==null?void 0:h.physicalName)||cl(_,k,i,0)||"";if(E&&c.has(E))continue;const N=rl(_,k,i);if(!N){u.push(_);continue}const C=_.derivedFrom?(b=i.get(k.end1.entityRef))==null?void 0:b.attributes.find(A=>A.modelId===_.derivedFrom.sourceAttributeRef):void 0;d.push({attr:{modelId:`synthetic-id:${_.modelId}`,name:N,type:o?o(_,k):(C==null?void 0:C.type)??_.type,customType:(C==null?void 0:C.customType)??_.customType,attrType:"NORMAL",identifier:!0,notNull:!0,order:_.order,dbAttrs:[{...h??{modelId:`synthetic-col:${_.modelId}`,dataType:""},physicalName:E}]},role:"scalar",synthetic:!0,sourceAttr:_})}const m=[],p=[];for(const _ of e.attributes)if(_.attrType!=="DIVIDER"){if(_.attrType.startsWith("EMBED")){p.push({attr:_,role:"embed",synthetic:!1,sourceAttr:_,collection:na(_,n.associations)});continue}if(_.attrType==="RELATION_OWN"){const k=r.get(_.modelId);k?p.push({attr:_,role:"relation-owner",synthetic:!1,sourceAttr:_,assoc:k.assoc,target:i.get(k.assoc.end1.entityRef)}):Or(_,e,a)?m.push({attr:_,reason:"join-column-only"}):m.push({attr:_,reason:"no-anchor"});continue}if(_.attrType==="RELATION_REF"){const k=r.get(_.modelId);if(!k){m.push({attr:_,reason:"nav-not-materialized"});continue}p.push({attr:_,role:"relation-inverse",synthetic:!1,sourceAttr:_,assoc:k.assoc,target:i.get(k.assoc.end2.entityRef),collection:fa(k.assoc.end2.multiplicity)?((g=k.assoc.end2.jpa)==null?void 0:g.collectionType)??"LIST":void 0});continue}p.push({attr:_,role:"scalar",synthetic:!1,sourceAttr:_})}return{fields:[...d,...p].sort((_,k)=>_.attr.order-k.attr.order),omitted:m,unresolvedDerivedIds:u}}function lg(e,n,o){var T,R,w,v,I,L,M;if(e.stereotype==="JPA_EMBEDDABLE")return sg(e,n,o);const i=new jc,a=e.name;let r=To(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${si}')`),r=si);const l=new Map(n.entities.map(V=>[V.modelId,V])),s=r,c=_g(e,o,i),d=new Map;for(const V of n.associations)V.end2.attributeRef&&d.set(V.end2.attributeRef,{assoc:V,role:"owner"}),V.end1.attributeRef&&V.end1.navigable&&d.set(V.end1.attributeRef,{assoc:V,role:"inverse"});const u=al(e),m=new Set;for(const V of u)ma(V,(T=d.get(V.modelId))==null?void 0:T.assoc)&&m.add(V.modelId);const p=ll(e,n,(V,U)=>rg(V,U,l,n,o)),f=p.fields.filter(V=>V.synthetic).map(V=>V.attr);for(const V of p.unresolvedDerivedIds)i.fillIn(`${a}.${V.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);for(const V of p.omitted)V.reason==="no-anchor"&&i.fillIn(`${e.name}.${V.attr.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`);const y=new Set(p.omitted.map(V=>V.attr.modelId)),b=[...u.filter(V=>!m.has(V.modelId)&&!y.has(V.modelId)),...f].sort((V,U)=>V.order-U.order),g=b.length>=2,_=b.length===1,k=`${a}PK`,h=V=>m.has(V.modelId)?"mapsId":V.identifier?"id":"none",E=o.lombok!==!1;i.jpa("Entity"),i.import(lt.jsonIdentityInfo),i.import(lt.jsogGenerator);const N=["@Entity"];N.push(pg(e,n,o,i)),N.push('@SuppressWarnings("serial")'),N.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),g&&(i.jpa("IdClass"),i.import(`${r}.${a}.${k}`),N.push(`@IdClass(${a}.${k}.class)`)),(R=e.jpaAttrs)!=null&&R.useDynamicInsert&&(N.push("@DynamicInsert"),i.import(lt.dynamicInsert)),(w=e.jpaAttrs)!=null&&w.useDynamicUpdate&&(N.push("@DynamicUpdate"),i.import(lt.dynamicUpdate)),(v=e.jpaAttrs)!=null&&v.useCacheable&&(N.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(cg),N.push("@PersonalInfo")),E&&(i.import(lt.lombokNoArgs),i.import(lt.lombokAccessLevel),N.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const V of il((I=e.table)==null?void 0:I.logicalName,""))i.line(V);for(const V of N)i.line(V);const C=e.abstractClass?"abstract ":"";i.line(`public ${C}class ${a}${c}${Xc(e,i)} {`);const A=p.fields.map(V=>V.attr),B=new Set(f.map(V=>V.modelId));for(const V of u){if(!m.has(V.modelId))continue;const U=(L=V.dbAttrs[0])==null?void 0:L.physicalName;if(U)for(const oe of u)oe.attrType==="NORMAL"&&oe.dbAttrs.some(ue=>ue.physicalName===U)&&B.add(oe.modelId)}const $=(M=e.jpaAttrs)!=null&&M.useVersion?u.length?u[u.length-1].modelId:null:void 0,x=[];for(const V of A){if(V.attrType.startsWith("EMBED"))x.push(...td(V,e,n,o,i));else if(V.attrType==="RELATION_OWN"){const U=d.get(V.modelId),oe=yg(V,U.assoc,s,l,h(V),E,n,o,i);oe&&x.push(oe)}else if(V.attrType==="RELATION_REF"){const U=d.get(V.modelId),oe=gg(V,U.assoc,s,l,E,n,o,i);oe&&x.push(oe)}else x.push(Qc(V,a,o,i,B.has(V.modelId)));V.modelId===$&&Wc(i,x,E)}$===null&&Wc(i,x,E),E||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Jc(x,i,E),Zc(e,i),g&&(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 ${k} getPK() {`),i.line(` return (${k}) HibernateBeanUtil.getPK(this);`),i.line(" }"),kg(k,b.map(V=>{const U=ua(V,n,o);return U.pkOwner&&i.import(qc(U.pkOwner,U.type,n,o)),{type:U.type,name:V.name}}),E,i)),i.line("}");let S;if(g)S=Eg(a,k,r);else if(_){const V=ua(b[0],n,o);S=Ng(a,r,V.type,V.pkOwner?qc(V.pkOwner,V.type,n,o):void 0)}return{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:S}}function Wc(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 Jc(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${Kc(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 sg(e,n,o){var d;const i=new jc,a=e.name;let r=To(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${si}')`),r=si),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}${Xc(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(...td(u,e,n,o,i));continue}c.push(Qc(u,a,o,i))}return Jc(c,i,o.lombok!==!1),Zc(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Xc(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 cg="net.g1project.bluecomm.annotation.PersonalInfo",dg="net.g1project.bluecomm.annotation.PersonalInfoAttribute",ug="net.g1project.bluecomm.model.PersonalInfoAttributeType";function Zc(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,`
18
+ `}}function Kc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Gc(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function $o(e,n){n&&(e.import(lt.lombokGetter),e.line(" @Getter"))}const ag=["ko","en","ja","zh"];function il(e,n){if(!e)return[];const o=ag.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=[...ai,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Yn){if(i){const c=[`${Ao}.Enumerated`,`${Ao}.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:[`${Ao}.Enumerated`,`${Ao}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===hn){const c=og(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=Uc(o,"money");return{type:"Money",primitive:!1,imports:c?[lt.money,`${Ao}.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 rg(e,n){var a;const o=(a=e.derivedFrom)==null?void 0:a.associationRef;if(!o)return;const i=n.associations.find(r=>r.modelId===o);return i?n.entities.find(r=>r.modelId===i.end1.entityRef):void 0}function ua(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return{type:da(e.type,e.customType,o,e.groupCode).type};const a=rg(e,n)??n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return{type:da(e.type,e.customType,o).type};const r=al(a);return r.length>=2?{type:`${a.name}PK`,pkOwner:a}:r.length===1?ua(r[0],n,o,new Set([...i,a.modelId])):{type:da(e.type,e.customType,o).type}}function Yc(e,n,o,i=new Set){return ua(e,n,o,i).type}function qc(e,n,o,i){return`${To(e,o,i)||si}.${e.name}.${n}`}function ma(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!fa(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 Gc(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function lg(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 Yc(r||e,i,a)}function ll(e,n,o){var y,b,g;const i=new Map(n.entities.map(_=>[_.modelId,_])),a=Dr(n.associations),r=new Map;for(const _ of n.associations)_.end2.attributeRef&&r.set(_.end2.attributeRef,{assoc:_,role:"owner"}),_.end1.attributeRef&&_.end1.navigable&&r.set(_.end1.attributeRef,{assoc:_,role:"inverse"});const l=al(e),s=new Set;for(const _ of l)ma(_,(y=r.get(_.modelId))==null?void 0:y.assoc)&&s.add(_.modelId);const c=new Set(l.filter(_=>_.attrType==="NORMAL").flatMap(_=>_.dbAttrs.map(k=>k.physicalName)).filter(Boolean)),d=[],u=[];for(const _ of l){if(!s.has(_.modelId))continue;const k=r.get(_.modelId).assoc,h=_.dbAttrs[0],E=(h==null?void 0:h.physicalName)||cl(_,k,i,0)||"";if(E&&c.has(E))continue;const N=rl(_,k,i);if(!N){u.push(_);continue}const C=_.derivedFrom?(b=i.get(k.end1.entityRef))==null?void 0:b.attributes.find(A=>A.modelId===_.derivedFrom.sourceAttributeRef):void 0;d.push({attr:{modelId:`synthetic-id:${_.modelId}`,name:N,type:o?o(_,k):(C==null?void 0:C.type)??_.type,customType:(C==null?void 0:C.customType)??_.customType,attrType:"NORMAL",identifier:!0,notNull:!0,order:_.order,dbAttrs:[{...h??{modelId:`synthetic-col:${_.modelId}`,dataType:""},physicalName:E}]},role:"scalar",synthetic:!0,sourceAttr:_})}const m=[],p=[];for(const _ of e.attributes)if(_.attrType!=="DIVIDER"){if(_.attrType.startsWith("EMBED")){p.push({attr:_,role:"embed",synthetic:!1,sourceAttr:_,collection:na(_,n.associations)});continue}if(_.attrType==="RELATION_OWN"){const k=r.get(_.modelId);k?p.push({attr:_,role:"relation-owner",synthetic:!1,sourceAttr:_,assoc:k.assoc,target:i.get(k.assoc.end1.entityRef)}):Or(_,e,a)?m.push({attr:_,reason:"join-column-only"}):m.push({attr:_,reason:"no-anchor"});continue}if(_.attrType==="RELATION_REF"){const k=r.get(_.modelId);if(!k){m.push({attr:_,reason:"nav-not-materialized"});continue}p.push({attr:_,role:"relation-inverse",synthetic:!1,sourceAttr:_,assoc:k.assoc,target:i.get(k.assoc.end2.entityRef),collection:fa(k.assoc.end2.multiplicity)?((g=k.assoc.end2.jpa)==null?void 0:g.collectionType)??"LIST":void 0});continue}p.push({attr:_,role:"scalar",synthetic:!1,sourceAttr:_})}return{fields:[...d,...p].sort((_,k)=>_.attr.order-k.attr.order),omitted:m,unresolvedDerivedIds:u}}function sg(e,n,o){var T,R,w,v,I,L,M;if(e.stereotype==="JPA_EMBEDDABLE")return cg(e,n,o);const i=new jc,a=e.name;let r=To(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${si}')`),r=si);const l=new Map(n.entities.map(V=>[V.modelId,V])),s=r,c=kg(e,o,i),d=new Map;for(const V of n.associations)V.end2.attributeRef&&d.set(V.end2.attributeRef,{assoc:V,role:"owner"}),V.end1.attributeRef&&V.end1.navigable&&d.set(V.end1.attributeRef,{assoc:V,role:"inverse"});const u=al(e),m=new Set;for(const V of u)ma(V,(T=d.get(V.modelId))==null?void 0:T.assoc)&&m.add(V.modelId);const p=ll(e,n,(V,U)=>lg(V,U,l,n,o)),f=p.fields.filter(V=>V.synthetic).map(V=>V.attr);for(const V of p.unresolvedDerivedIds)i.fillIn(`${a}.${V.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);for(const V of p.omitted)V.reason==="no-anchor"&&i.fillIn(`${e.name}.${V.attr.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`);const y=new Set(p.omitted.map(V=>V.attr.modelId)),b=[...u.filter(V=>!m.has(V.modelId)&&!y.has(V.modelId)),...f].sort((V,U)=>V.order-U.order),g=b.length>=2,_=b.length===1,k=`${a}PK`,h=V=>m.has(V.modelId)?"mapsId":V.identifier?"id":"none",E=o.lombok!==!1;i.jpa("Entity"),i.import(lt.jsonIdentityInfo),i.import(lt.jsogGenerator);const N=["@Entity"];N.push(hg(e,n,o,i)),N.push('@SuppressWarnings("serial")'),N.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),g&&(i.jpa("IdClass"),i.import(`${r}.${a}.${k}`),N.push(`@IdClass(${a}.${k}.class)`)),(R=e.jpaAttrs)!=null&&R.useDynamicInsert&&(N.push("@DynamicInsert"),i.import(lt.dynamicInsert)),(w=e.jpaAttrs)!=null&&w.useDynamicUpdate&&(N.push("@DynamicUpdate"),i.import(lt.dynamicUpdate)),(v=e.jpaAttrs)!=null&&v.useCacheable&&(N.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(dg),N.push("@PersonalInfo")),E&&(i.import(lt.lombokNoArgs),i.import(lt.lombokAccessLevel),N.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const V of il((I=e.table)==null?void 0:I.logicalName,""))i.line(V);for(const V of N)i.line(V);const C=e.abstractClass?"abstract ":"";i.line(`public ${C}class ${a}${c}${Xc(e,i)} {`);const A=p.fields.map(V=>V.attr),B=new Set(f.map(V=>V.modelId));for(const V of u){if(!m.has(V.modelId))continue;const U=(L=V.dbAttrs[0])==null?void 0:L.physicalName;if(U)for(const oe of u)oe.attrType==="NORMAL"&&oe.dbAttrs.some(ue=>ue.physicalName===U)&&B.add(oe.modelId)}const $=(M=e.jpaAttrs)!=null&&M.useVersion?u.length?u[u.length-1].modelId:null:void 0,x=[];for(const V of A){if(V.attrType.startsWith("EMBED"))x.push(...td(V,e,n,o,i));else if(V.attrType==="RELATION_OWN"){const U=d.get(V.modelId),oe=gg(V,U.assoc,s,l,h(V),E,n,o,i);oe&&x.push(oe)}else if(V.attrType==="RELATION_REF"){const U=d.get(V.modelId),oe=bg(V,U.assoc,s,l,E,n,o,i);oe&&x.push(oe)}else x.push(Qc(V,a,o,i,B.has(V.modelId)));V.modelId===$&&Wc(i,x,E)}$===null&&Wc(i,x,E),E||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Jc(x,i,E),Zc(e,i),g&&(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 ${k} getPK() {`),i.line(` return (${k}) HibernateBeanUtil.getPK(this);`),i.line(" }"),Eg(k,b.map(V=>{const U=ua(V,n,o);return U.pkOwner&&i.import(qc(U.pkOwner,U.type,n,o)),{type:U.type,name:V.name}}),E,i)),i.line("}");let S;if(g)S=Ng(a,k,r);else if(_){const V=ua(b[0],n,o);S=wg(a,r,V.type,V.pkOwner?qc(V.pkOwner,V.type,n,o):void 0)}return{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:S}}function Wc(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 Jc(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${Kc(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 cg(e,n,o){var d;const i=new jc,a=e.name;let r=To(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${si}')`),r=si),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}${Xc(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(...td(u,e,n,o,i));continue}c.push(Qc(u,a,o,i))}return Jc(c,i,o.lombok!==!1),Zc(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Xc(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 dg="net.g1project.bluecomm.annotation.PersonalInfo",ug="net.g1project.bluecomm.annotation.PersonalInfoAttribute",mg="net.g1project.bluecomm.model.PersonalInfoAttributeType";function Zc(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(dg),n.import(ug),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function Qc(e,n,o,i,a=!1){const r=e.dbAttrs[0],l=e.name||Gc(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(` ${bg(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=Uc(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)`),$o(i,o.lombok!==!1),i.line(` private ${d} ${l} = new LinkedHashSet<>();`)):($o(i,o.lombok!==!1),i.line(` private ${d} ${l};`)),{type:d,name:l,category:0}}function ed(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 mg(e,n,o,i,a,r){var u;const l=Eo($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,b=Gn(y,l),g=b?b.physicalName:y.physicalName||"",_=(f==null?void 0:f.defaultSharedRef)!=null?s(f.defaultSharedRef):(f==null?void 0:f.defaultPhysical)??"";if(!(!g||g===_)){if(!f||!f.propertyPath){r.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${p}] @AttributeOverride 프로퍼티 경로 미해소(카탈로그/중첩 임베더블 형상 확인)`);return}d.push(b?`@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 td(e,n,o,i,a){var m,p,f,y;const r=n.name,l=To(n,o,i);if(Qt(e.name))return a.fillIn(`${r} 임베드: 속성명(필드명) 미지정 — @Embedded/@ElementCollection 방출 불가, 속성명을 채워야 함`),[];let s=e.type;if(e.attrType==="EMBED_OWN"){const b=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(g=>g.modelId===e.embedded.embeddableRef):void 0;if(b){s=b.name;const g=To(b,o,i);g&&g!==l&&a.import(`${g}.${b.name}`)}}if(Qt(s))return a.fillIn(`${r}.${e.name}: 임베드 대상 타입 미해소 — @Embedded/@ElementCollection 방출 불가`),[];if(e.type==="Money")return[fg(e,n,o,i,a)];const c=ed(e,o,i),d=mg(e,n,o,c,i,a),u=na(e,o.associations);if(a.line(""),u){const b=o.associations.find(N=>{var C;return N.modelId===((C=e.embedded)==null?void 0:C.associationRef)}),g=b?b.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?b.end2:b.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const _=(f=g==null?void 0:g.jpa)==null?void 0:f.collectionTable;_?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${_}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),sl(d,a);const k=u==="SET";!k&&((y=g==null?void 0:g.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${g.jpa.orderColumn}")`)),a.import(k?"java.util.Set":"java.util.List"),a.import(k?"java.util.LinkedHashSet":"java.util.ArrayList");const h=k?`Set<${s}>`:`List<${s}>`,E=k?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${E};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),sl(d,a),$o(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function fg(e,n,o,i,a){a.jpa("Embedded"),a.import(lt.compositeType),a.import(lt.money),a.import(lt.moneyUserType);const r=ed(e,o,i),l=Eo($n(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var g,_;const u=((g=r[d])==null?void 0:g.propertyPath)||(d===0?"amount":d===1?"currency":`field${d}`),m=Gn(c,l),p=((_=r[d])==null?void 0:_.defaultPhysical)||"",f=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!f||f===p))return[];const b=[`name = "${m?m.physicalName:f||p}"`];return e.notNull&&b.push("nullable = false"),m?b.push("insertable = false","updatable = false"):(c.insertable===!1&&b.push("insertable = false"),c.updatable===!1&&b.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${b.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),sl(s,a),$o(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 pg(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,oi(p,f,y,e,n,l)));for(const p of ti(e,o.superClassCatalog??[]))s.set(p.modelId,p.physicalName);const c=Hn(e.attributes),d=[];for(const p of r){const f=[];for(const b of p.columns){const g=s.get(c.canon(b.columnRef));if(!g){i.fillIn(`${e.name}.@Index(${p.name}): 컬럼 참조 미해소(${Xs(c,b.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(`,
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(ug),n.import(mg),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function Qc(e,n,o,i,a=!1){const r=e.dbAttrs[0],l=e.name||Gc(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")),(r==null?void 0:r.dataType)==="CLOB"&&(i.jpa("Lob"),i.line(" @Lob")),i.line(` ${_g(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=Uc(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)`),$o(i,o.lombok!==!1),i.line(` private ${d} ${l} = new LinkedHashSet<>();`)):($o(i,o.lombok!==!1),i.line(` private ${d} ${l};`)),{type:d,name:l,category:0}}function ed(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 fg(e,n,o,i,a,r){var u;const l=Eo($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,b=Gn(y,l),g=b?b.physicalName:y.physicalName||"",_=(f==null?void 0:f.defaultSharedRef)!=null?s(f.defaultSharedRef):(f==null?void 0:f.defaultPhysical)??"";if(!(!g||g===_)){if(!f||!f.propertyPath){r.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${p}] @AttributeOverride 프로퍼티 경로 미해소(카탈로그/중첩 임베더블 형상 확인)`);return}d.push(b?`@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 td(e,n,o,i,a){var m,p,f,y;const r=n.name,l=To(n,o,i);if(Qt(e.name))return a.fillIn(`${r} 임베드: 속성명(필드명) 미지정 — @Embedded/@ElementCollection 방출 불가, 속성명을 채워야 함`),[];let s=e.type;if(e.attrType==="EMBED_OWN"){const b=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(g=>g.modelId===e.embedded.embeddableRef):void 0;if(b){s=b.name;const g=To(b,o,i);g&&g!==l&&a.import(`${g}.${b.name}`)}}if(Qt(s))return a.fillIn(`${r}.${e.name}: 임베드 대상 타입 미해소 — @Embedded/@ElementCollection 방출 불가`),[];if(e.type==="Money")return[pg(e,n,o,i,a)];const c=ed(e,o,i),d=fg(e,n,o,c,i,a),u=na(e,o.associations);if(a.line(""),u){const b=o.associations.find(N=>{var C;return N.modelId===((C=e.embedded)==null?void 0:C.associationRef)}),g=b?b.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?b.end2:b.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const _=(f=g==null?void 0:g.jpa)==null?void 0:f.collectionTable;_?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${_}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),sl(d,a);const k=u==="SET";!k&&((y=g==null?void 0:g.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${g.jpa.orderColumn}")`)),a.import(k?"java.util.Set":"java.util.List"),a.import(k?"java.util.LinkedHashSet":"java.util.ArrayList");const h=k?`Set<${s}>`:`List<${s}>`,E=k?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${E};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),sl(d,a),$o(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function pg(e,n,o,i,a){a.jpa("Embedded"),a.import(lt.compositeType),a.import(lt.money),a.import(lt.moneyUserType);const r=ed(e,o,i),l=Eo($n(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var g,_;const u=((g=r[d])==null?void 0:g.propertyPath)||(d===0?"amount":d===1?"currency":`field${d}`),m=Gn(c,l),p=((_=r[d])==null?void 0:_.defaultPhysical)||"",f=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!f||f===p))return[];const b=[`name = "${m?m.physicalName:f||p}"`];return e.notNull&&b.push("nullable = false"),m?b.push("insertable = false","updatable = false"):(c.insertable===!1&&b.push("insertable = false"),c.updatable===!1&&b.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${b.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),sl(s,a),$o(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 hg(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,oi(p,f,y,e,n,l)));for(const p of ti(e,o.superClassCatalog??[]))s.set(p.modelId,p.physicalName);const c=Hn(e.attributes),d=[];for(const p of r){const f=[];for(const b of p.columns){const g=s.get(c.canon(b.columnRef));if(!g){i.fillIn(`${e.name}.@Index(${p.name}): 컬럼 참조 미해소(${Xs(c,b.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 fa(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=ko(a)[i])==null?void 0:r.physicalName}return(l=ko(a)[i])==null?void 0:l.physicalName}function hg(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 nd(e,n,o,i,a){if(!e)return;const r=To(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function yg(e,n,o,i,a,r,l,s,c){var _;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=fa(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),nd(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}`)),(_=p==null?void 0:p.cascadeTypes)!=null&&_.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${p.cascadeTypes.map(k=>`CascadeType.${k}`).join(", ")} }`)),c.jpa("JoinColumn");const y=i.get(n.end2.entityRef),b=y?hg(e,n,y,i):[e],g=[];for(const k of b){const h=Math.max(1,k.dbAttrs.length);for(let E=0;E<h;E++){const N=k.dbAttrs[E],C=cl(k,n,i,E),A=(N==null?void 0:N.physicalName)||C||"",B=[];A?B.push(`name = "${A}"`):c.fillIn(`${(y==null?void 0:y.name)??""}.${k.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),C&&B.push(`referencedColumnName = "${C}"`),k.notNull&&B.push("nullable = false"),(N==null?void 0:N.insertable)===!1&&B.push("insertable = false"),(N==null?void 0:N.updatable)===!1&&B.push("updatable = false"),g.push(`@JoinColumn(${B.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((k,h)=>{const E=h===g.length-2;c.line(` ${k}${E?"})":","}`)})),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),$o(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function gg(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(N=>N.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;nd(c,o,r,l,s);const p=fa(n.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),$o(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 b=(f==null?void 0:f.cascadeTypes)??[],g=f==null?void 0:f.orphanRemoval;y&&b.length===0&&(b=["ALL"],g==null&&(g=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const _=[`mappedBy = "${m}"`];b.length&&(s.jpa("CascadeType"),_.push(`cascade = { ${b.map(N=>`CascadeType.${N}`).join(", ")} }`)),g&&_.push("orphanRemoval = true"),f!=null&&f.fetchType&&(s.jpa("FetchType"),_.push(`fetch = FetchType.${f.fetchType}`)),s.line(` @OneToMany(${_.join(", ")})`),f!=null&&f.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${f.orderBy}")`));const k=(f==null?void 0:f.collectionType)==="SET";s.import(k?"java.util.Set":"java.util.List"),s.import(k?"java.util.LinkedHashSet":"java.util.ArrayList");const h=k?`Set<${d}>`:`List<${d}>`,E=k?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${h} ${e.name} = ${E};`),{type:h,name:e.name,category:1,collection:!0}}function bg(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 _g(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 kg(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${Kc(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 Eg(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(`
23
+ })`}function fa(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=ko(a)[i])==null?void 0:r.physicalName}return(l=ko(a)[i])==null?void 0:l.physicalName}function yg(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 nd(e,n,o,i,a){if(!e)return;const r=To(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function gg(e,n,o,i,a,r,l,s,c){var _;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=fa(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),nd(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}`)),(_=p==null?void 0:p.cascadeTypes)!=null&&_.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${p.cascadeTypes.map(k=>`CascadeType.${k}`).join(", ")} }`)),c.jpa("JoinColumn");const y=i.get(n.end2.entityRef),b=y?yg(e,n,y,i):[e],g=[];for(const k of b){const h=Math.max(1,k.dbAttrs.length);for(let E=0;E<h;E++){const N=k.dbAttrs[E],C=cl(k,n,i,E),A=(N==null?void 0:N.physicalName)||C||"",B=[];A?B.push(`name = "${A}"`):c.fillIn(`${(y==null?void 0:y.name)??""}.${k.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),C&&B.push(`referencedColumnName = "${C}"`),k.notNull&&B.push("nullable = false"),(N==null?void 0:N.insertable)===!1&&B.push("insertable = false"),(N==null?void 0:N.updatable)===!1&&B.push("updatable = false"),g.push(`@JoinColumn(${B.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((k,h)=>{const E=h===g.length-2;c.line(` ${k}${E?"})":","}`)})),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),$o(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function bg(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(N=>N.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;nd(c,o,r,l,s);const p=fa(n.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),$o(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 b=(f==null?void 0:f.cascadeTypes)??[],g=f==null?void 0:f.orphanRemoval;y&&b.length===0&&(b=["ALL"],g==null&&(g=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const _=[`mappedBy = "${m}"`];b.length&&(s.jpa("CascadeType"),_.push(`cascade = { ${b.map(N=>`CascadeType.${N}`).join(", ")} }`)),g&&_.push("orphanRemoval = true"),f!=null&&f.fetchType&&(s.jpa("FetchType"),_.push(`fetch = FetchType.${f.fetchType}`)),s.line(` @OneToMany(${_.join(", ")})`),f!=null&&f.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${f.orderBy}")`));const k=(f==null?void 0:f.collectionType)==="SET";s.import(k?"java.util.Set":"java.util.List"),s.import(k?"java.util.LinkedHashSet":"java.util.ArrayList");const h=k?`Set<${d}>`:`List<${d}>`,E=k?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${h} ${e.name} = ${E};`),{type:h,name:e.name,category:1,collection:!0}}function _g(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 kg(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 Eg(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${Kc(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 Ng(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 Ng(e,n,o,i){const a=[`${n}.${e}`,...i?[i]:[],lt.jpaRepository,lt.querydslExecutor].sort(),r=[`package ${n};`,""];for(const l of a)r.push(`import ${l};`);return r.push(""),r.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),r.push("}"),{fileName:`${e}Repository.java`,source:r.join(`
25
+ `}}function wg(e,n,o,i){const a=[`${n}.${e}`,...i?[i]:[],lt.jpaRepository,lt.querydslExecutor].sort(),r=[`package ${n};`,""];for(const l of a)r.push(`import ${l};`);return r.push(""),r.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),r.push("}"),{fileName:`${e}Repository.java`,source:r.join(`
26
26
  `)+`
27
- `}}const si="com.example",wg="command.domain";function To(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??wg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Ig="CustomMoneyType",vg="Money";function Cg(e){return!(e.type!==Ig||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Sg(e){const n=e.dbAttrs[0]??{modelId:Pe(),physicalName:"",dataType:""},o={modelId:Pe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:vg,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function xg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Cg(l)?(a=!0,n=!0,Sg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Rg(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const b=new Map,g=new Map,_=new Map,k=(h,E,N)=>{if(!h)return;o.get(h)||o.set(h,[{entityId:E,assignedId:h}]),i.push({id:h,entityId:E,sink:N}),N(h)};for(const h of y.attributes){k(h.modelId,y.modelId,E=>b.set(h,E));for(const E of h.dbAttrs)k(E.modelId,y.modelId,N=>g.set(E,N))}for(const h of y.indexes??[])k(h.modelId,y.modelId,E=>_.set(h,E));a.set(y,{attrs:b,cols:g,idx:_})}const r=new Set(o.keys()),l=new Map;for(const y of i){const b=(l.get(y.id)??0)+1;if(l.set(y.id,b),b===1)continue;const g=Ag(y.id,b-1,r);r.add(g),o.get(y.id).push({entityId:y.entityId,assignedId:g}),y.sink(g)}const s=[...o.values()].reduce((y,b)=>y+Math.max(0,b.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,b)=>{var _;if(!b||!y)return b;const g=o.get(b);return!g||g.length<2?b:((_=g.find(k=>k.entityId===y))==null?void 0:_.assignedId)??b},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,b)=>{const g=d.get(y);if(g)return g.end1.entityRef===b?g.end2.entityRef:g.end1.entityRef},m=e.entities.map(y=>{var h;const b=a.get(y),g=y.attributes.map(E=>{const N=b.attrs.get(E),C=E.dbAttrs.map($=>{const x=b.cols.get($);return x===$.modelId?$:{...$,modelId:x}});let A=E.derivedFrom;if(A){const $=u(A.associationRef,y.modelId),x=c($,A.sourceAttributeRef);x!==A.sourceAttributeRef&&(A={...A,sourceAttributeRef:x})}return N!==E.modelId||A!==E.derivedFrom||C.some(($,x)=>$!==E.dbAttrs[x])?{...E,modelId:N,dbAttrs:C,derivedFrom:A}:E}),_=(h=y.indexes)==null?void 0:h.map(E=>{const N=b.idx.get(E),C=E.columns.map(B=>{const $=c(y.modelId,B.columnRef);return $===B.columnRef?B:{...B,columnRef:$}});return N!==E.modelId||C.some((B,$)=>B!==E.columns[$])?{...E,modelId:N,columns:C}:E});return g.some((E,N)=>E!==y.attributes[N])||_&&y.indexes&&_.some((E,N)=>E!==y.indexes[N])?{...y,attributes:g,..._?{indexes:_}:{}}:y}),p=e.associations.map(y=>{const b=c(y.end1.entityRef,y.end1.attributeRef),g=c(y.end2.entityRef,y.end2.attributeRef);return b===y.end1.attributeRef&&g===y.end2.attributeRef?y:{...y,end1:b===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:b},end2:g===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:g}}}),f=n.associationLayouts.map(y=>{const b=d.get(y.associationRef);if(!b)return y;const g=c(b.end1.entityRef,y.sourceColumnRef),_=c(b.end2.entityRef,y.targetColumnRef);return g===y.sourceColumnRef&&_===y.targetColumnRef?y:{...y,sourceColumnRef:g,targetColumnRef:_}});return{logical:{...e,entities:m,associations:p},layout:f.some((y,b)=>y!==n.associationLayouts[b])?{...n,associationLayouts:f}:n,reissued:s}}function Ag(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 od(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function id(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(od);if(!i.length)continue;const a=o.filter(s=>!od(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 Mo(e){return JSON.parse(JSON.stringify(e))}function ad(e,n,o){var B;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 x of r.associations){const S=$.has(x.end1.entityRef),T=$.has(x.end2.entityRef);S!==T&&s.add(S?x.end2.entityRef:x.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 x=p.get($);return x||(x=i(),p.set($,x)),x};for(const $ of c){f($.modelId);for(const x of $.attributes){f(x.modelId);for(const S of x.dbAttrs)f(S.modelId)}for(const x of $.indexes??[])f(x.modelId);for(const x of $.operations??[])f(x.modelId)}for(const $ of u)f($.modelId);const y=$=>p.get($),b=c.map($=>{const x=Mo($);x.modelId=y($.modelId),x.attributes=x.attributes.map(S=>$g(S,y,m,d));for(const S of x.indexes??[])S.modelId=y(S.modelId),S.columns=S.columns.map(T=>jn(T.columnRef)?T:{...T,columnRef:y(T.columnRef)}).filter(T=>T.columnRef!==void 0);for(const S of x.operations??[])S.modelId=y(S.modelId);return x});id(b);const g=u.map($=>{const x=Mo($);return x.modelId=y($.modelId),x.end1=rd(x.end1,y),x.end2=rd(x.end2,y),x}),_=[];for(const $ of r.groups){const x=$.memberEntityRefs.filter(T=>d.has(T));if(x.length===0)continue;const S=Mo($);S.modelId=f($.modelId),S.memberEntityRefs=x.map(T=>y(T)),_.push(S)}const k=o.collisionSuffix??"_imported",h=new Set(o.existing.entities.map($=>$.name)),E=new Set(o.existing.entities.map($=>{var x;return(x=$.table)==null?void 0:x.physicalName}).filter($=>!!$));for(const $ of b)h.has($.name)&&($.name=`${$.name}${k}`),(B=$.table)!=null&&B.physicalName&&E.has($.table.physicalName)&&($.table.physicalName=`${$.table.physicalName}${k}`);const N=[];for(const $ of l.entityLayouts){const x=y($.entityRef);if(!x)continue;const S=Mo($);S.entityRef=x,S.geo={...S.geo,location:ul(S.geo.location,a)},S.attributeStyles&&(S.attributeStyles=pa(S.attributeStyles,y)),S.operationStyles&&(S.operationStyles=pa(S.operationStyles,y)),N.push(S)}const C=[];for(const $ of l.associationLayouts){const x=y($.associationRef);if(!x)continue;const S=Mo($);S.associationRef=x,S.sourceColumnRef=$.sourceColumnRef?y($.sourceColumnRef):void 0,S.targetColumnRef=$.targetColumnRef?y($.targetColumnRef):void 0,S.waypoints=S.waypoints.map(T=>ul(T,a)),C.push(S)}const A=[];for(const $ of l.groupLayouts){const x=y($.groupRef);if(!x)continue;const S=Mo($);S.groupRef=x,S.geo={...S.geo,location:ul(S.geo.location,a)},delete S.memberNoteRefs,A.push(S)}return{logical:{entities:b,associations:g,groups:_},layout:{entityLayouts:N,associationLayouts:C,groupLayouts:A},idMap:p}}function ul(e,n){return{x:e.x+n.x,y:e.y+n.y}}function $g(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 rd(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 Tg(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const Mg=new Set(["attributes","operations","indexes","rev"]),Vg=new Set(["end1","end2","rev"]),Bg=new Set(["memberEntityRefs","rev"]),ld=new Set(["modelId"]),Dg=new Set(["modelId","columns"]),Og=new Set([]);function Lg(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,ld);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,ld);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,Dg);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Pg(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,Mg);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Lg(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,Vg);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]??{},Og);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,Bg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Tg(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 zg(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 Fg(e,n){const o=[];return Pg(e.logical,n.logical,o),zg(e.layout,n.layout,o),o}function Ug(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 Hg={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 jg{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=Hg[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=Ug(n),i=new jg(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 b=fl((r=y.value)==null?void 0:r.attributes,n.attributeRef);b&&en(i,f,b,"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 b=fl((s=y.value)==null?void 0:s.operations,n.operationRef);b&&en(i,f,b,"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 b=fl((d=y.value)==null?void 0:d.indexes,n.indexRef);b&&en(i,f,b,"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 b=(m=y.value)==null?void 0:m[n.end];en(i,f,b,"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 b=(p=y.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(b))for(const g of b)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는 의도적 범위 밖)"},Kg={"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,Gg=e=>{var n;return Ft((n=e.value)==null?void 0:n.modelId)};function sd(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=Kg[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=sd(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?Gg(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 Yg(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=sd(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 qg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Wg(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 cd(e,n){const o=e.filter(s=>s.ops.some(c=>qg(c,n))),{attributes:i,operations:a,indexes:r}=Wg(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 Jg(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 Xg(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=Yg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Zg(e){const{entities:n,associations:o,groups:i}=Xg(e),a=[];for(const r of n)for(const l of cd(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=Zg(e),o=Jg(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 dd(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Qg(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;eb.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const eb=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=dd(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 Qg(e,o,r)){const p=s.get(dd(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 b=null;for(const _ of m.evs){_.verb==="add"&&b!==null&&b!=="add"&&y.clear(),b=_.verb;for(const k of _.fields){const h=y.get(k.field);h?h.lastValue=k.value:y.set(k.field,{firstOld:k.oldValue,hasOld:k.oldValue!==void 0,lastValue:k.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const _=[];for(const[k,h]of y)_.push({field:k,value:h.lastValue});d.push({subject:m.subject,verb:"added",fields:_});continue}const g=[];for(const[_,k]of y)k.hasOld&&Jn(k.firstOld,k.lastValue)||g.push({field:_,value:k.lastValue,...k.hasOld?{oldValue:k.firstOld}:{}});g.length!==0&&d.push({subject:m.subject,verb:"modified",fields:g})}return{fromSeq:o,toSeq:r,entries:d}}function ud(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 md(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=md(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 fd(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=md(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 pd(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 hd(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 Vo(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 yd(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 gd(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 bd(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 _d(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 kd(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 Ed(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function Nd(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function 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 wd(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Id(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function vd(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 Cd(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 Sd(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 xd(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 xd("attribute.update","attributeRef",e,r,i??[])}}}function Rd(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 Ad(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 $d(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 Td(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 xd("operation.update","operationRef",e,r,i??[])}}}function Md(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 Vd(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 Bd(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 Dd(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 Od(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 Ld(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 Pd(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 zd(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 Fd(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 Ud(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 Hd(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 jd(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Kd(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Gd(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 Yd(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 qd(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 Wd(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 Jd(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 Xd(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 Zd(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 Qd(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 eu(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 tb=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ea,addAttribute:tn,addEntity:ga,addEntityToGroup:Nd,addGroup:_a,addIndex:Bd,addNote:Ud,addNoteConnection:Wd,addNoteConnectionWaypoint:Zd,addNoteToGroup:Yd,addOperation:Rd,addWaypoint:Fd,clearNoteConnectionWaypoints:eu,clearWaypoints:zd,composite:rt,moveEntity:Vo,moveGroup:wd,moveNote:mi,moveNoteConnectionWaypoint:Xd,moveWaypoint:Od,removeAssociation:Vd,removeAttribute:Sd,removeEntity:fd,removeEntityFromGroup:ka,removeGroup:Ed,removeIndex:Dd,removeNote:Hd,removeNoteConnection:Jd,removeNoteConnectionWaypoint:Qd,removeNoteFromGroup:qd,removeOperation:$d,removeWaypoint:Ld,renameEntity:hd,reorderAttributes:El,reorderOperations:Td,resizeEntity:yd,resizeGroup:Id,resizeNote:jd,setAllEntitiesCollapsed:kl,setAttributeSwatch:ba,setEntityCollapsed:bd,setEntityLocked:_d,setEntitySwatch:gd,setGroupLocked:Cd,setGroupSwatch:vd,setNoteMemo:Kd,setNoteSwatch:Gd,setOperationSwatch:Md,translateWaypoints:Pd,updateAssociation:Na,updateAssociationEnd:Ht,updateAttribute:nn,updateEntity:pd,updateGroup:kd,updateIndex:wa,updateOperation:Ad},Symbol.toStringTag,{value:"Module"}));class tu{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 nb=[400,1200];function ob(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 ib(e){const n=ob(e);return n==null||n===408||n===429?!0:n<400||n>=500}const ab=e=>new Promise(n=>setTimeout(n,e));class nu{constructor(n){ct(this,"cache",new tu);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??nb}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||!ib(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await ab(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 ou=["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"],iu=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function au(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 rb(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 lb(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=oi(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 ru(e,n,o=Pe){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=rb(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;lb(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 lu(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 b=c.map(_=>y.dbAttrs[d.get(_)]),g=b.reduce((_,k,h)=>k===y.dbAttrs[h]?_:_+1,0);g&&m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:b,moved:g})}return m}function su(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 b=y.dbAttrs.filter((k,h)=>d.has(h)),g=y.dbAttrs.filter((k,h)=>!d.has(h));y.dbAttrs.some((k,h)=>{if(d.has(h))return!1;const E=l[h],N=!!k.physicalName&&k.physicalName!==((E==null?void 0:E.physicalName)??""),C=k.sharedColumnRef!=null&&k.sharedColumnRef!==(E==null?void 0:E.sharedColumnRef);return N||C})||m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:b,dropped:g})}return m}function sb(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 cb(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 cu(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=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=>mb(i,e))}}function db(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=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=>({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 ub=new Set(["name","description","packageName","excludeDDLGeneration"]);function mb(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 du(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 fb(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 pb(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 uu(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 hb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function yb(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function gb(e,n){const o=hb(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 mu(e,n){const o=yb(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 fu(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function pu(e){return fu(e)&&e.dataType==null}function hu(e,n,o){const i=fu(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 yu(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 b={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=uu($n(i,a),b);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:b}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:b,matches: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 bb=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName"]),_b=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),kb=new Set(["description","identifying"]),Eb=new Set(["multiplicity","navigable","composition"]),Nb=new Set(["name","unique","description","parameters"]),wb=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Bo(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"]),Ib=new Set([...Cl].filter(e=>e!=="sharedColumnRef"));function vb(e,n,o,i){if(i||o.some(l=>!Ib.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))Cl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function Cb(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"},_=uu($n(i,a),g);if(!_.ok){s.push(_.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:_.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});return}const b={...m};delete b.sharedColumnRef,d.push({...b,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function gu(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 bu(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=pb(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 Do(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 Sb(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 au(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function xb(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 b=p.get(f)??[];b.push(y),p.set(f,b)}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 su(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 ru(f,m,r))u(y)}}function Sl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of Lc(n,o,i)){for(const u of c.remove)Do(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 Rb(e,n,o={}){const i=o.mkId??Pe,a=o.embeddableCatalog??[],r=h=>a.find(E=>E.type===h),l=[],s=[],c=new Map,d=(h,E)=>{const N=c.get(h)??zt(E);return c.set(h,N+1),N},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},y=[],b=new Set,g=(h,E)=>`${h}\0${E}`,_=new Set;for(const h of n)h.kind==="entity.add"&&(_.add(h.spec.name),h.spec.physicalName&&_.add(h.spec.physicalName));const k=new Set;return n.forEach((h,E)=>{var N,C,A,B,$;switch(h.kind){case"entity.add":{const x=e.entities.filter(L=>L.name===h.spec.name).map(L=>L.modelId);if(x.length||k.has(h.spec.name)){s.push({code:"entity-name-conflict",opIndex:E,handle:{ref:h.spec.name},matches:x});break}k.add(h.spec.name);const S=i(),T={modelId:S,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}}:{}},R={ref:h.spec.name};let w=!1;for(const[L,M]of(h.spec.attributes??[]).entries()){if(M.type==="GroupCodeEnum"&&!M.groupCode){s.push({code:"groupcode-required",opIndex:E,entity:R,handle:{ref:M.name}}),w=!0;continue}if(!r(M.type)&&!((N=M.embeddableOverrides)!=null&&N.length)&&pu(M)){s.push({code:"datatype-required",opIndex:E,entity:R,handle:{ref:M.name}}),w=!0;continue}const V=r(M.type);if(V){const U=yu(M,V,L,T,e.entities,E,R,s,i);U?T.attributes.push(U):w=!0}else(C=M.embeddableOverrides)!=null&&C.length?(s.push({code:"embeddable-type-unresolved",opIndex:E,entity:R,handle:{ref:M.name}}),w=!0):T.attributes.push(hu(M,L,i))}const v=(h.spec.operations??[]).map((L,M)=>gu(L,M,i));v.length&&(T.operations=v);const I=[];for(const L of h.spec.indexes??[]){const M=bu(T,L,E,R,s,i);M?I.push(M):w=!0}if(I.length&&(T.indexes=I),w)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:S,value:T});break}case"entity.update":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=Bo(h.patch,_b,["jpaAttrs.","table."]);if(S.length){s.push({code:"entity-patch-unknown-key",opIndex:E,entity:h.entity,keys:S});break}const T=h.patch.stereotype;if(typeof T=="string"&&T!==x.value.stereotype&&(T==="JPA_EMBEDDABLE"||x.value.stereotype==="JPA_EMBEDDABLE")){s.push({code:"stereotype-embeddable-transition-unsupported",opIndex:E,entity:h.entity,from:x.value.stereotype??"",to:T});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:h.patch});break}case"entity.remove":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=x.value.modelId,T=e.associations.filter(I=>I.end1.entityRef===S||I.end2.entityRef===S),R=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!==S)for(const L of I.attributes)L.embedded&&R.has(L.embedded.associationRef)&&Do(l,f,I.modelId,L.modelId);for(const I of T){if(I.end1.entityRef===S||!I.end1.attributeRef)continue;const L=e.entities.find(V=>V.modelId===I.end1.entityRef),M=L==null?void 0:L.attributes.find(V=>V.modelId===I.end1.attributeRef&&V.attrType==="RELATION_REF");M&&Do(l,f,L.modelId,M.modelId)}const w={...e,entities:e.entities.filter(I=>I.modelId!==S),associations:e.associations.filter(I=>!R.has(I.modelId))},v=new Set(T.filter(I=>I.end1.entityRef===S&&I.end2.entityRef!==S).map(I=>I.end2.entityRef));for(const I of v)Sl(l,w,I,i,f,d);for(const I of e.groups)I.memberEntityRefs.includes(S)&&(b.has(g(I.modelId,S))||(b.add(g(I.modelId,S)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:I.modelId,groupRef:I.modelId,entityRef:S})));p.add(S),l.push({kind:"entity.remove",casUnit:"logical",entityRef:S});break}case"attribute.add":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}if(h.spec.type==="GroupCodeEnum"&&!h.spec.groupCode){s.push({code:"groupcode-required",opIndex:E,entity:h.entity,handle:{ref:h.spec.name}});break}if(!r(h.spec.type)&&!((A=h.spec.embeddableOverrides)!=null&&A.length)&&pu(h.spec)){s.push({code:"datatype-required",opIndex:E,entity:h.entity,handle:{ref:h.spec.name}});break}const S=d(x.value.modelId,x.value.attributes),T=r(h.spec.type);let R;if(T)R=yu(h.spec,T,S,x.value,e.entities,E,h.entity,s,i);else if((B=h.spec.embeddableOverrides)!=null&&B.length){s.push({code:"embeddable-type-unresolved",opIndex:E,entity:h.entity,handle:{ref:h.spec.name}});break}else R=hu(h.spec,S,i);if(!R)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:R}),y.push({entityId:x.value.modelId,attribute:R});break}case"attribute.update":case"attribute.remove":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=du(x.value,h.attribute);if(!S.ok){s.push(S.reason==="not-found"?{code:"attribute-not-found",opIndex:E,entity:h.entity,handle:h.attribute}:{code:"attribute-ambiguous",opIndex:E,entity:h.entity,handle:h.attribute,matches:S.matches});break}if(h.kind==="attribute.update"){const T=[],R=[];let w=!1;for(const M of Object.keys(h.patch)){if(M.includes(".")){M.startsWith("dbAttrs.")?w=!0:R.push(M);continue}Cl.has(M)?T.push(M):bb.has(M)||R.push(M)}if(R.length){s.push({code:"attribute-patch-unknown-key",opIndex:E,entity:h.entity,handle:h.attribute,keys:R});break}if("attrType"in h.patch){const M=String(h.patch.attrType),V=iu.includes(M)?M!==S.value.attrType?"transition":void 0:"unknown-value";if(V){s.push({code:"attribute-attrtype-unsupported",opIndex:E,entity:h.entity,handle:h.attribute,reason:V,current:S.value.attrType,requested:M});break}}const v="type"in h.patch?h.patch.type:S.value.type,I="groupCode"in h.patch?h.patch.groupCode:S.value.groupCode;if(v==="GroupCodeEnum"&&!I){s.push({code:"groupcode-required",opIndex:E,entity:h.entity,handle:h.attribute});break}let L=h.patch;if(T.length){const M=vb(S.value,h.patch,T,w);if(!M){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:E,entity:h.entity,handle:h.attribute,keys:T});break}L=M}if(($=h.embeddableOverrides)!=null&&$.length){const M=r(S.value.type);if(!M||S.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:E,entity:h.entity,handle:h.attribute});break}const V=Cb(S.value,M,h.embeddableOverrides,x.value,e.entities,E,h.entity,s);if(!V)break;L={...L,dbAttrs:V}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:S.value.modelId,patch:L})}else{const T=xo(e,x.value.modelId,S.value.modelId);if(T){const R=w=>{var v;return((v=e.entities.find(I=>I.modelId===w))==null?void 0:v.name)??w};s.push({code:"attribute-fk-managed",opIndex:E,entity:h.entity,handle:h.attribute,association:{from:R(T.end1.entityRef),to:R(T.end2.entityRef)}});break}Do(l,f,x.value.modelId,S.value.modelId)}break}case"association.add":{const x=wt(e,h.spec.from),S=wt(e,h.spec.to);if(x.ok||s.push(It(x.reason,E,h.spec.from,x.matches,_)),S.ok||s.push(It(S.reason,E,h.spec.to,S.matches,_)),!x.ok||!S.ok)break;if(h.spec.identifying&&x.value.modelId===S.value.modelId){s.push({code:"self-identifying",opIndex:E,handle:{from:h.spec.from,to:h.spec.to}});break}if(x.value.stereotype==="JPA_EMBEDDABLE"||S.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:E,handle:{from:h.spec.from,to:h.spec.to}});break}const T=i(),R={modelId:T,...h.spec.identifying!=null?{identifying:h.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:h.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:S.value.modelId,multiplicity:h.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:h.spec.composition??!1}},w={...e,associations:[...e.associations,R]},v=ri(w,S.value.modelId,i);v.add[0]&&(R.end2.attributeRef=v.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:R});for(const I of v.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,value:{...I,order:d(S.value.modelId,S.value.attributes)}});break}case"association.remove":{const x=wt(e,h.association.from),S=wt(e,h.association.to);if(x.ok||s.push(It(x.reason,E,h.association.from,x.matches,_)),S.ok||s.push(It(S.reason,E,h.association.to,S.matches,_)),!x.ok||!S.ok)break;const T=cu(e,x.value.modelId,S.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:E,handle:h.association}:{code:"association-ambiguous",opIndex:E,handle:h.association,matches:T.map(I=>I.modelId)});break}const R=T[0];m.has(R.modelId)||(m.add(R.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:R.modelId}));const w=e.entities.find(I=>I.attributes.some(L=>{var M;return((M=L.embedded)==null?void 0:M.associationRef)===R.modelId}));if(w){const I=w.attributes.find(L=>{var M;return((M=L.embedded)==null?void 0:M.associationRef)===R.modelId});Do(l,f,w.modelId,I.modelId);break}if(R.end1.attributeRef){const I=e.entities.find(M=>M.modelId===R.end1.entityRef),L=I==null?void 0:I.attributes.find(M=>M.modelId===R.end1.attributeRef&&M.attrType==="RELATION_REF");L&&Do(l,f,I.modelId,L.modelId)}const v={...e,associations:e.associations.filter(I=>I.modelId!==R.modelId)};Sl(l,v,R.end2.entityRef,i,f,d);break}case"association.update":{const x=_u(e,h.association,E,s,_);if(!x)break;const S=h.patch.identifying,T=typeof S=="boolean"?S:void 0;if(T===!0&&x.end1.entityRef===x.end2.entityRef){s.push({code:"self-identifying",opIndex:E,handle:h.association});break}const R=Bo(h.patch,kb);if(R.length){s.push({code:"association-patch-unknown-key",opIndex:E,handle:h.association,keys:R});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:h.patch}),T!==void 0&&T!==(x.identifying??!1)){const w={...e,associations:e.associations.map(v=>v.modelId===x.modelId?{...v,identifying:T}:v)};Sl(l,w,x.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const x=_u(e,h.association,E,s,_);if(!x)break;const S=h.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(h.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:E,handle:h.association});break}const T=Bo(h.patch,Eb,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:E,handle:h.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:S,patch:h.patch});break}case"index.add":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=bu(x.value,h.spec,E,h.entity,s,i);if(!S)break;l.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:S.modelId,value:S});break}case"index.update":case"index.remove":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}if(vl(h.index)){s.push({code:"handle-by-unsupported",opIndex:E,entity:h.entity,handle:h.index,target:"index"});break}const S=gb(x.value,h.index);if(!S.ok){s.push(S.reason==="not-found"?{code:"index-not-found",opIndex:E,entity:h.entity,handle:h.index}:{code:"index-ambiguous",opIndex:E,entity:h.entity,handle:h.index,matches:S.matches});break}if(h.kind==="index.update"){if("columns"in h.patch){s.push({code:"index-columns-patch-unsupported",opIndex:E,entity:h.entity,handle:h.index});break}const T=Bo(h.patch,Nb);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:E,entity:h.entity,handle:h.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:S.value.modelId,patch:h.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:S.value.modelId});break}case"operation.add":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=u.get(x.value.modelId)??(x.value.operations?zt(x.value.operations):0);u.set(x.value.modelId,S+1);const T=gu(h.spec,S,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}if(vl(h.operation)){s.push({code:"handle-by-unsupported",opIndex:E,entity:h.entity,handle:h.operation,target:"operation"});break}const S=mu(x.value,h.operation);if(!S.ok){s.push(S.reason==="not-found"?{code:"operation-not-found",opIndex:E,entity:h.entity,handle:h.operation}:{code:"operation-ambiguous",opIndex:E,entity:h.entity,handle:h.operation,matches:S.matches});break}if(h.kind==="operation.update"){const T=Bo(h.patch,wb);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:E,entity:h.entity,handle:h.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:S.value.modelId,patch:h.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:S.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=h.kind==="attribute.reorder",S=wt(e,h.entity);if(!S.ok){s.push(It(S.reason,E,h.entity,S.matches,_));break}const T=x?h.order:h.operations,R=[],w=new Set;let v=!1;for(const V of T){if(!x&&vl(V)){s.push({code:"handle-by-unsupported",opIndex:E,entity:h.entity,handle:V,target:"operation"}),v=!0;continue}const U=x?du(S.value,V):mu(S.value,V);if(!U.ok){s.push(U.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:E,entity:h.entity,handle:V}:{code:"reorder-handle-ambiguous",opIndex:E,entity:h.entity,handle:V,matches:U.matches}),v=!0;continue}if(w.has(U.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:E,entity:h.entity,handle:V}),v=!0;continue}w.add(U.value.modelId),R.push(U.value)}if(v)break;const L=[...x?S.value.attributes:S.value.operations??[]].sort((V,U)=>V.order-U.order).filter(V=>!w.has(V.modelId)),M=[...R,...L];if(M.forEach((V,U)=>{V.order!==U&&l.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,attributeRef:V.modelId,patch:{order:U}}:{kind:"operation.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:V.modelId,patch:{order:U}})}),x)for(const V of lu(e,S.value.modelId,M.map(U=>U.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:V.entityId,entityRef:V.entityId,attributeRef:V.attributeId,patch:{dbAttrs:V.dbAttrs}});break}case"group.add":{const x=[];let S=!1;for(const w of h.spec.members){const v=wt(e,w);if(!v.ok){s.push(It(v.reason,E,w,v.matches,_)),S=!0;continue}x.push(v.value.modelId)}if(S)break;const T=i(),R={modelId:T,excludeDDLGeneration:h.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...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:R});break}case"group.update":{const x=wl(e,h.group);if(!x.ok){s.push(Il(x,E,h.group));break}const S=Bo(h.patch,ub);if(S.length){s.push({code:"group-patch-unknown-key",opIndex:E,handle:h.group,keys:S});break}l.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:h.patch});break}case"group.remove":{const x=wl(e,h.group);if(!x.ok){s.push(Il(x,E,h.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=wl(e,h.group);if(!x.ok){s.push(Il(x,E,h.group));break}const S=wt(e,h.entity);if(!S.ok){s.push(It(S.reason,E,h.entity,S.matches,_));break}const T=x.value.memberEntityRefs.includes(S.value.modelId);if(h.kind==="group.addMember"?T:!T)break;if(h.kind==="group.removeMember"){if(b.has(g(x.value.modelId,S.value.modelId)))break;b.add(g(x.value.modelId,S.value.modelId))}l.push({kind:h.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:S.value.modelId});break}}}),s.length||Sb(l,e,f,p),s.length||xb(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 _u(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=cu(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 ku={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},Ab={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},$b={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Tb={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},Mb={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...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},Vb={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},Eu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Bb={type:"object",description:"일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)을 end 로 주면 거부된다(임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Eu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Eu,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},Db={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...ku,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},Ob={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},Lb={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},Pb={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:[...iu],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},zb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Fb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Ub={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},Hb={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 소관).'},jb={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 Kb={"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"]})},Gb={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},Yb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...Vn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},Nu={anyOf:ou.map(e=>Kb[e])},qb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ku,nameHandle:Ab,groupHandle:Gb,assocHandle:$b,entitySpec:Tb,attrSpec:Mb,embeddableOverrides:Vb,assocSpec:Bb,indexSpec:Db,operationSpec:Ob,groupSpec:Lb,entityUpdatePatch:Hb,attrUpdatePatch:Pb,assocUpdatePatch:zb,assocEndUpdatePatch:jb,indexUpdatePatch:Fb,operationUpdatePatch:Ub,groupUpdatePatch:Yb,symbolicOp:Nu}};function Wb(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 wu={location:{x:0,y:0},size:{width:220,height:140}};function Iu(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 Xb(e){return e.attrType&&e.attrType!=="NORMAL"||!Jb.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Zb(e){return e.type===hn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Qb(e,n){if(e.attrType==="DIVIDER"||Xb(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=Zb(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(Iu)}}function e_(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 t_(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 n_(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(Qb),operations:(n=e.operations)==null?void 0:n.map(e_),indexes:(o=e.indexes)==null?void 0:o.map(t_),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function o_(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??{...wu},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 vu(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:vu(e)}}function i_(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 a_(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:i_(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 Cu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Su(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 xu(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(Iu)}}function r_(e,n,o){var E,N;const i=Rl(e.end1.attribute),a=Rl(e.end2.attribute);if(i===a)return a_(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(N=(E=s.dbAttrs)==null?void 0:E[0])==null?void 0:N.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((C,A)=>Math.max(C,A.order),-1)+1:s.order??0,p={...xu(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 b;if(y&&f&&r.navigable){const C=Qi(l.multiplicity);b={modelId:y.modelId??crypto.randomUUID(),name:wo(y.name??ta((u==null?void 0:u.name)??l.endModel.refId,C),new Set(f.attributes.map(A=>A.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((A,B)=>Math.max(A,B.order),-1)+1,dbAttrs:[]},f.attributes.push(b)}const g=(C,A)=>({entityRef:C.endModel.refId,multiplicity:C.multiplicity,navigable:C.navigable,composition:C.composition,attributeRef:A?b==null?void 0:b.modelId:p.modelId,jpa:vu(C)}),_=r.endModel.refId===l.endModel.refId,k={modelId:e.modelId,description:e.description,identifying:!_&&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:k,layout:h}}function l_(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 s_(e,n,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((b,g)=>Math.max(b,g.order),-1)+1:l.order??0,d={...xu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(b=>l_(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...xl(b),legacyEmbedRaw:b.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 c_(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 Ru(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=c_(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 Au(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 d_(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=wo(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 u_(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 $u(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&&!uc(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 Tu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?m_(n):f_(n)}function m_(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);d_(a,r),u_(a,r),$u(a,r);const{version:s,...c}=e.layout;Au(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 f_(e){var _,k;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(h,E)=>{o.push(n_(h));const N=o_(h);N.geo={location:{x:N.geo.location.x+E.x,y:N.geo.location.y+E.y},size:N.geo.size},i.push(N);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 E=h.entities??[];l.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:E.map(C=>C.modelId)});const N=((_=h.geo)==null?void 0:_.location)??u;if(h.geo){const C=(h.notes??[]).map(A=>A.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 E)d(C,N);for(const C of h.notes??[])m.push(Ru(C,N))}const p=new Map(o.map(h=>[h.modelId,h])),f=new Map,y=new Map;for(const h of o)for(const E of h.attributes)for(const N of E.dbAttrs)f.set(N.modelId,E.modelId),y.set(N.modelId,N);for(const h of c)for(const E of[h.end1,h.end2]){const N=E.attribute;if(N&&(((k=N.dbAttrs)==null?void 0:k.length)??0)>0)for(const C of N.dbAttrs)C.modelId&&f.set(C.modelId,N.modelId)}for(const h of c){const E=Cu(h.end1.attribute),N=Cu(h.end2.attribute),C=Su(h.end1)||Su(h.end2),{assoc:A,layout:B}=E!==N||C?s_(h,p,y):r_(h,p,f);a.push(A),r.push(B)}Au(o,a,r),id(o),$u(o,a);const b={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(h=>Ru(h)),...m]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:g}}function Mu(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function p_(e,n){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(Mu),style:n}}function h_(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 y_(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 g_(e,n){const o=n==null?void 0:n.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...Mu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function b_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function Vu(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 __(e){const n=new Set;for(const o of e.logical.associations){const i=Vu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function k_(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function E_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function N_(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:E_(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function w_(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)=>N_(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 I_(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=w_(e,n,i);if(a)return a;const r=Vu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?g_(r.fk,l):void 0,c=b_(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 Bu(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)??{...wu},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 p_(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 h_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>I_(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(y_),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 v_(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Du(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Bu(c,n,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function Du(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function C_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=__(e),r=k_(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=>Bu(s,e,a,r)),groups:e.logical.groups.map(s=>v_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>Du(s))}}function S_(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 x_=["notNull"];function R_(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}=Tu(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 b={};for(const g of x_)f[g]===!0!=(y[g]===!0)&&(b[g]=f[g],s.attributeFieldsByName[g]=(s.attributeFieldsByName[g]??0)+1);Object.keys(b).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:b}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const 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 A_=typeof window<"u"&&typeof document<"u",$_=e=>typeof e<"u",T_=Object.prototype.toString,M_=e=>T_.call(e)==="[object Object]",V_=()=>{};function B_(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 Ou=e=>e();function D_(e=Ou){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 Lu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function O_(e,n,o={}){const{eventFilter:i=Ou,...a}=o;return t.watch(e,B_(i,n),a)}function Oo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=D_(i);return{stop:O_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function L_(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:b}={}){let g=null;const k=[new Promise(h=>{g=t.watch(e,E=>{m(E)!==n&&(g==null||g(),h(E))},{flush:p,deep:f,immediate:!0})})];return y!=null&&k.push(Lu(y,b).then(()=>gn(e)).finally(()=>g==null?void 0:g())),Promise.race(k)}function i(m,p){if(!t.isRef(m))return o(E=>E===m,p);const{flush:f="sync",deep:y=!1,timeout:b,throwOnTimeout:g}=p??{};let _=null;const h=[new Promise(E=>{_=t.watch([e,m],([N,C])=>{n!==(N===C)&&(_==null||_(),E(N))},{flush:f,deep:y,immediate:!0})})];return b!=null&&h.push(Lu(b,g).then(()=>gn(e)).finally(()=>(_==null||_(),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 P_(e){var n;const o=gn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Pu=A_?window:void 0;function zu(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Pu):[n,o,i,a]=e,!n)return V_;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(()=>[P_(n),gn(a)],([u,m])=>{if(l(),!u)return;const p=M_(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 z_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Fu(...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=Pu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=z_(n);return zu(a,r,u=>{u.repeat&&gn(s)||c(u)&&o(u)},l)}function F_(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 b=d;n||(n="modelValue"),b=b||`update:${n.toString()}`;const g=h=>s?typeof s=="function"?s(h):F_(h):h,_=()=>$_(e[n])?g(e[n]):m,k=h=>{p?p(h)&&y(b,h):y(b,h)};if(c){const h=_(),E=t.ref(h);let N=!1;return t.watch(()=>e[n],C=>{N||(N=!0,E.value=g(C),t.nextTick(()=>N=!1))}),t.watch(E,C=>{!N&&(C!==e[n]||u)&&k(C)},{deep:u}),E}else return t.computed({get(){return _()},set(h){k(h)}})}var U_={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 H_(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=H_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=j_(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]=Uu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Uu(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 j_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Uu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=U_,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 Hu={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)),Hu.hasOwnProperty(n)?{space:Hu[n],local:e}:e}function K_(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 G_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ju(e){var n=Sa(e);return(n.local?G_:K_)(n)}function Y_(){}function Vl(e){return e==null?Y_:function(){return this.querySelector(e)}}function q_(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 W_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function J_(){return[]}function Ku(e){return e==null?J_:function(){return this.querySelectorAll(e)}}function X_(e){return function(){return W_(e.apply(this,arguments))}}function Z_(e){typeof e=="function"?e=X_(e):e=Ku(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 Gu(e){return function(){return this.matches(e)}}function Yu(e){return function(n){return n.matches(e)}}var Q_=Array.prototype.find;function ek(e){return function(){return Q_.call(this.children,e)}}function tk(){return this.firstElementChild}function nk(e){return this.select(e==null?tk:ek(typeof e=="function"?e:Yu(e)))}var ok=Array.prototype.filter;function ik(){return Array.from(this.children)}function ak(e){return function(){return ok.call(this.children,e)}}function rk(e){return this.selectAll(e==null?ik:ak(typeof e=="function"?e:Yu(e)))}function lk(e){typeof e!="function"&&(e=Gu(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 qu(e){return new Array(e.length)}function sk(){return new Lt(this._enter||this._groups.map(qu),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 ck(e){return function(){return e}}function dk(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 uk(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 mk(e){return e.__data__}function fk(e,n){if(!arguments.length)return Array.from(this,mk);var o=n?uk:dk,i=this._parents,a=this._groups;typeof e!="function"&&(e=ck(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=pk(e.call(u,u&&u.__data__,d,i)),y=f.length,b=s[d]=new Array(y),g=l[d]=new Array(y),_=c[d]=new Array(p);o(u,m,b,g,_,f,n);for(var k=0,h=0,E,N;k<y;++k)if(E=b[k]){for(k>=h&&(h=k+1);!(N=g[h])&&++h<y;);E._next=N||null}}return l=new Lt(l,i),l._enter=s,l._exit=c,l}function pk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hk(){return new Lt(this._exit||this._groups.map(qu),this._parents)}function yk(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 gk(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 bk(){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 _k(e){e||(e=kk);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 kk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Ek(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Nk(){return Array.from(this)}function wk(){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 Ik(){let e=0;for(const n of this)++e;return e}function vk(){return!this.node()}function Ck(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 Sk(e){return function(){this.removeAttribute(e)}}function xk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Rk(e,n){return function(){this.setAttribute(e,n)}}function Ak(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function $k(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Tk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Mk(e,n){var o=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?xk:Sk:typeof n=="function"?o.local?Tk:$k:o.local?Ak:Rk)(o,n))}function Wu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Vk(e){return function(){this.style.removeProperty(e)}}function Bk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Dk(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Ok(e,n,o){return arguments.length>1?this.each((n==null?Vk:typeof n=="function"?Dk:Bk)(e,n,o??"")):Lo(this.node(),e)}function Lo(e,n){return e.style.getPropertyValue(n)||Wu(e).getComputedStyle(e,null).getPropertyValue(n)}function Lk(e){return function(){delete this[e]}}function Pk(e,n){return function(){this[e]=n}}function zk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Fk(e,n){return arguments.length>1?this.each((n==null?Lk:typeof n=="function"?zk:Pk)(e,n)):this.node()[e]}function Ju(e){return e.trim().split(/^|\s+/)}function Bl(e){return e.classList||new Xu(e)}function Xu(e){this._node=e,this._names=Ju(e.getAttribute("class")||"")}Xu.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 Zu(e,n){for(var o=Bl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Qu(e,n){for(var o=Bl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Uk(e){return function(){Zu(this,e)}}function Hk(e){return function(){Qu(this,e)}}function jk(e,n){return function(){(n.apply(this,arguments)?Zu:Qu)(this,e)}}function Kk(e,n){var o=Ju(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"?jk:n?Uk:Hk)(o,n))}function Gk(){this.textContent=""}function Yk(e){return function(){this.textContent=e}}function qk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Wk(e){return arguments.length?this.each(e==null?Gk:(typeof e=="function"?qk:Yk)(e)):this.node().textContent}function Jk(){this.innerHTML=""}function Xk(e){return function(){this.innerHTML=e}}function Zk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Qk(e){return arguments.length?this.each(e==null?Jk:(typeof e=="function"?Zk:Xk)(e)):this.node().innerHTML}function eE(){this.nextSibling&&this.parentNode.appendChild(this)}function tE(){return this.each(eE)}function nE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function oE(){return this.each(nE)}function iE(e){var n=typeof e=="function"?e:ju(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function aE(){return null}function rE(e,n){var o=typeof e=="function"?e:ju(e),i=n==null?aE:typeof n=="function"?n:Vl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function lE(){var e=this.parentNode;e&&e.removeChild(this)}function sE(){return this.each(lE)}function cE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function dE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function uE(e){return this.select(e?dE:cE)}function mE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function fE(e){return function(n){e.call(this,n,this.__data__)}}function pE(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 hE(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 yE(e,n,o){return function(){var i=this.__on,a,r=fE(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 gE(e,n,o){var i=pE(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?yE:hE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function em(e,n,o){var i=Wu(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function bE(e,n){return function(){return em(this,e,n)}}function _E(e,n){return function(){return em(this,e,n.apply(this,arguments))}}function kE(e,n){return this.each((typeof n=="function"?_E:bE)(e,n))}function*EE(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var tm=[null];function Lt(e,n){this._groups=e,this._parents=n}function pi(){return new Lt([[document.documentElement]],tm)}function NE(){return this}Lt.prototype=pi.prototype={constructor:Lt,select:q_,selectAll:Z_,selectChild:nk,selectChildren:rk,filter:lk,data:fk,enter:sk,exit:hk,join:yk,merge:gk,selection:NE,order:bk,sort:_k,call:Ek,nodes:Nk,node:wk,size:Ik,empty:vk,each:Ck,attr:Mk,style:Ok,property:Fk,classed:Kk,text:Wk,html:Qk,raise:tE,lower:oE,append:iE,insert:rE,remove:sE,clone:uE,datum:mE,on:gE,dispatch:kE,[Symbol.iterator]:EE};function jt(e){return typeof e=="string"?new Lt([[document.querySelector(e)]],[document.documentElement]):new Lt([[e]],tm)}function wE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function an(e,n){if(e=wE(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 IE={passive:!1},hi={capture:!0,passive:!1};function Dl(e){e.stopImmediatePropagation()}function Po(e){e.preventDefault(),e.stopImmediatePropagation()}function nm(e){var n=e.document.documentElement,o=jt(e).on("dragstart.drag",Po,hi);"onselectstart"in n?o.on("selectstart.drag",Po,hi):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function om(e,n){var o=e.document.documentElement,i=jt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Po,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 vE(e){return!e.ctrlKey&&!e.button}function CE(){return this.parentNode}function SE(e,n){return n??{x:e.x,y:e.y}}function xE(){return navigator.maxTouchPoints||"ontouchstart"in this}function RE(){var e=vE,n=CE,o=SE,i=xE,a={},r=va("start","drag","end"),l=0,s,c,d,u,m=0;function p(E){E.on("mousedown.drag",f).filter(i).on("touchstart.drag",g).on("touchmove.drag",_,IE).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(E,N){if(!(u||!e.call(this,E,N))){var C=h(this,n.call(this,E,N),E,N,"mouse");C&&(jt(E.view).on("mousemove.drag",y,hi).on("mouseup.drag",b,hi),nm(E.view),Dl(E),d=!1,s=E.clientX,c=E.clientY,C("start",E))}}function y(E){if(Po(E),!d){var N=E.clientX-s,C=E.clientY-c;d=N*N+C*C>m}a.mouse("drag",E)}function b(E){jt(E.view).on("mousemove.drag mouseup.drag",null),om(E.view,d),Po(E),a.mouse("end",E)}function g(E,N){if(e.call(this,E,N)){var C=E.changedTouches,A=n.call(this,E,N),B=C.length,$,x;for($=0;$<B;++$)(x=h(this,A,E,N,C[$].identifier,C[$]))&&(Dl(E),x("start",E,C[$]))}}function _(E){var N=E.changedTouches,C=N.length,A,B;for(A=0;A<C;++A)(B=a[N[A].identifier])&&(Po(E),B("drag",E,N[A]))}function k(E){var N=E.changedTouches,C=N.length,A,B;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),A=0;A<C;++A)(B=a[N[A].identifier])&&(Dl(E),B("end",E,N[A]))}function h(E,N,C,A,B,$){var x=r.copy(),S=an($||C,N),T,R,w;if((w=o.call(E,new Ol("beforestart",{sourceEvent:C,target:p,identifier:B,active:l,x:S[0],y:S[1],dx:0,dy:0,dispatch:x}),A))!=null)return T=w.x-S[0]||0,R=w.y-S[1]||0,function v(I,L,M){var V=S,U;switch(I){case"start":a[B]=v,U=l++;break;case"end":delete a[B],--l;case"drag":S=an(M||L,N),U=l;break}x.call(I,E,new Ol(I,{sourceEvent:L,subject:w,target:p,identifier:B,active:U,x:S[0]+T,y:S[1]+R,dx:S[0]-V[0],dy:S[1]-V[1],dispatch:x}),A)}}return p.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Ra(!!E),p):e},p.container=function(E){return arguments.length?(n=typeof E=="function"?E:Ra(E),p):n},p.subject=function(E){return arguments.length?(o=typeof E=="function"?E:Ra(E),p):o},p.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:Ra(!!E),p):i},p.on=function(){var E=r.on.apply(r,arguments);return E===r?p:E},p.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,p):Math.sqrt(m)},p}function Ll(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function im(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,zo="\\s*([+-]?\\d+)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",AE=/^#([0-9a-f]{3,8})$/,$E=new RegExp(`^rgb\\(${zo},${zo},${zo}\\)$`),TE=new RegExp(`^rgb\\(${rn},${rn},${rn}\\)$`),ME=new RegExp(`^rgba\\(${zo},${zo},${zo},${bi}\\)$`),VE=new RegExp(`^rgba\\(${rn},${rn},${rn},${bi}\\)$`),BE=new RegExp(`^hsl\\(${bi},${rn},${rn}\\)$`),DE=new RegExp(`^hsla\\(${bi},${rn},${rn},${bi}\\)$`),am={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:rm,formatHex:rm,formatHex8:OE,formatHsl:LE,formatRgb:lm,toString:lm});function rm(){return this.rgb().formatHex()}function OE(){return this.rgb().formatHex8()}function LE(){return mm(this).formatHsl()}function lm(){return this.rgb().formatRgb()}function eo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=AE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?sm(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=$E.exec(e))?new Vt(n[1],n[2],n[3],1):(n=TE.exec(e))?new Vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=ME.exec(e))?$a(n[1],n[2],n[3],n[4]):(n=VE.exec(e))?$a(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=BE.exec(e))?um(n[1],n[2]/100,n[3]/100,1):(n=DE.exec(e))?um(n[1],n[2]/100,n[3]/100,n[4]):am.hasOwnProperty(e)?sm(am[e]):e==="transparent"?new Vt(NaN,NaN,NaN,0):null}function sm(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 PE(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?PE(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,im(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:cm,formatHex:cm,formatHex8:zE,formatRgb:dm,toString:dm}));function cm(){return`#${no(this.r)}${no(this.g)}${no(this.b)}`}function zE(){return`#${no(this.r)}${no(this.g)}${no(this.b)}${no((isNaN(this.opacity)?1:this.opacity)*255)}`}function dm(){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 um(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 mm(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 FE(e,n,o,i){return arguments.length===1?mm(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,FE,im(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(fm(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("}${fm(this.h)}, ${Ma(this.s)*100}%, ${Ma(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fm(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 UE(e,n){return function(o){return e+o*n}}function HE(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 jE(e){return(e=+e)==1?pm:function(n,o){return o-n?HE(n,o,e):Fl(isNaN(n)?o:n)}}function pm(e,n){var o=n-e;return o?UE(e,o):Fl(isNaN(e)?n:e)}const Va=(function e(n){var o=jE(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=pm(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 KE(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 GE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function YE(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 qE(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 WE(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 JE(e){return function(){return e}}function XE(e){return function(n){return e(n)+""}}function hm(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]?XE(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 _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):hm:n instanceof eo?Va:n instanceof Date?qE:GE(n)?KE:Array.isArray(n)?YE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?WE:ln)(e,n)}var ym=180/Math.PI,jl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gm(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)*ym,skewX:Math.atan(c)*ym,scaleX:l,scaleY:s}}var Ba;function ZE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?jl:gm(n.a,n.b,n.c,n.d,n.e,n.f)}function QE(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,gm(e.a,e.b,e.c,e.d,e.e,e.f))}function bm(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 b=f.push("translate(",null,n,null,o);y.push({i:b-4,x:ln(d,m)},{i:b-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 b=f.push(a(f)+"scale(",null,",",null,")");y.push({i:b-4,x:ln(d,m)},{i:b-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,b=p.length,g;++y<b;)m[(g=p[y]).i]=g.x(f);return m.join("")}}}var e1=bm(ZE,"px, ","px)","deg)"),t1=bm(QE,", ",")",")"),n1=1e-12;function _m(e){return((e=Math.exp(e))+1/e)/2}function o1(e){return((e=Math.exp(e))-1/e)/2}function i1(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,b=f*f+y*y,g,_;if(b<n1)_=Math.log(p/d)/n,g=function(A){return[s+A*f,c+A*y,d*Math.exp(n*A*_)]};else{var k=Math.sqrt(b),h=(p*p-d*d+i*b)/(2*d*o*k),E=(p*p-d*d-i*b)/(2*p*o*k),N=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(E*E+1)-E);_=(C-N)/n,g=function(A){var B=A*_,$=_m(N),x=d/(o*k)*($*i1(n*B+N)-o1(N));return[s+x*f,c+x*y,d*$/_m(n*B+N)]}}return g.duration=_*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 Fo=0,ki=0,Ei=0,km=1e3,Oa,Ni,La=0,oo=0,Pa=0,wi=typeof performance=="object"&&performance.now?performance:Date,Em=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kl(){return oo||(Em(a1),oo=wi.now()+Pa)}function a1(){oo=0}function za(){this._call=this._time=this._next=null}za.prototype=Nm.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 Nm(e,n,o){var i=new za;return i.restart(e,n,o),i}function r1(){Kl(),++Fo;for(var e=Oa,n;e;)(n=oo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Fo}function wm(){oo=(La=wi.now())+Pa,Fo=ki=0;try{r1()}finally{Fo=0,s1(),oo=0}}function l1(){var e=wi.now(),n=e-La;n>km&&(Pa-=n,La=e)}function s1(){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(!Fo){ki&&(ki=clearTimeout(ki));var n=e-oo;n>24?(e<1/0&&(ki=setTimeout(wm,e-wi.now()-Pa)),Ei&&(Ei=clearInterval(Ei))):(Ei||(La=wi.now(),Ei=setInterval(l1,km)),Fo=1,Em(wm))}}function Im(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 c1=va("start","end","cancel","interrupt"),d1=[],vm=0,Cm=1,Yl=2,Fa=3,Sm=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;u1(e,o,{name:n,index:i,group:a,on:c1,tween:d1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:vm})}function Wl(e,n){var o=Gt(e,n);if(o.state>vm)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 u1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Nm(r,0,o.time);function r(d){o.state=Cm,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!==Cm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Fa)return Im(l);f.state===Sm?(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(Im(function(){o.state===Fa&&(o.state=Sm,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 m1(e){return this.each(function(){ja(this,e)})}function f1(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 p1(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 h1(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?f1:p1)(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 xm(e,n){var o;return(typeof n=="number"?ln:n instanceof eo?Va:(o=eo(n))?(n=o,Va):hm)(e,n)}function y1(e){return function(){this.removeAttribute(e)}}function g1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function b1(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 _1(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 k1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function E1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function N1(e,n){var o=Sa(e),i=o==="transform"?t1:xm;return this.attrTween(e,typeof n=="function"?(o.local?E1:k1)(o,i,Jl(this,"attr."+e,n)):n==null?(o.local?g1:y1)(o):(o.local?_1:b1)(o,i,n))}function w1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function I1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function v1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&I1(e,r)),o}return a._value=n,a}function C1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&w1(e,r)),o}return a._value=n,a}function S1(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?v1:C1)(i,n))}function x1(e,n){return function(){Wl(this,e).delay=+n.apply(this,arguments)}}function R1(e,n){return n=+n,function(){Wl(this,e).delay=n}}function A1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?x1:R1)(n,e)):Gt(this.node(),n).delay}function $1(e,n){return function(){sn(this,e).duration=+n.apply(this,arguments)}}function T1(e,n){return n=+n,function(){sn(this,e).duration=n}}function M1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?$1:T1)(n,e)):Gt(this.node(),n).duration}function V1(e,n){if(typeof n!="function")throw new Error;return function(){sn(this,e).ease=n}}function B1(e){var n=this._id;return arguments.length?this.each(V1(n,e)):Gt(this.node(),n).ease}function D1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;sn(this,e).ease=o}}function O1(e){if(typeof e!="function")throw new Error;return this.each(D1(this._id,e))}function L1(e){typeof e!="function"&&(e=Gu(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 P1(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 z1(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 F1(e,n,o){var i,a,r=z1(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 U1(e,n){var o=this._id;return arguments.length<2?Gt(this.node(),o).on.on(e):this.each(F1(o,e,n))}function H1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function j1(){return this.on("end.remove",H1(this._id))}function K1(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 G1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Ku(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),b=0,g=p.length;b<g;++b)(f=p[b])&&Ha(f,n,o,b,p,y);r.push(p),l.push(u)}return new bn(r,l,n,o)}var Y1=pi.prototype.constructor;function q1(){return new Y1(this._groups,this._parents)}function W1(e,n){var o,i,a;return function(){var r=Lo(this,e),l=(this.style.removeProperty(e),Lo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Rm(e){return function(){this.style.removeProperty(e)}}function J1(e,n,o){var i,a=o+"",r;return function(){var l=Lo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function X1(e,n,o){var i,a,r;return function(){var l=Lo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Lo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function Z1(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=Rm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function Q1(e,n,o){var i=(e+="")=="transform"?e1:xm;return n==null?this.styleTween(e,W1(e,i)).on("end.style."+e,Rm(e)):typeof n=="function"?this.styleTween(e,X1(e,i,Jl(this,"style."+e,n))).each(Z1(this._id,e)):this.styleTween(e,J1(e,i,n),o).on("end.style."+e,null)}function e0(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function t0(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&e0(e,l,o)),i}return r._value=n,r}function n0(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,t0(e,n,o??""))}function o0(e){return function(){this.textContent=e}}function i0(e){return function(){var n=e(this);this.textContent=n??""}}function a0(e){return this.tween("text",typeof e=="function"?i0(Jl(this,"text",e)):o0(e==null?"":e+""))}function r0(e){return function(n){this.textContent=e.call(this,n)}}function l0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&r0(a)),n}return i._value=e,i}function s0(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,l0(e))}function c0(){for(var e=this._name,n=this._id,o=Am(),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 d0(){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 u0=0;function bn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Am(){return++u0}var _n=pi.prototype;bn.prototype={constructor:bn,select:K1,selectAll:G1,selectChild:_n.selectChild,selectChildren:_n.selectChildren,filter:L1,merge:P1,selection:q1,transition:c0,call:_n.call,nodes:_n.nodes,node:_n.node,size:_n.size,empty:_n.empty,each:_n.each,on:U1,attr:N1,attrTween:S1,style:Q1,styleTween:n0,text:a0,textTween:s0,remove:j1,tween:h1,delay:A1,duration:M1,ease:B1,easeVarying:O1,end:d0,[Symbol.iterator]:_n[Symbol.iterator]};function m0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var f0={time:null,delay:0,duration:250,ease:m0};function p0(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 h0(e){var n,o;e instanceof bn?(n=e._id,e=e._name):(n=Am(),(o=f0).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||p0(c,n));return new bn(i,this._parents,e,n)}pi.prototype.interrupt=m1,pi.prototype.transition=h0;const Ka=e=>()=>e;function y0(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 Uo=new kn(1,0,0);kn.prototype;function Xl(e){e.stopImmediatePropagation()}function Ii(e){e.preventDefault(),e.stopImmediatePropagation()}function g0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function b0(){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 $m(){return this.__zoom||Uo}function _0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function k0(){return navigator.maxTouchPoints||"ontouchstart"in this}function E0(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function N0(){var e=g0,n=b0,o=E0,i=_0,a=k0,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,b=0,g=10;function _(w){w.property("__zoom",$m).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",x).filter(a).on("touchstart.zoom",S).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,v,I,L){var M=w.selection?w.selection():w;M.property("__zoom",$m),w!==M?N(w,v,I,L):M.interrupt().each(function(){C(this,arguments).event(L).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},_.scaleBy=function(w,v,I,L){_.scaleTo(w,function(){var M=this.__zoom.k,V=typeof v=="function"?v.apply(this,arguments):v;return M*V},I,L)},_.scaleTo=function(w,v,I,L){_.transform(w,function(){var M=n.apply(this,arguments),V=this.__zoom,U=I==null?E(M):typeof I=="function"?I.apply(this,arguments):I,oe=V.invert(U),ue=typeof v=="function"?v.apply(this,arguments):v;return o(h(k(V,ue),U,oe),M,l)},I,L)},_.translateBy=function(w,v,I,L){_.transform(w,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,L)},_.translateTo=function(w,v,I,L,M){_.transform(w,function(){var V=n.apply(this,arguments),U=this.__zoom,oe=L==null?E(V):typeof L=="function"?L.apply(this,arguments):L;return o(Uo.translate(oe[0],oe[1]).scale(U.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof I=="function"?-I.apply(this,arguments):-I),V,l)},L,M)};function k(w,v){return v=Math.max(r[0],Math.min(r[1],v)),v===w.k?w:new kn(v,w.x,w.y)}function h(w,v,I){var L=v[0]-I[0]*w.k,M=v[1]-I[1]*w.k;return L===w.x&&M===w.y?w:new kn(w.k,L,M)}function E(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function N(w,v,I,L){w.on("start.zoom",function(){C(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,V=arguments,U=C(M,V).event(L),oe=n.apply(M,V),ue=I==null?E(oe):typeof I=="function"?I.apply(M,V):I,be=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),pe=M.__zoom,he=typeof v=="function"?v.apply(M,V):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)}U.zoom(null,ye)}})}function C(w,v,I){return!I&&w.__zooming||new A(w,v)}function A(w,v){this.that=w,this.args=v,this.active=0,this.sourceEvent=null,this.extent=n.apply(w,v),this.taps=0}A.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,v){return this.mouse&&w!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&w!=="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(w){var v=jt(this.that).datum();d.call(w,this.that,new y0(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),v)}};function B(w,...v){if(!e.apply(this,arguments))return;var I=C(this,v).event(w),L=this.__zoom,M=Math.max(r[0],Math.min(r[1],L.k*Math.pow(2,i.apply(this,arguments)))),V=an(w);if(I.wheel)(I.mouse[0][0]!==V[0]||I.mouse[0][1]!==V[1])&&(I.mouse[1]=L.invert(I.mouse[0]=V)),clearTimeout(I.wheel);else{if(L.k===M)return;I.mouse=[V,L.invert(V)],ja(this),I.start()}Ii(w),I.wheel=setTimeout(U,y),I.zoom("mouse",o(h(k(L,M),I.mouse[0],I.mouse[1]),I.extent,l));function U(){I.wheel=null,I.end()}}function $(w,...v){if(p||!e.apply(this,arguments))return;var I=w.currentTarget,L=C(this,v,!0).event(w),M=jt(w.view).on("mousemove.zoom",ue,!0).on("mouseup.zoom",be,!0),V=an(w,I),U=w.clientX,oe=w.clientY;nm(w.view),Xl(w),L.mouse=[V,this.__zoom.invert(V)],ja(this),L.start();function ue(pe){if(Ii(pe),!L.moved){var he=pe.clientX-U,_e=pe.clientY-oe;L.moved=he*he+_e*_e>b}L.event(pe).zoom("mouse",o(h(L.that.__zoom,L.mouse[0]=an(pe,I),L.mouse[1]),L.extent,l))}function be(pe){M.on("mousemove.zoom mouseup.zoom",null),om(pe.view,L.moved),Ii(pe),L.event(pe).end()}}function x(w,...v){if(e.apply(this,arguments)){var I=this.__zoom,L=an(w.changedTouches?w.changedTouches[0]:w,this),M=I.invert(L),V=I.k*(w.shiftKey?.5:2),U=o(h(k(I,V),L,M),n.apply(this,v),l);Ii(w),s>0?jt(this).transition().duration(s).call(N,U,L,w):jt(this).call(_.transform,U,L,w)}}function S(w,...v){if(e.apply(this,arguments)){var I=w.touches,L=I.length,M=C(this,v,w.changedTouches.length===L).event(w),V,U,oe,ue;for(Xl(w),U=0;U<L;++U)oe=I[U],ue=an(oe,this),ue=[ue,this.__zoom.invert(ue),oe.identifier],M.touch0?!M.touch1&&M.touch0[2]!==ue[2]&&(M.touch1=ue,M.taps=0):(M.touch0=ue,V=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),V&&(M.taps<2&&(m=ue[0],u=setTimeout(function(){u=null},f)),ja(this),M.start())}}function T(w,...v){if(this.__zooming){var I=C(this,v).event(w),L=w.changedTouches,M=L.length,V,U,oe,ue;for(Ii(w),V=0;V<M;++V)U=L[V],oe=an(U,this),I.touch0&&I.touch0[2]===U.identifier?I.touch0[0]=oe:I.touch1&&I.touch1[2]===U.identifier&&(I.touch1[0]=oe);if(U=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;U=k(U,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(U,oe,ue),I.extent,l))}}function R(w,...v){if(this.__zooming){var I=C(this,v).event(w),L=w.changedTouches,M=L.length,V,U;for(Xl(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),V=0;V<M;++V)U=L[V],I.touch0&&I.touch0[2]===U.identifier?delete I.touch0:I.touch1&&I.touch1[2]===U.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&&(U=an(U,this),Math.hypot(m[0]-U[0],m[1]-U[1])<g)){var oe=jt(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Ka(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ka(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Ka(!!w),_):a},_.extent=function(w){return arguments.length?(n=typeof w=="function"?w:Ka([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):n},_.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],_):[r[0],r[1]]},_.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,_):Math.sqrt(b)},_.tapDistance=function(w){return arguments.length?(g=+w,_):g},_}var 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||{}),Tm=(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))(Tm||{});const w0=["INPUT","SELECT","TEXTAREA"],I0=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 w0.includes(i==null?void 0:i.nodeName)||a||!!r}function v0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Mm(e,n,o,i){const a=n.replace("+",`
27
+ `}}const si="com.example",Ig="command.domain";function To(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??Ig,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const vg="CustomMoneyType",Cg="Money";function Sg(e){return!(e.type!==vg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function xg(e){const n=e.dbAttrs[0]??{modelId:Pe(),physicalName:"",dataType:""},o={modelId:Pe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Cg,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Rg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Sg(l)?(a=!0,n=!0,xg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Ag(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const b=new Map,g=new Map,_=new Map,k=(h,E,N)=>{if(!h)return;o.get(h)||o.set(h,[{entityId:E,assignedId:h}]),i.push({id:h,entityId:E,sink:N}),N(h)};for(const h of y.attributes){k(h.modelId,y.modelId,E=>b.set(h,E));for(const E of h.dbAttrs)k(E.modelId,y.modelId,N=>g.set(E,N))}for(const h of y.indexes??[])k(h.modelId,y.modelId,E=>_.set(h,E));a.set(y,{attrs:b,cols:g,idx:_})}const r=new Set(o.keys()),l=new Map;for(const y of i){const b=(l.get(y.id)??0)+1;if(l.set(y.id,b),b===1)continue;const g=$g(y.id,b-1,r);r.add(g),o.get(y.id).push({entityId:y.entityId,assignedId:g}),y.sink(g)}const s=[...o.values()].reduce((y,b)=>y+Math.max(0,b.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,b)=>{var _;if(!b||!y)return b;const g=o.get(b);return!g||g.length<2?b:((_=g.find(k=>k.entityId===y))==null?void 0:_.assignedId)??b},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,b)=>{const g=d.get(y);if(g)return g.end1.entityRef===b?g.end2.entityRef:g.end1.entityRef},m=e.entities.map(y=>{var h;const b=a.get(y),g=y.attributes.map(E=>{const N=b.attrs.get(E),C=E.dbAttrs.map($=>{const x=b.cols.get($);return x===$.modelId?$:{...$,modelId:x}});let A=E.derivedFrom;if(A){const $=u(A.associationRef,y.modelId),x=c($,A.sourceAttributeRef);x!==A.sourceAttributeRef&&(A={...A,sourceAttributeRef:x})}return N!==E.modelId||A!==E.derivedFrom||C.some(($,x)=>$!==E.dbAttrs[x])?{...E,modelId:N,dbAttrs:C,derivedFrom:A}:E}),_=(h=y.indexes)==null?void 0:h.map(E=>{const N=b.idx.get(E),C=E.columns.map(B=>{const $=c(y.modelId,B.columnRef);return $===B.columnRef?B:{...B,columnRef:$}});return N!==E.modelId||C.some((B,$)=>B!==E.columns[$])?{...E,modelId:N,columns:C}:E});return g.some((E,N)=>E!==y.attributes[N])||_&&y.indexes&&_.some((E,N)=>E!==y.indexes[N])?{...y,attributes:g,..._?{indexes:_}:{}}:y}),p=e.associations.map(y=>{const b=c(y.end1.entityRef,y.end1.attributeRef),g=c(y.end2.entityRef,y.end2.attributeRef);return b===y.end1.attributeRef&&g===y.end2.attributeRef?y:{...y,end1:b===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:b},end2:g===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:g}}}),f=n.associationLayouts.map(y=>{const b=d.get(y.associationRef);if(!b)return y;const g=c(b.end1.entityRef,y.sourceColumnRef),_=c(b.end2.entityRef,y.targetColumnRef);return g===y.sourceColumnRef&&_===y.targetColumnRef?y:{...y,sourceColumnRef:g,targetColumnRef:_}});return{logical:{...e,entities:m,associations:p},layout:f.some((y,b)=>y!==n.associationLayouts[b])?{...n,associationLayouts:f}:n,reissued:s}}function $g(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 od(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function id(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(od);if(!i.length)continue;const a=o.filter(s=>!od(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 Mo(e){return JSON.parse(JSON.stringify(e))}function ad(e,n,o){var B;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 x of r.associations){const S=$.has(x.end1.entityRef),T=$.has(x.end2.entityRef);S!==T&&s.add(S?x.end2.entityRef:x.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 x=p.get($);return x||(x=i(),p.set($,x)),x};for(const $ of c){f($.modelId);for(const x of $.attributes){f(x.modelId);for(const S of x.dbAttrs)f(S.modelId)}for(const x of $.indexes??[])f(x.modelId);for(const x of $.operations??[])f(x.modelId)}for(const $ of u)f($.modelId);const y=$=>p.get($),b=c.map($=>{const x=Mo($);x.modelId=y($.modelId),x.attributes=x.attributes.map(S=>Tg(S,y,m,d));for(const S of x.indexes??[])S.modelId=y(S.modelId),S.columns=S.columns.map(T=>jn(T.columnRef)?T:{...T,columnRef:y(T.columnRef)}).filter(T=>T.columnRef!==void 0);for(const S of x.operations??[])S.modelId=y(S.modelId);return x});id(b);const g=u.map($=>{const x=Mo($);return x.modelId=y($.modelId),x.end1=rd(x.end1,y),x.end2=rd(x.end2,y),x}),_=[];for(const $ of r.groups){const x=$.memberEntityRefs.filter(T=>d.has(T));if(x.length===0)continue;const S=Mo($);S.modelId=f($.modelId),S.memberEntityRefs=x.map(T=>y(T)),_.push(S)}const k=o.collisionSuffix??"_imported",h=new Set(o.existing.entities.map($=>$.name)),E=new Set(o.existing.entities.map($=>{var x;return(x=$.table)==null?void 0:x.physicalName}).filter($=>!!$));for(const $ of b)h.has($.name)&&($.name=`${$.name}${k}`),(B=$.table)!=null&&B.physicalName&&E.has($.table.physicalName)&&($.table.physicalName=`${$.table.physicalName}${k}`);const N=[];for(const $ of l.entityLayouts){const x=y($.entityRef);if(!x)continue;const S=Mo($);S.entityRef=x,S.geo={...S.geo,location:ul(S.geo.location,a)},S.attributeStyles&&(S.attributeStyles=pa(S.attributeStyles,y)),S.operationStyles&&(S.operationStyles=pa(S.operationStyles,y)),N.push(S)}const C=[];for(const $ of l.associationLayouts){const x=y($.associationRef);if(!x)continue;const S=Mo($);S.associationRef=x,S.sourceColumnRef=$.sourceColumnRef?y($.sourceColumnRef):void 0,S.targetColumnRef=$.targetColumnRef?y($.targetColumnRef):void 0,S.waypoints=S.waypoints.map(T=>ul(T,a)),C.push(S)}const A=[];for(const $ of l.groupLayouts){const x=y($.groupRef);if(!x)continue;const S=Mo($);S.groupRef=x,S.geo={...S.geo,location:ul(S.geo.location,a)},delete S.memberNoteRefs,A.push(S)}return{logical:{entities:b,associations:g,groups:_},layout:{entityLayouts:N,associationLayouts:C,groupLayouts:A},idMap:p}}function ul(e,n){return{x:e.x+n.x,y:e.y+n.y}}function Tg(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 rd(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 Mg(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 Vg=new Set(["attributes","operations","indexes","rev"]),Bg=new Set(["end1","end2","rev"]),Dg=new Set(["memberEntityRefs","rev"]),ld=new Set(["modelId"]),Og=new Set(["modelId","columns"]),Lg=new Set([]);function Pg(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,ld);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,ld);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,Og);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function zg(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,Vg);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Pg(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,Bg);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]??{},Lg);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,Dg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Mg(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 Fg(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 Ug(e,n){const o=[];return zg(e.logical,n.logical,o),Fg(e.layout,n.layout,o),o}function Hg(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 jg={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 Kg{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=jg[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=Hg(n),i=new Kg(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 b=fl((r=y.value)==null?void 0:r.attributes,n.attributeRef);b&&en(i,f,b,"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 b=fl((s=y.value)==null?void 0:s.operations,n.operationRef);b&&en(i,f,b,"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 b=fl((d=y.value)==null?void 0:d.indexes,n.indexRef);b&&en(i,f,b,"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 b=(m=y.value)==null?void 0:m[n.end];en(i,f,b,"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 b=(p=y.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(b))for(const g of b)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는 의도적 범위 밖)"},Gg={"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,Yg=e=>{var n;return Ft((n=e.value)==null?void 0:n.modelId)};function sd(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=Gg[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=sd(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?Yg(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 qg(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=sd(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 Wg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Jg(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 cd(e,n){const o=e.filter(s=>s.ops.some(c=>Wg(c,n))),{attributes:i,operations:a,indexes:r}=Jg(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 Xg(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 Zg(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=qg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Qg(e){const{entities:n,associations:o,groups:i}=Zg(e),a=[];for(const r of n)for(const l of cd(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=Qg(e),o=Xg(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 dd(e){return`${e.kind}:${e.ref}:${e.end??""}`}function eb(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;tb.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const tb=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=dd(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 eb(e,o,r)){const p=s.get(dd(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 b=null;for(const _ of m.evs){_.verb==="add"&&b!==null&&b!=="add"&&y.clear(),b=_.verb;for(const k of _.fields){const h=y.get(k.field);h?h.lastValue=k.value:y.set(k.field,{firstOld:k.oldValue,hasOld:k.oldValue!==void 0,lastValue:k.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const _=[];for(const[k,h]of y)_.push({field:k,value:h.lastValue});d.push({subject:m.subject,verb:"added",fields:_});continue}const g=[];for(const[_,k]of y)k.hasOld&&Jn(k.firstOld,k.lastValue)||g.push({field:_,value:k.lastValue,...k.hasOld?{oldValue:k.firstOld}:{}});g.length!==0&&d.push({subject:m.subject,verb:"modified",fields:g})}return{fromSeq:o,toSeq:r,entries:d}}function ud(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 md(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=md(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 fd(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=md(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 pd(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 hd(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 Vo(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 yd(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 gd(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 bd(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 _d(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 kd(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 Ed(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function Nd(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function 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 wd(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Id(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function vd(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 Cd(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 Sd(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 xd(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 xd("attribute.update","attributeRef",e,r,i??[])}}}function Rd(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 Ad(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 $d(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 Td(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 xd("operation.update","operationRef",e,r,i??[])}}}function Md(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 Vd(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 Bd(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 Dd(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 Od(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 Ld(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 Pd(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 zd(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 Fd(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 Ud(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 Hd(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 jd(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Kd(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Gd(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 Yd(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 qd(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 Wd(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 Jd(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 Xd(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 Zd(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 Qd(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 eu(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 nb=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ea,addAttribute:tn,addEntity:ga,addEntityToGroup:Nd,addGroup:_a,addIndex:Bd,addNote:Ud,addNoteConnection:Wd,addNoteConnectionWaypoint:Zd,addNoteToGroup:Yd,addOperation:Rd,addWaypoint:Fd,clearNoteConnectionWaypoints:eu,clearWaypoints:zd,composite:rt,moveEntity:Vo,moveGroup:wd,moveNote:mi,moveNoteConnectionWaypoint:Xd,moveWaypoint:Od,removeAssociation:Vd,removeAttribute:Sd,removeEntity:fd,removeEntityFromGroup:ka,removeGroup:Ed,removeIndex:Dd,removeNote:Hd,removeNoteConnection:Jd,removeNoteConnectionWaypoint:Qd,removeNoteFromGroup:qd,removeOperation:$d,removeWaypoint:Ld,renameEntity:hd,reorderAttributes:El,reorderOperations:Td,resizeEntity:yd,resizeGroup:Id,resizeNote:jd,setAllEntitiesCollapsed:kl,setAttributeSwatch:ba,setEntityCollapsed:bd,setEntityLocked:_d,setEntitySwatch:gd,setGroupLocked:Cd,setGroupSwatch:vd,setNoteMemo:Kd,setNoteSwatch:Gd,setOperationSwatch:Md,translateWaypoints:Pd,updateAssociation:Na,updateAssociationEnd:Ht,updateAttribute:nn,updateEntity:pd,updateGroup:kd,updateIndex:wa,updateOperation:Ad},Symbol.toStringTag,{value:"Module"}));class tu{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 ob=[400,1200];function ib(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 ab(e){const n=ib(e);return n==null||n===408||n===429?!0:n<400||n>=500}const rb=e=>new Promise(n=>setTimeout(n,e));class nu{constructor(n){ct(this,"cache",new tu);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??ob}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||!ab(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await rb(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 ou=["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"],iu=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function au(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 lb(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 sb(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=oi(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 ru(e,n,o=Pe){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=lb(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;sb(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 lu(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 b=c.map(_=>y.dbAttrs[d.get(_)]),g=b.reduce((_,k,h)=>k===y.dbAttrs[h]?_:_+1,0);g&&m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:b,moved:g})}return m}function su(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 b=y.dbAttrs.filter((k,h)=>d.has(h)),g=y.dbAttrs.filter((k,h)=>!d.has(h));y.dbAttrs.some((k,h)=>{if(d.has(h))return!1;const E=l[h],N=!!k.physicalName&&k.physicalName!==((E==null?void 0:E.physicalName)??""),C=k.sharedColumnRef!=null&&k.sharedColumnRef!==(E==null?void 0:E.sharedColumnRef);return N||C})||m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:b,dropped:g})}return m}function cb(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 db(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 cu(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=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=>fb(i,e))}}function ub(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=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=>({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 mb=new Set(["name","description","packageName","excludeDDLGeneration"]);function fb(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 du(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 pb(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 hb(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 uu(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 yb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function gb(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function bb(e,n){const o=yb(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 mu(e,n){const o=gb(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 fu(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function pu(e){return fu(e)&&e.dataType==null}function hu(e,n,o){const i=fu(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 yu(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 b={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=uu($n(i,a),b);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:b}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:b,matches: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 _b=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName"]),kb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),Eb=new Set(["description","identifying"]),Nb=new Set(["multiplicity","navigable","composition"]),wb=new Set(["name","unique","description","parameters"]),Ib=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Bo(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"]),vb=new Set([...Cl].filter(e=>e!=="sharedColumnRef"));function Cb(e,n,o,i){if(i||o.some(l=>!vb.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 Sb(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"},_=uu($n(i,a),g);if(!_.ok){s.push(_.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:_.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});return}const b={...m};delete b.sharedColumnRef,d.push({...b,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function gu(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 bu(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=hb(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 Do(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 xb(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 au(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function Rb(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 b=p.get(f)??[];b.push(y),p.set(f,b)}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 su(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 ru(f,m,r))u(y)}}function Sl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of Lc(n,o,i)){for(const u of c.remove)Do(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 Ab(e,n,o={}){const i=o.mkId??Pe,a=o.embeddableCatalog??[],r=h=>a.find(E=>E.type===h),l=[],s=[],c=new Map,d=(h,E)=>{const N=c.get(h)??zt(E);return c.set(h,N+1),N},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},y=[],b=new Set,g=(h,E)=>`${h}\0${E}`,_=new Set;for(const h of n)h.kind==="entity.add"&&(_.add(h.spec.name),h.spec.physicalName&&_.add(h.spec.physicalName));const k=new Set;return n.forEach((h,E)=>{var N,C,A,B,$;switch(h.kind){case"entity.add":{const x=e.entities.filter(L=>L.name===h.spec.name).map(L=>L.modelId);if(x.length||k.has(h.spec.name)){s.push({code:"entity-name-conflict",opIndex:E,handle:{ref:h.spec.name},matches:x});break}k.add(h.spec.name);const S=i(),T={modelId:S,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}}:{}},R={ref:h.spec.name};let w=!1;for(const[L,M]of(h.spec.attributes??[]).entries()){if(M.type==="GroupCodeEnum"&&!M.groupCode){s.push({code:"groupcode-required",opIndex:E,entity:R,handle:{ref:M.name}}),w=!0;continue}if(!r(M.type)&&!((N=M.embeddableOverrides)!=null&&N.length)&&pu(M)){s.push({code:"datatype-required",opIndex:E,entity:R,handle:{ref:M.name}}),w=!0;continue}const V=r(M.type);if(V){const U=yu(M,V,L,T,e.entities,E,R,s,i);U?T.attributes.push(U):w=!0}else(C=M.embeddableOverrides)!=null&&C.length?(s.push({code:"embeddable-type-unresolved",opIndex:E,entity:R,handle:{ref:M.name}}),w=!0):T.attributes.push(hu(M,L,i))}const v=(h.spec.operations??[]).map((L,M)=>gu(L,M,i));v.length&&(T.operations=v);const I=[];for(const L of h.spec.indexes??[]){const M=bu(T,L,E,R,s,i);M?I.push(M):w=!0}if(I.length&&(T.indexes=I),w)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:S,value:T});break}case"entity.update":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=Bo(h.patch,kb,["jpaAttrs.","table."]);if(S.length){s.push({code:"entity-patch-unknown-key",opIndex:E,entity:h.entity,keys:S});break}const T=h.patch.stereotype;if(typeof T=="string"&&T!==x.value.stereotype&&(T==="JPA_EMBEDDABLE"||x.value.stereotype==="JPA_EMBEDDABLE")){s.push({code:"stereotype-embeddable-transition-unsupported",opIndex:E,entity:h.entity,from:x.value.stereotype??"",to:T});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:h.patch});break}case"entity.remove":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=x.value.modelId,T=e.associations.filter(I=>I.end1.entityRef===S||I.end2.entityRef===S),R=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!==S)for(const L of I.attributes)L.embedded&&R.has(L.embedded.associationRef)&&Do(l,f,I.modelId,L.modelId);for(const I of T){if(I.end1.entityRef===S||!I.end1.attributeRef)continue;const L=e.entities.find(V=>V.modelId===I.end1.entityRef),M=L==null?void 0:L.attributes.find(V=>V.modelId===I.end1.attributeRef&&V.attrType==="RELATION_REF");M&&Do(l,f,L.modelId,M.modelId)}const w={...e,entities:e.entities.filter(I=>I.modelId!==S),associations:e.associations.filter(I=>!R.has(I.modelId))},v=new Set(T.filter(I=>I.end1.entityRef===S&&I.end2.entityRef!==S).map(I=>I.end2.entityRef));for(const I of v)Sl(l,w,I,i,f,d);for(const I of e.groups)I.memberEntityRefs.includes(S)&&(b.has(g(I.modelId,S))||(b.add(g(I.modelId,S)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:I.modelId,groupRef:I.modelId,entityRef:S})));p.add(S),l.push({kind:"entity.remove",casUnit:"logical",entityRef:S});break}case"attribute.add":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}if(h.spec.type==="GroupCodeEnum"&&!h.spec.groupCode){s.push({code:"groupcode-required",opIndex:E,entity:h.entity,handle:{ref:h.spec.name}});break}if(!r(h.spec.type)&&!((A=h.spec.embeddableOverrides)!=null&&A.length)&&pu(h.spec)){s.push({code:"datatype-required",opIndex:E,entity:h.entity,handle:{ref:h.spec.name}});break}const S=d(x.value.modelId,x.value.attributes),T=r(h.spec.type);let R;if(T)R=yu(h.spec,T,S,x.value,e.entities,E,h.entity,s,i);else if((B=h.spec.embeddableOverrides)!=null&&B.length){s.push({code:"embeddable-type-unresolved",opIndex:E,entity:h.entity,handle:{ref:h.spec.name}});break}else R=hu(h.spec,S,i);if(!R)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:R}),y.push({entityId:x.value.modelId,attribute:R});break}case"attribute.update":case"attribute.remove":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=du(x.value,h.attribute);if(!S.ok){s.push(S.reason==="not-found"?{code:"attribute-not-found",opIndex:E,entity:h.entity,handle:h.attribute}:{code:"attribute-ambiguous",opIndex:E,entity:h.entity,handle:h.attribute,matches:S.matches});break}if(h.kind==="attribute.update"){const T=[],R=[];let w=!1;for(const M of Object.keys(h.patch)){if(M.includes(".")){M.startsWith("dbAttrs.")?w=!0:R.push(M);continue}Cl.has(M)?T.push(M):_b.has(M)||R.push(M)}if(R.length){s.push({code:"attribute-patch-unknown-key",opIndex:E,entity:h.entity,handle:h.attribute,keys:R});break}if("attrType"in h.patch){const M=String(h.patch.attrType),V=iu.includes(M)?M!==S.value.attrType?"transition":void 0:"unknown-value";if(V){s.push({code:"attribute-attrtype-unsupported",opIndex:E,entity:h.entity,handle:h.attribute,reason:V,current:S.value.attrType,requested:M});break}}const v="type"in h.patch?h.patch.type:S.value.type,I="groupCode"in h.patch?h.patch.groupCode:S.value.groupCode;if(v==="GroupCodeEnum"&&!I){s.push({code:"groupcode-required",opIndex:E,entity:h.entity,handle:h.attribute});break}let L=h.patch;if(T.length){const M=Cb(S.value,h.patch,T,w);if(!M){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:E,entity:h.entity,handle:h.attribute,keys:T});break}L=M}if(($=h.embeddableOverrides)!=null&&$.length){const M=r(S.value.type);if(!M||S.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:E,entity:h.entity,handle:h.attribute});break}const V=Sb(S.value,M,h.embeddableOverrides,x.value,e.entities,E,h.entity,s);if(!V)break;L={...L,dbAttrs:V}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:S.value.modelId,patch:L})}else{const T=xo(e,x.value.modelId,S.value.modelId);if(T){const R=w=>{var v;return((v=e.entities.find(I=>I.modelId===w))==null?void 0:v.name)??w};s.push({code:"attribute-fk-managed",opIndex:E,entity:h.entity,handle:h.attribute,association:{from:R(T.end1.entityRef),to:R(T.end2.entityRef)}});break}Do(l,f,x.value.modelId,S.value.modelId)}break}case"association.add":{const x=wt(e,h.spec.from),S=wt(e,h.spec.to);if(x.ok||s.push(It(x.reason,E,h.spec.from,x.matches,_)),S.ok||s.push(It(S.reason,E,h.spec.to,S.matches,_)),!x.ok||!S.ok)break;if(h.spec.identifying&&x.value.modelId===S.value.modelId){s.push({code:"self-identifying",opIndex:E,handle:{from:h.spec.from,to:h.spec.to}});break}if(x.value.stereotype==="JPA_EMBEDDABLE"||S.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:E,handle:{from:h.spec.from,to:h.spec.to}});break}const T=i(),R={modelId:T,...h.spec.identifying!=null?{identifying:h.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:h.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:S.value.modelId,multiplicity:h.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:h.spec.composition??!1}},w={...e,associations:[...e.associations,R]},v=ri(w,S.value.modelId,i);v.add[0]&&(R.end2.attributeRef=v.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:R});for(const I of v.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,value:{...I,order:d(S.value.modelId,S.value.attributes)}});break}case"association.remove":{const x=wt(e,h.association.from),S=wt(e,h.association.to);if(x.ok||s.push(It(x.reason,E,h.association.from,x.matches,_)),S.ok||s.push(It(S.reason,E,h.association.to,S.matches,_)),!x.ok||!S.ok)break;const T=cu(e,x.value.modelId,S.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:E,handle:h.association}:{code:"association-ambiguous",opIndex:E,handle:h.association,matches:T.map(I=>I.modelId)});break}const R=T[0];m.has(R.modelId)||(m.add(R.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:R.modelId}));const w=e.entities.find(I=>I.attributes.some(L=>{var M;return((M=L.embedded)==null?void 0:M.associationRef)===R.modelId}));if(w){const I=w.attributes.find(L=>{var M;return((M=L.embedded)==null?void 0:M.associationRef)===R.modelId});Do(l,f,w.modelId,I.modelId);break}if(R.end1.attributeRef){const I=e.entities.find(M=>M.modelId===R.end1.entityRef),L=I==null?void 0:I.attributes.find(M=>M.modelId===R.end1.attributeRef&&M.attrType==="RELATION_REF");L&&Do(l,f,I.modelId,L.modelId)}const v={...e,associations:e.associations.filter(I=>I.modelId!==R.modelId)};Sl(l,v,R.end2.entityRef,i,f,d);break}case"association.update":{const x=_u(e,h.association,E,s,_);if(!x)break;const S=h.patch.identifying,T=typeof S=="boolean"?S:void 0;if(T===!0&&x.end1.entityRef===x.end2.entityRef){s.push({code:"self-identifying",opIndex:E,handle:h.association});break}const R=Bo(h.patch,Eb);if(R.length){s.push({code:"association-patch-unknown-key",opIndex:E,handle:h.association,keys:R});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:h.patch}),T!==void 0&&T!==(x.identifying??!1)){const w={...e,associations:e.associations.map(v=>v.modelId===x.modelId?{...v,identifying:T}:v)};Sl(l,w,x.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const x=_u(e,h.association,E,s,_);if(!x)break;const S=h.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(h.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:E,handle:h.association});break}const T=Bo(h.patch,Nb,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:E,handle:h.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:S,patch:h.patch});break}case"index.add":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=bu(x.value,h.spec,E,h.entity,s,i);if(!S)break;l.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:S.modelId,value:S});break}case"index.update":case"index.remove":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}if(vl(h.index)){s.push({code:"handle-by-unsupported",opIndex:E,entity:h.entity,handle:h.index,target:"index"});break}const S=bb(x.value,h.index);if(!S.ok){s.push(S.reason==="not-found"?{code:"index-not-found",opIndex:E,entity:h.entity,handle:h.index}:{code:"index-ambiguous",opIndex:E,entity:h.entity,handle:h.index,matches:S.matches});break}if(h.kind==="index.update"){if("columns"in h.patch){s.push({code:"index-columns-patch-unsupported",opIndex:E,entity:h.entity,handle:h.index});break}const T=Bo(h.patch,wb);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:E,entity:h.entity,handle:h.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:S.value.modelId,patch:h.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:S.value.modelId});break}case"operation.add":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}const S=u.get(x.value.modelId)??(x.value.operations?zt(x.value.operations):0);u.set(x.value.modelId,S+1);const T=gu(h.spec,S,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,E,h.entity,x.matches,_));break}if(vl(h.operation)){s.push({code:"handle-by-unsupported",opIndex:E,entity:h.entity,handle:h.operation,target:"operation"});break}const S=mu(x.value,h.operation);if(!S.ok){s.push(S.reason==="not-found"?{code:"operation-not-found",opIndex:E,entity:h.entity,handle:h.operation}:{code:"operation-ambiguous",opIndex:E,entity:h.entity,handle:h.operation,matches:S.matches});break}if(h.kind==="operation.update"){const T=Bo(h.patch,Ib);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:E,entity:h.entity,handle:h.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:S.value.modelId,patch:h.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:S.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=h.kind==="attribute.reorder",S=wt(e,h.entity);if(!S.ok){s.push(It(S.reason,E,h.entity,S.matches,_));break}const T=x?h.order:h.operations,R=[],w=new Set;let v=!1;for(const V of T){if(!x&&vl(V)){s.push({code:"handle-by-unsupported",opIndex:E,entity:h.entity,handle:V,target:"operation"}),v=!0;continue}const U=x?du(S.value,V):mu(S.value,V);if(!U.ok){s.push(U.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:E,entity:h.entity,handle:V}:{code:"reorder-handle-ambiguous",opIndex:E,entity:h.entity,handle:V,matches:U.matches}),v=!0;continue}if(w.has(U.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:E,entity:h.entity,handle:V}),v=!0;continue}w.add(U.value.modelId),R.push(U.value)}if(v)break;const L=[...x?S.value.attributes:S.value.operations??[]].sort((V,U)=>V.order-U.order).filter(V=>!w.has(V.modelId)),M=[...R,...L];if(M.forEach((V,U)=>{V.order!==U&&l.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,attributeRef:V.modelId,patch:{order:U}}:{kind:"operation.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:V.modelId,patch:{order:U}})}),x)for(const V of lu(e,S.value.modelId,M.map(U=>U.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:V.entityId,entityRef:V.entityId,attributeRef:V.attributeId,patch:{dbAttrs:V.dbAttrs}});break}case"group.add":{const x=[];let S=!1;for(const w of h.spec.members){const v=wt(e,w);if(!v.ok){s.push(It(v.reason,E,w,v.matches,_)),S=!0;continue}x.push(v.value.modelId)}if(S)break;const T=i(),R={modelId:T,excludeDDLGeneration:h.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...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:R});break}case"group.update":{const x=wl(e,h.group);if(!x.ok){s.push(Il(x,E,h.group));break}const S=Bo(h.patch,mb);if(S.length){s.push({code:"group-patch-unknown-key",opIndex:E,handle:h.group,keys:S});break}l.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:h.patch});break}case"group.remove":{const x=wl(e,h.group);if(!x.ok){s.push(Il(x,E,h.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=wl(e,h.group);if(!x.ok){s.push(Il(x,E,h.group));break}const S=wt(e,h.entity);if(!S.ok){s.push(It(S.reason,E,h.entity,S.matches,_));break}const T=x.value.memberEntityRefs.includes(S.value.modelId);if(h.kind==="group.addMember"?T:!T)break;if(h.kind==="group.removeMember"){if(b.has(g(x.value.modelId,S.value.modelId)))break;b.add(g(x.value.modelId,S.value.modelId))}l.push({kind:h.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:S.value.modelId});break}}}),s.length||xb(l,e,f,p),s.length||Rb(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 _u(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=cu(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 ku={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},$b={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},Tb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Mb={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},Vb={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},Bb={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},Eu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Db={type:"object",description:"일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)을 end 로 주면 거부된다(임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Eu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Eu,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},Ob={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...ku,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},Lb={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},Pb={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},zb={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:[...iu],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},Fb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Ub={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Hb={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},jb={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 소관).'},Kb={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 Gb={"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"]})},Yb={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},qb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...Vn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},Nu={anyOf:ou.map(e=>Gb[e])},Wb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ku,nameHandle:$b,groupHandle:Yb,assocHandle:Tb,entitySpec:Mb,attrSpec:Vb,embeddableOverrides:Bb,assocSpec:Db,indexSpec:Ob,operationSpec:Lb,groupSpec:Pb,entityUpdatePatch:jb,attrUpdatePatch:zb,assocUpdatePatch:Fb,assocEndUpdatePatch:Kb,indexUpdatePatch:Ub,operationUpdatePatch:Hb,groupUpdatePatch:qb,symbolicOp:Nu}};function Jb(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 wu={location:{x:0,y:0},size:{width:220,height:140}};function Iu(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 Xb=/^[-=_*~\s]{3,}$/;function Zb(e){return e.attrType&&e.attrType!=="NORMAL"||!Xb.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Qb(e){return e.type===hn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function e_(e,n){if(e.attrType==="DIVIDER"||Zb(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=Qb(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(Iu)}}function t_(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 n_(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 o_(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(e_),operations:(n=e.operations)==null?void 0:n.map(t_),indexes:(o=e.indexes)==null?void 0:o.map(n_),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function i_(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??{...wu},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 vu(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:vu(e)}}function a_(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 r_(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:a_(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 Cu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Su(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 xu(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(Iu)}}function l_(e,n,o){var E,N;const i=Rl(e.end1.attribute),a=Rl(e.end2.attribute);if(i===a)return r_(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(N=(E=s.dbAttrs)==null?void 0:E[0])==null?void 0:N.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((C,A)=>Math.max(C,A.order),-1)+1:s.order??0,p={...xu(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 b;if(y&&f&&r.navigable){const C=Qi(l.multiplicity);b={modelId:y.modelId??crypto.randomUUID(),name:wo(y.name??ta((u==null?void 0:u.name)??l.endModel.refId,C),new Set(f.attributes.map(A=>A.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((A,B)=>Math.max(A,B.order),-1)+1,dbAttrs:[]},f.attributes.push(b)}const g=(C,A)=>({entityRef:C.endModel.refId,multiplicity:C.multiplicity,navigable:C.navigable,composition:C.composition,attributeRef:A?b==null?void 0:b.modelId:p.modelId,jpa:vu(C)}),_=r.endModel.refId===l.endModel.refId,k={modelId:e.modelId,description:e.description,identifying:!_&&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:k,layout:h}}function s_(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 c_(e,n,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((b,g)=>Math.max(b,g.order),-1)+1:l.order??0,d={...xu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(b=>s_(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...xl(b),legacyEmbedRaw:b.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 d_(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 Ru(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=d_(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 Au(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 u_(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=wo(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 m_(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 $u(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&&!uc(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 Tu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?f_(n):p_(n)}function f_(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);u_(a,r),m_(a,r),$u(a,r);const{version:s,...c}=e.layout;Au(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 p_(e){var _,k;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(h,E)=>{o.push(o_(h));const N=i_(h);N.geo={location:{x:N.geo.location.x+E.x,y:N.geo.location.y+E.y},size:N.geo.size},i.push(N);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 E=h.entities??[];l.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:E.map(C=>C.modelId)});const N=((_=h.geo)==null?void 0:_.location)??u;if(h.geo){const C=(h.notes??[]).map(A=>A.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 E)d(C,N);for(const C of h.notes??[])m.push(Ru(C,N))}const p=new Map(o.map(h=>[h.modelId,h])),f=new Map,y=new Map;for(const h of o)for(const E of h.attributes)for(const N of E.dbAttrs)f.set(N.modelId,E.modelId),y.set(N.modelId,N);for(const h of c)for(const E of[h.end1,h.end2]){const N=E.attribute;if(N&&(((k=N.dbAttrs)==null?void 0:k.length)??0)>0)for(const C of N.dbAttrs)C.modelId&&f.set(C.modelId,N.modelId)}for(const h of c){const E=Cu(h.end1.attribute),N=Cu(h.end2.attribute),C=Su(h.end1)||Su(h.end2),{assoc:A,layout:B}=E!==N||C?c_(h,p,y):l_(h,p,f);a.push(A),r.push(B)}Au(o,a,r),id(o),$u(o,a);const b={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(h=>Ru(h)),...m]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:g}}function Mu(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function h_(e,n){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(Mu),style:n}}function y_(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 g_(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 b_(e,n){const o=n==null?void 0:n.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...Mu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function __(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function Vu(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 k_(e){const n=new Set;for(const o of e.logical.associations){const i=Vu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function E_(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 N_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function w_(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:N_(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 I_(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)=>w_(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 v_(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=I_(e,n,i);if(a)return a;const r=Vu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?b_(r.fk,l):void 0,c=__(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 Bu(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)??{...wu},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 h_(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 y_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>v_(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(g_),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 C_(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Du(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Bu(c,n,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function Du(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function S_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=k_(e),r=E_(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=>Bu(s,e,a,r)),groups:e.logical.groups.map(s=>C_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>Du(s))}}function x_(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 R_=["notNull"];function A_(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}=Tu(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 b={};for(const g of R_)f[g]===!0!=(y[g]===!0)&&(b[g]=f[g],s.attributeFieldsByName[g]=(s.attributeFieldsByName[g]??0)+1);Object.keys(b).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:b}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const 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 $_=typeof window<"u"&&typeof document<"u",T_=e=>typeof e<"u",M_=Object.prototype.toString,V_=e=>M_.call(e)==="[object Object]",B_=()=>{};function D_(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 Ou=e=>e();function O_(e=Ou){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 Lu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function L_(e,n,o={}){const{eventFilter:i=Ou,...a}=o;return t.watch(e,D_(i,n),a)}function Oo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=O_(i);return{stop:L_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function P_(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:b}={}){let g=null;const k=[new Promise(h=>{g=t.watch(e,E=>{m(E)!==n&&(g==null||g(),h(E))},{flush:p,deep:f,immediate:!0})})];return y!=null&&k.push(Lu(y,b).then(()=>gn(e)).finally(()=>g==null?void 0:g())),Promise.race(k)}function i(m,p){if(!t.isRef(m))return o(E=>E===m,p);const{flush:f="sync",deep:y=!1,timeout:b,throwOnTimeout:g}=p??{};let _=null;const h=[new Promise(E=>{_=t.watch([e,m],([N,C])=>{n!==(N===C)&&(_==null||_(),E(N))},{flush:f,deep:y,immediate:!0})})];return b!=null&&h.push(Lu(b,g).then(()=>gn(e)).finally(()=>(_==null||_(),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 z_(e){var n;const o=gn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Pu=$_?window:void 0;function zu(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Pu):[n,o,i,a]=e,!n)return B_;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(()=>[z_(n),gn(a)],([u,m])=>{if(l(),!u)return;const p=V_(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 F_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Fu(...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=Pu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=F_(n);return zu(a,r,u=>{u.repeat&&gn(s)||c(u)&&o(u)},l)}function U_(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 b=d;n||(n="modelValue"),b=b||`update:${n.toString()}`;const g=h=>s?typeof s=="function"?s(h):U_(h):h,_=()=>T_(e[n])?g(e[n]):m,k=h=>{p?p(h)&&y(b,h):y(b,h)};if(c){const h=_(),E=t.ref(h);let N=!1;return t.watch(()=>e[n],C=>{N||(N=!0,E.value=g(C),t.nextTick(()=>N=!1))}),t.watch(E,C=>{!N&&(C!==e[n]||u)&&k(C)},{deep:u}),E}else return t.computed({get(){return _()},set(h){k(h)}})}var H_={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 j_(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=j_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=K_(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]=Uu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Uu(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 K_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Uu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=H_,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 Hu={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)),Hu.hasOwnProperty(n)?{space:Hu[n],local:e}:e}function G_(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 Y_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ju(e){var n=Sa(e);return(n.local?Y_:G_)(n)}function q_(){}function Vl(e){return e==null?q_:function(){return this.querySelector(e)}}function W_(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 J_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function X_(){return[]}function Ku(e){return e==null?X_:function(){return this.querySelectorAll(e)}}function Z_(e){return function(){return J_(e.apply(this,arguments))}}function Q_(e){typeof e=="function"?e=Z_(e):e=Ku(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 Gu(e){return function(){return this.matches(e)}}function Yu(e){return function(n){return n.matches(e)}}var ek=Array.prototype.find;function tk(e){return function(){return ek.call(this.children,e)}}function nk(){return this.firstElementChild}function ok(e){return this.select(e==null?nk:tk(typeof e=="function"?e:Yu(e)))}var ik=Array.prototype.filter;function ak(){return Array.from(this.children)}function rk(e){return function(){return ik.call(this.children,e)}}function lk(e){return this.selectAll(e==null?ak:rk(typeof e=="function"?e:Yu(e)))}function sk(e){typeof e!="function"&&(e=Gu(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 qu(e){return new Array(e.length)}function ck(){return new Lt(this._enter||this._groups.map(qu),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 dk(e){return function(){return e}}function uk(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 mk(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 fk(e){return e.__data__}function pk(e,n){if(!arguments.length)return Array.from(this,fk);var o=n?mk:uk,i=this._parents,a=this._groups;typeof e!="function"&&(e=dk(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=hk(e.call(u,u&&u.__data__,d,i)),y=f.length,b=s[d]=new Array(y),g=l[d]=new Array(y),_=c[d]=new Array(p);o(u,m,b,g,_,f,n);for(var k=0,h=0,E,N;k<y;++k)if(E=b[k]){for(k>=h&&(h=k+1);!(N=g[h])&&++h<y;);E._next=N||null}}return l=new Lt(l,i),l._enter=s,l._exit=c,l}function hk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yk(){return new Lt(this._exit||this._groups.map(qu),this._parents)}function gk(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 bk(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 _k(){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 kk(e){e||(e=Ek);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 Ek(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Nk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function wk(){return Array.from(this)}function Ik(){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 vk(){let e=0;for(const n of this)++e;return e}function Ck(){return!this.node()}function Sk(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 xk(e){return function(){this.removeAttribute(e)}}function Rk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ak(e,n){return function(){this.setAttribute(e,n)}}function $k(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function Tk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Mk(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 Vk(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?Rk:xk:typeof n=="function"?o.local?Mk:Tk:o.local?$k:Ak)(o,n))}function Wu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Bk(e){return function(){this.style.removeProperty(e)}}function Dk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Ok(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Lk(e,n,o){return arguments.length>1?this.each((n==null?Bk:typeof n=="function"?Ok:Dk)(e,n,o??"")):Lo(this.node(),e)}function Lo(e,n){return e.style.getPropertyValue(n)||Wu(e).getComputedStyle(e,null).getPropertyValue(n)}function Pk(e){return function(){delete this[e]}}function zk(e,n){return function(){this[e]=n}}function Fk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Uk(e,n){return arguments.length>1?this.each((n==null?Pk:typeof n=="function"?Fk:zk)(e,n)):this.node()[e]}function Ju(e){return e.trim().split(/^|\s+/)}function Bl(e){return e.classList||new Xu(e)}function Xu(e){this._node=e,this._names=Ju(e.getAttribute("class")||"")}Xu.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 Zu(e,n){for(var o=Bl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Qu(e,n){for(var o=Bl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Hk(e){return function(){Zu(this,e)}}function jk(e){return function(){Qu(this,e)}}function Kk(e,n){return function(){(n.apply(this,arguments)?Zu:Qu)(this,e)}}function Gk(e,n){var o=Ju(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"?Kk:n?Hk:jk)(o,n))}function Yk(){this.textContent=""}function qk(e){return function(){this.textContent=e}}function Wk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Jk(e){return arguments.length?this.each(e==null?Yk:(typeof e=="function"?Wk:qk)(e)):this.node().textContent}function Xk(){this.innerHTML=""}function Zk(e){return function(){this.innerHTML=e}}function Qk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function eE(e){return arguments.length?this.each(e==null?Xk:(typeof e=="function"?Qk:Zk)(e)):this.node().innerHTML}function tE(){this.nextSibling&&this.parentNode.appendChild(this)}function nE(){return this.each(tE)}function oE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function iE(){return this.each(oE)}function aE(e){var n=typeof e=="function"?e:ju(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function rE(){return null}function lE(e,n){var o=typeof e=="function"?e:ju(e),i=n==null?rE:typeof n=="function"?n:Vl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function sE(){var e=this.parentNode;e&&e.removeChild(this)}function cE(){return this.each(sE)}function dE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function uE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function mE(e){return this.select(e?uE:dE)}function fE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function pE(e){return function(n){e.call(this,n,this.__data__)}}function hE(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 yE(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 gE(e,n,o){return function(){var i=this.__on,a,r=pE(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 bE(e,n,o){var i=hE(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?gE:yE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function em(e,n,o){var i=Wu(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function _E(e,n){return function(){return em(this,e,n)}}function kE(e,n){return function(){return em(this,e,n.apply(this,arguments))}}function EE(e,n){return this.each((typeof n=="function"?kE:_E)(e,n))}function*NE(){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 tm=[null];function Lt(e,n){this._groups=e,this._parents=n}function pi(){return new Lt([[document.documentElement]],tm)}function wE(){return this}Lt.prototype=pi.prototype={constructor:Lt,select:W_,selectAll:Q_,selectChild:ok,selectChildren:lk,filter:sk,data:pk,enter:ck,exit:yk,join:gk,merge:bk,selection:wE,order:_k,sort:kk,call:Nk,nodes:wk,node:Ik,size:vk,empty:Ck,each:Sk,attr:Vk,style:Lk,property:Uk,classed:Gk,text:Jk,html:eE,raise:nE,lower:iE,append:aE,insert:lE,remove:cE,clone:mE,datum:fE,on:bE,dispatch:EE,[Symbol.iterator]:NE};function jt(e){return typeof e=="string"?new Lt([[document.querySelector(e)]],[document.documentElement]):new Lt([[e]],tm)}function IE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function an(e,n){if(e=IE(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 vE={passive:!1},hi={capture:!0,passive:!1};function Dl(e){e.stopImmediatePropagation()}function Po(e){e.preventDefault(),e.stopImmediatePropagation()}function nm(e){var n=e.document.documentElement,o=jt(e).on("dragstart.drag",Po,hi);"onselectstart"in n?o.on("selectstart.drag",Po,hi):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function om(e,n){var o=e.document.documentElement,i=jt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Po,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 CE(e){return!e.ctrlKey&&!e.button}function SE(){return this.parentNode}function xE(e,n){return n??{x:e.x,y:e.y}}function RE(){return navigator.maxTouchPoints||"ontouchstart"in this}function AE(){var e=CE,n=SE,o=xE,i=RE,a={},r=va("start","drag","end"),l=0,s,c,d,u,m=0;function p(E){E.on("mousedown.drag",f).filter(i).on("touchstart.drag",g).on("touchmove.drag",_,vE).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(E,N){if(!(u||!e.call(this,E,N))){var C=h(this,n.call(this,E,N),E,N,"mouse");C&&(jt(E.view).on("mousemove.drag",y,hi).on("mouseup.drag",b,hi),nm(E.view),Dl(E),d=!1,s=E.clientX,c=E.clientY,C("start",E))}}function y(E){if(Po(E),!d){var N=E.clientX-s,C=E.clientY-c;d=N*N+C*C>m}a.mouse("drag",E)}function b(E){jt(E.view).on("mousemove.drag mouseup.drag",null),om(E.view,d),Po(E),a.mouse("end",E)}function g(E,N){if(e.call(this,E,N)){var C=E.changedTouches,A=n.call(this,E,N),B=C.length,$,x;for($=0;$<B;++$)(x=h(this,A,E,N,C[$].identifier,C[$]))&&(Dl(E),x("start",E,C[$]))}}function _(E){var N=E.changedTouches,C=N.length,A,B;for(A=0;A<C;++A)(B=a[N[A].identifier])&&(Po(E),B("drag",E,N[A]))}function k(E){var N=E.changedTouches,C=N.length,A,B;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),A=0;A<C;++A)(B=a[N[A].identifier])&&(Dl(E),B("end",E,N[A]))}function h(E,N,C,A,B,$){var x=r.copy(),S=an($||C,N),T,R,w;if((w=o.call(E,new Ol("beforestart",{sourceEvent:C,target:p,identifier:B,active:l,x:S[0],y:S[1],dx:0,dy:0,dispatch:x}),A))!=null)return T=w.x-S[0]||0,R=w.y-S[1]||0,function v(I,L,M){var V=S,U;switch(I){case"start":a[B]=v,U=l++;break;case"end":delete a[B],--l;case"drag":S=an(M||L,N),U=l;break}x.call(I,E,new Ol(I,{sourceEvent:L,subject:w,target:p,identifier:B,active:U,x:S[0]+T,y:S[1]+R,dx:S[0]-V[0],dy:S[1]-V[1],dispatch:x}),A)}}return p.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Ra(!!E),p):e},p.container=function(E){return arguments.length?(n=typeof E=="function"?E:Ra(E),p):n},p.subject=function(E){return arguments.length?(o=typeof E=="function"?E:Ra(E),p):o},p.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:Ra(!!E),p):i},p.on=function(){var E=r.on.apply(r,arguments);return E===r?p:E},p.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,p):Math.sqrt(m)},p}function Ll(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function im(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,zo="\\s*([+-]?\\d+)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$E=/^#([0-9a-f]{3,8})$/,TE=new RegExp(`^rgb\\(${zo},${zo},${zo}\\)$`),ME=new RegExp(`^rgb\\(${rn},${rn},${rn}\\)$`),VE=new RegExp(`^rgba\\(${zo},${zo},${zo},${bi}\\)$`),BE=new RegExp(`^rgba\\(${rn},${rn},${rn},${bi}\\)$`),DE=new RegExp(`^hsl\\(${bi},${rn},${rn}\\)$`),OE=new RegExp(`^hsla\\(${bi},${rn},${rn},${bi}\\)$`),am={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:rm,formatHex:rm,formatHex8:LE,formatHsl:PE,formatRgb:lm,toString:lm});function rm(){return this.rgb().formatHex()}function LE(){return this.rgb().formatHex8()}function PE(){return mm(this).formatHsl()}function lm(){return this.rgb().formatRgb()}function eo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=$E.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?sm(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=TE.exec(e))?new Vt(n[1],n[2],n[3],1):(n=ME.exec(e))?new Vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=VE.exec(e))?$a(n[1],n[2],n[3],n[4]):(n=BE.exec(e))?$a(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=DE.exec(e))?um(n[1],n[2]/100,n[3]/100,1):(n=OE.exec(e))?um(n[1],n[2]/100,n[3]/100,n[4]):am.hasOwnProperty(e)?sm(am[e]):e==="transparent"?new Vt(NaN,NaN,NaN,0):null}function sm(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 zE(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?zE(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,im(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:cm,formatHex:cm,formatHex8:FE,formatRgb:dm,toString:dm}));function cm(){return`#${no(this.r)}${no(this.g)}${no(this.b)}`}function FE(){return`#${no(this.r)}${no(this.g)}${no(this.b)}${no((isNaN(this.opacity)?1:this.opacity)*255)}`}function dm(){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 um(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 mm(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 UE(e,n,o,i){return arguments.length===1?mm(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,UE,im(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(fm(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("}${fm(this.h)}, ${Ma(this.s)*100}%, ${Ma(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fm(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 HE(e,n){return function(o){return e+o*n}}function jE(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 KE(e){return(e=+e)==1?pm:function(n,o){return o-n?jE(n,o,e):Fl(isNaN(n)?o:n)}}function pm(e,n){var o=n-e;return o?HE(e,o):Fl(isNaN(e)?n:e)}const Va=(function e(n){var o=KE(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=pm(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 GE(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 YE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qE(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 WE(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 JE(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 XE(e){return function(){return e}}function ZE(e){return function(n){return e(n)+""}}function hm(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]?ZE(c[0].x):XE(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):hm:n instanceof eo?Va:n instanceof Date?WE:YE(n)?GE:Array.isArray(n)?qE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?JE:ln)(e,n)}var ym=180/Math.PI,jl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gm(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)*ym,skewX:Math.atan(c)*ym,scaleX:l,scaleY:s}}var Ba;function QE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?jl:gm(n.a,n.b,n.c,n.d,n.e,n.f)}function e1(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,gm(e.a,e.b,e.c,e.d,e.e,e.f))}function bm(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 b=f.push("translate(",null,n,null,o);y.push({i:b-4,x:ln(d,m)},{i:b-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 b=f.push(a(f)+"scale(",null,",",null,")");y.push({i:b-4,x:ln(d,m)},{i:b-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,b=p.length,g;++y<b;)m[(g=p[y]).i]=g.x(f);return m.join("")}}}var t1=bm(QE,"px, ","px)","deg)"),n1=bm(e1,", ",")",")"),o1=1e-12;function _m(e){return((e=Math.exp(e))+1/e)/2}function i1(e){return((e=Math.exp(e))-1/e)/2}function a1(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,b=f*f+y*y,g,_;if(b<o1)_=Math.log(p/d)/n,g=function(A){return[s+A*f,c+A*y,d*Math.exp(n*A*_)]};else{var k=Math.sqrt(b),h=(p*p-d*d+i*b)/(2*d*o*k),E=(p*p-d*d-i*b)/(2*p*o*k),N=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(E*E+1)-E);_=(C-N)/n,g=function(A){var B=A*_,$=_m(N),x=d/(o*k)*($*a1(n*B+N)-i1(N));return[s+x*f,c+x*y,d*$/_m(n*B+N)]}}return g.duration=_*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 Fo=0,ki=0,Ei=0,km=1e3,Oa,Ni,La=0,oo=0,Pa=0,wi=typeof performance=="object"&&performance.now?performance:Date,Em=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kl(){return oo||(Em(r1),oo=wi.now()+Pa)}function r1(){oo=0}function za(){this._call=this._time=this._next=null}za.prototype=Nm.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 Nm(e,n,o){var i=new za;return i.restart(e,n,o),i}function l1(){Kl(),++Fo;for(var e=Oa,n;e;)(n=oo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Fo}function wm(){oo=(La=wi.now())+Pa,Fo=ki=0;try{l1()}finally{Fo=0,c1(),oo=0}}function s1(){var e=wi.now(),n=e-La;n>km&&(Pa-=n,La=e)}function c1(){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(!Fo){ki&&(ki=clearTimeout(ki));var n=e-oo;n>24?(e<1/0&&(ki=setTimeout(wm,e-wi.now()-Pa)),Ei&&(Ei=clearInterval(Ei))):(Ei||(La=wi.now(),Ei=setInterval(s1,km)),Fo=1,Em(wm))}}function Im(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 d1=va("start","end","cancel","interrupt"),u1=[],vm=0,Cm=1,Yl=2,Fa=3,Sm=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;m1(e,o,{name:n,index:i,group:a,on:d1,tween:u1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:vm})}function Wl(e,n){var o=Gt(e,n);if(o.state>vm)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 m1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Nm(r,0,o.time);function r(d){o.state=Cm,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!==Cm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Fa)return Im(l);f.state===Sm?(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(Im(function(){o.state===Fa&&(o.state=Sm,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 f1(e){return this.each(function(){ja(this,e)})}function p1(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 h1(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 y1(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?p1:h1)(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 xm(e,n){var o;return(typeof n=="number"?ln:n instanceof eo?Va:(o=eo(n))?(n=o,Va):hm)(e,n)}function g1(e){return function(){this.removeAttribute(e)}}function b1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _1(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 k1(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 E1(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 N1(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 w1(e,n){var o=Sa(e),i=o==="transform"?n1:xm;return this.attrTween(e,typeof n=="function"?(o.local?N1:E1)(o,i,Jl(this,"attr."+e,n)):n==null?(o.local?b1:g1)(o):(o.local?k1:_1)(o,i,n))}function I1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function v1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function C1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&v1(e,r)),o}return a._value=n,a}function S1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&I1(e,r)),o}return a._value=n,a}function x1(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?C1:S1)(i,n))}function R1(e,n){return function(){Wl(this,e).delay=+n.apply(this,arguments)}}function A1(e,n){return n=+n,function(){Wl(this,e).delay=n}}function $1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?R1:A1)(n,e)):Gt(this.node(),n).delay}function T1(e,n){return function(){sn(this,e).duration=+n.apply(this,arguments)}}function M1(e,n){return n=+n,function(){sn(this,e).duration=n}}function V1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?T1:M1)(n,e)):Gt(this.node(),n).duration}function B1(e,n){if(typeof n!="function")throw new Error;return function(){sn(this,e).ease=n}}function D1(e){var n=this._id;return arguments.length?this.each(B1(n,e)):Gt(this.node(),n).ease}function O1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;sn(this,e).ease=o}}function L1(e){if(typeof e!="function")throw new Error;return this.each(O1(this._id,e))}function P1(e){typeof e!="function"&&(e=Gu(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 z1(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 F1(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 U1(e,n,o){var i,a,r=F1(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 H1(e,n){var o=this._id;return arguments.length<2?Gt(this.node(),o).on.on(e):this.each(U1(o,e,n))}function j1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function K1(){return this.on("end.remove",j1(this._id))}function G1(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 Y1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Ku(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),b=0,g=p.length;b<g;++b)(f=p[b])&&Ha(f,n,o,b,p,y);r.push(p),l.push(u)}return new bn(r,l,n,o)}var q1=pi.prototype.constructor;function W1(){return new q1(this._groups,this._parents)}function J1(e,n){var o,i,a;return function(){var r=Lo(this,e),l=(this.style.removeProperty(e),Lo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Rm(e){return function(){this.style.removeProperty(e)}}function X1(e,n,o){var i,a=o+"",r;return function(){var l=Lo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function Z1(e,n,o){var i,a,r;return function(){var l=Lo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Lo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function Q1(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=Rm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function e0(e,n,o){var i=(e+="")=="transform"?t1:xm;return n==null?this.styleTween(e,J1(e,i)).on("end.style."+e,Rm(e)):typeof n=="function"?this.styleTween(e,Z1(e,i,Jl(this,"style."+e,n))).each(Q1(this._id,e)):this.styleTween(e,X1(e,i,n),o).on("end.style."+e,null)}function t0(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function n0(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&t0(e,l,o)),i}return r._value=n,r}function o0(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,n0(e,n,o??""))}function i0(e){return function(){this.textContent=e}}function a0(e){return function(){var n=e(this);this.textContent=n??""}}function r0(e){return this.tween("text",typeof e=="function"?a0(Jl(this,"text",e)):i0(e==null?"":e+""))}function l0(e){return function(n){this.textContent=e.call(this,n)}}function s0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&l0(a)),n}return i._value=e,i}function c0(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,s0(e))}function d0(){for(var e=this._name,n=this._id,o=Am(),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 u0(){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 m0=0;function bn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Am(){return++m0}var _n=pi.prototype;bn.prototype={constructor:bn,select:G1,selectAll:Y1,selectChild:_n.selectChild,selectChildren:_n.selectChildren,filter:P1,merge:z1,selection:W1,transition:d0,call:_n.call,nodes:_n.nodes,node:_n.node,size:_n.size,empty:_n.empty,each:_n.each,on:H1,attr:w1,attrTween:x1,style:e0,styleTween:o0,text:r0,textTween:c0,remove:K1,tween:y1,delay:$1,duration:V1,ease:D1,easeVarying:L1,end:u0,[Symbol.iterator]:_n[Symbol.iterator]};function f0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var p0={time:null,delay:0,duration:250,ease:f0};function h0(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 y0(e){var n,o;e instanceof bn?(n=e._id,e=e._name):(n=Am(),(o=p0).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||h0(c,n));return new bn(i,this._parents,e,n)}pi.prototype.interrupt=f1,pi.prototype.transition=y0;const Ka=e=>()=>e;function g0(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 Uo=new kn(1,0,0);kn.prototype;function Xl(e){e.stopImmediatePropagation()}function Ii(e){e.preventDefault(),e.stopImmediatePropagation()}function b0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _0(){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 $m(){return this.__zoom||Uo}function k0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function E0(){return navigator.maxTouchPoints||"ontouchstart"in this}function N0(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 w0(){var e=b0,n=_0,o=N0,i=k0,a=E0,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,b=0,g=10;function _(w){w.property("__zoom",$m).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",x).filter(a).on("touchstart.zoom",S).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,v,I,L){var M=w.selection?w.selection():w;M.property("__zoom",$m),w!==M?N(w,v,I,L):M.interrupt().each(function(){C(this,arguments).event(L).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},_.scaleBy=function(w,v,I,L){_.scaleTo(w,function(){var M=this.__zoom.k,V=typeof v=="function"?v.apply(this,arguments):v;return M*V},I,L)},_.scaleTo=function(w,v,I,L){_.transform(w,function(){var M=n.apply(this,arguments),V=this.__zoom,U=I==null?E(M):typeof I=="function"?I.apply(this,arguments):I,oe=V.invert(U),ue=typeof v=="function"?v.apply(this,arguments):v;return o(h(k(V,ue),U,oe),M,l)},I,L)},_.translateBy=function(w,v,I,L){_.transform(w,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,L)},_.translateTo=function(w,v,I,L,M){_.transform(w,function(){var V=n.apply(this,arguments),U=this.__zoom,oe=L==null?E(V):typeof L=="function"?L.apply(this,arguments):L;return o(Uo.translate(oe[0],oe[1]).scale(U.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof I=="function"?-I.apply(this,arguments):-I),V,l)},L,M)};function k(w,v){return v=Math.max(r[0],Math.min(r[1],v)),v===w.k?w:new kn(v,w.x,w.y)}function h(w,v,I){var L=v[0]-I[0]*w.k,M=v[1]-I[1]*w.k;return L===w.x&&M===w.y?w:new kn(w.k,L,M)}function E(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function N(w,v,I,L){w.on("start.zoom",function(){C(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,V=arguments,U=C(M,V).event(L),oe=n.apply(M,V),ue=I==null?E(oe):typeof I=="function"?I.apply(M,V):I,be=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),pe=M.__zoom,he=typeof v=="function"?v.apply(M,V):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)}U.zoom(null,ye)}})}function C(w,v,I){return!I&&w.__zooming||new A(w,v)}function A(w,v){this.that=w,this.args=v,this.active=0,this.sourceEvent=null,this.extent=n.apply(w,v),this.taps=0}A.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,v){return this.mouse&&w!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&w!=="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(w){var v=jt(this.that).datum();d.call(w,this.that,new g0(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),v)}};function B(w,...v){if(!e.apply(this,arguments))return;var I=C(this,v).event(w),L=this.__zoom,M=Math.max(r[0],Math.min(r[1],L.k*Math.pow(2,i.apply(this,arguments)))),V=an(w);if(I.wheel)(I.mouse[0][0]!==V[0]||I.mouse[0][1]!==V[1])&&(I.mouse[1]=L.invert(I.mouse[0]=V)),clearTimeout(I.wheel);else{if(L.k===M)return;I.mouse=[V,L.invert(V)],ja(this),I.start()}Ii(w),I.wheel=setTimeout(U,y),I.zoom("mouse",o(h(k(L,M),I.mouse[0],I.mouse[1]),I.extent,l));function U(){I.wheel=null,I.end()}}function $(w,...v){if(p||!e.apply(this,arguments))return;var I=w.currentTarget,L=C(this,v,!0).event(w),M=jt(w.view).on("mousemove.zoom",ue,!0).on("mouseup.zoom",be,!0),V=an(w,I),U=w.clientX,oe=w.clientY;nm(w.view),Xl(w),L.mouse=[V,this.__zoom.invert(V)],ja(this),L.start();function ue(pe){if(Ii(pe),!L.moved){var he=pe.clientX-U,_e=pe.clientY-oe;L.moved=he*he+_e*_e>b}L.event(pe).zoom("mouse",o(h(L.that.__zoom,L.mouse[0]=an(pe,I),L.mouse[1]),L.extent,l))}function be(pe){M.on("mousemove.zoom mouseup.zoom",null),om(pe.view,L.moved),Ii(pe),L.event(pe).end()}}function x(w,...v){if(e.apply(this,arguments)){var I=this.__zoom,L=an(w.changedTouches?w.changedTouches[0]:w,this),M=I.invert(L),V=I.k*(w.shiftKey?.5:2),U=o(h(k(I,V),L,M),n.apply(this,v),l);Ii(w),s>0?jt(this).transition().duration(s).call(N,U,L,w):jt(this).call(_.transform,U,L,w)}}function S(w,...v){if(e.apply(this,arguments)){var I=w.touches,L=I.length,M=C(this,v,w.changedTouches.length===L).event(w),V,U,oe,ue;for(Xl(w),U=0;U<L;++U)oe=I[U],ue=an(oe,this),ue=[ue,this.__zoom.invert(ue),oe.identifier],M.touch0?!M.touch1&&M.touch0[2]!==ue[2]&&(M.touch1=ue,M.taps=0):(M.touch0=ue,V=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),V&&(M.taps<2&&(m=ue[0],u=setTimeout(function(){u=null},f)),ja(this),M.start())}}function T(w,...v){if(this.__zooming){var I=C(this,v).event(w),L=w.changedTouches,M=L.length,V,U,oe,ue;for(Ii(w),V=0;V<M;++V)U=L[V],oe=an(U,this),I.touch0&&I.touch0[2]===U.identifier?I.touch0[0]=oe:I.touch1&&I.touch1[2]===U.identifier&&(I.touch1[0]=oe);if(U=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;U=k(U,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(U,oe,ue),I.extent,l))}}function R(w,...v){if(this.__zooming){var I=C(this,v).event(w),L=w.changedTouches,M=L.length,V,U;for(Xl(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),V=0;V<M;++V)U=L[V],I.touch0&&I.touch0[2]===U.identifier?delete I.touch0:I.touch1&&I.touch1[2]===U.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&&(U=an(U,this),Math.hypot(m[0]-U[0],m[1]-U[1])<g)){var oe=jt(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Ka(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ka(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Ka(!!w),_):a},_.extent=function(w){return arguments.length?(n=typeof w=="function"?w:Ka([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):n},_.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],_):[r[0],r[1]]},_.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,_):Math.sqrt(b)},_.tapDistance=function(w){return arguments.length?(g=+w,_):g},_}var 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||{}),Tm=(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))(Tm||{});const I0=["INPUT","SELECT","TEXTAREA"],v0=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 I0.includes(i==null?void 0:i.nodeName)||a||!!r}function C0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Mm(e,n,o,i){const a=n.replace("+",`
28
28
  `).replace(`
29
29
 
30
30
  `,`
31
31
  +`).split(`
32
- `).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===n.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function C0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=S0(o.code,e);return Array.isArray(e)?e.some(a=>Mm(o[i],a,n,o.type==="keyup")):Mm(o[i],e,n,o.type==="keyup")}}function S0(e,n){return n.includes(e)?"code":"key"}function Ci(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??I0),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}),zu(["blur","contextmenu"],s),Fu((...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=v0(d),(!a||a&&!p)&&es(d))return;const b=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,g=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!f&&(a||!g)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Fu((...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"?C0(d,r):d}return i}const Vm="vue-flow__node-desc",Bm="vue-flow__edge-desc",x0="vue-flow__aria-live",Dm=["Enter"," ","Escape"],Ho={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 Om(e,n){return{x:ao(e.x,n[0][0],n[1][0]),y:ao(e.y,n[0][1],n[1][1])}}function Lm(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 R0(e){return Wa(e.width)&&Wa(e.height)&&Wa(e.x)&&Wa(e.y)}function A0(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 Pm(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 zm(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 $0(...e){if(e.length===3){const[r,l,s]=e;return zm(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 T0(...e){if(e.length===3){const[r,l,s]=e;return zm(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 Fm({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function M0(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 Um(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 Hm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function V0(e,n){return Hm(Um(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=Um(n,Ja({...i.computedPosition,...i.dimensions}))}return Hm(n)}function jm(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,b=i&&f>0,g=(m??0)*(p??0);(y||b||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 jo(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 B0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=jo(e,o),a=jo(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=jo(e.top??e.y??0,o),a=jo(e.bottom??e.y??0,o),r=jo(e.left??e.x??0,n),l=jo(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 D0(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 Km(e,n,o,i,a,r=.1){const l=B0(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,b=D0(e,f,y,u,n,o),g={left:Math.min(b.left-l.left,0),top:Math.min(b.top-l.top,0),right:Math.min(b.right-l.right,0),bottom:Math.min(b.bottom-l.bottom,0)};return{x:f-g.left+g.right,y:y-g.top+g.bottom,zoom:u}}function O0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Gm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Gm(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 Ym(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 qm(e,n,o=15,i=40){const a=Ym(e.x,i,n.width-i)*o,r=Ym(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 Wm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(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 Jm(e){return{item:e,type:"add"}}function Xm(e){return{id:e,type:"remove"}}function Zm(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 Qm=()=>{};function Me(e){const n=new Set;let o=Qm,i=()=>!1;const a=()=>n.size>0||i(),r=p=>{o=p},l=()=>{o=Qm},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 ef(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 L0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Gm(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 tf(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 P0(e,n,o){const[i,a,r,l]=typeof e!="string"?tf(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 z0(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=P0(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]=tf(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 F0({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=F0(e.dimensions,z0(e,o,i,a)),l=Om(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 Ko(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??K0(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 nf(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function U0({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 H0(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 of={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 S0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=x0(o.code,e);return Array.isArray(e)?e.some(a=>Mm(o[i],a,n,o.type==="keyup")):Mm(o[i],e,n,o.type==="keyup")}}function x0(e,n){return n.includes(e)?"code":"key"}function Ci(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??v0),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}),zu(["blur","contextmenu"],s),Fu((...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=C0(d),(!a||a&&!p)&&es(d))return;const b=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,g=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!f&&(a||!g)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Fu((...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"?S0(d,r):d}return i}const Vm="vue-flow__node-desc",Bm="vue-flow__edge-desc",R0="vue-flow__aria-live",Dm=["Enter"," ","Escape"],Ho={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 Om(e,n){return{x:ao(e.x,n[0][0],n[1][0]),y:ao(e.y,n[0][1],n[1][1])}}function Lm(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 A0(e){return Wa(e.width)&&Wa(e.height)&&Wa(e.x)&&Wa(e.y)}function $0(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 Pm(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 zm(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 T0(...e){if(e.length===3){const[r,l,s]=e;return zm(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 M0(...e){if(e.length===3){const[r,l,s]=e;return zm(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 Fm({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function V0(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 Um(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 Hm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function B0(e,n){return Hm(Um(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=Um(n,Ja({...i.computedPosition,...i.dimensions}))}return Hm(n)}function jm(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,b=i&&f>0,g=(m??0)*(p??0);(y||b||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 jo(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 D0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=jo(e,o),a=jo(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=jo(e.top??e.y??0,o),a=jo(e.bottom??e.y??0,o),r=jo(e.left??e.x??0,n),l=jo(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 O0(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 Km(e,n,o,i,a,r=.1){const l=D0(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,b=O0(e,f,y,u,n,o),g={left:Math.min(b.left-l.left,0),top:Math.min(b.top-l.top,0),right:Math.min(b.right-l.right,0),bottom:Math.min(b.bottom-l.bottom,0)};return{x:f-g.left+g.right,y:y-g.top+g.bottom,zoom:u}}function L0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Gm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Gm(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 Ym(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 qm(e,n,o=15,i=40){const a=Ym(e.x,i,n.width-i)*o,r=Ym(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 Wm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(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 Jm(e){return{item:e,type:"add"}}function Xm(e){return{id:e,type:"remove"}}function Zm(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 Qm=()=>{};function Me(e){const n=new Set;let o=Qm,i=()=>!1;const a=()=>n.size>0||i(),r=p=>{o=p},l=()=>{o=Qm},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 ef(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 P0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Gm(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 tf(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 z0(e,n,o){const[i,a,r,l]=typeof e!="string"?tf(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 F0(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=z0(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]=tf(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 U0({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=U0(e.dimensions,F0(e,o,i,a)),l=Om(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 Ko(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??G0(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 nf(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function H0({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 j0(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 of={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,7 +49,7 @@ 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 kt extends Error{constructor(n,...o){var i;super((i=of[n])==null?void 0:i.call(of,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function rs(e){return"clientX"in e}function j0(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 K0(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 G0=()=>!0;function ls(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Y0(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 q0=250;function W0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=Y0(e,o,n+q0);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}=Ko(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 af(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=G0},u,m,p,f){const y=r==="target",b=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:g,y:_}=cn(e),k=l.elementFromPoint(g,_),h=k!=null&&k.classList.contains(`${s}-flow__handle`)?k:b,E={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const N=rf(void 0,h),C=h.getAttribute("data-nodeid"),A=h.getAttribute("data-handleid"),B=h.classList.contains("connectable"),$=h.classList.contains("connectableend");if(!C||!N)return E;const x={source:y?C:i,sourceHandle:y?A:a,target:y?i:C,targetHandle:y?a:A};E.connection=x;const T=B&&$&&(o===En.Strict?y&&N==="source"||!y&&N==="target":C!==i||A!==a);E.isValid=T&&d(x,{nodes:m,edges:u,sourceNode:p(x.source),targetNode:p(x.target)}),E.toHandle=lf(C,N,A,f,o,!0)}return E}function rf(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 X0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function lf(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,...Ko(d,m,m.position,!0)}:m}const ss={[De.Left]:De.Right,[De.Right]:De.Left,[De.Top]:De.Bottom,[De.Bottom]:De.Top},Z0=["production","prod"];function Ti(e,...n){sf()&&console.warn(`[Vue Flow]: ${e}`,...n)}function sf(){return!Z0.includes(process.env.NODE_ENV||"")}function cf(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 Q0(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:Fm(e)},a=Pm(a,void 0,i),M0(a,n)?!1:a}function eN(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?Fm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function df(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=A0(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 uf(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}`;uf("source",c,u,e,a,l),uf("target",c,d,e,r,s)}}function mf(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:Q0(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({...Pm(u,f,r),sourceNode:m,targetNode:p})}return c}const ff=Symbol("vueFlow"),pf=Symbol("nodeId"),hf=Symbol("nodeRef"),tN=Symbol("edgeId"),nN=Symbol("edgeRef"),Za=Symbol("slots");function yf(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:b,selectNodesOnDrag:g,removeSelectedElements:_,addSelectedNodes:k,updateNodePositions:h,emits:E}=et(),{onStart:N,onDrag:C,onStop:A,onClick:B,el:$,disabled:x,id:S,selectable:T,dragHandle:R}=e,w=t.shallowRef(!1);let v=[],I,L=null,M={x:void 0,y:void 0},V={x:0,y:0},U=null,oe=!1,ue=!1,be=0,pe=!1;const he=aN(),_e=({x:ae,y:me})=>{M={x:ae,y:me};let P=!1;if(v=v.map(O=>{const z={x:ae-O.distance.x,y:me-O.distance.y},{computedPosition:Q}=as(O,o.value?Xa(z,i.value):z,E.error,l.value,O.parentNode?f(O.parentNode):void 0);return P=P||O.position.x!==Q.x||O.position.y!==Q.y,O.position=Q,O}),ue=ue||P,!!P&&(h(v,!0,!0),w.value=!0,U)){const[O,z]=is({id:S,dragItems:v,findNode:f});C({event:U,node:O,nodes:z})}},ye=()=>{if(!L)return;const[ae,me]=qm(V,L,u.value);if(ae!==0||me!==0){const P={x:(M.x??0)-ae/c.value.zoom,y:(M.y??0)-me/c.value.zoom};p({x:ae,y:me})&&_e(P)}be=requestAnimationFrame(ye)},Ae=(ae,me)=>{oe=!0;const P=f(S);!g.value&&!y.value&&P&&(P.selected||_()),P&&t.toValue(T)&&g.value&&cs(P,y.value,k,_,b,!1,me);const O=he(ae.sourceEvent);if(M=O,v=L0(r.value,m.value,O,S),v.length){const[z,Q]=is({id:S,dragItems:v,findNode:f});N({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),M=he(ae.sourceEvent),L=((P=n.value)==null?void 0:P.getBoundingClientRect())||null,V=cn(ae.sourceEvent,L))},se=(ae,me)=>{const P=he(ae.sourceEvent);if(!pe&&oe&&d.value&&(pe=!0,ye()),!oe){const O=P.xSnapped-(M.x??0),z=P.ySnapped-(M.y??0);Math.sqrt(O*O+z*z)>s.value&&Ae(ae,me)}(M.x!==P.xSnapped||M.y!==P.ySnapped)&&v.length&&oe&&(U=ae.sourceEvent,V=cn(ae.sourceEvent,L),_e(P))},ne=ae=>{let me=!1;if(!oe&&!w.value&&!y.value){const P=ae.sourceEvent,O=he(P),z=O.xSnapped-(M.x??0),Q=O.ySnapped-(M.y??0),ee=Math.sqrt(z*z+Q*Q);ee!==0&&ee<=s.value&&(B==null||B(P),me=!0)}if(v.length&&!me){ue&&(h(v,!1,!1),ue=!1);const[P,O]=is({id:S,dragItems:v,findNode:f});A({event:ae.sourceEvent,node:P,nodes:O})}v=[],w.value=!1,pe=!1,oe=!1,M={x:void 0,y:void 0},cancelAnimationFrame(be)};return t.watch([()=>t.toValue(x),$],([ae,me],P,O)=>{if(me){const z=jt(me);ae||(I=RE().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(R);return!Q.button&&(!a.value||!ef(ee,`.${a.value}`,me)&&(!we||ef(ee,we,me)))}),z.call(I)),O(()=>{z.on(".drag",null),I&&(I.on("start",null),I.on("drag",null),I.on("end",null))})}}),w}function oN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),updateStart:Me(),update:Me(),updateEnd:Me()}}function iN(e,n){const o=oN();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 aN(){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=j0(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 gf({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:b,findNode:g,panBy:_,startConnection:k,updateConnection:h,endConnection:E,emits:N,viewport:C,edges:A,nodes:B,isValidConnection:$,nodeLookup:x}=et();let S=null,T=!1,R=null;function w(I){var L;const M=t.toValue(o)==="target",V=rs(I),U=Lm(I.target),oe=I.currentTarget;if(oe&&(V&&I.button===0||!V)){let ue=function(Ce){P=cn(Ce,ne),_e=W0(Ri(P,C.value,!1,[1,1]),u.value,x.value,Q),O||(z(),O=!0);const Y=af(Ce,{handle:_e,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:M?"target":"source",isValidConnection:he,doc:U,lib:"vue",flowId:s,nodeLookup:x.value},A.value,B.value,g,x.value);R=Y.handleDomNode,S=Y.connection,T=X0(!!_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?x.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,J0(!!q,T)),xe=X,!_e&&!T&&!R)return ls(me);S&&S.source!==S.target&&R&&(ls(me),me=R,R.classList.add("connecting","vue-flow__handle-connecting"),R.classList.toggle("valid",!!T),R.classList.toggle("vue-flow__handle-valid",!!T))},be=function(Ce){"touches"in Ce&&Ce.touches.length>0||((_e||R)&&S&&T&&(r?r(Ce,S):N.connect(S)),N.connectEnd(Ce),a&&(l==null||l(Ce)),ls(me),cancelAnimationFrame(ye),E(Ce),O=!1,T=!1,S=null,R=null,U.removeEventListener("mousemove",ue),U.removeEventListener("mouseup",be),U.removeEventListener("touchmove",ue),U.removeEventListener("touchend",be))};const pe=g(t.toValue(n));let he=t.toValue(i)||$.value||Qa;!he&&pe&&(he=(M?pe.isValidSourcePos:pe.isValidTargetPos)||Qa);let _e,ye=0;const{x:Ae,y:Fe}=cn(I),se=rf(t.toValue(a),oe),ne=(L=c.value)==null?void 0:L.getBoundingClientRect();if(!ne||!se)return;const ae=lf(t.toValue(n),se,t.toValue(e),x.value,d.value);if(!ae)return;let me,P=cn(I,ne),O=!1;const z=()=>{if(!y.value)return;const[Ce,Y]=qm(P,ne,b.value);_({x:Ce,y:Y}),ye=requestAnimationFrame(z)},Q={...ae,nodeId:t.toValue(n),type:se,position:ae.position},ee=x.value.get(t.toValue(n)),de={inProgress:!0,isValid:null,from:Ko(ee,Q,De.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ee,to:P,toHandle:null,toPosition:ss[Q.position],toNode:null};k({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}),N.connectStart({event:I,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:se});let xe=de;U.addEventListener("mousemove",ue),U.addEventListener("mouseup",be),U.addEventListener("touchmove",ue),U.addEventListener("touchend",be)}}function v(I){var L,M;if(!m.value)return;const V=t.toValue(o)==="target";if(!p.value){N.clickConnectStart({event:I,nodeId:t.toValue(n),handleId:t.toValue(e)}),k({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:De.Top,...cn(I)},void 0,!0);return}let U=t.toValue(i)||$.value||Qa;const oe=g(t.toValue(n));if(!U&&oe&&(U=(V?oe.isValidSourcePos:oe.isValidTargetPos)||Qa),oe&&(typeof oe.connectable>"u"?f.value:oe.connectable)===!1)return;const ue=Lm(I.target),be=af(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:U,doc:ue,lib:"vue",flowId:s,nodeLookup:x.value},A.value,B.value,g,x.value),pe=((L=be.connection)==null?void 0:L.source)===((M=be.connection)==null?void 0:M.target);be.isValid&&be.connection&&!pe&&N.connect(be.connection),N.clickConnectEnd(I),E(I,!0)}return{handlePointerDown:w,handleClick:v}}function rN(){return t.inject(pf,"")}function bf(e){const n=e??rN()??"",o=t.inject(hf,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 lN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),dragStart:Me(),drag:Me(),dragStop:Me()}}function sN(e,n){const o=lN();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 _f(){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,b=[];for(const g of e.value)if(g.draggable||l&&typeof g.draggable>"u"){const _={x:g.computedPosition.x+f,y:g.computedPosition.y+y},{position:k}=as(g,_,s.error,n.value,g.parentNode?i(g.parentNode):void 0);b.push({id:g.id,position:k,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(b,!0,!1)}}const er=.1,cN=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 dN={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 uN(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}=Om({x:-i,y:-a},e.translateExtent),m=Uo.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}=Km(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}=Km(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}}}:dN)}function ms(e,n=0,o=cN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function mN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,g,_=!!(o.nodes.value.length||o.edges.value.length);b=Oo([e.modelValue,()=>{var k,h;return(h=(k=e.modelValue)==null?void 0:k.value)==null?void 0:h.length}],([k])=>{k&&Array.isArray(k)&&(g==null||g.pause(),o.setElements(k),!g&&!_&&k.length?_=!0:g==null||g.resume())}),g=Oo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([k,h])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...k,...h],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let b,g,_=!!o.nodes.value.length;b=Oo([e.nodes,()=>{var k,h;return(h=(k=e.nodes)==null?void 0:k.value)==null?void 0:h.length}],([k])=>{k&&Array.isArray(k)&&(g==null||g.pause(),o.setNodes(k),!g&&!_&&k.length?_=!0:g==null||g.resume())}),g=Oo([o.nodes,()=>o.nodes.value.length],([k])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let b,g,_=!!o.edges.value.length;b=Oo([e.edges,()=>{var k,h;return(h=(k=e.edges)==null?void 0:k.value)==null?void 0:h.length}],([k])=>{k&&Array.isArray(k)&&(g==null||g.pause(),o.setEdges(k),!g&&!_&&k.length?_=!0:g==null||g.resume())}),g=Oo([o.edges,()=>o.edges.value.length],([k])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&gt(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&gt(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&gt(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&gt(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 b=async g=>{let _=g;typeof n.autoConnect=="function"&&(_=await n.autoConnect(g)),_!==!1&&o.addEdges([_])};t.watch(()=>n.autoConnect,()=>{gt(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(g,_,k)=>{g?o.onConnect(b):o.hooks.value.connect.off(b),k(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},f=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(n)){const _=g;if(!b.includes(_)){const k=t.toRef(()=>n[_]),h=o[_];t.isRef(h)&&i.run(()=>{t.watch(k,E=>{gt(E)&&(h.value=E)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function fN(){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 pN(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=hN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function hN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function kf(){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:fN(),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 yN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function gN(e,n,o){const i=uN(e),a=P=>{const O=P??[];e.hooks.updateNodeInternals.trigger(O)},r=P=>T0(P,e.nodes,e.edges),l=P=>$0(P,e.nodes,e.edges),s=P=>lo(P,e.edges),c=({id:P,type:O,nodeId:z})=>{var Q;const ee=P?`-${O}-${P}`:`-${O}`;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,O,z)=>{var Q,ee;const we=[];for(const de of P){const xe={id:de.id,type:"position",dragging:z,from:de.from};if(O&&(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 O=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!O)return;const z=window.getComputedStyle(O),{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=cf("source",de.nodeElement,X,Q,xe.id),xe.handleBounds.target=cf("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,O)=>{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,O));for(const de of Q)we.push(On(de,O))}ee.length&&e.hooks.nodesChange.trigger(ee),we.length&&e.hooks.edgesChange.trigger(we)},y=P=>{if(e.multiSelectionActive){const O=P.map(z=>On(z.id,!0));e.hooks.nodesChange.trigger(O);return}e.hooks.nodesChange.trigger(Ln(n.value,new Set(P.map(O=>O.id)),!0)),e.hooks.edgesChange.trigger(Ln(o.value))},b=P=>{if(e.multiSelectionActive){const O=P.map(z=>On(z.id,!0));e.hooks.edgesChange.trigger(O);return}e.hooks.edgesChange.trigger(Ln(o.value,new Set(P.map(O=>O.id)))),e.hooks.nodesChange.trigger(Ln(n.value,new Set,!0))},g=P=>{f(P,!0)},_=P=>{const z=(P||e.nodes).map(Q=>(Q.selected=!1,On(Q.id,!1)));e.hooks.nodesChange.trigger(z)},k=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 O=P.reduce((z,Q)=>{const ee=On(Q.id,!1);return ro(Q)?z.nodes.push(ee):z.edges.push(ee),z},{nodes:[],edges:[]});O.nodes.length&&e.hooks.nodesChange.trigger(O.nodes),O.edges.length&&e.hooks.edgesChange.trigger(O.edges)},E=P=>{var O;(O=e.d3Zoom)==null||O.scaleExtent([P,e.maxZoom]),e.minZoom=P},N=P=>{var O;(O=e.d3Zoom)==null||O.scaleExtent([e.minZoom,P]),e.maxZoom=P},C=P=>{var O;(O=e.d3Zoom)==null||O.translateExtent(P),e.translateExtent=P},A=P=>{e.nodeExtent=P,a()},B=P=>{var O;(O=e.d3Zoom)==null||O.clickDistance(P)},$=P=>{e.nodesDraggable=P,e.nodesConnectable=P,e.elementsSelectable=P},x=P=>{const O=P instanceof Function?P(e.nodes):P;!e.initialized&&!O.length||(e.nodes=df(O,d,e.hooks.error.trigger))},S=P=>{const O=P instanceof Function?P(e.edges):P;if(!e.initialized&&!O.length)return;const z=us(O,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 O=P instanceof Function?P([...e.nodes,...e.edges]):P;!e.initialized&&!O.length||(x(O.filter(ro)),S(O.filter(Dn)))},R=P=>{let O=P instanceof Function?P(e.nodes):P;O=Array.isArray(O)?O:[O];const z=df(O,d,e.hooks.error.trigger),Q=[];for(const ee of z)Q.push(Jm(ee));Q.length&&e.hooks.nodesChange.trigger(Q)},w=P=>{let O=P instanceof Function?P(e.edges):P;O=Array.isArray(O)?O:[O];const z=us(O,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const ee of z)Q.push(Jm(ee));Q.length&&e.hooks.edgesChange.trigger(Q)},v=(P,O=!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(Zm(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(Xm(q.id));O&&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(Xm(X.id)),O&&xe([X]),z&&Ce(X.id)))}de.length&&e.hooks.edgesChange.trigger(de),we.length&&e.hooks.nodesChange.trigger(we)},I=P=>{const O=P instanceof Function?P(e.edges):P,z=Array.isArray(O)?O:[O],Q=[];for(const ee of z){const we=typeof ee=="string"?u(ee):ee;we&&(gt(we.deletable)&&!we.deletable||Q.push(Zm(typeof ee=="string"?ee:ee.id,we.source,we.target,we.sourceHandle,we.targetHandle)))}e.hooks.edgesChange.trigger(Q)},L=(P,O,z=!0)=>{const Q=u(P.id);if(!Q)return!1;const ee=e.edges.indexOf(Q),we=eN(P,O,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},M=(P,O,z={replace:!1})=>{const Q=u(P);if(!Q)return;const ee=typeof O=="function"?O(Q):O;Q.data=z.replace?ee:{...Q.data,...ee}},V=P=>Wm(P,e.nodes),U=P=>{const O=Wm(P,e.edges);return ds(e.connectionLookup,o.value,O),O},oe=(P,O,z={replace:!1})=>{const Q=d(P);if(!Q)return;const ee=typeof O=="function"?O(Q):O;z.replace?e.nodes.splice(e.nodes.indexOf(Q),1,ee):Object.assign(Q,ee)},ue=(P,O,z={replace:!1})=>{const Q=d(P);if(!Q)return;const ee=typeof O=="function"?O(Q):O;Q.data=z.replace?ee:{...Q.data,...ee}},be=(P,O,z=!1)=>{z?e.connectionClickStartHandle=P:e.connectionStartHandle=P,e.connectionEndHandle=null,e.connectionStatus=null,O&&(e.connectionPosition=O)},pe=(P,O=null,z=null)=>{e.connectionStartHandle&&(e.connectionPosition=P,e.connectionEndHandle=O,e.connectionStatus=z)},he=(P,O)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,O?e.connectionClickStartHandle=null:e.connectionStartHandle=null},_e=P=>{const O=R0(P),z=O?null:Si(P)?P:d(P.id);return!O&&!z?[null,null,O]:[O?P:Ga(z),z,O]},ye=(P,O=!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);(O&&Y>0||Y>=Ce.width*Ce.height||Y>=Number(Q.width)*Number(Q.height))&&de.push(xe)}return de},Ae=(P,O,z=!0)=>{const[Q]=_e(P);if(!Q)return!1;const ee=Ya(Q,O);return z&&ee>0||ee>=Number(Q.width)*Number(Q.height)},Fe=P=>{const{viewport:O,dimensions:z,d3Zoom:Q,d3Selection:ee,translateExtent:we}=e;if(!Q||!ee||!P.x&&!P.y)return!1;const de=Uo.translate(O.x+P.x,O.y+P.y).scale(O.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 O=P instanceof Function?P(e):P,z=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];gt(O.defaultEdgeOptions)&&(e.defaultEdgeOptions=O.defaultEdgeOptions);const Q=O.modelValue||O.nodes||O.edges?[]:void 0;Q&&(O.modelValue&&Q.push(...O.modelValue),O.nodes&&Q.push(...O.nodes),O.edges&&Q.push(...O.edges),T(Q));const ee=()=>{gt(O.maxZoom)&&N(O.maxZoom),gt(O.minZoom)&&E(O.minZoom),gt(O.translateExtent)&&C(O.translateExtent)};for(const we of Object.keys(O)){const de=we,xe=O[de];![...yN,...z].includes(de)&&gt(xe)&&(e[de]=xe)}$l(()=>e.d3Zoom).not.toBeNull().then(ee),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:T,setNodes:x,setEdges:S,addNodes:R,addEdges:w,removeNodes:v,removeEdges:I,findNode:d,findEdge:u,updateEdge:L,updateEdgeData:M,updateNode:oe,updateNodeData:ue,applyEdgeChanges:U,applyNodeChanges:V,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:E,setMaxZoom:N,setTranslateExtent:C,setNodeExtent:A,setPaneClickDistance:B,removeSelectedElements:h,removeSelectedNodes:_,removeSelectedEdges:k,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,O)=>i.value.zoomTo(P,O),setViewport:(P,O)=>i.value.setViewport(P,O),setTransform:(P,O)=>i.value.setTransform(P,O),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(P,O,z)=>i.value.setCenter(P,O,z),fitBounds:(P,O)=>i.value.fitBounds(P,O),project:P=>i.value.project(P),screenToFlowCoordinate:P=>i.value.screenToFlowCoordinate(P),flowToScreenCoordinate:P=>i.value.flowToScreenCoordinate(P),toObject:()=>{const P=[],O=[];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;O.push(xe)}return JSON.parse(JSON.stringify({nodes:P,edges:O,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:P=>new Promise(O=>{const{nodes:z,edges:Q,position:ee,zoom:we,viewport:de}=P;z&&x(z),Q&&S(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(()=>{O(!0)})})}else O(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const P=kf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const O=Uo.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()(O,Q,P.translateExtent);e.d3Zoom.transform(e.d3Selection,ee)}se(P)},$destroy:()=>{}}}const bN=["data-id","data-handleid","data-nodeid","data-handlepos"],_N={name:"Handle",compatConfig:{MODE:3}},so=t.defineComponent({..._N,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:b,connectedEdges:g}=bf(),_=t.ref(),k=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),E=t.toRef(()=>{var S,T,R,w,v,I;return((S=l.value)==null?void 0:S.nodeId)===f&&((T=l.value)==null?void 0:T.id)===e.id&&((R=l.value)==null?void 0:R.type)===i.value||((w=c.value)==null?void 0:w.nodeId)===f&&((v=c.value)==null?void 0:v.id)===e.id&&((I=c.value)==null?void 0:I.type)===i.value}),N=t.toRef(()=>{var S,T,R;return((S=s.value)==null?void 0:S.nodeId)===f&&((T=s.value)==null?void 0:T.id)===e.id&&((R=s.value)==null?void 0:R.type)===i.value}),{handlePointerDown:C,handleClick:A}=gf({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),B=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(S=>{const T=S[`${i.value}Handle`];return S[i.value]!==f?!1:T?T===e.id:!0}):typeof e.connectable=="number"?g.value.filter(S=>{const T=S[`${i.value}Handle`];return S[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 S;if(!y.dimensions.width||!y.dimensions.height)return;const T=(S=y.handleBounds[i.value])==null?void 0:S.find(V=>V.id===e.id);if(!d.value||T)return;const R=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!_.value||!R||!e.id)return;const w=b.value.getBoundingClientRect(),v=_.value.getBoundingClientRect(),I=window.getComputedStyle(R),{m22:L}=new window.DOMMatrixReadOnly(I.transform),M={id:e.id,position:e.position,x:(v.left-w.left)/L,y:(v.top-w.top)/L,type:i.value,nodeId:f,...qa(_.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],M]});function $(S){const T=rs(S);B.value&&k.value&&(T&&S.button===0||!T)&&C(S)}function x(S){!f||!s.value&&!k.value||B.value&&A(S)}return n({handleClick:A,handlePointerDown:C,onClick:x,onPointerDown:$}),(S,T)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":S.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${S.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:B.value,connecting:N.value,connectablestart:k.value,connectableend:h.value,connectionindicator:B.value&&(k.value&&!E.value||h.value&&E.value)}]]),onMousedown:$,onTouchstartPassive:$,onClick:x},[t.renderSlot(S.$slots,"default",{id:S.id})],42,bN))}}),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 kN=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 EN=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 NN=or,wN=["transform"],IN=["width","height","x","y","rx","ry"],vN=["y"],CN={name:"EdgeText",compatConfig:{MODE:3}},SN=t.defineComponent({...CN,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,IN)):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,vN)],8,wN))}}),xN=["id","d","marker-end","marker-start"],RN=["d","stroke-width"],AN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ir=t.defineComponent({...AN,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,xN),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,RN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(SN,{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 Ef({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 Nf({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 wf({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 If(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top,curvature:s=.25}=e,[c,d]=wf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=wf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,y,b]=Nf({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,b]}function vf({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 Cf(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top}=e,[s,c]=vf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=vf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,y]=Nf({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 Sf={[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 $N({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 xf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function TN({source:e,sourcePosition:n=De.Bottom,target:o,targetPosition:i=De.Top,center:a,offset:r}){const l=Sf[n],s=Sf[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=$N({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,y,b;const g={x:0,y:0},_={x:0,y:0},[k,h,E,N]=Ef({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??k,b=a.y??h;const A=[{x:y,y:c.y},{x:y,y:d.y}],B=[{x:c.x,y:b},{x:d.x,y:b}];l[m]===p?f=m==="x"?A:B:f=m==="x"?B:A}else{const A=[{x:c.x,y:d.y}],B=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?B:A:f=l.y===p?A:B,n===i){const R=Math.abs(e[m]-o[m]);if(R<=r){const w=Math.min(r-1,r-R);l[m]===p?g[m]=(c[m]>e[m]?-1:1)*w:_[m]=(d[m]>o[m]?-1:1)*w}}if(n!==i){const R=m==="x"?"y":"x",w=l[m]===s[R],v=c[R]>d[R],I=c[R]<d[R];(l[m]===1&&(!w&&v||w&&I)||l[m]!==1&&(!w&&I||w&&v))&&(f=m==="x"?A:B)}const $={x:c.x+g.x,y:c.y+g.y},x={x:d.x+_.x,y:d.y+_.y},S=Math.max(Math.abs($.x-f[0].x),Math.abs(x.x-f[0].x)),T=Math.max(Math.abs($.y-f[0].y),Math.abs(x.y-f[0].y));S>=T?(y=($.x+x.x)/2,b=f[0].y):(y=f[0].x,b=($.y+x.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...f,{x:d.x+_.x,y:d.y+_.y},o],y,b,E,N]}function MN(e,n,o,i){const a=Math.min(xf(e,n)/2,xf(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,b]=TN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((_,k,h)=>{let E;return h>0&&h<m.length-1?E=MN(m[h-1],k,m[h+1],s):E=`${h===0?"M":"L"}${k.x} ${k.y}`,_+=E,_},""),p,f,y,b]}function VN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Ef({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const BN=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]=VN(e);return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),Rf=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})}}}),DN=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(Rf,{...e,...n,borderRadius:0})}}),ON=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]=If({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),LN=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]=Cf({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),PN={input:NN,default:kN,output:EN},zN={default:ON,straight:BN,step:DN,smoothstep:Rf,simplebezier:LN};function FN(e,n,o){const i=t.computed(()=>b=>n.value.get(b)),a=t.computed(()=>b=>o.value.get(b)),r=t.computed(()=>{const b={...zN,...e.edgeTypes},g=Object.keys(b);for(const _ of e.edges)_.type&&!g.includes(_.type)&&(b[_.type]=_.type);return b}),l=t.computed(()=>{const b={...PN,...e.nodeTypes},g=Object.keys(b);for(const _ of e.nodes)_.type&&!g.includes(_.type)&&(b[_.type]=_.type);return b}),s=t.computed(()=>e.onlyRenderVisibleElements?jm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const g of e.edges){const _=n.value.get(g.source),k=n.value.get(g.target);U0({sourcePos:_.computedPosition||{x:0,y:0},targetPos:k.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:k.dimensions.width,targetHeight:k.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(g)}return b}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const b=[];for(const g of e.nodes)g.selected&&b.push(g);return b}),m=t.computed(()=>{const b=[];for(const g of e.edges)g.selected&&b.push(g);return b}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const b=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&b.push(g);return b}),y=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=kf(),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=FN(a,s,c),u=gN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...L_(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(ff,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)},b=g=>{d.applyEdgeChanges(g)};m?(d.onNodesChange(y),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)),f(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)})},{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(ff,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 UN(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 HN={name:"UserSelection",compatConfig:{MODE:3}},jN=t.defineComponent({...HN,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))}}),KN=["tabIndex"],GN={name:"NodesSelection",compatConfig:{MODE:3}},YN=t.defineComponent({...GN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=et(),s=_f(),c=t.ref(null),d=yf({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||Ho[y.key]&&(y.preventDefault(),s({x:Ho[y.key].x,y:Ho[y.key].y},y.shiftKey))}return(y,b)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,KN)],6)):t.createCommentVNode("",!0)}});function qN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const WN={name:"Pane",compatConfig:{MODE:3}},JN=t.defineComponent({...WN,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:b,multiSelectionKeyCode:g,multiSelectionActive:_,edgeLookup:k,nodeLookup:h,connectionLookup:E,defaultEdgeOptions:N,connectionStartHandle:C,panOnDrag:A}=et(),B=t.shallowRef(null),$=t.shallowRef(new Set),x=t.shallowRef(new Set),S=t.shallowRef(null),T=t.toRef(()=>c.value&&(e.isSelecting||r.value)),R=t.toRef(()=>C.value!==null);let w=!1,v=!1;const I=Ci(b,{actInsideInputWithModifier:!1}),L=Ci(g);t.watch(I,he=>{he&&(p(m.value),f(u.value),d.value=!1)}),t.watch(L,he=>{_.value=he});function M(he,_e){return ye=>{ye.target===_e&&(he==null||he(ye))}}function V(he){if(w||R.value){w=!1;return}a.paneClick(he),l(),d.value=!1}function U(he){var _e;if(Array.isArray(A.value)&&((_e=A.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(S.value=((_e=n.value)==null?void 0:_e.getBoundingClientRect())??null,!c.value||!e.isSelecting||he.button!==0||he.target!==B.value||!S.value)return;(Ae=(ye=he.target)==null?void 0:ye.setPointerCapture)==null||Ae.call(ye,he.pointerId);const{x:Fe,y:se}=qN(he,S.value);v=!0,w=!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(!S.value||!s.value)return;w=!0;const{x:ye,y:Ae}=cn(he,S.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=x.value;$.value=new Set(jm(o.value,ne,i.value,y.value===Zl.Partial,!0).map(O=>O.id)),x.value=new Set;const P=((_e=N.value)==null?void 0:_e.selectable)??!0;for(const O of $.value){const z=E.value.get(O);if(z)for(const{edgeId:Q}of z.values()){const ee=k.value.get(Q);ee&&(ee.selectable??P)&&x.value.add(Q)}}if(!mf(ae,$.value)){const O=Ln(h.value,$.value,!0);a.nodesChange(O)}if(!mf(me,x.value)){const O=Ln(k.value,x.value);a.edgesChange(O)}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===B.value&&V(he),r.value=!1,s.value=null,d.value=$.value.size>0,a.selectionEnd(he),e.selectionKeyPressed&&(w=!1),v=!1)}return(he,_e)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:B,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:he.isSelecting}]),onClick:_e[0]||(_e[0]=ye=>T.value?void 0:M(V,B.value)(ye)),onContextmenu:_e[1]||(_e[1]=ye=>M(U,B.value)(ye)),onWheelPassive:_e[2]||(_e[2]=ye=>M(oe,B.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(jN,{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(YN,{key:1})):t.createCommentVNode("",!0)],34))}}),XN={name:"Transform",compatConfig:{MODE:3}},ZN=t.defineComponent({...XN,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))}}),QN={name:"Viewport",compatConfig:{MODE:3}},ew=t.defineComponent({...QN,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:b,noWheelClassName:g,noPanClassName:_,emits:k,connectionStartHandle:h,userSelectionActive:E,paneDragging:N,d3Zoom:C,d3Selection:A,d3ZoomHandler:B,viewport:$,viewportRef:x,paneClickDistance:S}=et();UN(x);const T=t.shallowRef(!1),R=t.shallowRef(!1);let w=null,v=!1,I=0,L={x:0,y:0,zoom:0};const M=Ci(s),V=Ci(l),U=Ci(r),oe=t.toRef(()=>(!V.value||V.value&&l.value===!0)&&(M.value||m.value)),ue=t.toRef(()=>M.value||c.value),be=t.toRef(()=>l.value===!0&&oe.value!==!0),pe=t.toRef(()=>V.value&&l.value!==!0||E.value||be.value),he=t.toRef(()=>h.value!==null);t.onMounted(()=>{if(!x.value){Ti("Viewport element is missing");return}const se=x.value,ne=se.getBoundingClientRect(),ae=N0().clickDistance(S.value).scaleExtent([n.value,o.value]).translateExtent(a.value),me=jt(se).call(ae),P=me.on("wheel.zoom"),O=Uo.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()(O,z,a.value);ae.transform(me,Q),ae.wheelDelta(ns),C.value=ae,A.value=me,B.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"&&(N.value=!0),L=de,k.viewportChangeStart(de),k.moveStart({event:ee,flowTransform:de})}),ae.on("end",ee=>{if(!ee.sourceEvent)return null;if(T.value=!1,N.value=!1,_e(oe.value,I??0)&&!v&&k.paneContextMenu(ee.sourceEvent),v=!1,ye(L,ee.transform)){const we=Ae(ee.transform);L=we,k.viewportChangeEnd(we),k.moveEnd({event:ee,flowTransform:we})}}),ae.filter(ee=>{var we;const de=U.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||E.value||he.value&&!Y||!p.value&&ee.type==="dblclick"||Fe(ee,g.value)&&Y||Fe(ee,_.value)&&(!Y||ue.value&&Y&&!U.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||M.value||Y)&&X}),t.watch([E,oe],()=>{E.value&&!T.value?ae.on("zoom",null):E.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),k.viewportChange(we),k.move({event:ee,flowTransform:we})})},{immediate:!0}),t.watch([E,ue,d,U,f,b,g],()=>{ue.value&&!U.value&&!E.value?me.on("wheel.zoom",ee=>{if(Fe(ee,g.value))return!1;const we=U.value||y.value,de=f.value&&ee.ctrlKey;if(!(!b.value||ue.value||we||de))return!1;ee.preventDefault(),ee.stopImmediatePropagation();const Ce=me.property("__zoom").k||1,Y=$i();if(!M.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"));w&&clearTimeout(w),R.value?(k.move({event:ee,flowTransform:Be}),k.viewportChange(Be),w=setTimeout(()=>{k.moveEnd({event:ee,flowTransform:Be}),k.viewportChangeEnd(Be),R.value=!1},150)):(R.value=!0,k.moveStart({event:ee,flowTransform:Be}),k.viewportChangeStart(Be))},{passive:!1}):typeof P<"u"&&me.on("wheel.zoom",function(ee,we){const de=!b.value&&ee.type==="wheel"&&!ee.ctrlKey,xe=U.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:x,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(JN,{"is-selecting":pe.value,"selection-key-pressed":t.unref(V),class:t.normalizeClass({connecting:he.value,dragging:t.unref(N),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(ZN,null,{default:t.withCtx(()=>[t.renderSlot(se.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),tw=["id"],nw=["id"],ow=["id"],iw={name:"A11yDescriptions",compatConfig:{MODE:3}},aw=t.defineComponent({...iw,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(Vm)}-${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,tw),t.createElementVNode("div",{id:`${t.unref(Bm)}-${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,nw),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(x0)}-${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,ow))],64))}});function rw(){const e=et();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function lw(e,n,o){return o===De.Left?e-n:o===De.Right?e+n:e}function sw(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:lw(n,e,i),cy:sw(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ps.props=["radius","centerX","centerY","position","type"],ps.compatConfig={MODE:3};const Af=ps,cw=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:b,edgesUpdatable:g,edgesFocusable:_,hooks:k}=et(),h=t.computed(()=>u(e.id)),{emit:E,on:N}=iN(h.value,r),C=t.inject(Za),A=t.getCurrentInstance(),B=t.ref(!1),$=t.ref(!1),x=t.ref(""),S=t.ref(null),T=t.ref("source"),R=t.ref(null),w=t.toRef(()=>typeof h.value.selectable>"u"?b.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"?_.value:h.value.focusable);t.provide(tN,e.id),t.provide(nN,R);const L=t.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),M=t.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),V=t.computed(()=>{const O=h.value.type||"default",z=C==null?void 0:C[`edge-${O}`];if(z)return z;let Q=h.value.template??c.value[O];if(typeof Q=="string"&&A){const ee=Object.keys(A.appContext.components);ee&&ee.includes(O)&&(Q=t.resolveComponent(O,!1))}return Q&&typeof Q!="string"?Q:(r.error(new kt(yt.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:U}=gf({nodeId:x,handleId:S,type:T,isValidConnection:p,edgeUpdaterType:T,onEdgeUpdate:be,onEdgeUpdateEnd:pe});return()=>{const O=m(h.value.source),z=m(h.value.target),Q="pathOptions"in h.value?h.value.pathOptions:{};if(!O&&!z)return r.error(new kt(yt.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!O)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||O.hidden||z.hidden)return null;let ee;i.value===En.Strict?ee=O.handleBounds.source:ee=[...O.handleBounds.source||[],...O.handleBounds.target||[]];const we=nf(ee,h.value.sourceHandle);let de;i.value===En.Strict?de=z.handleBounds.target:de=[...z.handleBounds.target||[],...z.handleBounds.source||[]];const xe=nf(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}=Ko(O,we,Ce),{x:Ie,y:Be}=Ko(z,xe,Y);return h.value.sourceX=X,h.value.sourceY=q,h.value.targetX=Ie,h.value.targetY=Be,t.h("g",{ref:R,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${V.value===!1?"default":h.value.type||"default"}`,s.value,L.value,{updating:B.value,selected:h.value.selected,animated:h.value.animated,inactive:!w.value&&!k.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?`${Bm}-${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(V.value===!1?c.value.default:V.value,{id:e.id,sourceNode:O,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,...N},style:M.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(Af,{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(Af,{position:Y,centerX:Ie,centerY:Be,radius:a.value,type:"target","data-type":"target"}))]:null]])};function oe(){B.value=!0}function ue(){B.value=!1}function be(O,z){E.update({event:O,edge:h.value,connection:z})}function pe(O){E.updateEnd({event:O,edge:h.value}),$.value=!1}function he(O,z){O.button===0&&($.value=!0,x.value=z?h.value.target:h.value.source,S.value=(z?h.value.targetHandle:h.value.sourceHandle)??null,T.value=z?"target":"source",E.updateStart({event:O,edge:h.value}),U(O))}function _e(O){var z;const Q={event:O,edge:h.value};w.value&&(l.value=!1,h.value.selected&&f.value?(d([h.value]),(z=R.value)==null||z.blur()):o([h.value])),E.click(Q)}function ye(O){E.contextMenu({event:O,edge:h.value})}function Ae(O){E.doubleClick({event:O,edge:h.value})}function Fe(O){E.mouseEnter({event:O,edge:h.value})}function se(O){E.mouseMove({event:O,edge:h.value})}function ne(O){E.mouseLeave({event:O,edge:h.value})}function ae(O){he(O,!0)}function me(O){he(O,!1)}function P(O){var z;!y.value&&Dm.includes(O.key)&&w.value&&(O.key==="Escape"?((z=R.value)==null||z.blur(),d([u(e.id)])):o([u(e.id)]))}}}),dw=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 k;return m((k=i.value)==null?void 0:k.nodeId)}),y=t.computed(()=>{var k;return m((k=a.value)==null?void 0:k.nodeId)??null}),b=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),g=t.computed(()=>c.value.markerStart?`url(#${Ai(c.value.markerStart,n)})`:""),_=t.computed(()=>c.value.markerEnd?`url(#${Ai(c.value.markerEnd,n)})`:"");return()=>{var k,h,E;if(!f.value||!i.value)return null;const N=i.value.id,C=i.value.type,A=f.value.handleBounds;let B=(A==null?void 0:A[C])??[];if(o.value===En.Loose){const M=(A==null?void 0:A[C==="source"?"target":"source"])??[];B=[...B,...M]}if(!B)return null;const $=(N?B.find(M=>M.id===N):B[0])??null,x=($==null?void 0:$.position)??De.Top,{x:S,y:T}=Ko(f.value,$,x);let R=null;y.value&&(o.value===En.Strict?R=((k=y.value.handleBounds[C==="source"?"target":"source"])==null?void 0:k.find(M=>{var V;return M.id===((V=a.value)==null?void 0:V.id)}))||null:R=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(M=>{var V;return M.id===((V=a.value)==null?void 0:V.id)}))||null);const w=((E=a.value)==null?void 0:E.position)??(x?ss[x]:null);if(!x||!w)return null;const v=l.value??c.value.type??io.Bezier;let I="";const L={sourceX:S,sourceY:T,sourcePosition:x,targetX:b.value.x,targetY:b.value.y,targetPosition:w};return v===io.Bezier?[I]=If(L):v===io.Step?[I]=fs({...L,borderRadius:0}):v===io.SmoothStep?[I]=fs(L):v===io.SimpleBezier?[I]=Cf(L):I=`M${S},${T} ${b.value.x},${b.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:S,sourceY:T,sourcePosition:x,targetX:b.value.x,targetY:b.value.y,targetPosition:w,sourceNode:f.value,sourceHandle:$,targetNode:y.value,targetHandle:R,markerEnd:_.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":_.value,"marker-start":g.value})))}}}),uw=["id","markerWidth","markerHeight","markerUnits","orient"],mw={name:"MarkerType",compatConfig:{MODE:3}},fw=t.defineComponent({...mw,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,uw))}}),pw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},hw={name:"MarkerDefinitions",compatConfig:{MODE:3}},yw=t.defineComponent({...hw,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",pw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(fw,{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))])]))}}),gw={name:"Edges",compatConfig:{MODE:3}},bw=t.defineComponent({...gw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=et();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(yw),(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(H0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(cw),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(dw))],64))}}),_w=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:b,snapToGrid:g,snapGrid:_,nodeDragThreshold:k,nodesDraggable:h,elementsSelectable:E,nodesConnectable:N,nodesFocusable:C,hooks:A}=et(),B=t.ref(null);t.provide(hf,B),t.provide(pf,e.id);const $=t.inject(Za),x=t.getCurrentInstance(),S=_f(),{node:T,parentNode:R}=bf(e.id),{emit:w,on:v}=sN(T,l),I=t.toRef(()=>typeof T.draggable>"u"?h.value:T.draggable),L=t.toRef(()=>typeof T.selectable>"u"?E.value:T.selectable),M=t.toRef(()=>typeof T.connectable>"u"?N.value:T.connectable),V=t.toRef(()=>typeof T.focusable>"u"?C.value:T.focusable),U=t.computed(()=>L.value||I.value||A.value.nodeClick.hasListeners()||A.value.nodeDoubleClick.hasListeners()||A.value.nodeMouseEnter.hasListeners()||A.value.nodeMouseMove.hasListeners()||A.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"&&x){const we=Object.keys(x.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=yf({id:e.id,el:B,disabled:()=>!I.value,selectable:L,dragHandle:()=>T.dragHandle,onStart(z){w.dragStart(z)},onDrag(z){w.drag(z)},onStop(z){w.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&&B.value&&(e.resizeObserver.observe(B.value),ee(()=>{B.value&&e.resizeObserver.unobserve(B.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>T.type,()=>T.sourcePosition,()=>T.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:B.value,forceUpdate:!0}])})}),t.watch([()=>T.position.x,()=>T.position.y,()=>{var z;return(z=R.value)==null?void 0:z.computedPosition.x},()=>{var z;return(z=R.value)==null?void 0:z.computedPosition.y},()=>{var z;return(z=R.value)==null?void 0:z.computedPosition.z},_e,()=>T.selected,()=>T.dimensions.height,()=>T.dimensions.width,()=>{var z;return(z=R.value)==null?void 0:z.dimensions.height},()=>{var z;return(z=R.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=O0({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:B,"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:L.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:U.value?"all":"none",...he.value},tabIndex:V.value?0:void 0,role:V.value?"group":void 0,"aria-describedby":y.value?void 0:`${Vm}-${n}`,"aria-label":T.ariaLabel,"aria-roledescription":"node",...T.domAttributes,onMouseenter:Fe,onMousemove:se,onMouseleave:ne,onContextmenu:ae,onClick:P,onDblclick:me,onKeydown:O},[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:M.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,_.value):z,l.error,p.value,R.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(){B.value&&d([{id:e.id,nodeElement:B.value,forceUpdate:!0}])}function Fe(z){be!=null&&be.value||w.mouseEnter({event:z,node:T})}function se(z){be!=null&&be.value||w.mouseMove({event:z,node:T})}function ne(z){be!=null&&be.value||w.mouseLeave({event:z,node:T})}function ae(z){return w.contextMenu({event:z,node:T})}function me(z){return w.doubleClick({event:z,node:T})}function P(z){L.value&&(!i.value||!I.value||k.value>0)&&cs(T,r.value,c,s,a,!1,B.value),w.click({event:z,node:T})}function O(z){if(!(es(z)||y.value))if(Dm.includes(z.key)&&L.value){const Q=z.key==="Escape";cs(T,r.value,c,s,a,Q,B.value)}else I.value&&T.selected&&Ho[z.key]&&(z.preventDefault(),b.value=`Moved selected node ${z.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~T.position.x}, y: ${~~T.position.y}`,S({x:Ho[z.key].x,y:Ho[z.key].y},z.shiftKey))}}});function kw(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 Ew={class:"vue-flow__nodes vue-flow__container"},Nw={name:"Nodes",compatConfig:{MODE:3}},ww=t.defineComponent({...Nw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=et(),a=kw(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",Ew,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(_w),{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 Iw(){const{emits:e}=et();t.onMounted(()=>{if(sf()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new kt(yt.MISSING_STYLES))}})}const vw=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Cw={name:"VueFlow",compatConfig:{MODE:3}},Sw=t.defineComponent({...Cw,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=mN({modelValue:r,nodes:l,edges:s},i,c);return pN(o,c.hooks),rw(),Iw(),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(ew,null,{default:t.withCtx(()=>[t.createVNode(bw),vw,t.createVNode(ww),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(aw)],512))}}),xw={name:"Panel",compatConfig:{MODE:3}},$f=t.defineComponent({...xw,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))}}),Rw=["width","height","innerHTML"],Aw=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,Rw))}}),tt=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ve=tt(Aw,[["__scopeId","data-v-05aac699"]]),uo=["red","amber","green","teal","blue","indigo","violet","pink"],Tf={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 $w(e){return typeof e=="string"&&e in Tf}const Tw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},Mw=.15;function Vw(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 Bw(e){if(typeof e!="string")return null;const n=Vw(e);if(!n||n.s<Mw)return null;let o=null,i=1/0;for(const a of uo){const r=Math.abs(n.h-Tw[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($w(n))return n;const o=e==null?void 0:e.properties;return Bw((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 Dw={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)"},Ow={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function Mf(e,n=!1){return e?n?Ow[e]:Dw[e]:null}function mo(e){return Tf[e]}function Go(e){return`var(--em-swatch-${e}-bar)`}function Lw(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 Pw(e,n){const o=Lw(n);return o?e(o):n.split("-")[1]??n}function zw(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-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 Vf(e,n){const o=zw(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 Fw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Uw={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",Uw,[(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(Vf)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Hw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],jw={key:0,class:"em-mlang__dot"},Kw=["id","role","aria-labelledby"],Gw=["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 _=o.defaultLang;return _&&o.languages.includes(_)?_:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const _=o.activeLang;return _&&o.languages.includes(_)?_:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(_){var k,h;return!!((h=(k=o.modelValue)==null?void 0:k[_])!=null&&h.trim())}const d=_=>`${o.name}-tab-${_}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(_){var E,N;const k=o.languages,h=k[(_+k.length)%k.length];h&&(l.value=h,await t.nextTick(),(N=(E=m.value)==null?void 0:E.querySelectorAll('[role="tab"]')[k.indexOf(h)])==null||N.focus())}function f(_){p(o.languages.indexOf(s.value)+_)}const y=t.computed(()=>o.languages.filter(_=>{var k,h;return _!==s.value&&!!((h=(k=o.modelValue)==null?void 0:k[_])!=null&&h.trim())})),b=t.computed(()=>{var _;return((_=o.modelValue)==null?void 0:_[s.value])??""});function g(_){const k={...o.modelValue};_.trim()===""?delete k[s.value]:k[s.value]=_,i("update:modelValue",k)}return(_,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,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:E=>l.value=h,onKeydown:[t.withKeys(t.withModifiers(E=>l.value=h,["prevent"]),["enter"]),t.withKeys(t.withModifiers(E=>l.value=h,["prevent"]),["space"]),k[0]||(k[0]=t.withKeys(t.withModifiers(E=>f(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(E=>f(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(E=>p(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(E=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(h),1),c(h)?(t.openBlock(),t.createElementBlock("span",jw,"•")):t.createCommentVNode("",!0)],42,Hw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(te.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":b.value,"onUpdate:modelValue":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":b.value,"onUpdate:modelValue":g},null,8,["name","placeholder","model-value"]))],8,Kw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,Gw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Yw=["disabled"],qw={class:"em-panel__sub-label"},Ww={class:"em-field"},Jw={class:"em-field"},Xw={class:"em-field"},Zw={class:"em-class"},Qw={class:"em-field"},eI={class:"em-field"},tI={class:"em-field"},nI={class:"em-field"},oI={class:"em-multilang"},iI={class:"em-multilang"},aI={class:"em-jpa"},rI={class:"em-field"},lI={class:"em-field"},sI={class:"em-field"},cI=["title"],dI={class:"em-swatch"},uI={class:"em-swatch__row"},mI=["title"],fI=["title","onClick"],Bf=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(R=>R.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(R=>R.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var R;return St(((R=l.value)==null?void 0:R.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=R=>R;function p(R){return R==="inherit"?a.t("em.common.inherit"):R}function f(R){r.value&&a.updateEntity(r.value.modelId,R)}function y(R,w,v){var L;const I=((L=r.value)==null?void 0:L.table)??{physicalName:""};f(R==="physicalName"?{table:{...I,physicalName:v}}:{table:{...I,logicalName:{...I.logicalName,[w]:v}}})}function b(R){f({description:Object.keys(R).length?R:void 0})}function g(R,w){var v;f({jpaAttrs:{...(v=r.value)==null?void 0:v.jpaAttrs,[R]:w}})}function _(R,w){g(R,w)}const k=t.computed(()=>{var R,w;return((w=(R=r.value)==null?void 0:R.jpaAttrs)==null?void 0:w.discriminatorType)??"inherit"}),h=t.computed(()=>{var R,w;return!((w=(R=r.value)==null?void 0:R.jpaAttrs)!=null&&w.useDiscriminator)});function E(R){g("discriminatorType",R==="inherit"?void 0:R)}function N(R){f({hasPersonalInfo:R})}function C(R){f({referenceOnly:R?!0:void 0})}function A(R){f({superClass:R.trim()||void 0})}function B(R){f({schema:R.trim()||void 0})}function $(R){f({abstractClass:R})}const x=t.computed(()=>{var R,w;return((w=(R=r.value)==null?void 0:R.declarationOfInterfaces)==null?void 0:w.join(", "))??""});function S(R){const w=R.split(",").map(v=>v.trim()).filter(Boolean);f({declarationOfInterfaces:w.length?w:void 0})}function T(R){r.value&&a.setEntitySwatch(r.value.modelId,R)}return(R,w)=>{var v,I,L;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:w[0]||(w[0]=M=>i("toggle"))},[t.createElementVNode("span",qw,[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",Ww,[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":w[1]||(w[1]=M=>f({name:M}))},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(te.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(ni),"onUpdate:modelValue":w[2]||(w[2]=M=>f({stereotype:M}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Xw,[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":w[3]||(w[3]=M=>f({packageName:M}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Zw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Qw,[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":w[4]||(w[4]=M=>A(M))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",eI,[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":x.value,"onUpdate:modelValue":w[5]||(w[5]=M=>S(M))},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":w[6]||(w[6]=M=>$(M))},null,8,["label","model-value"])]),t.createElementVNode("label",tI,[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":w[7]||(w[7]=M=>y("physicalName",null,M))},null,8,["model-value"])]),t.createElementVNode("label",nI,[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":w[8]||(w[8]=M=>B(M))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",oI,[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,M=>{var V,U;return t.openBlock(),t.createElementBlock("label",{key:M,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(M),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${M}`,width:"100%","model-value":((U=(V=r.value.table)==null?void 0:V.logicalName)==null?void 0:U[M])??"","onUpdate:modelValue":oe=>y("logicalName",M,oe)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",iI,[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":b},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",aI,[w[13]||(w[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,M=>{var V;return t.createVNode(t.unref(te.BSCheckbox),{key:M.key,name:`jpa-${M.key}`,class:"em-check",label:M.label,"model-value":!!((V=r.value.jpaAttrs)!=null&&V[M.key]),"onUpdate:modelValue":U=>_(M.key,U)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",rI,[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":w[9]||(w[9]=M=>g("discriminatorColumnName",M.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",lI,[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":k.value,items:u,"value-provider":m,"label-provider":p,"onUpdate:modelValue":w[10]||(w[10]=M=>M&&E(M))},null,8,["disabled","model-value"])]),t.createElementVNode("label",sI,[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":(L=r.value.jpaAttrs)==null?void 0:L.discriminatorLength,"onUpdate:modelValue":w[11]||(w[11]=M=>g("discriminatorLength",M||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":N},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,cI),t.createElementVNode("fieldset",dI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",uI,[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:w[12]||(w[12]=M=>T(null))},"∅",10,mI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),M=>(t.openBlock(),t.createElementBlock("button",{key:M,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===M}]),style:t.normalizeStyle({background:t.unref(Go)(M)}),title:t.unref(a).t(t.unref(mo)(M)),onClick:V=>T(M)},null,14,fI))),128))])])],64)):t.createCommentVNode("",!0)],8,Yw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),pI=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"],Df=["inherit","true","false"],rr="__OWN__";function Of(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=xo(e.state.logical,o.value.modelId,K.modelId);return le&&ma(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 b(K,le){s(K,{name:le})}function g(K){return!!o.value&&Or(K,o.value,c.value)}function _(K){var ke,H;const le=(ke=K.derivedFrom)==null?void 0:ke.associationRef,Re=(H=o.value)==null?void 0:H.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 k(K){return!!o.value&&!!xo(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 E(){return{naturalId:void 0,naturalIdMutable:void 0}}function N(K,le){s(K,{identifier:le,...le?E():{}})}function C(K,le){s(K,{transient:le||void 0,...le?E():{}})}function A(K){return!!K.transient||K.attrType==="RELATION_REF"}function B(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 x=K=>K.value,S=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 R(K,le){s(K,{customType:le.trim()===""?void 0:le})}function w(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)&&!B(K)&&!A(K)?e.t("em.attr.scaleTypeHint"):void 0}function L(K,le){w(K,{logicalName:Object.keys(le).length?le:void 0})}function M(K,le){s(K,{description:Object.keys(le).length?le:void 0})}function V(K){return K.personalInfoAttributeType??"none"}function U(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,H;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)??((H=K.label)==null?void 0:H.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 O(K,le,Re){const ke=K.dbAttrs.map((H,bt)=>{if(bt!==le)return H;const vt={...H,...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){O(K,le,{logicalName:Object.keys(Re).length?Re:void 0})}function Q(K,le){var H,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=(H=e.embeddableCatalog.value.find(Ge=>Ge.type===K.type))==null?void 0:H.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=Df;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){O(K,le,{updatable:Re==="inherit"?void 0:Re==="true"})}function Ie(K,le){w(K,{updatable:le==="inherit"?void 0:le==="true"})}const Be=Df;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){O(K,le,{insertable:Re==="inherit"?void 0:Re==="true"})}function Se(K,le){w(K,{insertable:le==="inherit"?void 0:le==="true"})}const je=t.computed(()=>o.value?Lr(o.value,e.state.logical.entities):[]),Ze=t.computed(()=>Eo(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){O(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:pI,piiLabel:r,idn:l,setAttr:s,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:p,setRowName:f,assocFieldName:y,setAssocFieldName:b,nameLocked:g,nameLockedHint:_,isManagedFk:k,setNaturalId:h,clearNaturalIdPatch:E,setIdentifier:N,setTransient:C,dbLocked:A,fkDerived:B,fkOriginPhysical:$,typeValueOf:x,typeLabelOf:S,setAttrType:T,setAttrCustomType:R,setDb:w,scaleApplicable:v,scaleHint:I,setDbLogical:L,setAttrDescription:M,attrPiiValue:V,setAttrPii:U,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:O,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 Lf={"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.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"},Pf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.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.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":"未指定"},zf={"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.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":"미지정"},hI=["ko","en","ja"],ys={ko:zf,en:Lf,ja:Pf};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 Ff=["ko","en","ja","zh"];function yI(e){if(e)for(const n of Ff){const o=e[n];if(o)return o}}function gs(e){const n=yI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function gI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Ff.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const bI=["aria-expanded","placeholder"],_I=["aria-selected","onClick","onMouseenter"],kI={key:0,class:"gcc__opt gcc__opt--empty"},Uf=tt(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=($,x)=>qt(o.locale??"ko",$,x),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:gI(o.items,c.value));function b(){var x;const $=(x=r.value)==null?void 0:x.getBoundingClientRect();$&&(m.value={left:`${$.left}px`,top:`${$.bottom}px`,width:`${$.width}px`})}function g(){d.value=!0,b(),u.value=Math.max(0,y.value.findIndex($=>$.groupCode===o.modelValue)),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),document.addEventListener("mousedown",B)}function _(){d.value=!1,window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b),document.removeEventListener("mousedown",B)}t.onBeforeUnmount(_);function k(){g(),t.nextTick(()=>{var $;return($=l.value)==null?void 0:$.select()})}function h(){d.value||g(),u.value=0}function E($){i("update:modelValue",$.groupCode),c.value=gs($),_()}function N(){i("update:modelValue",void 0),c.value="",_()}function C(){c.value.trim()===""?N():(c.value=f.value,_())}function A($){var x;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 S=y.value[u.value];S&&E(S),$.preventDefault()}else $.key==="Escape"&&(c.value=f.value,_(),(x=l.value)==null||x.blur())}function B($){var S,T;const x=$.target;!((S=r.value)!=null&&S.contains(x))&&!((T=s.value)!=null&&T.contains(x))&&C()}return($,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":x[0]||(x[0]=S=>c.value=S),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:k,onInput:h,onKeydown:A},null,40,bI),[[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:x[1]||(x[1]=t.withModifiers(()=>{},["prevent"])),onClick:N},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(S,T)=>(t.openBlock(),t.createElementBlock("li",{key:S.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":T===u.value,"is-selected":S.groupCode===e.modelValue}]),role:"option","aria-selected":S.groupCode===e.modelValue,onMousedown:x[2]||(x[2]=t.withModifiers(()=>{},["prevent"])),onClick:R=>E(S),onMouseenter:R=>u.value=T},t.toDisplayString(t.unref(gs)(S)),43,_I))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",kI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),EI=["aria-labelledby"],NI=["aria-checked","tabindex","onClick","onKeydown"],Hf=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,NI))),128))],8,EI))}}),[["__scopeId","data-v-5c793bbb"]]),wI=["disabled"],II={class:"em-aw__toolbar"},vI={class:"em-aw__count"},CI={class:"em-aw__scroll"},SI={class:"em-aw__table"},xI={class:"c-name"},RI={class:"c-type"},AI={class:"c-logical"},$I=["id"],TI={class:"c-col"},MI={class:"c-constraints"},VI={class:"c-del"},BI={class:"c-expand"},DI=["title","onClick","onKeydown"],OI=["title"],LI=["title"],PI={key:1,class:"em-aw__muted"},zI=["title"],FI=["title"],UI=["title"],HI={class:"em-aw__cflags"},jI=["title"],KI={key:0,class:"em-aw__embed-col"},GI={class:"em-aw__embed-label"},YI=["title"],qI={colspan:"8"},WI={class:"em-aw__detail"},JI={class:"em-aw__dgroup"},XI=["title"],ZI={class:"em-aw__df"},QI={class:"em-aw__df"},ev={class:"em-aw__dgroup"},tv={key:0,class:"em-aw__dgroup"},nv={class:"em-aw__df"},ov={key:0,class:"em-aw__df"},iv={class:"em-aw__df"},av={class:"em-aw__dgroup em-aw__ddesc"},rv={class:"c-expand"},lv=["title","onClick","onKeydown"],sv={key:1,class:"em-aw__caret is-static","aria-hidden":"true"},cv=["title"],dv=["title"],uv=["colspan"],mv=["title"],fv={class:"em-aw__cflags"},pv=["title"],hv={colspan:"8"},yv={class:"em-aw__detail"},gv={class:"em-aw__dgroup em-aw__ddesc"},bv={class:"c-expand"},_v=["title","onClick","onKeydown"],kv={class:"em-aw__embed-label"},Ev=["title"],Nv=["title"],wv={class:"em-aw__ro"},Iv=["title"],vv={class:"em-aw__ro"},Cv=["title"],Sv={class:"em-aw__ro"},xv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},Rv={colspan:"8"},Av={class:"em-aw__detail"},$v={class:"em-aw__dgroup"},Tv={key:0,class:"em-aw__df"},Mv={class:"em-aw__df"},Vv={class:"em-aw__df"},Bv={key:0},Dv={colspan:"99",class:"em-aw__empty"},Ov=6,jf=5,Lv=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:b,nameLocked:g,nameLockedHint:_,isManagedFk:k,setNaturalId:h,setIdentifier:E,setTransient:N,dbLocked:C,fkDerived:A,fkOriginPhysical:B,typeValueOf:$,typeLabelOf:x,setAttrType:S,setAttrCustomType:T,setDb:R,scaleApplicable:w,scaleHint:v,setDbLogical:I,attrPiiValue:L,setAttrPii:M,predefinedCustomTypeCatalog:V,embeddableCatalog:U,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:O,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}=Of(o,()=>n.entityId),Ke=t.computed(()=>{var Re;return[...((Re=i.value)==null?void 0:Re.attributes)??[]].sort((ke,H)=>ke.order-H.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",II,[t.createElementVNode("span",vI,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]=H=>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]=H=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(U).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(U),"value-provider":H=>H.type,"label-provider":t.unref(oe),"onUpdate:modelValue":le},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",CI,[t.createElementVNode("table",SI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[ke[3]||(ke[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",xI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",RI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",AI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,$I),t.createVNode(Hf,{modelValue:K.value,"onUpdate:modelValue":ke[2]||(ke[2]=H=>K.value=H),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",TI,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",MI,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,H=>{var bt,vt,ot,Ge,Xe,Z,Rt,$t,Sn,At;return t.openBlock(),t.createElementBlock(t.Fragment,{key:H.modelId},[H.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(H.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-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":H.name,"onUpdate:modelValue":ge=>t.unref(d)(H,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:Ov,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",VI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,H.modelId)},null,8,["onClick"])])],2)):t.unref(ne)(H)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(H.modelId)}])},[t.createElementVNode("td",rv,[t.unref(ae)(H)?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["em-aw__caret",{"is-open":nt(H.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(H.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>We(H.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>We(H.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>We(H.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,lv)):(t.openBlock(),t.createElementBlock("span",sv,[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})]))]),t.createElementVNode("td",{title:t.unref(g)(H)?t.unref(_)(H):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${H.modelId}`,width:"100%",disabled:t.unref(g)(H),placeholder:t.unref(p)(H),"model-value":t.unref(m)(H),"onUpdate:modelValue":ge=>t.unref(f)(H,ge)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,cv),t.createElementVNode("td",{title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${H.modelId}`,width:"100%",disabled:"","model-value":H.type},null,8,["name","model-value"])],8,dv),t.createElementVNode("td",{colspan:t.unref(ae)(H)?jf-1:jf,class:"em-aw__embed-note"},t.toDisplayString(t.unref(ae)(H)?t.unref(o).t("em.attr.fkChildCols",{n:H.dbAttrs.length}):t.unref(o).t("em.attr.embedChildCols",{n:H.dbAttrs.length})),9,uv),t.unref(ae)(H)?(t.openBlock(),t.createElementBlock("td",{key:0,class:"c-constraints",title:t.unref(o).t("em.attr.fkDerivedNote")},[t.createElementVNode("div",fv,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${H.modelId}`,label:"PK","model-value":H.identifier,disabled:"","onUpdate:modelValue":ge=>t.unref(E)(H,ge)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${H.modelId}`,label:"NN","model-value":H.notNull,disabled:"","onUpdate:modelValue":ge=>t.unref(d)(H,{notNull:ge})},null,8,["name","model-value","onUpdate:modelValue"])])],8,mv)):t.createCommentVNode("",!0),t.createElementVNode("td",{class:"c-del",title:t.unref(k)(H)?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,H.modelId)},null,8,["onClick"])],8,pv)],2),t.unref(ae)(H)&&nt(H.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(H.modelId)}])},[ke[15]||(ke[15]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",hv,[t.createElementVNode("div",yv,[t.createElementVNode("fieldset",gv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`aw-desc-${H.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":H.description,"onUpdate:modelValue":ge=>t.unref(se)(H,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(H.dbAttrs,(ge,ft)=>{var xn,Zt,D,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",bv,[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,_v)]),t.createElementVNode("td",kv,"↳ "+t.toDisplayString(((xn=t.unref(O)(H,ft))==null?void 0:xn.name)??((Zt=t.unref(O)(H,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=(D=t.unref(O)(H,ft))==null?void 0:D.logicalName)==null?void 0:F[K.value])??((fe=(j=t.unref(O)(H,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)(H,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(O)(H,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)(H,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,Ev),t.createElementVNode("td",{title:t.unref(we)(H)},[t.createElementVNode("span",wv,t.toDisplayString(t.unref(z)(H,ft)),1)],8,Nv),t.createElementVNode("td",{title:t.unref(we)(H)},[t.createElementVNode("span",vv,t.toDisplayString(t.unref(Q)(H,ft)??""),1)],8,Iv),t.createElementVNode("td",{class:"c-constraints",title:t.unref(we)(H)},[t.createElementVNode("span",Sv,t.toDisplayString(t.unref(ee)(H,ft)!=null?`scale ${t.unref(ee)(H,ft)}`:""),1)],8,Cv),ke[17]||(ke[17]=t.createElementVNode("td",null,null,-1))],2),nt(ge.modelId)?(t.openBlock(),t.createElementBlock("tr",xv,[ke[20]||(ke[20]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",Rv,[t.createElementVNode("div",Av,[t.createElementVNode("fieldset",$v,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(Oe=t.unref(O)(H,ft))!=null&&Oe.shareable?(t.openBlock(),t.createElementBlock("label",Tv,[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)(H,ft,ce)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",Mv,[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)(H,ft,ce)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",Vv,[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)(H,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(H.modelId),"em-aw__open":nt(H.modelId)})},[t.createElementVNode("td",BI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":nt(H.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(H.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>We(H.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>We(H.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>We(H.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,DI)]),t.createElementVNode("td",{title:t.unref(g)(H)?t.unref(_)(H):t.unref(u)(H)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${H.modelId}`,width:"100%",disabled:t.unref(g)(H),placeholder:t.unref(p)(H),"model-value":t.unref(m)(H),"onUpdate:modelValue":ge=>t.unref(f)(H,ge)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,OI),t.createElementVNode("td",{title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!H.groupCode||H.attrType==="RELATION_REF"||t.unref(A)(H),items:t.unref(kc)(H.type,t.unref(V)),"value-provider":t.unref($),"label-provider":t.unref(x),"model-value":H.type,"onUpdate:modelValue":ge=>t.unref(S)(H,ge)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),H.type===t.unref(hn)&&!t.unref(A)(H)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":H.customType??"","onUpdate:modelValue":ge=>t.unref(T)(H,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,LI),t.createElementVNode("td",null,[H.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Yt,{key:0,name:`aw-logical-${H.modelId}`,languages:t.unref(o).languages.value,"active-lang":K.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(bt=H.dbAttrs[0])==null?void 0:bt.logicalName,"onUpdate:modelValue":ge=>t.unref(I)(H,ge)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",PI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${H.modelId}`,width:"100%",placeholder:t.unref(B)(H)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(C)(H),"model-value":((vt=H.dbAttrs[0])==null?void 0:vt.physicalName)??"","onUpdate:modelValue":ge=>t.unref(R)(H,{physicalName:ge})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(fo,{controller:t.unref(o),"ref-id":(ot=H.dbAttrs[0])==null?void 0:ot.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${H.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(C)(H)||t.unref(A)(H),items:t.unref(gc)(((Ge=H.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=H.dbAttrs[0])==null?void 0:Xe.dataType)??"","onUpdate:modelValue":ge=>ge&&t.unref(R)(H,{dataType:ge})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,zI),t.createElementVNode("td",{title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${H.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(C)(H)||t.unref(A)(H),"model-value":(Z=H.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":ge=>t.unref(R)(H,{length:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,FI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",HI,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${H.modelId}`,label:"PK","model-value":H.identifier,disabled:t.unref(a)||t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(E)(H,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${H.modelId}`,label:"NN","model-value":H.notNull,disabled:t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(d)(H,{notNull:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${H.modelId}`,label:"UQ","model-value":!!((Rt=H.dbAttrs[0])!=null&&Rt.unique),disabled:t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(R)(H,{unique:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,UI),t.createElementVNode("td",{class:"c-del",title:t.unref(k)(H)?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,H.modelId)},null,8,["onClick"])],8,jI)],2),t.unref(u)(H)?(t.openBlock(),t.createElementBlock("tr",KI,[ke[8]||(ke[8]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",GI,"↳ "+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-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(y)(H),"onUpdate:modelValue":ge=>t.unref(b)(H,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,YI)])):t.createCommentVNode("",!0),nt(H.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(H.modelId)}])},[ke[14]||(ke[14]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",qI,[t.createElementVNode("div",WI,[t.createElementVNode("fieldset",JI,[ke[12]||(ke[12]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(v)(H)},[ke[9]||(ke[9]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${H.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(C)(H)||t.unref(A)(H)||!t.unref(w)(H),"model-value":($t=H.dbAttrs[0])==null?void 0:$t.scale,"onUpdate:modelValue":ge=>t.unref(R)(H,{scale:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,XI),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${H.modelId}`,label:"Auto Increment","model-value":!!((Sn=H.dbAttrs[0])!=null&&Sn.autoIncrement),disabled:t.unref(C)(H)||t.unref(A)(H)||!H.identifier,"onUpdate:modelValue":ge=>t.unref(R)(H,{autoIncrement:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",ZI,[ke[10]||(ke[10]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${H.modelId}`,width:"110px",disabled:t.unref(C)(H),"model-value":t.unref(Be)(H.dbAttrs[0]),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":ge=>ge&&t.unref(Ue)(H,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",QI,[ke[11]||(ke[11]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${H.modelId}`,width:"110px",disabled:t.unref(C)(H),"model-value":t.unref(Ce)(H.dbAttrs[0]),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":ge=>ge&&t.unref(X)(H,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",ev,[ke[13]||(ke[13]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${H.modelId}`,label:"@Transient","model-value":!!H.transient,disabled:H.identifier||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(N)(H,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${H.modelId}`,label:"@NaturalId","model-value":!!H.naturalId,disabled:H.identifier||t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(h)(H,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${H.modelId}`,label:"mutable","model-value":!!H.naturalIdMutable,disabled:t.unref(C)(H)||!H.naturalId,"onUpdate:modelValue":ge=>t.unref(d)(H,{naturalIdMutable:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${H.modelId}`,label:"Multi-Value (Set)","model-value":!!((At=H.dbAttrs[0])!=null&&At.multiValue),disabled:t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(R)(H,{multiValue:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(A)(H)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",tv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",nv,[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(L)(H),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":ge=>ge&&t.unref(M)(H,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(ue).length?(t.openBlock(),t.createElementBlock("label",ov,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Uf,{"model-value":H.groupCode,items:t.unref(ue),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ge=>t.unref(ye)(H,ge)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",iv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(be)(H).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":H.defaultValue??"none",items:t.unref(pe)(H),"value-provider":t.unref(he),"label-provider":t.unref(_e),"onUpdate:modelValue":ge=>ge&&t.unref(Ae)(H,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-${H.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":H.defaultValue??"","onUpdate:modelValue":ge=>t.unref(Fe)(H,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",av,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`aw-desc-${H.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":H.description,"onUpdate:modelValue":ge=>t.unref(se)(H,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",Bv,[t.createElementVNode("td",Dv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,wI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-36c8c727"]]);function bs(e,n){return n&&n!==e?`${e} (${n})`:e}function Kf(e,n,o){const i=e.dbAttrs[n];return i?oi(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function Pv(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,Kf(e,0,n))}function _s(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,Kf(o,r<0?0:r,n))}function Gf(e){const n=[];for(const o of e.entity.attributes??[]){const i=o.dbAttrs.filter(a=>!a.sharedColumnRef);if(i.length!==0){if(o.dbAttrs.length===1){n.push({ref:o.modelId,label:Pv(o,e)});continue}for(const a of i)n.push({ref:a.modelId,label:_s(a.modelId,e)})}}return n}const zv=["disabled"],Fv={class:"em-idxw__list"},Uv={class:"em-idxw__list-head"},Hv=["aria-label"],jv=["aria-current","onClick","onKeydown"],Kv={class:"em-idxw__item-name"},Gv={key:0,class:"em-idxw__badge"},Yv={class:"em-idxw__item-cnt"},qv={key:0,class:"em-idxw__empty"},Wv={key:0,class:"em-idxw__edit"},Jv={class:"em-idxw__form"},Xv={class:"em-field em-idxw__name"},Zv={class:"em-field"},Qv=["value","placeholder"],eC={class:"em-idxw__transfer"},tC={class:"em-idxw__pane"},nC={class:"em-idxw__pane-head"},oC=["aria-label"],iC=["aria-pressed","onClick","onKeydown"],aC=["title"],rC={key:0,class:"em-idxw__empty"},lC={class:"em-idxw__arrows"},sC={class:"em-idxw__pane"},cC={class:"em-idxw__pane-head"},dC={class:"em-idxw__col-name"},uC=["title"],mC={class:"em-idxw__col-ops"},fC=["title","disabled","onClick"],pC=["title","disabled","onClick"],hC=["title","onClick"],yC={key:0,class:"em-idxw__empty"},gC={key:1,class:"em-idxw__edit em-idxw__edit--empty"},bC=tt(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(R=>R.modelId===n.entityId)??null),a=t.computed(()=>{var R;return((R=i.value)==null?void 0:R.indexes)??[]}),r=t.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,R=>{var w;R.some(v=>v.modelId===s.value)||(s.value=((w=R[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(R=>R.modelId===s.value)??null),d=t.computed(()=>i.value?ti(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Hn(r.value)),m=R=>u.value.canon(R),p=t.computed(()=>{var R;return new Set((((R=c.value)==null?void 0:R.columns)??[]).map(w=>m(w.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function y(R){return R.physicalName&&R.physicalName!==R.field?`${R.field} (${R.physicalName})`:R.field}function b(R){return _s(R,f.value)}const g=t.computed(()=>[...Gf(f.value).filter(R=>!p.value.has(m(R.ref))).map(R=>({ref:R.ref,label:R.label,inherited:!1})),...d.value.filter(R=>!p.value.has(m(R.modelId))).map(R=>({ref:R.modelId,label:y(R),inherited:!0}))]),_=t.ref(new Set);t.watch(s,()=>_.value=new Set);function k(R){return jn(R)}function h(R,w){i.value&&o.updateIndex(i.value.modelId,R,w)}function E(){var w;if(!i.value)return;const R=Pe();o.addIndex(i.value.modelId,{modelId:R,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=R}function N(R){i.value&&o.removeIndex(i.value.modelId,R)}function C(R){c.value&&h(c.value.modelId,{parameters:R.trim()===""?void 0:R})}function A(R){const w=new Set(_.value);w.has(R)?w.delete(R):w.add(R),_.value=w}function B(){const R=c.value;if(!R||!_.value.size)return;const w=[..._.value].map(v=>({columnRef:v,descending:!1}));h(R.modelId,{columns:[...R.columns,...w]}),_.value=new Set}function $(R){const w=c.value;w&&h(w.modelId,{columns:w.columns.filter((v,I)=>I!==R)})}function x(R,w){const v=c.value;v&&h(v.modelId,{columns:v.columns.map((I,L)=>L===R?{...I,descending:w}:I)})}function S(R,w){const v=c.value;if(!v)return;const I=R+w;if(I<0||I>=v.columns.length)return;const L=[...v.columns];[L[R],L[I]]=[L[I],L[R]],h(v.modelId,{columns:L}),T(I,w)}async function T(R,w){var V,U;await t.nextTick();const v=(V=l.value)==null?void 0:V.querySelectorAll(".em-idxw__col--idx")[R];if(!v)return;const I=oe=>v.querySelector(`[data-move="${oe}"]`),L=I(w<0?"up":"down"),M=I(w<0?"down":"up");(U=L&&!L.disabled?L:M)==null||U.focus()}return(R,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",Fv,[t.createElementVNode("div",Uv,[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:E},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:I=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(I=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(I=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",Kv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",Gv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",Yv,t.toDisplayString(v.columns.length),1)],42,jv))),128))],8,Hv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",qv,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Wv,[t.createElementVNode("div",Jv,[t.createElementVNode("label",Xv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=v=>h(c.value.modelId,{name:v}))},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":w[1]||(w[1]=v=>h(c.value.modelId,{unique:v}))},null,8,["model-value"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=v=>N(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",Zv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=v=>C(v.target.value))},null,40,Qv)]),t.createElementVNode("div",eC,[t.createElementVNode("div",tC,[t.createElementVNode("div",nC,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:g.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:g.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":_.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":_.value.has(v.ref),onClick:I=>A(v.ref),onKeydown:[t.withKeys(t.withModifiers(I=>A(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(I=>A(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,aC)):t.createCommentVNode("",!0)],42,iC))),128))],8,oC),g.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",rC,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",lC,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!_.value.size,onClick:B},null,8,["caption","disabled"])]),t.createElementVNode("div",sC,[t.createElementVNode("div",cC,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,I)=>(t.openBlock(),t.createElementBlock("li",{key:I,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",dC,[t.createTextVNode(t.toDisplayString(b(v.columnRef)),1),k(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,uC)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${I}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":L=>x(I,L)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",mC,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:I===0,onClick:L=>S(I,-1)},"↑",8,fC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:I===c.value.columns.length-1,onClick:L=>S(I,1)},"↓",8,pC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:L=>$(I)},"✕",8,hC)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",yC,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",gC,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,zv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-76dd7610"]]),_C={class:"em-op-src"},kC=["placeholder"],EC={class:"em-op-src__actions"},Yf=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",_C,[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,kC),[[t.vModelText,a.value]]),t.createElementVNode("div",EC,[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"]]),NC=["disabled"],wC={class:"em-ow__toolbar"},IC={class:"em-ow__count"},vC={class:"em-ow__scroll"},CC={class:"em-ow__table"},SC={class:"c-name"},xC={class:"c-desc"},RC=["id"],AC={class:"c-pii"},$C={class:"c-src"},TC={class:"c-del"},MC={key:0},VC={colspan:"6",class:"em-ow__empty"},BC=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((_,k)=>_.order-k.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(g){return g==="none"?o.t("em.common.noneParen"):g}const u=g=>g;function m(g,_){a.value&&o.updateOperation(a.value.modelId,g.modelId,_)}function p(g,_){m(g,{description:Object.keys(_).length?_:void 0})}function f(g){return g.personalInfoAttributeType??"none"}function y(g,_){m(g,{personalInfoAttributeType:_==="none"?void 0:_})}function b(g){i.openModal({component:Yf,bind:{operationName:g.name,sourceCode:g.sourceCode??"",locale:o.uiLocale.value,onSave:_=>m(g,{sourceCode:_})}})}return(g,_)=>{var k,h;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",wC,[t.createElementVNode("span",IC,t.toDisplayString(t.unref(o).t("em.op.section",{n:((k=a.value.operations)==null?void 0:k.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:_[0]||(_[0]=E=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",vC,[t.createElementVNode("table",CC,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",SC,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),_[2]||(_[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",xC,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,RC),t.createVNode(Hf,{modelValue:l.value,"onUpdate:modelValue":_[1]||(_[1]=E=>l.value=E),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",AC,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",$C,t.toDisplayString(t.unref(o).t("em.op.body")),1),_[3]||(_[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,E=>(t.openBlock(),t.createElementBlock("tr",{key:E.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`ow-name-${E.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":E.name,"onUpdate:modelValue":N=>m(E,{name:N})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":E.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":N=>N&&m(E,{visibility:N})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(Yt,{name:`ow-desc-${E.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":E.description,"onUpdate:modelValue":N=>p(E,N)},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(E),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":N=>N&&y(E,N)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t(E.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:N=>b(E)},null,8,["caption","onClick"])]),t.createElementVNode("td",TC,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:N=>t.unref(o).removeOperation(a.value.modelId,E.modelId)},null,8,["onClick"])])]))),128)),(h=a.value.operations)!=null&&h.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",MC,[t.createElementVNode("td",VC,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,NC)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),DC={class:"em-detail__tabs"},OC=["onClick"],LC={key:0,class:"em-detail__lock"},PC=["disabled"],zC={key:0,class:"em-detail__narrow"},FC=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",DC,[(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,OC)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",LC,[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",zC,[t.createVNode(Bf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(Lv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(bC,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(BC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,PC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function lr(e,n,o){e.openModal({component:FC,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=>Sd(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 au(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 Yo(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 Oc(e,n,Pe))i.push(...sr(e,a,r,o));for(const a of ru(e,n,Pe))i.push(nn(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function UC(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 lu(e,n,r).map(l=>nn(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function qf(e,n,o){return su(e,n,o).map(i=>nn(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function HC(e,n,o){const i=new Set(o.remove);return Yo(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 Lc(e,r,Pe)){const c=i.get(l);i.set(l,c?Dc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...sr(e,r,jC(l),o));return a}function jC(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 Wf(e){return fn(e).map(n=>({...n.col,modelId:Pe()}))}function KC(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(_=>_.modelId===p.embedded.associationRef);if(!f)continue;const y=f.end1.entityRef===m.modelId,b=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:b.multiplicity,navigable:b.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=ri(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=HC(l,n,s);return i.push(...Mi(d,n,c)),i.push(...Wt(e,c)),i}function GC(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 E;return((E=h.embedded)==null?void 0:E.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 b=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:b,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(tn(c,g));const _=l?"end2":"end1",k=l?"end1":"end2";i.push(Na(r.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Pe()},[k]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Jf(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=[wd(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 p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(Pd(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 YC(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=ri(p,s,Pe),y=f.add[0];y&&(m.end2.attributeRef=y.modelId);const b={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},g=Ea(m,b),_=sr(p,s,f,[]);return i(_.length?rt("관계 추가",[g,..._]):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=Wf(d),b=C=>C&&C.charAt(0).toLowerCase()+C.slice(1),g=new Set(c.attributes.map(C=>C.name)),_=b(d.name);let k=_;for(let C=2;g.has(k);C++)k=`${_}${C}`;const h={modelId:m,name:k,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},E={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},N={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(rt("임베드 추가",[tn(l,h),Ea(E,N)])),u},setEmbedCardinality(l,s){var _;if(r(l))return;const c=n.logical.associations.find(k=>k.modelId===l);if(!c)return;let d,u;for(const k of n.logical.entities){const h=k.attributes.find(E=>{var N;return((N=E.embedded)==null?void 0:N.associationRef)===l&&E.attrType==="EMBED_OWN"});if(h){d=k.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=k=>k==="ZERO_OR_MORE_INSTANCES"||k==="ONE_OR_MORE_INSTANCES",b=y(f.multiplicity),g=y(s);if(b===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:((_=f.jpa)==null?void 0:_.collectionType)??"LIST"}})]));else{const k=n.logical.entities.find(h=>h.modelId===m);if(!k)return;i(rt("임베드 단일 전환",[nn(d,u.modelId,{dbAttrs:Wf(k)}),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=Vd(l);if(!s){i(c);return}for(const f of n.logical.entities){const y=f.attributes.find(b=>{var g;return((g=b.embedded)==null?void 0:g.associationRef)===l});if(y){const b=[];i(rt("임베드 삭제",[c,...Nn(f.modelId,[y.modelId],b),...Wt(n.logical,b)]));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(b=>b.modelId===s.end1.entityRef),y=f==null?void 0:f.attributes.find(b=>b.modelId===s.end1.attributeRef&&b.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),b=wo(y,new Set(u.attributes.map(h=>h.name))),g=Pe(),_=zt(u.attributes),k={modelId:g,name:b,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:_,dbAttrs:[]};i(rt("inverse nav 추가",[tn(d.end1.entityRef,k),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(k=>k.modelId===f&&k.attrType==="RELATION_REF"),b=Ht(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),g=[],_=y?Nn(d.end1.entityRef,[f],g):[];i(y?rt("inverse nav 제거",[..._,b,...Wt(n.logical,g)]):b);return}}}i(Ht(l,s,c))}}}function qC(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=Yo(n.logical,u,_=>_.map(k=>k.modelId===m?{...k,...p}:k)),b=[],g=Mi(y,u,b);g.push(...Wt(n.logical,b)),i(g.length?rt("속성 수정",[f,...g]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(k=>k.type===m),f=n.logical.entities.find(k=>k.modelId===u);if(!p||!f)return null;const y=zt(f.attributes),b=Pe(),g=p.fields.map(()=>({modelId:Pe(),physicalName:"",dataType:""})),_={modelId:b,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(N=>N.modelId===u),f=p?zt(p.attributes):0,y=m.modelId??Pe(),b=m.name??`field${f}`,g={modelId:y,name:b,type:m.type??Gr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Pe(),physicalName:b,dataType:"VARCHAR"}],...m},_=tn(u,g),k=Yo(n.logical,u,N=>[...N,g]),h=[],E=Mi(k,u,h);return E.push(...Wt(n.logical,h)),i(E.length?rt("속성 추가",[_,...E]):_),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(b=>b.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 k,h;if(a(u))return;const f=nn(u,m,{dbAttrs:p}),y=(k=n.logical.entities.find(E=>E.modelId===u))==null?void 0:k.attributes.find(E=>E.modelId===m),b=(h=y==null?void 0:y.embedded)==null?void 0:h.associationRef,g=b?n.logical.associations.find(E=>E.modelId===b):void 0,_=[];g&&b&&(g.end1.legacyEmbedRaw&&_.push(Ht(b,"end1",{legacyEmbedRaw:void 0})),g.end2.legacyEmbedRaw&&_.push(Ht(b,"end2",{legacyEmbedRaw:void 0}))),i(_.length?rt("임베드 컬럼 수정",[f,..._]):f)},removeAttribute(u,m){if(a(u))return;if(xo(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=Nn(u,[m],p),y=Yo(n.logical,u,_=>_.filter(k=>k.modelId!==m)),b=[...Mi(y,u,p),...Wt(n.logical,p),...qf(n.logical,u,[m])],g=[...f,...b];i(g.length===1?g[0]:rt("속성 삭제",g))},removeAttributes(u,m){var k;if(!m.length||a(u))return;const p=m.filter(h=>!xo(n.logical,u,h));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],y=Nn(u,p,f),b=new Set(p),g=Yo(n.logical,u,h=>h.filter(E=>!b.has(E.modelId))),_=[...y,...Mi(g,u,f),...Wt(n.logical,f),...qf(n.logical,u,p)];i(_.length===1?_[0]:rt("속성 삭제",_)),((k=c.value)==null?void 0:k.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=UC(n.logical,u,m,p);i(y.length?rt("속성 재정렬",[f,...y]):f)}}}function WC(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 JC=220;function XC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||JC));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 ks=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function ZC(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const b=c.filter(g=>n.logical.entities.some(_=>_.modelId===g));if(b.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:b}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const b=n.logical.entities.find(_=>_.modelId===d.entityId);if(!b)return;const g=[...b.attributes].sort((_,k)=>_.order-k.order).filter(_=>d.ids.includes(_.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(b=>b.modelId===u),p=n.layout.entityLayouts.find(b=>b.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:b,geo:g,locked:_,...k}=p;Object.keys(k).length&&(y=k)}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(E=>E.modelId===f);if(!y)return[];const b=new Set(y.attributes.map(E=>E.name)),g=new Set(y.attributes.flatMap(E=>E.dbAttrs.map(N=>N.physicalName))),_=zt(y.attributes),k=[],h=c.attributes.map((E,N)=>{const C=JSON.parse(JSON.stringify(E));C.modelId=Pe();for(const A of C.dbAttrs)A.modelId=Pe();b.has(C.name)&&(C.name=wo(`${C.name}_copy`,b)),b.add(C.name);for(const A of C.dbAttrs)A.physicalName&&g.has(A.physicalName)&&(A.physicalName=wo(`${A.physicalName}_copy`,g)),A.physicalName&&g.add(A.physicalName);return C.order=_+N,k.push(C.modelId),tn(f,C)});return l(h.length===1?h[0]:rt("속성 붙여넣기",h)),i.value={kind:"attribute",entityId:f,ids:k,anchor:k[k.length-1]},[]}const{clone:d,idMap:u}=WC(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=b=>u.get(b);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=ad(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"?XC(n.layout,m.layout):p.offset,y=new Map(m.layout.entityLayouts.map(h=>[h.entityRef,h])),b=new Map(m.layout.associationLayouts.map(h=>[h.associationRef,h])),g=new Map(m.layout.groupLayouts.map(h=>[h.groupRef,h])),_=[];let k=80;for(const h of m.logical.entities){const E=y.get(h.modelId),N=E?{location:ks(E.geo.location,f),size:{...E.geo.size}}:{location:{x:k+=40,y:80},size:{width:220,height:140}};let C;if(E){const{entityRef:A,geo:B,locked:$,...x}=E;C=x}_.push(ga(h,N,C))}for(const h of m.logical.associations){const E=b.get(h.modelId),N=E?{...E,waypoints:E.waypoints.map(C=>ks(C,f))}:{associationRef:h.modelId,waypoints:[]};_.push(Ea(h,N))}for(const h of m.logical.groups){const E=g.get(h.modelId),N=E?{location:ks(E.geo.location,f),size:{...E.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let C;if(E){const{groupRef:A,geo:B,locked:$,memberNoteRefs:x,...S}=E;C=S}_.push(_a(h,N,C))}return l(rt("다이어그램 가져오기",_)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(h=>h.modelId)}};return s}function QC(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(hd(s,c))},updateEntity(s,c){if(a(s))return;const d=pd(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=Yo({...n.logical,entities:n.logical.entities.map(h=>h.modelId===s?{...h,stereotype:"JPA_EMBEDDABLE"}:h)},s,h=>h.map(E=>E.identifier&&!E.derivedFrom?{...E,identifier:!1}:E)),b=[],g=cr(y,[s],b);g.push(...Wt(n.logical,b));const _=GC(n.logical,s),k=[d,...f,...g,..._];i(k.length>1?rt("임베더블 변환",k):d);return}if(p){const f=KC(n.logical,s),y=[d,...f];i(y.length>1?rt("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(Vo(s,c))},resizeEntity(s,c){a(s)||i(yd(s,c))},removeEntity(s){if(a(s))return;const c=fd(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 _ of g.attributes)_.embedded&&m.has(_.embedded.associationRef)&&p.push(...Nn(g.modelId,[_.modelId],f));for(const g of u){if(g.end1.entityRef===s||!g.end1.attributeRef)continue;const _=n.logical.entities.find(h=>h.modelId===g.end1.entityRef),k=_==null?void 0:_.attributes.find(h=>h.modelId===g.end1.attributeRef&&h.attrType==="RELATION_REF");k&&p.push(...Nn(_.modelId,[k.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))},b=new Set(u.filter(g=>g.end1.entityRef===s&&g.end2.entityRef!==s).map(g=>g.end2.entityRef));p.push(...cr(y,[...b],f)),p.push(...Wt(n.logical,f.filter(g=>g.entityId!==s))),i(p.length?rt("엔티티 삭제",[c,...p]):c)},setEntitySwatch(s,c){i(gd(s,c))},setEntityCollapsed(s,c){i(bd(s,c))},setEntityLocked(s,c){i(_d(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(kl(!0))},expandAll(){i(kl(!1))}}}function eS(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(_=>n.layout.entityLayouts.find(k=>k.entityRef===_)).filter(_=>!!_);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 _ of u){const k=_.geo.size.width||220,h=_.geo.size.height||140;m=Math.min(m,_.geo.location.x),p=Math.min(p,_.geo.location.y),f=Math.max(f,_.geo.location.x+k),y=Math.max(y,_.geo.location.y+h)}const b=40,g=28;return{location:{x:m-b,y:p-b-g},size:{width:f-m+b*2,height:y-p+b*2+g}}}return{dragGroup(d,u,m){l(d)||i(rt("그룹 이동",Jf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Id(d,u))},setGroupSwatch(d,u){i(vd(d,u))},setGroupLocked(d,u){i(Cd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(kd(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const b of d)y.memberEntityRefs.includes(b)&&m.push(ka(y.modelId,b));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(Ed(d))},dropEntity(d,u,m){var y;if(r(d))return;const p=((y=n.logical.groups.find(b=>b.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,f=[Vo(d,u)];p!==m&&(p&&f.push(ka(p,d)),m&&f.push(Nd(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(b=>{var g;return(g=b.memberNoteRefs)==null?void 0:g.includes(d)}))==null?void 0:y.groupRef)??null,f=[mi(d,u)];p!==m&&(p&&f.push(qd(p,d)),m&&f.push(Yd(m,d))),i(rt("이동",f))}}}function tS(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(b,g){if(d(),!o.value||!e.opTransport)return;const _=new nu({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:k=>{i.value=!1,a.value=k},onError:e.onOpError});_.seed((g==null?void 0:g.revSeed)??{}),c=_.attach(b),s=_}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(b){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let g;try{g=await l(b)}catch(_){return{ok:!1,reason:_ instanceof Error?_.message:String(_)}}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 nS(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(Ud({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(Hd(i))},moveNote(i,a){o(mi(i,a))},resizeNote(i,a){o(jd(i,a))},setNoteMemo(i,a){o(Kd(i,a))},setNoteSwatch(i,a){o(Gd(i,a))},addNoteConnection(i,a){o(Wd(i,a))},removeNoteConnection(i,a){o(Jd(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Xd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Zd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Qd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(eu(i,a))}}}function oS(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const E=p.ids.includes(u),N=E?p.ids.filter(A=>A!==u):[...p.ids,u];if(!N.length){o.value=null;return}const C=E&&p.anchor===u?N[N.length-1]:E?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:N,anchor:C};return}const y=n.logical.entities.find(E=>E.modelId===d),b=[...(y==null?void 0:y.attributes)??[]].sort((E,N)=>E.order-N.order).map(E=>E.modelId),g=b.indexOf(p.anchor),_=b.indexOf(u);if(g<0||_<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[k,h]=g<=_?[g,_]:[_,g];o.value={kind:"attribute",entityId:d,ids:b.slice(k,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(b=>b.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(b=>b.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(E=>E.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),y=p.map((E,N)=>f.has(E.modelId)?N:-1).filter(E=>E>=0);if(!y.length)return!1;const b=Math.min(...y),g=p.filter(E=>!f.has(E.modelId)),_=p.slice(0,b).filter(E=>!f.has(E.modelId)).length;let k;if(d<0){if(_<=0)return!0;k=_-1}else{if(g.length-_<=0)return!0;k=_+1}if(r(u.entityId))return!0;const h=p.filter(E=>f.has(E.modelId)).map(E=>E.modelId);return a(El(u.entityId,h,k)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(k=>k.modelId)),f=new Set(n.logical.groups.map(k=>k.modelId)),y=new Set(n.layout.notes.map(k=>k.modelId)),b=new Set;for(const k of d){if(!f.has(k))continue;const h=n.logical.groups.find(E=>E.modelId===k);for(const E of(h==null?void 0:h.memberEntityRefs)??[])b.add(E)}const g=[],_=[];for(const k of d)if(f.has(k)){if(s(k))continue;const h=n.layout.groupLayouts.find(A=>A.groupRef===k);if(!h)continue;const E=n.logical.groups.find(A=>A.modelId===k),N=((E==null?void 0:E.memberEntityRefs)??[]).map(A=>{var $;const B=(($=n.layout.entityLayouts.find(x=>x.entityRef===A))==null?void 0:$.geo.location)??{x:0,y:0};return{id:A,location:{x:B.x+u,y:B.y+m}}}),C={x:h.geo.location.x+u,y:h.geo.location.y+m};g.push(rt("그룹 이동",Jf(n,k,C,N))),_.push("g:"+k)}else if(p.has(k)){if(b.has(k)||l(k))continue;const h=n.layout.entityLayouts.find(E=>E.entityRef===k);if(!h)continue;g.push(Vo(k,{x:h.geo.location.x+u,y:h.geo.location.y+m})),_.push("e:"+k)}else if(y.has(k)){const h=n.layout.notes.find(E=>E.modelId===k);if(!h)continue;g.push(mi(k,{x:h.geo.location.x+u,y:h.geo.location.y+m})),_.push("n:"+k)}return g.length?(a(rt("이동",g,"nudge:"+_.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const po=Symbol("editorController");function Xf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function iS(e=Xf(),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),b=t.ref(n.flagEntitiesWithoutRelations??!1),g=t.ref(!1),_=t.ref(!1),k=t.ref(!1),h=t.ref(0),E=t.ref(null);let N=0;const C=J=>{if(n.onNotice){n.onNotice(J);return}E.value={text:J,id:++N}},A=t.ref(((Se=n.meta)==null?void 0:Se.schemaVersion)??1),B=t.ref(((je=n.meta)==null?void 0:je.opWriteEnabled)??!1),$=t.ref(((Ze=n.meta)==null?void 0:Ze.referenceOnly)??!1),x=t.computed(()=>A.value>=2&&B.value),S=t.ref(!(A.value>=2&&B.value===!1)),T=t.ref("LOGICAL_PHYSICAL"),R=t.ref("straight"),w=t.ref(!0),v=t.ref(!0),I=t.ref(null),L=t.computed(()=>{var J;return((J=I.value)==null?void 0:J.kind)==="attribute"?{entityId:I.value.entityId,attrId:I.value.anchor}:null}),M=t.computed(()=>{var J;return((J=I.value)==null?void 0:J.kind)==="attribute"?I.value.ids:[]}),V=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}),U=t.ref(null),oe=t.ref(null),ue=t.ref(null),be=t.ref(null),pe=tS({state:o,opMode:x,editable:S,opConflict:ue,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function he(){i.onChange(()=>{g.value=i.canUndo,_.value=i.canRedo,k.value=i.isDirty,h.value++})}he(),pe.setupOpAdapter(i,n.meta);const _e=t.computed(()=>qs(o.logical,o.layout)),ye=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:b.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,O=J=>{const re=Date.now();re-(P.get(J)??0)<me||(P.set(J,re),C(J))},z=J=>{if(!be.value){if(!S.value){O(m("em.notice.readOnly"));return}try{i.execute(J)}catch(re){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${J.label}):`,re),S.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)?(O(m("em.notice.entityLocked")),!0):!1,xe=J=>ee(J)?(O(m("em.notice.groupLocked")),!0):!1,Ce=J=>we(J)?(O(m("em.notice.assocLocked")),!0):!1,Y=ZC({state:o,clipboard:oe,selection:I,inspectedEntityId:V,editable:S,run:z}),X=oS({state:o,selection:I,focusRequest:U,run:z,gateEntityLocked:de,isEntityLockedFn:Q,isGroupLockedFn:ee}),q=QC({state:o,editable:S,run:z,gateEntityLocked:de,isEntityLockedFn:Q,isAssocLockedFn:we}),Ie=qC({state:o,editable:S,run:z,gateEntityLocked:de,embeddableCatalog:a,t:m,emitGateNotice:O,selection:I}),Be=eS({state:o,editable:S,run:z,selection:I,gateEntityLocked:de,gateGroupLocked:xe,isGroupLockedFn:ee}),ze=nS({editable:S,run:z}),Ue=YC({state:o,editable:S,run:z,gateEntityLocked:de,gateAssocLocked:Ce});return{state:o,resolved:_e,issues:se,issuesByRef:ae,flagEntitiesWithoutRelations:b,canUndo:g,canRedo:_,dirty:k,revision:h,notice:E,editable:S,schemaVersion:A,opWriteEnabled:B,opMode:x,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:R,showGrid:w,showMinimap:v,selection:I,selectedAttr:L,selectedAttrIds:M,inspectedEntityId:V,focusRequest:U,clipboard:oe,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:$,uiLocale:u,t:m,selectableDataTypes:f,setEditable(J){S.value=J&&x.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(!S.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:()=>{S.value&&i.undo()},redo:()=>{S.value&&i.redo()},markSaved:()=>{S.value&&(pe.flush(),i.markSavePoint())},loadDiagram(J,re){pe.teardownOpAdapter(),o.logical=J.logical,o.layout=J.layout,i=new _l(o),he(),A.value=(re==null?void 0:re.schemaVersion)??1,B.value=(re==null?void 0:re.opWriteEnabled)??!1,$.value=(re==null?void 0:re.referenceOnly)??!1,S.value=!(A.value>=2&&B.value===!1),ue.value=null,be.value=null,I.value=null,g.value=i.canUndo,_.value=i.canRedo,k.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(Bd(J,re))},updateIndex(J,re,Ke){de(J)||z(wa(J,re,Ke))},removeIndex(J,re){de(J)||z(Dd(J,re))},addOperation(J,re={}){if(!S.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(Rd(J,nt)),qe},updateOperation(J,re,Ke){de(J)||z(Ad(J,re,Ke))},removeOperation(J,re){de(J)||z($d(J,re))},reorderOperations(J,re,Ke){!re.length||de(J)||z(Td(J,re,Ke))},setOperationSwatch(J,re,Ke){z(Md(J,re,Ke))},addAssociation:Ue.addAssociation,addEmbedAssociation:Ue.addEmbedAssociation,setEmbedCardinality:Ue.setEmbedCardinality,removeAssociation:Ue.removeAssociation,setAssociationIdentifying:Ue.setAssociationIdentifying,updateAssociationEnd:Ue.updateAssociationEnd,hasQuickFix(J){if(!S.value)return!1;const re=ol(J,o.logical);return re?re.kind==="setEndCascades"?!we(re.assocRef):!Q(re.entityRef):!1},applyQuickFix(J){if(!S.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(Od(J,re,Ke))},addWaypoint(J,re,Ke){z(Fd(J,re,Ke))},removeWaypoint(J,re){z(Ld(J,re))},clearWaypoints(J){z(zd(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=Ws(o.logical,o.layout);J.length&&z(rt("자동 배치",J.map(re=>Vo(re.id,re.location))))},copy:Y.copy,paste:Y.paste,importEntities:Y.importEntities}}const dr=Symbol("groupHover"),Zf=Symbol("groupDrag"),qo=Symbol("relationHighlight"),Qf=Symbol("diffOverlay"),ep=Symbol("nodeInternals"),tp=Symbol("columnResolution");function aS(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 np(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!aS(e[o],n[o]))return!1;return!0}function op(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(!np(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function rS(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function lS(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||!rS(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!op(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!np(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!!sS(e.classRows,n.classRows)}function sS(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&&!op(i.attr,a.attr))return!1}return!0}function cS(){let e;return(n,o)=>e=dS(n,o,e)}function dS(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=Eo($n(s,i)));for(const k of s.attributes){if(Wi(k)){const C=k.dbAttrs[0];if(!(C!=null&&C.physicalName&&(C!=null&&C.dataType))){const A=Kn(k,s,i,e.associations);A&&c.set(k.modelId,{...k,dbAttrs:[{...C,physicalName:(C==null?void 0:C.physicalName)||A.physicalName,dataType:(C==null?void 0:C.dataType)||A.dataType,length:(C==null?void 0:C.length)??A.length,scale:(C==null?void 0:C.scale)??A.scale},...k.dbAttrs.slice(1)]})}}if(k.identifier&&k.attrType==="RELATION_OWN"){const C=xo(e,s.modelId,k.modelId);if(C&&ma(k,C)){const A=c.get(k.modelId)??k,B=k.derivedIdFieldName||rl({...k,derivedIdFieldName:void 0},C,l());B&&c.set(k.modelId,{...A,derivedIdFieldName:B})}}const h=na(k,e.associations);if(h&&u.set(k.modelId,h),mn(k)){d.set(k.modelId,k.dbAttrs.map((C,A)=>{const B=Kn(k,s,i,e.associations,A);return B?{...C,physicalName:C.physicalName||B.physicalName,dataType:C.dataType||B.dataType,length:C.length??B.length,scale:C.scale??B.scale}:C}));continue}if(!k.attrType.startsWith("EMBED")||k.dbAttrs.length===0)continue;if(k.attrType!=="EMBED_PREDEF"){const C=p();d.set(k.modelId,k.dbAttrs.map((A,B)=>{const $=Gn(A,C);return $?{...A,physicalName:$.physicalName}:pn(k,A,B,s,e)}));continue}const E=n==null?void 0:n.find(C=>C.type===k.type);if(!E)continue;const N=p();d.set(k.modelId,k.dbAttrs.map((C,A)=>{const B=E.fields[A],$=Gn(C,N);return $?{...C,physicalName:$.physicalName,logicalName:C.logicalName??(B==null?void 0:B.logicalName),dataType:C.dataType||(B==null?void 0:B.dataType)||""}:B?{...C,physicalName:C.physicalName||B.physicalName,logicalName:C.logicalName??B.logicalName,dataType:C.dataType||B.dataType,length:C.length??B.length}:C}))}const f=new Map,y=new Map;for(const k of s.attributes){const h=d.get(k.modelId);if(h)for(let E=0;E<h.length;E++){const N=`${k.attrType}\0${k.type??""}\0${E}`,C={attrId:k.modelId,slot:E,name:h[E].physicalName??""},A=y.get(N);A?A.push(C):y.set(N,[C])}}for(const k of y.values()){if(k.length<2)continue;const h=new Map;for(const E of k)h.set(E.name,(h.get(E.name)??0)+1);for(const E of k){if((h.get(E.name)??0)<2)continue;const N=f.get(E.attrId);N?N.add(E.slot):f.set(E.attrId,new Set([E.slot]))}}const b=ll(s,e).fields.map(k=>{var h;return{attr:k.attr,synthetic:k.synthetic,sourceAttrId:k.sourceAttr.modelId,targetName:(h=k.target)==null?void 0:h.name,collection:k.collection}}),g={effectiveAttrs:c,embedCols:d,collectionTypes:u,redundantSlots:f,classRows:b},_=o==null?void 0:o.get(s.modelId);a.set(s.modelId,_&&lS(g,_)?_:g)}return a}const ip=Symbol("embedSlotCollapse"),ap=(e,n)=>`${e}:${n}`,rp="all:",lp="one:",sp="fk:",cp=e=>`${rp}${e}`,uS=(e,n)=>`${lp}${e}:${n}`,mS=(e,n)=>`${sp}${e}:${n}`,fS=e=>e.startsWith(sp)||!e.startsWith(rp)&&!e.startsWith(lp),pS=["title"],hS={key:0,class:"em-sel","aria-hidden":"true"},yS=["title","aria-expanded","disabled"],gS={class:"em-entity__stereotype"},bS={key:1,class:"em-entity__name"},_S=["title","aria-expanded"],kS={"aria-hidden":"true"},ES=["data-attr","title","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],NS=["onPointerdown"],wS={key:1,class:"em-entity__divider-label"},IS=["title"],vS={class:"em-key-slot"},CS={class:"em-key-slot"},SS=["title","aria-expanded","onClick"],xS=["title","onClick"],RS=["title","aria-expanded","onClick"],AS={key:2,class:"em-entity__type"},$S=["onClick"],TS={class:"em-entity__attrname"},MS={class:"em-entity__type"},VS={key:1,class:"em-entity__embed-summary"},BS=["title"],DS=["data-op"],OS=["onPointerdown"],LS={class:"em-entity__op-vis","aria-hidden":"true"},PS=["title"],zS={key:4,class:"em-entity__footer"},dp=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(qo,null),d=t.inject(Qf,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(tp,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(ip,void 0),y=t.inject(ep,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const b=t.computed(()=>!!o&&o.editable.value);function g(){s&&(s.value=n.data.groupRef??null)}function _(){c==null||c.setEntityHover(n.id)}function k(){c==null||c.setEntityHover(null)}const h=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),E=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!h.value),N=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&&!N.value),A=t.computed(()=>{var G;return o&&((G=o.selectedAttr.value)==null?void 0:G.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),B=t.computed(()=>A.value.size>0);function $(G,W){const ve=W.shiftKey?"range":W.metaKey||W.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,L(G),ve)}const x=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!N.value),S=t.computed(()=>n.data.entity),T=t.computed(()=>Jh(S.value,o==null?void 0:o.referenceOnlyDocument.value)),R=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>{var G;if(R.value==="CLASS"){const W=(G=p.value)==null?void 0:G.classRows;if(W)return W.map(ve=>ve.attr)}return[...S.value.attributes].sort((W,ve)=>W.order-ve.order)}),v=t.computed(()=>{var W;const G=R.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 L(G){return U.value.get(G.modelId)??G.modelId}function M(G){return A.value.has(L(G))}function V(G){var W;return!!((W=u.value)!=null&&W.changedAttributeIds.has(L(G)))}const U=t.computed(()=>{var W;const G=new Map;if(R.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=R.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(()=>b.value&&!be.value);function he(){b.value&&(o==null||o.setEntityCollapsed(n.id,!ue.value))}const _e=t.computed(()=>R.value==="PHYSICAL"||R.value==="LOGICAL_PHYSICAL"),ye=t.computed(()=>{const G=R.value==="PHYSICAL"||R.value==="LOGICAL_PHYSICAL",W={};for(const ve of w.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(()=>[...S.value.operations??[]].sort((G,W)=>G.order-W.order)),ae=t.computed(()=>R.value==="CLASS"&&ne.value.length>0),me={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function P(G){return G?me[G]:"~"}function O(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(R.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 R.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)?mS(n.id,G.modelId):uS(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(cp(n.id)))??!1),ze=t.computed(()=>Be.value&&_e.value?w.value.reduce((G,W)=>Ce(W)?G+q(W).length:G,0):0),Ue=t.computed(()=>w.value.some(G=>Ce(G)));function ie(G){const W=Ie(G);return!W||W.size===0?!1:f?f.isCollapsed(ap(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(ap(n.id,G.modelId))}function qe(G){f==null||f.toggle(Y(G))}function nt(){f==null||f.toggle(cp(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(R.value,Q(G),ve,W==null?void 0:W.targetName)}const le=t.computed(()=>{const G={};for(const W of w.value)G[W.modelId]=K(W);return G}),Re=t.computed(()=>{var G,W,ve;return z(S.value.name,(W=(G=S.value.table)==null?void 0:G.logicalName)==null?void 0:W[a.value],((ve=S.value.table)==null?void 0:ve.physicalName)??"")}),ke=t.ref(!1),H=t.ref(""),bt=t.ref(null);async function vt(){var G,W;pe.value&&(H.value=S.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=H.value.trim();G&&G!==S.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),D=t.ref(null);function F(G,W){if(!pe.value)return;W.stopPropagation(),W.preventDefault();const ve=A.value,$e=ve.has(G.modelId)?new Set(ve):new Set([G.modelId]);D.value={ids:$e,dropIndex:-1,lineY:0},W.target.setPointerCapture(W.pointerId)}function j(G){if(!D.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;D.value={...D.value,dropIndex:ve,lineY:Ee}}function fe(){const G=D.value;if(D.value=null,!G||G.dropIndex<0)return;const W=w.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(){D.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":E.value,"is-dimmed":x.value,"is-selected":N.value,"is-multi-selected":C.value,"has-focused-attr":B.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:_,onMouseleave:k,onDblclick:l},[N.value?(t.openBlock(),t.createElementBlock("div",hS,[...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:!b.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,yS),t.createElementVNode("span",gS,"«"+t.toDisplayString(t.unref(ni)(S.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=>H.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,H.value]]):(t.openBlock(),t.createElementBlock("span",bS,[(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",kS,t.toDisplayString(Be.value?"▸":"▾"),1)],40,_S)):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"},[D.value&&D.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${D.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.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":M(Ee),"is-dragging":(Qe=D.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":V(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,NS)):t.createCommentVNode("",!0),X(Ee)?(t.openBlock(),t.createElementBlock("span",wS,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",vS,[(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",CS,[_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,SS)):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,IS),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,xS)):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,RS)):t.createCommentVNode("",!0),le.value[Ee.modelId]?(t.openBlock(),t.createElementBlock("span",AS,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,ES),(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":M(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",TS,[(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",MS,t.toDisplayString(pt.dataType),1)],10,$S))),128))],64)}),128)),ze.value?(t.openBlock(),t.createElementBlock("li",VS,[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,BS)])):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,OS)):t.createCommentVNode("",!0),t.createElementVNode("span",LS,t.toDisplayString(P(Ee.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:O(Ee)})},t.toDisplayString(Ee.name)+"()",5)],10,DS)}),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,PS)):t.createCommentVNode("",!0),pe.value?(t.openBlock(),t.createElementBlock("footer",zS,[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,pS)}}}),[["__scopeId","data-v-79399400"]]),FS={key:0,class:"em-sel","aria-hidden":"true"},US={class:"em-group__label"},HS={class:"em-group__name"},jS={key:0,class:"em-group__pkg"},KS={key:1,class:"em-group__flag"},up=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=(S,T)=>l?l.t(S,T):qt("ko",S,T),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var S;return!!n.id&&((S=l==null?void 0:l.selection.value)==null?void 0:S.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(qo,null);function y(){n.id&&(f==null||f.setGroupHover(n.id))}function b(){f==null||f.setGroupHover(null)}const g=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),_=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:k,findNode:h}=et();let E=null,N=null;function C(S){var w;if(!n.id||!c.value)return;S.stopPropagation();const T=((w=h(n.id))==null?void 0:w.dimensions)??{width:400,height:300},R=k({x:S.clientX,y:S.clientY});E={fx:R.x,fy:R.y,w:T.width,h:T.height},S.target.setPointerCapture(S.pointerId)}function A(S){if(!E||!n.id)return;const T=k({x:S.clientX,y:S.clientY});N={width:Math.max(160,E.w+(T.x-E.fx)),height:Math.max(120,E.h+(T.y-E.fy))};const R=h(n.id);R&&(R.style={width:`${N.width}px`,height:`${N.height}px`})}function B(S){var T,R;E&&N&&n.id&&l&&l.resizeGroup(n.id,N),E=null,N=null,(R=(T=S.target).releasePointerCapture)==null||R.call(T,S.pointerId)}const $=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),x=t.computed(()=>{const S=o.value.name;return(S==null?void 0:S[$.value])||(S==null?void 0:S.ko)||(S==null?void 0:S.en)||(S==null?void 0:S.ja)||(S==null?void 0:S.zh)||o.value.packageName||s("em.group.fallback")});return(S,T)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":g.value,"is-dimmed":_.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:b},[d.value?(t.openBlock(),t.createElementBlock("div",FS,[...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",US,[t.createElementVNode("span",HS,t.toDisplayString(x.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",jS,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",KS,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:A,onPointerup:B},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),GS={key:0,class:"em-sel","aria-hidden":"true"},YS={key:2,class:"em-note__text"},mp=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(qo,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 w;return((w=a==null?void 0:a.source.value)==null?void 0:w.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),y=t.computed(()=>{var w;return((w=o==null?void 0:o.selection.value)==null?void 0:w.kind)==="note"&&o.selection.value.id===n.id}),b=t.computed(()=>!!n.selected&&!y.value),g=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),_=[{id:"n-top",pos:De.Top},{id:"n-right",pos:De.Right},{id:"n-bottom",pos:De.Bottom},{id:"n-left",pos:De.Left}],k=t.ref(!1),h=t.ref(""),E=t.ref(null);async function N(){var w;l.value&&(h.value=r.value.memo,k.value=!0,await t.nextTick(),(w=E.value)==null||w.focus())}function C(){k.value&&(k.value=!1,h.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,h.value)))}const{screenToFlowCoordinate:A,findNode:B}=et();let $=null,x=null;function S(w){var L;if(!l.value)return;w.stopPropagation();const v=((L=B(n.id))==null?void 0:L.dimensions)??r.value.geo.size,I=A({x:w.clientX,y:w.clientY});$={fx:I.x,fy:I.y,w:v.width,h:v.height},w.target.setPointerCapture(w.pointerId)}function T(w){if(!$)return;const v=A({x:w.clientX,y:w.clientY});x={width:Math.max(140,$.w+(v.x-$.fx)),height:Math.max(60,$.h+(v.y-$.fy))};const I=B(n.id);I&&(I.style={width:`${x.width}px`,height:`${x.height}px`})}function R(w){var v,I;$&&x&&o&&o.resizeNote(n.id,x),$=null,x=null,(I=(v=w.target).releasePointerCapture)==null||I.call(v,w.pointerId)}return(w,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":b.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:N,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",GS,[...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),k.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:E,"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=>k.value=!1,["esc"])),onPointerdown:v[2]||(v[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,h.value]]):(t.openBlock(),t.createElementBlock("div",YS,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(_,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&&!k.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:S,onPointermove:T,onPointerup:R},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 Wo=.5;function fp(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,_)=>{(Math.abs(g.x-p.x)>=Wo||Math.abs(g.y-p.y)>=Wo)&&(m.push({a:p,b:g,seg:_}),p=g)};f(c,0);let y=l.x!==0,b=c;for(let g=1;g<u.length;g++){const _=u[g],k=g<=o.length?g-1:o.length,h=Math.abs(_.x-b.x)<Wo,E=Math.abs(_.y-b.y)<Wo;h&&E||(h?(f(_,k),y=!1):E?(f(_,k),y=!0):y?(f({x:b.x,y:_.y},k),f(_,k),y=!0):(f({x:_.x,y:b.y},k),f(_,k),y=!1),b=_)}return f(i,o.length),m}function pp(e,n,o,i,a,r=20){const l=fp(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 qS=14;function hp(e,n,o,i,a,r=20){return fp(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=qS).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 WS=36;function JS(e,n,o=WS){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 yp(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 XS(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function gp(e,n){const o=XS(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Wo&&Math.abs(l)<Wo)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 bp(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 _p(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 ZS=20,QS=22,ex=7,tx=22,kp=31,Ep=7,nx=20,Np=11,wp=11,ox=kp+Ep;function ix(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function ax(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 Ip(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 vp(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Ip(e,n);return[fr(o,a,r-Math.PI/2),fr(o,a,r+Math.PI/2)]}function Cp(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 Sp(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,ZS),[d,u]=vp(e,n,c,QS);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}),ix(o.multiplicity)){const m=mr(e,n,kp);r.push({cx:m.x,cy:m.y,r:Ep})}if(ax(o.multiplicity)){const m=mr(e,n,ex),[p,f]=vp(e,n,m,tx);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,nx),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Ip(e,n),m=fr(d,Np/2,u-Math.PI/2),p=fr(d,Np/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=Cp(s,c,wp,!0),u=Cp(s,c,wp,!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 xp=200,Rp=120,Es=24;function Ap(e){var a,r;if(!e)return{x:0,y:0,width:xp,height:Rp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||xp,i=((r=e.dimensions)==null?void 0:r.height)||Rp;return{x:n.x,y:n.y,width:o,height:i}}function $p(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Tp(e){const n=t.computed(()=>Ap(e.sourceNode())),o=t.computed(()=>Ap(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)<Es){const b=(m+p)/2;m=b-Es/2,p=b+Es/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??$p(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??$p(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?bp(n.value,d,r.value.x):gp(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?bp(o.value,d,l.value.x):gp(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const Ns=Symbol("waypointController"),rx=["d"],lx=["d"],sx=["d"],cx=["x1","y1","x2","y2"],dx=["cx","cy","r"],ux=["x","y"],mx=["x","y"],fx=["cx","cy","onDblclick"],px=["x","y","onPointerdown","onDblclick"],Mp=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(Ns),a=t.inject(po,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Zf,null),s=t.inject(qo,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=O=>{var z;return(z=ae.find(Q=>Q.entity.modelId===O))==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}),b=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)}),_=t.computed(()=>{var ne;return!!((ne=n.targetNode.data)!=null&&ne.collapsed)}),{source:k,target:h,sourceSide:E,targetSide:N,isSelf:C}=Tp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>b.value,sourceRowY:()=>n.data.sourceColumnRef&&!g.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!_.value?n.targetY:void 0}),A=ox+4,B=t.computed(()=>C.value?JS(k.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?pp(k.value,E.value,b.value,h.value,N.value,A):yp(k.value,b.value,h.value)),$=t.computed(()=>C.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?hp(k.value,E.value,b.value,h.value,N.value,A):_p(k.value,b.value,h.value).map((ne,ae)=>({point:ne,segIndex:ae}))),x=t.computed(()=>C.value||!r.value?[]:b.value),S=ea;function T(ne,ae){f.value=ne,y.value={...p.value[ne]},ae.target.setPointerCapture(ae.pointerId),ae.stopPropagation()}function R(ne){if(f.value<0)return;const ae=o({x:ne.clientX,y:ne.clientY});y.value={x:ae.x,y:ae.y}}function w(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 L=t.computed(()=>S(n.data.association.end1.multiplicity)),M=t.computed(()=>S(n.data.association.end2.multiplicity)),V=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),U=t.computed(()=>V.value==="class"),oe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ne=ur(E.value);return{x:k.value.x+ne.x*10,y:k.value.y+ne.y*10}}return b.value[0]??h.value}),ue=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ae=ur(N.value);return{x:h.value.x+ae.x*10,y:h.value.y+ae.y*10}}const ne=b.value;return ne[ne.length-1]??k.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(()=>Sp(k.value,oe.value,be.value,V.value)),_e=t.computed(()=>Sp(h.value,ue.value,pe.value,V.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:B.value,fill:"none",class:"em-edge__hit"},null,8,rx),t.createElementVNode("path",{d:B.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,lx),(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,sx))),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,cx))),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,dx))),128)),U.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(k).x+8,y:t.unref(k).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(L.value),11,ux),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(M.value),11,mx)],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(O=>I(me.segIndex,O),["stop"])},null,42,fx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.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:O=>T(P,O),onPointermove:R,onPointerup:w,onDblclick:O=>v(P,O)},null,42,px))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var wn=(e=>(e.Lines="lines",e.Dots="dots",e))(wn||{});const Vp=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]}`})},Bp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};wn.Lines+"",wn.Dots+"";const hx={[wn.Dots]:"#81818a",[wn.Lines]:"#eee"},yx=["id","x","y","width","height","patternTransform"],gx={key:2,height:"100",width:"100"},bx=["fill"],_x=["x","y","fill"],kx={name:"Background",compatConfig:{MODE:3}},Ex=t.defineComponent({...kx,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||hx[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(Vp),{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(Bp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",gx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,bx)])):t.createCommentVNode("",!0)])],8,yx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,_x),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),Nx={name:"ControlButton",compatConfig:{MODE:3}},wx=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ix={type:"button",class:"vue-flow__controls-button"};function vx(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",Ix,[t.renderSlot(e.$slots,"default")])}const ho=wx(Nx,[["render",vx]]),Cx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Sx=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function xx(e,n){return t.openBlock(),t.createElementBlock("svg",Cx,Sx)}const Rx={render:xx},Ax={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},$x=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Tx(e,n){return t.openBlock(),t.createElementBlock("svg",Ax,$x)}const Mx={render:Tx},Vx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Bx=[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 Dx(e,n){return t.openBlock(),t.createElementBlock("svg",Vx,Bx)}const Ox={render:Dx},Lx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Px=[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 zx(e,n){return t.openBlock(),t.createElementBlock("svg",Lx,Px)}const Fx={render:zx},Ux={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Hx=[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 jx(e,n){return t.openBlock(),t.createElementBlock("svg",Ux,Hx)}const Kx={render:jx},Gx={name:"Controls",compatConfig:{MODE:3}},Yx=t.defineComponent({...Gx,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Tm.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 b(){l(),n("zoomIn")}function g(){s(),n("zoomOut")}function _(){c(e.fitViewParams),n("fitView")}function k(){r(!p.value),n("interactionChange",!p.value)}return(h,E)=>(t.openBlock(),t.createBlock(t.unref($f),{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:b},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Rx))))])]),_: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(Mx))))])]),_: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:_},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ox))))])]),_: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:k},{default:t.withCtx(()=>[p.value?t.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Kx))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Fx))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var qx={value:()=>{}};function ws(){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 Wx(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=ws.prototype={constructor:pr,on:function(e,n){var o=this._,i=Wx(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Jx(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]=Dp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Dp(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 Jx(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Dp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=qx,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Is="http://www.w3.org/1999/xhtml";const Op={svg:"http://www.w3.org/2000/svg",xhtml:Is,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Op.hasOwnProperty(n)?{space:Op[n],local:e}:e}function Xx(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Is&&n.documentElement.namespaceURI===Is?n.createElement(e):n.createElementNS(o,e)}}function Zx(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Lp(e){var n=hr(e);return(n.local?Zx:Xx)(n)}function Qx(){}function vs(e){return e==null?Qx:function(){return this.querySelector(e)}}function eR(e){typeof e!="function"&&(e=vs(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 tR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function nR(){return[]}function Pp(e){return e==null?nR:function(){return this.querySelectorAll(e)}}function oR(e){return function(){return tR(e.apply(this,arguments))}}function iR(e){typeof e=="function"?e=oR(e):e=Pp(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 zp(e){return function(){return this.matches(e)}}function Fp(e){return function(n){return n.matches(e)}}var aR=Array.prototype.find;function rR(e){return function(){return aR.call(this.children,e)}}function lR(){return this.firstElementChild}function sR(e){return this.select(e==null?lR:rR(typeof e=="function"?e:Fp(e)))}var cR=Array.prototype.filter;function dR(){return Array.from(this.children)}function uR(e){return function(){return cR.call(this.children,e)}}function mR(e){return this.selectAll(e==null?dR:uR(typeof e=="function"?e:Fp(e)))}function fR(e){typeof e!="function"&&(e=zp(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 Up(e){return new Array(e.length)}function pR(){return new Pt(this._enter||this._groups.map(Up),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 hR(e){return function(){return e}}function yR(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 gR(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 bR(e){return e.__data__}function _R(e,n){if(!arguments.length)return Array.from(this,bR);var o=n?gR:yR,i=this._parents,a=this._groups;typeof e!="function"&&(e=hR(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=kR(e.call(u,u&&u.__data__,d,i)),y=f.length,b=s[d]=new Array(y),g=l[d]=new Array(y),_=c[d]=new Array(p);o(u,m,b,g,_,f,n);for(var k=0,h=0,E,N;k<y;++k)if(E=b[k]){for(k>=h&&(h=k+1);!(N=g[h])&&++h<y;);E._next=N||null}}return l=new Pt(l,i),l._enter=s,l._exit=c,l}function kR(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ER(){return new Pt(this._exit||this._groups.map(Up),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 wR(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 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 vR(e){e||(e=CR);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 CR(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function SR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xR(){return Array.from(this)}function RR(){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 AR(){let e=0;for(const n of this)++e;return e}function $R(){return!this.node()}function TR(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 MR(e){return function(){this.removeAttribute(e)}}function VR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function BR(e,n){return function(){this.setAttribute(e,n)}}function DR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function OR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function LR(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 PR(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?VR:MR:typeof n=="function"?o.local?LR:OR:o.local?DR:BR)(o,n))}function Hp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function zR(e){return function(){this.style.removeProperty(e)}}function FR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function UR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function HR(e,n,o){return arguments.length>1?this.each((n==null?zR:typeof n=="function"?UR:FR)(e,n,o??"")):Jo(this.node(),e)}function Jo(e,n){return e.style.getPropertyValue(n)||Hp(e).getComputedStyle(e,null).getPropertyValue(n)}function jR(e){return function(){delete this[e]}}function KR(e,n){return function(){this[e]=n}}function GR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function YR(e,n){return arguments.length>1?this.each((n==null?jR:typeof n=="function"?GR:KR)(e,n)):this.node()[e]}function jp(e){return e.trim().split(/^|\s+/)}function Cs(e){return e.classList||new Kp(e)}function Kp(e){this._node=e,this._names=jp(e.getAttribute("class")||"")}Kp.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 Gp(e,n){for(var o=Cs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Yp(e,n){for(var o=Cs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function qR(e){return function(){Gp(this,e)}}function WR(e){return function(){Yp(this,e)}}function JR(e,n){return function(){(n.apply(this,arguments)?Gp:Yp)(this,e)}}function XR(e,n){var o=jp(e+"");if(arguments.length<2){for(var i=Cs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?JR:n?qR:WR)(o,n))}function ZR(){this.textContent=""}function QR(e){return function(){this.textContent=e}}function eA(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function tA(e){return arguments.length?this.each(e==null?ZR:(typeof e=="function"?eA:QR)(e)):this.node().textContent}function nA(){this.innerHTML=""}function oA(e){return function(){this.innerHTML=e}}function iA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function aA(e){return arguments.length?this.each(e==null?nA:(typeof e=="function"?iA:oA)(e)):this.node().innerHTML}function rA(){this.nextSibling&&this.parentNode.appendChild(this)}function lA(){return this.each(rA)}function sA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function cA(){return this.each(sA)}function dA(e){var n=typeof e=="function"?e:Lp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function uA(){return null}function mA(e,n){var o=typeof e=="function"?e:Lp(e),i=n==null?uA:typeof n=="function"?n:vs(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function fA(){var e=this.parentNode;e&&e.removeChild(this)}function pA(){return this.each(fA)}function hA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function yA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function gA(e){return this.select(e?yA:hA)}function bA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function _A(e){return function(n){e.call(this,n,this.__data__)}}function kA(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 EA(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=_A(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 wA(e,n,o){var i=kA(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:EA,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function qp(e,n,o){var i=Hp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function IA(e,n){return function(){return qp(this,e,n)}}function vA(e,n){return function(){return qp(this,e,n.apply(this,arguments))}}function CA(e,n){return this.each((typeof n=="function"?vA:IA)(e,n))}function*SA(){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 Wp=[null];function Pt(e,n){this._groups=e,this._parents=n}function Vi(){return new Pt([[document.documentElement]],Wp)}function xA(){return this}Pt.prototype=Vi.prototype={constructor:Pt,select:eR,selectAll:iR,selectChild:sR,selectChildren:mR,filter:fR,data:_R,enter:pR,exit:ER,join:NR,merge:wR,selection:xA,order:IR,sort:vR,call:SR,nodes:xR,node:RR,size:AR,empty:$R,each:TR,attr:PR,style:HR,property:YR,classed:XR,text:tA,html:aA,raise:lA,lower:cA,append:dA,insert:mA,remove:pA,clone:gA,datum:bA,on:wA,dispatch:CA,[Symbol.iterator]:SA};function zn(e){return typeof e=="string"?new Pt([[document.querySelector(e)]],[document.documentElement]):new Pt([[e]],Wp)}function RA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Fn(e,n){if(e=RA(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 Ss={capture:!0,passive:!1};function xs(e){e.preventDefault(),e.stopImmediatePropagation()}function AA(e){var n=e.document.documentElement,o=zn(e).on("dragstart.drag",xs,Ss);"onselectstart"in n?o.on("selectstart.drag",xs,Ss):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function $A(e,n){var o=e.document.documentElement,i=zn(e).on("dragstart.drag",null);n&&(i.on("click.drag",xs,Ss),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function Rs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Jp(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,Xo="\\s*([+-]?\\d+)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",TA=/^#([0-9a-f]{3,8})$/,MA=new RegExp(`^rgb\\(${Xo},${Xo},${Xo}\\)$`),VA=new RegExp(`^rgb\\(${dn},${dn},${dn}\\)$`),BA=new RegExp(`^rgba\\(${Xo},${Xo},${Xo},${Oi}\\)$`),DA=new RegExp(`^rgba\\(${dn},${dn},${dn},${Oi}\\)$`),OA=new RegExp(`^hsl\\(${Oi},${dn},${dn}\\)$`),LA=new RegExp(`^hsla\\(${Oi},${dn},${dn},${Oi}\\)$`),Xp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Rs(Bi,Li,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Zp,formatHex:Zp,formatHex8:PA,formatHsl:zA,formatRgb:Qp,toString:Qp});function Zp(){return this.rgb().formatHex()}function PA(){return this.rgb().formatHex8()}function zA(){return ih(this).formatHsl()}function Qp(){return this.rgb().formatRgb()}function Li(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=TA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?eh(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=MA.exec(e))?new Bt(n[1],n[2],n[3],1):(n=VA.exec(e))?new Bt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=BA.exec(e))?br(n[1],n[2],n[3],n[4]):(n=DA.exec(e))?br(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=OA.exec(e))?oh(n[1],n[2]/100,n[3]/100,1):(n=LA.exec(e))?oh(n[1],n[2]/100,n[3]/100,n[4]):Xp.hasOwnProperty(e)?eh(Xp[e]):e==="transparent"?new Bt(NaN,NaN,NaN,0):null}function eh(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 FA(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 As(e,n,o,i){return arguments.length===1?FA(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}Rs(Bt,As,Jp(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:th,formatHex:th,formatHex8:UA,formatRgb:nh,toString:nh}));function th(){return`#${go(this.r)}${go(this.g)}${go(this.b)}`}function UA(){return`#${go(this.r)}${go(this.g)}${go(this.b)}${go((isNaN(this.opacity)?1:this.opacity)*255)}`}function nh(){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 oh(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 ih(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 HA(e,n,o,i){return arguments.length===1?ih(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}Rs(Jt,HA,Jp(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($s(e>=240?e-240:e+120,a,i),$s(e,a,i),$s(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Jt(ah(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("}${ah(this.h)}, ${kr(this.s)*100}%, ${kr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ah(e){return e=(e||0)%360,e<0?e+360:e}function kr(e){return Math.max(0,Math.min(1,e||0))}function $s(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 rh=e=>()=>e;function jA(e,n){return function(o){return e+o*n}}function KA(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function GA(e){return(e=+e)==1?lh:function(n,o){return o-n?KA(n,o,e):rh(isNaN(n)?o:n)}}function lh(e,n){var o=n-e;return o?jA(e,o):rh(isNaN(e)?n:e)}const sh=(function e(n){var o=GA(n);function i(a,r){var l=o((a=As(a)).r,(r=As(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=lh(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 Ts=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ms=new RegExp(Ts.source,"g");function YA(e){return function(){return e}}function qA(e){return function(n){return e(n)+""}}function WA(e,n){var o=Ts.lastIndex=Ms.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Ts.exec(e))&&(a=Ms.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=Ms.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?qA(c[0].x):YA(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 ch=180/Math.PI,Vs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function dh(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)*ch,skewX:Math.atan(c)*ch,scaleX:l,scaleY:s}}var Er;function JA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Vs:dh(n.a,n.b,n.c,n.d,n.e,n.f)}function XA(e){return e==null||(Er||(Er=document.createElementNS("http://www.w3.org/2000/svg","g")),Er.setAttribute("transform",e),!(e=Er.transform.baseVal.consolidate()))?Vs:(e=e.matrix,dh(e.a,e.b,e.c,e.d,e.e,e.f))}function uh(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 b=f.push("translate(",null,n,null,o);y.push({i:b-4,x:Un(d,m)},{i:b-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 b=f.push(a(f)+"scale(",null,",",null,")");y.push({i:b-4,x:Un(d,m)},{i:b-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,b=p.length,g;++y<b;)m[(g=p[y]).i]=g.x(f);return m.join("")}}}var ZA=uh(JA,"px, ","px)","deg)"),QA=uh(XA,", ",")",")"),e$=1e-12;function mh(e){return((e=Math.exp(e))+1/e)/2}function t$(e){return((e=Math.exp(e))-1/e)/2}function n$(e){return((e=Math.exp(2*e))-1)/(e+1)}const o$=(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,b=f*f+y*y,g,_;if(b<e$)_=Math.log(p/d)/n,g=function(A){return[s+A*f,c+A*y,d*Math.exp(n*A*_)]};else{var k=Math.sqrt(b),h=(p*p-d*d+i*b)/(2*d*o*k),E=(p*p-d*d-i*b)/(2*p*o*k),N=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(E*E+1)-E);_=(C-N)/n,g=function(A){var B=A*_,$=mh(N),x=d/(o*k)*($*n$(n*B+N)-t$(N));return[s+x*f,c+x*y,d*$/mh(n*B+N)]}}return g.duration=_*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 Zo=0,Pi=0,zi=0,fh=1e3,Nr,Fi,wr=0,bo=0,Ir=0,Ui=typeof performance=="object"&&performance.now?performance:Date,ph=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bs(){return bo||(ph(i$),bo=Ui.now()+Ir)}function i$(){bo=0}function vr(){this._call=this._time=this._next=null}vr.prototype=hh.prototype={constructor:vr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Bs():+o)+(n==null?0:+n),!this._next&&Fi!==this&&(Fi?Fi._next=this:Nr=this,Fi=this),this._call=e,this._time=o,Ds()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ds())}};function hh(e,n,o){var i=new vr;return i.restart(e,n,o),i}function a$(){Bs(),++Zo;for(var e=Nr,n;e;)(n=bo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Zo}function yh(){bo=(wr=Ui.now())+Ir,Zo=Pi=0;try{a$()}finally{Zo=0,l$(),bo=0}}function r$(){var e=Ui.now(),n=e-wr;n>fh&&(Ir-=n,wr=e)}function l$(){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,Ds(i)}function Ds(e){if(!Zo){Pi&&(Pi=clearTimeout(Pi));var n=e-bo;n>24?(e<1/0&&(Pi=setTimeout(yh,e-Ui.now()-Ir)),zi&&(zi=clearInterval(zi))):(zi||(wr=Ui.now(),zi=setInterval(r$,fh)),Zo=1,ph(yh))}}function gh(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 s$=ws("start","end","cancel","interrupt"),c$=[],bh=0,_h=1,Os=2,Cr=3,kh=4,Ls=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;d$(e,o,{name:n,index:i,group:a,on:s$,tween:c$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:bh})}function Ps(e,n){var o=Xt(e,n);if(o.state>bh)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 d$(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=hh(r,0,o.time);function r(d){o.state=_h,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!==_h)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Cr)return gh(l);f.state===kh?(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(gh(function(){o.state===Cr&&(o.state=kh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Os,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Os){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=Ls,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===Ls&&(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>Os&&i.state<Ls,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 u$(e){return this.each(function(){Rr(this,e)})}function m$(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 f$(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 p$(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?m$:f$)(o,e,n))}function zs(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 Eh(e,n){var o;return(typeof n=="number"?Un:n instanceof Li?sh:(o=Li(n))?(n=o,sh):WA)(e,n)}function h$(e){return function(){this.removeAttribute(e)}}function y$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function g$(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 b$(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 _$(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 k$(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 E$(e,n){var o=hr(e),i=o==="transform"?QA:Eh;return this.attrTween(e,typeof n=="function"?(o.local?k$:_$)(o,i,zs(this,"attr."+e,n)):n==null?(o.local?y$:h$)(o):(o.local?b$:g$)(o,i,n))}function N$(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function w$(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)&&w$(e,r)),o}return a._value=n,a}function v$(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 C$(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?I$:v$)(i,n))}function S$(e,n){return function(){Ps(this,e).delay=+n.apply(this,arguments)}}function x$(e,n){return n=+n,function(){Ps(this,e).delay=n}}function R$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?S$:x$)(n,e)):Xt(this.node(),n).delay}function A$(e,n){return function(){un(this,e).duration=+n.apply(this,arguments)}}function $$(e,n){return n=+n,function(){un(this,e).duration=n}}function T$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?A$:$$)(n,e)):Xt(this.node(),n).duration}function M$(e,n){if(typeof n!="function")throw new Error;return function(){un(this,e).ease=n}}function V$(e){var n=this._id;return arguments.length?this.each(M$(n,e)):Xt(this.node(),n).ease}function B$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;un(this,e).ease=o}}function D$(e){if(typeof e!="function")throw new Error;return this.each(B$(this._id,e))}function O$(e){typeof e!="function"&&(e=zp(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 L$(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 P$(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 z$(e,n,o){var i,a,r=P$(n)?Ps:un;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function F$(e,n){var o=this._id;return arguments.length<2?Xt(this.node(),o).on.on(e):this.each(z$(o,e,n))}function U$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function H$(){return this.on("end.remove",U$(this._id))}function j$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=vs(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 K$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Pp(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),b=0,g=p.length;b<g;++b)(f=p[b])&&xr(f,n,o,b,p,y);r.push(p),l.push(u)}return new In(r,l,n,o)}var G$=Vi.prototype.constructor;function Y$(){return new G$(this._groups,this._parents)}function q$(e,n){var o,i,a;return function(){var r=Jo(this,e),l=(this.style.removeProperty(e),Jo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Nh(e){return function(){this.style.removeProperty(e)}}function W$(e,n,o){var i,a=o+"",r;return function(){var l=Jo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function J$(e,n,o){var i,a,r;return function(){var l=Jo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Jo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function X$(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=Nh(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function Z$(e,n,o){var i=(e+="")=="transform"?ZA:Eh;return n==null?this.styleTween(e,q$(e,i)).on("end.style."+e,Nh(e)):typeof n=="function"?this.styleTween(e,J$(e,i,zs(this,"style."+e,n))).each(X$(this._id,e)):this.styleTween(e,W$(e,i,n),o).on("end.style."+e,null)}function Q$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function eT(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&Q$(e,l,o)),i}return r._value=n,r}function tT(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,eT(e,n,o??""))}function nT(e){return function(){this.textContent=e}}function oT(e){return function(){var n=e(this);this.textContent=n??""}}function iT(e){return this.tween("text",typeof e=="function"?oT(zs(this,"text",e)):nT(e==null?"":e+""))}function aT(e){return function(n){this.textContent=e.call(this,n)}}function rT(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&aT(a)),n}return i._value=e,i}function lT(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,rT(e))}function sT(){for(var e=this._name,n=this._id,o=wh(),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 cT(){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 dT=0;function In(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function wh(){return++dT}var vn=Vi.prototype;In.prototype={constructor:In,select:j$,selectAll:K$,selectChild:vn.selectChild,selectChildren:vn.selectChildren,filter:O$,merge:L$,selection:Y$,transition:sT,call:vn.call,nodes:vn.nodes,node:vn.node,size:vn.size,empty:vn.empty,each:vn.each,on:F$,attr:E$,attrTween:C$,style:Z$,styleTween:tT,text:iT,textTween:lT,remove:H$,tween:p$,delay:R$,duration:T$,ease:V$,easeVarying:D$,end:cT,[Symbol.iterator]:vn[Symbol.iterator]};function uT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mT={time:null,delay:0,duration:250,ease:uT};function fT(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 pT(e){var n,o;e instanceof In?(n=e._id,e=e._name):(n=wh(),(o=mT).time=Bs(),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||fT(c,n));return new In(i,this._parents,e,n)}Vi.prototype.interrupt=u$,Vi.prototype.transition=pT;const Ar=e=>()=>e;function hT(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 Fs=new Cn(1,0,0);Cn.prototype;function Us(e){e.stopImmediatePropagation()}function Hi(e){e.preventDefault(),e.stopImmediatePropagation()}function yT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gT(){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 Ih(){return this.__zoom||Fs}function bT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _T(){return navigator.maxTouchPoints||"ontouchstart"in this}function kT(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 ET(){var e=yT,n=gT,o=kT,i=bT,a=_T,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=o$,d=ws("start","zoom","end"),u,m,p,f=500,y=150,b=0,g=10;function _(w){w.property("__zoom",Ih).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",x).filter(a).on("touchstart.zoom",S).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,v,I,L){var M=w.selection?w.selection():w;M.property("__zoom",Ih),w!==M?N(w,v,I,L):M.interrupt().each(function(){C(this,arguments).event(L).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},_.scaleBy=function(w,v,I,L){_.scaleTo(w,function(){var M=this.__zoom.k,V=typeof v=="function"?v.apply(this,arguments):v;return M*V},I,L)},_.scaleTo=function(w,v,I,L){_.transform(w,function(){var M=n.apply(this,arguments),V=this.__zoom,U=I==null?E(M):typeof I=="function"?I.apply(this,arguments):I,oe=V.invert(U),ue=typeof v=="function"?v.apply(this,arguments):v;return o(h(k(V,ue),U,oe),M,l)},I,L)},_.translateBy=function(w,v,I,L){_.transform(w,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,L)},_.translateTo=function(w,v,I,L,M){_.transform(w,function(){var V=n.apply(this,arguments),U=this.__zoom,oe=L==null?E(V):typeof L=="function"?L.apply(this,arguments):L;return o(Fs.translate(oe[0],oe[1]).scale(U.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof I=="function"?-I.apply(this,arguments):-I),V,l)},L,M)};function k(w,v){return v=Math.max(r[0],Math.min(r[1],v)),v===w.k?w:new Cn(v,w.x,w.y)}function h(w,v,I){var L=v[0]-I[0]*w.k,M=v[1]-I[1]*w.k;return L===w.x&&M===w.y?w:new Cn(w.k,L,M)}function E(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function N(w,v,I,L){w.on("start.zoom",function(){C(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,V=arguments,U=C(M,V).event(L),oe=n.apply(M,V),ue=I==null?E(oe):typeof I=="function"?I.apply(M,V):I,be=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),pe=M.__zoom,he=typeof v=="function"?v.apply(M,V):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)}U.zoom(null,ye)}})}function C(w,v,I){return!I&&w.__zooming||new A(w,v)}function A(w,v){this.that=w,this.args=v,this.active=0,this.sourceEvent=null,this.extent=n.apply(w,v),this.taps=0}A.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,v){return this.mouse&&w!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&w!=="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(w){var v=zn(this.that).datum();d.call(w,this.that,new hT(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),v)}};function B(w,...v){if(!e.apply(this,arguments))return;var I=C(this,v).event(w),L=this.__zoom,M=Math.max(r[0],Math.min(r[1],L.k*Math.pow(2,i.apply(this,arguments)))),V=Fn(w);if(I.wheel)(I.mouse[0][0]!==V[0]||I.mouse[0][1]!==V[1])&&(I.mouse[1]=L.invert(I.mouse[0]=V)),clearTimeout(I.wheel);else{if(L.k===M)return;I.mouse=[V,L.invert(V)],Rr(this),I.start()}Hi(w),I.wheel=setTimeout(U,y),I.zoom("mouse",o(h(k(L,M),I.mouse[0],I.mouse[1]),I.extent,l));function U(){I.wheel=null,I.end()}}function $(w,...v){if(p||!e.apply(this,arguments))return;var I=w.currentTarget,L=C(this,v,!0).event(w),M=zn(w.view).on("mousemove.zoom",ue,!0).on("mouseup.zoom",be,!0),V=Fn(w,I),U=w.clientX,oe=w.clientY;AA(w.view),Us(w),L.mouse=[V,this.__zoom.invert(V)],Rr(this),L.start();function ue(pe){if(Hi(pe),!L.moved){var he=pe.clientX-U,_e=pe.clientY-oe;L.moved=he*he+_e*_e>b}L.event(pe).zoom("mouse",o(h(L.that.__zoom,L.mouse[0]=Fn(pe,I),L.mouse[1]),L.extent,l))}function be(pe){M.on("mousemove.zoom mouseup.zoom",null),$A(pe.view,L.moved),Hi(pe),L.event(pe).end()}}function x(w,...v){if(e.apply(this,arguments)){var I=this.__zoom,L=Fn(w.changedTouches?w.changedTouches[0]:w,this),M=I.invert(L),V=I.k*(w.shiftKey?.5:2),U=o(h(k(I,V),L,M),n.apply(this,v),l);Hi(w),s>0?zn(this).transition().duration(s).call(N,U,L,w):zn(this).call(_.transform,U,L,w)}}function S(w,...v){if(e.apply(this,arguments)){var I=w.touches,L=I.length,M=C(this,v,w.changedTouches.length===L).event(w),V,U,oe,ue;for(Us(w),U=0;U<L;++U)oe=I[U],ue=Fn(oe,this),ue=[ue,this.__zoom.invert(ue),oe.identifier],M.touch0?!M.touch1&&M.touch0[2]!==ue[2]&&(M.touch1=ue,M.taps=0):(M.touch0=ue,V=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),V&&(M.taps<2&&(m=ue[0],u=setTimeout(function(){u=null},f)),Rr(this),M.start())}}function T(w,...v){if(this.__zooming){var I=C(this,v).event(w),L=w.changedTouches,M=L.length,V,U,oe,ue;for(Hi(w),V=0;V<M;++V)U=L[V],oe=Fn(U,this),I.touch0&&I.touch0[2]===U.identifier?I.touch0[0]=oe:I.touch1&&I.touch1[2]===U.identifier&&(I.touch1[0]=oe);if(U=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;U=k(U,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(U,oe,ue),I.extent,l))}}function R(w,...v){if(this.__zooming){var I=C(this,v).event(w),L=w.changedTouches,M=L.length,V,U;for(Us(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),V=0;V<M;++V)U=L[V],I.touch0&&I.touch0[2]===U.identifier?delete I.touch0:I.touch1&&I.touch1[2]===U.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&&(U=Fn(U,this),Math.hypot(m[0]-U[0],m[1]-U[1])<g)){var oe=zn(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Ar(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ar(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Ar(!!w),_):a},_.extent=function(w){return arguments.length?(n=typeof w=="function"?w:Ar([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):n},_.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],_):[r[0],r[1]]},_.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,_):Math.sqrt(b)},_.tapDistance=function(w){return arguments.length?(g=+w,_):g},_}const vh=Symbol("MiniMapSlots"),NT=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],wT={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},IT=t.defineComponent({...wT,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(vh),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,NT))],64)):t.createCommentVNode("",!0)}}),vT=["width","height","viewBox","aria-labelledby"],CT=["id"],ST=["d","fill","stroke","stroke-width"],xT={name:"MiniMap",compatConfig:{MODE:3}},RT=t.defineComponent({...xT,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(),b=t.ref();t.provide(vh,o);const g=t.toRef(()=>{var M;return e.width??((M=i.style)==null?void 0:M.width)??a}),_=t.toRef(()=>{var M;return e.height??((M=i.style)==null?void 0:M.height)??r}),k=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),E=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),N=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),C=t.computed(()=>ts(y.value.filter(M=>!M.hidden))),A=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})),B=t.computed(()=>y.value&&y.value.length?V0(C.value,A.value):A.value),$=t.computed(()=>{const M=B.value.width/g.value,V=B.value.height/_.value;return Math.max(M,V)}),x=t.computed(()=>{const M=$.value*g.value,V=$.value*_.value,U=e.offsetScale*$.value;return{offset:U,x:B.value.x-(M-B.value.width)/2-U,y:B.value.y-(V-B.value.height)/2-U,width:M+U*2,height:V+U*2}}),S=t.computed(()=>!x.value.x||!x.value.y?"":`
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=of[n])==null?void 0:i.call(of,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function rs(e){return"clientX"in e}function K0(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 G0(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 Y0=()=>!0;function ls(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function q0(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 W0=250;function J0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=q0(e,o,n+W0);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}=Ko(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 af(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=Y0},u,m,p,f){const y=r==="target",b=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:g,y:_}=cn(e),k=l.elementFromPoint(g,_),h=k!=null&&k.classList.contains(`${s}-flow__handle`)?k:b,E={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const N=rf(void 0,h),C=h.getAttribute("data-nodeid"),A=h.getAttribute("data-handleid"),B=h.classList.contains("connectable"),$=h.classList.contains("connectableend");if(!C||!N)return E;const x={source:y?C:i,sourceHandle:y?A:a,target:y?i:C,targetHandle:y?a:A};E.connection=x;const T=B&&$&&(o===En.Strict?y&&N==="source"||!y&&N==="target":C!==i||A!==a);E.isValid=T&&d(x,{nodes:m,edges:u,sourceNode:p(x.source),targetNode:p(x.target)}),E.toHandle=lf(C,N,A,f,o,!0)}return E}function rf(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function X0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function Z0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function lf(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,...Ko(d,m,m.position,!0)}:m}const ss={[De.Left]:De.Right,[De.Right]:De.Left,[De.Top]:De.Bottom,[De.Bottom]:De.Top},Q0=["production","prod"];function Ti(e,...n){sf()&&console.warn(`[Vue Flow]: ${e}`,...n)}function sf(){return!Q0.includes(process.env.NODE_ENV||"")}function cf(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 eN(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:Fm(e)},a=Pm(a,void 0,i),V0(a,n)?!1:a}function tN(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?Fm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function df(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=$0(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 uf(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}`;uf("source",c,u,e,a,l),uf("target",c,d,e,r,s)}}function mf(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:eN(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({...Pm(u,f,r),sourceNode:m,targetNode:p})}return c}const ff=Symbol("vueFlow"),pf=Symbol("nodeId"),hf=Symbol("nodeRef"),nN=Symbol("edgeId"),oN=Symbol("edgeRef"),Za=Symbol("slots");function yf(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:b,selectNodesOnDrag:g,removeSelectedElements:_,addSelectedNodes:k,updateNodePositions:h,emits:E}=et(),{onStart:N,onDrag:C,onStop:A,onClick:B,el:$,disabled:x,id:S,selectable:T,dragHandle:R}=e,w=t.shallowRef(!1);let v=[],I,L=null,M={x:void 0,y:void 0},V={x:0,y:0},U=null,oe=!1,ue=!1,be=0,pe=!1;const he=rN(),_e=({x:ae,y:me})=>{M={x:ae,y:me};let P=!1;if(v=v.map(O=>{const z={x:ae-O.distance.x,y:me-O.distance.y},{computedPosition:Q}=as(O,o.value?Xa(z,i.value):z,E.error,l.value,O.parentNode?f(O.parentNode):void 0);return P=P||O.position.x!==Q.x||O.position.y!==Q.y,O.position=Q,O}),ue=ue||P,!!P&&(h(v,!0,!0),w.value=!0,U)){const[O,z]=is({id:S,dragItems:v,findNode:f});C({event:U,node:O,nodes:z})}},ye=()=>{if(!L)return;const[ae,me]=qm(V,L,u.value);if(ae!==0||me!==0){const P={x:(M.x??0)-ae/c.value.zoom,y:(M.y??0)-me/c.value.zoom};p({x:ae,y:me})&&_e(P)}be=requestAnimationFrame(ye)},Ae=(ae,me)=>{oe=!0;const P=f(S);!g.value&&!y.value&&P&&(P.selected||_()),P&&t.toValue(T)&&g.value&&cs(P,y.value,k,_,b,!1,me);const O=he(ae.sourceEvent);if(M=O,v=P0(r.value,m.value,O,S),v.length){const[z,Q]=is({id:S,dragItems:v,findNode:f});N({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),M=he(ae.sourceEvent),L=((P=n.value)==null?void 0:P.getBoundingClientRect())||null,V=cn(ae.sourceEvent,L))},se=(ae,me)=>{const P=he(ae.sourceEvent);if(!pe&&oe&&d.value&&(pe=!0,ye()),!oe){const O=P.xSnapped-(M.x??0),z=P.ySnapped-(M.y??0);Math.sqrt(O*O+z*z)>s.value&&Ae(ae,me)}(M.x!==P.xSnapped||M.y!==P.ySnapped)&&v.length&&oe&&(U=ae.sourceEvent,V=cn(ae.sourceEvent,L),_e(P))},ne=ae=>{let me=!1;if(!oe&&!w.value&&!y.value){const P=ae.sourceEvent,O=he(P),z=O.xSnapped-(M.x??0),Q=O.ySnapped-(M.y??0),ee=Math.sqrt(z*z+Q*Q);ee!==0&&ee<=s.value&&(B==null||B(P),me=!0)}if(v.length&&!me){ue&&(h(v,!1,!1),ue=!1);const[P,O]=is({id:S,dragItems:v,findNode:f});A({event:ae.sourceEvent,node:P,nodes:O})}v=[],w.value=!1,pe=!1,oe=!1,M={x:void 0,y:void 0},cancelAnimationFrame(be)};return t.watch([()=>t.toValue(x),$],([ae,me],P,O)=>{if(me){const z=jt(me);ae||(I=AE().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(R);return!Q.button&&(!a.value||!ef(ee,`.${a.value}`,me)&&(!we||ef(ee,we,me)))}),z.call(I)),O(()=>{z.on(".drag",null),I&&(I.on("start",null),I.on("drag",null),I.on("end",null))})}}),w}function iN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),updateStart:Me(),update:Me(),updateEnd:Me()}}function aN(e,n){const o=iN();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 rN(){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=K0(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 gf({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:b,findNode:g,panBy:_,startConnection:k,updateConnection:h,endConnection:E,emits:N,viewport:C,edges:A,nodes:B,isValidConnection:$,nodeLookup:x}=et();let S=null,T=!1,R=null;function w(I){var L;const M=t.toValue(o)==="target",V=rs(I),U=Lm(I.target),oe=I.currentTarget;if(oe&&(V&&I.button===0||!V)){let ue=function(Ce){P=cn(Ce,ne),_e=J0(Ri(P,C.value,!1,[1,1]),u.value,x.value,Q),O||(z(),O=!0);const Y=af(Ce,{handle:_e,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:M?"target":"source",isValidConnection:he,doc:U,lib:"vue",flowId:s,nodeLookup:x.value},A.value,B.value,g,x.value);R=Y.handleDomNode,S=Y.connection,T=Z0(!!_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?x.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,X0(!!q,T)),xe=X,!_e&&!T&&!R)return ls(me);S&&S.source!==S.target&&R&&(ls(me),me=R,R.classList.add("connecting","vue-flow__handle-connecting"),R.classList.toggle("valid",!!T),R.classList.toggle("vue-flow__handle-valid",!!T))},be=function(Ce){"touches"in Ce&&Ce.touches.length>0||((_e||R)&&S&&T&&(r?r(Ce,S):N.connect(S)),N.connectEnd(Ce),a&&(l==null||l(Ce)),ls(me),cancelAnimationFrame(ye),E(Ce),O=!1,T=!1,S=null,R=null,U.removeEventListener("mousemove",ue),U.removeEventListener("mouseup",be),U.removeEventListener("touchmove",ue),U.removeEventListener("touchend",be))};const pe=g(t.toValue(n));let he=t.toValue(i)||$.value||Qa;!he&&pe&&(he=(M?pe.isValidSourcePos:pe.isValidTargetPos)||Qa);let _e,ye=0;const{x:Ae,y:Fe}=cn(I),se=rf(t.toValue(a),oe),ne=(L=c.value)==null?void 0:L.getBoundingClientRect();if(!ne||!se)return;const ae=lf(t.toValue(n),se,t.toValue(e),x.value,d.value);if(!ae)return;let me,P=cn(I,ne),O=!1;const z=()=>{if(!y.value)return;const[Ce,Y]=qm(P,ne,b.value);_({x:Ce,y:Y}),ye=requestAnimationFrame(z)},Q={...ae,nodeId:t.toValue(n),type:se,position:ae.position},ee=x.value.get(t.toValue(n)),de={inProgress:!0,isValid:null,from:Ko(ee,Q,De.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ee,to:P,toHandle:null,toPosition:ss[Q.position],toNode:null};k({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}),N.connectStart({event:I,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:se});let xe=de;U.addEventListener("mousemove",ue),U.addEventListener("mouseup",be),U.addEventListener("touchmove",ue),U.addEventListener("touchend",be)}}function v(I){var L,M;if(!m.value)return;const V=t.toValue(o)==="target";if(!p.value){N.clickConnectStart({event:I,nodeId:t.toValue(n),handleId:t.toValue(e)}),k({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:De.Top,...cn(I)},void 0,!0);return}let U=t.toValue(i)||$.value||Qa;const oe=g(t.toValue(n));if(!U&&oe&&(U=(V?oe.isValidSourcePos:oe.isValidTargetPos)||Qa),oe&&(typeof oe.connectable>"u"?f.value:oe.connectable)===!1)return;const ue=Lm(I.target),be=af(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:U,doc:ue,lib:"vue",flowId:s,nodeLookup:x.value},A.value,B.value,g,x.value),pe=((L=be.connection)==null?void 0:L.source)===((M=be.connection)==null?void 0:M.target);be.isValid&&be.connection&&!pe&&N.connect(be.connection),N.clickConnectEnd(I),E(I,!0)}return{handlePointerDown:w,handleClick:v}}function lN(){return t.inject(pf,"")}function bf(e){const n=e??lN()??"",o=t.inject(hf,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 sN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),dragStart:Me(),drag:Me(),dragStop:Me()}}function cN(e,n){const o=sN();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 _f(){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,b=[];for(const g of e.value)if(g.draggable||l&&typeof g.draggable>"u"){const _={x:g.computedPosition.x+f,y:g.computedPosition.y+y},{position:k}=as(g,_,s.error,n.value,g.parentNode?i(g.parentNode):void 0);b.push({id:g.id,position:k,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(b,!0,!1)}}const er=.1,dN=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 uN={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 mN(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}=Om({x:-i,y:-a},e.translateExtent),m=Uo.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}=Km(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}=Km(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}}}:uN)}function ms(e,n=0,o=dN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function fN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,g,_=!!(o.nodes.value.length||o.edges.value.length);b=Oo([e.modelValue,()=>{var k,h;return(h=(k=e.modelValue)==null?void 0:k.value)==null?void 0:h.length}],([k])=>{k&&Array.isArray(k)&&(g==null||g.pause(),o.setElements(k),!g&&!_&&k.length?_=!0:g==null||g.resume())}),g=Oo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([k,h])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...k,...h],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let b,g,_=!!o.nodes.value.length;b=Oo([e.nodes,()=>{var k,h;return(h=(k=e.nodes)==null?void 0:k.value)==null?void 0:h.length}],([k])=>{k&&Array.isArray(k)&&(g==null||g.pause(),o.setNodes(k),!g&&!_&&k.length?_=!0:g==null||g.resume())}),g=Oo([o.nodes,()=>o.nodes.value.length],([k])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let b,g,_=!!o.edges.value.length;b=Oo([e.edges,()=>{var k,h;return(h=(k=e.edges)==null?void 0:k.value)==null?void 0:h.length}],([k])=>{k&&Array.isArray(k)&&(g==null||g.pause(),o.setEdges(k),!g&&!_&&k.length?_=!0:g==null||g.resume())}),g=Oo([o.edges,()=>o.edges.value.length],([k])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&gt(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&gt(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&gt(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&gt(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 b=async g=>{let _=g;typeof n.autoConnect=="function"&&(_=await n.autoConnect(g)),_!==!1&&o.addEdges([_])};t.watch(()=>n.autoConnect,()=>{gt(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(g,_,k)=>{g?o.onConnect(b):o.hooks.value.connect.off(b),k(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},f=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(n)){const _=g;if(!b.includes(_)){const k=t.toRef(()=>n[_]),h=o[_];t.isRef(h)&&i.run(()=>{t.watch(k,E=>{gt(E)&&(h.value=E)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function pN(){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 hN(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=yN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function yN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function kf(){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:pN(),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 gN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function bN(e,n,o){const i=mN(e),a=P=>{const O=P??[];e.hooks.updateNodeInternals.trigger(O)},r=P=>M0(P,e.nodes,e.edges),l=P=>T0(P,e.nodes,e.edges),s=P=>lo(P,e.edges),c=({id:P,type:O,nodeId:z})=>{var Q;const ee=P?`-${O}-${P}`:`-${O}`;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,O,z)=>{var Q,ee;const we=[];for(const de of P){const xe={id:de.id,type:"position",dragging:z,from:de.from};if(O&&(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 O=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!O)return;const z=window.getComputedStyle(O),{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=cf("source",de.nodeElement,X,Q,xe.id),xe.handleBounds.target=cf("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,O)=>{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,O));for(const de of Q)we.push(On(de,O))}ee.length&&e.hooks.nodesChange.trigger(ee),we.length&&e.hooks.edgesChange.trigger(we)},y=P=>{if(e.multiSelectionActive){const O=P.map(z=>On(z.id,!0));e.hooks.nodesChange.trigger(O);return}e.hooks.nodesChange.trigger(Ln(n.value,new Set(P.map(O=>O.id)),!0)),e.hooks.edgesChange.trigger(Ln(o.value))},b=P=>{if(e.multiSelectionActive){const O=P.map(z=>On(z.id,!0));e.hooks.edgesChange.trigger(O);return}e.hooks.edgesChange.trigger(Ln(o.value,new Set(P.map(O=>O.id)))),e.hooks.nodesChange.trigger(Ln(n.value,new Set,!0))},g=P=>{f(P,!0)},_=P=>{const z=(P||e.nodes).map(Q=>(Q.selected=!1,On(Q.id,!1)));e.hooks.nodesChange.trigger(z)},k=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 O=P.reduce((z,Q)=>{const ee=On(Q.id,!1);return ro(Q)?z.nodes.push(ee):z.edges.push(ee),z},{nodes:[],edges:[]});O.nodes.length&&e.hooks.nodesChange.trigger(O.nodes),O.edges.length&&e.hooks.edgesChange.trigger(O.edges)},E=P=>{var O;(O=e.d3Zoom)==null||O.scaleExtent([P,e.maxZoom]),e.minZoom=P},N=P=>{var O;(O=e.d3Zoom)==null||O.scaleExtent([e.minZoom,P]),e.maxZoom=P},C=P=>{var O;(O=e.d3Zoom)==null||O.translateExtent(P),e.translateExtent=P},A=P=>{e.nodeExtent=P,a()},B=P=>{var O;(O=e.d3Zoom)==null||O.clickDistance(P)},$=P=>{e.nodesDraggable=P,e.nodesConnectable=P,e.elementsSelectable=P},x=P=>{const O=P instanceof Function?P(e.nodes):P;!e.initialized&&!O.length||(e.nodes=df(O,d,e.hooks.error.trigger))},S=P=>{const O=P instanceof Function?P(e.edges):P;if(!e.initialized&&!O.length)return;const z=us(O,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 O=P instanceof Function?P([...e.nodes,...e.edges]):P;!e.initialized&&!O.length||(x(O.filter(ro)),S(O.filter(Dn)))},R=P=>{let O=P instanceof Function?P(e.nodes):P;O=Array.isArray(O)?O:[O];const z=df(O,d,e.hooks.error.trigger),Q=[];for(const ee of z)Q.push(Jm(ee));Q.length&&e.hooks.nodesChange.trigger(Q)},w=P=>{let O=P instanceof Function?P(e.edges):P;O=Array.isArray(O)?O:[O];const z=us(O,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const ee of z)Q.push(Jm(ee));Q.length&&e.hooks.edgesChange.trigger(Q)},v=(P,O=!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(Zm(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(Xm(q.id));O&&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(Xm(X.id)),O&&xe([X]),z&&Ce(X.id)))}de.length&&e.hooks.edgesChange.trigger(de),we.length&&e.hooks.nodesChange.trigger(we)},I=P=>{const O=P instanceof Function?P(e.edges):P,z=Array.isArray(O)?O:[O],Q=[];for(const ee of z){const we=typeof ee=="string"?u(ee):ee;we&&(gt(we.deletable)&&!we.deletable||Q.push(Zm(typeof ee=="string"?ee:ee.id,we.source,we.target,we.sourceHandle,we.targetHandle)))}e.hooks.edgesChange.trigger(Q)},L=(P,O,z=!0)=>{const Q=u(P.id);if(!Q)return!1;const ee=e.edges.indexOf(Q),we=tN(P,O,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},M=(P,O,z={replace:!1})=>{const Q=u(P);if(!Q)return;const ee=typeof O=="function"?O(Q):O;Q.data=z.replace?ee:{...Q.data,...ee}},V=P=>Wm(P,e.nodes),U=P=>{const O=Wm(P,e.edges);return ds(e.connectionLookup,o.value,O),O},oe=(P,O,z={replace:!1})=>{const Q=d(P);if(!Q)return;const ee=typeof O=="function"?O(Q):O;z.replace?e.nodes.splice(e.nodes.indexOf(Q),1,ee):Object.assign(Q,ee)},ue=(P,O,z={replace:!1})=>{const Q=d(P);if(!Q)return;const ee=typeof O=="function"?O(Q):O;Q.data=z.replace?ee:{...Q.data,...ee}},be=(P,O,z=!1)=>{z?e.connectionClickStartHandle=P:e.connectionStartHandle=P,e.connectionEndHandle=null,e.connectionStatus=null,O&&(e.connectionPosition=O)},pe=(P,O=null,z=null)=>{e.connectionStartHandle&&(e.connectionPosition=P,e.connectionEndHandle=O,e.connectionStatus=z)},he=(P,O)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,O?e.connectionClickStartHandle=null:e.connectionStartHandle=null},_e=P=>{const O=A0(P),z=O?null:Si(P)?P:d(P.id);return!O&&!z?[null,null,O]:[O?P:Ga(z),z,O]},ye=(P,O=!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);(O&&Y>0||Y>=Ce.width*Ce.height||Y>=Number(Q.width)*Number(Q.height))&&de.push(xe)}return de},Ae=(P,O,z=!0)=>{const[Q]=_e(P);if(!Q)return!1;const ee=Ya(Q,O);return z&&ee>0||ee>=Number(Q.width)*Number(Q.height)},Fe=P=>{const{viewport:O,dimensions:z,d3Zoom:Q,d3Selection:ee,translateExtent:we}=e;if(!Q||!ee||!P.x&&!P.y)return!1;const de=Uo.translate(O.x+P.x,O.y+P.y).scale(O.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 O=P instanceof Function?P(e):P,z=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];gt(O.defaultEdgeOptions)&&(e.defaultEdgeOptions=O.defaultEdgeOptions);const Q=O.modelValue||O.nodes||O.edges?[]:void 0;Q&&(O.modelValue&&Q.push(...O.modelValue),O.nodes&&Q.push(...O.nodes),O.edges&&Q.push(...O.edges),T(Q));const ee=()=>{gt(O.maxZoom)&&N(O.maxZoom),gt(O.minZoom)&&E(O.minZoom),gt(O.translateExtent)&&C(O.translateExtent)};for(const we of Object.keys(O)){const de=we,xe=O[de];![...gN,...z].includes(de)&&gt(xe)&&(e[de]=xe)}$l(()=>e.d3Zoom).not.toBeNull().then(ee),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:T,setNodes:x,setEdges:S,addNodes:R,addEdges:w,removeNodes:v,removeEdges:I,findNode:d,findEdge:u,updateEdge:L,updateEdgeData:M,updateNode:oe,updateNodeData:ue,applyEdgeChanges:U,applyNodeChanges:V,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:E,setMaxZoom:N,setTranslateExtent:C,setNodeExtent:A,setPaneClickDistance:B,removeSelectedElements:h,removeSelectedNodes:_,removeSelectedEdges:k,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,O)=>i.value.zoomTo(P,O),setViewport:(P,O)=>i.value.setViewport(P,O),setTransform:(P,O)=>i.value.setTransform(P,O),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(P,O,z)=>i.value.setCenter(P,O,z),fitBounds:(P,O)=>i.value.fitBounds(P,O),project:P=>i.value.project(P),screenToFlowCoordinate:P=>i.value.screenToFlowCoordinate(P),flowToScreenCoordinate:P=>i.value.flowToScreenCoordinate(P),toObject:()=>{const P=[],O=[];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;O.push(xe)}return JSON.parse(JSON.stringify({nodes:P,edges:O,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:P=>new Promise(O=>{const{nodes:z,edges:Q,position:ee,zoom:we,viewport:de}=P;z&&x(z),Q&&S(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(()=>{O(!0)})})}else O(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const P=kf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const O=Uo.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()(O,Q,P.translateExtent);e.d3Zoom.transform(e.d3Selection,ee)}se(P)},$destroy:()=>{}}}const _N=["data-id","data-handleid","data-nodeid","data-handlepos"],kN={name:"Handle",compatConfig:{MODE:3}},so=t.defineComponent({...kN,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:b,connectedEdges:g}=bf(),_=t.ref(),k=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),E=t.toRef(()=>{var S,T,R,w,v,I;return((S=l.value)==null?void 0:S.nodeId)===f&&((T=l.value)==null?void 0:T.id)===e.id&&((R=l.value)==null?void 0:R.type)===i.value||((w=c.value)==null?void 0:w.nodeId)===f&&((v=c.value)==null?void 0:v.id)===e.id&&((I=c.value)==null?void 0:I.type)===i.value}),N=t.toRef(()=>{var S,T,R;return((S=s.value)==null?void 0:S.nodeId)===f&&((T=s.value)==null?void 0:T.id)===e.id&&((R=s.value)==null?void 0:R.type)===i.value}),{handlePointerDown:C,handleClick:A}=gf({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),B=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(S=>{const T=S[`${i.value}Handle`];return S[i.value]!==f?!1:T?T===e.id:!0}):typeof e.connectable=="number"?g.value.filter(S=>{const T=S[`${i.value}Handle`];return S[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 S;if(!y.dimensions.width||!y.dimensions.height)return;const T=(S=y.handleBounds[i.value])==null?void 0:S.find(V=>V.id===e.id);if(!d.value||T)return;const R=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!_.value||!R||!e.id)return;const w=b.value.getBoundingClientRect(),v=_.value.getBoundingClientRect(),I=window.getComputedStyle(R),{m22:L}=new window.DOMMatrixReadOnly(I.transform),M={id:e.id,position:e.position,x:(v.left-w.left)/L,y:(v.top-w.top)/L,type:i.value,nodeId:f,...qa(_.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],M]});function $(S){const T=rs(S);B.value&&k.value&&(T&&S.button===0||!T)&&C(S)}function x(S){!f||!s.value&&!k.value||B.value&&A(S)}return n({handleClick:A,handlePointerDown:C,onClick:x,onPointerDown:$}),(S,T)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":S.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${S.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:B.value,connecting:N.value,connectablestart:k.value,connectableend:h.value,connectionindicator:B.value&&(k.value&&!E.value||h.value&&E.value)}]]),onMousedown:$,onTouchstartPassive:$,onClick:x},[t.renderSlot(S.$slots,"default",{id:S.id})],42,_N))}}),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 EN=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 NN=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 wN=or,IN=["transform"],vN=["width","height","x","y","rx","ry"],CN=["y"],SN={name:"EdgeText",compatConfig:{MODE:3}},xN=t.defineComponent({...SN,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,vN)):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,CN)],8,IN))}}),RN=["id","d","marker-end","marker-start"],AN=["d","stroke-width"],$N={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ir=t.defineComponent({...$N,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,RN),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,AN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(xN,{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 Ef({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 Nf({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 wf({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 If(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top,curvature:s=.25}=e,[c,d]=wf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=wf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,y,b]=Nf({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,b]}function vf({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 Cf(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top}=e,[s,c]=vf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=vf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,y]=Nf({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 Sf={[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 TN({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 xf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function MN({source:e,sourcePosition:n=De.Bottom,target:o,targetPosition:i=De.Top,center:a,offset:r}){const l=Sf[n],s=Sf[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=TN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,y,b;const g={x:0,y:0},_={x:0,y:0},[k,h,E,N]=Ef({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??k,b=a.y??h;const A=[{x:y,y:c.y},{x:y,y:d.y}],B=[{x:c.x,y:b},{x:d.x,y:b}];l[m]===p?f=m==="x"?A:B:f=m==="x"?B:A}else{const A=[{x:c.x,y:d.y}],B=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?B:A:f=l.y===p?A:B,n===i){const R=Math.abs(e[m]-o[m]);if(R<=r){const w=Math.min(r-1,r-R);l[m]===p?g[m]=(c[m]>e[m]?-1:1)*w:_[m]=(d[m]>o[m]?-1:1)*w}}if(n!==i){const R=m==="x"?"y":"x",w=l[m]===s[R],v=c[R]>d[R],I=c[R]<d[R];(l[m]===1&&(!w&&v||w&&I)||l[m]!==1&&(!w&&I||w&&v))&&(f=m==="x"?A:B)}const $={x:c.x+g.x,y:c.y+g.y},x={x:d.x+_.x,y:d.y+_.y},S=Math.max(Math.abs($.x-f[0].x),Math.abs(x.x-f[0].x)),T=Math.max(Math.abs($.y-f[0].y),Math.abs(x.y-f[0].y));S>=T?(y=($.x+x.x)/2,b=f[0].y):(y=f[0].x,b=($.y+x.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...f,{x:d.x+_.x,y:d.y+_.y},o],y,b,E,N]}function VN(e,n,o,i){const a=Math.min(xf(e,n)/2,xf(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,b]=MN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((_,k,h)=>{let E;return h>0&&h<m.length-1?E=VN(m[h-1],k,m[h+1],s):E=`${h===0?"M":"L"}${k.x} ${k.y}`,_+=E,_},""),p,f,y,b]}function BN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Ef({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const DN=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]=BN(e);return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),Rf=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})}}}),ON=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(Rf,{...e,...n,borderRadius:0})}}),LN=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]=If({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),PN=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]=Cf({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),zN={input:wN,default:EN,output:NN},FN={default:LN,straight:DN,step:ON,smoothstep:Rf,simplebezier:PN};function UN(e,n,o){const i=t.computed(()=>b=>n.value.get(b)),a=t.computed(()=>b=>o.value.get(b)),r=t.computed(()=>{const b={...FN,...e.edgeTypes},g=Object.keys(b);for(const _ of e.edges)_.type&&!g.includes(_.type)&&(b[_.type]=_.type);return b}),l=t.computed(()=>{const b={...zN,...e.nodeTypes},g=Object.keys(b);for(const _ of e.nodes)_.type&&!g.includes(_.type)&&(b[_.type]=_.type);return b}),s=t.computed(()=>e.onlyRenderVisibleElements?jm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const g of e.edges){const _=n.value.get(g.source),k=n.value.get(g.target);H0({sourcePos:_.computedPosition||{x:0,y:0},targetPos:k.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:k.dimensions.width,targetHeight:k.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(g)}return b}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const b=[];for(const g of e.nodes)g.selected&&b.push(g);return b}),m=t.computed(()=>{const b=[];for(const g of e.edges)g.selected&&b.push(g);return b}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const b=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&b.push(g);return b}),y=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=kf(),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=UN(a,s,c),u=bN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...P_(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(ff,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)},b=g=>{d.applyEdgeChanges(g)};m?(d.onNodesChange(y),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)),f(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)})},{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(ff,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 HN(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 jN={name:"UserSelection",compatConfig:{MODE:3}},KN=t.defineComponent({...jN,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))}}),GN=["tabIndex"],YN={name:"NodesSelection",compatConfig:{MODE:3}},qN=t.defineComponent({...YN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=et(),s=_f(),c=t.ref(null),d=yf({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||Ho[y.key]&&(y.preventDefault(),s({x:Ho[y.key].x,y:Ho[y.key].y},y.shiftKey))}return(y,b)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,GN)],6)):t.createCommentVNode("",!0)}});function WN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const JN={name:"Pane",compatConfig:{MODE:3}},XN=t.defineComponent({...JN,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:b,multiSelectionKeyCode:g,multiSelectionActive:_,edgeLookup:k,nodeLookup:h,connectionLookup:E,defaultEdgeOptions:N,connectionStartHandle:C,panOnDrag:A}=et(),B=t.shallowRef(null),$=t.shallowRef(new Set),x=t.shallowRef(new Set),S=t.shallowRef(null),T=t.toRef(()=>c.value&&(e.isSelecting||r.value)),R=t.toRef(()=>C.value!==null);let w=!1,v=!1;const I=Ci(b,{actInsideInputWithModifier:!1}),L=Ci(g);t.watch(I,he=>{he&&(p(m.value),f(u.value),d.value=!1)}),t.watch(L,he=>{_.value=he});function M(he,_e){return ye=>{ye.target===_e&&(he==null||he(ye))}}function V(he){if(w||R.value){w=!1;return}a.paneClick(he),l(),d.value=!1}function U(he){var _e;if(Array.isArray(A.value)&&((_e=A.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(S.value=((_e=n.value)==null?void 0:_e.getBoundingClientRect())??null,!c.value||!e.isSelecting||he.button!==0||he.target!==B.value||!S.value)return;(Ae=(ye=he.target)==null?void 0:ye.setPointerCapture)==null||Ae.call(ye,he.pointerId);const{x:Fe,y:se}=WN(he,S.value);v=!0,w=!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(!S.value||!s.value)return;w=!0;const{x:ye,y:Ae}=cn(he,S.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=x.value;$.value=new Set(jm(o.value,ne,i.value,y.value===Zl.Partial,!0).map(O=>O.id)),x.value=new Set;const P=((_e=N.value)==null?void 0:_e.selectable)??!0;for(const O of $.value){const z=E.value.get(O);if(z)for(const{edgeId:Q}of z.values()){const ee=k.value.get(Q);ee&&(ee.selectable??P)&&x.value.add(Q)}}if(!mf(ae,$.value)){const O=Ln(h.value,$.value,!0);a.nodesChange(O)}if(!mf(me,x.value)){const O=Ln(k.value,x.value);a.edgesChange(O)}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===B.value&&V(he),r.value=!1,s.value=null,d.value=$.value.size>0,a.selectionEnd(he),e.selectionKeyPressed&&(w=!1),v=!1)}return(he,_e)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:B,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:he.isSelecting}]),onClick:_e[0]||(_e[0]=ye=>T.value?void 0:M(V,B.value)(ye)),onContextmenu:_e[1]||(_e[1]=ye=>M(U,B.value)(ye)),onWheelPassive:_e[2]||(_e[2]=ye=>M(oe,B.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(KN,{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(qN,{key:1})):t.createCommentVNode("",!0)],34))}}),ZN={name:"Transform",compatConfig:{MODE:3}},QN=t.defineComponent({...ZN,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))}}),ew={name:"Viewport",compatConfig:{MODE:3}},tw=t.defineComponent({...ew,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:b,noWheelClassName:g,noPanClassName:_,emits:k,connectionStartHandle:h,userSelectionActive:E,paneDragging:N,d3Zoom:C,d3Selection:A,d3ZoomHandler:B,viewport:$,viewportRef:x,paneClickDistance:S}=et();HN(x);const T=t.shallowRef(!1),R=t.shallowRef(!1);let w=null,v=!1,I=0,L={x:0,y:0,zoom:0};const M=Ci(s),V=Ci(l),U=Ci(r),oe=t.toRef(()=>(!V.value||V.value&&l.value===!0)&&(M.value||m.value)),ue=t.toRef(()=>M.value||c.value),be=t.toRef(()=>l.value===!0&&oe.value!==!0),pe=t.toRef(()=>V.value&&l.value!==!0||E.value||be.value),he=t.toRef(()=>h.value!==null);t.onMounted(()=>{if(!x.value){Ti("Viewport element is missing");return}const se=x.value,ne=se.getBoundingClientRect(),ae=w0().clickDistance(S.value).scaleExtent([n.value,o.value]).translateExtent(a.value),me=jt(se).call(ae),P=me.on("wheel.zoom"),O=Uo.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()(O,z,a.value);ae.transform(me,Q),ae.wheelDelta(ns),C.value=ae,A.value=me,B.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"&&(N.value=!0),L=de,k.viewportChangeStart(de),k.moveStart({event:ee,flowTransform:de})}),ae.on("end",ee=>{if(!ee.sourceEvent)return null;if(T.value=!1,N.value=!1,_e(oe.value,I??0)&&!v&&k.paneContextMenu(ee.sourceEvent),v=!1,ye(L,ee.transform)){const we=Ae(ee.transform);L=we,k.viewportChangeEnd(we),k.moveEnd({event:ee,flowTransform:we})}}),ae.filter(ee=>{var we;const de=U.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||E.value||he.value&&!Y||!p.value&&ee.type==="dblclick"||Fe(ee,g.value)&&Y||Fe(ee,_.value)&&(!Y||ue.value&&Y&&!U.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||M.value||Y)&&X}),t.watch([E,oe],()=>{E.value&&!T.value?ae.on("zoom",null):E.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),k.viewportChange(we),k.move({event:ee,flowTransform:we})})},{immediate:!0}),t.watch([E,ue,d,U,f,b,g],()=>{ue.value&&!U.value&&!E.value?me.on("wheel.zoom",ee=>{if(Fe(ee,g.value))return!1;const we=U.value||y.value,de=f.value&&ee.ctrlKey;if(!(!b.value||ue.value||we||de))return!1;ee.preventDefault(),ee.stopImmediatePropagation();const Ce=me.property("__zoom").k||1,Y=$i();if(!M.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"));w&&clearTimeout(w),R.value?(k.move({event:ee,flowTransform:Be}),k.viewportChange(Be),w=setTimeout(()=>{k.moveEnd({event:ee,flowTransform:Be}),k.viewportChangeEnd(Be),R.value=!1},150)):(R.value=!0,k.moveStart({event:ee,flowTransform:Be}),k.viewportChangeStart(Be))},{passive:!1}):typeof P<"u"&&me.on("wheel.zoom",function(ee,we){const de=!b.value&&ee.type==="wheel"&&!ee.ctrlKey,xe=U.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:x,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(XN,{"is-selecting":pe.value,"selection-key-pressed":t.unref(V),class:t.normalizeClass({connecting:he.value,dragging:t.unref(N),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(QN,null,{default:t.withCtx(()=>[t.renderSlot(se.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),nw=["id"],ow=["id"],iw=["id"],aw={name:"A11yDescriptions",compatConfig:{MODE:3}},rw=t.defineComponent({...aw,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(Vm)}-${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,nw),t.createElementVNode("div",{id:`${t.unref(Bm)}-${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,ow),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(R0)}-${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,iw))],64))}});function lw(){const e=et();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function sw(e,n,o){return o===De.Left?e-n:o===De.Right?e+n:e}function cw(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:sw(n,e,i),cy:cw(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ps.props=["radius","centerX","centerY","position","type"],ps.compatConfig={MODE:3};const Af=ps,dw=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:b,edgesUpdatable:g,edgesFocusable:_,hooks:k}=et(),h=t.computed(()=>u(e.id)),{emit:E,on:N}=aN(h.value,r),C=t.inject(Za),A=t.getCurrentInstance(),B=t.ref(!1),$=t.ref(!1),x=t.ref(""),S=t.ref(null),T=t.ref("source"),R=t.ref(null),w=t.toRef(()=>typeof h.value.selectable>"u"?b.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"?_.value:h.value.focusable);t.provide(nN,e.id),t.provide(oN,R);const L=t.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),M=t.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),V=t.computed(()=>{const O=h.value.type||"default",z=C==null?void 0:C[`edge-${O}`];if(z)return z;let Q=h.value.template??c.value[O];if(typeof Q=="string"&&A){const ee=Object.keys(A.appContext.components);ee&&ee.includes(O)&&(Q=t.resolveComponent(O,!1))}return Q&&typeof Q!="string"?Q:(r.error(new kt(yt.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:U}=gf({nodeId:x,handleId:S,type:T,isValidConnection:p,edgeUpdaterType:T,onEdgeUpdate:be,onEdgeUpdateEnd:pe});return()=>{const O=m(h.value.source),z=m(h.value.target),Q="pathOptions"in h.value?h.value.pathOptions:{};if(!O&&!z)return r.error(new kt(yt.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!O)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||O.hidden||z.hidden)return null;let ee;i.value===En.Strict?ee=O.handleBounds.source:ee=[...O.handleBounds.source||[],...O.handleBounds.target||[]];const we=nf(ee,h.value.sourceHandle);let de;i.value===En.Strict?de=z.handleBounds.target:de=[...z.handleBounds.target||[],...z.handleBounds.source||[]];const xe=nf(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}=Ko(O,we,Ce),{x:Ie,y:Be}=Ko(z,xe,Y);return h.value.sourceX=X,h.value.sourceY=q,h.value.targetX=Ie,h.value.targetY=Be,t.h("g",{ref:R,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${V.value===!1?"default":h.value.type||"default"}`,s.value,L.value,{updating:B.value,selected:h.value.selected,animated:h.value.animated,inactive:!w.value&&!k.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?`${Bm}-${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(V.value===!1?c.value.default:V.value,{id:e.id,sourceNode:O,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,...N},style:M.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(Af,{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(Af,{position:Y,centerX:Ie,centerY:Be,radius:a.value,type:"target","data-type":"target"}))]:null]])};function oe(){B.value=!0}function ue(){B.value=!1}function be(O,z){E.update({event:O,edge:h.value,connection:z})}function pe(O){E.updateEnd({event:O,edge:h.value}),$.value=!1}function he(O,z){O.button===0&&($.value=!0,x.value=z?h.value.target:h.value.source,S.value=(z?h.value.targetHandle:h.value.sourceHandle)??null,T.value=z?"target":"source",E.updateStart({event:O,edge:h.value}),U(O))}function _e(O){var z;const Q={event:O,edge:h.value};w.value&&(l.value=!1,h.value.selected&&f.value?(d([h.value]),(z=R.value)==null||z.blur()):o([h.value])),E.click(Q)}function ye(O){E.contextMenu({event:O,edge:h.value})}function Ae(O){E.doubleClick({event:O,edge:h.value})}function Fe(O){E.mouseEnter({event:O,edge:h.value})}function se(O){E.mouseMove({event:O,edge:h.value})}function ne(O){E.mouseLeave({event:O,edge:h.value})}function ae(O){he(O,!0)}function me(O){he(O,!1)}function P(O){var z;!y.value&&Dm.includes(O.key)&&w.value&&(O.key==="Escape"?((z=R.value)==null||z.blur(),d([u(e.id)])):o([u(e.id)]))}}}),uw=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 k;return m((k=i.value)==null?void 0:k.nodeId)}),y=t.computed(()=>{var k;return m((k=a.value)==null?void 0:k.nodeId)??null}),b=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),g=t.computed(()=>c.value.markerStart?`url(#${Ai(c.value.markerStart,n)})`:""),_=t.computed(()=>c.value.markerEnd?`url(#${Ai(c.value.markerEnd,n)})`:"");return()=>{var k,h,E;if(!f.value||!i.value)return null;const N=i.value.id,C=i.value.type,A=f.value.handleBounds;let B=(A==null?void 0:A[C])??[];if(o.value===En.Loose){const M=(A==null?void 0:A[C==="source"?"target":"source"])??[];B=[...B,...M]}if(!B)return null;const $=(N?B.find(M=>M.id===N):B[0])??null,x=($==null?void 0:$.position)??De.Top,{x:S,y:T}=Ko(f.value,$,x);let R=null;y.value&&(o.value===En.Strict?R=((k=y.value.handleBounds[C==="source"?"target":"source"])==null?void 0:k.find(M=>{var V;return M.id===((V=a.value)==null?void 0:V.id)}))||null:R=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(M=>{var V;return M.id===((V=a.value)==null?void 0:V.id)}))||null);const w=((E=a.value)==null?void 0:E.position)??(x?ss[x]:null);if(!x||!w)return null;const v=l.value??c.value.type??io.Bezier;let I="";const L={sourceX:S,sourceY:T,sourcePosition:x,targetX:b.value.x,targetY:b.value.y,targetPosition:w};return v===io.Bezier?[I]=If(L):v===io.Step?[I]=fs({...L,borderRadius:0}):v===io.SmoothStep?[I]=fs(L):v===io.SimpleBezier?[I]=Cf(L):I=`M${S},${T} ${b.value.x},${b.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:S,sourceY:T,sourcePosition:x,targetX:b.value.x,targetY:b.value.y,targetPosition:w,sourceNode:f.value,sourceHandle:$,targetNode:y.value,targetHandle:R,markerEnd:_.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":_.value,"marker-start":g.value})))}}}),mw=["id","markerWidth","markerHeight","markerUnits","orient"],fw={name:"MarkerType",compatConfig:{MODE:3}},pw=t.defineComponent({...fw,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,mw))}}),hw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},yw={name:"MarkerDefinitions",compatConfig:{MODE:3}},gw=t.defineComponent({...yw,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",hw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(pw,{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))])]))}}),bw={name:"Edges",compatConfig:{MODE:3}},_w=t.defineComponent({...bw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=et();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(gw),(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(j0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(dw),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(uw))],64))}}),kw=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:b,snapToGrid:g,snapGrid:_,nodeDragThreshold:k,nodesDraggable:h,elementsSelectable:E,nodesConnectable:N,nodesFocusable:C,hooks:A}=et(),B=t.ref(null);t.provide(hf,B),t.provide(pf,e.id);const $=t.inject(Za),x=t.getCurrentInstance(),S=_f(),{node:T,parentNode:R}=bf(e.id),{emit:w,on:v}=cN(T,l),I=t.toRef(()=>typeof T.draggable>"u"?h.value:T.draggable),L=t.toRef(()=>typeof T.selectable>"u"?E.value:T.selectable),M=t.toRef(()=>typeof T.connectable>"u"?N.value:T.connectable),V=t.toRef(()=>typeof T.focusable>"u"?C.value:T.focusable),U=t.computed(()=>L.value||I.value||A.value.nodeClick.hasListeners()||A.value.nodeDoubleClick.hasListeners()||A.value.nodeMouseEnter.hasListeners()||A.value.nodeMouseMove.hasListeners()||A.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"&&x){const we=Object.keys(x.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=yf({id:e.id,el:B,disabled:()=>!I.value,selectable:L,dragHandle:()=>T.dragHandle,onStart(z){w.dragStart(z)},onDrag(z){w.drag(z)},onStop(z){w.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&&B.value&&(e.resizeObserver.observe(B.value),ee(()=>{B.value&&e.resizeObserver.unobserve(B.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>T.type,()=>T.sourcePosition,()=>T.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:B.value,forceUpdate:!0}])})}),t.watch([()=>T.position.x,()=>T.position.y,()=>{var z;return(z=R.value)==null?void 0:z.computedPosition.x},()=>{var z;return(z=R.value)==null?void 0:z.computedPosition.y},()=>{var z;return(z=R.value)==null?void 0:z.computedPosition.z},_e,()=>T.selected,()=>T.dimensions.height,()=>T.dimensions.width,()=>{var z;return(z=R.value)==null?void 0:z.dimensions.height},()=>{var z;return(z=R.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=L0({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:B,"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:L.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:U.value?"all":"none",...he.value},tabIndex:V.value?0:void 0,role:V.value?"group":void 0,"aria-describedby":y.value?void 0:`${Vm}-${n}`,"aria-label":T.ariaLabel,"aria-roledescription":"node",...T.domAttributes,onMouseenter:Fe,onMousemove:se,onMouseleave:ne,onContextmenu:ae,onClick:P,onDblclick:me,onKeydown:O},[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:M.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,_.value):z,l.error,p.value,R.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(){B.value&&d([{id:e.id,nodeElement:B.value,forceUpdate:!0}])}function Fe(z){be!=null&&be.value||w.mouseEnter({event:z,node:T})}function se(z){be!=null&&be.value||w.mouseMove({event:z,node:T})}function ne(z){be!=null&&be.value||w.mouseLeave({event:z,node:T})}function ae(z){return w.contextMenu({event:z,node:T})}function me(z){return w.doubleClick({event:z,node:T})}function P(z){L.value&&(!i.value||!I.value||k.value>0)&&cs(T,r.value,c,s,a,!1,B.value),w.click({event:z,node:T})}function O(z){if(!(es(z)||y.value))if(Dm.includes(z.key)&&L.value){const Q=z.key==="Escape";cs(T,r.value,c,s,a,Q,B.value)}else I.value&&T.selected&&Ho[z.key]&&(z.preventDefault(),b.value=`Moved selected node ${z.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~T.position.x}, y: ${~~T.position.y}`,S({x:Ho[z.key].x,y:Ho[z.key].y},z.shiftKey))}}});function Ew(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 Nw={class:"vue-flow__nodes vue-flow__container"},ww={name:"Nodes",compatConfig:{MODE:3}},Iw=t.defineComponent({...ww,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=et(),a=Ew(),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",Nw,[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(kw),{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 vw(){const{emits:e}=et();t.onMounted(()=>{if(sf()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new kt(yt.MISSING_STYLES))}})}const Cw=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Sw={name:"VueFlow",compatConfig:{MODE:3}},xw=t.defineComponent({...Sw,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=fN({modelValue:r,nodes:l,edges:s},i,c);return hN(o,c.hooks),lw(),vw(),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(tw,null,{default:t.withCtx(()=>[t.createVNode(_w),Cw,t.createVNode(Iw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(rw)],512))}}),Rw={name:"Panel",compatConfig:{MODE:3}},$f=t.defineComponent({...Rw,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))}}),Aw=["width","height","innerHTML"],$w=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,Aw))}}),tt=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ve=tt($w,[["__scopeId","data-v-05aac699"]]),uo=["red","amber","green","teal","blue","indigo","violet","pink"],Tf={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 Tw(e){return typeof e=="string"&&e in Tf}const Mw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},Vw=.15;function Bw(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 Dw(e){if(typeof e!="string")return null;const n=Bw(e);if(!n||n.s<Vw)return null;let o=null,i=1/0;for(const a of uo){const r=Math.abs(n.h-Mw[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(Tw(n))return n;const o=e==null?void 0:e.properties;return Dw((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 Ow={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)"},Lw={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function Mf(e,n=!1){return e?n?Lw[e]:Ow[e]:null}function mo(e){return Tf[e]}function Go(e){return`var(--em-swatch-${e}-bar)`}function Pw(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 zw(e,n){const o=Pw(n);return o?e(o):n.split("-")[1]??n}function Fw(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-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 Vf(e,n){const o=Fw(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 Uw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Hw={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",Hw,[(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(Vf)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),jw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Kw={key:0,class:"em-mlang__dot"},Gw=["id","role","aria-labelledby"],Yw=["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 _=o.defaultLang;return _&&o.languages.includes(_)?_:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const _=o.activeLang;return _&&o.languages.includes(_)?_:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(_){var k,h;return!!((h=(k=o.modelValue)==null?void 0:k[_])!=null&&h.trim())}const d=_=>`${o.name}-tab-${_}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(_){var E,N;const k=o.languages,h=k[(_+k.length)%k.length];h&&(l.value=h,await t.nextTick(),(N=(E=m.value)==null?void 0:E.querySelectorAll('[role="tab"]')[k.indexOf(h)])==null||N.focus())}function f(_){p(o.languages.indexOf(s.value)+_)}const y=t.computed(()=>o.languages.filter(_=>{var k,h;return _!==s.value&&!!((h=(k=o.modelValue)==null?void 0:k[_])!=null&&h.trim())})),b=t.computed(()=>{var _;return((_=o.modelValue)==null?void 0:_[s.value])??""});function g(_){const k={...o.modelValue};_.trim()===""?delete k[s.value]:k[s.value]=_,i("update:modelValue",k)}return(_,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,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:E=>l.value=h,onKeydown:[t.withKeys(t.withModifiers(E=>l.value=h,["prevent"]),["enter"]),t.withKeys(t.withModifiers(E=>l.value=h,["prevent"]),["space"]),k[0]||(k[0]=t.withKeys(t.withModifiers(E=>f(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(E=>f(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(E=>p(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(E=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(h),1),c(h)?(t.openBlock(),t.createElementBlock("span",Kw,"•")):t.createCommentVNode("",!0)],42,jw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(te.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":b.value,"onUpdate:modelValue":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":b.value,"onUpdate:modelValue":g},null,8,["name","placeholder","model-value"]))],8,Gw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,Yw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),qw=["disabled"],Ww={class:"em-panel__sub-label"},Jw={class:"em-field"},Xw={class:"em-field"},Zw={class:"em-field"},Qw={class:"em-class"},eI={class:"em-field"},tI={class:"em-field"},nI={class:"em-field"},oI={class:"em-field"},iI={class:"em-multilang"},aI={class:"em-multilang"},rI={class:"em-jpa"},lI={class:"em-field"},sI={class:"em-field"},cI={class:"em-field"},dI=["title"],uI={class:"em-swatch"},mI={class:"em-swatch__row"},fI=["title"],pI=["title","onClick"],Bf=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(R=>R.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(R=>R.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var R;return St(((R=l.value)==null?void 0:R.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=R=>R;function p(R){return R==="inherit"?a.t("em.common.inherit"):R}function f(R){r.value&&a.updateEntity(r.value.modelId,R)}function y(R,w,v){var L;const I=((L=r.value)==null?void 0:L.table)??{physicalName:""};f(R==="physicalName"?{table:{...I,physicalName:v}}:{table:{...I,logicalName:{...I.logicalName,[w]:v}}})}function b(R){f({description:Object.keys(R).length?R:void 0})}function g(R,w){var v;f({jpaAttrs:{...(v=r.value)==null?void 0:v.jpaAttrs,[R]:w}})}function _(R,w){g(R,w)}const k=t.computed(()=>{var R,w;return((w=(R=r.value)==null?void 0:R.jpaAttrs)==null?void 0:w.discriminatorType)??"inherit"}),h=t.computed(()=>{var R,w;return!((w=(R=r.value)==null?void 0:R.jpaAttrs)!=null&&w.useDiscriminator)});function E(R){g("discriminatorType",R==="inherit"?void 0:R)}function N(R){f({hasPersonalInfo:R})}function C(R){f({referenceOnly:R?!0:void 0})}function A(R){f({superClass:R.trim()||void 0})}function B(R){f({schema:R.trim()||void 0})}function $(R){f({abstractClass:R})}const x=t.computed(()=>{var R,w;return((w=(R=r.value)==null?void 0:R.declarationOfInterfaces)==null?void 0:w.join(", "))??""});function S(R){const w=R.split(",").map(v=>v.trim()).filter(Boolean);f({declarationOfInterfaces:w.length?w:void 0})}function T(R){r.value&&a.setEntitySwatch(r.value.modelId,R)}return(R,w)=>{var v,I,L;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:w[0]||(w[0]=M=>i("toggle"))},[t.createElementVNode("span",Ww,[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",Jw,[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":w[1]||(w[1]=M=>f({name:M}))},null,8,["model-value"])]),t.createElementVNode("label",Xw,[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(ni),"onUpdate:modelValue":w[2]||(w[2]=M=>f({stereotype:M}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Zw,[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":w[3]||(w[3]=M=>f({packageName:M}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Qw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",eI,[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":w[4]||(w[4]=M=>A(M))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",tI,[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":x.value,"onUpdate:modelValue":w[5]||(w[5]=M=>S(M))},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":w[6]||(w[6]=M=>$(M))},null,8,["label","model-value"])]),t.createElementVNode("label",nI,[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":w[7]||(w[7]=M=>y("physicalName",null,M))},null,8,["model-value"])]),t.createElementVNode("label",oI,[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":w[8]||(w[8]=M=>B(M))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",iI,[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,M=>{var V,U;return t.openBlock(),t.createElementBlock("label",{key:M,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(M),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${M}`,width:"100%","model-value":((U=(V=r.value.table)==null?void 0:V.logicalName)==null?void 0:U[M])??"","onUpdate:modelValue":oe=>y("logicalName",M,oe)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",aI,[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":b},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",rI,[w[13]||(w[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,M=>{var V;return t.createVNode(t.unref(te.BSCheckbox),{key:M.key,name:`jpa-${M.key}`,class:"em-check",label:M.label,"model-value":!!((V=r.value.jpaAttrs)!=null&&V[M.key]),"onUpdate:modelValue":U=>_(M.key,U)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",lI,[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":w[9]||(w[9]=M=>g("discriminatorColumnName",M.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",sI,[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":k.value,items:u,"value-provider":m,"label-provider":p,"onUpdate:modelValue":w[10]||(w[10]=M=>M&&E(M))},null,8,["disabled","model-value"])]),t.createElementVNode("label",cI,[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":(L=r.value.jpaAttrs)==null?void 0:L.discriminatorLength,"onUpdate:modelValue":w[11]||(w[11]=M=>g("discriminatorLength",M||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":N},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,dI),t.createElementVNode("fieldset",uI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",mI,[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:w[12]||(w[12]=M=>T(null))},"∅",10,fI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),M=>(t.openBlock(),t.createElementBlock("button",{key:M,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===M}]),style:t.normalizeStyle({background:t.unref(Go)(M)}),title:t.unref(a).t(t.unref(mo)(M)),onClick:V=>T(M)},null,14,pI))),128))])])],64)):t.createCommentVNode("",!0)],8,qw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),hI=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"],Df=["inherit","true","false"],rr="__OWN__";function Of(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=xo(e.state.logical,o.value.modelId,K.modelId);return le&&ma(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 b(K,le){s(K,{name:le})}function g(K){return!!o.value&&Or(K,o.value,c.value)}function _(K){var ke,H;const le=(ke=K.derivedFrom)==null?void 0:ke.associationRef,Re=(H=o.value)==null?void 0:H.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 k(K){return!!o.value&&!!xo(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 E(){return{naturalId:void 0,naturalIdMutable:void 0}}function N(K,le){s(K,{identifier:le,...le?E():{}})}function C(K,le){s(K,{transient:le||void 0,...le?E():{}})}function A(K){return!!K.transient||K.attrType==="RELATION_REF"}function B(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 x=K=>K.value,S=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 R(K,le){s(K,{customType:le.trim()===""?void 0:le})}function w(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)&&!B(K)&&!A(K)?e.t("em.attr.scaleTypeHint"):void 0}function L(K,le){w(K,{logicalName:Object.keys(le).length?le:void 0})}function M(K,le){s(K,{description:Object.keys(le).length?le:void 0})}function V(K){return K.personalInfoAttributeType??"none"}function U(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,H;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)??((H=K.label)==null?void 0:H.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 O(K,le,Re){const ke=K.dbAttrs.map((H,bt)=>{if(bt!==le)return H;const vt={...H,...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){O(K,le,{logicalName:Object.keys(Re).length?Re:void 0})}function Q(K,le){var H,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=(H=e.embeddableCatalog.value.find(Ge=>Ge.type===K.type))==null?void 0:H.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=Df;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){O(K,le,{updatable:Re==="inherit"?void 0:Re==="true"})}function Ie(K,le){w(K,{updatable:le==="inherit"?void 0:le==="true"})}const Be=Df;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){O(K,le,{insertable:Re==="inherit"?void 0:Re==="true"})}function Se(K,le){w(K,{insertable:le==="inherit"?void 0:le==="true"})}const je=t.computed(()=>o.value?Lr(o.value,e.state.logical.entities):[]),Ze=t.computed(()=>Eo(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){O(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:hI,piiLabel:r,idn:l,setAttr:s,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:p,setRowName:f,assocFieldName:y,setAssocFieldName:b,nameLocked:g,nameLockedHint:_,isManagedFk:k,setNaturalId:h,clearNaturalIdPatch:E,setIdentifier:N,setTransient:C,dbLocked:A,fkDerived:B,fkOriginPhysical:$,typeValueOf:x,typeLabelOf:S,setAttrType:T,setAttrCustomType:R,setDb:w,scaleApplicable:v,scaleHint:I,setDbLogical:L,setAttrDescription:M,attrPiiValue:V,setAttrPii:U,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:O,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 Lf={"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.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"},Pf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.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.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":"未指定"},zf={"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.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":"미지정"},yI=["ko","en","ja"],ys={ko:zf,en:Lf,ja:Pf};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 Ff=["ko","en","ja","zh"];function gI(e){if(e)for(const n of Ff){const o=e[n];if(o)return o}}function gs(e){const n=gI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function bI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Ff.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const _I=["aria-expanded","placeholder"],kI=["aria-selected","onClick","onMouseenter"],EI={key:0,class:"gcc__opt gcc__opt--empty"},Uf=tt(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=($,x)=>qt(o.locale??"ko",$,x),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:bI(o.items,c.value));function b(){var x;const $=(x=r.value)==null?void 0:x.getBoundingClientRect();$&&(m.value={left:`${$.left}px`,top:`${$.bottom}px`,width:`${$.width}px`})}function g(){d.value=!0,b(),u.value=Math.max(0,y.value.findIndex($=>$.groupCode===o.modelValue)),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),document.addEventListener("mousedown",B)}function _(){d.value=!1,window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b),document.removeEventListener("mousedown",B)}t.onBeforeUnmount(_);function k(){g(),t.nextTick(()=>{var $;return($=l.value)==null?void 0:$.select()})}function h(){d.value||g(),u.value=0}function E($){i("update:modelValue",$.groupCode),c.value=gs($),_()}function N(){i("update:modelValue",void 0),c.value="",_()}function C(){c.value.trim()===""?N():(c.value=f.value,_())}function A($){var x;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 S=y.value[u.value];S&&E(S),$.preventDefault()}else $.key==="Escape"&&(c.value=f.value,_(),(x=l.value)==null||x.blur())}function B($){var S,T;const x=$.target;!((S=r.value)!=null&&S.contains(x))&&!((T=s.value)!=null&&T.contains(x))&&C()}return($,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":x[0]||(x[0]=S=>c.value=S),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:k,onInput:h,onKeydown:A},null,40,_I),[[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:x[1]||(x[1]=t.withModifiers(()=>{},["prevent"])),onClick:N},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(S,T)=>(t.openBlock(),t.createElementBlock("li",{key:S.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":T===u.value,"is-selected":S.groupCode===e.modelValue}]),role:"option","aria-selected":S.groupCode===e.modelValue,onMousedown:x[2]||(x[2]=t.withModifiers(()=>{},["prevent"])),onClick:R=>E(S),onMouseenter:R=>u.value=T},t.toDisplayString(t.unref(gs)(S)),43,kI))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",EI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),NI=["aria-labelledby"],wI=["aria-checked","tabindex","onClick","onKeydown"],Hf=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,wI))),128))],8,NI))}}),[["__scopeId","data-v-5c793bbb"]]),II=["disabled"],vI={class:"em-aw__toolbar"},CI={class:"em-aw__count"},SI={class:"em-aw__scroll"},xI={class:"em-aw__table"},RI={class:"c-name"},AI={class:"c-type"},$I={class:"c-logical"},TI=["id"],MI={class:"c-col"},VI={class:"c-constraints"},BI={class:"c-del"},DI={class:"c-expand"},OI=["title","onClick","onKeydown"],LI=["title"],PI=["title"],zI={key:1,class:"em-aw__muted"},FI=["title"],UI=["title"],HI=["title"],jI={class:"em-aw__cflags"},KI=["title"],GI={key:0,class:"em-aw__embed-col"},YI={class:"em-aw__embed-label"},qI=["title"],WI={colspan:"8"},JI={class:"em-aw__detail"},XI={class:"em-aw__dgroup"},ZI=["title"],QI={class:"em-aw__df"},ev={class:"em-aw__df"},tv={class:"em-aw__dgroup"},nv={key:0,class:"em-aw__dgroup"},ov={class:"em-aw__df"},iv={key:0,class:"em-aw__df"},av={class:"em-aw__df"},rv={class:"em-aw__dgroup em-aw__ddesc"},lv={class:"c-expand"},sv=["title","onClick","onKeydown"],cv={key:1,class:"em-aw__caret is-static","aria-hidden":"true"},dv=["title"],uv=["title"],mv=["colspan"],fv=["title"],pv={class:"em-aw__cflags"},hv=["title"],yv={colspan:"8"},gv={class:"em-aw__detail"},bv={class:"em-aw__dgroup em-aw__ddesc"},_v={class:"c-expand"},kv=["title","onClick","onKeydown"],Ev={class:"em-aw__embed-label"},Nv=["title"],wv=["title"],Iv={class:"em-aw__ro"},vv=["title"],Cv={class:"em-aw__ro"},Sv=["title"],xv={class:"em-aw__ro"},Rv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},Av={colspan:"8"},$v={class:"em-aw__detail"},Tv={class:"em-aw__dgroup"},Mv={key:0,class:"em-aw__df"},Vv={class:"em-aw__df"},Bv={class:"em-aw__df"},Dv={key:0},Ov={colspan:"99",class:"em-aw__empty"},Lv=6,jf=5,Pv=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:b,nameLocked:g,nameLockedHint:_,isManagedFk:k,setNaturalId:h,setIdentifier:E,setTransient:N,dbLocked:C,fkDerived:A,fkOriginPhysical:B,typeValueOf:$,typeLabelOf:x,setAttrType:S,setAttrCustomType:T,setDb:R,scaleApplicable:w,scaleHint:v,setDbLogical:I,attrPiiValue:L,setAttrPii:M,predefinedCustomTypeCatalog:V,embeddableCatalog:U,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:O,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}=Of(o,()=>n.entityId),Ke=t.computed(()=>{var Re;return[...((Re=i.value)==null?void 0:Re.attributes)??[]].sort((ke,H)=>ke.order-H.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",vI,[t.createElementVNode("span",CI,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]=H=>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]=H=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(U).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(U),"value-provider":H=>H.type,"label-provider":t.unref(oe),"onUpdate:modelValue":le},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",SI,[t.createElementVNode("table",xI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[ke[3]||(ke[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",RI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",AI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",$I,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,TI),t.createVNode(Hf,{modelValue:K.value,"onUpdate:modelValue":ke[2]||(ke[2]=H=>K.value=H),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",MI,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",VI,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,H=>{var bt,vt,ot,Ge,Xe,Z,Rt,$t,Sn,At;return t.openBlock(),t.createElementBlock(t.Fragment,{key:H.modelId},[H.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(H.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-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":H.name,"onUpdate:modelValue":ge=>t.unref(d)(H,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:Lv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",BI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,H.modelId)},null,8,["onClick"])])],2)):t.unref(ne)(H)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(H.modelId)}])},[t.createElementVNode("td",lv,[t.unref(ae)(H)?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["em-aw__caret",{"is-open":nt(H.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(H.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>We(H.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>We(H.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>We(H.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,sv)):(t.openBlock(),t.createElementBlock("span",cv,[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})]))]),t.createElementVNode("td",{title:t.unref(g)(H)?t.unref(_)(H):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${H.modelId}`,width:"100%",disabled:t.unref(g)(H),placeholder:t.unref(p)(H),"model-value":t.unref(m)(H),"onUpdate:modelValue":ge=>t.unref(f)(H,ge)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,dv),t.createElementVNode("td",{title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${H.modelId}`,width:"100%",disabled:"","model-value":H.type},null,8,["name","model-value"])],8,uv),t.createElementVNode("td",{colspan:t.unref(ae)(H)?jf-1:jf,class:"em-aw__embed-note"},t.toDisplayString(t.unref(ae)(H)?t.unref(o).t("em.attr.fkChildCols",{n:H.dbAttrs.length}):t.unref(o).t("em.attr.embedChildCols",{n:H.dbAttrs.length})),9,mv),t.unref(ae)(H)?(t.openBlock(),t.createElementBlock("td",{key:0,class:"c-constraints",title:t.unref(o).t("em.attr.fkDerivedNote")},[t.createElementVNode("div",pv,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${H.modelId}`,label:"PK","model-value":H.identifier,disabled:"","onUpdate:modelValue":ge=>t.unref(E)(H,ge)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${H.modelId}`,label:"NN","model-value":H.notNull,disabled:"","onUpdate:modelValue":ge=>t.unref(d)(H,{notNull:ge})},null,8,["name","model-value","onUpdate:modelValue"])])],8,fv)):t.createCommentVNode("",!0),t.createElementVNode("td",{class:"c-del",title:t.unref(k)(H)?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,H.modelId)},null,8,["onClick"])],8,hv)],2),t.unref(ae)(H)&&nt(H.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(H.modelId)}])},[ke[15]||(ke[15]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",yv,[t.createElementVNode("div",gv,[t.createElementVNode("fieldset",bv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`aw-desc-${H.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":H.description,"onUpdate:modelValue":ge=>t.unref(se)(H,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(H.dbAttrs,(ge,ft)=>{var xn,Zt,D,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",_v,[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,kv)]),t.createElementVNode("td",Ev,"↳ "+t.toDisplayString(((xn=t.unref(O)(H,ft))==null?void 0:xn.name)??((Zt=t.unref(O)(H,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=(D=t.unref(O)(H,ft))==null?void 0:D.logicalName)==null?void 0:F[K.value])??((fe=(j=t.unref(O)(H,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)(H,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(O)(H,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)(H,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,Nv),t.createElementVNode("td",{title:t.unref(we)(H)},[t.createElementVNode("span",Iv,t.toDisplayString(t.unref(z)(H,ft)),1)],8,wv),t.createElementVNode("td",{title:t.unref(we)(H)},[t.createElementVNode("span",Cv,t.toDisplayString(t.unref(Q)(H,ft)??""),1)],8,vv),t.createElementVNode("td",{class:"c-constraints",title:t.unref(we)(H)},[t.createElementVNode("span",xv,t.toDisplayString(t.unref(ee)(H,ft)!=null?`scale ${t.unref(ee)(H,ft)}`:""),1)],8,Sv),ke[17]||(ke[17]=t.createElementVNode("td",null,null,-1))],2),nt(ge.modelId)?(t.openBlock(),t.createElementBlock("tr",Rv,[ke[20]||(ke[20]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",Av,[t.createElementVNode("div",$v,[t.createElementVNode("fieldset",Tv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(Oe=t.unref(O)(H,ft))!=null&&Oe.shareable?(t.openBlock(),t.createElementBlock("label",Mv,[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)(H,ft,ce)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",Vv,[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)(H,ft,ce)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",Bv,[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)(H,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(H.modelId),"em-aw__open":nt(H.modelId)})},[t.createElementVNode("td",DI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":nt(H.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(H.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>We(H.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>We(H.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>We(H.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,OI)]),t.createElementVNode("td",{title:t.unref(g)(H)?t.unref(_)(H):t.unref(u)(H)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${H.modelId}`,width:"100%",disabled:t.unref(g)(H),placeholder:t.unref(p)(H),"model-value":t.unref(m)(H),"onUpdate:modelValue":ge=>t.unref(f)(H,ge)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,LI),t.createElementVNode("td",{title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!H.groupCode||H.attrType==="RELATION_REF"||t.unref(A)(H),items:t.unref(kc)(H.type,t.unref(V)),"value-provider":t.unref($),"label-provider":t.unref(x),"model-value":H.type,"onUpdate:modelValue":ge=>t.unref(S)(H,ge)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),H.type===t.unref(hn)&&!t.unref(A)(H)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":H.customType??"","onUpdate:modelValue":ge=>t.unref(T)(H,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,PI),t.createElementVNode("td",null,[H.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Yt,{key:0,name:`aw-logical-${H.modelId}`,languages:t.unref(o).languages.value,"active-lang":K.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(bt=H.dbAttrs[0])==null?void 0:bt.logicalName,"onUpdate:modelValue":ge=>t.unref(I)(H,ge)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",zI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${H.modelId}`,width:"100%",placeholder:t.unref(B)(H)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(C)(H),"model-value":((vt=H.dbAttrs[0])==null?void 0:vt.physicalName)??"","onUpdate:modelValue":ge=>t.unref(R)(H,{physicalName:ge})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(fo,{controller:t.unref(o),"ref-id":(ot=H.dbAttrs[0])==null?void 0:ot.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${H.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(C)(H)||t.unref(A)(H),items:t.unref(gc)(((Ge=H.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=H.dbAttrs[0])==null?void 0:Xe.dataType)??"","onUpdate:modelValue":ge=>ge&&t.unref(R)(H,{dataType:ge})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,FI),t.createElementVNode("td",{title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${H.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(C)(H)||t.unref(A)(H),"model-value":(Z=H.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":ge=>t.unref(R)(H,{length:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,UI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(A)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",jI,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${H.modelId}`,label:"PK","model-value":H.identifier,disabled:t.unref(a)||t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(E)(H,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${H.modelId}`,label:"NN","model-value":H.notNull,disabled:t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(d)(H,{notNull:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${H.modelId}`,label:"UQ","model-value":!!((Rt=H.dbAttrs[0])!=null&&Rt.unique),disabled:t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(R)(H,{unique:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,HI),t.createElementVNode("td",{class:"c-del",title:t.unref(k)(H)?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,H.modelId)},null,8,["onClick"])],8,KI)],2),t.unref(u)(H)?(t.openBlock(),t.createElementBlock("tr",GI,[ke[8]||(ke[8]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",YI,"↳ "+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-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(y)(H),"onUpdate:modelValue":ge=>t.unref(b)(H,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,qI)])):t.createCommentVNode("",!0),nt(H.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(H.modelId)}])},[ke[14]||(ke[14]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",WI,[t.createElementVNode("div",JI,[t.createElementVNode("fieldset",XI,[ke[12]||(ke[12]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(v)(H)},[ke[9]||(ke[9]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${H.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(C)(H)||t.unref(A)(H)||!t.unref(w)(H),"model-value":($t=H.dbAttrs[0])==null?void 0:$t.scale,"onUpdate:modelValue":ge=>t.unref(R)(H,{scale:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,ZI),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${H.modelId}`,label:"Auto Increment","model-value":!!((Sn=H.dbAttrs[0])!=null&&Sn.autoIncrement),disabled:t.unref(C)(H)||t.unref(A)(H)||!H.identifier,"onUpdate:modelValue":ge=>t.unref(R)(H,{autoIncrement:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",QI,[ke[10]||(ke[10]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${H.modelId}`,width:"110px",disabled:t.unref(C)(H),"model-value":t.unref(Be)(H.dbAttrs[0]),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":ge=>ge&&t.unref(Ue)(H,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",ev,[ke[11]||(ke[11]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${H.modelId}`,width:"110px",disabled:t.unref(C)(H),"model-value":t.unref(Ce)(H.dbAttrs[0]),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":ge=>ge&&t.unref(X)(H,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",tv,[ke[13]||(ke[13]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${H.modelId}`,label:"@Transient","model-value":!!H.transient,disabled:H.identifier||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(N)(H,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${H.modelId}`,label:"@NaturalId","model-value":!!H.naturalId,disabled:H.identifier||t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(h)(H,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${H.modelId}`,label:"mutable","model-value":!!H.naturalIdMutable,disabled:t.unref(C)(H)||!H.naturalId,"onUpdate:modelValue":ge=>t.unref(d)(H,{naturalIdMutable:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${H.modelId}`,label:"Multi-Value (Set)","model-value":!!((At=H.dbAttrs[0])!=null&&At.multiValue),disabled:t.unref(C)(H)||t.unref(A)(H),"onUpdate:modelValue":ge=>t.unref(R)(H,{multiValue:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(A)(H)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",nv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",ov,[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(L)(H),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":ge=>ge&&t.unref(M)(H,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(ue).length?(t.openBlock(),t.createElementBlock("label",iv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Uf,{"model-value":H.groupCode,items:t.unref(ue),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ge=>t.unref(ye)(H,ge)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",av,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(be)(H).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":H.defaultValue??"none",items:t.unref(pe)(H),"value-provider":t.unref(he),"label-provider":t.unref(_e),"onUpdate:modelValue":ge=>ge&&t.unref(Ae)(H,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-${H.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":H.defaultValue??"","onUpdate:modelValue":ge=>t.unref(Fe)(H,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",rv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`aw-desc-${H.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":H.description,"onUpdate:modelValue":ge=>t.unref(se)(H,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",Dv,[t.createElementVNode("td",Ov,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,II)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-36c8c727"]]);function bs(e,n){return n&&n!==e?`${e} (${n})`:e}function Kf(e,n,o){const i=e.dbAttrs[n];return i?oi(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function zv(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,Kf(e,0,n))}function _s(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,Kf(o,r<0?0:r,n))}function Gf(e){const n=[];for(const o of e.entity.attributes??[]){const i=o.dbAttrs.filter(a=>!a.sharedColumnRef);if(i.length!==0){if(o.dbAttrs.length===1){n.push({ref:o.modelId,label:zv(o,e)});continue}for(const a of i)n.push({ref:a.modelId,label:_s(a.modelId,e)})}}return n}const Fv=["disabled"],Uv={class:"em-idxw__list"},Hv={class:"em-idxw__list-head"},jv=["aria-label"],Kv=["aria-current","onClick","onKeydown"],Gv={class:"em-idxw__item-name"},Yv={key:0,class:"em-idxw__badge"},qv={class:"em-idxw__item-cnt"},Wv={key:0,class:"em-idxw__empty"},Jv={key:0,class:"em-idxw__edit"},Xv={class:"em-idxw__form"},Zv={class:"em-field em-idxw__name"},Qv={class:"em-field"},eC=["value","placeholder"],tC={class:"em-idxw__transfer"},nC={class:"em-idxw__pane"},oC={class:"em-idxw__pane-head"},iC=["aria-label"],aC=["aria-pressed","onClick","onKeydown"],rC=["title"],lC={key:0,class:"em-idxw__empty"},sC={class:"em-idxw__arrows"},cC={class:"em-idxw__pane"},dC={class:"em-idxw__pane-head"},uC={class:"em-idxw__col-name"},mC=["title"],fC={class:"em-idxw__col-ops"},pC=["title","disabled","onClick"],hC=["title","disabled","onClick"],yC=["title","onClick"],gC={key:0,class:"em-idxw__empty"},bC={key:1,class:"em-idxw__edit em-idxw__edit--empty"},_C=tt(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(R=>R.modelId===n.entityId)??null),a=t.computed(()=>{var R;return((R=i.value)==null?void 0:R.indexes)??[]}),r=t.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,R=>{var w;R.some(v=>v.modelId===s.value)||(s.value=((w=R[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(R=>R.modelId===s.value)??null),d=t.computed(()=>i.value?ti(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Hn(r.value)),m=R=>u.value.canon(R),p=t.computed(()=>{var R;return new Set((((R=c.value)==null?void 0:R.columns)??[]).map(w=>m(w.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function y(R){return R.physicalName&&R.physicalName!==R.field?`${R.field} (${R.physicalName})`:R.field}function b(R){return _s(R,f.value)}const g=t.computed(()=>[...Gf(f.value).filter(R=>!p.value.has(m(R.ref))).map(R=>({ref:R.ref,label:R.label,inherited:!1})),...d.value.filter(R=>!p.value.has(m(R.modelId))).map(R=>({ref:R.modelId,label:y(R),inherited:!0}))]),_=t.ref(new Set);t.watch(s,()=>_.value=new Set);function k(R){return jn(R)}function h(R,w){i.value&&o.updateIndex(i.value.modelId,R,w)}function E(){var w;if(!i.value)return;const R=Pe();o.addIndex(i.value.modelId,{modelId:R,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=R}function N(R){i.value&&o.removeIndex(i.value.modelId,R)}function C(R){c.value&&h(c.value.modelId,{parameters:R.trim()===""?void 0:R})}function A(R){const w=new Set(_.value);w.has(R)?w.delete(R):w.add(R),_.value=w}function B(){const R=c.value;if(!R||!_.value.size)return;const w=[..._.value].map(v=>({columnRef:v,descending:!1}));h(R.modelId,{columns:[...R.columns,...w]}),_.value=new Set}function $(R){const w=c.value;w&&h(w.modelId,{columns:w.columns.filter((v,I)=>I!==R)})}function x(R,w){const v=c.value;v&&h(v.modelId,{columns:v.columns.map((I,L)=>L===R?{...I,descending:w}:I)})}function S(R,w){const v=c.value;if(!v)return;const I=R+w;if(I<0||I>=v.columns.length)return;const L=[...v.columns];[L[R],L[I]]=[L[I],L[R]],h(v.modelId,{columns:L}),T(I,w)}async function T(R,w){var V,U;await t.nextTick();const v=(V=l.value)==null?void 0:V.querySelectorAll(".em-idxw__col--idx")[R];if(!v)return;const I=oe=>v.querySelector(`[data-move="${oe}"]`),L=I(w<0?"up":"down"),M=I(w<0?"down":"up");(U=L&&!L.disabled?L:M)==null||U.focus()}return(R,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",Uv,[t.createElementVNode("div",Hv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:E},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:I=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(I=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(I=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",Gv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",Yv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",qv,t.toDisplayString(v.columns.length),1)],42,Kv))),128))],8,jv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Wv,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Jv,[t.createElementVNode("div",Xv,[t.createElementVNode("label",Zv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=v=>h(c.value.modelId,{name:v}))},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":w[1]||(w[1]=v=>h(c.value.modelId,{unique:v}))},null,8,["model-value"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=v=>N(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",Qv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=v=>C(v.target.value))},null,40,eC)]),t.createElementVNode("div",tC,[t.createElementVNode("div",nC,[t.createElementVNode("div",oC,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:g.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:g.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":_.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":_.value.has(v.ref),onClick:I=>A(v.ref),onKeydown:[t.withKeys(t.withModifiers(I=>A(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(I=>A(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,rC)):t.createCommentVNode("",!0)],42,aC))),128))],8,iC),g.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",lC,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",sC,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!_.value.size,onClick:B},null,8,["caption","disabled"])]),t.createElementVNode("div",cC,[t.createElementVNode("div",dC,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,I)=>(t.openBlock(),t.createElementBlock("li",{key:I,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",uC,[t.createTextVNode(t.toDisplayString(b(v.columnRef)),1),k(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,mC)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${I}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":L=>x(I,L)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",fC,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:I===0,onClick:L=>S(I,-1)},"↑",8,pC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:I===c.value.columns.length-1,onClick:L=>S(I,1)},"↓",8,hC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:L=>$(I)},"✕",8,yC)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",gC,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",bC,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,Fv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-76dd7610"]]),kC={class:"em-op-src"},EC=["placeholder"],NC={class:"em-op-src__actions"},Yf=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",kC,[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,EC),[[t.vModelText,a.value]]),t.createElementVNode("div",NC,[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"]]),wC=["disabled"],IC={class:"em-ow__toolbar"},vC={class:"em-ow__count"},CC={class:"em-ow__scroll"},SC={class:"em-ow__table"},xC={class:"c-name"},RC={class:"c-desc"},AC=["id"],$C={class:"c-pii"},TC={class:"c-src"},MC={class:"c-del"},VC={key:0},BC={colspan:"6",class:"em-ow__empty"},DC=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((_,k)=>_.order-k.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(g){return g==="none"?o.t("em.common.noneParen"):g}const u=g=>g;function m(g,_){a.value&&o.updateOperation(a.value.modelId,g.modelId,_)}function p(g,_){m(g,{description:Object.keys(_).length?_:void 0})}function f(g){return g.personalInfoAttributeType??"none"}function y(g,_){m(g,{personalInfoAttributeType:_==="none"?void 0:_})}function b(g){i.openModal({component:Yf,bind:{operationName:g.name,sourceCode:g.sourceCode??"",locale:o.uiLocale.value,onSave:_=>m(g,{sourceCode:_})}})}return(g,_)=>{var k,h;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",IC,[t.createElementVNode("span",vC,t.toDisplayString(t.unref(o).t("em.op.section",{n:((k=a.value.operations)==null?void 0:k.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:_[0]||(_[0]=E=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",CC,[t.createElementVNode("table",SC,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",xC,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),_[2]||(_[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",RC,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,AC),t.createVNode(Hf,{modelValue:l.value,"onUpdate:modelValue":_[1]||(_[1]=E=>l.value=E),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",$C,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",TC,t.toDisplayString(t.unref(o).t("em.op.body")),1),_[3]||(_[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,E=>(t.openBlock(),t.createElementBlock("tr",{key:E.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`ow-name-${E.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":E.name,"onUpdate:modelValue":N=>m(E,{name:N})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":E.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":N=>N&&m(E,{visibility:N})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(Yt,{name:`ow-desc-${E.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":E.description,"onUpdate:modelValue":N=>p(E,N)},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(E),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":N=>N&&y(E,N)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t(E.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:N=>b(E)},null,8,["caption","onClick"])]),t.createElementVNode("td",MC,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:N=>t.unref(o).removeOperation(a.value.modelId,E.modelId)},null,8,["onClick"])])]))),128)),(h=a.value.operations)!=null&&h.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",VC,[t.createElementVNode("td",BC,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,wC)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),OC={class:"em-detail__tabs"},LC=["onClick"],PC={key:0,class:"em-detail__lock"},zC=["disabled"],FC={key:0,class:"em-detail__narrow"},UC=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",OC,[(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,LC)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",PC,[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",FC,[t.createVNode(Bf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(Pv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(_C,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(DC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,zC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function lr(e,n,o){e.openModal({component:UC,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=>Sd(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 au(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 Yo(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 Oc(e,n,Pe))i.push(...sr(e,a,r,o));for(const a of ru(e,n,Pe))i.push(nn(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function HC(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 lu(e,n,r).map(l=>nn(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function qf(e,n,o){return su(e,n,o).map(i=>nn(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function jC(e,n,o){const i=new Set(o.remove);return Yo(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 Lc(e,r,Pe)){const c=i.get(l);i.set(l,c?Dc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...sr(e,r,KC(l),o));return a}function KC(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 Wf(e){return fn(e).map(n=>({...n.col,modelId:Pe()}))}function GC(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(_=>_.modelId===p.embedded.associationRef);if(!f)continue;const y=f.end1.entityRef===m.modelId,b=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:b.multiplicity,navigable:b.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=ri(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=jC(l,n,s);return i.push(...Mi(d,n,c)),i.push(...Wt(e,c)),i}function YC(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 E;return((E=h.embedded)==null?void 0:E.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 b=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:b,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(tn(c,g));const _=l?"end2":"end1",k=l?"end1":"end2";i.push(Na(r.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Pe()},[k]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Jf(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=[wd(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 p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(Pd(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 qC(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=ri(p,s,Pe),y=f.add[0];y&&(m.end2.attributeRef=y.modelId);const b={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},g=Ea(m,b),_=sr(p,s,f,[]);return i(_.length?rt("관계 추가",[g,..._]):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=Wf(d),b=C=>C&&C.charAt(0).toLowerCase()+C.slice(1),g=new Set(c.attributes.map(C=>C.name)),_=b(d.name);let k=_;for(let C=2;g.has(k);C++)k=`${_}${C}`;const h={modelId:m,name:k,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},E={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},N={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(rt("임베드 추가",[tn(l,h),Ea(E,N)])),u},setEmbedCardinality(l,s){var _;if(r(l))return;const c=n.logical.associations.find(k=>k.modelId===l);if(!c)return;let d,u;for(const k of n.logical.entities){const h=k.attributes.find(E=>{var N;return((N=E.embedded)==null?void 0:N.associationRef)===l&&E.attrType==="EMBED_OWN"});if(h){d=k.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=k=>k==="ZERO_OR_MORE_INSTANCES"||k==="ONE_OR_MORE_INSTANCES",b=y(f.multiplicity),g=y(s);if(b===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:((_=f.jpa)==null?void 0:_.collectionType)??"LIST"}})]));else{const k=n.logical.entities.find(h=>h.modelId===m);if(!k)return;i(rt("임베드 단일 전환",[nn(d,u.modelId,{dbAttrs:Wf(k)}),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=Vd(l);if(!s){i(c);return}for(const f of n.logical.entities){const y=f.attributes.find(b=>{var g;return((g=b.embedded)==null?void 0:g.associationRef)===l});if(y){const b=[];i(rt("임베드 삭제",[c,...Nn(f.modelId,[y.modelId],b),...Wt(n.logical,b)]));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(b=>b.modelId===s.end1.entityRef),y=f==null?void 0:f.attributes.find(b=>b.modelId===s.end1.attributeRef&&b.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),b=wo(y,new Set(u.attributes.map(h=>h.name))),g=Pe(),_=zt(u.attributes),k={modelId:g,name:b,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:_,dbAttrs:[]};i(rt("inverse nav 추가",[tn(d.end1.entityRef,k),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(k=>k.modelId===f&&k.attrType==="RELATION_REF"),b=Ht(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),g=[],_=y?Nn(d.end1.entityRef,[f],g):[];i(y?rt("inverse nav 제거",[..._,b,...Wt(n.logical,g)]):b);return}}}i(Ht(l,s,c))}}}function WC(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=Yo(n.logical,u,_=>_.map(k=>k.modelId===m?{...k,...p}:k)),b=[],g=Mi(y,u,b);g.push(...Wt(n.logical,b)),i(g.length?rt("속성 수정",[f,...g]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(k=>k.type===m),f=n.logical.entities.find(k=>k.modelId===u);if(!p||!f)return null;const y=zt(f.attributes),b=Pe(),g=p.fields.map(()=>({modelId:Pe(),physicalName:"",dataType:""})),_={modelId:b,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(N=>N.modelId===u),f=p?zt(p.attributes):0,y=m.modelId??Pe(),b=m.name??`field${f}`,g={modelId:y,name:b,type:m.type??Gr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Pe(),physicalName:b,dataType:"VARCHAR"}],...m},_=tn(u,g),k=Yo(n.logical,u,N=>[...N,g]),h=[],E=Mi(k,u,h);return E.push(...Wt(n.logical,h)),i(E.length?rt("속성 추가",[_,...E]):_),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(b=>b.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 k,h;if(a(u))return;const f=nn(u,m,{dbAttrs:p}),y=(k=n.logical.entities.find(E=>E.modelId===u))==null?void 0:k.attributes.find(E=>E.modelId===m),b=(h=y==null?void 0:y.embedded)==null?void 0:h.associationRef,g=b?n.logical.associations.find(E=>E.modelId===b):void 0,_=[];g&&b&&(g.end1.legacyEmbedRaw&&_.push(Ht(b,"end1",{legacyEmbedRaw:void 0})),g.end2.legacyEmbedRaw&&_.push(Ht(b,"end2",{legacyEmbedRaw:void 0}))),i(_.length?rt("임베드 컬럼 수정",[f,..._]):f)},removeAttribute(u,m){if(a(u))return;if(xo(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=Nn(u,[m],p),y=Yo(n.logical,u,_=>_.filter(k=>k.modelId!==m)),b=[...Mi(y,u,p),...Wt(n.logical,p),...qf(n.logical,u,[m])],g=[...f,...b];i(g.length===1?g[0]:rt("속성 삭제",g))},removeAttributes(u,m){var k;if(!m.length||a(u))return;const p=m.filter(h=>!xo(n.logical,u,h));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],y=Nn(u,p,f),b=new Set(p),g=Yo(n.logical,u,h=>h.filter(E=>!b.has(E.modelId))),_=[...y,...Mi(g,u,f),...Wt(n.logical,f),...qf(n.logical,u,p)];i(_.length===1?_[0]:rt("속성 삭제",_)),((k=c.value)==null?void 0:k.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=HC(n.logical,u,m,p);i(y.length?rt("속성 재정렬",[f,...y]):f)}}}function JC(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 XC=220;function ZC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||XC));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 ks=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function QC(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const b=c.filter(g=>n.logical.entities.some(_=>_.modelId===g));if(b.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:b}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const b=n.logical.entities.find(_=>_.modelId===d.entityId);if(!b)return;const g=[...b.attributes].sort((_,k)=>_.order-k.order).filter(_=>d.ids.includes(_.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(b=>b.modelId===u),p=n.layout.entityLayouts.find(b=>b.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:b,geo:g,locked:_,...k}=p;Object.keys(k).length&&(y=k)}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(E=>E.modelId===f);if(!y)return[];const b=new Set(y.attributes.map(E=>E.name)),g=new Set(y.attributes.flatMap(E=>E.dbAttrs.map(N=>N.physicalName))),_=zt(y.attributes),k=[],h=c.attributes.map((E,N)=>{const C=JSON.parse(JSON.stringify(E));C.modelId=Pe();for(const A of C.dbAttrs)A.modelId=Pe();b.has(C.name)&&(C.name=wo(`${C.name}_copy`,b)),b.add(C.name);for(const A of C.dbAttrs)A.physicalName&&g.has(A.physicalName)&&(A.physicalName=wo(`${A.physicalName}_copy`,g)),A.physicalName&&g.add(A.physicalName);return C.order=_+N,k.push(C.modelId),tn(f,C)});return l(h.length===1?h[0]:rt("속성 붙여넣기",h)),i.value={kind:"attribute",entityId:f,ids:k,anchor:k[k.length-1]},[]}const{clone:d,idMap:u}=JC(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=b=>u.get(b);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=ad(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"?ZC(n.layout,m.layout):p.offset,y=new Map(m.layout.entityLayouts.map(h=>[h.entityRef,h])),b=new Map(m.layout.associationLayouts.map(h=>[h.associationRef,h])),g=new Map(m.layout.groupLayouts.map(h=>[h.groupRef,h])),_=[];let k=80;for(const h of m.logical.entities){const E=y.get(h.modelId),N=E?{location:ks(E.geo.location,f),size:{...E.geo.size}}:{location:{x:k+=40,y:80},size:{width:220,height:140}};let C;if(E){const{entityRef:A,geo:B,locked:$,...x}=E;C=x}_.push(ga(h,N,C))}for(const h of m.logical.associations){const E=b.get(h.modelId),N=E?{...E,waypoints:E.waypoints.map(C=>ks(C,f))}:{associationRef:h.modelId,waypoints:[]};_.push(Ea(h,N))}for(const h of m.logical.groups){const E=g.get(h.modelId),N=E?{location:ks(E.geo.location,f),size:{...E.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let C;if(E){const{groupRef:A,geo:B,locked:$,memberNoteRefs:x,...S}=E;C=S}_.push(_a(h,N,C))}return l(rt("다이어그램 가져오기",_)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(h=>h.modelId)}};return s}function eS(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(hd(s,c))},updateEntity(s,c){if(a(s))return;const d=pd(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=Yo({...n.logical,entities:n.logical.entities.map(h=>h.modelId===s?{...h,stereotype:"JPA_EMBEDDABLE"}:h)},s,h=>h.map(E=>E.identifier&&!E.derivedFrom?{...E,identifier:!1}:E)),b=[],g=cr(y,[s],b);g.push(...Wt(n.logical,b));const _=YC(n.logical,s),k=[d,...f,...g,..._];i(k.length>1?rt("임베더블 변환",k):d);return}if(p){const f=GC(n.logical,s),y=[d,...f];i(y.length>1?rt("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(Vo(s,c))},resizeEntity(s,c){a(s)||i(yd(s,c))},removeEntity(s){if(a(s))return;const c=fd(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 _ of g.attributes)_.embedded&&m.has(_.embedded.associationRef)&&p.push(...Nn(g.modelId,[_.modelId],f));for(const g of u){if(g.end1.entityRef===s||!g.end1.attributeRef)continue;const _=n.logical.entities.find(h=>h.modelId===g.end1.entityRef),k=_==null?void 0:_.attributes.find(h=>h.modelId===g.end1.attributeRef&&h.attrType==="RELATION_REF");k&&p.push(...Nn(_.modelId,[k.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))},b=new Set(u.filter(g=>g.end1.entityRef===s&&g.end2.entityRef!==s).map(g=>g.end2.entityRef));p.push(...cr(y,[...b],f)),p.push(...Wt(n.logical,f.filter(g=>g.entityId!==s))),i(p.length?rt("엔티티 삭제",[c,...p]):c)},setEntitySwatch(s,c){i(gd(s,c))},setEntityCollapsed(s,c){i(bd(s,c))},setEntityLocked(s,c){i(_d(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(kl(!0))},expandAll(){i(kl(!1))}}}function tS(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(_=>n.layout.entityLayouts.find(k=>k.entityRef===_)).filter(_=>!!_);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 _ of u){const k=_.geo.size.width||220,h=_.geo.size.height||140;m=Math.min(m,_.geo.location.x),p=Math.min(p,_.geo.location.y),f=Math.max(f,_.geo.location.x+k),y=Math.max(y,_.geo.location.y+h)}const b=40,g=28;return{location:{x:m-b,y:p-b-g},size:{width:f-m+b*2,height:y-p+b*2+g}}}return{dragGroup(d,u,m){l(d)||i(rt("그룹 이동",Jf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Id(d,u))},setGroupSwatch(d,u){i(vd(d,u))},setGroupLocked(d,u){i(Cd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(kd(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const b of d)y.memberEntityRefs.includes(b)&&m.push(ka(y.modelId,b));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(Ed(d))},dropEntity(d,u,m){var y;if(r(d))return;const p=((y=n.logical.groups.find(b=>b.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,f=[Vo(d,u)];p!==m&&(p&&f.push(ka(p,d)),m&&f.push(Nd(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(b=>{var g;return(g=b.memberNoteRefs)==null?void 0:g.includes(d)}))==null?void 0:y.groupRef)??null,f=[mi(d,u)];p!==m&&(p&&f.push(qd(p,d)),m&&f.push(Yd(m,d))),i(rt("이동",f))}}}function nS(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(b,g){if(d(),!o.value||!e.opTransport)return;const _=new nu({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:k=>{i.value=!1,a.value=k},onError:e.onOpError});_.seed((g==null?void 0:g.revSeed)??{}),c=_.attach(b),s=_}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(b){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let g;try{g=await l(b)}catch(_){return{ok:!1,reason:_ instanceof Error?_.message:String(_)}}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 oS(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(Ud({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(Hd(i))},moveNote(i,a){o(mi(i,a))},resizeNote(i,a){o(jd(i,a))},setNoteMemo(i,a){o(Kd(i,a))},setNoteSwatch(i,a){o(Gd(i,a))},addNoteConnection(i,a){o(Wd(i,a))},removeNoteConnection(i,a){o(Jd(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Xd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Zd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Qd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(eu(i,a))}}}function iS(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const E=p.ids.includes(u),N=E?p.ids.filter(A=>A!==u):[...p.ids,u];if(!N.length){o.value=null;return}const C=E&&p.anchor===u?N[N.length-1]:E?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:N,anchor:C};return}const y=n.logical.entities.find(E=>E.modelId===d),b=[...(y==null?void 0:y.attributes)??[]].sort((E,N)=>E.order-N.order).map(E=>E.modelId),g=b.indexOf(p.anchor),_=b.indexOf(u);if(g<0||_<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[k,h]=g<=_?[g,_]:[_,g];o.value={kind:"attribute",entityId:d,ids:b.slice(k,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(b=>b.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(b=>b.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(E=>E.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),y=p.map((E,N)=>f.has(E.modelId)?N:-1).filter(E=>E>=0);if(!y.length)return!1;const b=Math.min(...y),g=p.filter(E=>!f.has(E.modelId)),_=p.slice(0,b).filter(E=>!f.has(E.modelId)).length;let k;if(d<0){if(_<=0)return!0;k=_-1}else{if(g.length-_<=0)return!0;k=_+1}if(r(u.entityId))return!0;const h=p.filter(E=>f.has(E.modelId)).map(E=>E.modelId);return a(El(u.entityId,h,k)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(k=>k.modelId)),f=new Set(n.logical.groups.map(k=>k.modelId)),y=new Set(n.layout.notes.map(k=>k.modelId)),b=new Set;for(const k of d){if(!f.has(k))continue;const h=n.logical.groups.find(E=>E.modelId===k);for(const E of(h==null?void 0:h.memberEntityRefs)??[])b.add(E)}const g=[],_=[];for(const k of d)if(f.has(k)){if(s(k))continue;const h=n.layout.groupLayouts.find(A=>A.groupRef===k);if(!h)continue;const E=n.logical.groups.find(A=>A.modelId===k),N=((E==null?void 0:E.memberEntityRefs)??[]).map(A=>{var $;const B=(($=n.layout.entityLayouts.find(x=>x.entityRef===A))==null?void 0:$.geo.location)??{x:0,y:0};return{id:A,location:{x:B.x+u,y:B.y+m}}}),C={x:h.geo.location.x+u,y:h.geo.location.y+m};g.push(rt("그룹 이동",Jf(n,k,C,N))),_.push("g:"+k)}else if(p.has(k)){if(b.has(k)||l(k))continue;const h=n.layout.entityLayouts.find(E=>E.entityRef===k);if(!h)continue;g.push(Vo(k,{x:h.geo.location.x+u,y:h.geo.location.y+m})),_.push("e:"+k)}else if(y.has(k)){const h=n.layout.notes.find(E=>E.modelId===k);if(!h)continue;g.push(mi(k,{x:h.geo.location.x+u,y:h.geo.location.y+m})),_.push("n:"+k)}return g.length?(a(rt("이동",g,"nudge:"+_.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const po=Symbol("editorController");function Xf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function aS(e=Xf(),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),b=t.ref(n.flagEntitiesWithoutRelations??!1),g=t.ref(!1),_=t.ref(!1),k=t.ref(!1),h=t.ref(0),E=t.ref(null);let N=0;const C=J=>{if(n.onNotice){n.onNotice(J);return}E.value={text:J,id:++N}},A=t.ref(((Se=n.meta)==null?void 0:Se.schemaVersion)??1),B=t.ref(((je=n.meta)==null?void 0:je.opWriteEnabled)??!1),$=t.ref(((Ze=n.meta)==null?void 0:Ze.referenceOnly)??!1),x=t.computed(()=>A.value>=2&&B.value),S=t.ref(!(A.value>=2&&B.value===!1)),T=t.ref("LOGICAL_PHYSICAL"),R=t.ref("straight"),w=t.ref(!0),v=t.ref(!0),I=t.ref(null),L=t.computed(()=>{var J;return((J=I.value)==null?void 0:J.kind)==="attribute"?{entityId:I.value.entityId,attrId:I.value.anchor}:null}),M=t.computed(()=>{var J;return((J=I.value)==null?void 0:J.kind)==="attribute"?I.value.ids:[]}),V=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}),U=t.ref(null),oe=t.ref(null),ue=t.ref(null),be=t.ref(null),pe=nS({state:o,opMode:x,editable:S,opConflict:ue,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function he(){i.onChange(()=>{g.value=i.canUndo,_.value=i.canRedo,k.value=i.isDirty,h.value++})}he(),pe.setupOpAdapter(i,n.meta);const _e=t.computed(()=>qs(o.logical,o.layout)),ye=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:b.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,O=J=>{const re=Date.now();re-(P.get(J)??0)<me||(P.set(J,re),C(J))},z=J=>{if(!be.value){if(!S.value){O(m("em.notice.readOnly"));return}try{i.execute(J)}catch(re){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${J.label}):`,re),S.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)?(O(m("em.notice.entityLocked")),!0):!1,xe=J=>ee(J)?(O(m("em.notice.groupLocked")),!0):!1,Ce=J=>we(J)?(O(m("em.notice.assocLocked")),!0):!1,Y=QC({state:o,clipboard:oe,selection:I,inspectedEntityId:V,editable:S,run:z}),X=iS({state:o,selection:I,focusRequest:U,run:z,gateEntityLocked:de,isEntityLockedFn:Q,isGroupLockedFn:ee}),q=eS({state:o,editable:S,run:z,gateEntityLocked:de,isEntityLockedFn:Q,isAssocLockedFn:we}),Ie=WC({state:o,editable:S,run:z,gateEntityLocked:de,embeddableCatalog:a,t:m,emitGateNotice:O,selection:I}),Be=tS({state:o,editable:S,run:z,selection:I,gateEntityLocked:de,gateGroupLocked:xe,isGroupLockedFn:ee}),ze=oS({editable:S,run:z}),Ue=qC({state:o,editable:S,run:z,gateEntityLocked:de,gateAssocLocked:Ce});return{state:o,resolved:_e,issues:se,issuesByRef:ae,flagEntitiesWithoutRelations:b,canUndo:g,canRedo:_,dirty:k,revision:h,notice:E,editable:S,schemaVersion:A,opWriteEnabled:B,opMode:x,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:R,showGrid:w,showMinimap:v,selection:I,selectedAttr:L,selectedAttrIds:M,inspectedEntityId:V,focusRequest:U,clipboard:oe,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:$,uiLocale:u,t:m,selectableDataTypes:f,setEditable(J){S.value=J&&x.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(!S.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:()=>{S.value&&i.undo()},redo:()=>{S.value&&i.redo()},markSaved:()=>{S.value&&(pe.flush(),i.markSavePoint())},loadDiagram(J,re){pe.teardownOpAdapter(),o.logical=J.logical,o.layout=J.layout,i=new _l(o),he(),A.value=(re==null?void 0:re.schemaVersion)??1,B.value=(re==null?void 0:re.opWriteEnabled)??!1,$.value=(re==null?void 0:re.referenceOnly)??!1,S.value=!(A.value>=2&&B.value===!1),ue.value=null,be.value=null,I.value=null,g.value=i.canUndo,_.value=i.canRedo,k.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(Bd(J,re))},updateIndex(J,re,Ke){de(J)||z(wa(J,re,Ke))},removeIndex(J,re){de(J)||z(Dd(J,re))},addOperation(J,re={}){if(!S.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(Rd(J,nt)),qe},updateOperation(J,re,Ke){de(J)||z(Ad(J,re,Ke))},removeOperation(J,re){de(J)||z($d(J,re))},reorderOperations(J,re,Ke){!re.length||de(J)||z(Td(J,re,Ke))},setOperationSwatch(J,re,Ke){z(Md(J,re,Ke))},addAssociation:Ue.addAssociation,addEmbedAssociation:Ue.addEmbedAssociation,setEmbedCardinality:Ue.setEmbedCardinality,removeAssociation:Ue.removeAssociation,setAssociationIdentifying:Ue.setAssociationIdentifying,updateAssociationEnd:Ue.updateAssociationEnd,hasQuickFix(J){if(!S.value)return!1;const re=ol(J,o.logical);return re?re.kind==="setEndCascades"?!we(re.assocRef):!Q(re.entityRef):!1},applyQuickFix(J){if(!S.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(Od(J,re,Ke))},addWaypoint(J,re,Ke){z(Fd(J,re,Ke))},removeWaypoint(J,re){z(Ld(J,re))},clearWaypoints(J){z(zd(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=Ws(o.logical,o.layout);J.length&&z(rt("자동 배치",J.map(re=>Vo(re.id,re.location))))},copy:Y.copy,paste:Y.paste,importEntities:Y.importEntities}}const dr=Symbol("groupHover"),Zf=Symbol("groupDrag"),qo=Symbol("relationHighlight"),Qf=Symbol("diffOverlay"),ep=Symbol("nodeInternals"),tp=Symbol("columnResolution");function rS(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 np(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!rS(e[o],n[o]))return!1;return!0}function op(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(!np(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function lS(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function sS(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||!lS(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!op(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!np(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!!cS(e.classRows,n.classRows)}function cS(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&&!op(i.attr,a.attr))return!1}return!0}function dS(){let e;return(n,o)=>e=uS(n,o,e)}function uS(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=Eo($n(s,i)));for(const k of s.attributes){if(Wi(k)){const C=k.dbAttrs[0];if(!(C!=null&&C.physicalName&&(C!=null&&C.dataType))){const A=Kn(k,s,i,e.associations);A&&c.set(k.modelId,{...k,dbAttrs:[{...C,physicalName:(C==null?void 0:C.physicalName)||A.physicalName,dataType:(C==null?void 0:C.dataType)||A.dataType,length:(C==null?void 0:C.length)??A.length,scale:(C==null?void 0:C.scale)??A.scale},...k.dbAttrs.slice(1)]})}}if(k.identifier&&k.attrType==="RELATION_OWN"){const C=xo(e,s.modelId,k.modelId);if(C&&ma(k,C)){const A=c.get(k.modelId)??k,B=k.derivedIdFieldName||rl({...k,derivedIdFieldName:void 0},C,l());B&&c.set(k.modelId,{...A,derivedIdFieldName:B})}}const h=na(k,e.associations);if(h&&u.set(k.modelId,h),mn(k)){d.set(k.modelId,k.dbAttrs.map((C,A)=>{const B=Kn(k,s,i,e.associations,A);return B?{...C,physicalName:C.physicalName||B.physicalName,dataType:C.dataType||B.dataType,length:C.length??B.length,scale:C.scale??B.scale}:C}));continue}if(!k.attrType.startsWith("EMBED")||k.dbAttrs.length===0)continue;if(k.attrType!=="EMBED_PREDEF"){const C=p();d.set(k.modelId,k.dbAttrs.map((A,B)=>{const $=Gn(A,C);return $?{...A,physicalName:$.physicalName}:pn(k,A,B,s,e)}));continue}const E=n==null?void 0:n.find(C=>C.type===k.type);if(!E)continue;const N=p();d.set(k.modelId,k.dbAttrs.map((C,A)=>{const B=E.fields[A],$=Gn(C,N);return $?{...C,physicalName:$.physicalName,logicalName:C.logicalName??(B==null?void 0:B.logicalName),dataType:C.dataType||(B==null?void 0:B.dataType)||""}:B?{...C,physicalName:C.physicalName||B.physicalName,logicalName:C.logicalName??B.logicalName,dataType:C.dataType||B.dataType,length:C.length??B.length}:C}))}const f=new Map,y=new Map;for(const k of s.attributes){const h=d.get(k.modelId);if(h)for(let E=0;E<h.length;E++){const N=`${k.attrType}\0${k.type??""}\0${E}`,C={attrId:k.modelId,slot:E,name:h[E].physicalName??""},A=y.get(N);A?A.push(C):y.set(N,[C])}}for(const k of y.values()){if(k.length<2)continue;const h=new Map;for(const E of k)h.set(E.name,(h.get(E.name)??0)+1);for(const E of k){if((h.get(E.name)??0)<2)continue;const N=f.get(E.attrId);N?N.add(E.slot):f.set(E.attrId,new Set([E.slot]))}}const b=ll(s,e).fields.map(k=>{var h;return{attr:k.attr,synthetic:k.synthetic,sourceAttrId:k.sourceAttr.modelId,targetName:(h=k.target)==null?void 0:h.name,collection:k.collection}}),g={effectiveAttrs:c,embedCols:d,collectionTypes:u,redundantSlots:f,classRows:b},_=o==null?void 0:o.get(s.modelId);a.set(s.modelId,_&&sS(g,_)?_:g)}return a}const ip=Symbol("embedSlotCollapse"),ap=(e,n)=>`${e}:${n}`,rp="all:",lp="one:",sp="fk:",cp=e=>`${rp}${e}`,mS=(e,n)=>`${lp}${e}:${n}`,fS=(e,n)=>`${sp}${e}:${n}`,pS=e=>e.startsWith(sp)||!e.startsWith(rp)&&!e.startsWith(lp),hS=["title"],yS={key:0,class:"em-sel","aria-hidden":"true"},gS=["title","aria-expanded","disabled"],bS={class:"em-entity__stereotype"},_S={key:1,class:"em-entity__name"},kS=["title","aria-expanded"],ES={"aria-hidden":"true"},NS=["data-attr","title","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],wS=["onPointerdown"],IS={key:1,class:"em-entity__divider-label"},vS=["title"],CS={class:"em-key-slot"},SS={class:"em-key-slot"},xS=["title","aria-expanded","onClick"],RS=["title","onClick"],AS=["title","aria-expanded","onClick"],$S={key:2,class:"em-entity__type"},TS=["onClick"],MS={class:"em-entity__attrname"},VS={class:"em-entity__type"},BS={key:1,class:"em-entity__embed-summary"},DS=["title"],OS=["data-op"],LS=["onPointerdown"],PS={class:"em-entity__op-vis","aria-hidden":"true"},zS=["title"],FS={key:4,class:"em-entity__footer"},dp=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(qo,null),d=t.inject(Qf,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(tp,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(ip,void 0),y=t.inject(ep,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const b=t.computed(()=>!!o&&o.editable.value);function g(){s&&(s.value=n.data.groupRef??null)}function _(){c==null||c.setEntityHover(n.id)}function k(){c==null||c.setEntityHover(null)}const h=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),E=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!h.value),N=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&&!N.value),A=t.computed(()=>{var G;return o&&((G=o.selectedAttr.value)==null?void 0:G.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),B=t.computed(()=>A.value.size>0);function $(G,W){const ve=W.shiftKey?"range":W.metaKey||W.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,L(G),ve)}const x=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!N.value),S=t.computed(()=>n.data.entity),T=t.computed(()=>Jh(S.value,o==null?void 0:o.referenceOnlyDocument.value)),R=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>{var G;if(R.value==="CLASS"){const W=(G=p.value)==null?void 0:G.classRows;if(W)return W.map(ve=>ve.attr)}return[...S.value.attributes].sort((W,ve)=>W.order-ve.order)}),v=t.computed(()=>{var W;const G=R.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 L(G){return U.value.get(G.modelId)??G.modelId}function M(G){return A.value.has(L(G))}function V(G){var W;return!!((W=u.value)!=null&&W.changedAttributeIds.has(L(G)))}const U=t.computed(()=>{var W;const G=new Map;if(R.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=R.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(()=>b.value&&!be.value);function he(){b.value&&(o==null||o.setEntityCollapsed(n.id,!ue.value))}const _e=t.computed(()=>R.value==="PHYSICAL"||R.value==="LOGICAL_PHYSICAL"),ye=t.computed(()=>{const G=R.value==="PHYSICAL"||R.value==="LOGICAL_PHYSICAL",W={};for(const ve of w.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(()=>[...S.value.operations??[]].sort((G,W)=>G.order-W.order)),ae=t.computed(()=>R.value==="CLASS"&&ne.value.length>0),me={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function P(G){return G?me[G]:"~"}function O(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(R.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 R.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)?fS(n.id,G.modelId):mS(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(cp(n.id)))??!1),ze=t.computed(()=>Be.value&&_e.value?w.value.reduce((G,W)=>Ce(W)?G+q(W).length:G,0):0),Ue=t.computed(()=>w.value.some(G=>Ce(G)));function ie(G){const W=Ie(G);return!W||W.size===0?!1:f?f.isCollapsed(ap(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(ap(n.id,G.modelId))}function qe(G){f==null||f.toggle(Y(G))}function nt(){f==null||f.toggle(cp(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(R.value,Q(G),ve,W==null?void 0:W.targetName)}const le=t.computed(()=>{const G={};for(const W of w.value)G[W.modelId]=K(W);return G}),Re=t.computed(()=>{var G,W,ve;return z(S.value.name,(W=(G=S.value.table)==null?void 0:G.logicalName)==null?void 0:W[a.value],((ve=S.value.table)==null?void 0:ve.physicalName)??"")}),ke=t.ref(!1),H=t.ref(""),bt=t.ref(null);async function vt(){var G,W;pe.value&&(H.value=S.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=H.value.trim();G&&G!==S.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),D=t.ref(null);function F(G,W){if(!pe.value)return;W.stopPropagation(),W.preventDefault();const ve=A.value,$e=ve.has(G.modelId)?new Set(ve):new Set([G.modelId]);D.value={ids:$e,dropIndex:-1,lineY:0},W.target.setPointerCapture(W.pointerId)}function j(G){if(!D.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;D.value={...D.value,dropIndex:ve,lineY:Ee}}function fe(){const G=D.value;if(D.value=null,!G||G.dropIndex<0)return;const W=w.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(){D.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":E.value,"is-dimmed":x.value,"is-selected":N.value,"is-multi-selected":C.value,"has-focused-attr":B.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:_,onMouseleave:k,onDblclick:l},[N.value?(t.openBlock(),t.createElementBlock("div",yS,[...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:!b.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,gS),t.createElementVNode("span",bS,"«"+t.toDisplayString(t.unref(ni)(S.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=>H.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,H.value]]):(t.openBlock(),t.createElementBlock("span",_S,[(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",ES,t.toDisplayString(Be.value?"▸":"▾"),1)],40,kS)):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"},[D.value&&D.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${D.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.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":M(Ee),"is-dragging":(Qe=D.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":V(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,wS)):t.createCommentVNode("",!0),X(Ee)?(t.openBlock(),t.createElementBlock("span",IS,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",CS,[(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",SS,[_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,xS)):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,vS),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,RS)):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,AS)):t.createCommentVNode("",!0),le.value[Ee.modelId]?(t.openBlock(),t.createElementBlock("span",$S,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,NS),(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":M(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",MS,[(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",VS,t.toDisplayString(pt.dataType),1)],10,TS))),128))],64)}),128)),ze.value?(t.openBlock(),t.createElementBlock("li",BS,[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,DS)])):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,LS)):t.createCommentVNode("",!0),t.createElementVNode("span",PS,t.toDisplayString(P(Ee.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:O(Ee)})},t.toDisplayString(Ee.name)+"()",5)],10,OS)}),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,zS)):t.createCommentVNode("",!0),pe.value?(t.openBlock(),t.createElementBlock("footer",FS,[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,hS)}}}),[["__scopeId","data-v-79399400"]]),US={key:0,class:"em-sel","aria-hidden":"true"},HS={class:"em-group__label"},jS={class:"em-group__name"},KS={key:0,class:"em-group__pkg"},GS={key:1,class:"em-group__flag"},up=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=(S,T)=>l?l.t(S,T):qt("ko",S,T),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var S;return!!n.id&&((S=l==null?void 0:l.selection.value)==null?void 0:S.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(qo,null);function y(){n.id&&(f==null||f.setGroupHover(n.id))}function b(){f==null||f.setGroupHover(null)}const g=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),_=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:k,findNode:h}=et();let E=null,N=null;function C(S){var w;if(!n.id||!c.value)return;S.stopPropagation();const T=((w=h(n.id))==null?void 0:w.dimensions)??{width:400,height:300},R=k({x:S.clientX,y:S.clientY});E={fx:R.x,fy:R.y,w:T.width,h:T.height},S.target.setPointerCapture(S.pointerId)}function A(S){if(!E||!n.id)return;const T=k({x:S.clientX,y:S.clientY});N={width:Math.max(160,E.w+(T.x-E.fx)),height:Math.max(120,E.h+(T.y-E.fy))};const R=h(n.id);R&&(R.style={width:`${N.width}px`,height:`${N.height}px`})}function B(S){var T,R;E&&N&&n.id&&l&&l.resizeGroup(n.id,N),E=null,N=null,(R=(T=S.target).releasePointerCapture)==null||R.call(T,S.pointerId)}const $=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),x=t.computed(()=>{const S=o.value.name;return(S==null?void 0:S[$.value])||(S==null?void 0:S.ko)||(S==null?void 0:S.en)||(S==null?void 0:S.ja)||(S==null?void 0:S.zh)||o.value.packageName||s("em.group.fallback")});return(S,T)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":g.value,"is-dimmed":_.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:b},[d.value?(t.openBlock(),t.createElementBlock("div",US,[...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",HS,[t.createElementVNode("span",jS,t.toDisplayString(x.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",KS,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",GS,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:A,onPointerup:B},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),YS={key:0,class:"em-sel","aria-hidden":"true"},qS={key:2,class:"em-note__text"},mp=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(qo,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 w;return((w=a==null?void 0:a.source.value)==null?void 0:w.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),y=t.computed(()=>{var w;return((w=o==null?void 0:o.selection.value)==null?void 0:w.kind)==="note"&&o.selection.value.id===n.id}),b=t.computed(()=>!!n.selected&&!y.value),g=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),_=[{id:"n-top",pos:De.Top},{id:"n-right",pos:De.Right},{id:"n-bottom",pos:De.Bottom},{id:"n-left",pos:De.Left}],k=t.ref(!1),h=t.ref(""),E=t.ref(null);async function N(){var w;l.value&&(h.value=r.value.memo,k.value=!0,await t.nextTick(),(w=E.value)==null||w.focus())}function C(){k.value&&(k.value=!1,h.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,h.value)))}const{screenToFlowCoordinate:A,findNode:B}=et();let $=null,x=null;function S(w){var L;if(!l.value)return;w.stopPropagation();const v=((L=B(n.id))==null?void 0:L.dimensions)??r.value.geo.size,I=A({x:w.clientX,y:w.clientY});$={fx:I.x,fy:I.y,w:v.width,h:v.height},w.target.setPointerCapture(w.pointerId)}function T(w){if(!$)return;const v=A({x:w.clientX,y:w.clientY});x={width:Math.max(140,$.w+(v.x-$.fx)),height:Math.max(60,$.h+(v.y-$.fy))};const I=B(n.id);I&&(I.style={width:`${x.width}px`,height:`${x.height}px`})}function R(w){var v,I;$&&x&&o&&o.resizeNote(n.id,x),$=null,x=null,(I=(v=w.target).releasePointerCapture)==null||I.call(v,w.pointerId)}return(w,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":b.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:N,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",YS,[...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),k.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:E,"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=>k.value=!1,["esc"])),onPointerdown:v[2]||(v[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,h.value]]):(t.openBlock(),t.createElementBlock("div",qS,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(_,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&&!k.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:S,onPointermove:T,onPointerup:R},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 Wo=.5;function fp(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,_)=>{(Math.abs(g.x-p.x)>=Wo||Math.abs(g.y-p.y)>=Wo)&&(m.push({a:p,b:g,seg:_}),p=g)};f(c,0);let y=l.x!==0,b=c;for(let g=1;g<u.length;g++){const _=u[g],k=g<=o.length?g-1:o.length,h=Math.abs(_.x-b.x)<Wo,E=Math.abs(_.y-b.y)<Wo;h&&E||(h?(f(_,k),y=!1):E?(f(_,k),y=!0):y?(f({x:b.x,y:_.y},k),f(_,k),y=!0):(f({x:_.x,y:b.y},k),f(_,k),y=!1),b=_)}return f(i,o.length),m}function pp(e,n,o,i,a,r=20){const l=fp(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 WS=14;function hp(e,n,o,i,a,r=20){return fp(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=WS).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 JS=36;function XS(e,n,o=JS){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 yp(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 ZS(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function gp(e,n){const o=ZS(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Wo&&Math.abs(l)<Wo)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 bp(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 _p(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 QS=20,ex=22,tx=7,nx=22,kp=31,Ep=7,ox=20,Np=11,wp=11,ix=kp+Ep;function ax(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function rx(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 Ip(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 vp(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Ip(e,n);return[fr(o,a,r-Math.PI/2),fr(o,a,r+Math.PI/2)]}function Cp(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 Sp(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,QS),[d,u]=vp(e,n,c,ex);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}),ax(o.multiplicity)){const m=mr(e,n,kp);r.push({cx:m.x,cy:m.y,r:Ep})}if(rx(o.multiplicity)){const m=mr(e,n,tx),[p,f]=vp(e,n,m,nx);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,ox),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Ip(e,n),m=fr(d,Np/2,u-Math.PI/2),p=fr(d,Np/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=Cp(s,c,wp,!0),u=Cp(s,c,wp,!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 xp=200,Rp=120,Es=24;function Ap(e){var a,r;if(!e)return{x:0,y:0,width:xp,height:Rp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||xp,i=((r=e.dimensions)==null?void 0:r.height)||Rp;return{x:n.x,y:n.y,width:o,height:i}}function $p(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Tp(e){const n=t.computed(()=>Ap(e.sourceNode())),o=t.computed(()=>Ap(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)<Es){const b=(m+p)/2;m=b-Es/2,p=b+Es/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??$p(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??$p(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?bp(n.value,d,r.value.x):gp(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?bp(o.value,d,l.value.x):gp(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const Ns=Symbol("waypointController"),lx=["d"],sx=["d"],cx=["d"],dx=["x1","y1","x2","y2"],ux=["cx","cy","r"],mx=["x","y"],fx=["x","y"],px=["cx","cy","onDblclick"],hx=["x","y","onPointerdown","onDblclick"],Mp=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(Ns),a=t.inject(po,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Zf,null),s=t.inject(qo,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=O=>{var z;return(z=ae.find(Q=>Q.entity.modelId===O))==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}),b=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)}),_=t.computed(()=>{var ne;return!!((ne=n.targetNode.data)!=null&&ne.collapsed)}),{source:k,target:h,sourceSide:E,targetSide:N,isSelf:C}=Tp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>b.value,sourceRowY:()=>n.data.sourceColumnRef&&!g.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!_.value?n.targetY:void 0}),A=ix+4,B=t.computed(()=>C.value?XS(k.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?pp(k.value,E.value,b.value,h.value,N.value,A):yp(k.value,b.value,h.value)),$=t.computed(()=>C.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?hp(k.value,E.value,b.value,h.value,N.value,A):_p(k.value,b.value,h.value).map((ne,ae)=>({point:ne,segIndex:ae}))),x=t.computed(()=>C.value||!r.value?[]:b.value),S=ea;function T(ne,ae){f.value=ne,y.value={...p.value[ne]},ae.target.setPointerCapture(ae.pointerId),ae.stopPropagation()}function R(ne){if(f.value<0)return;const ae=o({x:ne.clientX,y:ne.clientY});y.value={x:ae.x,y:ae.y}}function w(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 L=t.computed(()=>S(n.data.association.end1.multiplicity)),M=t.computed(()=>S(n.data.association.end2.multiplicity)),V=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),U=t.computed(()=>V.value==="class"),oe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ne=ur(E.value);return{x:k.value.x+ne.x*10,y:k.value.y+ne.y*10}}return b.value[0]??h.value}),ue=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ae=ur(N.value);return{x:h.value.x+ae.x*10,y:h.value.y+ae.y*10}}const ne=b.value;return ne[ne.length-1]??k.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(()=>Sp(k.value,oe.value,be.value,V.value)),_e=t.computed(()=>Sp(h.value,ue.value,pe.value,V.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:B.value,fill:"none",class:"em-edge__hit"},null,8,lx),t.createElementVNode("path",{d:B.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,sx),(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,cx))),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,dx))),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,ux))),128)),U.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(k).x+8,y:t.unref(k).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(L.value),11,mx),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(M.value),11,fx)],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(O=>I(me.segIndex,O),["stop"])},null,42,px))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.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:O=>T(P,O),onPointermove:R,onPointerup:w,onDblclick:O=>v(P,O)},null,42,hx))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var wn=(e=>(e.Lines="lines",e.Dots="dots",e))(wn||{});const Vp=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]}`})},Bp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};wn.Lines+"",wn.Dots+"";const yx={[wn.Dots]:"#81818a",[wn.Lines]:"#eee"},gx=["id","x","y","width","height","patternTransform"],bx={key:2,height:"100",width:"100"},_x=["fill"],kx=["x","y","fill"],Ex={name:"Background",compatConfig:{MODE:3}},Nx=t.defineComponent({...Ex,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||yx[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(Vp),{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(Bp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",bx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,_x)])):t.createCommentVNode("",!0)])],8,gx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,kx),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),wx={name:"ControlButton",compatConfig:{MODE:3}},Ix=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},vx={type:"button",class:"vue-flow__controls-button"};function Cx(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",vx,[t.renderSlot(e.$slots,"default")])}const ho=Ix(wx,[["render",Cx]]),Sx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},xx=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},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 5"},Tx=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},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 32 30"},Dx=[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 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 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 Fx(e,n){return t.openBlock(),t.createElementBlock("svg",Px,zx)}const Ux={render:Fx},Hx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},jx=[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 Kx(e,n){return t.openBlock(),t.createElementBlock("svg",Hx,jx)}const Gx={render:Kx},Yx={name:"Controls",compatConfig:{MODE:3}},qx=t.defineComponent({...Yx,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Tm.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 b(){l(),n("zoomIn")}function g(){s(),n("zoomOut")}function _(){c(e.fitViewParams),n("fitView")}function k(){r(!p.value),n("interactionChange",!p.value)}return(h,E)=>(t.openBlock(),t.createBlock(t.unref($f),{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:b},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ax))))])]),_: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(Vx))))])]),_: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:_},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Lx))))])]),_: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:k},{default:t.withCtx(()=>[p.value?t.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Gx))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ux))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var Wx={value:()=>{}};function ws(){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 Jx(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=ws.prototype={constructor:pr,on:function(e,n){var o=this._,i=Jx(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Xx(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]=Dp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Dp(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 Xx(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Dp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=Wx,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Is="http://www.w3.org/1999/xhtml";const Op={svg:"http://www.w3.org/2000/svg",xhtml:Is,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Op.hasOwnProperty(n)?{space:Op[n],local:e}:e}function Zx(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Is&&n.documentElement.namespaceURI===Is?n.createElement(e):n.createElementNS(o,e)}}function Qx(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Lp(e){var n=hr(e);return(n.local?Qx:Zx)(n)}function eR(){}function vs(e){return e==null?eR:function(){return this.querySelector(e)}}function tR(e){typeof e!="function"&&(e=vs(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 nR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function oR(){return[]}function Pp(e){return e==null?oR:function(){return this.querySelectorAll(e)}}function iR(e){return function(){return nR(e.apply(this,arguments))}}function aR(e){typeof e=="function"?e=iR(e):e=Pp(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 zp(e){return function(){return this.matches(e)}}function Fp(e){return function(n){return n.matches(e)}}var rR=Array.prototype.find;function lR(e){return function(){return rR.call(this.children,e)}}function sR(){return this.firstElementChild}function cR(e){return this.select(e==null?sR:lR(typeof e=="function"?e:Fp(e)))}var dR=Array.prototype.filter;function uR(){return Array.from(this.children)}function mR(e){return function(){return dR.call(this.children,e)}}function fR(e){return this.selectAll(e==null?uR:mR(typeof e=="function"?e:Fp(e)))}function pR(e){typeof e!="function"&&(e=zp(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 Up(e){return new Array(e.length)}function hR(){return new Pt(this._enter||this._groups.map(Up),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 yR(e){return function(){return e}}function gR(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 bR(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 _R(e){return e.__data__}function kR(e,n){if(!arguments.length)return Array.from(this,_R);var o=n?bR:gR,i=this._parents,a=this._groups;typeof e!="function"&&(e=yR(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=ER(e.call(u,u&&u.__data__,d,i)),y=f.length,b=s[d]=new Array(y),g=l[d]=new Array(y),_=c[d]=new Array(p);o(u,m,b,g,_,f,n);for(var k=0,h=0,E,N;k<y;++k)if(E=b[k]){for(k>=h&&(h=k+1);!(N=g[h])&&++h<y;);E._next=N||null}}return l=new Pt(l,i),l._enter=s,l._exit=c,l}function ER(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function NR(){return new Pt(this._exit||this._groups.map(Up),this._parents)}function wR(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 IR(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 vR(){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 CR(e){e||(e=SR);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 SR(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function xR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function RR(){return Array.from(this)}function AR(){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 $R(){let e=0;for(const n of this)++e;return e}function TR(){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 VR(e){return function(){this.removeAttribute(e)}}function BR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function DR(e,n){return function(){this.setAttribute(e,n)}}function OR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function LR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function PR(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 zR(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?BR:VR:typeof n=="function"?o.local?PR:LR:o.local?OR:DR)(o,n))}function Hp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function FR(e){return function(){this.style.removeProperty(e)}}function UR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function HR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function jR(e,n,o){return arguments.length>1?this.each((n==null?FR:typeof n=="function"?HR:UR)(e,n,o??"")):Jo(this.node(),e)}function Jo(e,n){return e.style.getPropertyValue(n)||Hp(e).getComputedStyle(e,null).getPropertyValue(n)}function KR(e){return function(){delete this[e]}}function GR(e,n){return function(){this[e]=n}}function YR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function qR(e,n){return arguments.length>1?this.each((n==null?KR:typeof n=="function"?YR:GR)(e,n)):this.node()[e]}function jp(e){return e.trim().split(/^|\s+/)}function Cs(e){return e.classList||new Kp(e)}function Kp(e){this._node=e,this._names=jp(e.getAttribute("class")||"")}Kp.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 Gp(e,n){for(var o=Cs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Yp(e,n){for(var o=Cs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function WR(e){return function(){Gp(this,e)}}function JR(e){return function(){Yp(this,e)}}function XR(e,n){return function(){(n.apply(this,arguments)?Gp:Yp)(this,e)}}function ZR(e,n){var o=jp(e+"");if(arguments.length<2){for(var i=Cs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?XR:n?WR:JR)(o,n))}function QR(){this.textContent=""}function eA(e){return function(){this.textContent=e}}function tA(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function nA(e){return arguments.length?this.each(e==null?QR:(typeof e=="function"?tA:eA)(e)):this.node().textContent}function oA(){this.innerHTML=""}function iA(e){return function(){this.innerHTML=e}}function aA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function rA(e){return arguments.length?this.each(e==null?oA:(typeof e=="function"?aA:iA)(e)):this.node().innerHTML}function lA(){this.nextSibling&&this.parentNode.appendChild(this)}function sA(){return this.each(lA)}function cA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function dA(){return this.each(cA)}function uA(e){var n=typeof e=="function"?e:Lp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function mA(){return null}function fA(e,n){var o=typeof e=="function"?e:Lp(e),i=n==null?mA:typeof n=="function"?n:vs(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function pA(){var e=this.parentNode;e&&e.removeChild(this)}function hA(){return this.each(pA)}function yA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function gA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function bA(e){return this.select(e?gA:yA)}function _A(e){return arguments.length?this.property("__data__",e):this.node().__data__}function kA(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 NA(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 wA(e,n,o){return function(){var i=this.__on,a,r=kA(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 IA(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?wA:NA,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function qp(e,n,o){var i=Hp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function vA(e,n){return function(){return qp(this,e,n)}}function CA(e,n){return function(){return qp(this,e,n.apply(this,arguments))}}function SA(e,n){return this.each((typeof n=="function"?CA:vA)(e,n))}function*xA(){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 Wp=[null];function Pt(e,n){this._groups=e,this._parents=n}function Vi(){return new Pt([[document.documentElement]],Wp)}function RA(){return this}Pt.prototype=Vi.prototype={constructor:Pt,select:tR,selectAll:aR,selectChild:cR,selectChildren:fR,filter:pR,data:kR,enter:hR,exit:NR,join:wR,merge:IR,selection:RA,order:vR,sort:CR,call:xR,nodes:RR,node:AR,size:$R,empty:TR,each:MR,attr:zR,style:jR,property:qR,classed:ZR,text:nA,html:rA,raise:sA,lower:dA,append:uA,insert:fA,remove:hA,clone:bA,datum:_A,on:IA,dispatch:SA,[Symbol.iterator]:xA};function zn(e){return typeof e=="string"?new Pt([[document.querySelector(e)]],[document.documentElement]):new Pt([[e]],Wp)}function AA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Fn(e,n){if(e=AA(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 Ss={capture:!0,passive:!1};function xs(e){e.preventDefault(),e.stopImmediatePropagation()}function $A(e){var n=e.document.documentElement,o=zn(e).on("dragstart.drag",xs,Ss);"onselectstart"in n?o.on("selectstart.drag",xs,Ss):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function TA(e,n){var o=e.document.documentElement,i=zn(e).on("dragstart.drag",null);n&&(i.on("click.drag",xs,Ss),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function Rs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Jp(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,Xo="\\s*([+-]?\\d+)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",MA=/^#([0-9a-f]{3,8})$/,VA=new RegExp(`^rgb\\(${Xo},${Xo},${Xo}\\)$`),BA=new RegExp(`^rgb\\(${dn},${dn},${dn}\\)$`),DA=new RegExp(`^rgba\\(${Xo},${Xo},${Xo},${Oi}\\)$`),OA=new RegExp(`^rgba\\(${dn},${dn},${dn},${Oi}\\)$`),LA=new RegExp(`^hsl\\(${Oi},${dn},${dn}\\)$`),PA=new RegExp(`^hsla\\(${Oi},${dn},${dn},${Oi}\\)$`),Xp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Rs(Bi,Li,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Zp,formatHex:Zp,formatHex8:zA,formatHsl:FA,formatRgb:Qp,toString:Qp});function Zp(){return this.rgb().formatHex()}function zA(){return this.rgb().formatHex8()}function FA(){return ih(this).formatHsl()}function Qp(){return this.rgb().formatRgb()}function Li(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=MA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?eh(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=VA.exec(e))?new Bt(n[1],n[2],n[3],1):(n=BA.exec(e))?new Bt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=DA.exec(e))?br(n[1],n[2],n[3],n[4]):(n=OA.exec(e))?br(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=LA.exec(e))?oh(n[1],n[2]/100,n[3]/100,1):(n=PA.exec(e))?oh(n[1],n[2]/100,n[3]/100,n[4]):Xp.hasOwnProperty(e)?eh(Xp[e]):e==="transparent"?new Bt(NaN,NaN,NaN,0):null}function eh(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 UA(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 As(e,n,o,i){return arguments.length===1?UA(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}Rs(Bt,As,Jp(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:th,formatHex:th,formatHex8:HA,formatRgb:nh,toString:nh}));function th(){return`#${go(this.r)}${go(this.g)}${go(this.b)}`}function HA(){return`#${go(this.r)}${go(this.g)}${go(this.b)}${go((isNaN(this.opacity)?1:this.opacity)*255)}`}function nh(){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 oh(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 ih(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 jA(e,n,o,i){return arguments.length===1?ih(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}Rs(Jt,jA,Jp(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($s(e>=240?e-240:e+120,a,i),$s(e,a,i),$s(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Jt(ah(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("}${ah(this.h)}, ${kr(this.s)*100}%, ${kr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ah(e){return e=(e||0)%360,e<0?e+360:e}function kr(e){return Math.max(0,Math.min(1,e||0))}function $s(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 rh=e=>()=>e;function KA(e,n){return function(o){return e+o*n}}function GA(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 YA(e){return(e=+e)==1?lh:function(n,o){return o-n?GA(n,o,e):rh(isNaN(n)?o:n)}}function lh(e,n){var o=n-e;return o?KA(e,o):rh(isNaN(e)?n:e)}const sh=(function e(n){var o=YA(n);function i(a,r){var l=o((a=As(a)).r,(r=As(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=lh(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 Ts=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ms=new RegExp(Ts.source,"g");function qA(e){return function(){return e}}function WA(e){return function(n){return e(n)+""}}function JA(e,n){var o=Ts.lastIndex=Ms.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Ts.exec(e))&&(a=Ms.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=Ms.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?WA(c[0].x):qA(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 ch=180/Math.PI,Vs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function dh(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)*ch,skewX:Math.atan(c)*ch,scaleX:l,scaleY:s}}var Er;function XA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Vs:dh(n.a,n.b,n.c,n.d,n.e,n.f)}function ZA(e){return e==null||(Er||(Er=document.createElementNS("http://www.w3.org/2000/svg","g")),Er.setAttribute("transform",e),!(e=Er.transform.baseVal.consolidate()))?Vs:(e=e.matrix,dh(e.a,e.b,e.c,e.d,e.e,e.f))}function uh(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 b=f.push("translate(",null,n,null,o);y.push({i:b-4,x:Un(d,m)},{i:b-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 b=f.push(a(f)+"scale(",null,",",null,")");y.push({i:b-4,x:Un(d,m)},{i:b-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,b=p.length,g;++y<b;)m[(g=p[y]).i]=g.x(f);return m.join("")}}}var QA=uh(XA,"px, ","px)","deg)"),e$=uh(ZA,", ",")",")"),t$=1e-12;function mh(e){return((e=Math.exp(e))+1/e)/2}function n$(e){return((e=Math.exp(e))-1/e)/2}function o$(e){return((e=Math.exp(2*e))-1)/(e+1)}const i$=(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,b=f*f+y*y,g,_;if(b<t$)_=Math.log(p/d)/n,g=function(A){return[s+A*f,c+A*y,d*Math.exp(n*A*_)]};else{var k=Math.sqrt(b),h=(p*p-d*d+i*b)/(2*d*o*k),E=(p*p-d*d-i*b)/(2*p*o*k),N=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(E*E+1)-E);_=(C-N)/n,g=function(A){var B=A*_,$=mh(N),x=d/(o*k)*($*o$(n*B+N)-n$(N));return[s+x*f,c+x*y,d*$/mh(n*B+N)]}}return g.duration=_*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 Zo=0,Pi=0,zi=0,fh=1e3,Nr,Fi,wr=0,bo=0,Ir=0,Ui=typeof performance=="object"&&performance.now?performance:Date,ph=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bs(){return bo||(ph(a$),bo=Ui.now()+Ir)}function a$(){bo=0}function vr(){this._call=this._time=this._next=null}vr.prototype=hh.prototype={constructor:vr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Bs():+o)+(n==null?0:+n),!this._next&&Fi!==this&&(Fi?Fi._next=this:Nr=this,Fi=this),this._call=e,this._time=o,Ds()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ds())}};function hh(e,n,o){var i=new vr;return i.restart(e,n,o),i}function r$(){Bs(),++Zo;for(var e=Nr,n;e;)(n=bo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Zo}function yh(){bo=(wr=Ui.now())+Ir,Zo=Pi=0;try{r$()}finally{Zo=0,s$(),bo=0}}function l$(){var e=Ui.now(),n=e-wr;n>fh&&(Ir-=n,wr=e)}function s$(){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,Ds(i)}function Ds(e){if(!Zo){Pi&&(Pi=clearTimeout(Pi));var n=e-bo;n>24?(e<1/0&&(Pi=setTimeout(yh,e-Ui.now()-Ir)),zi&&(zi=clearInterval(zi))):(zi||(wr=Ui.now(),zi=setInterval(l$,fh)),Zo=1,ph(yh))}}function gh(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 c$=ws("start","end","cancel","interrupt"),d$=[],bh=0,_h=1,Os=2,Cr=3,kh=4,Ls=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;u$(e,o,{name:n,index:i,group:a,on:c$,tween:d$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:bh})}function Ps(e,n){var o=Xt(e,n);if(o.state>bh)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 u$(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=hh(r,0,o.time);function r(d){o.state=_h,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!==_h)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Cr)return gh(l);f.state===kh?(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(gh(function(){o.state===Cr&&(o.state=kh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Os,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Os){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=Ls,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===Ls&&(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>Os&&i.state<Ls,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 m$(e){return this.each(function(){Rr(this,e)})}function f$(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 p$(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 h$(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?f$:p$)(o,e,n))}function zs(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 Eh(e,n){var o;return(typeof n=="number"?Un:n instanceof Li?sh:(o=Li(n))?(n=o,sh):JA)(e,n)}function y$(e){return function(){this.removeAttribute(e)}}function g$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function b$(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 _$(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 k$(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 N$(e,n){var o=hr(e),i=o==="transform"?e$:Eh;return this.attrTween(e,typeof n=="function"?(o.local?E$:k$)(o,i,zs(this,"attr."+e,n)):n==null?(o.local?g$:y$)(o):(o.local?_$:b$)(o,i,n))}function w$(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function I$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function v$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&I$(e,r)),o}return a._value=n,a}function C$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&w$(e,r)),o}return a._value=n,a}function S$(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?v$:C$)(i,n))}function x$(e,n){return function(){Ps(this,e).delay=+n.apply(this,arguments)}}function R$(e,n){return n=+n,function(){Ps(this,e).delay=n}}function A$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?x$:R$)(n,e)):Xt(this.node(),n).delay}function $$(e,n){return function(){un(this,e).duration=+n.apply(this,arguments)}}function T$(e,n){return n=+n,function(){un(this,e).duration=n}}function M$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?$$:T$)(n,e)):Xt(this.node(),n).duration}function V$(e,n){if(typeof n!="function")throw new Error;return function(){un(this,e).ease=n}}function B$(e){var n=this._id;return arguments.length?this.each(V$(n,e)):Xt(this.node(),n).ease}function D$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;un(this,e).ease=o}}function O$(e){if(typeof e!="function")throw new Error;return this.each(D$(this._id,e))}function L$(e){typeof e!="function"&&(e=zp(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 P$(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 z$(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 F$(e,n,o){var i,a,r=z$(n)?Ps:un;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function U$(e,n){var o=this._id;return arguments.length<2?Xt(this.node(),o).on.on(e):this.each(F$(o,e,n))}function H$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function j$(){return this.on("end.remove",H$(this._id))}function K$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=vs(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 G$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Pp(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),b=0,g=p.length;b<g;++b)(f=p[b])&&xr(f,n,o,b,p,y);r.push(p),l.push(u)}return new In(r,l,n,o)}var Y$=Vi.prototype.constructor;function q$(){return new Y$(this._groups,this._parents)}function W$(e,n){var o,i,a;return function(){var r=Jo(this,e),l=(this.style.removeProperty(e),Jo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Nh(e){return function(){this.style.removeProperty(e)}}function J$(e,n,o){var i,a=o+"",r;return function(){var l=Jo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function X$(e,n,o){var i,a,r;return function(){var l=Jo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Jo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function Z$(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=Nh(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function Q$(e,n,o){var i=(e+="")=="transform"?QA:Eh;return n==null?this.styleTween(e,W$(e,i)).on("end.style."+e,Nh(e)):typeof n=="function"?this.styleTween(e,X$(e,i,zs(this,"style."+e,n))).each(Z$(this._id,e)):this.styleTween(e,J$(e,i,n),o).on("end.style."+e,null)}function eT(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function tT(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&eT(e,l,o)),i}return r._value=n,r}function nT(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,tT(e,n,o??""))}function oT(e){return function(){this.textContent=e}}function iT(e){return function(){var n=e(this);this.textContent=n??""}}function aT(e){return this.tween("text",typeof e=="function"?iT(zs(this,"text",e)):oT(e==null?"":e+""))}function rT(e){return function(n){this.textContent=e.call(this,n)}}function lT(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&rT(a)),n}return i._value=e,i}function sT(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,lT(e))}function cT(){for(var e=this._name,n=this._id,o=wh(),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 dT(){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 uT=0;function In(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function wh(){return++uT}var vn=Vi.prototype;In.prototype={constructor:In,select:K$,selectAll:G$,selectChild:vn.selectChild,selectChildren:vn.selectChildren,filter:L$,merge:P$,selection:q$,transition:cT,call:vn.call,nodes:vn.nodes,node:vn.node,size:vn.size,empty:vn.empty,each:vn.each,on:U$,attr:N$,attrTween:S$,style:Q$,styleTween:nT,text:aT,textTween:sT,remove:j$,tween:h$,delay:A$,duration:M$,ease:B$,easeVarying:O$,end:dT,[Symbol.iterator]:vn[Symbol.iterator]};function mT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fT={time:null,delay:0,duration:250,ease:mT};function pT(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 hT(e){var n,o;e instanceof In?(n=e._id,e=e._name):(n=wh(),(o=fT).time=Bs(),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||pT(c,n));return new In(i,this._parents,e,n)}Vi.prototype.interrupt=m$,Vi.prototype.transition=hT;const Ar=e=>()=>e;function yT(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 Fs=new Cn(1,0,0);Cn.prototype;function Us(e){e.stopImmediatePropagation()}function Hi(e){e.preventDefault(),e.stopImmediatePropagation()}function gT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bT(){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 Ih(){return this.__zoom||Fs}function _T(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function kT(){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 NT(){var e=gT,n=bT,o=ET,i=_T,a=kT,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=i$,d=ws("start","zoom","end"),u,m,p,f=500,y=150,b=0,g=10;function _(w){w.property("__zoom",Ih).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",x).filter(a).on("touchstart.zoom",S).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,v,I,L){var M=w.selection?w.selection():w;M.property("__zoom",Ih),w!==M?N(w,v,I,L):M.interrupt().each(function(){C(this,arguments).event(L).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},_.scaleBy=function(w,v,I,L){_.scaleTo(w,function(){var M=this.__zoom.k,V=typeof v=="function"?v.apply(this,arguments):v;return M*V},I,L)},_.scaleTo=function(w,v,I,L){_.transform(w,function(){var M=n.apply(this,arguments),V=this.__zoom,U=I==null?E(M):typeof I=="function"?I.apply(this,arguments):I,oe=V.invert(U),ue=typeof v=="function"?v.apply(this,arguments):v;return o(h(k(V,ue),U,oe),M,l)},I,L)},_.translateBy=function(w,v,I,L){_.transform(w,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,L)},_.translateTo=function(w,v,I,L,M){_.transform(w,function(){var V=n.apply(this,arguments),U=this.__zoom,oe=L==null?E(V):typeof L=="function"?L.apply(this,arguments):L;return o(Fs.translate(oe[0],oe[1]).scale(U.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof I=="function"?-I.apply(this,arguments):-I),V,l)},L,M)};function k(w,v){return v=Math.max(r[0],Math.min(r[1],v)),v===w.k?w:new Cn(v,w.x,w.y)}function h(w,v,I){var L=v[0]-I[0]*w.k,M=v[1]-I[1]*w.k;return L===w.x&&M===w.y?w:new Cn(w.k,L,M)}function E(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function N(w,v,I,L){w.on("start.zoom",function(){C(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,V=arguments,U=C(M,V).event(L),oe=n.apply(M,V),ue=I==null?E(oe):typeof I=="function"?I.apply(M,V):I,be=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),pe=M.__zoom,he=typeof v=="function"?v.apply(M,V):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)}U.zoom(null,ye)}})}function C(w,v,I){return!I&&w.__zooming||new A(w,v)}function A(w,v){this.that=w,this.args=v,this.active=0,this.sourceEvent=null,this.extent=n.apply(w,v),this.taps=0}A.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,v){return this.mouse&&w!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&w!=="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(w){var v=zn(this.that).datum();d.call(w,this.that,new yT(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),v)}};function B(w,...v){if(!e.apply(this,arguments))return;var I=C(this,v).event(w),L=this.__zoom,M=Math.max(r[0],Math.min(r[1],L.k*Math.pow(2,i.apply(this,arguments)))),V=Fn(w);if(I.wheel)(I.mouse[0][0]!==V[0]||I.mouse[0][1]!==V[1])&&(I.mouse[1]=L.invert(I.mouse[0]=V)),clearTimeout(I.wheel);else{if(L.k===M)return;I.mouse=[V,L.invert(V)],Rr(this),I.start()}Hi(w),I.wheel=setTimeout(U,y),I.zoom("mouse",o(h(k(L,M),I.mouse[0],I.mouse[1]),I.extent,l));function U(){I.wheel=null,I.end()}}function $(w,...v){if(p||!e.apply(this,arguments))return;var I=w.currentTarget,L=C(this,v,!0).event(w),M=zn(w.view).on("mousemove.zoom",ue,!0).on("mouseup.zoom",be,!0),V=Fn(w,I),U=w.clientX,oe=w.clientY;$A(w.view),Us(w),L.mouse=[V,this.__zoom.invert(V)],Rr(this),L.start();function ue(pe){if(Hi(pe),!L.moved){var he=pe.clientX-U,_e=pe.clientY-oe;L.moved=he*he+_e*_e>b}L.event(pe).zoom("mouse",o(h(L.that.__zoom,L.mouse[0]=Fn(pe,I),L.mouse[1]),L.extent,l))}function be(pe){M.on("mousemove.zoom mouseup.zoom",null),TA(pe.view,L.moved),Hi(pe),L.event(pe).end()}}function x(w,...v){if(e.apply(this,arguments)){var I=this.__zoom,L=Fn(w.changedTouches?w.changedTouches[0]:w,this),M=I.invert(L),V=I.k*(w.shiftKey?.5:2),U=o(h(k(I,V),L,M),n.apply(this,v),l);Hi(w),s>0?zn(this).transition().duration(s).call(N,U,L,w):zn(this).call(_.transform,U,L,w)}}function S(w,...v){if(e.apply(this,arguments)){var I=w.touches,L=I.length,M=C(this,v,w.changedTouches.length===L).event(w),V,U,oe,ue;for(Us(w),U=0;U<L;++U)oe=I[U],ue=Fn(oe,this),ue=[ue,this.__zoom.invert(ue),oe.identifier],M.touch0?!M.touch1&&M.touch0[2]!==ue[2]&&(M.touch1=ue,M.taps=0):(M.touch0=ue,V=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),V&&(M.taps<2&&(m=ue[0],u=setTimeout(function(){u=null},f)),Rr(this),M.start())}}function T(w,...v){if(this.__zooming){var I=C(this,v).event(w),L=w.changedTouches,M=L.length,V,U,oe,ue;for(Hi(w),V=0;V<M;++V)U=L[V],oe=Fn(U,this),I.touch0&&I.touch0[2]===U.identifier?I.touch0[0]=oe:I.touch1&&I.touch1[2]===U.identifier&&(I.touch1[0]=oe);if(U=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;U=k(U,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(U,oe,ue),I.extent,l))}}function R(w,...v){if(this.__zooming){var I=C(this,v).event(w),L=w.changedTouches,M=L.length,V,U;for(Us(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),V=0;V<M;++V)U=L[V],I.touch0&&I.touch0[2]===U.identifier?delete I.touch0:I.touch1&&I.touch1[2]===U.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&&(U=Fn(U,this),Math.hypot(m[0]-U[0],m[1]-U[1])<g)){var oe=zn(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Ar(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ar(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Ar(!!w),_):a},_.extent=function(w){return arguments.length?(n=typeof w=="function"?w:Ar([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):n},_.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],_):[r[0],r[1]]},_.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,_):Math.sqrt(b)},_.tapDistance=function(w){return arguments.length?(g=+w,_):g},_}const vh=Symbol("MiniMapSlots"),wT=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],IT={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},vT=t.defineComponent({...IT,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(vh),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,wT))],64)):t.createCommentVNode("",!0)}}),CT=["width","height","viewBox","aria-labelledby"],ST=["id"],xT=["d","fill","stroke","stroke-width"],RT={name:"MiniMap",compatConfig:{MODE:3}},AT=t.defineComponent({...RT,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(),b=t.ref();t.provide(vh,o);const g=t.toRef(()=>{var M;return e.width??((M=i.style)==null?void 0:M.width)??a}),_=t.toRef(()=>{var M;return e.height??((M=i.style)==null?void 0:M.height)??r}),k=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),E=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),N=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),C=t.computed(()=>ts(y.value.filter(M=>!M.hidden))),A=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})),B=t.computed(()=>y.value&&y.value.length?B0(C.value,A.value):A.value),$=t.computed(()=>{const M=B.value.width/g.value,V=B.value.height/_.value;return Math.max(M,V)}),x=t.computed(()=>{const M=$.value*g.value,V=$.value*_.value,U=e.offsetScale*$.value;return{offset:U,x:B.value.x-(M-B.value.width)/2-U,y:B.value.y-(V-B.value.height)/2-U,width:M+U*2,height:V+U*2}}),S=t.computed(()=>!x.value.x||!x.value.y?"":`
53
53
  M${x.value.x-x.value.offset},${x.value.y-x.value.offset}
54
54
  h${x.value.width+x.value.offset*2}
55
55
  v${x.value.height+x.value.offset*2}
@@ -62,5 +62,5 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
62
62
  h${-(A.value.width-2*e.maskBorderRadius)}
63
63
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
64
64
  v${-(A.value.height-2*e.maskBorderRadius)}
65
- a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(M=>{if(b.value){const V=zn(b.value),U=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=Fs.translate(he.x,he.y).scale(c.value.zoom),Ae=f.value.constrain()(ye,_e,d.value);f.value.transform(p.value,Ae)},ue=ET().wheelDelta(be=>ns(be)*(e.zoomStep/10)).on("zoom",e.pannable?oe:()=>{}).on("zoom.wheel",e.zoomable?U:()=>{});V.call(ue),M(()=>{V.on("zoom",null)})}},{flush:"post"});function T(M){const[V,U]=Fn(M);n("click",{event:M,position:{x:V,y:U}})}function R(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeClick(U),n("nodeClick",U)}function w(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeDoubleClick(U),n("nodeDblclick",U)}function v(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeMouseEnter(U),n("nodeMouseenter",U)}function I(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeMouseMove(U),n("nodeMousemove",U)}function L(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeMouseLeave(U),n("nodeMouseleave",U)}return(M,V)=>(t.openBlock(),t.createBlock(t.unref($f),{position:M.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:M.pannable,zoomable:M.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:b,width:g.value,height:_.value,viewBox:[x.value.x,x.value.y,x.value.width,x.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:T},[M.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(M.ariaLabel),9,CT)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),U=>(t.openBlock(),t.createBlock(IT,{id:U.id,key:U.id,f:"",position:U.computedPosition,dimensions:U.dimensions,selected:U.selected,dragging:U.dragging,style:t.normalizeStyle(U.style),class:t.normalizeClass(N.value(U)),color:h.value(U),"border-radius":M.nodeBorderRadius,"stroke-color":E.value(U),"stroke-width":M.nodeStrokeWidth,"shape-rendering":t.unref(k),type:U.type,hidden:U.hidden,onClick:oe=>R(oe,U),onDblclick:oe=>w(oe,U),onMouseenter:oe=>v(oe,U),onMousemove:oe=>I(oe,U),onMouseleave:oe=>L(oe,U)},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:S.value,fill:M.maskColor,stroke:M.maskStrokeColor,"stroke-width":M.maskStrokeWidth,"fill-rule":"evenodd"},null,8,ST)],8,vT))]),_:1},8,["position","class"]))}}),AT=["d"],$T=["cx","cy","onDblclick"],TT=["x","y","onPointerdown","onDblclick"],MT=tt(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=et(),i=t.inject(Ns),a=t.inject(po,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(qo,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((B,$)=>$===d.value?u.value:B)),{source:p,target:f,sourceSide:y,targetSide:b}=Tp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),g=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?pp(p.value,y.value,m.value,f.value,b.value):yp(p.value,m.value,f.value)),_=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?hp(p.value,y.value,m.value,f.value,b.value):_p(p.value,m.value,f.value).map((B,$)=>({point:B,segIndex:$})):[]),k=t.computed(()=>r.value?m.value:[]);function h(B,$){d.value=B,u.value={...c.value[B]},$.target.setPointerCapture($.pointerId),$.stopPropagation()}function E(B){if(d.value<0)return;const $=o({x:B.clientX,y:B.clientY});u.value={x:$.x,y:$.y}}function N(B){var $,x;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(x=($=B.target).releasePointerCapture)==null||x.call($,B.pointerId)}function C(B,$){$.stopPropagation(),i==null||i.removePoint(n.id,B)}function A(B,$){if(!i)return;const x=o({x:$.clientX,y:$.clientY});i.insertPoint(n.id,B,{x:x.x,y:x.y})}return(B,$)=>(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,AT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,(x,S)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${S}`,cx:x.point.x,cy:x.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(T=>A(x.segIndex,T),["stop"])},null,42,$T))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,(x,S)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${S}`,x:x.x-5,y:x.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:T=>h(S,T),onPointermove:E,onPointerup:N,onDblclick:T=>C(S,T)},null,42,TT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),VT=["data-theme"],BT={key:0,class:"em-ctx__sep",role:"separator"},DT=["aria-label"],OT={class:"em-ctx__swatches-label","aria-hidden":"true"},LT={class:"em-ctx__chips",role:"none"},PT=["aria-checked","aria-label","title","onClick"],zT=["aria-checked","aria-label","title","onClick"],FT=["disabled","onClick"],UT={class:"em-ctx__icon"},HT={class:"em-ctx__caption"},jT=tt(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(h,E)=>qt(o.locale??"ko",h,E),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(h,E){var A,B;r.value=E,l.value=(A=h.target)!=null&&A.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 N=s.value;if(!N)return;const C=N.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)),(B=f()[0])==null||B.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 E=[];for(const N of Array.from(h.children))if(N.classList.contains("em-ctx__item"))N.disabled||E.push(N);else if(N.classList.contains("em-ctx__swatches")){const C=Array.from(N.querySelectorAll(".em-ctx__chip"));C.length&&E.push(C.find(A=>A===document.activeElement)??C[0])}return E}function y(h){var A;const E=f();if(!E.length)return;const N=E.indexOf(document.activeElement),C=N<0?h>0?0:E.length-1:(N+h+E.length)%E.length;(A=E[C])==null||A.focus()}function b(h){var A,B;const E=(A=document.activeElement)==null?void 0:A.closest(".em-ctx__swatches");if(!E)return!1;const N=Array.from(E.querySelectorAll(".em-ctx__chip")),C=N.indexOf(document.activeElement);return C<0?!1:((B=N[(C+h+N.length)%N.length])==null||B.focus(),!0)}function g(h){var E,N;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":b(1)&&h.preventDefault();return;case"ArrowLeft":b(-1)&&h.preventDefault();return;case"Home":h.preventDefault(),(E=f()[0])==null||E.focus();return;case"End":{h.preventDefault();const C=f();(N=C[C.length-1])==null||N.focus();return}case"Tab":h.preventDefault(),y(h.shiftKey?-1:1)}}function _(h){h.disabled||(h.handler(),p())}function k(h,E){h.onPick(E),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(h,E)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:p,onContextmenu:t.withModifiers(p,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:E[0]||(E[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(N,C)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:C},[N.type==="separator"?(t.openBlock(),t.createElementBlock("div",BT)):N.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":N.caption},[t.createElementVNode("span",OT,t.toDisplayString(N.caption),1),t.createElementVNode("div",LT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":N.current===null}]),role:"menuitemradio","aria-checked":N.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:A=>k(N,null)},null,10,PT),(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-ctx__chip",{"is-on":N.current===A}]),style:t.normalizeStyle({background:t.unref(Go)(A)}),role:"menuitemradio","aria-checked":N.current===A,"aria-label":i(t.unref(mo)(A)),title:i(t.unref(mo)(A)),onClick:B=>k(N,A)},null,14,zT))),128))])],8,DT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":N.danger,"is-disabled":N.disabled}]),disabled:N.disabled,role:"menuitem",onClick:A=>_(N)},[t.createElementVNode("span",UT,[N.icon?(t.openBlock(),t.createBlock(Ve,{key:0,name:N.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",HT,t.toDisplayString(N.caption),1)],10,FT))],64))),128))],36)],8,VT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function Ch(e,n){return n?`${e}:${n}`:e}function Sh(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(Ch(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 KT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=Ch(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 xh(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(Sh(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=Sh(e.storageKey,s)),t.watch(o,s=>KT(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 Hs=[".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 Qo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function GT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function YT(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const b=n(y.left,y.top+y.height/2);return[{...i,x:b.x,y:b.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,p=0;const f=()=>{const y=d.trim();if(y){const b=n(m,(u+p)/2);c.push({...i,x:b.x,y:b.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const b=a.getBoundingClientRect();u===null||Math.abs(b.top-u)>1?(f(),u=b.top,m=b.left,p=b.bottom,d=s[y]):(d+=s[y],p=Math.max(p,b.bottom))}return f(),c}function $r(e,n){const o=[];for(const i of e.querySelectorAll("*"))GT(i)&&(i.closest(Hs)||Qo(i)&&o.push(...YT(i,n)));return o}function ji(e){return Math.round(e*100)/100}function qT(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Hs)||!Qo(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 WT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Qo(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 Rh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Hs)||!Qo(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 js(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 JT(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||!Qo(y))continue;const b=y.firstElementChild;if(b)if(f.type==="group"){const g=Ki(b,o);js(s,g),i.push({...g,texts:[]});const _=b.querySelector(".em-group__label");_&&i.push({...Ki(_,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:$r(b,o)})}else if(f.type==="note"){const g={...Ki(b,o),texts:$r(b,o),lines:Rh(b,b,o)};js(s,g),r.push(g)}else{const g=Ki(b,o);js(s,g);const _=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const k=b.querySelector(".em-entity__header");if(k){const h=Ki(k,o);a.push({x:g.x,y:g.y,w:g.w,h:h.y+h.h-g.y,fill:h.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:$r(b,o),lines:Rh(b,b,o),icons:qT(b,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||!Qo(y))continue;const b=y.getAttribute("d");if(!b)continue;const g=getComputedStyle(y),_=g.strokeDasharray,k=WT(f);l.push({d:b,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:$r(f,o),markers:k.length?k:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Ks(e){return Tc(JT(e))}function Ah(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 $h(e,n="diagram.svg"){const o=Ks(e);Ah(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function XT(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 Th(e,n="diagram.png",o=2){const i=Ks(e),{w:a,h:r}=XT(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 변환 실패");Ah(u,n)}finally{URL.revokeObjectURL(l)}}const ZT={class:"em-shortcuts"},QT={class:"em-shortcuts__list"},eM={class:"em-shortcuts__title"},tM={class:"em-shortcuts__keys"},nM={class:"em-shortcuts__kbd"},oM={key:0,class:"em-shortcuts__plus"},iM={class:"em-shortcuts__desc"},aM={class:"em-shortcuts__actions"},Mh=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",ZT,[t.createElementVNode("div",QT,[(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",eM,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",tM,[(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",nM,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",oM,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",iM,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",aM,[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 ei(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function rM(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 lM=["aria-label"],sM=["aria-activedescendant","aria-label","placeholder"],cM={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},dM=["aria-label"],uM={class:"em-cmdk__section","aria-hidden":"true"},mM=["id","aria-selected","onMouseenter","onClick"],fM={class:"em-cmdk__label"},pM={key:0,class:"em-cmdk__tag"},hM={key:1,class:"em-cmdk__sub"},yM=["aria-label"],gM={class:"em-cmdk__section","aria-hidden":"true"},bM=["id","aria-selected","aria-disabled","onMouseenter","onClick"],_M={class:"em-cmdk__label"},kM={key:1,class:"em-cmdk__empty"},EM=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 N=c.value,C=a.state.logical.entities.map(B=>{var $,x,S,T,R,w;return{type:"goto",kind:"entity",id:B.modelId,label:((x=($=B.table)==null?void 0:$.logicalName)==null?void 0:x[N])||B.name,sub:(S=B.table)==null?void 0:S.physicalName,match:ei(B.name,(R=(T=B.table)==null?void 0:T.logicalName)==null?void 0:R[N],(w=B.table)==null?void 0:w.physicalName)??""}}),A=a.state.logical.groups.map(B=>{var $,x,S,T;return{type:"goto",kind:"group",id:B.modelId,label:(($=B.name)==null?void 0:$[N])||((x=B.name)==null?void 0:x.ko)||B.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:ei((S=B.name)==null?void 0:S[N],(T=B.name)==null?void 0:T.ko,B.packageName)??""}});return[...C,...A]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const N=[];a.editable.value&&(N.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),N.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),N.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),N.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),N.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),N.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),N.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),N.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"])N.push({type:"action",id:`dm-${C}`,label:a.t(u[C]),run:()=>a.displayMode.value=C});return N});function p(N,C){return N.label.toLowerCase().includes(C)}const f=t.computed(()=>{const N=r.value.trim().toLowerCase();return N?d.value.filter(C=>C.match.includes(N)):d.value}),y=t.computed(()=>{const N=r.value.trim().toLowerCase();return N?m.value.filter(C=>p(C,N)):m.value}),b=t.computed(()=>[...f.value,...y.value]);t.watch([f,y],()=>{l.value=0});function g(N){return b.value.indexOf(N)}const _=N=>`em-cmdk-opt-${N}`,k=t.computed(()=>b.value[l.value]?_(l.value):void 0);t.watch(l,async()=>{var C;await t.nextTick();const N=k.value;N&&((C=document.getElementById(N))==null||C.scrollIntoView({block:"nearest"}))});function h(N){if(N.type==="goto")a.selection.value={kind:N.kind,id:N.id},a.requestFocus(N.id);else{if(N.disabled)return;N.run()}i("close")}function E(N){if(N.key==="Escape"){i("close"),N.preventDefault();return}if(N.key==="ArrowDown"){l.value=Math.min(l.value+1,b.value.length-1),N.preventDefault();return}if(N.key==="ArrowUp"){l.value=Math.max(l.value-1,0),N.preventDefault();return}if(N.key==="Enter"){const C=b.value[l.value];C&&h(C),N.preventDefault();return}N.key==="Tab"&&N.preventDefault()}return t.nextTick(()=>{var N;return(N=s.value)==null?void 0:N.focus()}),(N,C)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:C[1]||(C[1]=t.withModifiers(A=>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]=A=>r.value=A),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":k.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:E},null,40,sM),[[t.vModelText,r.value]]),t.createElementVNode("div",cM,[b.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",uM,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,A=>(t.openBlock(),t.createElementBlock("button",{id:_(g(A)),key:A.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g(A)===l.value}]),role:"option","aria-selected":g(A)===l.value,onMouseenter:B=>l.value=g(A),onClick:B=>h(A)},[t.createElementVNode("span",fM,t.toDisplayString(A.label),1),A.tag?(t.openBlock(),t.createElementBlock("span",pM,t.toDisplayString(A.tag),1)):A.sub?(t.openBlock(),t.createElementBlock("span",hM,t.toDisplayString(A.sub),1)):t.createCommentVNode("",!0)],42,mM))),128))],8,dM)):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",gM,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,A=>(t.openBlock(),t.createElementBlock("button",{id:_(g(A)),key:A.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g(A)===l.value,"is-disabled":A.disabled}]),role:"option","aria-selected":g(A)===l.value,"aria-disabled":A.disabled||void 0,onMouseenter:B=>l.value=g(A),onClick:B=>h(A)},[t.createElementVNode("span",_M,t.toDisplayString(A.label),1)],42,bM))),128))],8,yM)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",kM,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,lM)],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 wM={key:0,class:"em-canvas__empty","aria-hidden":"true"},IM={class:"em-canvas__empty-title"},vM=["innerHTML"],CM=["innerHTML"],SM=["innerHTML"],xM={key:1,class:"em-canvas__empty-title"},RM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},AM={class:"em-conflict-banner__body"},$M={class:"em-conflict-banner__title"},TM={class:"em-conflict-banner__detail"},MM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Gs="nc:",Vh=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(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),p={x:0,y:0};function f(D){p.x=D.clientX,p.y=D.clientY}const y=t.ref(null);t.provide(dr,y);const b=t.ref(null);t.provide(Zf,b);const g=t.ref(null),_=t.computed(()=>{const D=g.value,F=new Set;if(!D)return F;if(D.kind==="entity")F.add(D.id);else if(D.kind==="group"){const j=i.resolved.value.groups.find(fe=>fe.group.modelId===D.id);for(const fe of(j==null?void 0:j.group.memberEntityRefs)??[])F.add(fe)}return F}),k=t.computed(()=>{const D=g.value,F=new Set(_.value),j=new Set,fe=new Set;if(!D)return{related:F,edges:j,notes:fe};if(D.kind==="note"){fe.add(D.id);for(const Oe of i.resolved.value.noteConnections)Oe.noteRef===D.id&&F.add(Oe.targetRef);return{related:F,edges:j,notes:fe}}const Te=_.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(qo,{source:g,active:t.computed(()=>g.value!==null),primaryEntityIds:_,relatedEntityIds:t.computed(()=>k.value.related),relatedEdgeIds:t.computed(()=>k.value.edges),relatedNoteIds:t.computed(()=>k.value.notes),hoverGroupId:t.computed(()=>{var D;return((D=g.value)==null?void 0:D.kind)==="group"?g.value.id:null}),setEntityHover:D=>{b.value||m.value||(g.value=D?{kind:"entity",id:D}:null)},setGroupHover:D=>{b.value||m.value||(g.value=D?{kind:"group",id:D}:null)},setNoteHover:D=>{b.value||m.value||(g.value=D?{kind:"note",id:D}:null)}}),t.provide(po,i);const h=cS(),E=t.computed(()=>h(i.state.logical,i.embeddableCatalog.value));t.provide(tp,E);const N=xh({expandableKeys:()=>[],defaultCollapsed:fS,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(ip,{isCollapsed:N.isCollapsed,toggle:N.toggle}),t.provide(Qf,{marks:t.toRef(o,"diffMarks")});function C(D,F){return`${Gs}${D}:${F}`}function A(D){if(!D.startsWith(Gs))return null;const[F,j]=D.slice(Gs.length).split(":");return F&&j?{noteRef:F,targetRef:j}:null}t.provide(Ns,{points:D=>{var j,fe;const F=A(D);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===D))==null?void 0:fe.waypoints)??[]},movePoint:(D,F,j)=>{const fe=A(D);fe?i.moveNoteConnectionWaypoint(fe.noteRef,fe.targetRef,F,j):i.moveWaypoint(D,F,j)},insertPoint:(D,F,j)=>{const fe=A(D);fe?i.addNoteConnectionWaypoint(fe.noteRef,fe.targetRef,F,j):i.addWaypoint(D,F,j)},removePoint:(D,F)=>{const j=A(D);j?i.removeNoteConnectionWaypoint(j.noteRef,j.targetRef,F):i.removeWaypoint(D,F)}});const B=et(),{nodes:$,edges:x,findNode:S,findEdge:T,addNodes:R,addEdges:w,removeNodes:v,removeEdges:I,fitView:L,setCenter:M,getViewport:V,screenToFlowCoordinate:U,getSelectedNodes:oe,updateNodeInternals:ue}=B,be=t.ref(!1);async function pe(D){be.value=!0,await t.nextTick(),await new Promise(F=>requestAnimationFrame(()=>F(null)));try{return await D()}finally{be.value=!1}}async function he(){try{await pe(()=>$h(B))}catch(D){console.error("[entity-modeler] SVG export failed",D),c(i.t("em.canvas.exportFailed"))}}async function _e(){try{await pe(()=>Th(B))}catch(D){console.error("[entity-modeler] PNG export failed",D),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:he,exportPng:_e,fitView:L});const ye=t.computed(()=>i.resolved.value.entities.length===0);function Ae(){const D=V(),{width:F,height:j}=B.dimensions.value;return{x:(F/2-D.x)/D.zoom,y:(j/2-D.y)/D.zoom}}function Fe(){const D=Ae();i.addEntity("NewEntity",{x:D.x,y:D.y})}function se(){const D=Ae();i.addNote("메모",{x:D.x,y:D.y})}function ne(D){for(const F of i.resolved.value.groups){const{location:j,size:fe}=F.geo;if(D.x>=j.x&&D.x<=j.x+fe.width&&D.y>=j.y&&D.y<=j.y+fe.height)return F.group.modelId}return null}function ae(D,F){return D.x===F.x&&D.y===F.y}function me(D,F){return(D==null?void 0:D.width)===(F==null?void 0:F.width)&&(D==null?void 0:D.height)===(F==null?void 0:F.height)}function P(D,F){return D.entity===F.entity&&D.displayMode===F.displayMode&&D.collapsed===F.collapsed&&D.locked===F.locked&&D.groupRef===F.groupRef&&me(D.size,F.size)&&D.style===F.style&&D.attributeStyles===F.attributeStyles&&D.operationStyles===F.operationStyles}function O(D,F){const j=Object.keys(D);if(j.length!==Object.keys(F).length)return!1;for(const fe of j)if(fe==="geo"){const Te=D.geo,Oe=F.geo;if(!ae(Te.location,Oe.location)||!me(Te.size,Oe.size))return!1}else if(D[fe]!==F[fe])return!1;return!0}function z(){const D=i.resolved.value,F=new Map(D.groups.map(ce=>[ce.group.modelId,ce.geo])),j=new Set(D.groups.map(ce=>ce.group.modelId)),fe=new Set([...j,...D.entities.map(ce=>ce.entity.modelId),...D.notes.map(ce=>ce.note.modelId)]);for(const ce of[...$.value])fe.has(ce.id)||v([ce.id]);for(const ce of D.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=S(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 R([{id:Le,type:"group",position:{...ce.geo.location},draggable:ut,style:Ye,data:Je}])}for(const ce of D.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=S(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)):R([{id:Le,type:"entity",position:ve,parentNode:Ye,draggable:ut,connectable:G,data:Je}])}for(const ce of D.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=S(Ye);if($e){ae($e.position,ve)||($e.position=ve);const Ee=$e.data;(Ee.groupRef!==Je||!O(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 R([{id:Ye,type:"note",position:ve,parentNode:Je,style:G,data:ut}])}const Te=new Map(D.associations.map(ce=>[ce.association.modelId,ce])),Oe=new Set(D.noteConnections.map(ce=>C(ce.noteRef,ce.targetRef)));for(const ce of[...x.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 w([Ye])}for(const ce of D.noteConnections){const Le=C(ce.noteRef,ce.targetRef),Ye={noteRef:ce.noteRef,targetRef:ce.targetRef};T(Le)||w([{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(D){const F=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(D)}"]`);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 D=ee;ee=!1;const F=[...Q];if(Q.clear(),D){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(D){if(D)for(const F of D)Q.add(F);else ee=!0;we||(we=!0,t.nextTick(()=>requestAnimationFrame(Ce)))}t.provide(ep,{mark:D=>Y([D])});function X(){const D=oe.value.map(j=>j.id);if(D.length)return D;const F=i.selection.value;return F&&(F.kind==="entity"||F.kind==="note"||F.kind==="group")?[F.id]:[]}function q(){return oe.value.filter(D=>D.type==="entity").map(D=>D.id)}function Ie(){return oe.value.filter(D=>D.type==="group").map(D=>D.id)}function Be(D){var F;return[...((F=i.state.logical.groups.find(j=>j.modelId===D))==null?void 0:F.memberEntityRefs)??[]]}function ze(){const D=Ie().flatMap(Be);return[...new Set([...q(),...D])]}function Ue(){return Ie().length>0||q().length>1}function ie(){Ue()?i.copy(ze()):i.copy()}async function Se(D){if(!D.length)return;await t.nextTick();const F=oe.value;F.length&&B.removeSelectedNodes(F);const j=D.map(fe=>S(fe)).filter(fe=>!!fe);j.length&&B.addSelectedNodes(j)}function je(D){if(Ue()&&q().includes(D)){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:D},i.copy()}}}function Ze(D){var Te;const F=D.target;if(F&&(F.tagName==="INPUT"||F.tagName==="TEXTAREA"||F.isContentEditable))return;if(D.key==="?"){a.openModal({component:Mh,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"&&(ie(),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(((Te=i.selection.value)==null?void 0:Te.kind)==="attribute"){if(D.key==="ArrowUp"||D.key==="ArrowDown"){const Ye=D.key==="ArrowDown"?1:-1;(D.altKey?i.nudgeSelectedAttributes(Ye):i.moveAttributeFocus(Ye))&&D.preventDefault()}return}const Oe=D.shiftKey?10:1,ce=D.key==="ArrowLeft"?-Oe:D.key==="ArrowRight"?Oe:0,Le=D.key==="ArrowUp"?-Oe:D.key==="ArrowDown"?Oe:0;i.nudgeNodes(X(),ce,Le)&&D.preventDefault();return}if(!(D.metaKey||D.ctrlKey))return;const fe=D.key.toLowerCase();fe==="c"?(ie(),D.preventDefault()):fe==="v"?(Se(i.paste()),D.preventDefault()):fe==="z"&&(D.shiftKey?i.redo():i.undo(),D.preventDefault())}t.onMounted(async()=>{z(),await t.nextTick(),L(),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 D=(fe=document.elementFromPoint(p.x,p.y))==null?void 0:fe.closest(".vue-flow__node"),F=D==null?void 0:D.dataset.id;if(!F){g.value=null;return}const j=D.classList.contains("vue-flow__node-group")?"group":D.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,D=>{const F=g.value;if(!F)return;(F.kind==="entity"?D.entities.some(fe=>fe.entity.modelId===F.id):F.kind==="group"?D.groups.some(fe=>fe.group.modelId===F.id):D.notes.some(fe=>fe.note.modelId===F.id))||(g.value=null)});function st(D){const F=D.computedPosition??D.position,j=D.dimensions??{width:0,height:0};return{x:F.x+j.width/2,y:F.y+j.height/2}}function qe(D){const F=D.node;if(F){if(g.value=null,F.type==="group"){const j=i.resolved.value.groups.find(fe=>fe.group.modelId===F.id);b.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(D){var fe;y.value=null,b.value=null;const F=(fe=D.nodes)!=null&&fe.length?D.nodes:[D.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=S(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(D){var Ye,Je,ut,G,W;if(!i.editable.value||!D.source||!D.target)return;const F=((Ye=S(D.source))==null?void 0:Ye.type)==="note",j=((Je=S(D.target))==null?void 0:Je.type)==="note";if(F||j){if(F&&j)return;const ve=F?D.source:D.target,$e=F?D.target:D.source;((ut=S($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(D.source)==="JPA_EMBEDDABLE",Oe=fe(D.target)==="JPA_EMBEDDABLE";if(Te||Oe){if(Te&&Oe)return;const ve=Te?D.source:D.target,$e=Te?D.target:D.source;i.addEmbedAssociation($e,ve);return}const ce=(G=D.sourceHandle)!=null&&G.startsWith("r:")?D.sourceHandle.slice(2):void 0,Le=(W=D.targetHandle)!=null&&W.startsWith("l:")?D.targetHandle.slice(2):void 0;i.addAssociation(D.source,D.target,ce,Le)}const K=t.ref(null);function le(D,F){var fe;const j=i.state.layout.entityLayouts.find(Te=>Te.entityRef===D);return St((fe=j==null?void 0:j.attributeStyles)==null?void 0:fe[F])}function Re(D,F){var fe;const j=i.state.layout.entityLayouts.find(Te=>Te.entityRef===D);return St((fe=j==null?void 0:j.operationStyles)==null?void 0:fe[F])}function ke(D){var F;return St((F=i.state.layout.groupLayouts.find(j=>j.groupRef===D))==null?void 0:F.style)}function H(D){var F;return St((F=i.state.layout.notes.find(j=>j.modelId===D))==null?void 0:F.style)}function bt(D){var Te,Oe;if(D.preventDefault(),!i.editable.value)return;const F=()=>U({x:D.clientX,y:D.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(D,j)}function vt({event:D,node:F}){var Ye,Je,ut,G,W,ve,$e,Ee,Qe,Tt,Et,_o,Gi,pt,Rn,Mr,Ph,zh,Fh;const j=D;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:H(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,Ys=[{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:YD=>i.setAttributeSwatches(F.id,Nt,YD)},{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"&&Ys.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()}}),Ys.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,Ys);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])??((Ph=ht.label)==null?void 0:Ph.ko)??((zh=ht.label)==null?void 0:zh.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)})}(Fh=K.value)==null||Fh.open(j,Le)}function ot({event:D,edge:F}){var Oe,ce;const j=D;if(j.preventDefault(),!i.editable.value)return;const fe=A(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(D){return D==="group"?"group":D==="note"?"note":"entity"}function Xe({node:D}){if(oe.value.length>1){i.selection.value=null;return}i.selection.value={kind:Ge(D.type),id:D.id}}function Z({nodes:D}){D.length>1&&(i.selection.value=null)}function Rt({edge:D}){const F=A(D.id);i.selection.value=F?{kind:"note",id:F.noteRef}:{kind:"association",id:D.id}}function $t(D){const F=i.selection.value;return!!F&&F.kind!=="attribute"&&F.id===D.id}function Sn(D){var F,j;return $t(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"?Mf(St((F=D.data)==null?void 0:F.style),!0)??"var(--em-mm-group)":Mf(St((j=D.data)==null?void 0:j.style))??"var(--em-mm-entity)"}function At(D){return $t(D)?"var(--em-selection)":D.type==="note"?"var(--em-note-accent)":D.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ge(D,F){M(D,F,{zoom:V().zoom,duration:350})}t.watch(()=>i.focusRequest.value,D=>{if(!D)return;const F=S(D.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:D}){ge(D.x,D.y)}function xn({node:D}){i.selection.value={kind:Ge(D.type),id:D.id};const F=D.computedPosition??D.position,j=D.dimensions??{width:0,height:0};ge(F.x+j.width/2,F.y+j.height/2)}function Zt({node:D}){L({nodes:[D.id],duration:350,maxZoom:1.2,padding:.6})}return(D,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(Sw),{"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(up,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"node-entity":t.withCtx(j=>[t.createVNode(dp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"node-note":t.withCtx(j=>[t.createVNode(mp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"edge-association":t.withCtx(j=>[t.createVNode(Mp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"edge-note-connection":t.withCtx(j=>[t.createVNode(MT,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(Ex),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(Yx),{"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(RT),{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",wM,[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,vM),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,CM),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,SM)],64)):(t.openBlock(),t.createElementBlock("p",xM,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(EM,{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",RM,[t.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",AM,[t.createElementVNode("strong",$M,t.toDisplayString(d.value.title),1),t.createElementVNode("span",TM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(jT,{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",MM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),VM={class:"em-explorer em-scroll-overlay"},BM={class:"em-explorer__search"},DM=["placeholder","aria-label"],OM=["aria-label","title"],LM={key:0,class:"em-explorer__empty"},PM=["aria-label"],zM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],FM=["onClick"],UM=["title"],HM={class:"em-key-slot"},jM={class:"em-key-slot"},KM={class:"em-explorer__label"},GM={key:2,class:"em-explorer__sr"},Bh=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 R=i.resolved.value,w=i.displayMode.value,v=i.userLanguage.value,I=se=>{var ne,ae,me;return Ji(w,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"))},L=w==="PHYSICAL"||w==="LOGICAL_PHYSICAL",M=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&&L}}},V=se=>se.attrType.startsWith("EMBED")&&se.dbAttrs.length>0,U=se=>V(se)||mn(se),oe=w==="PHYSICAL"||w==="LOGICAL_PHYSICAL",ue=(se,ne)=>{if(mn(se)){const me=i.state.logical.entities,P=me.find(O=>O.modelId===ne);return se.dbAttrs.map((O,z)=>{const Q=Kn(se,P,me,i.state.logical.associations,z);return Q?{...O,physicalName:O.physicalName||Q.physicalName,logicalName:O.logicalName??Q.logicalName,dataType:O.dataType||Q.dataType}:O})}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 O=ae.fields[P];return O?{...me,physicalName:me.physicalName||O.physicalName,logicalName:me.logicalName??O.logicalName,dataType:me.dataType||O.dataType,length:me.length??O.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(U(se)){const q=Yr(w,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:ei(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(w,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:ei(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),O=Yr(w,se,P,ae==null?void 0:ae.targetName);return{key:`attr:${se.modelId}`,label:Ji(w,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"))+(O?` : ${O}`:""),...M(se),attrRef:me,focusId:ne,matchText:ei(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=w==="CLASS",P=ae||ne.attributes.some(mn)?ll(ne,i.state.logical):void 0,O=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:ei(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:O.map(de=>be(de,ne.modelId,z.get(de.modelId)))}},he=new Map,_e=[];for(const se of R.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 R.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(R.associations.length){const se=new Map(R.entities.map(ne=>[ne.entity.modelId,I(ne.entity)]));ye.push({key:"section:associations",label:i.t("em.explorer.associations",{n:R.associations.length}),icon:"arrow-lr",children:R.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 R.notes.length&&ye.push({key:"section:notes",label:i.t("em.explorer.notes",{n:R.notes.length}),icon:"note",children:R.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(R){return R?R.pk&&R.fk?i.t("em.node.keyPfk"):R.pk?i.t("em.node.keyPk"):R.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const R=[],w=v=>{if(v.children.length){v.key!=="root"&&R.push(v.key);for(const I of v.children)w(I)}};return w(r.value),R}),c=R=>R.startsWith("entity:")||R==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=xh({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),y=t.ref(null),b=t.computed(()=>f.value.trim().length>0),g=t.computed(()=>{const R=[];if(b.value){const v=rM(r.value,f.value.trim().toLowerCase()),I=(L,M,V,U,oe)=>{if(!v.has(L.key))return;R.push({node:L,depth:M,parentKey:V,posinset:U,setsize:oe});const ue=L.children.filter(be=>v.has(be.key));ue.forEach((be,pe)=>I(be,M+1,L.key,pe+1,ue.length))};return I(r.value,0,null,1,1),R}const w=(v,I,L,M,V)=>{R.push({node:v,depth:I,parentKey:L,posinset:M,setsize:V}),d(v.key)||v.children.forEach((U,oe)=>w(U,I+1,v.key,oe+1,v.children.length))};return w(r.value,0,null,1,1),R}),_=t.ref(null),k=t.ref(null),h=t.computed(()=>{var w;const R=g.value;return k.value&&R.some(v=>v.node.key===k.value)?k.value:((w=R[0])==null?void 0:w.node.key)??null}),E=R=>!b.value&&d(R);async function N(R){var w,v;R&&(k.value=R,await t.nextTick(),(v=(w=_.value)==null?void 0:w.querySelector(`[data-key="${R}"]`))==null||v.focus())}function C(R,w){var L,M,V,U,oe;const v=g.value,I=v.findIndex(ue=>ue.node.key===w.node.key);switch(R.key){case"ArrowDown":R.preventDefault(),N((L=v[I+1])==null?void 0:L.node.key);return;case"ArrowUp":R.preventDefault(),N((M=v[I-1])==null?void 0:M.node.key);return;case"Home":R.preventDefault(),N((V=v[0])==null?void 0:V.node.key);return;case"End":R.preventDefault(),N((U=v[v.length-1])==null?void 0:U.node.key);return;case"ArrowRight":if(R.preventDefault(),!w.node.children.length)return;E(w.node.key)?u(w.node.key):N((oe=v[I+1])==null?void 0:oe.node.key);return;case"ArrowLeft":R.preventDefault(),w.node.children.length&&!E(w.node.key)?u(w.node.key):N(w.parentKey);return;case"Enter":case" ":R.preventDefault(),S(w.node,R);return;case"F2":R.preventDefault(),T(w.node)}}const A=t.computed(()=>b.value&&g.value.length<=1);function B(R){var I;if(R.key!=="/"||R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;const w=R.target,v=w==null?void 0:w.tagName;v==="INPUT"||v==="TEXTAREA"||v==="SELECT"||w!=null&&w.isContentEditable||(R.preventDefault(),(I=y.value)==null||I.focus())}t.onMounted(()=>window.addEventListener("keydown",B)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",B)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function $(R){const w=i.selection.value;return R.attrRef?(w==null?void 0:w.kind)==="attribute"&&w.entityId===R.attrRef.entityId&&w.ids.includes(R.attrRef.attrId):!!w&&w.kind!=="attribute"&&!!R.selectId&&R.selectKind===w.kind&&R.selectId===w.id}function x(R){const w=i.selection.value;return R.selectKind==="entity"&&(w==null?void 0:w.kind)==="attribute"&&w.entityId===R.selectId}function S(R,w){if(R.attrRef){const v=w.shiftKey?"range":w.metaKey||w.ctrlKey?"toggle":"replace";i.selectAttribute(R.attrRef.entityId,R.attrRef.attrId,v)}else R.selectKind&&R.selectId&&(i.selection.value={kind:R.selectKind,id:R.selectId});R.focusId&&i.requestFocus(R.focusId)}function T(R){R.selectKind==="entity"&&R.selectId&&lr(a,i,R.selectId)}return(R,w)=>(t.openBlock(),t.createElementBlock("section",VM,[t.createElementVNode("div",BM,[t.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":w[0]||(w[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:w[1]||(w[1]=t.withKeys(v=>f.value="",["esc"]))},null,40,DM),[[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:w[2]||(w[2]=v=>f.value="")},[t.createVNode(Ve,{name:"x",size:13})],8,OM)):t.createCommentVNode("",!0)]),A.value?(t.openBlock(),t.createElementBlock("p",LM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:_,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":x(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?!E(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=>S(v.node,I),onDblclick:I=>T(v.node),onFocus:I=>k.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":!E(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,FM),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",HM,[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",jM,[v.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,UM)):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:v.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",KM,t.toDisplayString(v.node.label),1),l(v.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",GM,t.toDisplayString(l(v.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,zM))),128))],8,PM)]))}}),[["__scopeId","data-v-63b45532"]]),YM={class:"em-text-export"},qM=["id","aria-selected","tabindex","onClick"],WM=["aria-labelledby"],JM={class:"em-text-export__actions"},XM=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",YM,[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:b=>a.value=y,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(b=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(b=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(b=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(b=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,qM))),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,WM),t.createElementVNode("div",JM,[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"]]),ZM={class:"em-text-import"},QM=["aria-label"],e2=["aria-checked","tabindex","onClick"],t2=["placeholder"],n2={class:"em-text-import__status"},o2={class:"em-text-import__ok"},i2={key:0,class:"em-text-import__warn"},a2={key:1,class:"em-text-import__err"},r2={key:2,class:"em-text-import__err"},l2={key:3,class:"em-text-import__err"},s2={class:"em-text-import__actions"},c2=tt(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(b,g)=>qt(n.locale??"ko",b,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(b){var _,k;const g=l[(b+l.length)%l.length];g&&(r.value=g.key,await t.nextTick(),(k=(_=s.value)==null?void 0:_.querySelectorAll('[role="radio"]')[l.indexOf(g)])==null||k.focus())}function d(b){c(l.findIndex(g=>g.key===r.value)+b)}function u(b){return b?b.startsWith("{")?"json":/\berdiagram\b/i.test(b)?"mermaid":/\bcreate\s+table\b/i.test(b)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const b=a.value.trim();if(!b)return{status:"empty"};const g=m.value;if(!g)return{status:"unknown"};try{let _,k=[];return g==="json"?_=Ac(b):g==="mermaid"?_=Nc(b):(_=Cc(b),k=qr(b).warnings),_.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:_,warnings:k}}catch(_){return{status:"error",message:_ instanceof Error?_.message:String(_)}}}),f=t.computed(()=>p.value.status==="ok");function y(){const b=p.value;b.status!=="ok"||!b.source||(n.onImport(b.source),o.close())}return(b,g)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",ZM,[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,_=>t.createElementVNode("button",{key:_.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":_.key===r.value}]),"aria-checked":_.key===r.value,tabindex:_.key===r.value?0:-1,onClick:k=>r.value=_.key,onKeydown:[g[0]||(g[0]=t.withKeys(t.withModifiers(k=>d(-1),["prevent"]),["left"])),g[1]||(g[1]=t.withKeys(t.withModifiers(k=>d(1),["prevent"]),["right"])),g[2]||(g[2]=t.withKeys(t.withModifiers(k=>c(0),["prevent"]),["home"])),g[3]||(g[3]=t.withKeys(t.withModifiers(k=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(_.labelKey)),43,e2)),64))],8,QM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":g[4]||(g[4]=_=>a.value=_),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,t2),[[t.vModelText,a.value]]),t.createElementVNode("div",n2,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",o2,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",i2," ⚠ "+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",a2,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",r2,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",l2,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",s2,[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]=_=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),d2={class:"em-toolbar"},u2=["title"],m2={class:"em-toolbar__mode"},Dh=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(b=>b.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=zr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:XM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:sc(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:Sc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:Rc(y,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:c2,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(b=>b.modelId))}}})}function f(){r.openModal({component:Mh,bind:{locale:i.uiLocale.value}})}return(y,b)=>(t.openBlock(),t.createElementBlock("div",d2,[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,u2)):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:b[0]||(b[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:b[1]||(b[1]=g=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),b[9]||(b[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",m2,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":b[2]||(b[2]=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:b[3]||(b[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:b[4]||(b[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"]),b[10]||(b[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick: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:b[5]||(b[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:b[6]||(b[6]=g=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),b[11]||(b[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key: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:b[7]||(b[7]=g=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),b[8]||(b[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),f2=["title"],p2=["title"],h2=["disabled","aria-pressed"],y2=["disabled","aria-pressed"],g2=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,f2)):(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,h2),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,y2)],10,p2))}}),[["__scopeId","data-v-2b5162b7"]]),b2=["disabled"],_2={class:"em-panel__sub"},k2={class:"em-nav"},E2={key:0,class:"em-nav__divider","aria-hidden":"true"},N2={key:1},w2=["onClick","onKeydown"],I2={class:"em-nav__name"},v2=["title"],C2={key:0,class:"em-panel__note"},S2=["data-attr-block"],x2={key:0,class:"em-embed-col__label"},R2={class:"em-attr__row"},A2=["title"],$2={key:1,class:"em-attr__row"},T2={key:2,class:"em-embed-cols"},M2={class:"em-embed-col"},V2={class:"em-embed-col__label"},B2={class:"em-attr__row"},D2={class:"em-attr__navhint"},O2={key:3,class:"em-attr__navhint"},L2={key:0,class:"em-attr__navhint"},P2={class:"em-attr__row"},z2={class:"em-attr__row"},F2=["title"],U2={class:"em-attr__flags"},H2={class:"em-attr__pii"},j2={class:"em-attr__pii"},K2={key:1,class:"em-attr__pii"},G2={key:2,class:"em-attr__pii em-attr__codetop"},Y2={class:"em-multilang"},q2={key:5,class:"em-embed-cols"},W2={key:0,class:"em-attr__navhint"},J2={class:"em-embed-col__label"},X2={class:"em-attr__row"},Z2=["title"],Q2=["title"],eV=["title"],tV={class:"em-attr__row"},nV={key:0,class:"em-embed-upd"},oV={key:1,class:"em-attr__navhint"},iV={class:"em-embed-upd"},aV={class:"em-embed-upd"},rV={class:"em-attr__flags"},lV={class:"em-multilang"},sV={class:"em-swatch__row em-attr__swatch"},cV=["title","onClick"],dV=["title","onClick"],uV={key:0,class:"em-attr__swatch-hint"},mV=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:b,nameLocked:g,nameLockedHint:_,isManagedFk:k,setNaturalId:h,setIdentifier:E,setTransient:N,dbLocked:C,fkDerived:A,fkOriginPhysical:B,typeValueOf:$,typeLabelOf:x,setAttrType:S,setAttrCustomType:T,setDb:R,scaleApplicable:w,scaleHint:v,setDbLogical:I,setAttrDescription:L,attrPiiValue:M,setAttrPii:V,predefinedCustomTypeCatalog:U,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:O,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}=Of(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 H(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",_2,[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",k2,[(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",E2,[...Xe[0]||(Xe[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(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",I2,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,v2)],42,w2)]))],64))),128))]),st.value.length&&!nt.value.length?(t.openBlock(),t.createElementBlock("p",C2,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,D,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",x2,t.toDisplayString(t.unref(o).t("em.attr.derivedIdField")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",R2,[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(_)(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(A)(Z),items:t.unref(kc)(Z.type,t.unref(U)),"value-provider":t.unref($),"label-provider":t.unref(x),"model-value":Z.type,"onUpdate:modelValue":j=>t.unref(S)(Z,j)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(k)(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,A2)]),Z.type===t.unref(hn)&&!t.unref(A)(Z)?(t.openBlock(),t.createElementBlock("div",$2,[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",T2,[t.createElementVNode("div",M2,[t.createElementVNode("span",V2,t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("div",B2,[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(b)(Z,j)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("p",D2,t.toDisplayString(t.unref(o).t("em.attr.derivedIdNote")),1)])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",O2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ne)(Z)?(t.openBlock(),t.createElementBlock("div",q2,[t.unref(ae)(Z)?(t.openBlock(),t.createElementBlock("p",W2,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",J2,t.toDisplayString(((Te=t.unref(O)(Z,fe))==null?void 0:Te.name)??((Oe=t.unref(O)(Z,fe))==null?void 0:Oe.physicalName)??t.unref(o).t("em.attr.colFallback",{n:fe+1})),1),t.createElementVNode("div",X2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`embed-col-${j.modelId}`,width:"100%",disabled:t.unref(J)(j),placeholder:((ce=t.unref(O)(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,Z2),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,Q2),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,eV)]),t.createVNode(fo,{controller:t.unref(o),"ref-id":j.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",tV,[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(O)(Z,fe))==null?void 0:Le.logicalName)==null?void 0:Ye[t.unref(o).userLanguage.value])??((ut=(Je=t.unref(O)(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(O)(Z,fe))!=null&&G.shareable?(t.openBlock(),t.createElementBlock("label",nV,[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",oV,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",iV,[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",aV,[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",rV,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:"","onUpdate:modelValue":j=>t.unref(E)(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",lV,[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(L)(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(A)(Z)?(t.openBlock(),t.createElementBlock("p",L2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",P2,[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",z2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(B)(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(R)(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(A)(Z),items:t.unref(gc)(((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(R)(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(A)(Z),"model-value":(ge=Z.dbAttrs[0])==null?void 0:ge.length,"onUpdate:modelValue":j=>t.unref(R)(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(A)(Z)||!t.unref(w)(Z),"model-value":(ft=Z.dbAttrs[0])==null?void 0:ft.scale,"onUpdate:modelValue":j=>t.unref(R)(Z,{scale:j||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,F2)]),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",U2,[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(A)(Z),"onUpdate:modelValue":j=>t.unref(E)(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(A)(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(A)(Z),"onUpdate:modelValue":j=>t.unref(R)(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":!!((D=Z.dbAttrs[0])!=null&&D.autoIncrement),disabled:t.unref(C)(Z)||t.unref(A)(Z)||!Z.identifier,"onUpdate:modelValue":j=>t.unref(R)(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(A)(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-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(C)(Z)||t.unref(A)(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(A)(Z),"onUpdate:modelValue":j=>t.unref(R)(Z,{multiValue:j||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",H2,[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",j2,[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(A)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",K2,[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(M)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":j=>j&&t.unref(V)(Z,j)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(be).length&&!t.unref(A)(Z)?(t.openBlock(),t.createElementBlock("label",G2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Uf,{"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(A)(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",Y2,[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(L)(Z,j)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",sV,[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=>H(Z,null)},"∅",10,cV),(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(Go)(j)}),title:t.unref(o).t(t.unref(mo)(j)),onClick:fe=>H(Z,j)},null,14,dV))),128)),ke(Z)?(t.openBlock(),t.createElementBlock("span",uV,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,S2)}),128))],8,b2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-af496d06"]]),fV=["disabled"],pV={class:"em-panel__sub-label"},hV={class:"em-attr__row"},yV={class:"em-field em-idx-params"},gV=["value","placeholder","onChange"],bV=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(N=>N.modelId===o.entityId)??null),l=t.computed(()=>r.value?ti(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var N;return Hn(((N=r.value)==null?void 0:N.attributes)??[])}),c=N=>s.value.canon(N),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(()=>[...Gf(d.value).map(N=>({value:N.ref,label:N.label})),...l.value.map(N=>({value:N.modelId,label:a.t("em.index.inherited",{field:N.field})}))]);function m(N,C){var x;const A=new Set(N.columns.filter((S,T)=>T!==C).map(S=>c(S.columnRef))),B=u.value.filter(S=>!A.has(c(S.value))),$=(x=N.columns[C])==null?void 0:x.columnRef;return $&&!B.some(S=>S.value===$)&&B.push({value:$,label:p($)}),B}function p(N){return _s(N,d.value)}function f(N){const C=new Set(N.columns.map(A=>c(A.columnRef)));return u.value.filter(A=>!C.has(c(A.value)))}function y(){var C;if(!r.value)return;const N=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:N?[{columnRef:N.value,descending:!1}]:[]})}function b(N,C){r.value&&a.updateIndex(r.value.modelId,N,C)}function g(N){const C=f(N)[0];C&&b(N.modelId,{columns:[...N.columns,{columnRef:C.value,descending:!1}]})}function _(N,C,A){b(N.modelId,{columns:N.columns.map((B,$)=>$===C?{...B,columnRef:A}:B)})}function k(N,C,A){b(N.modelId,{columns:N.columns.map((B,$)=>$===C?{...B,descending:A}:B)})}function h(N,C){b(N.modelId,{columns:N.columns.filter((A,B)=>B!==C)})}function E(N,C){b(N.modelId,{parameters:C.trim()===""?void 0:C})}return(N,C)=>{var A;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]=B=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",pV,[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:((A=r.value.indexes)==null?void 0:A.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??[],B=>(t.openBlock(),t.createElementBlock("div",{key:B.modelId,class:"em-attr"},[t.createElementVNode("div",hV,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`idx-name-${B.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":$=>b(B.modelId,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-uq-${B.modelId}`,class:"em-check",label:"UQ","model-value":B.unique,"onUpdate:modelValue":$=>b(B.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,B.modelId)},null,8,["onClick"])]),t.createVNode(fo,{controller:t.unref(a),"ref-id":B.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.columns,($,x)=>(t.openBlock(),t.createElementBlock("div",{key:x,class:"em-attr__row"},[t.createVNode(t.unref(te.BSSelect),{class:"grow","model-value":$.columnRef,items:m(B,x),"value-provider":S=>S.value,"label-provider":S=>S.label,"onUpdate:modelValue":S=>S&&_(B,x,S)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-${B.modelId}-desc-${x}`,class:"em-check",label:"DESC","model-value":$.descending,"onUpdate:modelValue":S=>k(B,x,S)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:"−",onClick:S=>h(B,x)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(B).length,onClick:$=>g(B)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",yV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:B.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:$=>E(B,$.target.value)},null,40,gV)])]))),128)):t.createCommentVNode("",!0)],8,fV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-ee0032b1"]]),_V=["disabled"],kV={class:"em-panel__sub-label"},EV={class:"em-attr__row"},NV={class:"em-attr__row"},wV={class:"em-multilang"},IV={class:"em-attr__pii"},vV={class:"em-swatch__row em-attr__swatch"},CV=["title","onClick"],SV=["title","onClick"],xV=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,E){l.value&&a.updateOperation(l.value.modelId,h.modelId,E)}function f(h,E){p(h,{description:Object.keys(E).length?E:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function b(h,E){p(h,{personalInfoAttributeType:E==="none"?void 0:E})}function g(h){var E,N;return St((N=(E=s.value)==null?void 0:E.operationStyles)==null?void 0:N[h.modelId])}function _(h,E){l.value&&a.setOperationSwatch(l.value.modelId,h.modelId,E)}function k(h){r.openModal({component:Yf,bind:{operationName:h.name,sourceCode:h.sourceCode??"",locale:a.uiLocale.value,onSave:E=>p(h,{sourceCode:E})}})}return(h,E)=>{var N;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:E[1]||(E[1]=C=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",kV,[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:((N=l.value.operations)==null?void 0:N.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:E[0]||(E[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",EV,[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":A=>p(C,{name:A})},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":A=>A&&p(C,{visibility:A})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:A=>t.unref(a).removeOperation(l.value.modelId,C.modelId)},null,8,["onClick"])]),t.createElementVNode("div",NV,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t(C.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:A=>k(C)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",wV,[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":A=>f(C,A)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",IV,[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":A=>A&&b(C,A)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",vV,[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:A=>_(C,null)},"∅",10,CV),(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":g(C)===A}]),style:t.normalizeStyle({background:t.unref(Go)(A)}),title:t.unref(a).t(t.unref(mo)(A)),onClick:B=>_(C,A)},null,14,SV))),128))])]))),128)):t.createCommentVNode("",!0)],8,_V)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),RV=["title"],AV={class:"em-panel__head"},$V={class:"em-panel__head-row"},TV=["title"],MV={class:"em-panel__context"},VV={key:0,class:"em-panel__lock"},BV=["disabled"],DV={key:0,class:"em-panel__note"},OV={key:1,class:"em-panel__note"},LV={key:2,class:"em-jpa"},PV={class:"em-field"},zV={class:"em-field"},FV={class:"em-field"},UV={key:0,class:"em-field"},HV={class:"em-panel__note"},jV={class:"em-panel__sub"},KV={class:"em-field"},GV={class:"em-field"},YV={class:"em-jpa"},qV={key:0,class:"em-panel__note"},WV={key:1,class:"em-panel__note"},JV={class:"em-jpa"},XV={class:"em-field"},ZV={key:0,class:"em-panel__note"},QV={class:"em-field"},eB={class:"em-multilang"},tB={class:"em-field"},nB=["value"],oB={class:"em-field"},iB={class:"em-swatch"},aB={class:"em-swatch__row"},rB=["title"],lB=["title","onClick"],sB={class:"em-panel__note"},cB={class:"em-field"},dB=["value"],uB={class:"em-swatch"},mB={class:"em-swatch__row"},fB=["title"],pB=["title","onClick"],Oh=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 b(Y){return y.value[Y]??f.value}function g(Y){y.value={...y.value,[Y]:!b(Y)}}const _=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}),k=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}),E=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}),N=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(k.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(k.value.end1.entityRef),b:Y(k.value.end2.entityRef)})}return h.value?l.t("em.inspector.ctxGroup",{name:N.value}):E.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),A=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],B=["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"},x=Y=>{const X=$[Y];return X?l.t(X):Y},S=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"],R=["LIST","SET"],w=["inherit","LAZY","EAGER"],v=Y=>Y;function I(Y){return Y==="inherit"?l.t("em.common.inherit"):Y}const L=t.computed(()=>!!k.value&&k.value.end1.entityRef===k.value.end2.entityRef);function M(Y,X){k.value&&l.updateAssociationEnd(k.value.modelId,Y,X)}function V(Y){return ne.value?Y:Y==="end1"?"end2":"end1"}function U(Y){var Be;const X=(Be=k.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=k.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=U(Y);if(X!==void 0)return X;const q=(ze=k.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=k.value)==null?void 0:ie[Ie].entityRef)});return Be?ta(Be.name,Qi(k.value[Ie].multiplicity)):""}function be(Y){return!!ne.value||U(Y)!==void 0}function pe(Y){k.value&&!L.value&&l.setAssociationIdentifying(k.value.modelId,Y)}function he(Y){var X,q,Ie;return!!((Ie=(q=(X=k.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=k.value)==null?void 0:ze[Y];if(X==="ALL"&&q){M(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),M(Y,{jpa:{...Ie==null?void 0:Ie.jpa,cascadeTypes:[...Be]}})}function ye(Y,X){var Ie;const q=(Ie=k.value)==null?void 0:Ie[Y];M(Y,{jpa:{...q==null?void 0:q.jpa,...X}})}function Ae(Y){var X,q;return((q=(X=k.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=k.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=k.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){k.value&&l.setEmbedCardinality(k.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 O(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){E.value&&l.setNoteMemo(E.value.modelId,Y)}const xe=t.computed(()=>{var Y;return St((Y=E.value)==null?void 0:Y.style)});function Ce(Y){E.value&&l.setNoteSwatch(E.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,RV),t.createElementVNode("header",AV,[t.createElementVNode("div",$V,[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,TV)]),t.createElementVNode("p",MV,t.toDisplayString(C.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",VV,[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(Bf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("basics"),title:_.value,onToggle:X[3]||(X[3]=q=>g("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(mV,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(bV,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("index"),onToggle:X[4]||(X[4]=q=>g("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(xV,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("ops"),onToggle:X[5]||(X[5]=q=>g("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!k.value.identifying,disabled:L.value||!!ne.value,"onUpdate:modelValue":pe},null,8,["label","model-value","disabled"]),L.value?(t.openBlock(),t.createElementBlock("p",DV,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):ne.value?(t.openBlock(),t.createElementBlock("p",OV,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),ne.value?(t.openBlock(),t.createElementBlock("fieldset",LV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",PV,[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:B,"value-provider":v,"label-provider":x,"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",zV,[X[15]||(X[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(te.BSSelect),{"model-value":ne.value.collectionType,items:R,"value-provider":v,"label-provider":v,"onUpdate:modelValue":X[7]||(X[7]=q=>q&&me(q))},null,8,["model-value"])]),t.createElementVNode("label",FV,[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",UV,[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":O},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",HV,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",jV,t.toDisplayString(q)+" → "+t.toDisplayString(S(k.value[q].entityRef)),1),ne.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",KV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":k.value[q].multiplicity,items:A,"value-provider":v,"label-provider":t.unref(ea),"onUpdate:modelValue":Ue=>M(q,{multiplicity:Ue})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${V(q)}-navigable`,class:"em-check",label:"navigable",title:V(q)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:V(q)==="end2","model-value":V(q)==="end2"?!0:k.value[V(q)].navigable,"onUpdate:modelValue":Ue=>M(V(q),{navigable:Ue})},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(te.BSTextInput),{name:`${V(q)}-navname`,width:"100%",disabled:!be(V(q)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":ue(V(q)),"onUpdate:modelValue":Ue=>oe(V(q),Ue)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${V(q)}-composition`,class:"em-check",label:"composition","model-value":k.value[V(q)].composition,"onUpdate:modelValue":Ue=>M(V(q),{composition:Ue})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",YV,[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:`${V(q)}-cascade-${Ue}`,class:"em-check",label:Ue,"model-value":!!((Se=(ie=k.value[V(q)].jpa)==null?void 0:ie.cascadeTypes)!=null&&Se.includes(Ue)),disabled:!be(V(q))||Ue!=="ALL"&&he(V(q)),"onUpdate:modelValue":je=>_e(V(q),Ue,je)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),be(V(q))?he(V(q))?(t.openBlock(),t.createElementBlock("p",WV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",qV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",JV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",XV,[X[19]||(X[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(te.BSSelect),{disabled:!be(V(q)),"model-value":Ae(V(q)),items:w,"value-provider":v,"label-provider":I,"onUpdate:modelValue":Ue=>Ue&&Fe(V(q),Ue)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${V(q)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Ie=k.value[V(q)].jpa)!=null&&Ie.orphanRemoval),disabled:!be(V(q))||se(q),"onUpdate:modelValue":Ue=>ye(V(q),{orphanRemoval:Ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),se(q)&&((Be=k.value[V(q)].jpa)!=null&&Be.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",ZV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",QV,[X[20]||(X[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(te.BSTextInput),{name:`${V(q)}-orderby`,width:"100%",disabled:!be(V(q)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((ze=k.value[V(q)].jpa)==null?void 0:ze.orderBy)??"","onUpdate:modelValue":Ue=>ye(V(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",eB,[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",tB,[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,nB)]),t.createElementVNode("label",oB,[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",iB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",aB,[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,rB),(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(Go)(q)}),title:t.unref(l).t(t.unref(mo)(q)),onClick:Ie=>we(q)},null,14,lB))),128))])]),t.createElementVNode("p",sB,t.toDisplayString(t.unref(l).t("em.group.members",{n:h.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",cB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:E.value.memo,rows:"6",onChange:X[12]||(X[12]=q=>de(q.target.value))},null,40,dB)]),t.createElementVNode("fieldset",uB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",mB,[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,fB),(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(Go)(q)}),title:t.unref(l).t(t.unref(mo)(q)),onClick:Ie=>Ce(q)},null,14,pB))),128))])])],64)):t.createCommentVNode("",!0)],8,BV)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),hB=["title"],yB={class:"em-validation__title"},gB=["title","onClick"],bB={key:0,class:"em-validation__body"},_B={class:"em-validation__opt"},kB={key:0,class:"em-validation__empty"},EB={key:1,class:"em-validation__empty"},NB={key:2,class:"em-validation__list"},wB=["onClick"],IB={class:"em-validation__item-msg"},vB={key:0,class:"em-validation__item-entity"},CB=["title","onClick"],SB=["title"],xB=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 b=new Map;for(const g of o.state.logical.entities)b.set(g.modelId,g.name);return b});function r(b){const g=Fw(b);if(!g)return null;const _=a.value.get(g);return _===void 0?null:_.trim()===""?o.t("em.validation.nameless"):_}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const b={error:0,warning:0,info:0};for(const g of i.value)b[g.severity]++;return b}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(b=>c.value[b.severity]).slice().sort((b,g)=>l[b.severity].order-l[g.severity].order)),u=t.computed(()=>d.value.map(b=>({issue:b,entityName:r(b),message:Vf(o.t,b),category:Pw(o.t,b.ruleId)}))),m=t.ref(!1);function p(b){c.value[b]=!c.value[b]}function f(b){if(!m.value){m.value=!0;return}p(b)}function y(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,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]=_=>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",yB,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,hB),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"],_=>t.createElementVNode("button",{key:_,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:m.value?t.unref(o).t(c.value[_]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[_].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:k=>f(_)},[t.createVNode(Ve,{name:l[_].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[_]),1)],10,gB)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",bB,[t.createElementVNode("label",_B,[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]=_=>t.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",kB,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",EB,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",NB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:_,entityName:k,message:h,category:E},N)=>(t.openBlock(),t.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${N}`,class:t.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:C=>y(_)},[t.createVNode(Ve,{name:l[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",IB,[k?(t.openBlock(),t.createElementBlock("span",vB,t.toDisplayString(k),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(h),1)]),t.unref(o).hasQuickFix(_)?(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(_),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,CB)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},t.toDisplayString(E),9,SB)],10,wB))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),RB={class:"em-history"},AB={class:"em-history__head"},$B={class:"em-history__title"},TB={class:"em-history__head-actions"},MB=["title","disabled"],VB=["title"],BB={class:"em-history__filters"},DB={class:"em-history__filter"},OB={class:"em-history__filters em-history__filters--period"},LB={class:"em-history__filter-label"},PB=["title","aria-label","max"],zB=["title","aria-label","min"],FB=["title"],UB={key:0,class:"em-history__diffbar"},HB={class:"em-history__diffbar-range"},jB={class:"em-history__diffbar-count"},KB={class:"em-history__body"},GB={key:0,class:"em-history__empty"},YB={key:1,class:"em-history__diff-list"},qB=["onClick"],WB={class:"em-history__action-head"},JB={class:"em-history__action-name"},XB={key:0,class:"em-history__fields"},ZB={class:"em-history__fname"},QB={key:0,class:"em-history__old"},eD={class:"em-history__val"},tD={key:1,class:"em-history__empty"},nD={key:2,class:"em-history__empty is-error"},oD={key:3,class:"em-history__empty"},iD={key:4,class:"em-history__list"},aD=["onClick"],rD={class:"em-history__summary"},lD={class:"em-history__seq"},sD={class:"em-history__gmeta"},cD={class:"em-history__who"},dD={key:0,class:"em-history__time"},uD={key:1,class:"em-history__restored-from"},mD=["onClick"],fD={key:0,class:"em-history__detail"},pD={class:"em-history__action-head"},hD={class:"em-history__action-name"},yD={key:0,class:"em-history__fields"},gD={class:"em-history__fname"},bD={key:0,class:"em-history__old"},_D={class:"em-history__val"},kD={class:"em-history__preview"},ED=["disabled"],ND={key:0,class:"em-history__diff-list is-preview"},wD={class:"em-history__action-head"},ID={class:"em-history__action-name"},vD={key:0,class:"em-history__fields"},CD={class:"em-history__fname"},SD={key:0,class:"em-history__old"},xD={class:"em-history__val"},RD={class:"em-history__confirm-row"},AD={class:"em-history__confirm-msg"},$D=["disabled","onClick"],TD=["disabled"],MD=["onClick"],Tr=50,VD=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 b=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]))),_=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 k(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=b.value.get((re=Se.end1)==null?void 0:re.entityRef))==null?void 0:Ke.name)==null?void 0:st.trim(),Ze=(We=(nt=b.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=b.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?b.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"?k(ie.ref):ie.kind==="associationEnd"?`${k(ie.ref)}(${ie.end})`:ie.kind==="group"?a.t("em.history.groupSubject",{name:_.value.get(ie.ref)??ie.ref}):ie.ref}const E={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},C=t.ref("all"),A=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],B=t.computed({get:()=>C.value,set:ie=>{ie&&(C.value=ie)}}),$=t.computed(()=>gl(r.value)),x=t.computed(()=>$.value.length?$.value[0].seq:null),S=t.computed(()=>C.value==="all"?$.value:$.value.filter(ie=>(ie.kind??"edit")===C.value)),T=t.ref(Tr),R=t.ref(""),w=t.ref(""),v=t.computed(()=>!!R.value||!!w.value);function I(){R.value="",w.value=""}const L=t.computed(()=>{const ie=R.value?new Date(`${R.value}T00:00:00`).getTime():null,Se=w.value?new Date(`${w.value}T23:59:59.999`).getTime():null;return ie==null&&Se==null?S.value:S.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)})}),M=t.computed(()=>L.value.slice(0,T.value)),V=t.computed(()=>Math.max(0,L.value.length-T.value));function U(){T.value+=Tr}t.watch([C,R,w],()=>{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?ud(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(()=>x.value??1/0),me=t.computed(()=>f.value??ae.value),P=t.computed(()=>f.value??ae.value),O=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"?b.value.has(ie.ref)?ie.ref:null:(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index")&&ie.entityRef?b.value.has(ie.entityRef)?ie.entityRef:null:ie.kind==="group"&&_.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",RB,[t.createElementVNode("header",AB,[t.createElementVNode("div",$B,[t.createVNode(Ve,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",TB,[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,MB),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,VB)])]),t.createElementVNode("div",BB,[t.createElementVNode("label",DB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(te.BSSelect),{modelValue:B.value,"onUpdate:modelValue":Se[2]||(Se[2]=J=>B.value=J),items:A,"value-provider":J=>J.v,"label-provider":J=>t.unref(a).t(J.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",OB,[t.createElementVNode("span",LB,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:w.value||void 0,"onUpdate:modelValue":Se[3]||(Se[3]=J=>R.value=J)},null,8,PB),[[t.vModelText,R.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:R.value||void 0,"onUpdate:modelValue":Se[4]||(Se[4]=J=>w.value=J)},null,8,zB),[[t.vModelText,w.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,FB)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",UB,[t.createElementVNode("div",HB,[t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:O.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",jB,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",KB,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ze=Ae.value)!=null&&Ze.entries.length?(t.openBlock(),t.createElementBlock("ul",YB,[(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",WB,[t.createVNode(Ve,{name:E[J.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",JB,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",XB,[(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",ZB,t.toDisplayString(Ke.field),1),Ke.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",QB,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",eD,t.toDisplayString(oe(Ke.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,qB))),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",tD,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",nD,t.toDisplayString(s.value),1)):L.value.length===0?(t.openBlock(),t.createElementBlock("p",oD,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",iD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.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",rD,t.toDisplayString(be(J)),1),t.createElementVNode("span",lD,"#"+t.toDisplayString(J.seq),1)],8,aD),t.createElementVNode("div",sD,[t.createElementVNode("span",cD,t.toDisplayString(ye(J)),1),J.ts?(t.openBlock(),t.createElementBlock("span",dD,t.toDisplayString(_e(J.ts)),1)):t.createCommentVNode("",!0),J.kind==="restore"&&J.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",uD,"← #"+t.toDisplayString(J.restoredFromSeq),1)):t.createCommentVNode("",!0),J.seq!==x.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,mD)):t.createCommentVNode("",!0)]),pe.value.has(J.seq)?(t.openBlock(),t.createElementBlock("div",fD,[(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",pD,[t.createVNode(Ve,{name:E[qe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",hD,t.toDisplayString(h(qe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${qe.verb}`])},t.toDisplayString(t.unref(a).t(N[qe.verb])),3)]),qe.fields.length?(t.openBlock(),t.createElementBlock("ul",yD,[(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",gD,t.toDisplayString(We.field),1),We.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",bD,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",_D,t.toDisplayString(oe(We.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&J.seq!==x.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",kD,[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,ED),Be.value&&((st=Ie.value)!=null&&st.entries.length)?(t.openBlock(),t.createElementBlock("ul",ND,[(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",wD,[t.createVNode(Ve,{name:E[qe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",ID,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",vD,[(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",CD,t.toDisplayString(We.field),1),We.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",SD,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",xD,t.toDisplayString(oe(We.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",RD,[t.createElementVNode("span",AD,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,$D),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,TD)])],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,MD))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&V.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:U},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:V.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function BD(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 Lh(e){const n=t.ref(BD(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 DD={class:"em-modeler"},OD={class:"em-modeler__body"},LD={class:"em-drawer__inner"},PD={class:"em-drawer__head"},zD={class:"em-drawer__actions"},FD=["title"],UD=["title"],HD=["title"],jD=["title"],KD=["title"],GD=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(E){t.nextTick(()=>{const N=E();N&&("focusCollapse"in N?N.focusCollapse():N.focus())})}function c(E){n.value=E,s(()=>E?i.value:a.value)}function d(E){o.value=E,s(()=>E?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:y}=Lh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:b,dragging:g,startResize:_}=Lh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),k=t.ref(null),h=t.ref(null);return(E,N)=>{var C,A,B;return t.openBlock(),t.createElementBlock("div",DD,[t.createVNode(Dh,{controller:e.controller,"history-open":u.value,onExportSvg:N[0]||(N[0]=$=>{var x;return(x=k.value)==null?void 0:x.exportSvg()}),onExportPng:N[1]||(N[1]=$=>{var x;return(x=k.value)==null?void 0:x.exportPng()}),onToggleHistory:N[2]||(N[2]=$=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",OD,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",LD,[t.createElementVNode("header",PD,[N[11]||(N[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",zD,[(C=h.value)!=null&&C.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((A=h.value)!=null&&A.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:N[3]||(N[3]=$=>{var x;return(x=h.value)==null?void 0:x.toggleAll()})},[t.createVNode(Ve,{name:(B=h.value)!=null&&B.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,FD)):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:N[4]||(N[4]=$=>c(!1))},[t.createVNode(Ve,{name:"panel-close",size:16})],8,UD)])]),t.createVNode(Bh,{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:N[5]||(N[5]=(...$)=>t.unref(y)&&t.unref(y)(...$))},null,42,HD),[[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:N[6]||(N[6]=$=>c(!0))},[t.createVNode(Ve,{name:"panel-open",size:18})],8,jD),[[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(Vh,{ref_key:"canvas",ref:k,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(Oh,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(b),resizing:t.unref(g),"start-resize":t.unref(_),onCollapse:N[7]||(N[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:N[8]||(N[8]=$=>d(!0))},[t.createVNode(Ve,{name:"panel-right-open",size:18})],8,KD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(VD,{controller:e.controller,open:u.value,onClose:N[9]||(N[9]=$=>u.value=!1),onDiffChange:N[10]||(N[10]=$=>m.value=$)},null,8,["controller","open"])]),t.createVNode(xB,{controller:e.controller,"panel-width":t.unref(b),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=qb,Ne.AssociationEdge=Mp,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=Vh,Ne.DiagramExplorer=Bh,Ne.EDITOR=po,Ne.EditModeToggle=g2,Ne.EditorToolbar=Dh,Ne.EntityModeler=GD,Ne.EntityNode=dp,Ne.GROUP_CODE_ENUM_VALUE=Yn,Ne.GroupNode=up,Ne.INHERITED_REF_PREFIX=qi,Ne.InvalidDiagramJsonError=Wn,Ne.JAVA_TYPES=ai,Ne.NoteNode=mp,Ne.OpSyncAdapter=nu,Ne.PHYSICAL_NAME_MAX_LENGTH=li,Ne.PropertyPanel=Oh,Ne.RevCache=tu,Ne.SELECTABLE_JAVA_TYPES=_c,Ne.SYMBOLIC_OP_KINDS=ou,Ne.SYMBOLIC_OP_SCHEMA=Nu,Ne.UI_LOCALES=hI,Ne.applyDocumentReferenceOnly=zr,Ne.buildAgentBatch=Wb,Ne.buildDiagramSvg=Ks,Ne.buildDiffMarks=ud,Ne.collectSharedColumns=$n,Ne.commands=tb,Ne.computeAutoLayout=Ws,Ne.createEditorController=iS,Ne.dedupeModelIds=Rg,Ne.defaultMermaidDialect=Qh,Ne.defaultSqlDialect=$y,Ne.diagramToJson=Rc,Ne.displayLabel=Ji,Ne.emptyState=Xf,Ne.entityModelToDdl=Sc,Ne.entityModelToMermaid=Fr,Ne.entityModelToText=sc,Ne.exportDiagramPng=Th,Ne.exportDiagramSvg=$h,Ne.fromPersisted=Tu,Ne.isGeneratable=Hc,Ne.isInheritedColumnRef=jn,Ne.javaTypeLabel=Io,Ne.makeInheritedColumnRef=Zs,Ne.mergeDiagram=ad,Ne.mermaidErToImportSource=Nc,Ne.migrateLegacyMoney=xg,Ne.multiplicityLabel=ea,Ne.newId=Pe,Ne.packEntityBoxes=Vr,Ne.parseDiagramJson=Ac,Ne.parseInheritedColumnRef=Br,Ne.parseMermaidEr=Ec,Ne.parseSqlDdl=qr,Ne.planHealBackfillOps=R_,Ne.projectActionLog=gl,Ne.projectEntityAudit=cd,Ne.projectFieldAudit=Tn,Ne.projectInheritedColumns=ti,Ne.projectSeqDiff=bl,Ne.renderDiagramSvg=Tc,Ne.resolveColumnPhysicalName=oi,Ne.resolveDiagram=qs,Ne.resolveEffectiveColumn=pn,Ne.resolveQuickFix=ol,Ne.resolveSharedColumn=Gn,Ne.resolveSymbolicOps=Rb,Ne.restoreDeepEqual=Jn,Ne.scaffoldEntityJava=ig,Ne.sharedColumnScopeEntities=Lr,Ne.sqlDdlToImportSource=Cc,Ne.stereotypeLabel=ni,Ne.synthesizeRestoreOps=Fg,Ne.toPersisted=C_,Ne.toPersistedV2=S_,Ne.translate=qt,Ne.uiMessagesEn=Lf,Ne.uiMessagesJa=Pf,Ne.uiMessagesKo=zf,Ne.validateModel=sa,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
65
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(M=>{if(b.value){const V=zn(b.value),U=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=Fs.translate(he.x,he.y).scale(c.value.zoom),Ae=f.value.constrain()(ye,_e,d.value);f.value.transform(p.value,Ae)},ue=NT().wheelDelta(be=>ns(be)*(e.zoomStep/10)).on("zoom",e.pannable?oe:()=>{}).on("zoom.wheel",e.zoomable?U:()=>{});V.call(ue),M(()=>{V.on("zoom",null)})}},{flush:"post"});function T(M){const[V,U]=Fn(M);n("click",{event:M,position:{x:V,y:U}})}function R(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeClick(U),n("nodeClick",U)}function w(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeDoubleClick(U),n("nodeDblclick",U)}function v(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeMouseEnter(U),n("nodeMouseenter",U)}function I(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeMouseMove(U),n("nodeMousemove",U)}function L(M,V){const U={event:M,node:V,connectedEdges:lo([V],s.value)};m.miniMapNodeMouseLeave(U),n("nodeMouseleave",U)}return(M,V)=>(t.openBlock(),t.createBlock(t.unref($f),{position:M.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:M.pannable,zoomable:M.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:b,width:g.value,height:_.value,viewBox:[x.value.x,x.value.y,x.value.width,x.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:T},[M.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(M.ariaLabel),9,ST)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),U=>(t.openBlock(),t.createBlock(vT,{id:U.id,key:U.id,f:"",position:U.computedPosition,dimensions:U.dimensions,selected:U.selected,dragging:U.dragging,style:t.normalizeStyle(U.style),class:t.normalizeClass(N.value(U)),color:h.value(U),"border-radius":M.nodeBorderRadius,"stroke-color":E.value(U),"stroke-width":M.nodeStrokeWidth,"shape-rendering":t.unref(k),type:U.type,hidden:U.hidden,onClick:oe=>R(oe,U),onDblclick:oe=>w(oe,U),onMouseenter:oe=>v(oe,U),onMousemove:oe=>I(oe,U),onMouseleave:oe=>L(oe,U)},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:S.value,fill:M.maskColor,stroke:M.maskStrokeColor,"stroke-width":M.maskStrokeWidth,"fill-rule":"evenodd"},null,8,xT)],8,CT))]),_:1},8,["position","class"]))}}),$T=["d"],TT=["cx","cy","onDblclick"],MT=["x","y","onPointerdown","onDblclick"],VT=tt(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=et(),i=t.inject(Ns),a=t.inject(po,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(qo,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((B,$)=>$===d.value?u.value:B)),{source:p,target:f,sourceSide:y,targetSide:b}=Tp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),g=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?pp(p.value,y.value,m.value,f.value,b.value):yp(p.value,m.value,f.value)),_=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?hp(p.value,y.value,m.value,f.value,b.value):_p(p.value,m.value,f.value).map((B,$)=>({point:B,segIndex:$})):[]),k=t.computed(()=>r.value?m.value:[]);function h(B,$){d.value=B,u.value={...c.value[B]},$.target.setPointerCapture($.pointerId),$.stopPropagation()}function E(B){if(d.value<0)return;const $=o({x:B.clientX,y:B.clientY});u.value={x:$.x,y:$.y}}function N(B){var $,x;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(x=($=B.target).releasePointerCapture)==null||x.call($,B.pointerId)}function C(B,$){$.stopPropagation(),i==null||i.removePoint(n.id,B)}function A(B,$){if(!i)return;const x=o({x:$.clientX,y:$.clientY});i.insertPoint(n.id,B,{x:x.x,y:x.y})}return(B,$)=>(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,$T),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,(x,S)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${S}`,cx:x.point.x,cy:x.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(T=>A(x.segIndex,T),["stop"])},null,42,TT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,(x,S)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${S}`,x:x.x-5,y:x.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:T=>h(S,T),onPointermove:E,onPointerup:N,onDblclick:T=>C(S,T)},null,42,MT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),BT=["data-theme"],DT={key:0,class:"em-ctx__sep",role:"separator"},OT=["aria-label"],LT={class:"em-ctx__swatches-label","aria-hidden":"true"},PT={class:"em-ctx__chips",role:"none"},zT=["aria-checked","aria-label","title","onClick"],FT=["aria-checked","aria-label","title","onClick"],UT=["disabled","onClick"],HT={class:"em-ctx__icon"},jT={class:"em-ctx__caption"},KT=tt(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(h,E)=>qt(o.locale??"ko",h,E),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(h,E){var A,B;r.value=E,l.value=(A=h.target)!=null&&A.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 N=s.value;if(!N)return;const C=N.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)),(B=f()[0])==null||B.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 E=[];for(const N of Array.from(h.children))if(N.classList.contains("em-ctx__item"))N.disabled||E.push(N);else if(N.classList.contains("em-ctx__swatches")){const C=Array.from(N.querySelectorAll(".em-ctx__chip"));C.length&&E.push(C.find(A=>A===document.activeElement)??C[0])}return E}function y(h){var A;const E=f();if(!E.length)return;const N=E.indexOf(document.activeElement),C=N<0?h>0?0:E.length-1:(N+h+E.length)%E.length;(A=E[C])==null||A.focus()}function b(h){var A,B;const E=(A=document.activeElement)==null?void 0:A.closest(".em-ctx__swatches");if(!E)return!1;const N=Array.from(E.querySelectorAll(".em-ctx__chip")),C=N.indexOf(document.activeElement);return C<0?!1:((B=N[(C+h+N.length)%N.length])==null||B.focus(),!0)}function g(h){var E,N;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":b(1)&&h.preventDefault();return;case"ArrowLeft":b(-1)&&h.preventDefault();return;case"Home":h.preventDefault(),(E=f()[0])==null||E.focus();return;case"End":{h.preventDefault();const C=f();(N=C[C.length-1])==null||N.focus();return}case"Tab":h.preventDefault(),y(h.shiftKey?-1:1)}}function _(h){h.disabled||(h.handler(),p())}function k(h,E){h.onPick(E),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(h,E)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:p,onContextmenu:t.withModifiers(p,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:E[0]||(E[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(N,C)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:C},[N.type==="separator"?(t.openBlock(),t.createElementBlock("div",DT)):N.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":N.caption},[t.createElementVNode("span",LT,t.toDisplayString(N.caption),1),t.createElementVNode("div",PT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":N.current===null}]),role:"menuitemradio","aria-checked":N.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:A=>k(N,null)},null,10,zT),(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-ctx__chip",{"is-on":N.current===A}]),style:t.normalizeStyle({background:t.unref(Go)(A)}),role:"menuitemradio","aria-checked":N.current===A,"aria-label":i(t.unref(mo)(A)),title:i(t.unref(mo)(A)),onClick:B=>k(N,A)},null,14,FT))),128))])],8,OT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":N.danger,"is-disabled":N.disabled}]),disabled:N.disabled,role:"menuitem",onClick:A=>_(N)},[t.createElementVNode("span",HT,[N.icon?(t.openBlock(),t.createBlock(Ve,{key:0,name:N.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",jT,t.toDisplayString(N.caption),1)],10,UT))],64))),128))],36)],8,BT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function Ch(e,n){return n?`${e}:${n}`:e}function Sh(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(Ch(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 GT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=Ch(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 xh(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(Sh(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=Sh(e.storageKey,s)),t.watch(o,s=>GT(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 Hs=[".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 Qo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function YT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function qT(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const b=n(y.left,y.top+y.height/2);return[{...i,x:b.x,y:b.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,p=0;const f=()=>{const y=d.trim();if(y){const b=n(m,(u+p)/2);c.push({...i,x:b.x,y:b.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const b=a.getBoundingClientRect();u===null||Math.abs(b.top-u)>1?(f(),u=b.top,m=b.left,p=b.bottom,d=s[y]):(d+=s[y],p=Math.max(p,b.bottom))}return f(),c}function $r(e,n){const o=[];for(const i of e.querySelectorAll("*"))YT(i)&&(i.closest(Hs)||Qo(i)&&o.push(...qT(i,n)));return o}function ji(e){return Math.round(e*100)/100}function WT(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Hs)||!Qo(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 JT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Qo(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 Rh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Hs)||!Qo(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 js(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 XT(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||!Qo(y))continue;const b=y.firstElementChild;if(b)if(f.type==="group"){const g=Ki(b,o);js(s,g),i.push({...g,texts:[]});const _=b.querySelector(".em-group__label");_&&i.push({...Ki(_,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:$r(b,o)})}else if(f.type==="note"){const g={...Ki(b,o),texts:$r(b,o),lines:Rh(b,b,o)};js(s,g),r.push(g)}else{const g=Ki(b,o);js(s,g);const _=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const k=b.querySelector(".em-entity__header");if(k){const h=Ki(k,o);a.push({x:g.x,y:g.y,w:g.w,h:h.y+h.h-g.y,fill:h.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:$r(b,o),lines:Rh(b,b,o),icons:WT(b,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||!Qo(y))continue;const b=y.getAttribute("d");if(!b)continue;const g=getComputedStyle(y),_=g.strokeDasharray,k=JT(f);l.push({d:b,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:$r(f,o),markers:k.length?k:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Ks(e){return Tc(XT(e))}function Ah(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 $h(e,n="diagram.svg"){const o=Ks(e);Ah(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function ZT(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 Th(e,n="diagram.png",o=2){const i=Ks(e),{w:a,h:r}=ZT(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 변환 실패");Ah(u,n)}finally{URL.revokeObjectURL(l)}}const QT={class:"em-shortcuts"},eM={class:"em-shortcuts__list"},tM={class:"em-shortcuts__title"},nM={class:"em-shortcuts__keys"},oM={class:"em-shortcuts__kbd"},iM={key:0,class:"em-shortcuts__plus"},aM={class:"em-shortcuts__desc"},rM={class:"em-shortcuts__actions"},Mh=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",QT,[t.createElementVNode("div",eM,[(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",tM,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",nM,[(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",oM,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",iM,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",aM,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",rM,[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 ei(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function lM(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 sM=["aria-label"],cM=["aria-activedescendant","aria-label","placeholder"],dM={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},uM=["aria-label"],mM={class:"em-cmdk__section","aria-hidden":"true"},fM=["id","aria-selected","onMouseenter","onClick"],pM={class:"em-cmdk__label"},hM={key:0,class:"em-cmdk__tag"},yM={key:1,class:"em-cmdk__sub"},gM=["aria-label"],bM={class:"em-cmdk__section","aria-hidden":"true"},_M=["id","aria-selected","aria-disabled","onMouseenter","onClick"],kM={class:"em-cmdk__label"},EM={key:1,class:"em-cmdk__empty"},NM=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 N=c.value,C=a.state.logical.entities.map(B=>{var $,x,S,T,R,w;return{type:"goto",kind:"entity",id:B.modelId,label:((x=($=B.table)==null?void 0:$.logicalName)==null?void 0:x[N])||B.name,sub:(S=B.table)==null?void 0:S.physicalName,match:ei(B.name,(R=(T=B.table)==null?void 0:T.logicalName)==null?void 0:R[N],(w=B.table)==null?void 0:w.physicalName)??""}}),A=a.state.logical.groups.map(B=>{var $,x,S,T;return{type:"goto",kind:"group",id:B.modelId,label:(($=B.name)==null?void 0:$[N])||((x=B.name)==null?void 0:x.ko)||B.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:ei((S=B.name)==null?void 0:S[N],(T=B.name)==null?void 0:T.ko,B.packageName)??""}});return[...C,...A]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const N=[];a.editable.value&&(N.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),N.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),N.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),N.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),N.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),N.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),N.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),N.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"])N.push({type:"action",id:`dm-${C}`,label:a.t(u[C]),run:()=>a.displayMode.value=C});return N});function p(N,C){return N.label.toLowerCase().includes(C)}const f=t.computed(()=>{const N=r.value.trim().toLowerCase();return N?d.value.filter(C=>C.match.includes(N)):d.value}),y=t.computed(()=>{const N=r.value.trim().toLowerCase();return N?m.value.filter(C=>p(C,N)):m.value}),b=t.computed(()=>[...f.value,...y.value]);t.watch([f,y],()=>{l.value=0});function g(N){return b.value.indexOf(N)}const _=N=>`em-cmdk-opt-${N}`,k=t.computed(()=>b.value[l.value]?_(l.value):void 0);t.watch(l,async()=>{var C;await t.nextTick();const N=k.value;N&&((C=document.getElementById(N))==null||C.scrollIntoView({block:"nearest"}))});function h(N){if(N.type==="goto")a.selection.value={kind:N.kind,id:N.id},a.requestFocus(N.id);else{if(N.disabled)return;N.run()}i("close")}function E(N){if(N.key==="Escape"){i("close"),N.preventDefault();return}if(N.key==="ArrowDown"){l.value=Math.min(l.value+1,b.value.length-1),N.preventDefault();return}if(N.key==="ArrowUp"){l.value=Math.max(l.value-1,0),N.preventDefault();return}if(N.key==="Enter"){const C=b.value[l.value];C&&h(C),N.preventDefault();return}N.key==="Tab"&&N.preventDefault()}return t.nextTick(()=>{var N;return(N=s.value)==null?void 0:N.focus()}),(N,C)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:C[1]||(C[1]=t.withModifiers(A=>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]=A=>r.value=A),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":k.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:E},null,40,cM),[[t.vModelText,r.value]]),t.createElementVNode("div",dM,[b.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",mM,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,A=>(t.openBlock(),t.createElementBlock("button",{id:_(g(A)),key:A.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g(A)===l.value}]),role:"option","aria-selected":g(A)===l.value,onMouseenter:B=>l.value=g(A),onClick:B=>h(A)},[t.createElementVNode("span",pM,t.toDisplayString(A.label),1),A.tag?(t.openBlock(),t.createElementBlock("span",hM,t.toDisplayString(A.tag),1)):A.sub?(t.openBlock(),t.createElementBlock("span",yM,t.toDisplayString(A.sub),1)):t.createCommentVNode("",!0)],42,fM))),128))],8,uM)):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",bM,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,A=>(t.openBlock(),t.createElementBlock("button",{id:_(g(A)),key:A.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g(A)===l.value,"is-disabled":A.disabled}]),role:"option","aria-selected":g(A)===l.value,"aria-disabled":A.disabled||void 0,onMouseenter:B=>l.value=g(A),onClick:B=>h(A)},[t.createElementVNode("span",kM,t.toDisplayString(A.label),1)],42,_M))),128))],8,gM)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",EM,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,sM)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function wM(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const IM={key:0,class:"em-canvas__empty","aria-hidden":"true"},vM={class:"em-canvas__empty-title"},CM=["innerHTML"],SM=["innerHTML"],xM=["innerHTML"],RM={key:1,class:"em-canvas__empty-title"},AM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},$M={class:"em-conflict-banner__body"},TM={class:"em-conflict-banner__title"},MM={class:"em-conflict-banner__detail"},VM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Gs="nc:",Vh=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(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=wM(i.opConflict.value);return D?{title:i.t(D.titleKey),detail:i.t(D.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(D){p.x=D.clientX,p.y=D.clientY}const y=t.ref(null);t.provide(dr,y);const b=t.ref(null);t.provide(Zf,b);const g=t.ref(null),_=t.computed(()=>{const D=g.value,F=new Set;if(!D)return F;if(D.kind==="entity")F.add(D.id);else if(D.kind==="group"){const j=i.resolved.value.groups.find(fe=>fe.group.modelId===D.id);for(const fe of(j==null?void 0:j.group.memberEntityRefs)??[])F.add(fe)}return F}),k=t.computed(()=>{const D=g.value,F=new Set(_.value),j=new Set,fe=new Set;if(!D)return{related:F,edges:j,notes:fe};if(D.kind==="note"){fe.add(D.id);for(const Oe of i.resolved.value.noteConnections)Oe.noteRef===D.id&&F.add(Oe.targetRef);return{related:F,edges:j,notes:fe}}const Te=_.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(qo,{source:g,active:t.computed(()=>g.value!==null),primaryEntityIds:_,relatedEntityIds:t.computed(()=>k.value.related),relatedEdgeIds:t.computed(()=>k.value.edges),relatedNoteIds:t.computed(()=>k.value.notes),hoverGroupId:t.computed(()=>{var D;return((D=g.value)==null?void 0:D.kind)==="group"?g.value.id:null}),setEntityHover:D=>{b.value||m.value||(g.value=D?{kind:"entity",id:D}:null)},setGroupHover:D=>{b.value||m.value||(g.value=D?{kind:"group",id:D}:null)},setNoteHover:D=>{b.value||m.value||(g.value=D?{kind:"note",id:D}:null)}}),t.provide(po,i);const h=dS(),E=t.computed(()=>h(i.state.logical,i.embeddableCatalog.value));t.provide(tp,E);const N=xh({expandableKeys:()=>[],defaultCollapsed:pS,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(ip,{isCollapsed:N.isCollapsed,toggle:N.toggle}),t.provide(Qf,{marks:t.toRef(o,"diffMarks")});function C(D,F){return`${Gs}${D}:${F}`}function A(D){if(!D.startsWith(Gs))return null;const[F,j]=D.slice(Gs.length).split(":");return F&&j?{noteRef:F,targetRef:j}:null}t.provide(Ns,{points:D=>{var j,fe;const F=A(D);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===D))==null?void 0:fe.waypoints)??[]},movePoint:(D,F,j)=>{const fe=A(D);fe?i.moveNoteConnectionWaypoint(fe.noteRef,fe.targetRef,F,j):i.moveWaypoint(D,F,j)},insertPoint:(D,F,j)=>{const fe=A(D);fe?i.addNoteConnectionWaypoint(fe.noteRef,fe.targetRef,F,j):i.addWaypoint(D,F,j)},removePoint:(D,F)=>{const j=A(D);j?i.removeNoteConnectionWaypoint(j.noteRef,j.targetRef,F):i.removeWaypoint(D,F)}});const B=et(),{nodes:$,edges:x,findNode:S,findEdge:T,addNodes:R,addEdges:w,removeNodes:v,removeEdges:I,fitView:L,setCenter:M,getViewport:V,screenToFlowCoordinate:U,getSelectedNodes:oe,updateNodeInternals:ue}=B,be=t.ref(!1);async function pe(D){be.value=!0,await t.nextTick(),await new Promise(F=>requestAnimationFrame(()=>F(null)));try{return await D()}finally{be.value=!1}}async function he(){try{await pe(()=>$h(B))}catch(D){console.error("[entity-modeler] SVG export failed",D),c(i.t("em.canvas.exportFailed"))}}async function _e(){try{await pe(()=>Th(B))}catch(D){console.error("[entity-modeler] PNG export failed",D),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:he,exportPng:_e,fitView:L});const ye=t.computed(()=>i.resolved.value.entities.length===0);function Ae(){const D=V(),{width:F,height:j}=B.dimensions.value;return{x:(F/2-D.x)/D.zoom,y:(j/2-D.y)/D.zoom}}function Fe(){const D=Ae();i.addEntity("NewEntity",{x:D.x,y:D.y})}function se(){const D=Ae();i.addNote("메모",{x:D.x,y:D.y})}function ne(D){for(const F of i.resolved.value.groups){const{location:j,size:fe}=F.geo;if(D.x>=j.x&&D.x<=j.x+fe.width&&D.y>=j.y&&D.y<=j.y+fe.height)return F.group.modelId}return null}function ae(D,F){return D.x===F.x&&D.y===F.y}function me(D,F){return(D==null?void 0:D.width)===(F==null?void 0:F.width)&&(D==null?void 0:D.height)===(F==null?void 0:F.height)}function P(D,F){return D.entity===F.entity&&D.displayMode===F.displayMode&&D.collapsed===F.collapsed&&D.locked===F.locked&&D.groupRef===F.groupRef&&me(D.size,F.size)&&D.style===F.style&&D.attributeStyles===F.attributeStyles&&D.operationStyles===F.operationStyles}function O(D,F){const j=Object.keys(D);if(j.length!==Object.keys(F).length)return!1;for(const fe of j)if(fe==="geo"){const Te=D.geo,Oe=F.geo;if(!ae(Te.location,Oe.location)||!me(Te.size,Oe.size))return!1}else if(D[fe]!==F[fe])return!1;return!0}function z(){const D=i.resolved.value,F=new Map(D.groups.map(ce=>[ce.group.modelId,ce.geo])),j=new Set(D.groups.map(ce=>ce.group.modelId)),fe=new Set([...j,...D.entities.map(ce=>ce.entity.modelId),...D.notes.map(ce=>ce.note.modelId)]);for(const ce of[...$.value])fe.has(ce.id)||v([ce.id]);for(const ce of D.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=S(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 R([{id:Le,type:"group",position:{...ce.geo.location},draggable:ut,style:Ye,data:Je}])}for(const ce of D.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=S(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)):R([{id:Le,type:"entity",position:ve,parentNode:Ye,draggable:ut,connectable:G,data:Je}])}for(const ce of D.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=S(Ye);if($e){ae($e.position,ve)||($e.position=ve);const Ee=$e.data;(Ee.groupRef!==Je||!O(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 R([{id:Ye,type:"note",position:ve,parentNode:Je,style:G,data:ut}])}const Te=new Map(D.associations.map(ce=>[ce.association.modelId,ce])),Oe=new Set(D.noteConnections.map(ce=>C(ce.noteRef,ce.targetRef)));for(const ce of[...x.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 w([Ye])}for(const ce of D.noteConnections){const Le=C(ce.noteRef,ce.targetRef),Ye={noteRef:ce.noteRef,targetRef:ce.targetRef};T(Le)||w([{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(D){const F=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(D)}"]`);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 D=ee;ee=!1;const F=[...Q];if(Q.clear(),D){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(D){if(D)for(const F of D)Q.add(F);else ee=!0;we||(we=!0,t.nextTick(()=>requestAnimationFrame(Ce)))}t.provide(ep,{mark:D=>Y([D])});function X(){const D=oe.value.map(j=>j.id);if(D.length)return D;const F=i.selection.value;return F&&(F.kind==="entity"||F.kind==="note"||F.kind==="group")?[F.id]:[]}function q(){return oe.value.filter(D=>D.type==="entity").map(D=>D.id)}function Ie(){return oe.value.filter(D=>D.type==="group").map(D=>D.id)}function Be(D){var F;return[...((F=i.state.logical.groups.find(j=>j.modelId===D))==null?void 0:F.memberEntityRefs)??[]]}function ze(){const D=Ie().flatMap(Be);return[...new Set([...q(),...D])]}function Ue(){return Ie().length>0||q().length>1}function ie(){Ue()?i.copy(ze()):i.copy()}async function Se(D){if(!D.length)return;await t.nextTick();const F=oe.value;F.length&&B.removeSelectedNodes(F);const j=D.map(fe=>S(fe)).filter(fe=>!!fe);j.length&&B.addSelectedNodes(j)}function je(D){if(Ue()&&q().includes(D)){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:D},i.copy()}}}function Ze(D){var Te;const F=D.target;if(F&&(F.tagName==="INPUT"||F.tagName==="TEXTAREA"||F.isContentEditable))return;if(D.key==="?"){a.openModal({component:Mh,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"&&(ie(),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(((Te=i.selection.value)==null?void 0:Te.kind)==="attribute"){if(D.key==="ArrowUp"||D.key==="ArrowDown"){const Ye=D.key==="ArrowDown"?1:-1;(D.altKey?i.nudgeSelectedAttributes(Ye):i.moveAttributeFocus(Ye))&&D.preventDefault()}return}const Oe=D.shiftKey?10:1,ce=D.key==="ArrowLeft"?-Oe:D.key==="ArrowRight"?Oe:0,Le=D.key==="ArrowUp"?-Oe:D.key==="ArrowDown"?Oe:0;i.nudgeNodes(X(),ce,Le)&&D.preventDefault();return}if(!(D.metaKey||D.ctrlKey))return;const fe=D.key.toLowerCase();fe==="c"?(ie(),D.preventDefault()):fe==="v"?(Se(i.paste()),D.preventDefault()):fe==="z"&&(D.shiftKey?i.redo():i.undo(),D.preventDefault())}t.onMounted(async()=>{z(),await t.nextTick(),L(),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 D=(fe=document.elementFromPoint(p.x,p.y))==null?void 0:fe.closest(".vue-flow__node"),F=D==null?void 0:D.dataset.id;if(!F){g.value=null;return}const j=D.classList.contains("vue-flow__node-group")?"group":D.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,D=>{const F=g.value;if(!F)return;(F.kind==="entity"?D.entities.some(fe=>fe.entity.modelId===F.id):F.kind==="group"?D.groups.some(fe=>fe.group.modelId===F.id):D.notes.some(fe=>fe.note.modelId===F.id))||(g.value=null)});function st(D){const F=D.computedPosition??D.position,j=D.dimensions??{width:0,height:0};return{x:F.x+j.width/2,y:F.y+j.height/2}}function qe(D){const F=D.node;if(F){if(g.value=null,F.type==="group"){const j=i.resolved.value.groups.find(fe=>fe.group.modelId===F.id);b.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(D){var fe;y.value=null,b.value=null;const F=(fe=D.nodes)!=null&&fe.length?D.nodes:[D.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=S(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(D){var Ye,Je,ut,G,W;if(!i.editable.value||!D.source||!D.target)return;const F=((Ye=S(D.source))==null?void 0:Ye.type)==="note",j=((Je=S(D.target))==null?void 0:Je.type)==="note";if(F||j){if(F&&j)return;const ve=F?D.source:D.target,$e=F?D.target:D.source;((ut=S($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(D.source)==="JPA_EMBEDDABLE",Oe=fe(D.target)==="JPA_EMBEDDABLE";if(Te||Oe){if(Te&&Oe)return;const ve=Te?D.source:D.target,$e=Te?D.target:D.source;i.addEmbedAssociation($e,ve);return}const ce=(G=D.sourceHandle)!=null&&G.startsWith("r:")?D.sourceHandle.slice(2):void 0,Le=(W=D.targetHandle)!=null&&W.startsWith("l:")?D.targetHandle.slice(2):void 0;i.addAssociation(D.source,D.target,ce,Le)}const K=t.ref(null);function le(D,F){var fe;const j=i.state.layout.entityLayouts.find(Te=>Te.entityRef===D);return St((fe=j==null?void 0:j.attributeStyles)==null?void 0:fe[F])}function Re(D,F){var fe;const j=i.state.layout.entityLayouts.find(Te=>Te.entityRef===D);return St((fe=j==null?void 0:j.operationStyles)==null?void 0:fe[F])}function ke(D){var F;return St((F=i.state.layout.groupLayouts.find(j=>j.groupRef===D))==null?void 0:F.style)}function H(D){var F;return St((F=i.state.layout.notes.find(j=>j.modelId===D))==null?void 0:F.style)}function bt(D){var Te,Oe;if(D.preventDefault(),!i.editable.value)return;const F=()=>U({x:D.clientX,y:D.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(D,j)}function vt({event:D,node:F}){var Ye,Je,ut,G,W,ve,$e,Ee,Qe,Tt,Et,_o,Gi,pt,Rn,Mr,Ph,zh,Fh;const j=D;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:H(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,Ys=[{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:qD=>i.setAttributeSwatches(F.id,Nt,qD)},{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"&&Ys.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()}}),Ys.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,Ys);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])??((Ph=ht.label)==null?void 0:Ph.ko)??((zh=ht.label)==null?void 0:zh.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)})}(Fh=K.value)==null||Fh.open(j,Le)}function ot({event:D,edge:F}){var Oe,ce;const j=D;if(j.preventDefault(),!i.editable.value)return;const fe=A(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(D){return D==="group"?"group":D==="note"?"note":"entity"}function Xe({node:D}){if(oe.value.length>1){i.selection.value=null;return}i.selection.value={kind:Ge(D.type),id:D.id}}function Z({nodes:D}){D.length>1&&(i.selection.value=null)}function Rt({edge:D}){const F=A(D.id);i.selection.value=F?{kind:"note",id:F.noteRef}:{kind:"association",id:D.id}}function $t(D){const F=i.selection.value;return!!F&&F.kind!=="attribute"&&F.id===D.id}function Sn(D){var F,j;return $t(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"?Mf(St((F=D.data)==null?void 0:F.style),!0)??"var(--em-mm-group)":Mf(St((j=D.data)==null?void 0:j.style))??"var(--em-mm-entity)"}function At(D){return $t(D)?"var(--em-selection)":D.type==="note"?"var(--em-note-accent)":D.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ge(D,F){M(D,F,{zoom:V().zoom,duration:350})}t.watch(()=>i.focusRequest.value,D=>{if(!D)return;const F=S(D.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:D}){ge(D.x,D.y)}function xn({node:D}){i.selection.value={kind:Ge(D.type),id:D.id};const F=D.computedPosition??D.position,j=D.dimensions??{width:0,height:0};ge(F.x+j.width/2,F.y+j.height/2)}function Zt({node:D}){L({nodes:[D.id],duration:350,maxZoom:1.2,padding:.6})}return(D,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(xw),{"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(up,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"node-entity":t.withCtx(j=>[t.createVNode(dp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"node-note":t.withCtx(j=>[t.createVNode(mp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"edge-association":t.withCtx(j=>[t.createVNode(Mp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"edge-note-connection":t.withCtx(j=>[t.createVNode(VT,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(Nx),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(qx),{"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(AT),{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",IM,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",vM,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,CM),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,SM),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,xM)],64)):(t.openBlock(),t.createElementBlock("p",RM,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(NM,{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",AM,[t.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",$M,[t.createElementVNode("strong",TM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",MM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(KT,{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",VM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),BM={class:"em-explorer em-scroll-overlay"},DM={class:"em-explorer__search"},OM=["placeholder","aria-label"],LM=["aria-label","title"],PM={key:0,class:"em-explorer__empty"},zM=["aria-label"],FM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],UM=["onClick"],HM=["title"],jM={class:"em-key-slot"},KM={class:"em-key-slot"},GM={class:"em-explorer__label"},YM={key:2,class:"em-explorer__sr"},Bh=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 R=i.resolved.value,w=i.displayMode.value,v=i.userLanguage.value,I=se=>{var ne,ae,me;return Ji(w,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"))},L=w==="PHYSICAL"||w==="LOGICAL_PHYSICAL",M=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&&L}}},V=se=>se.attrType.startsWith("EMBED")&&se.dbAttrs.length>0,U=se=>V(se)||mn(se),oe=w==="PHYSICAL"||w==="LOGICAL_PHYSICAL",ue=(se,ne)=>{if(mn(se)){const me=i.state.logical.entities,P=me.find(O=>O.modelId===ne);return se.dbAttrs.map((O,z)=>{const Q=Kn(se,P,me,i.state.logical.associations,z);return Q?{...O,physicalName:O.physicalName||Q.physicalName,logicalName:O.logicalName??Q.logicalName,dataType:O.dataType||Q.dataType}:O})}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 O=ae.fields[P];return O?{...me,physicalName:me.physicalName||O.physicalName,logicalName:me.logicalName??O.logicalName,dataType:me.dataType||O.dataType,length:me.length??O.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(U(se)){const q=Yr(w,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:ei(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(w,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:ei(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),O=Yr(w,se,P,ae==null?void 0:ae.targetName);return{key:`attr:${se.modelId}`,label:Ji(w,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"))+(O?` : ${O}`:""),...M(se),attrRef:me,focusId:ne,matchText:ei(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=w==="CLASS",P=ae||ne.attributes.some(mn)?ll(ne,i.state.logical):void 0,O=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:ei(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:O.map(de=>be(de,ne.modelId,z.get(de.modelId)))}},he=new Map,_e=[];for(const se of R.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 R.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(R.associations.length){const se=new Map(R.entities.map(ne=>[ne.entity.modelId,I(ne.entity)]));ye.push({key:"section:associations",label:i.t("em.explorer.associations",{n:R.associations.length}),icon:"arrow-lr",children:R.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 R.notes.length&&ye.push({key:"section:notes",label:i.t("em.explorer.notes",{n:R.notes.length}),icon:"note",children:R.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(R){return R?R.pk&&R.fk?i.t("em.node.keyPfk"):R.pk?i.t("em.node.keyPk"):R.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const R=[],w=v=>{if(v.children.length){v.key!=="root"&&R.push(v.key);for(const I of v.children)w(I)}};return w(r.value),R}),c=R=>R.startsWith("entity:")||R==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=xh({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),y=t.ref(null),b=t.computed(()=>f.value.trim().length>0),g=t.computed(()=>{const R=[];if(b.value){const v=lM(r.value,f.value.trim().toLowerCase()),I=(L,M,V,U,oe)=>{if(!v.has(L.key))return;R.push({node:L,depth:M,parentKey:V,posinset:U,setsize:oe});const ue=L.children.filter(be=>v.has(be.key));ue.forEach((be,pe)=>I(be,M+1,L.key,pe+1,ue.length))};return I(r.value,0,null,1,1),R}const w=(v,I,L,M,V)=>{R.push({node:v,depth:I,parentKey:L,posinset:M,setsize:V}),d(v.key)||v.children.forEach((U,oe)=>w(U,I+1,v.key,oe+1,v.children.length))};return w(r.value,0,null,1,1),R}),_=t.ref(null),k=t.ref(null),h=t.computed(()=>{var w;const R=g.value;return k.value&&R.some(v=>v.node.key===k.value)?k.value:((w=R[0])==null?void 0:w.node.key)??null}),E=R=>!b.value&&d(R);async function N(R){var w,v;R&&(k.value=R,await t.nextTick(),(v=(w=_.value)==null?void 0:w.querySelector(`[data-key="${R}"]`))==null||v.focus())}function C(R,w){var L,M,V,U,oe;const v=g.value,I=v.findIndex(ue=>ue.node.key===w.node.key);switch(R.key){case"ArrowDown":R.preventDefault(),N((L=v[I+1])==null?void 0:L.node.key);return;case"ArrowUp":R.preventDefault(),N((M=v[I-1])==null?void 0:M.node.key);return;case"Home":R.preventDefault(),N((V=v[0])==null?void 0:V.node.key);return;case"End":R.preventDefault(),N((U=v[v.length-1])==null?void 0:U.node.key);return;case"ArrowRight":if(R.preventDefault(),!w.node.children.length)return;E(w.node.key)?u(w.node.key):N((oe=v[I+1])==null?void 0:oe.node.key);return;case"ArrowLeft":R.preventDefault(),w.node.children.length&&!E(w.node.key)?u(w.node.key):N(w.parentKey);return;case"Enter":case" ":R.preventDefault(),S(w.node,R);return;case"F2":R.preventDefault(),T(w.node)}}const A=t.computed(()=>b.value&&g.value.length<=1);function B(R){var I;if(R.key!=="/"||R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;const w=R.target,v=w==null?void 0:w.tagName;v==="INPUT"||v==="TEXTAREA"||v==="SELECT"||w!=null&&w.isContentEditable||(R.preventDefault(),(I=y.value)==null||I.focus())}t.onMounted(()=>window.addEventListener("keydown",B)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",B)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function $(R){const w=i.selection.value;return R.attrRef?(w==null?void 0:w.kind)==="attribute"&&w.entityId===R.attrRef.entityId&&w.ids.includes(R.attrRef.attrId):!!w&&w.kind!=="attribute"&&!!R.selectId&&R.selectKind===w.kind&&R.selectId===w.id}function x(R){const w=i.selection.value;return R.selectKind==="entity"&&(w==null?void 0:w.kind)==="attribute"&&w.entityId===R.selectId}function S(R,w){if(R.attrRef){const v=w.shiftKey?"range":w.metaKey||w.ctrlKey?"toggle":"replace";i.selectAttribute(R.attrRef.entityId,R.attrRef.attrId,v)}else R.selectKind&&R.selectId&&(i.selection.value={kind:R.selectKind,id:R.selectId});R.focusId&&i.requestFocus(R.focusId)}function T(R){R.selectKind==="entity"&&R.selectId&&lr(a,i,R.selectId)}return(R,w)=>(t.openBlock(),t.createElementBlock("section",BM,[t.createElementVNode("div",DM,[t.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":w[0]||(w[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:w[1]||(w[1]=t.withKeys(v=>f.value="",["esc"]))},null,40,OM),[[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:w[2]||(w[2]=v=>f.value="")},[t.createVNode(Ve,{name:"x",size:13})],8,LM)):t.createCommentVNode("",!0)]),A.value?(t.openBlock(),t.createElementBlock("p",PM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:_,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":x(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?!E(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=>S(v.node,I),onDblclick:I=>T(v.node),onFocus:I=>k.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":!E(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,UM),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",jM,[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",KM,[v.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,HM)):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:v.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",GM,t.toDisplayString(v.node.label),1),l(v.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",YM,t.toDisplayString(l(v.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,FM))),128))],8,zM)]))}}),[["__scopeId","data-v-63b45532"]]),qM={class:"em-text-export"},WM=["id","aria-selected","tabindex","onClick"],JM=["aria-labelledby"],XM={class:"em-text-export__actions"},ZM=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",qM,[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:b=>a.value=y,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(b=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(b=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(b=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(b=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,WM))),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,JM),t.createElementVNode("div",XM,[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"]]),QM={class:"em-text-import"},e2=["aria-label"],t2=["aria-checked","tabindex","onClick"],n2=["placeholder"],o2={class:"em-text-import__status"},i2={class:"em-text-import__ok"},a2={key:0,class:"em-text-import__warn"},r2={key:1,class:"em-text-import__err"},l2={key:2,class:"em-text-import__err"},s2={key:3,class:"em-text-import__err"},c2={class:"em-text-import__actions"},d2=tt(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(b,g)=>qt(n.locale??"ko",b,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(b){var _,k;const g=l[(b+l.length)%l.length];g&&(r.value=g.key,await t.nextTick(),(k=(_=s.value)==null?void 0:_.querySelectorAll('[role="radio"]')[l.indexOf(g)])==null||k.focus())}function d(b){c(l.findIndex(g=>g.key===r.value)+b)}function u(b){return b?b.startsWith("{")?"json":/\berdiagram\b/i.test(b)?"mermaid":/\bcreate\s+table\b/i.test(b)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const b=a.value.trim();if(!b)return{status:"empty"};const g=m.value;if(!g)return{status:"unknown"};try{let _,k=[];return g==="json"?_=Ac(b):g==="mermaid"?_=Nc(b):(_=Cc(b),k=qr(b).warnings),_.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:_,warnings:k}}catch(_){return{status:"error",message:_ instanceof Error?_.message:String(_)}}}),f=t.computed(()=>p.value.status==="ok");function y(){const b=p.value;b.status!=="ok"||!b.source||(n.onImport(b.source),o.close())}return(b,g)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",QM,[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,_=>t.createElementVNode("button",{key:_.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":_.key===r.value}]),"aria-checked":_.key===r.value,tabindex:_.key===r.value?0:-1,onClick:k=>r.value=_.key,onKeydown:[g[0]||(g[0]=t.withKeys(t.withModifiers(k=>d(-1),["prevent"]),["left"])),g[1]||(g[1]=t.withKeys(t.withModifiers(k=>d(1),["prevent"]),["right"])),g[2]||(g[2]=t.withKeys(t.withModifiers(k=>c(0),["prevent"]),["home"])),g[3]||(g[3]=t.withKeys(t.withModifiers(k=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(_.labelKey)),43,t2)),64))],8,e2),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":g[4]||(g[4]=_=>a.value=_),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,n2),[[t.vModelText,a.value]]),t.createElementVNode("div",o2,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",i2,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",a2," ⚠ "+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",r2,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",l2,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",s2,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",c2,[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]=_=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),u2={class:"em-toolbar"},m2=["title"],f2={class:"em-toolbar__mode"},Dh=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(b=>b.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=zr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:ZM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:sc(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:Sc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:Rc(y,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:d2,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(b=>b.modelId))}}})}function f(){r.openModal({component:Mh,bind:{locale:i.uiLocale.value}})}return(y,b)=>(t.openBlock(),t.createElementBlock("div",u2,[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,m2)):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:b[0]||(b[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:b[1]||(b[1]=g=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),b[9]||(b[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",f2,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":b[2]||(b[2]=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:b[3]||(b[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:b[4]||(b[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"]),b[10]||(b[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick: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:b[5]||(b[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:b[6]||(b[6]=g=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),b[11]||(b[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key: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:b[7]||(b[7]=g=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),b[8]||(b[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),p2=["title"],h2=["title"],y2=["disabled","aria-pressed"],g2=["disabled","aria-pressed"],b2=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,p2)):(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,y2),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,g2)],10,h2))}}),[["__scopeId","data-v-2b5162b7"]]),_2=["disabled"],k2={class:"em-panel__sub"},E2={class:"em-nav"},N2={key:0,class:"em-nav__divider","aria-hidden":"true"},w2={key:1},I2=["onClick","onKeydown"],v2={class:"em-nav__name"},C2=["title"],S2={key:0,class:"em-panel__note"},x2=["data-attr-block"],R2={key:0,class:"em-embed-col__label"},A2={class:"em-attr__row"},$2=["title"],T2={key:1,class:"em-attr__row"},M2={key:2,class:"em-embed-cols"},V2={class:"em-embed-col"},B2={class:"em-embed-col__label"},D2={class:"em-attr__row"},O2={class:"em-attr__navhint"},L2={key:3,class:"em-attr__navhint"},P2={key:0,class:"em-attr__navhint"},z2={class:"em-attr__row"},F2={class:"em-attr__row"},U2=["title"],H2={class:"em-attr__flags"},j2={class:"em-attr__pii"},K2={class:"em-attr__pii"},G2={key:1,class:"em-attr__pii"},Y2={key:2,class:"em-attr__pii em-attr__codetop"},q2={class:"em-multilang"},W2={key:5,class:"em-embed-cols"},J2={key:0,class:"em-attr__navhint"},X2={class:"em-embed-col__label"},Z2={class:"em-attr__row"},Q2=["title"],eV=["title"],tV=["title"],nV={class:"em-attr__row"},oV={key:0,class:"em-embed-upd"},iV={key:1,class:"em-attr__navhint"},aV={class:"em-embed-upd"},rV={class:"em-embed-upd"},lV={class:"em-attr__flags"},sV={class:"em-multilang"},cV={class:"em-swatch__row em-attr__swatch"},dV=["title","onClick"],uV=["title","onClick"],mV={key:0,class:"em-attr__swatch-hint"},fV=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:b,nameLocked:g,nameLockedHint:_,isManagedFk:k,setNaturalId:h,setIdentifier:E,setTransient:N,dbLocked:C,fkDerived:A,fkOriginPhysical:B,typeValueOf:$,typeLabelOf:x,setAttrType:S,setAttrCustomType:T,setDb:R,scaleApplicable:w,scaleHint:v,setDbLogical:I,setAttrDescription:L,attrPiiValue:M,setAttrPii:V,predefinedCustomTypeCatalog:U,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:O,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}=Of(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 H(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",k2,[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",E2,[(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",N2,[...Xe[0]||(Xe[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",w2,[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",v2,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,C2)],42,I2)]))],64))),128))]),st.value.length&&!nt.value.length?(t.openBlock(),t.createElementBlock("p",S2,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,D,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",R2,t.toDisplayString(t.unref(o).t("em.attr.derivedIdField")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",A2,[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(_)(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(A)(Z),items:t.unref(kc)(Z.type,t.unref(U)),"value-provider":t.unref($),"label-provider":t.unref(x),"model-value":Z.type,"onUpdate:modelValue":j=>t.unref(S)(Z,j)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(k)(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,$2)]),Z.type===t.unref(hn)&&!t.unref(A)(Z)?(t.openBlock(),t.createElementBlock("div",T2,[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",M2,[t.createElementVNode("div",V2,[t.createElementVNode("span",B2,t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("div",D2,[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(b)(Z,j)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("p",O2,t.toDisplayString(t.unref(o).t("em.attr.derivedIdNote")),1)])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",L2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ne)(Z)?(t.openBlock(),t.createElementBlock("div",W2,[t.unref(ae)(Z)?(t.openBlock(),t.createElementBlock("p",J2,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",X2,t.toDisplayString(((Te=t.unref(O)(Z,fe))==null?void 0:Te.name)??((Oe=t.unref(O)(Z,fe))==null?void 0:Oe.physicalName)??t.unref(o).t("em.attr.colFallback",{n:fe+1})),1),t.createElementVNode("div",Z2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`embed-col-${j.modelId}`,width:"100%",disabled:t.unref(J)(j),placeholder:((ce=t.unref(O)(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,Q2),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,eV),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,tV)]),t.createVNode(fo,{controller:t.unref(o),"ref-id":j.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",nV,[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(O)(Z,fe))==null?void 0:Le.logicalName)==null?void 0:Ye[t.unref(o).userLanguage.value])??((ut=(Je=t.unref(O)(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(O)(Z,fe))!=null&&G.shareable?(t.openBlock(),t.createElementBlock("label",oV,[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",iV,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",aV,[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",rV,[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",lV,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:"","onUpdate:modelValue":j=>t.unref(E)(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",sV,[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(L)(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(A)(Z)?(t.openBlock(),t.createElementBlock("p",P2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",z2,[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",F2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(B)(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(R)(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(A)(Z),items:t.unref(gc)(((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(R)(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(A)(Z),"model-value":(ge=Z.dbAttrs[0])==null?void 0:ge.length,"onUpdate:modelValue":j=>t.unref(R)(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(A)(Z)||!t.unref(w)(Z),"model-value":(ft=Z.dbAttrs[0])==null?void 0:ft.scale,"onUpdate:modelValue":j=>t.unref(R)(Z,{scale:j||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,U2)]),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",H2,[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(A)(Z),"onUpdate:modelValue":j=>t.unref(E)(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(A)(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(A)(Z),"onUpdate:modelValue":j=>t.unref(R)(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":!!((D=Z.dbAttrs[0])!=null&&D.autoIncrement),disabled:t.unref(C)(Z)||t.unref(A)(Z)||!Z.identifier,"onUpdate:modelValue":j=>t.unref(R)(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(A)(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-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(C)(Z)||t.unref(A)(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(A)(Z),"onUpdate:modelValue":j=>t.unref(R)(Z,{multiValue:j||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",j2,[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",K2,[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(A)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",G2,[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(M)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":j=>j&&t.unref(V)(Z,j)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(be).length&&!t.unref(A)(Z)?(t.openBlock(),t.createElementBlock("label",Y2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Uf,{"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(A)(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",q2,[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(L)(Z,j)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",cV,[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=>H(Z,null)},"∅",10,dV),(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(Go)(j)}),title:t.unref(o).t(t.unref(mo)(j)),onClick:fe=>H(Z,j)},null,14,uV))),128)),ke(Z)?(t.openBlock(),t.createElementBlock("span",mV,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,x2)}),128))],8,_2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-af496d06"]]),pV=["disabled"],hV={class:"em-panel__sub-label"},yV={class:"em-attr__row"},gV={class:"em-field em-idx-params"},bV=["value","placeholder","onChange"],_V=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(N=>N.modelId===o.entityId)??null),l=t.computed(()=>r.value?ti(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var N;return Hn(((N=r.value)==null?void 0:N.attributes)??[])}),c=N=>s.value.canon(N),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(()=>[...Gf(d.value).map(N=>({value:N.ref,label:N.label})),...l.value.map(N=>({value:N.modelId,label:a.t("em.index.inherited",{field:N.field})}))]);function m(N,C){var x;const A=new Set(N.columns.filter((S,T)=>T!==C).map(S=>c(S.columnRef))),B=u.value.filter(S=>!A.has(c(S.value))),$=(x=N.columns[C])==null?void 0:x.columnRef;return $&&!B.some(S=>S.value===$)&&B.push({value:$,label:p($)}),B}function p(N){return _s(N,d.value)}function f(N){const C=new Set(N.columns.map(A=>c(A.columnRef)));return u.value.filter(A=>!C.has(c(A.value)))}function y(){var C;if(!r.value)return;const N=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:N?[{columnRef:N.value,descending:!1}]:[]})}function b(N,C){r.value&&a.updateIndex(r.value.modelId,N,C)}function g(N){const C=f(N)[0];C&&b(N.modelId,{columns:[...N.columns,{columnRef:C.value,descending:!1}]})}function _(N,C,A){b(N.modelId,{columns:N.columns.map((B,$)=>$===C?{...B,columnRef:A}:B)})}function k(N,C,A){b(N.modelId,{columns:N.columns.map((B,$)=>$===C?{...B,descending:A}:B)})}function h(N,C){b(N.modelId,{columns:N.columns.filter((A,B)=>B!==C)})}function E(N,C){b(N.modelId,{parameters:C.trim()===""?void 0:C})}return(N,C)=>{var A;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]=B=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",hV,[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:((A=r.value.indexes)==null?void 0:A.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??[],B=>(t.openBlock(),t.createElementBlock("div",{key:B.modelId,class:"em-attr"},[t.createElementVNode("div",yV,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`idx-name-${B.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":$=>b(B.modelId,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-uq-${B.modelId}`,class:"em-check",label:"UQ","model-value":B.unique,"onUpdate:modelValue":$=>b(B.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,B.modelId)},null,8,["onClick"])]),t.createVNode(fo,{controller:t.unref(a),"ref-id":B.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.columns,($,x)=>(t.openBlock(),t.createElementBlock("div",{key:x,class:"em-attr__row"},[t.createVNode(t.unref(te.BSSelect),{class:"grow","model-value":$.columnRef,items:m(B,x),"value-provider":S=>S.value,"label-provider":S=>S.label,"onUpdate:modelValue":S=>S&&_(B,x,S)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-${B.modelId}-desc-${x}`,class:"em-check",label:"DESC","model-value":$.descending,"onUpdate:modelValue":S=>k(B,x,S)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:"−",onClick:S=>h(B,x)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(B).length,onClick:$=>g(B)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",gV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:B.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:$=>E(B,$.target.value)},null,40,bV)])]))),128)):t.createCommentVNode("",!0)],8,pV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-ee0032b1"]]),kV=["disabled"],EV={class:"em-panel__sub-label"},NV={class:"em-attr__row"},wV={class:"em-attr__row"},IV={class:"em-multilang"},vV={class:"em-attr__pii"},CV={class:"em-swatch__row em-attr__swatch"},SV=["title","onClick"],xV=["title","onClick"],RV=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,E){l.value&&a.updateOperation(l.value.modelId,h.modelId,E)}function f(h,E){p(h,{description:Object.keys(E).length?E:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function b(h,E){p(h,{personalInfoAttributeType:E==="none"?void 0:E})}function g(h){var E,N;return St((N=(E=s.value)==null?void 0:E.operationStyles)==null?void 0:N[h.modelId])}function _(h,E){l.value&&a.setOperationSwatch(l.value.modelId,h.modelId,E)}function k(h){r.openModal({component:Yf,bind:{operationName:h.name,sourceCode:h.sourceCode??"",locale:a.uiLocale.value,onSave:E=>p(h,{sourceCode:E})}})}return(h,E)=>{var N;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:E[1]||(E[1]=C=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",EV,[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:((N=l.value.operations)==null?void 0:N.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:E[0]||(E[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",NV,[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":A=>p(C,{name:A})},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":A=>A&&p(C,{visibility:A})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:A=>t.unref(a).removeOperation(l.value.modelId,C.modelId)},null,8,["onClick"])]),t.createElementVNode("div",wV,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t(C.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:A=>k(C)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",IV,[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":A=>f(C,A)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",vV,[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":A=>A&&b(C,A)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",CV,[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:A=>_(C,null)},"∅",10,SV),(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":g(C)===A}]),style:t.normalizeStyle({background:t.unref(Go)(A)}),title:t.unref(a).t(t.unref(mo)(A)),onClick:B=>_(C,A)},null,14,xV))),128))])]))),128)):t.createCommentVNode("",!0)],8,kV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),AV=["title"],$V={class:"em-panel__head"},TV={class:"em-panel__head-row"},MV=["title"],VV={class:"em-panel__context"},BV={key:0,class:"em-panel__lock"},DV=["disabled"],OV={key:0,class:"em-panel__note"},LV={key:1,class:"em-panel__note"},PV={key:2,class:"em-jpa"},zV={class:"em-field"},FV={class:"em-field"},UV={class:"em-field"},HV={key:0,class:"em-field"},jV={class:"em-panel__note"},KV={class:"em-panel__sub"},GV={class:"em-field"},YV={class:"em-field"},qV={class:"em-jpa"},WV={key:0,class:"em-panel__note"},JV={key:1,class:"em-panel__note"},XV={class:"em-jpa"},ZV={class:"em-field"},QV={key:0,class:"em-panel__note"},eB={class:"em-field"},tB={class:"em-multilang"},nB={class:"em-field"},oB=["value"],iB={class:"em-field"},aB={class:"em-swatch"},rB={class:"em-swatch__row"},lB=["title"],sB=["title","onClick"],cB={class:"em-panel__note"},dB={class:"em-field"},uB=["value"],mB={class:"em-swatch"},fB={class:"em-swatch__row"},pB=["title"],hB=["title","onClick"],Oh=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 b(Y){return y.value[Y]??f.value}function g(Y){y.value={...y.value,[Y]:!b(Y)}}const _=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}),k=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}),E=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}),N=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(k.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(k.value.end1.entityRef),b:Y(k.value.end2.entityRef)})}return h.value?l.t("em.inspector.ctxGroup",{name:N.value}):E.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),A=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],B=["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"},x=Y=>{const X=$[Y];return X?l.t(X):Y},S=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"],R=["LIST","SET"],w=["inherit","LAZY","EAGER"],v=Y=>Y;function I(Y){return Y==="inherit"?l.t("em.common.inherit"):Y}const L=t.computed(()=>!!k.value&&k.value.end1.entityRef===k.value.end2.entityRef);function M(Y,X){k.value&&l.updateAssociationEnd(k.value.modelId,Y,X)}function V(Y){return ne.value?Y:Y==="end1"?"end2":"end1"}function U(Y){var Be;const X=(Be=k.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=k.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=U(Y);if(X!==void 0)return X;const q=(ze=k.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=k.value)==null?void 0:ie[Ie].entityRef)});return Be?ta(Be.name,Qi(k.value[Ie].multiplicity)):""}function be(Y){return!!ne.value||U(Y)!==void 0}function pe(Y){k.value&&!L.value&&l.setAssociationIdentifying(k.value.modelId,Y)}function he(Y){var X,q,Ie;return!!((Ie=(q=(X=k.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=k.value)==null?void 0:ze[Y];if(X==="ALL"&&q){M(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),M(Y,{jpa:{...Ie==null?void 0:Ie.jpa,cascadeTypes:[...Be]}})}function ye(Y,X){var Ie;const q=(Ie=k.value)==null?void 0:Ie[Y];M(Y,{jpa:{...q==null?void 0:q.jpa,...X}})}function Ae(Y){var X,q;return((q=(X=k.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=k.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=k.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){k.value&&l.setEmbedCardinality(k.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 O(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){E.value&&l.setNoteMemo(E.value.modelId,Y)}const xe=t.computed(()=>{var Y;return St((Y=E.value)==null?void 0:Y.style)});function Ce(Y){E.value&&l.setNoteSwatch(E.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,AV),t.createElementVNode("header",$V,[t.createElementVNode("div",TV,[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,MV)]),t.createElementVNode("p",VV,t.toDisplayString(C.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",BV,[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(Bf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("basics"),title:_.value,onToggle:X[3]||(X[3]=q=>g("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(fV,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(_V,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("index"),onToggle:X[4]||(X[4]=q=>g("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(RV,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:b("ops"),onToggle:X[5]||(X[5]=q=>g("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!k.value.identifying,disabled:L.value||!!ne.value,"onUpdate:modelValue":pe},null,8,["label","model-value","disabled"]),L.value?(t.openBlock(),t.createElementBlock("p",OV,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):ne.value?(t.openBlock(),t.createElementBlock("p",LV,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),ne.value?(t.openBlock(),t.createElementBlock("fieldset",PV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",zV,[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:B,"value-provider":v,"label-provider":x,"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",FV,[X[15]||(X[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(te.BSSelect),{"model-value":ne.value.collectionType,items:R,"value-provider":v,"label-provider":v,"onUpdate:modelValue":X[7]||(X[7]=q=>q&&me(q))},null,8,["model-value"])]),t.createElementVNode("label",UV,[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",HV,[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":O},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",jV,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",KV,t.toDisplayString(q)+" → "+t.toDisplayString(S(k.value[q].entityRef)),1),ne.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",GV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":k.value[q].multiplicity,items:A,"value-provider":v,"label-provider":t.unref(ea),"onUpdate:modelValue":Ue=>M(q,{multiplicity:Ue})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${V(q)}-navigable`,class:"em-check",label:"navigable",title:V(q)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:V(q)==="end2","model-value":V(q)==="end2"?!0:k.value[V(q)].navigable,"onUpdate:modelValue":Ue=>M(V(q),{navigable:Ue})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",YV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(te.BSTextInput),{name:`${V(q)}-navname`,width:"100%",disabled:!be(V(q)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":ue(V(q)),"onUpdate:modelValue":Ue=>oe(V(q),Ue)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${V(q)}-composition`,class:"em-check",label:"composition","model-value":k.value[V(q)].composition,"onUpdate:modelValue":Ue=>M(V(q),{composition:Ue})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",qV,[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:`${V(q)}-cascade-${Ue}`,class:"em-check",label:Ue,"model-value":!!((Se=(ie=k.value[V(q)].jpa)==null?void 0:ie.cascadeTypes)!=null&&Se.includes(Ue)),disabled:!be(V(q))||Ue!=="ALL"&&he(V(q)),"onUpdate:modelValue":je=>_e(V(q),Ue,je)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),be(V(q))?he(V(q))?(t.openBlock(),t.createElementBlock("p",JV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",WV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",XV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",ZV,[X[19]||(X[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(te.BSSelect),{disabled:!be(V(q)),"model-value":Ae(V(q)),items:w,"value-provider":v,"label-provider":I,"onUpdate:modelValue":Ue=>Ue&&Fe(V(q),Ue)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${V(q)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Ie=k.value[V(q)].jpa)!=null&&Ie.orphanRemoval),disabled:!be(V(q))||se(q),"onUpdate:modelValue":Ue=>ye(V(q),{orphanRemoval:Ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),se(q)&&((Be=k.value[V(q)].jpa)!=null&&Be.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",QV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",eB,[X[20]||(X[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(te.BSTextInput),{name:`${V(q)}-orderby`,width:"100%",disabled:!be(V(q)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((ze=k.value[V(q)].jpa)==null?void 0:ze.orderBy)??"","onUpdate:modelValue":Ue=>ye(V(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",tB,[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",nB,[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,oB)]),t.createElementVNode("label",iB,[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",aB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",rB,[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,lB),(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(Go)(q)}),title:t.unref(l).t(t.unref(mo)(q)),onClick:Ie=>we(q)},null,14,sB))),128))])]),t.createElementVNode("p",cB,t.toDisplayString(t.unref(l).t("em.group.members",{n:h.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",dB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:E.value.memo,rows:"6",onChange:X[12]||(X[12]=q=>de(q.target.value))},null,40,uB)]),t.createElementVNode("fieldset",mB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",fB,[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,pB),(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(Go)(q)}),title:t.unref(l).t(t.unref(mo)(q)),onClick:Ie=>Ce(q)},null,14,hB))),128))])])],64)):t.createCommentVNode("",!0)],8,DV)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),yB=["title"],gB={class:"em-validation__title"},bB=["title","onClick"],_B={key:0,class:"em-validation__body"},kB={class:"em-validation__opt"},EB={key:0,class:"em-validation__empty"},NB={key:1,class:"em-validation__empty"},wB={key:2,class:"em-validation__list"},IB=["onClick"],vB={class:"em-validation__item-msg"},CB={key:0,class:"em-validation__item-entity"},SB=["title","onClick"],xB=["title"],RB=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 b=new Map;for(const g of o.state.logical.entities)b.set(g.modelId,g.name);return b});function r(b){const g=Uw(b);if(!g)return null;const _=a.value.get(g);return _===void 0?null:_.trim()===""?o.t("em.validation.nameless"):_}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const b={error:0,warning:0,info:0};for(const g of i.value)b[g.severity]++;return b}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(b=>c.value[b.severity]).slice().sort((b,g)=>l[b.severity].order-l[g.severity].order)),u=t.computed(()=>d.value.map(b=>({issue:b,entityName:r(b),message:Vf(o.t,b),category:zw(o.t,b.ruleId)}))),m=t.ref(!1);function p(b){c.value[b]=!c.value[b]}function f(b){if(!m.value){m.value=!0;return}p(b)}function y(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,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]=_=>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",gB,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,yB),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"],_=>t.createElementVNode("button",{key:_,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:m.value?t.unref(o).t(c.value[_]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[_].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:k=>f(_)},[t.createVNode(Ve,{name:l[_].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[_]),1)],10,bB)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",_B,[t.createElementVNode("label",kB,[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]=_=>t.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",EB,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",NB,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",wB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:_,entityName:k,message:h,category:E},N)=>(t.openBlock(),t.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${N}`,class:t.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:C=>y(_)},[t.createVNode(Ve,{name:l[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",vB,[k?(t.openBlock(),t.createElementBlock("span",CB,t.toDisplayString(k),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(h),1)]),t.unref(o).hasQuickFix(_)?(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(_),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,SB)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},t.toDisplayString(E),9,xB)],10,IB))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),AB={class:"em-history"},$B={class:"em-history__head"},TB={class:"em-history__title"},MB={class:"em-history__head-actions"},VB=["title","disabled"],BB=["title"],DB={class:"em-history__filters"},OB={class:"em-history__filter"},LB={class:"em-history__filters em-history__filters--period"},PB={class:"em-history__filter-label"},zB=["title","aria-label","max"],FB=["title","aria-label","min"],UB=["title"],HB={key:0,class:"em-history__diffbar"},jB={class:"em-history__diffbar-range"},KB={class:"em-history__diffbar-count"},GB={class:"em-history__body"},YB={key:0,class:"em-history__empty"},qB={key:1,class:"em-history__diff-list"},WB=["onClick"],JB={class:"em-history__action-head"},XB={class:"em-history__action-name"},ZB={key:0,class:"em-history__fields"},QB={class:"em-history__fname"},eD={key:0,class:"em-history__old"},tD={class:"em-history__val"},nD={key:1,class:"em-history__empty"},oD={key:2,class:"em-history__empty is-error"},iD={key:3,class:"em-history__empty"},aD={key:4,class:"em-history__list"},rD=["onClick"],lD={class:"em-history__summary"},sD={class:"em-history__seq"},cD={class:"em-history__gmeta"},dD={class:"em-history__who"},uD={key:0,class:"em-history__time"},mD={key:1,class:"em-history__restored-from"},fD=["onClick"],pD={key:0,class:"em-history__detail"},hD={class:"em-history__action-head"},yD={class:"em-history__action-name"},gD={key:0,class:"em-history__fields"},bD={class:"em-history__fname"},_D={key:0,class:"em-history__old"},kD={class:"em-history__val"},ED={class:"em-history__preview"},ND=["disabled"],wD={key:0,class:"em-history__diff-list is-preview"},ID={class:"em-history__action-head"},vD={class:"em-history__action-name"},CD={key:0,class:"em-history__fields"},SD={class:"em-history__fname"},xD={key:0,class:"em-history__old"},RD={class:"em-history__val"},AD={class:"em-history__confirm-row"},$D={class:"em-history__confirm-msg"},TD=["disabled","onClick"],MD=["disabled"],VD=["onClick"],Tr=50,BD=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 b=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]))),_=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 k(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=b.value.get((re=Se.end1)==null?void 0:re.entityRef))==null?void 0:Ke.name)==null?void 0:st.trim(),Ze=(We=(nt=b.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=b.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?b.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"?k(ie.ref):ie.kind==="associationEnd"?`${k(ie.ref)}(${ie.end})`:ie.kind==="group"?a.t("em.history.groupSubject",{name:_.value.get(ie.ref)??ie.ref}):ie.ref}const E={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},C=t.ref("all"),A=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],B=t.computed({get:()=>C.value,set:ie=>{ie&&(C.value=ie)}}),$=t.computed(()=>gl(r.value)),x=t.computed(()=>$.value.length?$.value[0].seq:null),S=t.computed(()=>C.value==="all"?$.value:$.value.filter(ie=>(ie.kind??"edit")===C.value)),T=t.ref(Tr),R=t.ref(""),w=t.ref(""),v=t.computed(()=>!!R.value||!!w.value);function I(){R.value="",w.value=""}const L=t.computed(()=>{const ie=R.value?new Date(`${R.value}T00:00:00`).getTime():null,Se=w.value?new Date(`${w.value}T23:59:59.999`).getTime():null;return ie==null&&Se==null?S.value:S.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)})}),M=t.computed(()=>L.value.slice(0,T.value)),V=t.computed(()=>Math.max(0,L.value.length-T.value));function U(){T.value+=Tr}t.watch([C,R,w],()=>{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?ud(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(()=>x.value??1/0),me=t.computed(()=>f.value??ae.value),P=t.computed(()=>f.value??ae.value),O=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"?b.value.has(ie.ref)?ie.ref:null:(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index")&&ie.entityRef?b.value.has(ie.entityRef)?ie.entityRef:null:ie.kind==="group"&&_.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",AB,[t.createElementVNode("header",$B,[t.createElementVNode("div",TB,[t.createVNode(Ve,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",MB,[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,VB),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,BB)])]),t.createElementVNode("div",DB,[t.createElementVNode("label",OB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(te.BSSelect),{modelValue:B.value,"onUpdate:modelValue":Se[2]||(Se[2]=J=>B.value=J),items:A,"value-provider":J=>J.v,"label-provider":J=>t.unref(a).t(J.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",LB,[t.createElementVNode("span",PB,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:w.value||void 0,"onUpdate:modelValue":Se[3]||(Se[3]=J=>R.value=J)},null,8,zB),[[t.vModelText,R.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:R.value||void 0,"onUpdate:modelValue":Se[4]||(Se[4]=J=>w.value=J)},null,8,FB),[[t.vModelText,w.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,UB)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",HB,[t.createElementVNode("div",jB,[t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:O.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",KB,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",GB,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ze=Ae.value)!=null&&Ze.entries.length?(t.openBlock(),t.createElementBlock("ul",qB,[(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",JB,[t.createVNode(Ve,{name:E[J.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",XB,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",ZB,[(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",QB,t.toDisplayString(Ke.field),1),Ke.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",eD,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",tD,t.toDisplayString(oe(Ke.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,WB))),128))])):(t.openBlock(),t.createElementBlock("p",YB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",nD,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",oD,t.toDisplayString(s.value),1)):L.value.length===0?(t.openBlock(),t.createElementBlock("p",iD,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",aD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.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",lD,t.toDisplayString(be(J)),1),t.createElementVNode("span",sD,"#"+t.toDisplayString(J.seq),1)],8,rD),t.createElementVNode("div",cD,[t.createElementVNode("span",dD,t.toDisplayString(ye(J)),1),J.ts?(t.openBlock(),t.createElementBlock("span",uD,t.toDisplayString(_e(J.ts)),1)):t.createCommentVNode("",!0),J.kind==="restore"&&J.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",mD,"← #"+t.toDisplayString(J.restoredFromSeq),1)):t.createCommentVNode("",!0),J.seq!==x.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,fD)):t.createCommentVNode("",!0)]),pe.value.has(J.seq)?(t.openBlock(),t.createElementBlock("div",pD,[(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",hD,[t.createVNode(Ve,{name:E[qe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",yD,t.toDisplayString(h(qe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${qe.verb}`])},t.toDisplayString(t.unref(a).t(N[qe.verb])),3)]),qe.fields.length?(t.openBlock(),t.createElementBlock("ul",gD,[(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",bD,t.toDisplayString(We.field),1),We.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",_D,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",kD,t.toDisplayString(oe(We.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&J.seq!==x.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",ED,[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,ND),Be.value&&((st=Ie.value)!=null&&st.entries.length)?(t.openBlock(),t.createElementBlock("ul",wD,[(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",ID,[t.createVNode(Ve,{name:E[qe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",vD,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",CD,[(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",SD,t.toDisplayString(We.field),1),We.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",xD,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",RD,t.toDisplayString(oe(We.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",AD,[t.createElementVNode("span",$D,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,TD),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,MD)])],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,VD))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&V.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:U},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:V.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function DD(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 Lh(e){const n=t.ref(DD(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 OD={class:"em-modeler"},LD={class:"em-modeler__body"},PD={class:"em-drawer__inner"},zD={class:"em-drawer__head"},FD={class:"em-drawer__actions"},UD=["title"],HD=["title"],jD=["title"],KD=["title"],GD=["title"],YD=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(E){t.nextTick(()=>{const N=E();N&&("focusCollapse"in N?N.focusCollapse():N.focus())})}function c(E){n.value=E,s(()=>E?i.value:a.value)}function d(E){o.value=E,s(()=>E?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:y}=Lh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:b,dragging:g,startResize:_}=Lh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),k=t.ref(null),h=t.ref(null);return(E,N)=>{var C,A,B;return t.openBlock(),t.createElementBlock("div",OD,[t.createVNode(Dh,{controller:e.controller,"history-open":u.value,onExportSvg:N[0]||(N[0]=$=>{var x;return(x=k.value)==null?void 0:x.exportSvg()}),onExportPng:N[1]||(N[1]=$=>{var x;return(x=k.value)==null?void 0:x.exportPng()}),onToggleHistory:N[2]||(N[2]=$=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",LD,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",PD,[t.createElementVNode("header",zD,[N[11]||(N[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",FD,[(C=h.value)!=null&&C.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((A=h.value)!=null&&A.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:N[3]||(N[3]=$=>{var x;return(x=h.value)==null?void 0:x.toggleAll()})},[t.createVNode(Ve,{name:(B=h.value)!=null&&B.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,UD)):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:N[4]||(N[4]=$=>c(!1))},[t.createVNode(Ve,{name:"panel-close",size:16})],8,HD)])]),t.createVNode(Bh,{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:N[5]||(N[5]=(...$)=>t.unref(y)&&t.unref(y)(...$))},null,42,jD),[[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:N[6]||(N[6]=$=>c(!0))},[t.createVNode(Ve,{name:"panel-open",size:18})],8,KD),[[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(Vh,{ref_key:"canvas",ref:k,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(Oh,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(b),resizing:t.unref(g),"start-resize":t.unref(_),onCollapse:N[7]||(N[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:N[8]||(N[8]=$=>d(!0))},[t.createVNode(Ve,{name:"panel-right-open",size:18})],8,GD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(BD,{controller:e.controller,open:u.value,onClose:N[9]||(N[9]=$=>u.value=!1),onDiffChange:N[10]||(N[10]=$=>m.value=$)},null,8,["controller","open"])]),t.createVNode(RB,{controller:e.controller,"panel-width":t.unref(b),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=Wb,Ne.AssociationEdge=Mp,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=Vh,Ne.DiagramExplorer=Bh,Ne.EDITOR=po,Ne.EditModeToggle=b2,Ne.EditorToolbar=Dh,Ne.EntityModeler=YD,Ne.EntityNode=dp,Ne.GROUP_CODE_ENUM_VALUE=Yn,Ne.GroupNode=up,Ne.INHERITED_REF_PREFIX=qi,Ne.InvalidDiagramJsonError=Wn,Ne.JAVA_TYPES=ai,Ne.NoteNode=mp,Ne.OpSyncAdapter=nu,Ne.PHYSICAL_NAME_MAX_LENGTH=li,Ne.PropertyPanel=Oh,Ne.RevCache=tu,Ne.SELECTABLE_JAVA_TYPES=_c,Ne.SYMBOLIC_OP_KINDS=ou,Ne.SYMBOLIC_OP_SCHEMA=Nu,Ne.UI_LOCALES=yI,Ne.applyDocumentReferenceOnly=zr,Ne.buildAgentBatch=Jb,Ne.buildDiagramSvg=Ks,Ne.buildDiffMarks=ud,Ne.collectSharedColumns=$n,Ne.commands=nb,Ne.computeAutoLayout=Ws,Ne.createEditorController=aS,Ne.dedupeModelIds=Ag,Ne.defaultMermaidDialect=Qh,Ne.defaultSqlDialect=$y,Ne.diagramToJson=Rc,Ne.displayLabel=Ji,Ne.emptyState=Xf,Ne.entityModelToDdl=Sc,Ne.entityModelToMermaid=Fr,Ne.entityModelToText=sc,Ne.exportDiagramPng=Th,Ne.exportDiagramSvg=$h,Ne.fromPersisted=Tu,Ne.isGeneratable=Hc,Ne.isInheritedColumnRef=jn,Ne.javaTypeLabel=Io,Ne.makeInheritedColumnRef=Zs,Ne.mergeDiagram=ad,Ne.mermaidErToImportSource=Nc,Ne.migrateLegacyMoney=Rg,Ne.multiplicityLabel=ea,Ne.newId=Pe,Ne.packEntityBoxes=Vr,Ne.parseDiagramJson=Ac,Ne.parseInheritedColumnRef=Br,Ne.parseMermaidEr=Ec,Ne.parseSqlDdl=qr,Ne.planHealBackfillOps=A_,Ne.projectActionLog=gl,Ne.projectEntityAudit=cd,Ne.projectFieldAudit=Tn,Ne.projectInheritedColumns=ti,Ne.projectSeqDiff=bl,Ne.renderDiagramSvg=Tc,Ne.resolveColumnPhysicalName=oi,Ne.resolveDiagram=qs,Ne.resolveEffectiveColumn=pn,Ne.resolveQuickFix=ol,Ne.resolveSharedColumn=Gn,Ne.resolveSymbolicOps=Ab,Ne.restoreDeepEqual=Jn,Ne.scaffoldEntityJava=ig,Ne.sharedColumnScopeEntities=Lr,Ne.sqlDdlToImportSource=Cc,Ne.stereotypeLabel=ni,Ne.synthesizeRestoreOps=Ug,Ne.toPersisted=S_,Ne.toPersistedV2=x_,Ne.translate=qt,Ne.uiMessagesEn=Lf,Ne.uiMessagesJa=Pf,Ne.uiMessagesKo=zf,Ne.validateModel=sa,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));