@g1cloud/entity-modeler-next 5.1.4 → 5.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/scaffoldJava.d.ts +35 -1
- package/dist/core/types.d.ts +14 -0
- package/dist/entity-modeler-next.css +1 -1
- package/dist/entity-modeler.js +10319 -10227
- package/dist/entity-modeler.umd.cjs +19 -19
- package/dist/i18n/ko.d.ts +1 -0
- package/dist/view/useAttributeEditing.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
(function(be,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,ee){"use strict";var yD=Object.defineProperty;var gD=(be,t,ee)=>t in be?yD(be,t,{enumerable:!0,configurable:!0,writable:!0,value:ee}):be[t]=ee;var Xe=(be,t,ee)=>gD(be,typeof t!="symbol"?t+"":t,ee);const $h={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Th(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 $s(e,n,o={}){const i={...$h,...o},a=new Map(e.entities.map(_=>[_.modelId,_])),r=new Map(n.entityLayouts.map(_=>[_.entityRef,_])),l=new Map(n.associationLayouts.map(_=>[_.associationRef,_])),s=new Map;for(const _ of e.groups)for(const E of _.memberEntityRefs)s.set(E,_.modelId);const c=new Map;for(const _ of n.groupLayouts)for(const E of _.memberNoteRefs??[])c.set(E,_.groupRef);let d=0;const u=e.entities.map(_=>{const E=s.get(_.modelId),N=r.get(_.modelId);if(N){const k={location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}};return{entity:_,geo:k,collapsed:N.collapsed??!1,locked:N.locked??!1,groupRef:E,style:N.style,attributeStyles:N.attributeStyles,operationStyles:N.operationStyles}}const p=Th(d++,i);return{entity:_,geo:p,collapsed:!1,locked:!1,groupRef:E}}),m=new Map(n.groupLayouts.map(_=>[_.groupRef,_])),h=e.groups.map(_=>{const E=m.get(_.modelId),N=E?{location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:_,geo:N,style:E==null?void 0:E.style,locked:(E==null?void 0:E.locked)??!1}}),f=e.associations.map(_=>{const E=l.get(_.modelId);return{association:_,waypoints:(E==null?void 0:E.waypoints)??[],sourceColumnRef:E==null?void 0:E.sourceColumnRef,targetColumnRef:E==null?void 0:E.targetColumnRef}}),y=n.notes.map(_=>({note:{..._,geo:{location:{x:_.geo.location.x,y:_.geo.location.y},size:{width:_.geo.size.width,height:_.geo.size.height}}},groupRef:c.get(_.modelId)})),g=[];for(const _ of n.notes)for(const E of _.connections??[])a.has(E.targetRef)&&g.push({noteRef:_.modelId,targetRef:E.targetRef,waypoints:E.waypoints.map(N=>({x:N.x,y:N.y}))});return{entities:u,associations:f,groups:h,notes:y,noteConnections:g}}const Mh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ts(e,n,o={}){const i={...Mh,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),h=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,_)=>{const E=_%y,N=Math.floor(_/y);r.push({id:g,location:{x:h.x+i.pad+E*i.cellWidth,y:h.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const h=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+f*i.cellHeight}})}),r}const Ms={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Vh(e,n={}){const o={...Ms,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Er(e,n={}){const o={...Ms,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Vh(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 Vn(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 Vs(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 Oi="inherited:";function Bs(e,n){return`${Oi}${e}:${n}`}function Bn(e){return e.startsWith(Oi)}function Nr(e){if(!Bn(e))return null;const n=e.slice(Oi.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 Ko(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:Bs(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 Bh={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function Go(e){return Bh[e]??e}function Li(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Pi(e,n,o,i,a=0){var u;if(!Li(e))return;const r=i.find(m=>m.end1.attributeRef===e.modelId||m.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(m=>m.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(u=e.derivedFrom)==null?void 0:u.sourceAttributeRef;if(c){const m=s==null?void 0:s.attributes.find(h=>h.modelId===c);if(m)return m.dbAttrs[a];for(const h of o){const f=h.attributes.find(y=>y.modelId===c);if(f)return f.dbAttrs[a]}}return s?s.attributes.filter(m=>m.identifier&&(m.attrType==="NORMAL"||m.attrType==="RELATION_OWN")).sort((m,h)=>m.order-h.order).flatMap(m=>m.dbAttrs)[a]:void 0}function Dh(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=Ds(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function nn(e,n){return Ds(e,n,new Set)}function Ds(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=Dh(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 Os=e=>e==null||e.trim()==="";function Ls(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=nn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return Pi(e,o,i.entities,i.associations,n)}function on(e,n,o,i,a,r){const l=Ls(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:Oh(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 Oh(e){return e!=null&&Object.values(e).some(n=>!Os(n))}function Yo(e,n,o,i,a,r){var l;return Os(n.physicalName)?((l=Ls(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Ps(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let h=0;h<m.dbAttrs.length;h++){if(u===n)return m.name||void 0;u++}}}function wr(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 Nn(e,n){return wr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function co(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Dn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function zi(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 zs="(미지정)",Lh="(이름 없음)",Fi=e=>e==null||String(e).trim()==="",Ui=e=>Fi(e)?Lh:String(e),Fs=e=>Fi(e)?zs:String(e);function Us(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 zs}function Hs(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Fi(n)?Fs(e.physicalName):String(n),a=Fi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function js(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function Ks(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(`## ${Ui(c.name)}${d} «${Go(c.stereotype)}»${u?` [${u}]`:""}`);const m=co(Nn(c,e.entities)),h=_=>{var E;return _.sharedColumnRef?(E=Dn(_,m))==null?void 0:E.physicalName:void 0},f=[...c.attributes].sort((_,E)=>_.order-E.order);for(const _ of f){if(_.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${_.name?` ${_.name} ${"─".repeat(8)}`:""}`);continue}const E=_.dbAttrs.map(($,L)=>on(_,$,L,c,e,n)),N=[_.identifier?"PK":"",_.notNull?"NOT NULL":""].filter(Boolean),p=` - ${Ui(_.name)}: ${Fs(_.type)}`,k=$=>$.length?` {${$.join(", ")}}`:"";if(E.length>1){a.push(`${p}${k(N)}`),E.forEach(($,L)=>{const V=Ps(_,L,e,n);a.push(` · ${V?`${V} → `:""}${Hs($,h($))}${k(js($))}`)});continue}const I=E[0],A=I?` → ${Hs(I,h(I))}`:"";a.push(`${p}${A}${k([...N,...I?js(I):[]])}`)}const y=Vn(c.attributes);for(const _ of c.indexes??[]){const E=_.columns.map(N=>{var p,k;return`${((p=y.attributeOf(N.columnRef))==null?void 0:p.name)??((k=Nr(N.columnRef))==null?void 0:k.field)??N.columnRef}${N.descending?" DESC":""}`}).join(", ");a.push(` index ${Ui(_.name)}${_.unique?" UNIQUE":""}: ${E}`)}const g=[...c.operations??[]].sort((_,E)=>_.order-E.order);for(const _ of g){const E=_.visibility?` {${_.visibility}}`:"",N=(s=_.description)!=null&&s.ko?` — ${_.description.ko}`:"";a.push(` method ${Ui(_.name)}()${E}${N}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Us(c.end1.multiplicity)} —— ${Us(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
-
`).trim()}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:
|
|
6
|
-
`)}function
|
|
7
|
-
`)+(
|
|
8
|
-
${
|
|
1
|
+
(function(be,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,ee){"use strict";var _D=Object.defineProperty;var kD=(be,t,ee)=>t in be?_D(be,t,{enumerable:!0,configurable:!0,writable:!0,value:ee}):be[t]=ee;var nt=(be,t,ee)=>kD(be,typeof t!="symbol"?t+"":t,ee);const Bh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Dh(e,n){const o=e%n.perRow,i=Math.floor(e/n.perRow);return{location:{x:n.startX+o*n.columnGap,y:n.startY+i*n.rowGap},size:{...n.defaultSize}}}function Vs(e,n,o={}){const i={...Bh,...o},a=new Map(e.entities.map(_=>[_.modelId,_])),r=new Map(n.entityLayouts.map(_=>[_.entityRef,_])),l=new Map(n.associationLayouts.map(_=>[_.associationRef,_])),s=new Map;for(const _ of e.groups)for(const E of _.memberEntityRefs)s.set(E,_.modelId);const c=new Map;for(const _ of n.groupLayouts)for(const E of _.memberNoteRefs??[])c.set(E,_.groupRef);let d=0;const u=e.entities.map(_=>{const E=s.get(_.modelId),N=r.get(_.modelId);if(N){const b={location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}};return{entity:_,geo:b,collapsed:N.collapsed??!1,locked:N.locked??!1,groupRef:E,style:N.style,attributeStyles:N.attributeStyles,operationStyles:N.operationStyles}}const p=Dh(d++,i);return{entity:_,geo:p,collapsed:!1,locked:!1,groupRef:E}}),m=new Map(n.groupLayouts.map(_=>[_.groupRef,_])),h=e.groups.map(_=>{const E=m.get(_.modelId),N=E?{location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:_,geo:N,style:E==null?void 0:E.style,locked:(E==null?void 0:E.locked)??!1}}),f=e.associations.map(_=>{const E=l.get(_.modelId);return{association:_,waypoints:(E==null?void 0:E.waypoints)??[],sourceColumnRef:E==null?void 0:E.sourceColumnRef,targetColumnRef:E==null?void 0:E.targetColumnRef}}),y=n.notes.map(_=>({note:{..._,geo:{location:{x:_.geo.location.x,y:_.geo.location.y},size:{width:_.geo.size.width,height:_.geo.size.height}}},groupRef:c.get(_.modelId)})),k=[];for(const _ of n.notes)for(const E of _.connections??[])a.has(E.targetRef)&&k.push({noteRef:_.modelId,targetRef:E.targetRef,waypoints:E.waypoints.map(N=>({x:N.x,y:N.y}))});return{entities:u,associations:f,groups:h,notes:y,noteConnections:k}}const Oh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Bs(e,n,o={}){const i={...Oh,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),h=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((k,_)=>{const E=_%y,N=Math.floor(_/y);r.push({id:k,location:{x:h.x+i.pad+E*i.cellWidth,y:h.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const h=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+f*i.cellHeight}})}),r}const Ds={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Lh(e,n={}){const o={...Ds,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Nr(e,n={}){const o={...Ds,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Lh(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function On(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function Os(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const Pi="inherited:";function Ls(e,n){return`${Pi}${e}:${n}`}function Ln(e){return e.startsWith(Pi)}function wr(e){if(!Ln(e))return null;const n=e.slice(Pi.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function Go(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Ls(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}const Ph={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function Yo(e){return Ph[e]??e}function zi(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Fi(e,n,o,i,a=0){var u;if(!zi(e))return;const r=i.find(m=>m.end1.attributeRef===e.modelId||m.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(m=>m.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(u=e.derivedFrom)==null?void 0:u.sourceAttributeRef;if(c){const m=s==null?void 0:s.attributes.find(h=>h.modelId===c);if(m)return m.dbAttrs[a];for(const h of o){const f=h.attributes.find(y=>y.modelId===c);if(f)return f.dbAttrs[a]}}return s?s.attributes.filter(m=>m.identifier&&(m.attrType==="NORMAL"||m.attrType==="RELATION_OWN")).sort((m,h)=>m.order-h.order).flatMap(m=>m.dbAttrs)[a]:void 0}function zh(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=Ps(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function nn(e,n){return Ps(e,n,new Set)}function Ps(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=zh(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const zs=e=>e==null||e.trim()==="";function Fs(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=nn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return Fi(e,o,i.entities,i.associations,n)}function on(e,n,o,i,a,r){const l=Fs(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:Fh(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function Fh(e){return e!=null&&Object.values(e).some(n=>!zs(n))}function qo(e,n,o,i,a,r){var l;return zs(n.physicalName)?((l=Fs(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Us(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let h=0;h<m.dbAttrs.length;h++){if(u===n)return m.name||void 0;u++}}}function Ir(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function vn(e,n){return Ir(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function fo(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Pn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function Ui(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const Hs="(미지정)",Uh="(이름 없음)",Hi=e=>e==null||String(e).trim()==="",ji=e=>Hi(e)?Uh:String(e),js=e=>Hi(e)?Hs:String(e);function Ks(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}return Hs}function Gs(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Hi(n)?js(e.physicalName):String(n),a=Hi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function Ys(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function qs(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${ji(c.name)}${d} «${Yo(c.stereotype)}»${u?` [${u}]`:""}`);const m=fo(vn(c,e.entities)),h=_=>{var E;return _.sharedColumnRef?(E=Pn(_,m))==null?void 0:E.physicalName:void 0},f=[...c.attributes].sort((_,E)=>_.order-E.order);for(const _ of f){if(_.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${_.name?` ${_.name} ${"─".repeat(8)}`:""}`);continue}const E=_.dbAttrs.map(($,L)=>on(_,$,L,c,e,n)),N=[_.identifier?"PK":"",_.notNull?"NOT NULL":""].filter(Boolean),p=` - ${ji(_.name)}: ${js(_.type)}`,b=$=>$.length?` {${$.join(", ")}}`:"";if(E.length>1){a.push(`${p}${b(N)}`),E.forEach(($,L)=>{const T=Us(_,L,e,n);a.push(` · ${T?`${T} → `:""}${Gs($,h($))}${b(Ys($))}`)});continue}const w=E[0],A=w?` → ${Gs(w,h(w))}`:"";a.push(`${p}${A}${b([...N,...w?Ys(w):[]])}`)}const y=On(c.attributes);for(const _ of c.indexes??[]){const E=_.columns.map(N=>{var p,b;return`${((p=y.attributeOf(N.columnRef))==null?void 0:p.name)??((b=wr(N.columnRef))==null?void 0:b.field)??N.columnRef}${N.descending?" DESC":""}`}).join(", ");a.push(` index ${ji(_.name)}${_.unique?" UNIQUE":""}: ${E}`)}const k=[...c.operations??[]].sort((_,E)=>_.order-E.order);for(const _ of k){const E=_.visibility?` {${_.visibility}}`:"",N=(s=_.description)!=null&&s.ko?` — ${_.description.ko}`:"";a.push(` method ${ji(_.name)}()${E}${N}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Ks(c.end1.multiplicity)} —— ${Ks(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
+
`).trim()}function po(e){return e.referenceOnly===!0}function vr(e){const n=new Set;for(const o of e.entities)po(o)&&n.add(o.modelId);return n}function Ws(e){return e.entities.filter(n=>!po(n))}function Js(e,n=vr(e)){return n.size===0?e.associations:e.associations.filter(o=>!n.has(o.end1.entityRef)&&!n.has(o.end2.entityRef))}function Cr(e,n){return n?{...e,entities:e.entities.map(o=>o.referenceOnly?o:{...o,referenceOnly:!0})}:e}function Hh(e,n){return po(e)||n===!0}const jh=e=>e&&e[0].toLowerCase()+e.slice(1);function Ki(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Xs(e){return e!=="EXACTLY_ONE_INSTANCE"&&e!=="ONE_OR_MORE_INSTANCES"}function Gi(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 Kh(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function Yi(e,n){const o=jh(e);return n?Kh(o):o}function ho(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function Gh(e){return e==="CLASS"?"class":"er"}function xr(e,n,o){const i=Yh(e);return n==="class"?ey(i):Xh(i,o)}function Yh(e){const n=vr(e);return n.size===0?e:{...e,entities:Ws(e),associations:Js(e,n)}}function Wo(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function Sr(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Zs(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=Wo(n(a),`Entity_${r+1}`);let s=l,c=2;for(;o.has(s);)s=`${l}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function qh(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const Qs=Gi;function Rr(e){return e!=null&&ec[e]!=null}const ec={NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"};function tc(e,n){const o={NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"},i=Rr(e)?e:"ZERO_OR_MORE_INSTANCES";return(n==="left"?ec:o)[i]}function Wh(e,n,o,i){if(e.dbAttrs.length===0)return[];const a=[];return e.dbAttrs.forEach((r,l)=>{var h;const s=on(e,r,l,n,o,i);if(s.sharedColumnRef!=null)return;const c=l===0?e.name:Us(e,l,o,i),d=Wo(s.dataType||e.type,"unknown"),u=Wo(s.physicalName||c,"col"),m=s.length?`(${s.length}${s.scale!=null?`,${s.scale}`:""})`:"";a.push(Jh(d,u,e,s.unique===!0,m,(h=s.logicalName)==null?void 0:h.ko))}),a}function Jh(e,n,o,i,a,r){const l=[o.identifier?"PK":"",qh(o)?"FK":"",i?"UK":""].filter(Boolean).join(", "),s=Sr([r,a].filter(Boolean).join(" ")),c=[` ${e} ${n}`];return l&&c.push(l),c.join(" ")+(s?` "${s}"`:"")}function Xh(e,n){const o=Zs(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 Wh(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=`${tc(r.end1.multiplicity,"left")}--${tc(r.end2.multiplicity,"right")}`,d=Sr(r.description);i.push(` ${l} ${c} ${s} : "${d}"`),(!Rr(r.end1.multiplicity)||!Rr(r.end2.multiplicity))&&a.push(`${l} -- ${s}`)}if(a.length>0){i.push(`%% ⚠ 다중성 미지정 ${a.length}건 — 0..*(가장 약한 주장)로 표기함. 모델을 정정할 지점:`);for(const r of a)i.push(`%% ${r}`)}return i.join(`
|
|
3
|
+
`)}function Zh(e){return e&&e!=="UNDEFINED"?Yo(e):null}function Qh(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function ey(e){const n=Zs(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=Zh(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(` +${Qh(c.type)} ${Wo(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${Wo(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=ty(i),s=Sr(i.description),c=` ${a} "${Qs(i.end1.multiplicity)}" ${l} "${Qs(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function ty(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function De(){return crypto.randomUUID()}const nc=["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"],ny=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"]),oy=nc.filter(e=>!ny.has(e)),iy={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Ar(e){return iy[e]??e}const ay=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),$r=new Set(["NUMERIC","DECIMAL"]);function oc(e,n=oy){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const an="CustomType",zn="GroupCodeEnum",Tr="String",Jo=[{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:zn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:an,label:"CustomType"}],ry=new Map(Jo.map(e=>[e.value,e.label]));function yo(e){return ry.get(e)??e}const ly={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 ic(e){if(e)return ly[e.toUpperCase()]}const sy={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"]),[zn]:new Set(["VARCHAR","CHAR"])},cy=new Map(Jo.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function dy(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!nc.includes(i))return;const a=cy.get(o)??o,r=sy[a];if(r)return r.has(i)}const uy=new Set([zn,"CustomMoneyType"]),ac=Jo.filter(e=>!uy.has(e.value)).map(e=>e.value===an?{...e,label:"CustomType (사용자정의)"}:e);function rc(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=[...ac,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:yo(e)},...i]:i}function my(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Mr(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 Vr(e,n,o){var i;return n.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&n.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${yo(n.type)}>`:my(n)?yo(n.type):e==="CLASS"?n.type===an&&n.customType||yo(n.type):Ar(((i=n.dbAttrs[0])==null?void 0:i.dataType)??"")}const fy={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},py={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function hy(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(k=>{var _;return k.identifier&&(y==null||((_=k.dbAttrs[0])==null?void 0:_.physicalName)===y)});let h=c.length===1?c[0]:void 0;if(!h){const f=c.filter(y=>m(y.parent,u)!=null);f.length===1&&(h=f[0])}h&&(d.attrType="RELATION_OWN",d.derivedFrom={associationRef:h.assoc.modelId,sourceAttributeRef:((r=m(h.parent,u)??m(h.parent))==null?void 0:r.modelId)??""},h.assoc.end2.attributeRef||(h.assoc.end2.attributeRef=d.modelId))}}}function yy(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 k=i.slice(0,y.index).trim();k&&(m=k)}else i.trim()&&(m=i.trim())}const h={modelId:De(),physicalName:s,dataType:l};return d!=null&&(h.length=d),u!=null&&(h.scale=u),c.has("UK")&&(h.unique=!0),m&&(h.logicalName={ko:m}),{attr:{modelId:De(),name:s,type:ic(l)??"",attrType:"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[h]},foreignKey:c.has("FK")}}function lc(e){const n=e.split(`
|
|
5
|
+
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:De(),name:d,stereotype:"JPA_ENTITY",table:{physicalName:d},attributes:[]};return o.push(m),i.set(d,m),m};let s=null;for(const d of n){const u=d.trim();if(!u||u==="erDiagram"||u.startsWith("%%"))continue;if(s){if(u==="}"){s=null;continue}const f=yy(u,s.attributes.length);f&&(s.attributes.push(f.attr),f.foreignKey&&r.add(f.attr.modelId));continue}const m=u.match(/^(\S+)\s*\{$/);if(m){s=l(m[1]);continue}const h=u.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(h&&/--|\.\./.test(h[2])){const[f,y]=h[2].split(/--|\.\./);let k=(h[4]??"").trim();const _=k.match(/^"([^"]*)"$/);_&&(k=_[1]),a.push({left:h[1],right:h[3],cardL:f??"",cardR:y??"",label:k});continue}/^\S+$/.test(u)&&l(u)}const c=a.map(d=>{const u=l(d.left),m=l(d.right);return{modelId:De(),description:d.label||void 0,end1:{entityRef:u.modelId,multiplicity:fy[d.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:py[d.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return hy(o,c,r),{modelId:De(),entities:o,associations:c,groups:[]}}function sc(e){const n=lc(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Nr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const cc={smallint:{dataType:"SMALLINT"},int2:{dataType:"SMALLINT"},integer:{dataType:"INTEGER"},int:{dataType:"INTEGER"},int4:{dataType:"INTEGER"},bigint:{dataType:"BIGINT"},int8:{dataType:"BIGINT"},smallserial:{dataType:"SMALLINT",autoIncrement:!0},serial:{dataType:"INTEGER",autoIncrement:!0},serial4:{dataType:"INTEGER",autoIncrement:!0},bigserial:{dataType:"BIGINT",autoIncrement:!0},serial8:{dataType:"BIGINT",autoIncrement:!0},real:{dataType:"REAL"},float4:{dataType:"REAL"},"double precision":{dataType:"DOUBLE"},float8:{dataType:"DOUBLE"},numeric:{dataType:"NUMERIC"},decimal:{dataType:"DECIMAL"},boolean:{dataType:"BOOLEAN"},bool:{dataType:"BOOLEAN"},char:{dataType:"CHAR"},character:{dataType:"CHAR"},varchar:{dataType:"VARCHAR"},"character varying":{dataType:"VARCHAR"},text:{dataType:"LONGVARCHAR"},bytea:{dataType:"VARBINARY"},date:{dataType:"DATE"},time:{dataType:"TIME"},"time with time zone":{dataType:"TIME_WITH_TIMEZONE"},timestamp:{dataType:"TIMESTAMP"},"timestamp with time zone":{dataType:"TIMESTAMP_WITH_TIMEZONE"},jsonb:{dataType:"JSONB"},json:{dataType:"JSONB"},xml:{dataType:"SQLXML"}},gy=Object.keys(cc).sort((e,n)=>n.length-e.length),dc=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,go=`${dc}(?:\\.${dc})*`,by=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${go})\s*\(([\s\S]*)\)\s*$`,"i"),_y=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${go})\s*\(([^)]*)\)`,"i"),ky=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${go})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${go})\s*\(([^)]*)\)`,"i"),Ey=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${go})\s+ON\s+(${go})\s*\(([^)]*)\)`,"i");function It(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function Fn(e){const n=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(n.push(i),i=""):i+=a;return i.trim()&&n.push(i),n.map(a=>a.trim()).filter(Boolean)}function Ny(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=It(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const _ of gy)if(a.startsWith(_)){const E=cc[_];r=E.dataType,l=!!E.autoIncrement;let N=i.slice(_.length);const p=N.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);p&&(s=Number(p[1]),p[2]!=null&&(c=Number(p[2])),N=N.slice(p[0].length)),d=N,u=!0;break}if(!u){const _=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);_&&(r=_[1].toUpperCase(),_[2]!=null&&(s=Number(_[2])),_[3]!=null&&(c=Number(_[3])),d=_[4]??"")}const m=d.toUpperCase(),h=/\bPRIMARY\s+KEY\b/.test(m),f=h||/\bNOT\s+NULL\b/.test(m),y=/\bUNIQUE\b/.test(m),k={modelId:De(),physicalName:o,dataType:r};return s!=null&&(k.length=s),c!=null&&(k.scale=c),y&&(k.unique=!0),l&&(k.autoIncrement=!0),{primaryKey:h,attr:{modelId:De(),name:o,type:ic(r)??"",attrType:"NORMAL",identifier:h,notNull:f,order:0,dbAttrs:[k]}}}function wy(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function uc(e){const n=e.match(/\(([^)]*)\)/);return n?Fn(n[1]).map(It):[]}function Br(e){var d;const n=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(u=>u.trim()).filter(Boolean);for(const u of c){const m=u.match(by);if(!m)continue;const h=It(m[1]),f=m[2],y={modelId:De(),name:h,stereotype:"JPA_ENTITY",table:{physicalName:h},attributes:[]},k=new Map,_=[];let E=0;for(const N of Fn(f)){if(wy(N)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(N))_.push(...uc(N));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(N))for(const w of uc(N)){const A=k.get(w.toLowerCase());A!=null&&A.dbAttrs[0]&&(A.dbAttrs[0].unique=!0)}const b=N.match(_y);b&&l.push({childTable:h,childCols:Fn(b[1]).map(It),parentTable:It(b[2]),parentCols:Fn(b[3]).map(It)});continue}const p=Ny(N);if(!p){n.push(`컬럼 정의 해석 실패: ${N.slice(0,40)}`);continue}p.attr.order=E++,p.attr.type||n.push(`자바 타입 미해소(수동 지정 필요): ${h}.${p.attr.name} — ${(d=p.attr.dbAttrs[0])==null?void 0:d.dataType}`),y.attributes.push(p.attr),k.set(p.attr.name.toLowerCase(),p.attr)}for(const N of _){const p=k.get(N.toLowerCase());p&&(p.identifier=!0,p.notNull=!0)}o.push(y),i.set(h.toLowerCase(),y);for(const[N,p]of k)a.set(`${h.toLowerCase()}.${N}`,p)}for(const u of c){const m=u.match(ky);m&&l.push({childTable:It(m[1]),childCols:Fn(m[2]).map(It),parentTable:It(m[3]),parentCols:Fn(m[4]).map(It)})}for(const u of l){const m=i.get(u.childTable.toLowerCase()),h=i.get(u.parentTable.toLowerCase());if(!m||!h){n.push(`FK 대상 테이블 없음: ${u.childTable}→${u.parentTable}`);continue}const f=a.get(`${u.childTable.toLowerCase()}.${(u.childCols[0]??"").toLowerCase()}`),y={modelId:De(),end1:{entityRef:h.modelId,multiplicity:f!=null&&f.notNull?"EXACTLY_ONE_INSTANCE":"NO_INSTANCE_OR_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};u.childCols.forEach((k,_)=>{const E=a.get(`${u.childTable.toLowerCase()}.${k.toLowerCase()}`),N=a.get(`${u.parentTable.toLowerCase()}.${(u.parentCols[_]??"").toLowerCase()}`);E&&(E.attrType="RELATION_OWN",E.derivedFrom={associationRef:y.modelId,sourceAttributeRef:(N==null?void 0:N.modelId)??""},_===0&&(y.end2.attributeRef=E.modelId))}),r.push(y)}for(const u of c){const m=u.match(Ey);if(!m)continue;const h=It(m[3]),f=i.get(h.toLowerCase());if(!f){n.push(`인덱스 대상 테이블 없음: ${h}`);continue}const k=Fn(m[4]).map(E=>It(E.replace(/\s+(ASC|DESC)$/i,""))).map(E=>{var N,p;return(p=(N=a.get(`${h.toLowerCase()}.${E.toLowerCase()}`))==null?void 0:N.dbAttrs[0])==null?void 0:p.modelId}).filter(E=>!!E).map(E=>({columnRef:E,descending:!1}));if(!k.length)continue;const _={modelId:De(),name:It(m[2]),unique:!!m[1],columns:k};f.indexes=[...f.indexes??[],_]}return{logical:{modelId:De(),entities:o,associations:r,groups:[]},warnings:n}}function mc(e){const{logical:n}=Br(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Nr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}function Iy(){return"postgres"}function fc(e,n="postgres",o){return Ay(e,o)}const bo=e=>e==null||e.trim()==="";function qi(e){return[...e.attributes].filter(n=>n.attrType!=="DIVIDER"&&!n.transient).sort((n,o)=>n.order-o.order)}function vy(e){const n=new Set;for(const o of e.groups)if(o.excludeDDLGeneration)for(const i of o.memberEntityRefs)n.add(i);return e.entities.filter(o=>o.stereotype!=="JPA_EMBEDDABLE"&&!n.has(o.modelId)&&!po(o))}function Dr(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name}const Cy={SMALLINT:"smallint",TINYINT:"smallint",INTEGER:"integer",BIGINT:"bigint",SERIAL:"serial",BIG_SERIAL:"bigserial",REAL:"real",FLOAT:"double precision",DOUBLE:"double precision",BOOLEAN:"boolean",BIT:"boolean",LONGVARCHAR:"text",LONGNVARCHAR:"text",CLOB:"text",NCLOB:"text",BINARY:"bytea",VARBINARY:"bytea",LONGVARBINARY:"bytea",BLOB:"bytea",DATE:"date",TIME:"time",TIME_WITH_TIMEZONE:"time with time zone",TIMESTAMP:"timestamp",TIMESTAMP_WITH_TIMEZONE:"timestamp with time zone",JSONB:"jsonb",JAVA_OBJECT:"jsonb",SQLXML:"xml"};function xy(e){const n=e.dataType;if(e.autoIncrement){if(n==="BIGINT")return"bigserial";if(n==="SMALLINT")return"smallserial";if(n==="INTEGER")return"serial"}return n==="NUMERIC"||n==="DECIMAL"?e.length==null?"numeric":e.scale!=null?`numeric(${e.length}, ${e.scale})`:`numeric(${e.length})`:n==="CHAR"||n==="NCHAR"?e.length!=null?`char(${e.length})`:"char":n==="VARCHAR"||n==="NVARCHAR"?e.length!=null?`varchar(${e.length})`:"varchar":Cy[n]??n.toLowerCase()}function Sy(e,n,o){const i=[];for(const a of qi(e))a.dbAttrs.forEach((r,l)=>{const s=on(a,r,l,e,n,o);pc(s)&&i.push({attr:a,col:s,name:s.physicalName})});return i}function pc(e){return e.sharedColumnRef==null&&!bo(e.physicalName)&&!bo(e.dataType)}function Ry(e){return[` -- ⚠ 컬럼명 충돌로 ${e.length}개 컬럼 생략 (CHK-NAME-2 — 같은 물리명을 둘 이상이 사용):`,...e.map(({attr:o,name:i})=>` -- ${o.name||"(이름 없음)"} → ${i}`)].join(`
|
|
6
|
+
`)}function Ay(e,n){const o=vy(e),i=new Map,a=new Map;for(const d of e.entities)for(const u of qi(d)){i.set(u.modelId,d);const m=[];u.dbAttrs.forEach((h,f)=>{const y=on(u,h,f,d,e,n);pc(y)&&(m[f]=y.physicalName)}),a.set(u.modelId,m)}const r=[],l=[],s=[];for(const d of o){const u=Dr(d),m=Sy(d,e,n);if(m.length===0)continue;const h=new Map,f=new Map;for(const{attr:$,col:L,name:T}of m){const S=$.dbAttrs.findIndex(M=>M.modelId===L.modelId),C=h.get($.modelId)??[];C[S<0?C.length:S]=T,h.set($.modelId,C),f.set(L.modelId,T)}const y=new Set,k=[],_=[];for(const{attr:$,col:L,name:T}of m){if(y.has(T)){k.push({attr:$,col:L,name:T});continue}y.add(T);const S=[` ${T} ${xy(L)}`];$.notNull&&!$.identifier&&S.push("NOT NULL"),L.unique&&S.push("UNIQUE"),_.push(S.join(" "))}const E=qi(d).filter($=>$.identifier).flatMap($=>h.get($.modelId)??[]).filter($=>!bo($));E.length&&_.push(` PRIMARY KEY (${E.join(", ")})`);const N=_.join(`,
|
|
7
|
+
`)+(k.length?`
|
|
8
|
+
${Ry(k)}`:"");r.push(`CREATE TABLE ${u} (
|
|
9
9
|
${N}
|
|
10
|
-
);`);const p=new Map,
|
|
10
|
+
);`);const p=new Map,b=[];for(const $ of qi(d)){const L=$.derivedFrom;if(!L)continue;const T=i.get(L.sourceAttributeRef);if(!T)continue;if(po(T)){b.push(`${$.name||$.modelId} → ${Dr(T)}`);continue}const S=h.get($.modelId)??[],C=a.get(L.sourceAttributeRef)??[],M=[];for(let g=0;g<Math.max(S.length,C.length);g++){const I=S[g],v=C[g];bo(I)||bo(v)||M.push([I,v])}if(!M.length)continue;const B=p.get(L.associationRef)??{childCols:[],parentTable:Dr(T),parentCols:[]};for(const[g,I]of M)B.childCols.push(g),B.parentCols.push(I);p.set(L.associationRef,B)}b.length&&l.push(`-- ⚠ ${u}: 참고 전용 부모를 참조하는 FK ${b.length}개 생략 — ${b.join(", ")}`);let w=0;for(const $ of p.values()){const L=`fk_${u}_${$.parentTable}${p.size>1?`_${++w}`:""}`;l.push(`ALTER TABLE ${u} ADD CONSTRAINT ${L} FOREIGN KEY (${$.childCols.join(", ")}) REFERENCES ${$.parentTable} (${$.parentCols.join(", ")});`)}const A=On(d.attributes);for(const $ of d.indexes??[]){const L=[],T=[],S=[],C=new Set;for(const B of $.columns){const g=f.get(A.canon(B.columnRef));if(bo(g)){Ln(B.columnRef)||T.push(Os(A,B.columnRef));continue}if(C.has(g)){S.push(g);continue}C.add(g),L.push(g)}if(T.length&&s.push(`-- ⚠ ${u} 인덱스 ${$.name||"(이름 없음)"}: 컬럼 참조 미해소 ${T.length}개 생략 — ${T.join(", ")}`),S.length&&s.push(`-- ⚠ ${u} 인덱스 ${$.name||"(이름 없음)"}: 중복 컬럼 ${S.length}개 생략 (CHK-DSN-7) — ${S.join(", ")}`),!L.length)continue;const M=$.name||`ix_${u}_${L.join("_")}`;s.push(`CREATE ${$.unique?"UNIQUE ":""}INDEX ${M} ON ${u} (${L.join(", ")});`)}}return[r.join(`
|
|
11
11
|
|
|
12
12
|
`),l.join(`
|
|
13
13
|
`),s.join(`
|
|
14
14
|
`)].filter(d=>d.length).join(`
|
|
15
15
|
|
|
16
|
-
`)}const Dr="entity-modeler-diagram",Or=1;class Pn extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function mc(e,n){return JSON.stringify({format:Dr,version:Or,logical:e,layout:n},null,2)}const Yi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),yo=e=>Array.isArray(e)?e:[];function fc(e){let n;try{n=JSON.parse(e)}catch{throw new Pn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Yi(n))throw new Pn("최상위가 객체가 아닙니다.");if(n.format!==Dr)throw new Pn(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Or)throw new Pn(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Yi(o)||!Array.isArray(o.entities))throw new Pn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Yi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Pn("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:yo(o.associations),groups:yo(o.groups)},a=Yi(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:yo(a.entityLayouts),associationLayouts:yo(a.associationLayouts),groupLayouts:yo(a.groupLayouts),notes:yo(a.notes)};return{logical:i,layout:r}}const xy=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ct(e){return e.replace(xy,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Oe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function pc(e){return`<text ${[`x="${Oe(e.x)}"`,`y="${Oe(e.y)}"`,`fill="${Ct(e.fill)}"`,`font-size="${Oe(e.fontSize)}"`,e.fontFamily?`font-family="${Ct(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ct(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ct(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ct(e.text)}</text>`}function Sy(e){return`<line x1="${Oe(e.x1)}" y1="${Oe(e.y)}" x2="${Oe(e.x2)}" y2="${Oe(e.y)}" stroke="${Ct(e.stroke)}" stroke-width="${Oe(e.strokeWidth??1)}" />`}function Ry(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 Ay(e,n,o,i,a){return[`M${Oe(e+a.tl)},${Oe(n)}`,`L${Oe(e+o-a.tr)},${Oe(n)}`,a.tr?`Q${Oe(e+o)},${Oe(n)} ${Oe(e+o)},${Oe(n+a.tr)}`:"",`L${Oe(e+o)},${Oe(n+i-a.br)}`,a.br?`Q${Oe(e+o)},${Oe(n+i)} ${Oe(e+o-a.br)},${Oe(n+i)}`:"",`L${Oe(e+a.bl)},${Oe(n+i)}`,a.bl?`Q${Oe(e)},${Oe(n+i)} ${Oe(e)},${Oe(n+i-a.bl)}`:"",`L${Oe(e)},${Oe(n+a.tl)}`,a.tl?`Q${Oe(e)},${Oe(n)} ${Oe(e+a.tl)},${Oe(n)}`:"","Z"].filter(Boolean).join(" ")}function Lr(e){const n=Ry(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${Ct(e.fill)}"`,`stroke="${Ct(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ct(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Oe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Ay(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Oe(e.x)}" y="${Oe(e.y)}" width="${Oe(e.w)}" height="${Oe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Sy(l));for(const l of e.texts)r.push(pc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function $y(e){const o=[`<path ${[`d="${Ct(e.d)}"`,'fill="none"',`stroke="${Ct(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ct(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(pc(i));return`<g>${o.join("")}</g>`}function hc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Oe(n)}" y="${Oe(o)}" width="${Oe(i)}" height="${Oe(a)}" fill="${Ct(e.background)}" />`);for(const l of e.groups)r.push(Lr(l));for(const l of e.edges)r.push($y(l));for(const l of e.entities)r.push(Lr(l));for(const l of e.notes)r.push(Lr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Oe(n)} ${Oe(o)} ${Oe(i)} ${Oe(a)}" width="${Oe(i)}" height="${Oe(a)}">`+r.join("")+"</svg>"}function qi(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 Ty(e,n,o){const i=qi(e,o),a=qi(n,o);return i.kind===a.kind&&i.value!==a.value}const Pr=()=>crypto.randomUUID(),yc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,My=e=>e&&e[0].toLowerCase()+e.slice(1),Vy=e=>e&&e[0].toUpperCase()+e.slice(1),gc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function By(e,n){return My(e??"")+Vy(n??"")}function Dy(e,n){const o=mo(e.name,n);return o===e.name?e:{...e,name:o,dbAttrs:e.dbAttrs.map(i=>({...i,physicalName:gc(o)}))}}function bc(e,n){const o=e.entities.find(s=>s.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!qs(n.end1.multiplicity);return o.attributes.filter(s=>s.identifier&&(s.attrType==="NORMAL"||s.attrType==="RELATION_OWN")).sort((s,c)=>s.order-c.order).map(s=>{const c=By(o.name,s.name);return{associationRef:n.modelId,sourceAttributeRef:s.modelId,name:c,type:s.type,identifier:a,notNull:r,dbAttrs:s.dbAttrs.map(d=>({physicalName:gc(c),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const Wi=(e,n)=>`${e}::${n}`,Ji=e=>e??void 0;function Oy(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||Ji(s.length)!==Ji(r.length)||Ji(s.scale)!==Ji(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 Ly(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 Jo(e,n,o=Pr){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=>bc(e,f)),s=new Map(l.map(f=>[Wi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Wi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const y=Wi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(y)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let h=a.attributes.reduce((f,y)=>Math.max(f,y.order),-1)+1;for(const f of l){const y=Wi(f.associationRef,f.sourceAttributeRef),g=d.get(y);if(g){const _=Oy(g,f,o);_&&i.update.push({attributeId:g.modelId,patch:_})}else{const _=Dy(f,m);m.add(_.name),i.add.push(Ly(_,h++,o))}}return i}function _c(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 Py(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function kc(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 Ec(e,n,o=Pr){const i=new Map,a=Py(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(h=>h.end1.entityRef===d).map(h=>h.end2.entityRef));for(const h of m){const f=Jo(a,h,o);if(yc(f))continue;const y=i.get(h);i.set(h,y?kc(y,f):f);const g=a.entities.find(_=>_.modelId===h);g&&_c(g,f),r.has(h)||(r.add(h),c.push(h))}}return i}function Nc(e,n,o=Pr){const i=[],a=Jo(e,n,o);let r=e;yc(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 _c(s,a),s})});for(const[l,s]of Ec(r,n,o))i.push({entityId:l,plan:s});return i}function Xi(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||!Li(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 Xo=63;function zr(e){if(!e)return null;const n=e.length;return n>Xo?n:null}function Fr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function bt(e){return!e||e.trim()===""}function go(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function zy(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const h=o.get(m.end1.entityRef)??[];h.push(m.end2.entityRef),o.set(m.end1.entityRef,h)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const h of o.get(m)??[]){const f=l.get(h)??i;if(f===i)u(h);else if(f===a){const y=s.slice(s.indexOf(h)),g=[...y].sort().join(" ");d.has(g)||(d.add(g),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 wc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Fy(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function Ic(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Uy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=bt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Hy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Uy(a,o))).size===1}function vc(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 Ur(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 Zi(e,n){var m,h,f,y,g,_,E,N,p;const o=[],i=new Map(e.entities.map(k=>[k.modelId,k])),a=new Map(e.associations.map(k=>[k.modelId,k])),r=Ir(e),l=r.size===0?e.entities:Gs(e),s=Ys(e,r);for(const k of vc(l,I=>I.name))for(const I of k){const A=k.filter(V=>V!==I),$=wc(I)&&A.some(wc),L=A.some(V=>!Ty(I,V,e));!$&&!L||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:I.modelId,params:{name:I.name,reason:$?"entity":"package"}})}for(const k of vc(Fy(l),Ic))if(new Set(k.map(I=>I.name)).size!==1&&!Hy(k,e))for(const I of k)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:I.modelId,params:{name:Ic(I)}});const c=l.flatMap(k=>(k.indexes??[]).map(I=>({e:k,ix:I})));for(const k of Ur(c,I=>I.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:k.ix.modelId,contextRef:k.e.modelId,params:{name:k.ix.name}});for(const k of l){const I=k.attributes.filter(b=>b.attrType!=="DIVIDER");if(bt(k.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:k.modelId}),k.stereotype==="JPA_ENTITY"&&!k.abstractClass&&(I.some(b=>b.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:k.modelId}),bt((m=k.table)==null?void 0:m.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:k.modelId})),k.stereotype==="JPA_EMBEDDABLE")for(const b of I.filter(w=>w.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I.filter(w=>w.identifier&&w.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I)if(!b.identifier)for(const w of b.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:w.autoIncrement?{name:b.name}:{name:b.name,seq:w.sequenceName??""}});const A=I.filter(b=>b.identifier&&!b.transient);if(A.reduce((b,w)=>b+w.dbAttrs.length,0)>=2)for(const b of A)for(const w of b.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I.filter(w=>w.naturalId&&w.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I.filter(w=>w.naturalId&&w.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I.filter(w=>w.naturalId&&!w.notNull&&!w.identifier&&!w.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});!k.abstractClass&&I.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:k.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&I.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:k.modelId,params:{count:I.length,threshold:n.largeEntityThreshold}});for(const b of Ur(I,w=>w.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I)if(bt(b.name)){const w=b.attrType.startsWith("RELATION")||b.attrType.startsWith("EMBED");o.push({ruleId:w?"CHK-NAME-7":"CHK-NAME-4",severity:w?"error":"info",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,...w?{params:{attrType:b.attrType}}:{}})}const $=I.flatMap(b=>b.dbAttrs.map((w,v)=>({attr:b,index:v,col:w,eff:on(b,w,v,k,e,n),name:Yo(b,w,v,k,e,n)})).filter(w=>w.eff.sharedColumnRef==null));for(const b of Ur($,w=>w.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:b.col.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of $){if(!bt(b.name)||b.attr.transient||bt(b.attr.name)&&(b.attr.attrType.startsWith("RELATION")||b.attr.attrType.startsWith("EMBED"))||b.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const w=Pi(b.attr,k,e.entities,e.associations,b.index);bt(w==null?void 0:w.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:b.col.modelId,contextRef:k.modelId,params:{name:b.attr.name}})}for(const b of $){const w=b.col,v=zr(w.physicalName);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{max:Xo,len:v}}),n!=null&&n.reservedWords&&!bt(w.physicalName)&&n.reservedWords.has(w.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{name:w.physicalName}}),n!=null&&n.selectableDataTypes&&!bt(w.dataType)&&!n.selectableDataTypes.has(w.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{dataType:w.dataType}});const O=b.attr.transient||w.multiValue||b.attr.attrType.startsWith("EMBED")||b.attr.attrType.startsWith("RELATION")?void 0:ry(b.attr.type,w.dataType);O===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{type:b.attr.type,dataType:Fr(w)}}),O!==!1&&!bt(w.dataType)&&ty.has(w.dataType)&&!w.length&&(on(b.attr,w,b.index,k,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{dataType:w.dataType}}))}for(const b of $)bt(b.col.dataType)&&(b.attr.transient||b.attr.attrType.startsWith("EMBED")||b.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:b.col.modelId,contextRef:k.modelId,params:{name:b.attr.name}}));if((h=n==null?void 0:n.embeddableCatalog)!=null&&h.length){const b=co(Nn(k,e.entities));for(const w of I){if(w.attrType!=="EMBED_PREDEF")continue;const v=n.embeddableCatalog.find(O=>O.type===w.type);v&&w.dbAttrs.forEach((O,M)=>{if(O.sharedColumnRef==null)return;const z=v.fields[M],j=b.get(O.sharedColumnRef);if(!z||!j)return;(j.dataType!==z.dataType||(j.length??null)!==(z.length??null)||(j.scale??null)!==(z.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:O.modelId,contextRef:k.modelId,params:{targetType:Fr(j),metaName:z.name,metaType:Fr(z)}})})}}for(const b of I){const w=b.dbAttrs[0];if(!(w!=null&&w.multiValue))continue;b.type===On&&w.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{type:b.type||"",dataType:w.dataType||""}})}for(const b of I){if(b.attrType!=="EMBED_OWN"||!b.embedded)continue;const w=i.get(b.embedded.embeddableRef);if(!w)continue;const v=a.get(b.embedded.associationRef),O=v==null?void 0:v.end1.entityRef===b.embedded.embeddableRef?v.end1:v.end2;if(O&&go(O.multiplicity))continue;const M=nn(w).length;b.dbAttrs.length!==M&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name,embeddable:w.name,slots:b.dbAttrs.length,declared:M}})}const L=(f=k.table)==null?void 0:f.physicalName,V=zr(L);V!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:k.modelId,params:{max:Xo,len:V}}),n!=null&&n.reservedWords&&!bt(L)&&n.reservedWords.has(L.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:k.modelId,params:{name:L}});const S=new Set;for(const b of k.attributes){S.add(b.modelId);for(const w of b.dbAttrs)S.add(w.modelId)}const x=new Set(Ko(k,(n==null?void 0:n.superClassCatalog)??[]).map(b=>b.modelId)),T=(((y=n==null?void 0:n.superClassCatalog)==null?void 0:y.length)??0)>0,D=Vn(k.attributes);for(const b of k.indexes??[]){const w=zr(b.name);w!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:{max:Xo,len:w}}),n!=null&&n.reservedWords&&!bt(b.name)&&n.reservedWords.has(b.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const v of b.columns){const O=v.columnRef;if(S.has(O)||x.has(O))continue;const M=Bn(O);M&&!T||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:M?{name:b.name,field:((g=Nr(O))==null?void 0:g.field)??O}:{name:b.name}})}b.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}}),new Set(b.columns.map(v=>D.canon(v.columnRef))).size!==b.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}})}}const d=new Map;for(const k of e.entities)for(const I of k.attributes)I.attrType==="EMBED_OWN"&&I.embedded&&d.set(I.embedded.associationRef,I);for(const k of s){if(go(k.end1.multiplicity)&&go(k.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:k.modelId}),d.has(k.modelId)&&k.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:k.modelId}),!d.has(k.modelId)){const I=!!k.end2.attributeRef&&(((E=(_=k.end2.jpa)==null?void 0:_.cascadeTypes)==null?void 0:E.length)??0)>0,A=!!k.end1.attributeRef&&k.end1.navigable&&(((p=(N=k.end1.jpa)==null?void 0:N.cascadeTypes)==null?void 0:p.length)??0)>0;I&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:k.modelId})}if(!d.has(k.modelId)&&k.end1.navigable&&k.end1.attributeRef){const I=i.get(k.end1.entityRef),A=I==null?void 0:I.attributes.some(V=>V.modelId===k.end1.attributeRef),$=i.get(k.end2.entityRef),L=bc(e,k).length>0;A&&$&&L&&(k.end2.attributeRef&&$.attributes.some(S=>S.modelId===k.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:k.modelId,params:{child:$.name}}))}for(const I of["end1","end2"]){const A=k[I].jpa;if(!A)continue;const $=A.cascadeTypes??[],L=$.includes("ALL"),V=$.includes("REMOVE");L&&$.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:I}}),A.orphanRemoval&&(V||L)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:k.modelId,params:{which:I,cascade:L?"ALL":"REMOVE"}}),go(k[I].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:I}}),A.orphanRemoval&&go(k[I==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:k.modelId,params:{which:I}}),!go(k[I].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:I}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:I}})}}const u=new Map(e.entities.map(k=>[k.modelId,k.name||k.modelId]));for(const k of zy(l,s)){const I=[...k,k[0]].map(A=>u.get(A)??A).join(" → ");for(const A of k)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:I}})}if(n!=null&&n.flagEntitiesWithoutRelations){const k=new Set;for(const A of e.associations)k.add(A.end1.entityRef),k.add(A.end2.entityRef);const I=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const $ of A.attributes)$.embedded&&(k.add(A.modelId),k.add($.embedded.embeddableRef));if(!bt(A.superClass)){k.add(A.modelId);const $=I.get(A.superClass);$&&k.add($)}}for(const A of l)k.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function Hr(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return jy(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}function jy(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=Vn(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 bo="javax.persistence",Je={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},Ky={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function Cc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Ut(o)?null:o??Ky[n]}const Qi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function Gy(e){if(!e)return;if(Qi[e])return{simpleName:e,fqn:Qi[e]};const n=Object.entries(Qi).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function xc(e){return!(Ut(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Yy(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(uo(l)||o.skipUngeneratable!==!1&&!xc(l)||a.push(Xy(l,e,o)))}return a}class Sc{constructor(){Xe(this,"imports",new Set);Xe(this,"body",[]);Xe(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${bo}.${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 Or="entity-modeler-diagram",Lr=1;class Un extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function hc(e,n){return JSON.stringify({format:Or,version:Lr,logical:e,layout:n},null,2)}const Wi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),_o=e=>Array.isArray(e)?e:[];function yc(e){let n;try{n=JSON.parse(e)}catch{throw new Un("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Wi(n))throw new Un("최상위가 객체가 아닙니다.");if(n.format!==Or)throw new Un(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Lr)throw new Un(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Wi(o)||!Array.isArray(o.entities))throw new Un("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Wi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Un("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:_o(o.associations),groups:_o(o.groups)},a=Wi(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:_o(a.entityLayouts),associationLayouts:_o(a.associationLayouts),groupLayouts:_o(a.groupLayouts),notes:_o(a.notes)};return{logical:i,layout:r}}const $y=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function vt(e){return e.replace($y,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Pe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function gc(e){return`<text ${[`x="${Pe(e.x)}"`,`y="${Pe(e.y)}"`,`fill="${vt(e.fill)}"`,`font-size="${Pe(e.fontSize)}"`,e.fontFamily?`font-family="${vt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${vt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${vt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${vt(e.text)}</text>`}function Ty(e){return`<line x1="${Pe(e.x1)}" y1="${Pe(e.y)}" x2="${Pe(e.x2)}" y2="${Pe(e.y)}" stroke="${vt(e.stroke)}" stroke-width="${Pe(e.strokeWidth??1)}" />`}function My(e){return e==null?{tl:0,tr:0,br:0,bl:0}:typeof e=="number"?{tl:e,tr:e,br:e,bl:e}:e}function Vy(e,n,o,i,a){return[`M${Pe(e+a.tl)},${Pe(n)}`,`L${Pe(e+o-a.tr)},${Pe(n)}`,a.tr?`Q${Pe(e+o)},${Pe(n)} ${Pe(e+o)},${Pe(n+a.tr)}`:"",`L${Pe(e+o)},${Pe(n+i-a.br)}`,a.br?`Q${Pe(e+o)},${Pe(n+i)} ${Pe(e+o-a.br)},${Pe(n+i)}`:"",`L${Pe(e+a.bl)},${Pe(n+i)}`,a.bl?`Q${Pe(e)},${Pe(n+i)} ${Pe(e)},${Pe(n+i-a.bl)}`:"",`L${Pe(e)},${Pe(n+a.tl)}`,a.tl?`Q${Pe(e)},${Pe(n)} ${Pe(e+a.tl)},${Pe(n)}`:"","Z"].filter(Boolean).join(" ")}function Pr(e){const n=My(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${vt(e.fill)}"`,`stroke="${vt(e.stroke)}"`,`stroke-width="${Pe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${vt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Pe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Vy(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Pe(e.x)}" y="${Pe(e.y)}" width="${Pe(e.w)}" height="${Pe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Ty(l));for(const l of e.texts)r.push(gc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function By(e){const o=[`<path ${[`d="${vt(e.d)}"`,'fill="none"',`stroke="${vt(e.stroke)}"`,`stroke-width="${Pe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${vt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(gc(i));return`<g>${o.join("")}</g>`}function bc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Pe(n)}" y="${Pe(o)}" width="${Pe(i)}" height="${Pe(a)}" fill="${vt(e.background)}" />`);for(const l of e.groups)r.push(Pr(l));for(const l of e.edges)r.push(By(l));for(const l of e.entities)r.push(Pr(l));for(const l of e.notes)r.push(Pr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Pe(n)} ${Pe(o)} ${Pe(i)} ${Pe(a)}" width="${Pe(i)}" height="${Pe(a)}">`+r.join("")+"</svg>"}function Ji(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function Dy(e,n,o){const i=Ji(e,o),a=Ji(n,o);return i.kind===a.kind&&i.value!==a.value}const zr=()=>crypto.randomUUID(),_c=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Oy=e=>e&&e[0].toLowerCase()+e.slice(1),Ly=e=>e&&e[0].toUpperCase()+e.slice(1),kc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Py(e,n){return Oy(e??"")+Ly(n??"")}function zy(e,n){const o=ho(e.name,n);return o===e.name?e:{...e,name:o,dbAttrs:e.dbAttrs.map(i=>({...i,physicalName:kc(o)}))}}function Ec(e,n){const o=e.entities.find(s=>s.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!Xs(n.end1.multiplicity);return o.attributes.filter(s=>s.identifier&&(s.attrType==="NORMAL"||s.attrType==="RELATION_OWN")).sort((s,c)=>s.order-c.order).map(s=>{const c=Py(o.name,s.name);return{associationRef:n.modelId,sourceAttributeRef:s.modelId,name:c,type:s.type,identifier:a,notNull:r,dbAttrs:s.dbAttrs.map(d=>({physicalName:kc(c),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const Xi=(e,n)=>`${e}::${n}`,Zi=e=>e??void 0;function Fy(e,n,o){const i={};return e.type!==n.type&&(i.type=n.type),e.identifier!==n.identifier&&(i.identifier=n.identifier),e.notNull!==n.notNull&&(i.notNull=n.notNull),(e.dbAttrs.length!==n.dbAttrs.length||n.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||Zi(s.length)!==Zi(r.length)||Zi(s.scale)!==Zi(r.scale)}))&&(i.dbAttrs=n.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function Uy(e,n,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:n,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function Xo(e,n,o=zr){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(f=>Ec(e,f)),s=new Map(l.map(f=>[Xi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Xi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const y=Xi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(y)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let h=a.attributes.reduce((f,y)=>Math.max(f,y.order),-1)+1;for(const f of l){const y=Xi(f.associationRef,f.sourceAttributeRef),k=d.get(y);if(k){const _=Fy(k,f,o);_&&i.update.push({attributeId:k.modelId,patch:_})}else{const _=zy(f,m);m.add(_.name),i.add.push(Uy(_,h++,o))}}return i}function Nc(e,n){if(n.remove.length){const o=new Set(n.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of n.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}n.add.length&&e.attributes.push(...n.add)}function Hy(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function wc(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function Ic(e,n,o=zr){const i=new Map,a=Hy(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(h=>h.end1.entityRef===d).map(h=>h.end2.entityRef));for(const h of m){const f=Xo(a,h,o);if(_c(f))continue;const y=i.get(h);i.set(h,y?wc(y,f):f);const k=a.entities.find(_=>_.modelId===h);k&&Nc(k,f),r.has(h)||(r.add(h),c.push(h))}}return i}function vc(e,n,o=zr){const i=[],a=Xo(e,n,o);let r=e;_c(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return Nc(s,a),s})});for(const[l,s]of Ic(r,n,o))i.push({entityId:l,plan:s});return i}function ko(e,n,o){var l;const i=e.entities.find(s=>s.modelId===n),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!zi(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const Zo=63;function Fr(e){if(!e)return null;const n=e.length;return n>Zo?n:null}function Ur(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function gt(e){return!e||e.trim()===""}function Eo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function jy(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const h=o.get(m.end1.entityRef)??[];h.push(m.end2.entityRef),o.set(m.end1.entityRef,h)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const h of o.get(m)??[]){const f=l.get(h)??i;if(f===i)u(h);else if(f===a){const y=s.slice(s.indexOf(h)),k=[...y].sort().join(" ");d.has(k)||(d.add(k),c.push(y))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function Cc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Ky(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function xc(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Gy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=gt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Yy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Gy(a,o))).size===1}function Sc(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function Hr(e,n){const o=new Map;for(const i of e){const a=n(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=n(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function Qi(e,n){var m,h,f,y,k,_,E,N,p;const o=[],i=new Map(e.entities.map(b=>[b.modelId,b])),a=new Map(e.associations.map(b=>[b.modelId,b])),r=vr(e),l=r.size===0?e.entities:Ws(e),s=Js(e,r);for(const b of Sc(l,w=>w.name))for(const w of b){const A=b.filter(T=>T!==w),$=Cc(w)&&A.some(Cc),L=A.some(T=>!Dy(w,T,e));!$&&!L||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:w.modelId,params:{name:w.name,reason:$?"entity":"package"}})}for(const b of Sc(Ky(l),xc))if(new Set(b.map(w=>w.name)).size!==1&&!Yy(b,e))for(const w of b)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:w.modelId,params:{name:xc(w)}});const c=l.flatMap(b=>(b.indexes??[]).map(w=>({e:b,ix:w})));for(const b of Hr(c,w=>w.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:b.ix.modelId,contextRef:b.e.modelId,params:{name:b.ix.name}});for(const b of l){const w=b.attributes.filter(g=>g.attrType!=="DIVIDER");if(gt(b.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:b.modelId}),b.stereotype==="JPA_ENTITY"&&!b.abstractClass&&(w.some(g=>g.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:b.modelId}),gt((m=b.table)==null?void 0:m.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:b.modelId})),b.stereotype==="JPA_EMBEDDABLE")for(const g of w.filter(I=>I.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w.filter(I=>I.identifier&&I.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w)if(!g.identifier)for(const I of g.dbAttrs)!I.autoIncrement&>(I.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:I.autoIncrement?{name:g.name}:{name:g.name,seq:I.sequenceName??""}});const A=w.filter(g=>g.identifier&&!g.transient);if(A.reduce((g,I)=>g+I.dbAttrs.length,0)>=2)for(const g of A)for(const I of g.dbAttrs)!I.autoIncrement&>(I.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w.filter(I=>I.naturalId&&I.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w.filter(I=>I.naturalId&&I.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w.filter(I=>I.naturalId&&!I.notNull&&!I.identifier&&!I.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});!b.abstractClass&&w.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:b.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&w.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:b.modelId,params:{count:w.length,threshold:n.largeEntityThreshold}});for(const g of Hr(w,I=>I.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of w)if(gt(g.name)){const I=g.attrType.startsWith("RELATION")||g.attrType.startsWith("EMBED");o.push({ruleId:I?"CHK-NAME-7":"CHK-NAME-4",severity:I?"error":"info",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,...I?{params:{attrType:g.attrType}}:{}})}const $=w.flatMap(g=>g.dbAttrs.map((I,v)=>({attr:g,index:v,col:I,eff:on(g,I,v,b,e,n),name:qo(g,I,v,b,e,n)})).filter(I=>I.eff.sharedColumnRef==null));for(const g of Hr($,I=>I.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:g.col.modelId,contextRef:b.modelId,params:{name:g.name}});for(const g of $){if(!gt(g.name)||g.attr.transient||gt(g.attr.name)&&(g.attr.attrType.startsWith("RELATION")||g.attr.attrType.startsWith("EMBED"))||g.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const I=Fi(g.attr,b,e.entities,e.associations,g.index);gt(I==null?void 0:I.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:g.col.modelId,contextRef:b.modelId,params:{name:g.attr.name}})}for(const g of $){const I=g.col,v=Fr(I.physicalName);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{max:Zo,len:v}}),n!=null&&n.reservedWords&&!gt(I.physicalName)&&n.reservedWords.has(I.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{name:I.physicalName}}),n!=null&&n.selectableDataTypes&&!gt(I.dataType)&&!n.selectableDataTypes.has(I.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{dataType:I.dataType}});const O=g.attr.transient||I.multiValue||g.attr.attrType.startsWith("EMBED")||g.attr.attrType.startsWith("RELATION")?void 0:dy(g.attr.type,I.dataType);O===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{type:g.attr.type,dataType:Ur(I)}}),O!==!1&&!gt(I.dataType)&&ay.has(I.dataType)&&!I.length&&(on(g.attr,I,g.index,b,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{dataType:I.dataType}}))}for(const g of $)gt(g.col.dataType)&&(g.attr.transient||g.attr.attrType.startsWith("EMBED")||g.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:g.col.modelId,contextRef:b.modelId,params:{name:g.attr.name}}));if((h=n==null?void 0:n.embeddableCatalog)!=null&&h.length){const g=fo(vn(b,e.entities));for(const I of w){if(I.attrType!=="EMBED_PREDEF")continue;const v=n.embeddableCatalog.find(O=>O.type===I.type);v&&I.dbAttrs.forEach((O,x)=>{if(O.sharedColumnRef==null)return;const z=v.fields[x],j=g.get(O.sharedColumnRef);if(!z||!j)return;(j.dataType!==z.dataType||(j.length??null)!==(z.length??null)||(j.scale??null)!==(z.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:O.modelId,contextRef:b.modelId,params:{targetType:Ur(j),metaName:z.name,metaType:Ur(z)}})})}}for(const g of w){const I=g.dbAttrs[0];if(!(I!=null&&I.multiValue))continue;g.type===zn&&I.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:b.modelId,params:{type:g.type||"",dataType:I.dataType||""}})}for(const g of w){if(g.attrType!=="EMBED_OWN"||!g.embedded)continue;const I=i.get(g.embedded.embeddableRef);if(!I)continue;const v=a.get(g.embedded.associationRef),O=v==null?void 0:v.end1.entityRef===g.embedded.embeddableRef?v.end1:v.end2;if(O&&Eo(O.multiplicity))continue;const x=nn(I).length;g.dbAttrs.length!==x&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name,embeddable:I.name,slots:g.dbAttrs.length,declared:x}})}const L=(f=b.table)==null?void 0:f.physicalName,T=Fr(L);T!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:b.modelId,params:{max:Zo,len:T}}),n!=null&&n.reservedWords&&!gt(L)&&n.reservedWords.has(L.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:b.modelId,params:{name:L}});const S=new Set;for(const g of b.attributes){S.add(g.modelId);for(const I of g.dbAttrs)S.add(I.modelId)}const C=new Set(Go(b,(n==null?void 0:n.superClassCatalog)??[]).map(g=>g.modelId)),M=(((y=n==null?void 0:n.superClassCatalog)==null?void 0:y.length)??0)>0,B=On(b.attributes);for(const g of b.indexes??[]){const I=Fr(g.name);I!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:{max:Zo,len:I}}),n!=null&&n.reservedWords&&!gt(g.name)&&n.reservedWords.has(g.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}});for(const v of g.columns){const O=v.columnRef;if(S.has(O)||C.has(O))continue;const x=Ln(O);x&&!M||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:x?{name:g.name,field:((k=wr(O))==null?void 0:k.field)??O}:{name:g.name}})}g.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}}),new Set(g.columns.map(v=>B.canon(v.columnRef))).size!==g.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:g.modelId,contextRef:b.modelId,params:{name:g.name}})}}const d=new Map;for(const b of e.entities)for(const w of b.attributes)w.attrType==="EMBED_OWN"&&w.embedded&&d.set(w.embedded.associationRef,w);for(const b of s){if(Eo(b.end1.multiplicity)&&Eo(b.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:b.modelId}),d.has(b.modelId)&&b.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:b.modelId}),!d.has(b.modelId)){const w=!!b.end2.attributeRef&&(((E=(_=b.end2.jpa)==null?void 0:_.cascadeTypes)==null?void 0:E.length)??0)>0,A=!!b.end1.attributeRef&&b.end1.navigable&&(((p=(N=b.end1.jpa)==null?void 0:N.cascadeTypes)==null?void 0:p.length)??0)>0;w&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:b.modelId})}if(!d.has(b.modelId)&&b.end1.navigable&&b.end1.attributeRef){const w=i.get(b.end1.entityRef),A=w==null?void 0:w.attributes.some(T=>T.modelId===b.end1.attributeRef),$=i.get(b.end2.entityRef),L=Ec(e,b).length>0;A&&$&&L&&(b.end2.attributeRef&&$.attributes.some(S=>S.modelId===b.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:b.modelId,params:{child:$.name}}))}for(const w of["end1","end2"]){const A=b[w].jpa;if(!A)continue;const $=A.cascadeTypes??[],L=$.includes("ALL"),T=$.includes("REMOVE");L&&$.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:b.modelId,params:{which:w}}),A.orphanRemoval&&(T||L)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:b.modelId,params:{which:w,cascade:L?"ALL":"REMOVE"}}),Eo(b[w].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:b.modelId,params:{which:w}}),A.orphanRemoval&&Eo(b[w==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:b.modelId,params:{which:w}}),!Eo(b[w].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:b.modelId,params:{which:w}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:b.modelId,params:{which:w}})}}const u=new Map(e.entities.map(b=>[b.modelId,b.name||b.modelId]));for(const b of jy(l,s)){const w=[...b,b[0]].map(A=>u.get(A)??A).join(" → ");for(const A of b)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:w}})}if(n!=null&&n.flagEntitiesWithoutRelations){const b=new Set;for(const A of e.associations)b.add(A.end1.entityRef),b.add(A.end2.entityRef);const w=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const $ of A.attributes)$.embedded&&(b.add(A.modelId),b.add($.embedded.embeddableRef));if(!gt(A.superClass)){b.add(A.modelId);const $=w.get(A.superClass);$&&b.add($)}}for(const A of l)b.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function jr(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return qy(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}function qy(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=On(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const No="javax.persistence",et={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},Wy={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function Rc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Ut(o)?null:o??Wy[n]}const ea={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function Jy(e){if(!e)return;if(ea[e])return{simpleName:e,fqn:ea[e]};const n=Object.entries(ea).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function Ac(e){return!(Ut(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Xy(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(po(l)||o.skipUngeneratable!==!1&&!Ac(l)||a.push(eg(l,e,o)))}return a}class $c{constructor(){nt(this,"imports",new Set);nt(this,"body",[]);nt(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${No}.${n}`)}line(n=""){this.body.push(n)}fillIn(n){this.fillIns.push(n)}render(n){const o=[`package ${n};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
17
17
|
`)+`
|
|
18
|
-
`}}function
|
|
18
|
+
`}}function Tc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Mc(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function wo(e,n){n&&(e.import(et.lombokGetter),e.line(" @Getter"))}const Zy=["ko","en","ja","zh"];function Kr(e,n){if(!e)return[];const o=Zy.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${n} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${n}/**`,`${n} * <ul>`,...o,`${n} * </ul>`,`${n} */`]}function ta(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...Jo,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===zn){if(i){const c=[`${No}.Enumerated`,`${No}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${No}.Enumerated`,`${No}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===an){const c=Jy(n),d=c?`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${n??"(미지정)"}`;return{...a,type:n||"Object",fillIns:[d]}}if(e==="CustomMoneyType"){const c=Rc(o,"money");return{type:"Money",primitive:!1,imports:c?[et.money,`${No}.Convert`]:[et.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=ea[e];if(s)return{type:e,primitive:!1,imports:[s,et.jdbcTypeCode,et.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const c=l.label,d=[],u=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),u.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:l.boxed!=null,imports:d,fieldAnnotations:[],fillIns:u}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function Vc(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function Qo(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return ta(e.type,e.customType,o,e.groupCode).type;const a=n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return ta(e.type,e.customType,o).type;const r=Vc(a);return r.length>=2?`${a.name}PK`:r.length===1?Qo(r[0],n,o,new Set([...i,a.modelId])):ta(e.type,e.customType,o).type}function Gr(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!Wr(n.end2.multiplicity)&&e.dbAttrs.length===1}function Yr(e,n,o){var a;if(e.derivedIdFieldName)return e.derivedIdFieldName;const i=Jr(e,n,o,0);return Mc(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function Qy(e,n,o,i,a){var l;const r=e.derivedFrom?(l=o.get(n.end1.entityRef))==null?void 0:l.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef):void 0;return Qo(r||e,i,a)}function eg(e,n,o){var C,M,B,g,I,v,O;if(e.stereotype==="JPA_EMBEDDABLE")return tg(e,n,o);const i=new $c,a=e.name;let r=ei(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${na}')`),r=na);const l=new Map(n.entities.map(x=>[x.modelId,x])),s=r,c=fg(e,o,i),d=new Map;for(const x of n.associations)x.end2.attributeRef&&d.set(x.end2.attributeRef,{assoc:x,role:"owner"}),x.end1.attributeRef&&x.end1.navigable&&d.set(x.end1.attributeRef,{assoc:x,role:"inverse"});const u=Vc(e),m=new Set;for(const x of u)Gr(x,(C=d.get(x.modelId))==null?void 0:C.assoc)&&m.add(x.modelId);const h=new Set(u.filter(x=>x.attrType==="NORMAL").flatMap(x=>x.dbAttrs.map(z=>z.physicalName)).filter(Boolean)),f=[];for(const x of u){if(!m.has(x.modelId))continue;const z=d.get(x.modelId).assoc,j=x.dbAttrs[0],ne=Jr(x,z,l,0),de=(j==null?void 0:j.physicalName)||ne||"";if(de&&h.has(de))continue;const pe=Yr(x,z,l);if(!pe){i.fillIn(`${a}.${x.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);continue}f.push({modelId:`synthetic-id:${x.modelId}`,name:pe,type:Qy(x,z,l,n,o),attrType:"NORMAL",identifier:!0,notNull:!0,order:x.order,dbAttrs:[{...j??{modelId:`synthetic-col:${x.modelId}`,dataType:""},physicalName:de}]})}const y=[...u.filter(x=>!m.has(x.modelId)),...f].sort((x,z)=>x.order-z.order),k=y.length>=2,_=y.length===1,E=`${a}PK`,N=x=>m.has(x.modelId)?"mapsId":x.identifier?"id":"none",p=o.lombok!==!1;i.jpa("Entity"),i.import(et.jsonIdentityInfo),i.import(et.jsogGenerator);const b=["@Entity"];b.push(lg(e,n,o,i)),b.push('@SuppressWarnings("serial")'),b.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),k&&(i.jpa("IdClass"),i.import(`${r}.${a}.${E}`),b.push(`@IdClass(${a}.${E}.class)`)),(M=e.jpaAttrs)!=null&&M.useDynamicInsert&&(b.push("@DynamicInsert"),i.import(et.dynamicInsert)),(B=e.jpaAttrs)!=null&&B.useDynamicUpdate&&(b.push("@DynamicUpdate"),i.import(et.dynamicUpdate)),(g=e.jpaAttrs)!=null&&g.useCacheable&&(b.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(ng),b.push("@PersonalInfo")),p&&(i.import(et.lombokNoArgs),i.import(et.lombokAccessLevel),b.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const x of Kr((I=e.table)==null?void 0:I.logicalName,""))i.line(x);for(const x of b)i.line(x);const w=e.abstractClass?"abstract ":"";i.line(`public ${w}class ${a}${c}${Oc(e,i)} {`);const A=[...f,...e.attributes.filter(x=>x.attrType!=="DIVIDER")].sort((x,z)=>x.order-z.order),$=new Set(f.map(x=>x.modelId));for(const x of u){if(!m.has(x.modelId))continue;const z=(v=x.dbAttrs[0])==null?void 0:v.physicalName;if(z)for(const j of u)j.attrType==="NORMAL"&&j.dbAttrs.some(ne=>ne.physicalName===z)&&$.add(j.modelId)}const L=(O=e.jpaAttrs)!=null&&O.useVersion?u.length?u[u.length-1].modelId:null:void 0,T=[];for(const x of A){if(x.attrType.startsWith("EMBED"))T.push(...Fc(x,e,n,o,i));else if(x.attrType==="RELATION_OWN"){const z=d.get(x.modelId);if(z){const j=dg(x,z.assoc,s,l,N(x),p,n,o,i);j&&T.push(j)}else sg(x,e,new Set(d.keys()))||i.fillIn(`${e.name}.${x.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`)}else if(x.attrType==="RELATION_REF"){const z=d.get(x.modelId),j=z?ug(x,z.assoc,s,l,p,n,o,i):null;j&&T.push(j)}else T.push(Pc(x,a,o,i,$.has(x.modelId)));x.modelId===L&&Bc(i,T,p)}L===null&&Bc(i,T,p),p||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Dc(T,i,p),Lc(e,i),k&&(i.import(et.jsonBackReference),i.import(et.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${E} getPK() {`),i.line(` return (${E}) HibernateBeanUtil.getPK(this);`),i.line(" }"),pg(E,y.map(x=>({type:Qo(x,n,o),name:x.name})),p,i)),i.line("}");let S;return k?S=hg(a,E,r):_&&(S=yg(a,r,Qo(y[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:S}}function Bc(e,n,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||n.push({type:"int",name:"dataVersion",category:0})}function Dc(e,n,o){const i=e.map((a,r)=>({g:a,i:r})).sort((a,r)=>a.g.category-r.g.category||a.i-r.i);for(const{g:a}of i){if(o&&!a.collection)continue;n.line(""),n.line(` public ${a.type} get${Tc(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(n.import("java.util.Collections"),n.line(` return Collections.${r}(this.${a.name});`)):n.line(` return ${a.name};`),n.line(" }")}}function tg(e,n,o){var d;const i=new $c,a=e.name;let r=ei(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${na}')`),r=na),i.jpa("Embeddable"),i.import(et.jsonIdentityInfo),i.import(et.jsogGenerator),i.import(et.serializable);for(const u of Kr((d=e.table)==null?void 0:d.logicalName,""))i.line(u);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)");const l=e.abstractClass?"abstract ":"";i.line(`public ${l}class ${a}${Oc(e,i,["Serializable"])} {`);const s=e.attributes.filter(u=>u.attrType!=="DIVIDER").sort((u,m)=>u.order-m.order),c=[];for(const u of s){if(u.attrType.startsWith("EMBED")){c.push(...Fc(u,e,n,o,i));continue}c.push(Pc(u,a,o,i))}return Dc(c,i,o.lombok!==!1),Lc(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Oc(e,n,o=[]){const i=(e.declarationOfInterfaces??[]).map(s=>s.trim()).filter(Boolean),a=new Set(i.filter(s=>!s.includes("."))),r=[...i].sort().map(s=>{if(!s.includes("."))return s;const c=s.slice(s.lastIndexOf(".")+1);return a.has(c)?s:(n.import(s),c)}),l=[...o,...r];return l.length?` implements ${l.join(", ")}`:""}const ng="net.g1project.bluecomm.annotation.PersonalInfo",og="net.g1project.bluecomm.annotation.PersonalInfoAttribute",ig="net.g1project.bluecomm.model.PersonalInfoAttributeType";function Lc(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Ut(i.name)||Ut(a))continue;const r=a.replace(/\r\n/g,`
|
|
19
19
|
`).split(`
|
|
20
|
-
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(
|
|
20
|
+
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(og),n.import(ig),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function Pc(e,n,o,i,a=!1){const r=e.dbAttrs[0],l=e.name||Mc(r==null?void 0:r.physicalName)||"unnamedField";e.name||i.fillIn(`${n}.${l}: 속성 이름 미지정 — 물리명 '${(r==null?void 0:r.physicalName)??""}'에서 파생, 모델 정정 필요`);const s=ta(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 Kr(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(et.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${mg(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=Rc(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)`),wo(i,o.lombok!==!1),i.line(` private ${d} ${l} = new LinkedHashSet<>();`)):(wo(i,o.lombok!==!1),i.line(` private ${d} ${l};`)),{type:d,name:l,category:0}}function zc(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 h,f;return{propertyPath:((h=d==null?void 0:d.fields[m])==null?void 0:h.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=nn(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 ag(e,n,o,i,a,r){var u;const l=fo(vn(n,o.entities)),s=m=>{var h;return m==null?"":((h=l.get(m))==null?void 0:h.physicalName)??""},c=e.dbAttrs.length===nn((u=e.embedded)!=null&&u.embeddableRef?o.entities.find(m=>m.modelId===e.embedded.embeddableRef):void 0).length,d=[];return e.dbAttrs.forEach((m,h)=>{const f=i[h],y=c?on(e,m,h,n,o,{embeddableCatalog:a.embeddableCatalog}):m,k=Pn(y,l),_=k?k.physicalName:y.physicalName||"",E=(f==null?void 0:f.defaultSharedRef)!=null?s(f.defaultSharedRef):(f==null?void 0:f.defaultPhysical)??"";if(!(!_||_===E)){if(!f||!f.propertyPath){r.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${h}] @AttributeOverride 프로퍼티 경로 미해소(카탈로그/중첩 임베더블 형상 확인)`);return}d.push(k?`@AttributeOverride(name = "${f.propertyPath}", column = @Column(name = "${_}", insertable = false, updatable = false))`:`@AttributeOverride(name = "${f.propertyPath}", column = @Column(name = "${_}"))`)}}),d}function Ut(e){return!e||e.trim()===""}function Fc(e,n,o,i,a){var m,h,f,y;const r=n.name,l=ei(n,o,i);if(Ut(e.name))return a.fillIn(`${r} 임베드: 속성명(필드명) 미지정 — @Embedded/@ElementCollection 방출 불가, 속성명을 채워야 함`),[];let s=e.type;if(e.attrType==="EMBED_OWN"){const k=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(_=>_.modelId===e.embedded.embeddableRef):void 0;if(k){s=k.name;const _=ei(k,o,i);_&&_!==l&&a.import(`${_}.${k.name}`)}}if(Ut(s))return a.fillIn(`${r}.${e.name}: 임베드 대상 타입 미해소 — @Embedded/@ElementCollection 방출 불가`),[];if(e.type==="Money")return[rg(e,n,o,i,a)];const c=zc(e,o,i),d=ag(e,n,o,c,i,a),u=Mr(e,o.associations);if(a.line(""),u){const k=o.associations.find(w=>{var A;return w.modelId===((A=e.embedded)==null?void 0:A.associationRef)}),_=k?k.end2.entityRef===((h=e.embedded)==null?void 0:h.embeddableRef)?k.end2:k.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const E=(f=_==null?void 0:_.jpa)==null?void 0:f.collectionTable;E?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${E}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),qr(d,a);const N=u==="SET";!N&&((y=_==null?void 0:_.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${_.jpa.orderColumn}")`)),a.import(N?"java.util.Set":"java.util.List"),a.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const p=N?`Set<${s}>`:`List<${s}>`,b=N?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${p} ${e.name} = ${b};`),[{type:p,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),qr(d,a),wo(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function rg(e,n,o,i,a){a.jpa("Embedded"),a.import(et.compositeType),a.import(et.money),a.import(et.moneyUserType);const r=zc(e,o,i),l=fo(vn(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var _,E;const u=((_=r[d])==null?void 0:_.propertyPath)||(d===0?"amount":d===1?"currency":`field${d}`),m=Pn(c,l),h=((E=r[d])==null?void 0:E.defaultPhysical)||"",f=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!f||f===h))return[];const k=[`name = "${m?m.physicalName:f||h}"`];return e.notNull&&k.push("nullable = false"),m?k.push("insertable = false","updatable = false"):(c.insertable===!1&&k.push("insertable = false"),c.updatable===!1&&k.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${k.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),qr(s,a),wo(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function qr(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 lg(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 h of e.attributes)h.dbAttrs.forEach((f,y)=>s.set(f.modelId,qo(h,f,y,e,n,l)));for(const h of Go(e,o.superClassCatalog??[]))s.set(h.modelId,h.physicalName);const c=On(e.attributes),d=[];for(const h of r){const f=[];for(const k of h.columns){const _=s.get(c.canon(k.columnRef));if(!_){i.fillIn(`${e.name}.@Index(${h.name}): 컬럼 참조 미해소(${Os(c,k.columnRef)}) — 카탈로그 확인`);continue}f.includes(_)||f.push(_)}if(!f.length)continue;const y=h.unique?", unique = true":"";d.push(`@Index(name = "${h.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(h=>` ${h}`).join(`,
|
|
21
21
|
`);return`@Table(name = "${a}", indexes = {
|
|
22
22
|
${u}
|
|
23
|
-
})`}function
|
|
23
|
+
})`}function Wr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Jr(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=Uc(a)[i])==null?void 0:r.physicalName}return(l=Uc(a)[i])==null?void 0:l.physicalName}function sg(e,n,o){var a;const i=(a=e.derivedFrom)==null?void 0:a.associationRef;return i?n.attributes.some(r=>{var l;return r.modelId!==e.modelId&&r.attrType==="RELATION_OWN"&&((l=r.derivedFrom)==null?void 0:l.associationRef)===i&&o.has(r.modelId)}):!1}function Uc(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 cg(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 Hc(e,n,o,i,a){if(!e)return;const r=ei(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function dg(e,n,o,i,a,r,l,s,c){var E;const d=i.get(n.end1.entityRef),u=(d==null?void 0:d.name)??n.end1.entityRef;if(Ut(e.name)||Ut(u))return c.fillIn(`${u||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @ManyToOne/@OneToOne 방출 불가`),null;const m=Wr(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),Hc(d,o,l,s,c);const h=n.end2.jpa,f=[];e.notNull&&f.push("optional = false"),h!=null&&h.fetchType&&(c.jpa("FetchType"),f.push(`fetch = FetchType.${h.fetchType}`)),(E=h==null?void 0:h.cascadeTypes)!=null&&E.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${h.cascadeTypes.map(N=>`CascadeType.${N}`).join(", ")} }`)),c.jpa("JoinColumn");const y=i.get(n.end2.entityRef),k=y?cg(e,n,y,i):[e],_=[];for(const N of k){const p=Math.max(1,N.dbAttrs.length);for(let b=0;b<p;b++){const w=N.dbAttrs[b],A=Jr(N,n,i,b),$=(w==null?void 0:w.physicalName)||A||"",L=[];$?L.push(`name = "${$}"`):c.fillIn(`${(y==null?void 0:y.name)??""}.${N.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),A&&L.push(`referencedColumnName = "${A}"`),N.notNull&&L.push("nullable = false"),(w==null?void 0:w.insertable)===!1&&L.push("insertable = false"),(w==null?void 0:w.updatable)===!1&&L.push("updatable = false"),_.push(`@JoinColumn(${L.join(", ")})`)}}return c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${f.length?`(${f.join(", ")})`:""}`),_.length===1?c.line(` ${_[0]}`):(c.jpa("JoinColumns"),c.line(` @JoinColumns({${_[0]},`),_.slice(1).forEach((N,p)=>{const b=p===_.length-2;c.line(` ${N}${b?"})":","}`)})),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),wo(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function ug(e,n,o,i,a,r,l,s){const c=i.get(n.end2.entityRef),d=(c==null?void 0:c.name)??n.end2.entityRef;if(Ut(e.name)||Ut(d))return s.fillIn(`${d||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @OneToMany/@OneToOne 방출 불가`),null;const u=c==null?void 0:c.attributes.find(w=>w.modelId===n.end2.attributeRef),m=(u==null?void 0:u.name)??"";if(!m)return s.fillIn(`${e.name}: 반대편(${d})에 대응 관계 속성이 없어 @OneToMany/@OneToOne(mappedBy) 방출 불가 — 자식에 FK 속성을 만들거나 관계를 단방향으로 정리 필요(CHK-JPA-19)`),null;Hc(c,o,r,l,s);const h=Wr(n.end2.multiplicity);if(s.line(""),!h)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),wo(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 k=(f==null?void 0:f.cascadeTypes)??[],_=f==null?void 0:f.orphanRemoval;y&&k.length===0&&(k=["ALL"],_==null&&(_=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const E=[`mappedBy = "${m}"`];k.length&&(s.jpa("CascadeType"),E.push(`cascade = { ${k.map(w=>`CascadeType.${w}`).join(", ")} }`)),_&&E.push("orphanRemoval = true"),f!=null&&f.fetchType&&(s.jpa("FetchType"),E.push(`fetch = FetchType.${f.fetchType}`)),s.line(` @OneToMany(${E.join(", ")})`),f!=null&&f.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${f.orderBy}")`));const N=(f==null?void 0:f.collectionType)==="SET";s.import(N?"java.util.Set":"java.util.List"),s.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const p=N?`Set<${d}>`:`List<${d}>`,b=N?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${p} ${e.name} = ${b};`),{type:p,name:e.name,category:1,collection:!0}}function mg(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=$r.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 fg(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 pg(e,n,o,i){i.import(et.serializable),i.import(et.objects),i.import(et.jsonUtils),o&&i.import(et.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${Tc(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 hg(e,n,o){const i=[`${o}.${e}`,`${o}.${e}.${n}`,et.jpaRepository,et.querydslExecutor].sort(),a=[`package ${o};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${n}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
24
24
|
`)+`
|
|
25
|
-
`}}function
|
|
25
|
+
`}}function yg(e,n,o){const i=[`${n}.${e}`,et.jpaRepository,et.querydslExecutor].sort(),a=[`package ${n};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
26
26
|
`)+`
|
|
27
|
-
`}}const ta="com.example",hg="command.domain";function Zo(e,n,o={}){const i=qi(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??hg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const yg="CustomMoneyType",gg="Money";function bg(e){return!(e.type!==yg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function _g(e){const n=e.dbAttrs[0]??{modelId:Me(),physicalName:"",dataType:""},o={modelId:Me(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:gg,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function kg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>bg(l)?(a=!0,n=!0,_g(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Eg(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const g=new Map,_=new Map,E=new Map,N=(p,k,I)=>{if(!p)return;o.get(p)||o.set(p,[{entityId:k,assignedId:p}]),i.push({id:p,entityId:k,sink:I}),I(p)};for(const p of y.attributes){N(p.modelId,y.modelId,k=>g.set(p,k));for(const k of p.dbAttrs)N(k.modelId,y.modelId,I=>_.set(k,I))}for(const p of y.indexes??[])N(p.modelId,y.modelId,k=>E.set(p,k));a.set(y,{attrs:g,cols:_,idx:E})}const r=new Set(o.keys()),l=new Map;for(const y of i){const g=(l.get(y.id)??0)+1;if(l.set(y.id,g),g===1)continue;const _=Ng(y.id,g-1,r);r.add(_),o.get(y.id).push({entityId:y.entityId,assignedId:_}),y.sink(_)}const s=[...o.values()].reduce((y,g)=>y+Math.max(0,g.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,g)=>{var E;if(!g||!y)return g;const _=o.get(g);return!_||_.length<2?g:((E=_.find(N=>N.entityId===y))==null?void 0:E.assignedId)??g},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,g)=>{const _=d.get(y);if(_)return _.end1.entityRef===g?_.end2.entityRef:_.end1.entityRef},m=e.entities.map(y=>{var p;const g=a.get(y),_=y.attributes.map(k=>{const I=g.attrs.get(k),A=k.dbAttrs.map(V=>{const S=g.cols.get(V);return S===V.modelId?V:{...V,modelId:S}});let $=k.derivedFrom;if($){const V=u($.associationRef,y.modelId),S=c(V,$.sourceAttributeRef);S!==$.sourceAttributeRef&&($={...$,sourceAttributeRef:S})}return I!==k.modelId||$!==k.derivedFrom||A.some((V,S)=>V!==k.dbAttrs[S])?{...k,modelId:I,dbAttrs:A,derivedFrom:$}:k}),E=(p=y.indexes)==null?void 0:p.map(k=>{const I=g.idx.get(k),A=k.columns.map(L=>{const V=c(y.modelId,L.columnRef);return V===L.columnRef?L:{...L,columnRef:V}});return I!==k.modelId||A.some((L,V)=>L!==k.columns[V])?{...k,modelId:I,columns:A}:k});return _.some((k,I)=>k!==y.attributes[I])||E&&y.indexes&&E.some((k,I)=>k!==y.indexes[I])?{...y,attributes:_,...E?{indexes:E}:{}}:y}),h=e.associations.map(y=>{const g=c(y.end1.entityRef,y.end1.attributeRef),_=c(y.end2.entityRef,y.end2.attributeRef);return g===y.end1.attributeRef&&_===y.end2.attributeRef?y:{...y,end1:g===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:g},end2:_===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:_}}}),f=n.associationLayouts.map(y=>{const g=d.get(y.associationRef);if(!g)return y;const _=c(g.end1.entityRef,y.sourceColumnRef),E=c(g.end2.entityRef,y.targetColumnRef);return _===y.sourceColumnRef&&E===y.targetColumnRef?y:{...y,sourceColumnRef:_,targetColumnRef:E}});return{logical:{...e,entities:m,associations:h},layout:f.some((y,g)=>y!==n.associationLayouts[g])?{...n,associationLayouts:f}:n,reissued:s}}function Ng(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function Rt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function qr(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 zc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Fc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(zc);if(!i.length)continue;const a=o.filter(s=>!zc(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 ko(e){return JSON.parse(JSON.stringify(e))}function Uc(e,n,o){var L;const i=o.idFactory??Me,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const V=new Set(n);for(const S of r.associations){const x=V.has(S.end1.entityRef),T=V.has(S.end2.entityRef);x!==T&&s.add(x?S.end2.entityRef:S.end1.entityRef)}}const c=r.entities.filter(V=>s.has(V.modelId)),d=new Set(c.map(V=>V.modelId)),u=r.associations.filter(V=>d.has(V.end1.entityRef)&&d.has(V.end2.entityRef)),m=new Set(u.map(V=>V.modelId)),h=new Map,f=V=>{let S=h.get(V);return S||(S=i(),h.set(V,S)),S};for(const V of c){f(V.modelId);for(const S of V.attributes){f(S.modelId);for(const x of S.dbAttrs)f(x.modelId)}for(const S of V.indexes??[])f(S.modelId);for(const S of V.operations??[])f(S.modelId)}for(const V of u)f(V.modelId);const y=V=>h.get(V),g=c.map(V=>{const S=ko(V);S.modelId=y(V.modelId),S.attributes=S.attributes.map(x=>wg(x,y,m,d));for(const x of S.indexes??[])x.modelId=y(x.modelId),x.columns=x.columns.map(T=>Bn(T.columnRef)?T:{...T,columnRef:y(T.columnRef)}).filter(T=>T.columnRef!==void 0);for(const x of S.operations??[])x.modelId=y(x.modelId);return S});Fc(g);const _=u.map(V=>{const S=ko(V);return S.modelId=y(V.modelId),S.end1=Hc(S.end1,y),S.end2=Hc(S.end2,y),S}),E=[];for(const V of r.groups){const S=V.memberEntityRefs.filter(T=>d.has(T));if(S.length===0)continue;const x=ko(V);x.modelId=f(V.modelId),x.memberEntityRefs=S.map(T=>y(T)),E.push(x)}const N=o.collisionSuffix??"_imported",p=new Set(o.existing.entities.map(V=>V.name)),k=new Set(o.existing.entities.map(V=>{var S;return(S=V.table)==null?void 0:S.physicalName}).filter(V=>!!V));for(const V of g)p.has(V.name)&&(V.name=`${V.name}${N}`),(L=V.table)!=null&&L.physicalName&&k.has(V.table.physicalName)&&(V.table.physicalName=`${V.table.physicalName}${N}`);const I=[];for(const V of l.entityLayouts){const S=y(V.entityRef);if(!S)continue;const x=ko(V);x.entityRef=S,x.geo={...x.geo,location:Wr(x.geo.location,a)},x.attributeStyles&&(x.attributeStyles=na(x.attributeStyles,y)),x.operationStyles&&(x.operationStyles=na(x.operationStyles,y)),I.push(x)}const A=[];for(const V of l.associationLayouts){const S=y(V.associationRef);if(!S)continue;const x=ko(V);x.associationRef=S,x.sourceColumnRef=V.sourceColumnRef?y(V.sourceColumnRef):void 0,x.targetColumnRef=V.targetColumnRef?y(V.targetColumnRef):void 0,x.waypoints=x.waypoints.map(T=>Wr(T,a)),A.push(x)}const $=[];for(const V of l.groupLayouts){const S=y(V.groupRef);if(!S)continue;const x=ko(V);x.groupRef=S,x.geo={...x.geo,location:Wr(x.geo.location,a)},delete x.memberNoteRefs,$.push(x)}return{logical:{entities:g,associations:_,groups:E},layout:{entityLayouts:I,associationLayouts:A,groupLayouts:$},idMap:h}}function Wr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function wg(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 Hc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function na(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Jr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function zn(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>zn(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!zn(e[i],n[i]))return!1;return!0}return!1}function Fn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||zn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Un(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function Ig(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"]),Cg=new Set(["end1","end2","rev"]),xg=new Set(["memberEntityRefs","rev"]),jc=new Set(["modelId"]),Sg=new Set(["modelId","columns"]),Rg=new Set([]);function Ag(e,n,o,i){const a=Un(n.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=Fn(s,c,jc);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Un(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=Fn(s,c,jc);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Un(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!zn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=Fn(s,c,Sg);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function $g(e,n,o){const i=Un(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:Jr(l)});for(const{cur:l,tgt:s}of i.common){const c=Fn(l,s,vg);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Ag(l.modelId,l,s,o)}const a=Un(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:Jr(l)});for(const{cur:l,tgt:s}of a.common){const c=Fn(l,s,Cg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=Fn(l[d]??{},s[d]??{},Rg);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=Un(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:Jr(l)});for(const{cur:l,tgt:s}of r.common){const c=Fn(l,s,xg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Ig(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 oa(e,n,o,i,a,r,l){const s=Un(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)zn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function Tg(e,n,o){oa(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),oa(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),oa(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),oa(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Mg(e,n){const o=[];return $g(e.logical,n.logical,o),Tg(e.layout,n.layout,o),o}function Vg(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 Bg={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 Dg{constructor(n){Xe(this,"out",[]);Xe(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...Qo(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({...Qo(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({...Qo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...Qo(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({...Qo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Qo(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Ht(e,n,o,i){if(o==null||typeof o!="object")return;const a=Bg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Hn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Xr(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function wn(e,n){var r,l,s,c,d,u,m,h;const o=Vg(n),i=new Dg(n.field),a=[...e].sort((f,y)=>f.seq-y.seq);for(const f of a)for(const y of f.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?Ht(i,f,y.value,"entity"):y.kind==="entity.update"?Hn(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 g=Xr((r=y.value)==null?void 0:r.attributes,n.attributeRef);g&&Ht(i,f,g,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?Ht(i,f,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Hn(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 g=Xr((s=y.value)==null?void 0:s.operations,n.operationRef);g&&Ht(i,f,g,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?Ht(i,f,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Hn(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 g=Xr((d=y.value)==null?void 0:d.indexes,n.indexRef);g&&Ht(i,f,g,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?Ht(i,f,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Hn(i,f,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(f);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?Ht(i,f,y.value,"association"):y.kind==="association.update"?Hn(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 g=(m=y.value)==null?void 0:m[n.end];Ht(i,f,g,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Hn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){Ht(i,f,y.value,"group");const g=(h=y.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(g))for(const _ of g)i.member(f,_,!1)}else y.kind==="group.update"?Hn(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 qe={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},Og={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":qe,"entityLayout.remove":qe,"entityLayout.move":qe,"entityLayout.resize":qe,"entityLayout.setCollapsed":qe,"entityLayout.setLocked":qe,"entityLayout.setStyle":qe,"entityLayout.setAttrStyle":qe,"entityLayout.setOpStyle":qe,"groupLayout.add":qe,"groupLayout.remove":qe,"groupLayout.move":qe,"groupLayout.resize":qe,"groupLayout.setLocked":qe,"groupLayout.setStyle":qe,"groupLayout.addNoteMember":qe,"groupLayout.removeNoteMember":qe,"associationLayout.add":qe,"associationLayout.remove":qe,"associationLayout.setWaypoints":qe,"note.add":qe,"note.remove":qe,"note.move":qe,"note.resize":qe,"note.setMemo":qe,"note.setStyle":qe,"noteConnection.add":qe,"noteConnection.remove":qe,"noteConnection.setWaypoints":qe},At=e=>typeof e=="string"?e:void 0,Lg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Kc(e){return At(e.containerRef)??At(e.entityRef)}function Zr(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=At(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function Qr(e){const n=Og[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=At(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Zr(o,"attributes","attribute",a),...Zr(o,"operations","operation",a),...Zr(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Kc(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?Lg(o):At(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=At(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=At(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Pg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=At(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Kc(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=At(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=At(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function zg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Fg(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of Qr(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function ia(e,n){return e.map(o=>({...o,subject:n}))}function Gc(e,n){const o=e.filter(s=>s.ops.some(c=>zg(c,n))),{attributes:i,operations:a,indexes:r}=Fg(o,n),l=[...ia(wn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...ia(wn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...ia(wn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...ia(wn(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 el(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Ug(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of Qr(i))a.existence==="add"&&n.add(el(a.subject));return n}function Hg(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=Pg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function jg(e){const{entities:n,associations:o,groups:i}=Hg(e),a=[];for(const r of n)for(const l of Gc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of wn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of wn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of wn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function tl(e){const n=jg(e),o=Ug(e),i=new Map;for(const l of n){const s=el(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=el(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 Yc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Kg(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of Qr(r)){if(!l.existence||l.inline)continue;const s=l.subject;Gg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const Gg=new Set(["attribute","operation","index"]);function nl(e,n){const{fromSeq:o}=n,i=tl(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const h=Yc(m.subject);let f=s.get(h);f||(f={subject:m.subject,evs:[]},s.set(h,f)),f.evs.push(m)};for(const m of l)for(const h of m.actions)c({seq:m.seq,subject:h.subject,verb:h.verb,fields:h.fields});for(const m of Kg(e,o,r)){const h=s.get(Yc(m.subject));h!=null&&h.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,y)=>f.seq-y.seq);const h=m.evs[m.evs.length-1];m.subject.kind==="entity"&&h.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const h=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||h&&f)continue;const y=new Map;let g=null;for(const E of m.evs){E.verb==="add"&&g!==null&&g!=="add"&&y.clear(),g=E.verb;for(const N of E.fields){const p=y.get(N.field);p?p.lastValue=N.value:y.set(N.field,{firstOld:N.oldValue,hasOld:N.oldValue!==void 0,lastValue:N.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(h){const E=[];for(const[N,p]of y)E.push({field:N,value:p.lastValue});d.push({subject:m.subject,verb:"added",fields:E});continue}const _=[];for(const[E,N]of y)N.hasOld&&zn(N.firstOld,N.lastValue)||_.push({field:E,value:N.lastValue,...N.hasOld?{oldValue:N.firstOld}:{}});_.length!==0&&d.push({subject:m.subject,verb:"modified",fields:_})}return{fromSeq:o,toSeq:r,entries:d}}function qc(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 ol{constructor(n){Xe(this,"undoStack",[]);Xe(this,"redoStack",[]);Xe(this,"savePoint",null);Xe(this,"listeners",new Set);Xe(this,"commandListeners",new Set);Xe(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function Nt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Wc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function mt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function $t(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function Qe(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function rn(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function aa(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=Wc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=mt(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Jc(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Wc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=mt(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(h=>h.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function Xc(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=Qe(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(Qe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(o)}]}}}}function Zc(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=Qe(i,e);o=a.name,a.name=n},invert(i){Qe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function Eo(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=mt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Qc(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=mt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function ei(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 ed(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=ei(r.style,n)},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=mt(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function td(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(n)],invert:[i(o)]}}}}function nd(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function il(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 ra(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=ei(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function la(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 od(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(o)}]}}}}function id(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 ad(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 sa(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 rd(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 ld(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 sd(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=ei(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 jt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){Qe(o,e).attributes.push(n)},invert(o){const i=Qe(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function Kt(e,n,o){const i={},a=r=>{const l=Qe(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(i)}]}}}}function dd(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=Qe(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&Qe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function ud(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 al(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Qe(a,e);i=r.attributes.map(s=>({...s}));const l=qr([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&Qe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).attributes;return ud("attribute.update","attributeRef",e,r,i??[])}}}function md(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=Qe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=Qe(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function fd(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(i)}]}}}}function pd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Qe(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=Qe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function hd(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Qe(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=qr([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=Qe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).operations??[];return ud("operation.update","operationRef",e,r,i??[])}}}function yd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=ei(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function ca(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 gd(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 da(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(o)}]}}}}function Tt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(i)}]}}}}function bd(e,n){return{label:"인덱스 추가",apply(o){const i=Qe(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=Qe(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function ua(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(i)}]}}}}function _d(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Qe(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&Qe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Gt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ti=(e,n)=>{var o;return((o=$t(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function kd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=$t(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=$t(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ti(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Gt(e,r)],invert:[Gt(e,l)]}}}}function Ed(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=$t(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=$t(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ti(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Gt(e,a)],invert:[Gt(e,r)]}}}}function Nd(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=$t(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=$t(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Gt(e,ti(a,e))],invert:[Gt(e,i??[])]}}}}function wd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=$t(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=$t(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Gt(e,ti(o,e))],invert:[Gt(e,n??[])]}}}}function Id(e,n,o){return{label:"waypoint 추가",apply(i){const a=$t(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=$t(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ti(i,e),r=a.slice();return r.splice(n,1),{forward:[Gt(e,a)],invert:[Gt(e,r)]}}}}function vd(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 Cd(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 ni(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 xd(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 Sd(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 Rd(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=ei(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 Ad(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 $d(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 In=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),ma=(e,n,o)=>{var i;return((i=rn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Td(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 Md(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 Vd(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=rn(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=rn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=ma(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[In(e,n,l)],invert:[In(e,n,s)]}}}}function Bd(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=rn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=rn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=ma(a,e,n),l=r.slice();return l.splice(o,1),{forward:[In(e,n,r)],invert:[In(e,n,l)]}}}}function Dd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=rn(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=rn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=ma(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[In(e,n,r)],invert:[In(e,n,l)]}}}}function Od(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=rn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=rn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[In(e,n,ma(i,e,n))],invert:[In(e,n,o??[])]}}}}function We(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const Yg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:ca,addAttribute:jt,addEntity:aa,addEntityToGroup:ad,addGroup:la,addIndex:bd,addNote:vd,addNoteConnection:Td,addNoteConnectionWaypoint:Bd,addNoteToGroup:Ad,addOperation:md,addWaypoint:Id,clearNoteConnectionWaypoints:Od,clearWaypoints:wd,composite:We,moveEntity:Eo,moveGroup:rd,moveNote:ni,moveNoteConnectionWaypoint:Vd,moveWaypoint:kd,removeAssociation:gd,removeAttribute:dd,removeEntity:Jc,removeEntityFromGroup:sa,removeGroup:id,removeIndex:_d,removeNote:Cd,removeNoteConnection:Md,removeNoteConnectionWaypoint:Dd,removeNoteFromGroup:$d,removeOperation:pd,removeWaypoint:Ed,renameEntity:Zc,reorderAttributes:al,reorderOperations:hd,resizeEntity:Qc,resizeGroup:ld,resizeNote:xd,setAllEntitiesCollapsed:il,setAttributeSwatch:ra,setEntityCollapsed:td,setEntityLocked:nd,setEntitySwatch:ed,setGroupLocked:cd,setGroupSwatch:sd,setNoteMemo:Sd,setNoteSwatch:Rd,setOperationSwatch:yd,translateWaypoints:Nd,updateAssociation:da,updateAssociationEnd:Tt,updateAttribute:Kt,updateEntity:Xc,updateGroup:od,updateIndex:ua,updateOperation:fd},Symbol.toStringTag,{value:"Module"}));class Ld{constructor(){Xe(this,"revs",new Map);Xe(this,"layoutVersion",0);Xe(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const qg=[400,1200];function Wg(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function Jg(e){const n=Wg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Xg=e=>new Promise(n=>setTimeout(n,e));class Pd{constructor(n){Xe(this,"cache",new Ld);Xe(this,"newClientOpId");Xe(this,"debounceMs");Xe(this,"retryDelaysMs");Xe(this,"emissions",new WeakMap);Xe(this,"open",null);Xe(this,"debounceHandle",null);Xe(this,"queue",[]);Xe(this,"sending",!1);Xe(this,"_frozen",!1);Xe(this,"stack",null);Xe(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Me,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??qg}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!Jg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Xg(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 zd=["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"],Fd=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Ud(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 Zg(e){return nn(e).length}function rl(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 Qg(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=Yo(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 Hd(e,n,o=Me){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Zg(i);if(a===0)return[];const r=rl(e,n),l=nn(i).map(c=>c.col),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;Qg(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 jd(e,n,o){var h;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const y=r.get(f);if(!y)return[];l.push(y)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,y)=>f===c[y]))return[];const d=new Map(s.map((f,y)=>[f,y])),u=rl(e,n),m=[];for(const f of e.entities)for(const y of f.attributes){if(y.attrType!=="EMBED_OWN"||((h=y.embedded)==null?void 0:h.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const g=c.map(E=>y.dbAttrs[d.get(E)]),_=g.reduce((E,N,p)=>N===y.dbAttrs[p]?E:E+1,0);_&&m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:g,moved:_})}return m}function Kd(e,n,o){var h;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=nn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(nn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,y)=>{c.has(f)&&d.add(y)}),d.size===s.length)return[];const u=rl(e,n),m=[];for(const f of e.entities)for(const y of f.attributes){if(y.attrType!=="EMBED_OWN"||((h=y.embedded)==null?void 0:h.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const g=y.dbAttrs.filter((N,p)=>d.has(p)),_=y.dbAttrs.filter((N,p)=>!d.has(p));y.dbAttrs.some((N,p)=>{if(d.has(p))return!1;const k=l[p],I=!!N.physicalName&&N.physicalName!==((k==null?void 0:k.physicalName)??""),A=N.sharedColumnRef!=null&&N.sharedColumnRef!==(k==null?void 0:k.sharedColumnRef);return I||A})||m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:g,dropped:_})}return m}function eb(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 tb(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 Gd(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function yt(e,n){const o=eb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>ib(i,e))}}function nb(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 ll(e,n){const o=nb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function sl(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 ob=new Set(["name","description","packageName","excludeDDLGeneration"]);function ib(e,n){var a;const o=qi(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(h=>h.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function Yd(e,n){const o=tb(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 ab(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 rb(e,n){const o=ab(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function qd(e,n){const o=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 cl(e){return e.by!==void 0&&e.by!=="name"}function lb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function sb(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function cb(e,n){const o=lb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Wd(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=>i.modelId)}}function Jd(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Xd(e){return Jd(e)&&e.dataType==null}function Zd(e,n,o){const i=Jd(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 Qd(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let h=!1;for(const f of n.fields){const y=u.get(f.name);if(y!=null&&y.sharedColumnPhysicalName){const g={ref:y.sharedColumnPhysicalName,by:"physicalName"},_=qd(Nn(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}),h=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return h?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}const db=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),ub=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),mb=new Set(["description","identifying"]),fb=new Set(["multiplicity","navigable","composition"]),pb=new Set(["name","unique","description","parameters"]),hb=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function No(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 dl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),yb=new Set([...dl].filter(e=>e!=="sharedColumnRef"));function gb(e,n,o,i){if(i||o.some(l=>!yb.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))dl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function bb(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,h)=>{const f=n.fields[h],y=f?c.get(f.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},E=qd(Nn(i,a),_);if(!E.ok){s.push(E.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:E.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:E.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...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 eu(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 tu(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=rb(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 wo(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 _b(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 Ud(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function kb(e,n,o,i,a,r){const l=m=>{const h=new Map;for(const{entityId:f,item:y}of m){if(a.has(f))continue;const g=h.get(f)??[];g.push(y),h.set(f,g)}return h},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,h]of s)if(!c.has(m))for(const f of Kd(n,m,h))u(f);for(const[m,h]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(y=>y.modelId===m?{...y,attributes:[...y.attributes,...h]}:y)};for(const y of Hd(f,m,r))u(y)}}function ul(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of Nc(n,o,i)){for(const u of c.remove)wo(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 Eb(e,n,o={}){const i=o.mkId??Me,a=o.embeddableCatalog??[],r=p=>a.find(k=>k.type===p),l=[],s=[],c=new Map,d=(p,k)=>{const I=c.get(p)??Rt(k);return c.set(p,I+1),I},u=new Map,m=new Set,h=new Set,f={seen:new Set,pairs:[]},y=[],g=new Set,_=(p,k)=>`${p}\0${k}`,E=new Set;for(const p of n)p.kind==="entity.add"&&(E.add(p.spec.name),p.spec.physicalName&&E.add(p.spec.physicalName));const N=new Set;return n.forEach((p,k)=>{var I,A,$,L,V;switch(p.kind){case"entity.add":{const S=e.entities.filter(O=>O.name===p.spec.name).map(O=>O.modelId);if(S.length||N.has(p.spec.name)){s.push({code:"entity-name-conflict",opIndex:k,handle:{ref:p.spec.name},matches:S});break}N.add(p.spec.name);const x=i(),T={modelId:x,name:p.spec.name,stereotype:p.spec.stereotype??"JPA_ENTITY",attributes:[],...p.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...p.spec.physicalName?{table:{physicalName:p.spec.physicalName}}:{}},D={ref:p.spec.name};let b=!1;for(const[O,M]of(p.spec.attributes??[]).entries()){if(M.type==="GroupCodeEnum"&&!M.groupCode){s.push({code:"groupcode-required",opIndex:k,entity:D,handle:{ref:M.name}}),b=!0;continue}if(!r(M.type)&&!((I=M.embeddableOverrides)!=null&&I.length)&&Xd(M)){s.push({code:"datatype-required",opIndex:k,entity:D,handle:{ref:M.name}}),b=!0;continue}const z=r(M.type);if(z){const j=Qd(M,z,O,T,e.entities,k,D,s,i);j?T.attributes.push(j):b=!0}else(A=M.embeddableOverrides)!=null&&A.length?(s.push({code:"embeddable-type-unresolved",opIndex:k,entity:D,handle:{ref:M.name}}),b=!0):T.attributes.push(Zd(M,O,i))}const w=(p.spec.operations??[]).map((O,M)=>eu(O,M,i));w.length&&(T.operations=w);const v=[];for(const O of p.spec.indexes??[]){const M=tu(T,O,k,D,s,i);M?v.push(M):b=!0}if(v.length&&(T.indexes=v),b)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:x,value:T});break}case"entity.update":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=No(p.patch,ub,["jpaAttrs.","table."]);if(x.length){s.push({code:"entity-patch-unknown-key",opIndex:k,entity:p.entity,keys:x});break}const T=p.patch.stereotype;if(typeof T=="string"&&T!==S.value.stereotype&&(T==="JPA_EMBEDDABLE"||S.value.stereotype==="JPA_EMBEDDABLE")){s.push({code:"stereotype-embeddable-transition-unsupported",opIndex:k,entity:p.entity,from:S.value.stereotype??"",to:T});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,patch:p.patch});break}case"entity.remove":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=S.value.modelId,T=e.associations.filter(v=>v.end1.entityRef===x||v.end2.entityRef===x),D=new Set(T.map(v=>v.modelId));for(const v of T)m.has(v.modelId)||(m.add(v.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:v.modelId}));for(const v of e.entities)if(v.modelId!==x)for(const O of v.attributes)O.embedded&&D.has(O.embedded.associationRef)&&wo(l,f,v.modelId,O.modelId);for(const v of T){if(v.end1.entityRef===x||!v.end1.attributeRef)continue;const O=e.entities.find(z=>z.modelId===v.end1.entityRef),M=O==null?void 0:O.attributes.find(z=>z.modelId===v.end1.attributeRef&&z.attrType==="RELATION_REF");M&&wo(l,f,O.modelId,M.modelId)}const b={...e,entities:e.entities.filter(v=>v.modelId!==x),associations:e.associations.filter(v=>!D.has(v.modelId))},w=new Set(T.filter(v=>v.end1.entityRef===x&&v.end2.entityRef!==x).map(v=>v.end2.entityRef));for(const v of w)ul(l,b,v,i,f,d);for(const v of e.groups)v.memberEntityRefs.includes(x)&&(g.has(_(v.modelId,x))||(g.add(_(v.modelId,x)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:v.modelId,groupRef:v.modelId,entityRef:x})));h.add(x),l.push({kind:"entity.remove",casUnit:"logical",entityRef:x});break}case"attribute.add":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}if(p.spec.type==="GroupCodeEnum"&&!p.spec.groupCode){s.push({code:"groupcode-required",opIndex:k,entity:p.entity,handle:{ref:p.spec.name}});break}if(!r(p.spec.type)&&!(($=p.spec.embeddableOverrides)!=null&&$.length)&&Xd(p.spec)){s.push({code:"datatype-required",opIndex:k,entity:p.entity,handle:{ref:p.spec.name}});break}const x=d(S.value.modelId,S.value.attributes),T=r(p.spec.type);let D;if(T)D=Qd(p.spec,T,x,S.value,e.entities,k,p.entity,s,i);else if((L=p.spec.embeddableOverrides)!=null&&L.length){s.push({code:"embeddable-type-unresolved",opIndex:k,entity:p.entity,handle:{ref:p.spec.name}});break}else D=Zd(p.spec,x,i);if(!D)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,value:D}),y.push({entityId:S.value.modelId,attribute:D});break}case"attribute.update":case"attribute.remove":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=Yd(S.value,p.attribute);if(!x.ok){s.push(x.reason==="not-found"?{code:"attribute-not-found",opIndex:k,entity:p.entity,handle:p.attribute}:{code:"attribute-ambiguous",opIndex:k,entity:p.entity,handle:p.attribute,matches:x.matches});break}if(p.kind==="attribute.update"){const T=[],D=[];let b=!1;for(const M of Object.keys(p.patch)){if(M.includes(".")){M.startsWith("dbAttrs.")?b=!0:D.push(M);continue}dl.has(M)?T.push(M):db.has(M)||D.push(M)}if(D.length){s.push({code:"attribute-patch-unknown-key",opIndex:k,entity:p.entity,handle:p.attribute,keys:D});break}if("attrType"in p.patch){const M=String(p.patch.attrType),z=Fd.includes(M)?M!==x.value.attrType?"transition":void 0:"unknown-value";if(z){s.push({code:"attribute-attrtype-unsupported",opIndex:k,entity:p.entity,handle:p.attribute,reason:z,current:x.value.attrType,requested:M});break}}const w="type"in p.patch?p.patch.type:x.value.type,v="groupCode"in p.patch?p.patch.groupCode:x.value.groupCode;if(w==="GroupCodeEnum"&&!v){s.push({code:"groupcode-required",opIndex:k,entity:p.entity,handle:p.attribute});break}let O=p.patch;if(T.length){const M=gb(x.value,p.patch,T,b);if(!M){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:k,entity:p.entity,handle:p.attribute,keys:T});break}O=M}if((V=p.embeddableOverrides)!=null&&V.length){const M=r(x.value.type);if(!M||x.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:k,entity:p.entity,handle:p.attribute});break}const z=bb(x.value,M,p.embeddableOverrides,S.value,e.entities,k,p.entity,s);if(!z)break;O={...O,dbAttrs:z}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,attributeRef:x.value.modelId,patch:O})}else{const T=Xi(e,S.value.modelId,x.value.modelId);if(T){const D=b=>{var w;return((w=e.entities.find(v=>v.modelId===b))==null?void 0:w.name)??b};s.push({code:"attribute-fk-managed",opIndex:k,entity:p.entity,handle:p.attribute,association:{from:D(T.end1.entityRef),to:D(T.end2.entityRef)}});break}wo(l,f,S.value.modelId,x.value.modelId)}break}case"association.add":{const S=yt(e,p.spec.from),x=yt(e,p.spec.to);if(S.ok||s.push(gt(S.reason,k,p.spec.from,S.matches,E)),x.ok||s.push(gt(x.reason,k,p.spec.to,x.matches,E)),!S.ok||!x.ok)break;if(p.spec.identifying&&S.value.modelId===x.value.modelId){s.push({code:"self-identifying",opIndex:k,handle:{from:p.spec.from,to:p.spec.to}});break}if(S.value.stereotype==="JPA_EMBEDDABLE"||x.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:k,handle:{from:p.spec.from,to:p.spec.to}});break}const T=i(),D={modelId:T,...p.spec.identifying!=null?{identifying:p.spec.identifying}:{},end1:{entityRef:S.value.modelId,multiplicity:p.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:x.value.modelId,multiplicity:p.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:p.spec.composition??!1}},b={...e,associations:[...e.associations,D]},w=Jo(b,x.value.modelId,i);w.add[0]&&(D.end2.attributeRef=w.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:D});for(const v of w.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:{...v,order:d(x.value.modelId,x.value.attributes)}});break}case"association.remove":{const S=yt(e,p.association.from),x=yt(e,p.association.to);if(S.ok||s.push(gt(S.reason,k,p.association.from,S.matches,E)),x.ok||s.push(gt(x.reason,k,p.association.to,x.matches,E)),!S.ok||!x.ok)break;const T=Gd(e,S.value.modelId,x.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:k,handle:p.association}:{code:"association-ambiguous",opIndex:k,handle:p.association,matches:T.map(v=>v.modelId)});break}const D=T[0];m.has(D.modelId)||(m.add(D.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:D.modelId}));const b=e.entities.find(v=>v.attributes.some(O=>{var M;return((M=O.embedded)==null?void 0:M.associationRef)===D.modelId}));if(b){const v=b.attributes.find(O=>{var M;return((M=O.embedded)==null?void 0:M.associationRef)===D.modelId});wo(l,f,b.modelId,v.modelId);break}if(D.end1.attributeRef){const v=e.entities.find(M=>M.modelId===D.end1.entityRef),O=v==null?void 0:v.attributes.find(M=>M.modelId===D.end1.attributeRef&&M.attrType==="RELATION_REF");O&&wo(l,f,v.modelId,O.modelId)}const w={...e,associations:e.associations.filter(v=>v.modelId!==D.modelId)};ul(l,w,D.end2.entityRef,i,f,d);break}case"association.update":{const S=nu(e,p.association,k,s,E);if(!S)break;const x=p.patch.identifying,T=typeof x=="boolean"?x:void 0;if(T===!0&&S.end1.entityRef===S.end2.entityRef){s.push({code:"self-identifying",opIndex:k,handle:p.association});break}const D=No(p.patch,mb);if(D.length){s.push({code:"association-patch-unknown-key",opIndex:k,handle:p.association,keys:D});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:S.modelId,associationRef:S.modelId,patch:p.patch}),T!==void 0&&T!==(S.identifying??!1)){const b={...e,associations:e.associations.map(w=>w.modelId===S.modelId?{...w,identifying:T}:w)};ul(l,b,S.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const S=nu(e,p.association,k,s,E);if(!S)break;const x=p.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(p.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:k,handle:p.association});break}const T=No(p.patch,fb,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:k,handle:p.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:S.modelId,associationRef:S.modelId,end:x,patch:p.patch});break}case"index.add":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=tu(S.value,p.spec,k,p.entity,s,i);if(!x)break;l.push({kind:"index.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:x.modelId,value:x});break}case"index.update":case"index.remove":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}if(cl(p.index)){s.push({code:"handle-by-unsupported",opIndex:k,entity:p.entity,handle:p.index,target:"index"});break}const x=cb(S.value,p.index);if(!x.ok){s.push(x.reason==="not-found"?{code:"index-not-found",opIndex:k,entity:p.entity,handle:p.index}:{code:"index-ambiguous",opIndex:k,entity:p.entity,handle:p.index,matches:x.matches});break}if(p.kind==="index.update"){if("columns"in p.patch){s.push({code:"index-columns-patch-unsupported",opIndex:k,entity:p.entity,handle:p.index});break}const T=No(p.patch,pb);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:k,entity:p.entity,handle:p.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:x.value.modelId,patch:p.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:x.value.modelId});break}case"operation.add":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=u.get(S.value.modelId)??(S.value.operations?Rt(S.value.operations):0);u.set(S.value.modelId,x+1);const T=eu(p.spec,x,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}if(cl(p.operation)){s.push({code:"handle-by-unsupported",opIndex:k,entity:p.entity,handle:p.operation,target:"operation"});break}const x=Wd(S.value,p.operation);if(!x.ok){s.push(x.reason==="not-found"?{code:"operation-not-found",opIndex:k,entity:p.entity,handle:p.operation}:{code:"operation-ambiguous",opIndex:k,entity:p.entity,handle:p.operation,matches:x.matches});break}if(p.kind==="operation.update"){const T=No(p.patch,hb);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:k,entity:p.entity,handle:p.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:x.value.modelId,patch:p.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:x.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const S=p.kind==="attribute.reorder",x=yt(e,p.entity);if(!x.ok){s.push(gt(x.reason,k,p.entity,x.matches,E));break}const T=S?p.order:p.operations,D=[],b=new Set;let w=!1;for(const z of T){if(!S&&cl(z)){s.push({code:"handle-by-unsupported",opIndex:k,entity:p.entity,handle:z,target:"operation"}),w=!0;continue}const j=S?Yd(x.value,z):Wd(x.value,z);if(!j.ok){s.push(j.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:k,entity:p.entity,handle:z}:{code:"reorder-handle-ambiguous",opIndex:k,entity:p.entity,handle:z,matches:j.matches}),w=!0;continue}if(b.has(j.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:k,entity:p.entity,handle:z}),w=!0;continue}b.add(j.value.modelId),D.push(j.value)}if(w)break;const O=[...S?x.value.attributes:x.value.operations??[]].sort((z,j)=>z.order-j.order).filter(z=>!b.has(z.modelId)),M=[...D,...O];if(M.forEach((z,j)=>{z.order!==j&&l.push(S?{kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:z.modelId,patch:{order:j}}:{kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:z.modelId,patch:{order:j}})}),S)for(const z of jd(e,x.value.modelId,M.map(j=>j.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:z.entityId,entityRef:z.entityId,attributeRef:z.attributeId,patch:{dbAttrs:z.dbAttrs}});break}case"group.add":{const S=[];let x=!1;for(const b of p.spec.members){const w=yt(e,b);if(!w.ok){s.push(gt(w.reason,k,b,w.matches,E)),x=!0;continue}S.push(w.value.modelId)}if(x)break;const T=i(),D={modelId:T,excludeDDLGeneration:p.spec.excludeDDLGeneration??!1,memberEntityRefs:S,...p.spec.name?{name:p.spec.name}:{},...p.spec.packageName?{packageName:p.spec.packageName}:{},...p.spec.description?{description:p.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:T,value:D});break}case"group.update":{const S=ll(e,p.group);if(!S.ok){s.push(sl(S,k,p.group));break}const x=No(p.patch,ob);if(x.length){s.push({code:"group-patch-unknown-key",opIndex:k,handle:p.group,keys:x});break}l.push({kind:"group.update",casUnit:"logical",containerRef:S.value.modelId,groupRef:S.value.modelId,patch:p.patch});break}case"group.remove":{const S=ll(e,p.group);if(!S.ok){s.push(sl(S,k,p.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:S.value.modelId});break}case"group.addMember":case"group.removeMember":{const S=ll(e,p.group);if(!S.ok){s.push(sl(S,k,p.group));break}const x=yt(e,p.entity);if(!x.ok){s.push(gt(x.reason,k,p.entity,x.matches,E));break}const T=S.value.memberEntityRefs.includes(x.value.modelId);if(p.kind==="group.addMember"?T:!T)break;if(p.kind==="group.removeMember"){if(g.has(_(S.value.modelId,x.value.modelId)))break;g.add(_(S.value.modelId,x.value.modelId))}l.push({kind:p.kind,casUnit:"logical",containerRef:S.value.modelId,groupRef:S.value.modelId,entityRef:x.value.modelId});break}}}),s.length||_b(l,e,f,h),s.length||kb(l,e,f,y,h,i),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function gt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function nu(e,n,o,i,a){const r=yt(e,n.from),l=yt(e,n.to);if(r.ok||i.push(gt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(gt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Gd(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 ou={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},Nb={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},wb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Ib={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},Cb={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}},iu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},xb={type:"object",description:"일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)을 end 로 주면 거부된다(임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...iu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...iu,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},Sb={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...ou,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},Rb={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},Ab={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},$b={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:[...Fd],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},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},Tb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Mb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Vb={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},Bb={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 소관).'},Db={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function it(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const Ob={"entity.add":it("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":it("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":it("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":it("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":it("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":it("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":it("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":it("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":it("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":it("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":it("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":it("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":it("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":it("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":it("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":it("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":it("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":it("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":it("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":it("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":it("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":it("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":it("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},Lb={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},Pb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...vn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},au={anyOf:zd.map(e=>Ob[e])},zb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ou,nameHandle:Nb,groupHandle:Lb,assocHandle:wb,entitySpec:Ib,attrSpec:vb,embeddableOverrides:Cb,assocSpec:xb,indexSpec:Sb,operationSpec:Rb,groupSpec:Ab,entityUpdatePatch:Bb,attrUpdatePatch:$b,assocUpdatePatch:Tb,assocEndUpdatePatch:Db,indexUpdatePatch:Mb,operationUpdatePatch:Vb,groupUpdatePatch:Pb,symbolicOp:au}};function Fb(e,n,o,i={}){const a=i.mkClientOpId??Me,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const ru={location:{x:0,y:0},size:{width:220,height:140}};function lu(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Ub=/^[-=_*~\s]{3,}$/;function Hb(e){return e.attrType&&e.attrType!=="NORMAL"||!Ub.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function jb(e){return e.type===an&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Kb(e,n){if(e.attrType==="DIVIDER"||Hb(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=jb(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(lu)}}function Gb(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 Yb(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 qb(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(Kb),operations:(n=e.operations)==null?void 0:n.map(Gb),indexes:(o=e.indexes)==null?void 0:o.map(Yb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Wb(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??{...ru},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 su(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 ml(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:su(e)}}function Jb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>fl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Xb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:Jb(e),end1:ml(e.end1),end2:ml(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 fl(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 du(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 uu(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(lu)}}function Zb(e,n,o){var k,I;const i=fl(e.end1.attribute),a=fl(e.end2.attribute);if(i===a)return Xb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(I=(k=s.dbAttrs)==null?void 0:k[0])==null?void 0:I.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((A,$)=>Math.max(A,$.order),-1)+1:s.order??0,h={...uu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const f=n.get(r.endModel.refId),y=l.attribute;let g;if(y&&f&&r.navigable){const A=Hi(l.multiplicity);g={modelId:y.modelId??crypto.randomUUID(),name:mo(y.name??Ki((u==null?void 0:u.name)??l.endModel.refId,A),new Set(f.attributes.map($=>$.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce(($,L)=>Math.max($,L.order),-1)+1,dbAttrs:[]},f.attributes.push(g)}const _=(A,$)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:$?g==null?void 0:g.modelId:h.modelId,jpa:su(A)}),E=r.endModel.refId===l.endModel.refId,N={modelId:e.modelId,description:e.description,identifying:!E&&h.identifier===!0?!0:void 0,end1:_(e.end1,i),end2:_(e.end2,a)},p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:h.modelId,targetColumnRef:i?h.modelId:d,style:e.style};return{assoc:N,layout:p}}function Qb(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 e_(e,n,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((g,_)=>Math.max(g,_.order),-1)+1:l.order??0,d={...uu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Qb(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...ml(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function t_(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 mu(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=t_(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 fu(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 n_(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(h=>h.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(h=>h.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=Hi(i.end2.multiplicity),u=Ki(r.name,d),m=mo(u,new Set(a.attributes.map(h=>h.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((h,f)=>Math.max(h,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function o_(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 pu(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&&!qs(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 hu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?i_(n):a_(n)}function i_(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:h,...f}=m;return h!=null&&(o[m.modelId]=h),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);n_(a,r),o_(a,r),pu(a,r);const{version:s,...c}=e.layout;fu(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 a_(e){var E,N;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(p,k)=>{o.push(qb(p));const I=Wb(p);I.geo={location:{x:I.geo.location.x+k.x,y:I.geo.location.y+k.y},size:I.geo.size},i.push(I);for(const A of p.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const p of e.entities??[])d(p,u);const m=[];for(const p of e.groups??[]){const k=p.entities??[];l.push({modelId:p.modelId,name:p.name,description:p.description,packageName:p.packageName,excludeDDLGeneration:p.excludeDDLGeneration??!1,memberEntityRefs:k.map(A=>A.modelId)});const I=((E=p.geo)==null?void 0:E.location)??u;if(p.geo){const A=(p.notes??[]).map($=>$.modelId);s.push({groupRef:p.modelId,geo:p.geo,style:p.style,locked:p.locked,memberNoteRefs:A.length?A:void 0})}for(const A of k)d(A,I);for(const A of p.notes??[])m.push(mu(A,I))}const h=new Map(o.map(p=>[p.modelId,p])),f=new Map,y=new Map;for(const p of o)for(const k of p.attributes)for(const I of k.dbAttrs)f.set(I.modelId,k.modelId),y.set(I.modelId,I);for(const p of c)for(const k of[p.end1,p.end2]){const I=k.attribute;if(I&&(((N=I.dbAttrs)==null?void 0:N.length)??0)>0)for(const A of I.dbAttrs)A.modelId&&f.set(A.modelId,I.modelId)}for(const p of c){const k=cu(p.end1.attribute),I=cu(p.end2.attribute),A=du(p.end1)||du(p.end2),{assoc:$,layout:L}=k!==I||A?e_(p,h,y):Zb(p,h,f);a.push($),r.push(L)}fu(o,a,r),Fc(o),pu(o,a);const g={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(p=>mu(p)),...m]}},_={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:_}}function yu(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 r_(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(yu),style:n}}function l_(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 s_(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 Cn(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 c_(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{...yu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function d_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function gu(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 u_(e){const n=new Set;for(const o of e.logical.associations){const i=gu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function m_(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 f_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function p_(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:f_(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 h_(e,n,o){let i;for(const m of n.logical.entities){const h=m.attributes.find(f=>{var y;return((y=f.embedded)==null?void 0:y.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,h)=>p_(m,l[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Cn(e.end1,c?s:u),end2:Cn(e.end2,c?u:s)}}function y_(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:Cn(e.end1,e.end1.legacyEmbedRaw),end2:Cn(e.end2,e.end2.legacyEmbedRaw)};const a=h_(e,n,i);if(a)return a;const r=gu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?c_(r.fk,l):void 0,c=d_(r.navAttr);return{...i,end1:Cn(e.end1,r.navEnd===e.end1?s:c),end2:Cn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:Cn(e.end1),end2:Cn(e.end2)}}function bu(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(h=>h.entityRef===e.modelId),l=n.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>n.layout.associationLayouts.find(f=>f.associationRef===h),c=(r==null?void 0:r.geo)??{...ru},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var f;return r_(h,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var f;return l_(h,(f=r==null?void 0:r.operationStyles)==null?void 0:f[h.modelId])}),ownedAssociations:l.map(h=>y_(h,n,s(h.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(s_),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 g_(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=>_u(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 _u(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 b_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=u_(e),r=m_(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=>g_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>_u(s))}}function __(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 k_=["notNull"];function E_(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}=hu(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(h=>[h.modelId,h]))]));for(const m of i.logical.entities){const h=c.get(m.modelId);if(h)for(const f of m.attributes){const y=h.get(f.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const g={};for(const _ of k_)f[_]===!0!=(y[_]===!0)&&(g[_]=f[_],s.attributeFieldsByName[_]=(s.attributeFieldsByName[_]??0)+1);Object.keys(g).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:g}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const h=d.get(m.modelId);h&&(m.end1.attributeRef&&m.end1.attributeRef!==h.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&h.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function oi(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function ln(e){return typeof e=="function"?e():t.unref(e)}const N_=typeof window<"u"&&typeof document<"u",w_=e=>typeof e<"u",I_=Object.prototype.toString,v_=e=>I_.call(e)==="[object Object]",C_=()=>{};function x_(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 ku=e=>e();function S_(e=ku){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 Eu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function R_(e,n,o={}){const{eventFilter:i=ku,...a}=o;return t.watch(e,x_(i,n),a)}function Io(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=S_(i);return{stop:R_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function A_(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=ln(n.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function pl(e,n=!1){function o(m,{flush:h="sync",deep:f=!1,timeout:y,throwOnTimeout:g}={}){let _=null;const N=[new Promise(p=>{_=t.watch(e,k=>{m(k)!==n&&(_==null||_(),p(k))},{flush:h,deep:f,immediate:!0})})];return y!=null&&N.push(Eu(y,g).then(()=>ln(e)).finally(()=>_==null?void 0:_())),Promise.race(N)}function i(m,h){if(!t.isRef(m))return o(k=>k===m,h);const{flush:f="sync",deep:y=!1,timeout:g,throwOnTimeout:_}=h??{};let E=null;const p=[new Promise(k=>{E=t.watch([e,m],([I,A])=>{n!==(I===A)&&(E==null||E(),k(I))},{flush:f,deep:y,immediate:!0})})];return g!=null&&p.push(Eu(g,_).then(()=>ln(e)).finally(()=>(E==null||E(),ln(e)))),Promise.race(p)}function a(m){return o(h=>!!h,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,h){return o(f=>{const y=Array.from(f);return y.includes(m)||y.includes(ln(m))},h)}function d(m){return u(1,m)}function u(m=1,h){let f=-1;return o(()=>(f+=1,f>=m),h)}return Array.isArray(ln(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return pl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return pl(e,!n)}}}function hl(e){return pl(e)}function $_(e){var n;const o=ln(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Nu=N_?window:void 0;function wu(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Nu):[n,o,i,a]=e,!n)return C_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,h,f)=>(u.addEventListener(m,h,f),()=>u.removeEventListener(m,h,f)),c=t.watch(()=>[$_(n),ln(a)],([u,m])=>{if(l(),!u)return;const h=v_(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(y=>s(u,f,y,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return oi(d),d}function T_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Iu(...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=Nu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=T_(n);return wu(a,r,u=>{u.repeat&&ln(s)||c(u)&&o(u)},l)}function M_(e){return JSON.parse(JSON.stringify(e))}function yl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:h}=i,f=t.getCurrentInstance(),y=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=d;n||(n="modelValue"),g=g||`update:${n.toString()}`;const _=p=>s?typeof s=="function"?s(p):M_(p):p,E=()=>w_(e[n])?_(e[n]):m,N=p=>{h?h(p)&&y(g,p):y(g,p)};if(c){const p=E(),k=t.ref(p);let I=!1;return t.watch(()=>e[n],A=>{I||(I=!0,k.value=_(A),t.nextTick(()=>I=!1))}),t.watch(k,A=>{!I&&(A!==e[n]||u)&&N(A)},{deep:u}),k}else return t.computed({get(){return E()},set(p){N(p)}})}var V_={value:()=>{}};function fa(){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 pa(o)}function pa(e){this._=e}function B_(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}})}pa.prototype=fa.prototype={constructor:pa,on:function(e,n){var o=this._,i=B_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=D_(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]=vu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=vu(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 pa(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 D_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function vu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=V_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var gl="http://www.w3.org/1999/xhtml";const Cu={svg:"http://www.w3.org/2000/svg",xhtml:gl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ha(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Cu.hasOwnProperty(n)?{space:Cu[n],local:e}:e}function O_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===gl&&n.documentElement.namespaceURI===gl?n.createElement(e):n.createElementNS(o,e)}}function L_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function xu(e){var n=ha(e);return(n.local?L_:O_)(n)}function P_(){}function bl(e){return e==null?P_:function(){return this.querySelector(e)}}function z_(e){typeof e!="function"&&(e=bl(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new xt(i,this._parents)}function F_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function U_(){return[]}function Su(e){return e==null?U_:function(){return this.querySelectorAll(e)}}function H_(e){return function(){return F_(e.apply(this,arguments))}}function j_(e){typeof e=="function"?e=H_(e):e=Su(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new xt(i,a)}function Ru(e){return function(){return this.matches(e)}}function Au(e){return function(n){return n.matches(e)}}var K_=Array.prototype.find;function G_(e){return function(){return K_.call(this.children,e)}}function Y_(){return this.firstElementChild}function q_(e){return this.select(e==null?Y_:G_(typeof e=="function"?e:Au(e)))}var W_=Array.prototype.filter;function J_(){return Array.from(this.children)}function X_(e){return function(){return W_.call(this.children,e)}}function Z_(e){return this.selectAll(e==null?J_:X_(typeof e=="function"?e:Au(e)))}function Q_(e){typeof e!="function"&&(e=Ru(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new xt(i,this._parents)}function $u(e){return new Array(e.length)}function ek(){return new xt(this._enter||this._groups.map($u),this._parents)}function ya(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ya.prototype={constructor:ya,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 tk(e){return function(){return e}}function nk(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 ya(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function ok(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(h[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ya(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function ik(e){return e.__data__}function ak(e,n){if(!arguments.length)return Array.from(this,ik);var o=n?ok:nk,i=this._parents,a=this._groups;typeof e!="function"&&(e=tk(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,f=rk(e.call(u,u&&u.__data__,d,i)),y=f.length,g=s[d]=new Array(y),_=l[d]=new Array(y),E=c[d]=new Array(h);o(u,m,g,_,E,f,n);for(var N=0,p=0,k,I;N<y;++N)if(k=g[N]){for(N>=p&&(p=N+1);!(I=_[p])&&++p<y;);k._next=I||null}}return l=new xt(l,i),l._enter=s,l._exit=c,l}function rk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lk(){return new xt(this._exit||this._groups.map($u),this._parents)}function sk(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 ck(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),f,y=0;y<m;++y)(f=d[y]||u[y])&&(h[y]=f);for(;c<a;++c)s[c]=o[c];return new xt(s,this._parents)}function dk(){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 uk(e){e||(e=mk);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new xt(a,this._parents).order()}function mk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function fk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pk(){return Array.from(this)}function hk(){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 yk(){let e=0;for(const n of this)++e;return e}function gk(){return!this.node()}function bk(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 _k(e){return function(){this.removeAttribute(e)}}function kk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ek(e,n){return function(){this.setAttribute(e,n)}}function Nk(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function wk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Ik(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=ha(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?kk:_k:typeof n=="function"?o.local?Ik:wk:o.local?Nk:Ek)(o,n))}function Tu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ck(e){return function(){this.style.removeProperty(e)}}function xk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Sk(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Rk(e,n,o){return arguments.length>1?this.each((n==null?Ck:typeof n=="function"?Sk:xk)(e,n,o??"")):vo(this.node(),e)}function vo(e,n){return e.style.getPropertyValue(n)||Tu(e).getComputedStyle(e,null).getPropertyValue(n)}function Ak(e){return function(){delete this[e]}}function $k(e,n){return function(){this[e]=n}}function Tk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Mk(e,n){return arguments.length>1?this.each((n==null?Ak:typeof n=="function"?Tk:$k)(e,n)):this.node()[e]}function Mu(e){return e.trim().split(/^|\s+/)}function _l(e){return e.classList||new Vu(e)}function Vu(e){this._node=e,this._names=Mu(e.getAttribute("class")||"")}Vu.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Bu(e,n){for(var o=_l(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Du(e,n){for(var o=_l(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Vk(e){return function(){Bu(this,e)}}function Bk(e){return function(){Du(this,e)}}function Dk(e,n){return function(){(n.apply(this,arguments)?Bu:Du)(this,e)}}function Ok(e,n){var o=Mu(e+"");if(arguments.length<2){for(var i=_l(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Dk:n?Vk:Bk)(o,n))}function Lk(){this.textContent=""}function Pk(e){return function(){this.textContent=e}}function zk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Fk(e){return arguments.length?this.each(e==null?Lk:(typeof e=="function"?zk:Pk)(e)):this.node().textContent}function Uk(){this.innerHTML=""}function Hk(e){return function(){this.innerHTML=e}}function jk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Kk(e){return arguments.length?this.each(e==null?Uk:(typeof e=="function"?jk:Hk)(e)):this.node().innerHTML}function Gk(){this.nextSibling&&this.parentNode.appendChild(this)}function Yk(){return this.each(Gk)}function qk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Wk(){return this.each(qk)}function Jk(e){var n=typeof e=="function"?e:xu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Xk(){return null}function Zk(e,n){var o=typeof e=="function"?e:xu(e),i=n==null?Xk:typeof n=="function"?n:bl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Qk(){var e=this.parentNode;e&&e.removeChild(this)}function eE(){return this.each(Qk)}function tE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function nE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function oE(e){return this.select(e?nE:tE)}function iE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function aE(e){return function(n){e.call(this,n,this.__data__)}}function rE(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 lE(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 sE(e,n,o){return function(){var i=this.__on,a,r=aE(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 cE(e,n,o){var i=rE(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?sE:lE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Ou(e,n,o){var i=Tu(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 dE(e,n){return function(){return Ou(this,e,n)}}function uE(e,n){return function(){return Ou(this,e,n.apply(this,arguments))}}function mE(e,n){return this.each((typeof n=="function"?uE:dE)(e,n))}function*fE(){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 Lu=[null];function xt(e,n){this._groups=e,this._parents=n}function ii(){return new xt([[document.documentElement]],Lu)}function pE(){return this}xt.prototype=ii.prototype={constructor:xt,select:z_,selectAll:j_,selectChild:q_,selectChildren:Z_,filter:Q_,data:ak,enter:ek,exit:lk,join:sk,merge:ck,selection:pE,order:dk,sort:uk,call:fk,nodes:pk,node:hk,size:yk,empty:gk,each:bk,attr:vk,style:Rk,property:Mk,classed:Ok,text:Fk,html:Kk,raise:Yk,lower:Wk,append:Jk,insert:Zk,remove:eE,clone:oE,datum:iE,on:cE,dispatch:mE,[Symbol.iterator]:fE};function Mt(e){return typeof e=="string"?new xt([[document.querySelector(e)]],[document.documentElement]):new xt([[e]],Lu)}function hE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Yt(e,n){if(e=hE(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 yE={passive:!1},ai={capture:!0,passive:!1};function kl(e){e.stopImmediatePropagation()}function Co(e){e.preventDefault(),e.stopImmediatePropagation()}function Pu(e){var n=e.document.documentElement,o=Mt(e).on("dragstart.drag",Co,ai);"onselectstart"in n?o.on("selectstart.drag",Co,ai):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function zu(e,n){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Co,ai),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 ga=e=>()=>e;function El(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}})}El.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function gE(e){return!e.ctrlKey&&!e.button}function bE(){return this.parentNode}function _E(e,n){return n??{x:e.x,y:e.y}}function kE(){return navigator.maxTouchPoints||"ontouchstart"in this}function EE(){var e=gE,n=bE,o=_E,i=kE,a={},r=fa("start","drag","end"),l=0,s,c,d,u,m=0;function h(k){k.on("mousedown.drag",f).filter(i).on("touchstart.drag",_).on("touchmove.drag",E,yE).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(k,I){if(!(u||!e.call(this,k,I))){var A=p(this,n.call(this,k,I),k,I,"mouse");A&&(Mt(k.view).on("mousemove.drag",y,ai).on("mouseup.drag",g,ai),Pu(k.view),kl(k),d=!1,s=k.clientX,c=k.clientY,A("start",k))}}function y(k){if(Co(k),!d){var I=k.clientX-s,A=k.clientY-c;d=I*I+A*A>m}a.mouse("drag",k)}function g(k){Mt(k.view).on("mousemove.drag mouseup.drag",null),zu(k.view,d),Co(k),a.mouse("end",k)}function _(k,I){if(e.call(this,k,I)){var A=k.changedTouches,$=n.call(this,k,I),L=A.length,V,S;for(V=0;V<L;++V)(S=p(this,$,k,I,A[V].identifier,A[V]))&&(kl(k),S("start",k,A[V]))}}function E(k){var I=k.changedTouches,A=I.length,$,L;for($=0;$<A;++$)(L=a[I[$].identifier])&&(Co(k),L("drag",k,I[$]))}function N(k){var I=k.changedTouches,A=I.length,$,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),$=0;$<A;++$)(L=a[I[$].identifier])&&(kl(k),L("end",k,I[$]))}function p(k,I,A,$,L,V){var S=r.copy(),x=Yt(V||A,I),T,D,b;if((b=o.call(k,new El("beforestart",{sourceEvent:A,target:h,identifier:L,active:l,x:x[0],y:x[1],dx:0,dy:0,dispatch:S}),$))!=null)return T=b.x-x[0]||0,D=b.y-x[1]||0,function w(v,O,M){var z=x,j;switch(v){case"start":a[L]=w,j=l++;break;case"end":delete a[L],--l;case"drag":x=Yt(M||O,I),j=l;break}S.call(v,k,new El(v,{sourceEvent:O,subject:b,target:h,identifier:L,active:j,x:x[0]+T,y:x[1]+D,dx:x[0]-z[0],dy:x[1]-z[1],dispatch:S}),$)}}return h.filter=function(k){return arguments.length?(e=typeof k=="function"?k:ga(!!k),h):e},h.container=function(k){return arguments.length?(n=typeof k=="function"?k:ga(k),h):n},h.subject=function(k){return arguments.length?(o=typeof k=="function"?k:ga(k),h):o},h.touchable=function(k){return arguments.length?(i=typeof k=="function"?k:ga(!!k),h):i},h.on=function(){var k=r.on.apply(r,arguments);return k===r?h:k},h.clickDistance=function(k){return arguments.length?(m=(k=+k)*k,h):Math.sqrt(m)},h}function Nl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Fu(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ri(){}var li=.7,ba=1/li,xo="\\s*([+-]?\\d+)\\s*",si="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",NE=/^#([0-9a-f]{3,8})$/,wE=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),IE=new RegExp(`^rgb\\(${qt},${qt},${qt}\\)$`),vE=new RegExp(`^rgba\\(${xo},${xo},${xo},${si}\\)$`),CE=new RegExp(`^rgba\\(${qt},${qt},${qt},${si}\\)$`),xE=new RegExp(`^hsl\\(${si},${qt},${qt}\\)$`),SE=new RegExp(`^hsla\\(${si},${qt},${qt},${si}\\)$`),Uu={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};Nl(ri,jn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Hu,formatHex:Hu,formatHex8:RE,formatHsl:AE,formatRgb:ju,toString:ju});function Hu(){return this.rgb().formatHex()}function RE(){return this.rgb().formatHex8()}function AE(){return Wu(this).formatHsl()}function ju(){return this.rgb().formatRgb()}function jn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=NE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Ku(n):o===3?new wt(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=wE.exec(e))?new wt(n[1],n[2],n[3],1):(n=IE.exec(e))?new wt(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=CE.exec(e))?_a(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=xE.exec(e))?qu(n[1],n[2]/100,n[3]/100,1):(n=SE.exec(e))?qu(n[1],n[2]/100,n[3]/100,n[4]):Uu.hasOwnProperty(e)?Ku(Uu[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function Ku(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function _a(e,n,o,i){return i<=0&&(e=n=o=NaN),new wt(e,n,o,i)}function $E(e){return e instanceof ri||(e=jn(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function wl(e,n,o,i){return arguments.length===1?$E(e):new wt(e,n,o,i??1)}function wt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Nl(wt,wl,Fu(ri,{brighter(e){return e=e==null?ba:Math.pow(ba,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?li:Math.pow(li,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(Kn(this.r),Kn(this.g),Kn(this.b),ka(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:Gu,formatHex:Gu,formatHex8:TE,formatRgb:Yu,toString:Yu}));function Gu(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function TE(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Yu(){const e=ka(this.opacity);return`${e===1?"rgb(":"rgba("}${Kn(this.r)}, ${Kn(this.g)}, ${Kn(this.b)}${e===1?")":`, ${e})`}`}function ka(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gn(e){return e=Kn(e),(e<16?"0":"")+e.toString(16)}function qu(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Vt(e,n,o,i)}function Wu(e){if(e instanceof Vt)return new Vt(e.h,e.s,e.l,e.opacity);if(e instanceof ri||(e=jn(e)),!e)return new Vt;if(e instanceof Vt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Vt(l,s,c,e.opacity)}function ME(e,n,o,i){return arguments.length===1?Wu(e):new Vt(e,n,o,i??1)}function Vt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Nl(Vt,ME,Fu(ri,{brighter(e){return e=e==null?ba:Math.pow(ba,e),new Vt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?li:Math.pow(li,e),new Vt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new wt(Il(e>=240?e-240:e+120,a,i),Il(e,a,i),Il(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Vt(Ju(this.h),Ea(this.s),Ea(this.l),ka(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=ka(this.opacity);return`${e===1?"hsl(":"hsla("}${Ju(this.h)}, ${Ea(this.s)*100}%, ${Ea(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ju(e){return e=(e||0)%360,e<0?e+360:e}function Ea(e){return Math.max(0,Math.min(1,e||0))}function Il(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 vl=e=>()=>e;function VE(e,n){return function(o){return e+o*n}}function BE(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 DE(e){return(e=+e)==1?Xu:function(n,o){return o-n?BE(n,o,e):vl(isNaN(n)?o:n)}}function Xu(e,n){var o=n-e;return o?VE(e,o):vl(isNaN(e)?n:e)}const Na=(function e(n){var o=DE(n);function i(a,r){var l=o((a=wl(a)).r,(r=wl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Xu(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 OE(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 LE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function PE(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]=ci(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 zE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function Wt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function FE(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]=ci(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Cl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xl=new RegExp(Cl.source,"g");function UE(e){return function(){return e}}function HE(e){return function(n){return e(n)+""}}function Zu(e,n){var o=Cl.lastIndex=xl.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Cl.exec(e))&&(a=xl.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Wt(i,a)})),o=xl.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?HE(c[0].x):UE(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 ci(e,n){var o=typeof n,i;return n==null||o==="boolean"?vl(n):(o==="number"?Wt:o==="string"?(i=jn(n))?(n=i,Na):Zu:n instanceof jn?Na:n instanceof Date?zE:LE(n)?OE:Array.isArray(n)?PE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?FE:Wt)(e,n)}var Qu=180/Math.PI,Sl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function em(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)*Qu,skewX:Math.atan(c)*Qu,scaleX:l,scaleY:s}}var wa;function jE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Sl:em(n.a,n.b,n.c,n.d,n.e,n.f)}function KE(e){return e==null||(wa||(wa=document.createElementNS("http://www.w3.org/2000/svg","g")),wa.setAttribute("transform",e),!(e=wa.transform.baseVal.consolidate()))?Sl:(e=e.matrix,em(e.a,e.b,e.c,e.d,e.e,e.f))}function tm(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,f,y){if(d!==m||u!==h){var g=f.push("translate(",null,n,null,o);y.push({i:g-4,x:Wt(d,m)},{i:g-2,x:Wt(u,h)})}else(m||h)&&f.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Wt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Wt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,f,y){if(d!==m||u!==h){var g=f.push(a(f)+"scale(",null,",",null,")");y.push({i:g-4,x:Wt(d,m)},{i:g-2,x:Wt(u,h)})}else(m!==1||h!==1)&&f.push(a(f)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(f){for(var y=-1,g=h.length,_;++y<g;)m[(_=h[y]).i]=_.x(f);return m.join("")}}}var GE=tm(jE,"px, ","px)","deg)"),YE=tm(KE,", ",")",")"),qE=1e-12;function nm(e){return((e=Math.exp(e))+1/e)/2}function WE(e){return((e=Math.exp(e))-1/e)/2}function JE(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ia=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],f=u-s,y=m-c,g=f*f+y*y,_,E;if(g<qE)E=Math.log(h/d)/n,_=function($){return[s+$*f,c+$*y,d*Math.exp(n*$*E)]};else{var N=Math.sqrt(g),p=(h*h-d*d+i*g)/(2*d*o*N),k=(h*h-d*d-i*g)/(2*h*o*N),I=Math.log(Math.sqrt(p*p+1)-p),A=Math.log(Math.sqrt(k*k+1)-k);E=(A-I)/n,_=function($){var L=$*E,V=nm(I),S=d/(o*N)*(V*JE(n*L+I)-WE(I));return[s+S*f,c+S*y,d*V/nm(n*L+I)]}}return _.duration=E*1e3*n/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var So=0,di=0,ui=0,om=1e3,va,mi,Ca=0,Yn=0,xa=0,fi=typeof performance=="object"&&performance.now?performance:Date,im=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Rl(){return Yn||(im(XE),Yn=fi.now()+xa)}function XE(){Yn=0}function Sa(){this._call=this._time=this._next=null}Sa.prototype=am.prototype={constructor:Sa,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Rl():+o)+(n==null?0:+n),!this._next&&mi!==this&&(mi?mi._next=this:va=this,mi=this),this._call=e,this._time=o,Al()},stop:function(){this._call&&(this._call=null,this._time=1/0,Al())}};function am(e,n,o){var i=new Sa;return i.restart(e,n,o),i}function ZE(){Rl(),++So;for(var e=va,n;e;)(n=Yn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--So}function rm(){Yn=(Ca=fi.now())+xa,So=di=0;try{ZE()}finally{So=0,e1(),Yn=0}}function QE(){var e=fi.now(),n=e-Ca;n>om&&(xa-=n,Ca=e)}function e1(){for(var e,n=va,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:va=o);mi=e,Al(i)}function Al(e){if(!So){di&&(di=clearTimeout(di));var n=e-Yn;n>24?(e<1/0&&(di=setTimeout(rm,e-fi.now()-xa)),ui&&(ui=clearInterval(ui))):(ui||(Ca=fi.now(),ui=setInterval(QE,om)),So=1,im(rm))}}function lm(e,n,o){var i=new Sa;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var t1=fa("start","end","cancel","interrupt"),n1=[],sm=0,cm=1,$l=2,Ra=3,dm=4,Tl=5,Aa=6;function $a(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;o1(e,o,{name:n,index:i,group:a,on:t1,tween:n1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:sm})}function Ml(e,n){var o=Bt(e,n);if(o.state>sm)throw new Error("too late; already scheduled");return o}function Jt(e,n){var o=Bt(e,n);if(o.state>Ra)throw new Error("too late; already running");return o}function Bt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function o1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=am(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,h,f;if(o.state!==cm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Ra)return lm(l);f.state===dm?(f.state=Aa,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Aa,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(lm(function(){o.state===Ra&&(o.state=dm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=$l,o.on.call("start",e,e.__data__,o.index,o.group),o.state===$l){for(o.state=Ra,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Tl,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Tl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Aa,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Ta(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>$l&&i.state<Tl,i.state=Aa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function i1(e){return this.each(function(){Ta(this,e)})}function a1(e,n){var o,i;return function(){var a=Jt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function r1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Jt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function l1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Bt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?a1:r1)(o,e,n))}function Vl(e,n,o){var i=e._id;return e.each(function(){var a=Jt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Bt(a,i).value[n]}}function um(e,n){var o;return(typeof n=="number"?Wt:n instanceof jn?Na:(o=jn(n))?(n=o,Na):Zu)(e,n)}function s1(e){return function(){this.removeAttribute(e)}}function c1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function d1(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 u1(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 m1(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 f1(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 p1(e,n){var o=ha(e),i=o==="transform"?YE:um;return this.attrTween(e,typeof n=="function"?(o.local?f1:m1)(o,i,Vl(this,"attr."+e,n)):n==null?(o.local?c1:s1)(o):(o.local?u1:d1)(o,i,n))}function h1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function y1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function g1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&y1(e,r)),o}return a._value=n,a}function b1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&h1(e,r)),o}return a._value=n,a}function _1(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=ha(e);return this.tween(o,(i.local?g1:b1)(i,n))}function k1(e,n){return function(){Ml(this,e).delay=+n.apply(this,arguments)}}function E1(e,n){return n=+n,function(){Ml(this,e).delay=n}}function N1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?k1:E1)(n,e)):Bt(this.node(),n).delay}function w1(e,n){return function(){Jt(this,e).duration=+n.apply(this,arguments)}}function I1(e,n){return n=+n,function(){Jt(this,e).duration=n}}function v1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?w1:I1)(n,e)):Bt(this.node(),n).duration}function C1(e,n){if(typeof n!="function")throw new Error;return function(){Jt(this,e).ease=n}}function x1(e){var n=this._id;return arguments.length?this.each(C1(n,e)):Bt(this.node(),n).ease}function S1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Jt(this,e).ease=o}}function R1(e){if(typeof e!="function")throw new Error;return this.each(S1(this._id,e))}function A1(e){typeof e!="function"&&(e=Ru(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new sn(i,this._parents,this._name,this._id)}function $1(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,f=0;f<u;++f)(h=c[f]||d[f])&&(m[f]=h);for(;s<i;++s)l[s]=n[s];return new sn(l,this._parents,this._name,this._id)}function T1(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 M1(e,n,o){var i,a,r=T1(n)?Ml:Jt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function V1(e,n){var o=this._id;return arguments.length<2?Bt(this.node(),o).on.on(e):this.each(M1(o,e,n))}function B1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function D1(){return this.on("end.remove",B1(this._id))}function O1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=bl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,$a(d[h],n,o,h,d,Bt(u,o)));return new sn(r,this._parents,n,o)}function L1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Su(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),f,y=Bt(u,o),g=0,_=h.length;g<_;++g)(f=h[g])&&$a(f,n,o,g,h,y);r.push(h),l.push(u)}return new sn(r,l,n,o)}var P1=ii.prototype.constructor;function z1(){return new P1(this._groups,this._parents)}function F1(e,n){var o,i,a;return function(){var r=vo(this,e),l=(this.style.removeProperty(e),vo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function mm(e){return function(){this.style.removeProperty(e)}}function U1(e,n,o){var i,a=o+"",r;return function(){var l=vo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function H1(e,n,o){var i,a,r;return function(){var l=vo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),vo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function j1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Jt(this,e),d=c.on,u=c.value[r]==null?s||(s=mm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function K1(e,n,o){var i=(e+="")=="transform"?GE:um;return n==null?this.styleTween(e,F1(e,i)).on("end.style."+e,mm(e)):typeof n=="function"?this.styleTween(e,H1(e,i,Vl(this,"style."+e,n))).each(j1(this._id,e)):this.styleTween(e,U1(e,i,n),o).on("end.style."+e,null)}function G1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function Y1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&G1(e,l,o)),i}return r._value=n,r}function q1(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,Y1(e,n,o??""))}function W1(e){return function(){this.textContent=e}}function J1(e){return function(){var n=e(this);this.textContent=n??""}}function X1(e){return this.tween("text",typeof e=="function"?J1(Vl(this,"text",e)):W1(e==null?"":e+""))}function Z1(e){return function(n){this.textContent=e.call(this,n)}}function Q1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&Z1(a)),n}return i._value=e,i}function e0(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,Q1(e))}function t0(){for(var e=this._name,n=this._id,o=fm(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Bt(c,n);$a(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new sn(i,this._parents,e,o)}function n0(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Jt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var o0=0;function sn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function fm(){return++o0}var cn=ii.prototype;sn.prototype={constructor:sn,select:O1,selectAll:L1,selectChild:cn.selectChild,selectChildren:cn.selectChildren,filter:A1,merge:$1,selection:z1,transition:t0,call:cn.call,nodes:cn.nodes,node:cn.node,size:cn.size,empty:cn.empty,each:cn.each,on:V1,attr:p1,attrTween:_1,style:K1,styleTween:q1,text:X1,textTween:e0,remove:D1,tween:l1,delay:N1,duration:v1,ease:x1,easeVarying:R1,end:n0,[Symbol.iterator]:cn[Symbol.iterator]};function i0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var a0={time:null,delay:0,duration:250,ease:i0};function r0(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 l0(e){var n,o;e instanceof sn?(n=e._id,e=e._name):(n=fm(),(o=a0).time=Rl(),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])&&$a(c,e,n,d,l,o||r0(c,n));return new sn(i,this._parents,e,n)}ii.prototype.interrupt=i1,ii.prototype.transition=l0;const Ma=e=>()=>e;function s0(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function dn(e,n,o){this.k=e,this.x=n,this.y=o}dn.prototype={constructor:dn,scale:function(e){return e===1?this:new dn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new dn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ro=new dn(1,0,0);dn.prototype;function Bl(e){e.stopImmediatePropagation()}function pi(e){e.preventDefault(),e.stopImmediatePropagation()}function c0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function d0(){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 pm(){return this.__zoom||Ro}function u0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function m0(){return navigator.maxTouchPoints||"ontouchstart"in this}function f0(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 p0(){var e=c0,n=d0,o=f0,i=u0,a=m0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ia,d=fa("start","zoom","end"),u,m,h,f=500,y=150,g=0,_=10;function E(b){b.property("__zoom",pm).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",x).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(b,w,v,O){var M=b.selection?b.selection():b;M.property("__zoom",pm),b!==M?I(b,w,v,O):M.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},E.scaleBy=function(b,w,v,O){E.scaleTo(b,function(){var M=this.__zoom.k,z=typeof w=="function"?w.apply(this,arguments):w;return M*z},v,O)},E.scaleTo=function(b,w,v,O){E.transform(b,function(){var M=n.apply(this,arguments),z=this.__zoom,j=v==null?k(M):typeof v=="function"?v.apply(this,arguments):v,ie=z.invert(j),pe=typeof w=="function"?w.apply(this,arguments):w;return o(p(N(z,pe),j,ie),M,l)},v,O)},E.translateBy=function(b,w,v,O){E.transform(b,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,O)},E.translateTo=function(b,w,v,O,M){E.transform(b,function(){var z=n.apply(this,arguments),j=this.__zoom,ie=O==null?k(z):typeof O=="function"?O.apply(this,arguments):O;return o(Ro.translate(ie[0],ie[1]).scale(j.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),z,l)},O,M)};function N(b,w){return w=Math.max(r[0],Math.min(r[1],w)),w===b.k?b:new dn(w,b.x,b.y)}function p(b,w,v){var O=w[0]-v[0]*b.k,M=w[1]-v[1]*b.k;return O===b.x&&M===b.y?b:new dn(b.k,O,M)}function k(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function I(b,w,v,O){b.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var M=this,z=arguments,j=A(M,z).event(O),ie=n.apply(M,z),pe=v==null?k(ie):typeof v=="function"?v.apply(M,z):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=M.__zoom,me=typeof w=="function"?w.apply(M,z):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new dn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}j.zoom(null,ke)}})}function A(b,w,v){return!v&&b.__zooming||new $(b,w)}function $(b,w){this.that=b,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(b,w),this.taps=0}$.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,w){return this.mouse&&b!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var w=Mt(this.that).datum();d.call(b,this.that,new s0(b,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),w)}};function L(b,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(b),O=this.__zoom,M=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),z=Yt(b);if(v.wheel)(v.mouse[0][0]!==z[0]||v.mouse[0][1]!==z[1])&&(v.mouse[1]=O.invert(v.mouse[0]=z)),clearTimeout(v.wheel);else{if(O.k===M)return;v.mouse=[z,O.invert(z)],Ta(this),v.start()}pi(b),v.wheel=setTimeout(j,y),v.zoom("mouse",o(p(N(O,M),v.mouse[0],v.mouse[1]),v.extent,l));function j(){v.wheel=null,v.end()}}function V(b,...w){if(h||!e.apply(this,arguments))return;var v=b.currentTarget,O=A(this,w,!0).event(b),M=Mt(b.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),z=Yt(b,v),j=b.clientX,ie=b.clientY;Pu(b.view),Bl(b),O.mouse=[z,this.__zoom.invert(z)],Ta(this),O.start();function pe(ge){if(pi(ge),!O.moved){var me=ge.clientX-j,se=ge.clientY-ie;O.moved=me*me+se*se>g}O.event(ge).zoom("mouse",o(p(O.that.__zoom,O.mouse[0]=Yt(ge,v),O.mouse[1]),O.extent,l))}function ye(ge){M.on("mousemove.zoom mouseup.zoom",null),zu(ge.view,O.moved),pi(ge),O.event(ge).end()}}function S(b,...w){if(e.apply(this,arguments)){var v=this.__zoom,O=Yt(b.changedTouches?b.changedTouches[0]:b,this),M=v.invert(O),z=v.k*(b.shiftKey?.5:2),j=o(p(N(v,z),O,M),n.apply(this,w),l);pi(b),s>0?Mt(this).transition().duration(s).call(I,j,O,b):Mt(this).call(E.transform,j,O,b)}}function x(b,...w){if(e.apply(this,arguments)){var v=b.touches,O=v.length,M=A(this,w,b.changedTouches.length===O).event(b),z,j,ie,pe;for(Bl(b),j=0;j<O;++j)ie=v[j],pe=Yt(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],M.touch0?!M.touch1&&M.touch0[2]!==pe[2]&&(M.touch1=pe,M.taps=0):(M.touch0=pe,z=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),z&&(M.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),Ta(this),M.start())}}function T(b,...w){if(this.__zooming){var v=A(this,w).event(b),O=b.changedTouches,M=O.length,z,j,ie,pe;for(pi(b),z=0;z<M;++z)j=O[z],ie=Yt(j,this),v.touch0&&v.touch0[2]===j.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===j.identifier&&(v.touch1[0]=ie);if(j=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;j=N(j,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(p(j,ie,pe),v.extent,l))}}function D(b,...w){if(this.__zooming){var v=A(this,w).event(b),O=b.changedTouches,M=O.length,z,j;for(Bl(b),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),z=0;z<M;++z)j=O[z],v.touch0&&v.touch0[2]===j.identifier?delete v.touch0:v.touch1&&v.touch1[2]===j.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(j=Yt(j,this),Math.hypot(m[0]-j[0],m[1]-j[1])<_)){var ie=Mt(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return E.wheelDelta=function(b){return arguments.length?(i=typeof b=="function"?b:Ma(+b),E):i},E.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Ma(!!b),E):e},E.touchable=function(b){return arguments.length?(a=typeof b=="function"?b:Ma(!!b),E):a},E.extent=function(b){return arguments.length?(n=typeof b=="function"?b:Ma([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),E):n},E.scaleExtent=function(b){return arguments.length?(r[0]=+b[0],r[1]=+b[1],E):[r[0],r[1]]},E.translateExtent=function(b){return arguments.length?(l[0][0]=+b[0][0],l[1][0]=+b[1][0],l[0][1]=+b[0][1],l[1][1]=+b[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(b){return arguments.length?(o=b,E):o},E.duration=function(b){return arguments.length?(s=+b,E):s},E.interpolate=function(b){return arguments.length?(c=b,E):c},E.on=function(){var b=d.on.apply(d,arguments);return b===d?E:b},E.clickDistance=function(b){return arguments.length?(g=(b=+b)*b,E):Math.sqrt(g)},E.tapDistance=function(b){return arguments.length?(_=+b,E):_},E}var $e=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))($e||{}),Dl=(e=>(e.Partial="partial",e.Full="full",e))(Dl||{}),qn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(qn||{}),un=(e=>(e.Strict="strict",e.Loose="loose",e))(un||{}),Ol=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Ol||{}),hi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(hi||{}),hm=(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))(hm||{});const h0=["INPUT","SELECT","TEXTAREA"],y0=typeof document<"u"?document:null;function Ll(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 h0.includes(i==null?void 0:i.nodeName)||a||!!r}function g0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ym(e,n,o,i){const a=n.replace("+",`
|
|
27
|
+
`}}const na="com.example",gg="command.domain";function ei(e,n,o={}){const i=Ji(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??gg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const bg="CustomMoneyType",_g="Money";function kg(e){return!(e.type!==bg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Eg(e){const n=e.dbAttrs[0]??{modelId:De(),physicalName:"",dataType:""},o={modelId:De(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:_g,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Ng(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>kg(l)?(a=!0,n=!0,Eg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function wg(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const k=new Map,_=new Map,E=new Map,N=(p,b,w)=>{if(!p)return;o.get(p)||o.set(p,[{entityId:b,assignedId:p}]),i.push({id:p,entityId:b,sink:w}),w(p)};for(const p of y.attributes){N(p.modelId,y.modelId,b=>k.set(p,b));for(const b of p.dbAttrs)N(b.modelId,y.modelId,w=>_.set(b,w))}for(const p of y.indexes??[])N(p.modelId,y.modelId,b=>E.set(p,b));a.set(y,{attrs:k,cols:_,idx:E})}const r=new Set(o.keys()),l=new Map;for(const y of i){const k=(l.get(y.id)??0)+1;if(l.set(y.id,k),k===1)continue;const _=Ig(y.id,k-1,r);r.add(_),o.get(y.id).push({entityId:y.entityId,assignedId:_}),y.sink(_)}const s=[...o.values()].reduce((y,k)=>y+Math.max(0,k.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,k)=>{var E;if(!k||!y)return k;const _=o.get(k);return!_||_.length<2?k:((E=_.find(N=>N.entityId===y))==null?void 0:E.assignedId)??k},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,k)=>{const _=d.get(y);if(_)return _.end1.entityRef===k?_.end2.entityRef:_.end1.entityRef},m=e.entities.map(y=>{var p;const k=a.get(y),_=y.attributes.map(b=>{const w=k.attrs.get(b),A=b.dbAttrs.map(T=>{const S=k.cols.get(T);return S===T.modelId?T:{...T,modelId:S}});let $=b.derivedFrom;if($){const T=u($.associationRef,y.modelId),S=c(T,$.sourceAttributeRef);S!==$.sourceAttributeRef&&($={...$,sourceAttributeRef:S})}return w!==b.modelId||$!==b.derivedFrom||A.some((T,S)=>T!==b.dbAttrs[S])?{...b,modelId:w,dbAttrs:A,derivedFrom:$}:b}),E=(p=y.indexes)==null?void 0:p.map(b=>{const w=k.idx.get(b),A=b.columns.map(L=>{const T=c(y.modelId,L.columnRef);return T===L.columnRef?L:{...L,columnRef:T}});return w!==b.modelId||A.some((L,T)=>L!==b.columns[T])?{...b,modelId:w,columns:A}:b});return _.some((b,w)=>b!==y.attributes[w])||E&&y.indexes&&E.some((b,w)=>b!==y.indexes[w])?{...y,attributes:_,...E?{indexes:E}:{}}:y}),h=e.associations.map(y=>{const k=c(y.end1.entityRef,y.end1.attributeRef),_=c(y.end2.entityRef,y.end2.attributeRef);return k===y.end1.attributeRef&&_===y.end2.attributeRef?y:{...y,end1:k===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:k},end2:_===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:_}}}),f=n.associationLayouts.map(y=>{const k=d.get(y.associationRef);if(!k)return y;const _=c(k.end1.entityRef,y.sourceColumnRef),E=c(k.end2.entityRef,y.targetColumnRef);return _===y.sourceColumnRef&&E===y.targetColumnRef?y:{...y,sourceColumnRef:_,targetColumnRef:E}});return{logical:{...e,entities:m,associations:h},layout:f.some((y,k)=>y!==n.associationLayouts[k])?{...n,associationLayouts:f}:n,reissued:s}}function Ig(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function Rt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Xr(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function jc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Kc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(jc);if(!i.length)continue;const a=o.filter(s=>!jc(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),n.attributes=l}}function Io(e){return JSON.parse(JSON.stringify(e))}function Gc(e,n,o){var L;const i=o.idFactory??De,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const T=new Set(n);for(const S of r.associations){const C=T.has(S.end1.entityRef),M=T.has(S.end2.entityRef);C!==M&&s.add(C?S.end2.entityRef:S.end1.entityRef)}}const c=r.entities.filter(T=>s.has(T.modelId)),d=new Set(c.map(T=>T.modelId)),u=r.associations.filter(T=>d.has(T.end1.entityRef)&&d.has(T.end2.entityRef)),m=new Set(u.map(T=>T.modelId)),h=new Map,f=T=>{let S=h.get(T);return S||(S=i(),h.set(T,S)),S};for(const T of c){f(T.modelId);for(const S of T.attributes){f(S.modelId);for(const C of S.dbAttrs)f(C.modelId)}for(const S of T.indexes??[])f(S.modelId);for(const S of T.operations??[])f(S.modelId)}for(const T of u)f(T.modelId);const y=T=>h.get(T),k=c.map(T=>{const S=Io(T);S.modelId=y(T.modelId),S.attributes=S.attributes.map(C=>vg(C,y,m,d));for(const C of S.indexes??[])C.modelId=y(C.modelId),C.columns=C.columns.map(M=>Ln(M.columnRef)?M:{...M,columnRef:y(M.columnRef)}).filter(M=>M.columnRef!==void 0);for(const C of S.operations??[])C.modelId=y(C.modelId);return S});Kc(k);const _=u.map(T=>{const S=Io(T);return S.modelId=y(T.modelId),S.end1=Yc(S.end1,y),S.end2=Yc(S.end2,y),S}),E=[];for(const T of r.groups){const S=T.memberEntityRefs.filter(M=>d.has(M));if(S.length===0)continue;const C=Io(T);C.modelId=f(T.modelId),C.memberEntityRefs=S.map(M=>y(M)),E.push(C)}const N=o.collisionSuffix??"_imported",p=new Set(o.existing.entities.map(T=>T.name)),b=new Set(o.existing.entities.map(T=>{var S;return(S=T.table)==null?void 0:S.physicalName}).filter(T=>!!T));for(const T of k)p.has(T.name)&&(T.name=`${T.name}${N}`),(L=T.table)!=null&&L.physicalName&&b.has(T.table.physicalName)&&(T.table.physicalName=`${T.table.physicalName}${N}`);const w=[];for(const T of l.entityLayouts){const S=y(T.entityRef);if(!S)continue;const C=Io(T);C.entityRef=S,C.geo={...C.geo,location:Zr(C.geo.location,a)},C.attributeStyles&&(C.attributeStyles=oa(C.attributeStyles,y)),C.operationStyles&&(C.operationStyles=oa(C.operationStyles,y)),w.push(C)}const A=[];for(const T of l.associationLayouts){const S=y(T.associationRef);if(!S)continue;const C=Io(T);C.associationRef=S,C.sourceColumnRef=T.sourceColumnRef?y(T.sourceColumnRef):void 0,C.targetColumnRef=T.targetColumnRef?y(T.targetColumnRef):void 0,C.waypoints=C.waypoints.map(M=>Zr(M,a)),A.push(C)}const $=[];for(const T of l.groupLayouts){const S=y(T.groupRef);if(!S)continue;const C=Io(T);C.groupRef=S,C.geo={...C.geo,location:Zr(C.geo.location,a)},delete C.memberNoteRefs,$.push(C)}return{logical:{entities:k,associations:_,groups:E},layout:{entityLayouts:w,associationLayouts:A,groupLayouts:$},idMap:h}}function Zr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function vg(e,n,o,i){e.modelId=n(e.modelId);for(const a of e.dbAttrs)if(a.modelId=n(a.modelId),a.sharedColumnRef!==void 0){const r=n(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:n(e.derivedFrom.associationRef),sourceAttributeRef:n(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:n(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:n(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function Yc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function oa(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Qr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function Hn(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>Hn(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!Hn(e[i],n[i]))return!1;return!0}return!1}function jn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||Hn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Kn(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function Cg(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const xg=new Set(["attributes","operations","indexes","rev"]),Sg=new Set(["end1","end2","rev"]),Rg=new Set(["memberEntityRefs","rev"]),qc=new Set(["modelId"]),Ag=new Set(["modelId","columns"]),$g=new Set([]);function Tg(e,n,o,i){const a=Kn(n.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=jn(s,c,qc);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Kn(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=jn(s,c,qc);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Kn(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!Hn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=jn(s,c,Ag);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Mg(e,n,o){const i=Kn(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:Qr(l)});for(const{cur:l,tgt:s}of i.common){const c=jn(l,s,xg);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Tg(l.modelId,l,s,o)}const a=Kn(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:Qr(l)});for(const{cur:l,tgt:s}of a.common){const c=jn(l,s,Sg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=jn(l[d]??{},s[d]??{},$g);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=Kn(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:Qr(l)});for(const{cur:l,tgt:s}of r.common){const c=jn(l,s,Rg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Cg(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function ia(e,n,o,i,a,r,l){const s=Kn(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)Hn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function Vg(e,n,o){ia(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ia(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ia(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ia(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Bg(e,n){const o=[];return Mg(e.logical,n.logical,o),Vg(e.layout,n.layout,o),o}function Dg(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const Og={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class Lg{constructor(n){nt(this,"out",[]);nt(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...ti(n),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(n,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...ti(n),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...ti(n),field:a,value:void 0,removed:!0});continue}this.out.push({...ti(n),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(n,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...ti(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function ti(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Ht(e,n,o,i){if(o==null||typeof o!="object")return;const a=Og[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Gn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function el(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Cn(e,n){var r,l,s,c,d,u,m,h;const o=Dg(n),i=new Lg(n.field),a=[...e].sort((f,y)=>f.seq-y.seq);for(const f of a)for(const y of f.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?Ht(i,f,y.value,"entity"):y.kind==="entity.update"?Gn(i,f,y.patch):y.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const k=el((r=y.value)==null?void 0:r.attributes,n.attributeRef);k&&Ht(i,f,k,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?Ht(i,f,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Gn(i,f,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(f);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const k=el((s=y.value)==null?void 0:s.operations,n.operationRef);k&&Ht(i,f,k,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?Ht(i,f,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Gn(i,f,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(f);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const k=el((d=y.value)==null?void 0:d.indexes,n.indexRef);k&&Ht(i,f,k,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?Ht(i,f,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Gn(i,f,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(f);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?Ht(i,f,y.value,"association"):y.kind==="association.update"?Gn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const k=(m=y.value)==null?void 0:m[n.end];Ht(i,f,k,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Gn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){Ht(i,f,y.value,"group");const k=(h=y.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(k))for(const _ of k)i.member(f,_,!1)}else y.kind==="group.update"?Gn(i,f,y.patch):y.kind==="group.remove"?i.remove(f):y.kind==="group.addMember"&&y.entityRef!=null?i.member(f,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(f,y.entityRef,!0);break}return i.result()}const Ze={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},Pg={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":Ze,"entityLayout.remove":Ze,"entityLayout.move":Ze,"entityLayout.resize":Ze,"entityLayout.setCollapsed":Ze,"entityLayout.setLocked":Ze,"entityLayout.setStyle":Ze,"entityLayout.setAttrStyle":Ze,"entityLayout.setOpStyle":Ze,"groupLayout.add":Ze,"groupLayout.remove":Ze,"groupLayout.move":Ze,"groupLayout.resize":Ze,"groupLayout.setLocked":Ze,"groupLayout.setStyle":Ze,"groupLayout.addNoteMember":Ze,"groupLayout.removeNoteMember":Ze,"associationLayout.add":Ze,"associationLayout.remove":Ze,"associationLayout.setWaypoints":Ze,"note.add":Ze,"note.remove":Ze,"note.move":Ze,"note.resize":Ze,"note.setMemo":Ze,"note.setStyle":Ze,"noteConnection.add":Ze,"noteConnection.remove":Ze,"noteConnection.setWaypoints":Ze},At=e=>typeof e=="string"?e:void 0,zg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Wc(e){return At(e.containerRef)??At(e.entityRef)}function tl(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=At(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function nl(e){const n=Pg[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=At(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...tl(o,"attributes","attribute",a),...tl(o,"operations","operation",a),...tl(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Wc(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?zg(o):At(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=At(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=At(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Fg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=At(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Wc(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=At(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=At(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function Ug(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Hg(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of nl(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function aa(e,n){return e.map(o=>({...o,subject:n}))}function Jc(e,n){const o=e.filter(s=>s.ops.some(c=>Ug(c,n))),{attributes:i,operations:a,indexes:r}=Hg(o,n),l=[...aa(Cn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...aa(Cn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...aa(Cn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...aa(Cn(o,{entityRef:n,indexRef:s}),{kind:"index",ref:s}));return l.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function ol(e){return`${e.kind}:${e.ref}:${e.end??""}`}function jg(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of nl(i))a.existence==="add"&&n.add(ol(a.subject));return n}function Kg(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=Fg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Gg(e){const{entities:n,associations:o,groups:i}=Kg(e),a=[];for(const r of n)for(const l of Jc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Cn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Cn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Cn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function il(e){const n=Gg(e),o=jg(e),i=new Map;for(const l of n){const s=ol(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of n){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=ol(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}function Xc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Yg(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of nl(r)){if(!l.existence||l.inline)continue;const s=l.subject;qg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const qg=new Set(["attribute","operation","index"]);function al(e,n){const{fromSeq:o}=n,i=il(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const h=Xc(m.subject);let f=s.get(h);f||(f={subject:m.subject,evs:[]},s.set(h,f)),f.evs.push(m)};for(const m of l)for(const h of m.actions)c({seq:m.seq,subject:h.subject,verb:h.verb,fields:h.fields});for(const m of Yg(e,o,r)){const h=s.get(Xc(m.subject));h!=null&&h.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,y)=>f.seq-y.seq);const h=m.evs[m.evs.length-1];m.subject.kind==="entity"&&h.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const h=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||h&&f)continue;const y=new Map;let k=null;for(const E of m.evs){E.verb==="add"&&k!==null&&k!=="add"&&y.clear(),k=E.verb;for(const N of E.fields){const p=y.get(N.field);p?p.lastValue=N.value:y.set(N.field,{firstOld:N.oldValue,hasOld:N.oldValue!==void 0,lastValue:N.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(h){const E=[];for(const[N,p]of y)E.push({field:N,value:p.lastValue});d.push({subject:m.subject,verb:"added",fields:E});continue}const _=[];for(const[E,N]of y)N.hasOld&&Hn(N.firstOld,N.lastValue)||_.push({field:E,value:N.lastValue,...N.hasOld?{oldValue:N.firstOld}:{}});_.length!==0&&d.push({subject:m.subject,verb:"modified",fields:_})}return{fromSeq:o,toSeq:r,entries:d}}function Zc(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class rl{constructor(n){nt(this,"undoStack",[]);nt(this,"redoStack",[]);nt(this,"savePoint",null);nt(this,"listeners",new Set);nt(this,"commandListeners",new Set);nt(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function Et(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Qc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function mt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function $t(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function it(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function rn(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function ra(e,n,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:n,...o})},invert(i){const a=Qc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=mt(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function ed(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Qc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=mt(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(h=>h.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function td(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=it(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(it(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Et(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Et(o)}]}}}}function nd(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=it(i,e);o=a.name,a.name=n},invert(i){it(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function vo(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=mt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function od(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=mt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function ni(e,n){const o={...(e==null?void 0:e.properties)??{}};return n?o.swatch=n:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function id(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=ni(r.style,n)},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=mt(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function ad(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(n)],invert:[i(o)]}}}}function rd(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function ll(e){let n=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){n=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=n[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:n[l]}})}),{forward:i,invert:a}}}}function la(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=ni(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function sa(e,n,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:n,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function ld(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Et(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Et(o)}]}}}}function sd(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function cd(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function ca(e,n){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,n)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}}}}function dd(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function ud(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function md(e,n){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=ni(a.style,n)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function fd(e,n){let o;return{label:n?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=n},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function jt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){it(o,e).attributes.push(n)},invert(o){const i=it(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function Kt(e,n,o){const i={},a=r=>{const l=it(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Et(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Et(i)}]}}}}function pd(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=it(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&it(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function hd(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function sl(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=it(a,e);i=r.attributes.map(s=>({...s}));const l=Xr([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&it(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=it(a,e).attributes;return hd("attribute.update","attributeRef",e,r,i??[])}}}function yd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=it(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=it(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function gd(e,n,o){const i={},a=r=>{var s;const l=(s=it(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Et(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Et(i)}]}}}}function bd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=it(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=it(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function _d(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=it(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Xr([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=it(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=it(a,e).operations??[];return hd("operation.update","operationRef",e,r,i??[])}}}function kd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=ni(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function da(e,n){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(n)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:n,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function Ed(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function ua(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Et(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Et(o)}]}}}}function Tt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Et(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Et(i)}]}}}}function Nd(e,n){return{label:"인덱스 추가",apply(o){const i=it(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=it(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function ma(e,n,o){const i={},a=r=>{var s;const l=(s=it(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Et(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Et(i)}]}}}}function wd(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=it(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&it(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Gt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),oi=(e,n)=>{var o;return((o=$t(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Id(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=$t(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=$t(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=oi(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Gt(e,r)],invert:[Gt(e,l)]}}}}function vd(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=$t(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=$t(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=oi(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Gt(e,a)],invert:[Gt(e,r)]}}}}function Cd(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=$t(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=$t(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Gt(e,oi(a,e))],invert:[Gt(e,i??[])]}}}}function xd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=$t(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=$t(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Gt(e,oi(o,e))],invert:[Gt(e,n??[])]}}}}function Sd(e,n,o){return{label:"waypoint 추가",apply(i){const a=$t(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=$t(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=oi(i,e),r=a.slice();return r.splice(n,1),{forward:[Gt(e,a)],invert:[Gt(e,r)]}}}}function Rd(e){return{label:"노트 추가",apply(n){n.layout.notes.push(e)},invert(n){const o=n.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&n.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function Ad(e){let n=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);n={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){n&&o.layout.notes.splice(n.index,0,n.item)},emitOps(){return n?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:n.item}]}:{forward:[],invert:[]}}}}function ii(e,n){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function $d(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Td(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Md(e,n){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=ni(a.style,n)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Vd(e,n){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(n)&&(l.memberNoteRefs.push(n),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(n);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}:{forward:[],invert:[]}}}}function Bd(e,n){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(n))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,n))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}}}}const xn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),fa=(e,n,o)=>{var i;return((i=rn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Dd(e,n){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===n)){o=!1;return}r.connections.push({targetRef:n,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===n);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:{targetRef:n,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}]}:{forward:[],invert:[]}}}}function Od(e,n){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===n))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${n}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:o.item}]}:{forward:[],invert:[]}}}}function Ld(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=rn(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=rn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=fa(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[xn(e,n,l)],invert:[xn(e,n,s)]}}}}function Pd(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=rn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=rn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=fa(a,e,n),l=r.slice();return l.splice(o,1),{forward:[xn(e,n,r)],invert:[xn(e,n,l)]}}}}function zd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=rn(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=rn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=fa(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[xn(e,n,r)],invert:[xn(e,n,l)]}}}}function Fd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=rn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=rn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[xn(e,n,fa(i,e,n))],invert:[xn(e,n,o??[])]}}}}function Qe(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const Wg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:da,addAttribute:jt,addEntity:ra,addEntityToGroup:cd,addGroup:sa,addIndex:Nd,addNote:Rd,addNoteConnection:Dd,addNoteConnectionWaypoint:Pd,addNoteToGroup:Vd,addOperation:yd,addWaypoint:Sd,clearNoteConnectionWaypoints:Fd,clearWaypoints:xd,composite:Qe,moveEntity:vo,moveGroup:dd,moveNote:ii,moveNoteConnectionWaypoint:Ld,moveWaypoint:Id,removeAssociation:Ed,removeAttribute:pd,removeEntity:ed,removeEntityFromGroup:ca,removeGroup:sd,removeIndex:wd,removeNote:Ad,removeNoteConnection:Od,removeNoteConnectionWaypoint:zd,removeNoteFromGroup:Bd,removeOperation:bd,removeWaypoint:vd,renameEntity:nd,reorderAttributes:sl,reorderOperations:_d,resizeEntity:od,resizeGroup:ud,resizeNote:$d,setAllEntitiesCollapsed:ll,setAttributeSwatch:la,setEntityCollapsed:ad,setEntityLocked:rd,setEntitySwatch:id,setGroupLocked:fd,setGroupSwatch:md,setNoteMemo:Td,setNoteSwatch:Md,setOperationSwatch:kd,translateWaypoints:Cd,updateAssociation:ua,updateAssociationEnd:Tt,updateAttribute:Kt,updateEntity:td,updateGroup:ld,updateIndex:ma,updateOperation:gd},Symbol.toStringTag,{value:"Module"}));class Ud{constructor(){nt(this,"revs",new Map);nt(this,"layoutVersion",0);nt(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const Jg=[400,1200];function Xg(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function Zg(e){const n=Xg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Qg=e=>new Promise(n=>setTimeout(n,e));class Hd{constructor(n){nt(this,"cache",new Ud);nt(this,"newClientOpId");nt(this,"debounceMs");nt(this,"retryDelaysMs");nt(this,"emissions",new WeakMap);nt(this,"open",null);nt(this,"debounceHandle",null);nt(this,"queue",[]);nt(this,"sending",!1);nt(this,"_frozen",!1);nt(this,"stack",null);nt(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??De,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??Jg}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!Zg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Qg(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const jd=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Kd=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Gd(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function eb(e){return nn(e).length}function cl(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function tb(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=qo(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function Yd(e,n,o=De){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=eb(i);if(a===0)return[];const r=cl(e,n),l=nn(i).map(c=>c.col),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;tb(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function qd(e,n,o){var h;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const y=r.get(f);if(!y)return[];l.push(y)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,y)=>f===c[y]))return[];const d=new Map(s.map((f,y)=>[f,y])),u=cl(e,n),m=[];for(const f of e.entities)for(const y of f.attributes){if(y.attrType!=="EMBED_OWN"||((h=y.embedded)==null?void 0:h.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const k=c.map(E=>y.dbAttrs[d.get(E)]),_=k.reduce((E,N,p)=>N===y.dbAttrs[p]?E:E+1,0);_&&m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:k,moved:_})}return m}function Wd(e,n,o){var h;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=nn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(nn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,y)=>{c.has(f)&&d.add(y)}),d.size===s.length)return[];const u=cl(e,n),m=[];for(const f of e.entities)for(const y of f.attributes){if(y.attrType!=="EMBED_OWN"||((h=y.embedded)==null?void 0:h.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const k=y.dbAttrs.filter((N,p)=>d.has(p)),_=y.dbAttrs.filter((N,p)=>!d.has(p));y.dbAttrs.some((N,p)=>{if(d.has(p))return!1;const b=l[p],w=!!N.physicalName&&N.physicalName!==((b==null?void 0:b.physicalName)??""),A=N.sharedColumnRef!=null&&N.sharedColumnRef!==(b==null?void 0:b.sharedColumnRef);return w||A})||m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:k,dropped:_})}return m}function nb(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function ob(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Jd(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function ht(e,n){const o=nb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>rb(i,e))}}function ib(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function dl(e,n){const o=ib(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function ul(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const ab=new Set(["name","description","packageName","excludeDDLGeneration"]);function rb(e,n){var a;const o=Ji(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(h=>h.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function Xd(e,n){const o=ob(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function lb(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function sb(e,n){const o=lb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Zd(e,n){const o=e.filter(i=>i.physicalName===n.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function ml(e){return e.by!==void 0&&e.by!=="name"}function cb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function db(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function ub(e,n){const o=cb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Qd(e,n){const o=db(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function eu(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function tu(e){return eu(e)&&e.dataType==null}function nu(e,n,o){const i=eu(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function ou(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let h=!1;for(const f of n.fields){const y=u.get(f.name);if(y!=null&&y.sharedColumnPhysicalName){const k={ref:y.sharedColumnPhysicalName,by:"physicalName"},_=Zd(vn(i,a),k);if(!_.ok){s.push(_.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:k}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:k,matches:_.matches}),h=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return h?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}const mb=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName"]),fb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),pb=new Set(["description","identifying"]),hb=new Set(["multiplicity","navigable","composition"]),yb=new Set(["name","unique","description","parameters"]),gb=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Co(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const fl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),bb=new Set([...fl].filter(e=>e!=="sharedColumnRef"));function _b(e,n,o,i){if(i||o.some(l=>!bb.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))fl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function kb(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,h)=>{const f=n.fields[h],y=f?c.get(f.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},E=Zd(vn(i,a),_);if(!E.ok){s.push(E.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:E.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:E.value.modelId});return}const k={...m};delete k.sharedColumnRef,d.push({...k,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function iu(e,n,o){return{modelId:o(),name:e.name,order:n,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function au(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=sb(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:n.name,unique:n.unique??!1,columns:l,...n.description?{description:n.description}:{},...n.parameters?{parameters:n.parameters}:{}}}function xo(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function Eb(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Gd(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function Nb(e,n,o,i,a,r){const l=m=>{const h=new Map;for(const{entityId:f,item:y}of m){if(a.has(f))continue;const k=h.get(f)??[];k.push(y),h.set(f,k)}return h},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,h]of s)if(!c.has(m))for(const f of Wd(n,m,h))u(f);for(const[m,h]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(y=>y.modelId===m?{...y,attributes:[...y.attributes,...h]}:y)};for(const y of Yd(f,m,r))u(y)}}function pl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of vc(n,o,i)){for(const u of c.remove)xo(e,a,s,u);for(const u of c.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:s,entityRef:s,attributeRef:u.attributeId,patch:u.patch});const d=((l=n.entities.find(u=>u.modelId===s))==null?void 0:l.attributes)??[];for(const u of c.add)e.push({kind:"attribute.add",casUnit:"logical",containerRef:s,entityRef:s,value:{...u,order:r(s,d)}})}}function wb(e,n,o={}){const i=o.mkId??De,a=o.embeddableCatalog??[],r=p=>a.find(b=>b.type===p),l=[],s=[],c=new Map,d=(p,b)=>{const w=c.get(p)??Rt(b);return c.set(p,w+1),w},u=new Map,m=new Set,h=new Set,f={seen:new Set,pairs:[]},y=[],k=new Set,_=(p,b)=>`${p}\0${b}`,E=new Set;for(const p of n)p.kind==="entity.add"&&(E.add(p.spec.name),p.spec.physicalName&&E.add(p.spec.physicalName));const N=new Set;return n.forEach((p,b)=>{var w,A,$,L,T;switch(p.kind){case"entity.add":{const S=e.entities.filter(O=>O.name===p.spec.name).map(O=>O.modelId);if(S.length||N.has(p.spec.name)){s.push({code:"entity-name-conflict",opIndex:b,handle:{ref:p.spec.name},matches:S});break}N.add(p.spec.name);const C=i(),M={modelId:C,name:p.spec.name,stereotype:p.spec.stereotype??"JPA_ENTITY",attributes:[],...p.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...p.spec.physicalName?{table:{physicalName:p.spec.physicalName}}:{}},B={ref:p.spec.name};let g=!1;for(const[O,x]of(p.spec.attributes??[]).entries()){if(x.type==="GroupCodeEnum"&&!x.groupCode){s.push({code:"groupcode-required",opIndex:b,entity:B,handle:{ref:x.name}}),g=!0;continue}if(!r(x.type)&&!((w=x.embeddableOverrides)!=null&&w.length)&&tu(x)){s.push({code:"datatype-required",opIndex:b,entity:B,handle:{ref:x.name}}),g=!0;continue}const z=r(x.type);if(z){const j=ou(x,z,O,M,e.entities,b,B,s,i);j?M.attributes.push(j):g=!0}else(A=x.embeddableOverrides)!=null&&A.length?(s.push({code:"embeddable-type-unresolved",opIndex:b,entity:B,handle:{ref:x.name}}),g=!0):M.attributes.push(nu(x,O,i))}const I=(p.spec.operations??[]).map((O,x)=>iu(O,x,i));I.length&&(M.operations=I);const v=[];for(const O of p.spec.indexes??[]){const x=au(M,O,b,B,s,i);x?v.push(x):g=!0}if(v.length&&(M.indexes=v),g)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:C,value:M});break}case"entity.update":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=Co(p.patch,fb,["jpaAttrs.","table."]);if(C.length){s.push({code:"entity-patch-unknown-key",opIndex:b,entity:p.entity,keys:C});break}const M=p.patch.stereotype;if(typeof M=="string"&&M!==S.value.stereotype&&(M==="JPA_EMBEDDABLE"||S.value.stereotype==="JPA_EMBEDDABLE")){s.push({code:"stereotype-embeddable-transition-unsupported",opIndex:b,entity:p.entity,from:S.value.stereotype??"",to:M});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,patch:p.patch});break}case"entity.remove":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=S.value.modelId,M=e.associations.filter(v=>v.end1.entityRef===C||v.end2.entityRef===C),B=new Set(M.map(v=>v.modelId));for(const v of M)m.has(v.modelId)||(m.add(v.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:v.modelId}));for(const v of e.entities)if(v.modelId!==C)for(const O of v.attributes)O.embedded&&B.has(O.embedded.associationRef)&&xo(l,f,v.modelId,O.modelId);for(const v of M){if(v.end1.entityRef===C||!v.end1.attributeRef)continue;const O=e.entities.find(z=>z.modelId===v.end1.entityRef),x=O==null?void 0:O.attributes.find(z=>z.modelId===v.end1.attributeRef&&z.attrType==="RELATION_REF");x&&xo(l,f,O.modelId,x.modelId)}const g={...e,entities:e.entities.filter(v=>v.modelId!==C),associations:e.associations.filter(v=>!B.has(v.modelId))},I=new Set(M.filter(v=>v.end1.entityRef===C&&v.end2.entityRef!==C).map(v=>v.end2.entityRef));for(const v of I)pl(l,g,v,i,f,d);for(const v of e.groups)v.memberEntityRefs.includes(C)&&(k.has(_(v.modelId,C))||(k.add(_(v.modelId,C)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:v.modelId,groupRef:v.modelId,entityRef:C})));h.add(C),l.push({kind:"entity.remove",casUnit:"logical",entityRef:C});break}case"attribute.add":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}if(p.spec.type==="GroupCodeEnum"&&!p.spec.groupCode){s.push({code:"groupcode-required",opIndex:b,entity:p.entity,handle:{ref:p.spec.name}});break}if(!r(p.spec.type)&&!(($=p.spec.embeddableOverrides)!=null&&$.length)&&tu(p.spec)){s.push({code:"datatype-required",opIndex:b,entity:p.entity,handle:{ref:p.spec.name}});break}const C=d(S.value.modelId,S.value.attributes),M=r(p.spec.type);let B;if(M)B=ou(p.spec,M,C,S.value,e.entities,b,p.entity,s,i);else if((L=p.spec.embeddableOverrides)!=null&&L.length){s.push({code:"embeddable-type-unresolved",opIndex:b,entity:p.entity,handle:{ref:p.spec.name}});break}else B=nu(p.spec,C,i);if(!B)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,value:B}),y.push({entityId:S.value.modelId,attribute:B});break}case"attribute.update":case"attribute.remove":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=Xd(S.value,p.attribute);if(!C.ok){s.push(C.reason==="not-found"?{code:"attribute-not-found",opIndex:b,entity:p.entity,handle:p.attribute}:{code:"attribute-ambiguous",opIndex:b,entity:p.entity,handle:p.attribute,matches:C.matches});break}if(p.kind==="attribute.update"){const M=[],B=[];let g=!1;for(const x of Object.keys(p.patch)){if(x.includes(".")){x.startsWith("dbAttrs.")?g=!0:B.push(x);continue}fl.has(x)?M.push(x):mb.has(x)||B.push(x)}if(B.length){s.push({code:"attribute-patch-unknown-key",opIndex:b,entity:p.entity,handle:p.attribute,keys:B});break}if("attrType"in p.patch){const x=String(p.patch.attrType),z=Kd.includes(x)?x!==C.value.attrType?"transition":void 0:"unknown-value";if(z){s.push({code:"attribute-attrtype-unsupported",opIndex:b,entity:p.entity,handle:p.attribute,reason:z,current:C.value.attrType,requested:x});break}}const I="type"in p.patch?p.patch.type:C.value.type,v="groupCode"in p.patch?p.patch.groupCode:C.value.groupCode;if(I==="GroupCodeEnum"&&!v){s.push({code:"groupcode-required",opIndex:b,entity:p.entity,handle:p.attribute});break}let O=p.patch;if(M.length){const x=_b(C.value,p.patch,M,g);if(!x){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:b,entity:p.entity,handle:p.attribute,keys:M});break}O=x}if((T=p.embeddableOverrides)!=null&&T.length){const x=r(C.value.type);if(!x||C.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:b,entity:p.entity,handle:p.attribute});break}const z=kb(C.value,x,p.embeddableOverrides,S.value,e.entities,b,p.entity,s);if(!z)break;O={...O,dbAttrs:z}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,attributeRef:C.value.modelId,patch:O})}else{const M=ko(e,S.value.modelId,C.value.modelId);if(M){const B=g=>{var I;return((I=e.entities.find(v=>v.modelId===g))==null?void 0:I.name)??g};s.push({code:"attribute-fk-managed",opIndex:b,entity:p.entity,handle:p.attribute,association:{from:B(M.end1.entityRef),to:B(M.end2.entityRef)}});break}xo(l,f,S.value.modelId,C.value.modelId)}break}case"association.add":{const S=ht(e,p.spec.from),C=ht(e,p.spec.to);if(S.ok||s.push(yt(S.reason,b,p.spec.from,S.matches,E)),C.ok||s.push(yt(C.reason,b,p.spec.to,C.matches,E)),!S.ok||!C.ok)break;if(p.spec.identifying&&S.value.modelId===C.value.modelId){s.push({code:"self-identifying",opIndex:b,handle:{from:p.spec.from,to:p.spec.to}});break}if(S.value.stereotype==="JPA_EMBEDDABLE"||C.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:b,handle:{from:p.spec.from,to:p.spec.to}});break}const M=i(),B={modelId:M,...p.spec.identifying!=null?{identifying:p.spec.identifying}:{},end1:{entityRef:S.value.modelId,multiplicity:p.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:C.value.modelId,multiplicity:p.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:p.spec.composition??!1}},g={...e,associations:[...e.associations,B]},I=Xo(g,C.value.modelId,i);I.add[0]&&(B.end2.attributeRef=I.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:M,value:B});for(const v of I.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,value:{...v,order:d(C.value.modelId,C.value.attributes)}});break}case"association.remove":{const S=ht(e,p.association.from),C=ht(e,p.association.to);if(S.ok||s.push(yt(S.reason,b,p.association.from,S.matches,E)),C.ok||s.push(yt(C.reason,b,p.association.to,C.matches,E)),!S.ok||!C.ok)break;const M=Jd(e,S.value.modelId,C.value.modelId);if(M.length!==1){s.push(M.length===0?{code:"association-not-found",opIndex:b,handle:p.association}:{code:"association-ambiguous",opIndex:b,handle:p.association,matches:M.map(v=>v.modelId)});break}const B=M[0];m.has(B.modelId)||(m.add(B.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:B.modelId}));const g=e.entities.find(v=>v.attributes.some(O=>{var x;return((x=O.embedded)==null?void 0:x.associationRef)===B.modelId}));if(g){const v=g.attributes.find(O=>{var x;return((x=O.embedded)==null?void 0:x.associationRef)===B.modelId});xo(l,f,g.modelId,v.modelId);break}if(B.end1.attributeRef){const v=e.entities.find(x=>x.modelId===B.end1.entityRef),O=v==null?void 0:v.attributes.find(x=>x.modelId===B.end1.attributeRef&&x.attrType==="RELATION_REF");O&&xo(l,f,v.modelId,O.modelId)}const I={...e,associations:e.associations.filter(v=>v.modelId!==B.modelId)};pl(l,I,B.end2.entityRef,i,f,d);break}case"association.update":{const S=ru(e,p.association,b,s,E);if(!S)break;const C=p.patch.identifying,M=typeof C=="boolean"?C:void 0;if(M===!0&&S.end1.entityRef===S.end2.entityRef){s.push({code:"self-identifying",opIndex:b,handle:p.association});break}const B=Co(p.patch,pb);if(B.length){s.push({code:"association-patch-unknown-key",opIndex:b,handle:p.association,keys:B});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:S.modelId,associationRef:S.modelId,patch:p.patch}),M!==void 0&&M!==(S.identifying??!1)){const g={...e,associations:e.associations.map(I=>I.modelId===S.modelId?{...I,identifying:M}:I)};pl(l,g,S.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const S=ru(e,p.association,b,s,E);if(!S)break;const C=p.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(p.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:b,handle:p.association});break}const M=Co(p.patch,hb,["jpa."]);if(M.length){s.push({code:"association-end-patch-unknown-key",opIndex:b,handle:p.association,keys:M});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:S.modelId,associationRef:S.modelId,end:C,patch:p.patch});break}case"index.add":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=au(S.value,p.spec,b,p.entity,s,i);if(!C)break;l.push({kind:"index.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:C.modelId,value:C});break}case"index.update":case"index.remove":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}if(ml(p.index)){s.push({code:"handle-by-unsupported",opIndex:b,entity:p.entity,handle:p.index,target:"index"});break}const C=ub(S.value,p.index);if(!C.ok){s.push(C.reason==="not-found"?{code:"index-not-found",opIndex:b,entity:p.entity,handle:p.index}:{code:"index-ambiguous",opIndex:b,entity:p.entity,handle:p.index,matches:C.matches});break}if(p.kind==="index.update"){if("columns"in p.patch){s.push({code:"index-columns-patch-unsupported",opIndex:b,entity:p.entity,handle:p.index});break}const M=Co(p.patch,yb);if(M.length){s.push({code:"index-patch-unknown-key",opIndex:b,entity:p.entity,handle:p.index,keys:M});break}l.push({kind:"index.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:C.value.modelId,patch:p.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:C.value.modelId});break}case"operation.add":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}const C=u.get(S.value.modelId)??(S.value.operations?Rt(S.value.operations):0);u.set(S.value.modelId,C+1);const M=iu(p.spec,C,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:M.modelId,value:M});break}case"operation.update":case"operation.remove":{const S=ht(e,p.entity);if(!S.ok){s.push(yt(S.reason,b,p.entity,S.matches,E));break}if(ml(p.operation)){s.push({code:"handle-by-unsupported",opIndex:b,entity:p.entity,handle:p.operation,target:"operation"});break}const C=Qd(S.value,p.operation);if(!C.ok){s.push(C.reason==="not-found"?{code:"operation-not-found",opIndex:b,entity:p.entity,handle:p.operation}:{code:"operation-ambiguous",opIndex:b,entity:p.entity,handle:p.operation,matches:C.matches});break}if(p.kind==="operation.update"){const M=Co(p.patch,gb);if(M.length){s.push({code:"operation-patch-unknown-key",opIndex:b,entity:p.entity,handle:p.operation,keys:M});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:C.value.modelId,patch:p.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:C.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const S=p.kind==="attribute.reorder",C=ht(e,p.entity);if(!C.ok){s.push(yt(C.reason,b,p.entity,C.matches,E));break}const M=S?p.order:p.operations,B=[],g=new Set;let I=!1;for(const z of M){if(!S&&ml(z)){s.push({code:"handle-by-unsupported",opIndex:b,entity:p.entity,handle:z,target:"operation"}),I=!0;continue}const j=S?Xd(C.value,z):Qd(C.value,z);if(!j.ok){s.push(j.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:b,entity:p.entity,handle:z}:{code:"reorder-handle-ambiguous",opIndex:b,entity:p.entity,handle:z,matches:j.matches}),I=!0;continue}if(g.has(j.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:b,entity:p.entity,handle:z}),I=!0;continue}g.add(j.value.modelId),B.push(j.value)}if(I)break;const O=[...S?C.value.attributes:C.value.operations??[]].sort((z,j)=>z.order-j.order).filter(z=>!g.has(z.modelId)),x=[...B,...O];if(x.forEach((z,j)=>{z.order!==j&&l.push(S?{kind:"attribute.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,attributeRef:z.modelId,patch:{order:j}}:{kind:"operation.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:z.modelId,patch:{order:j}})}),S)for(const z of qd(e,C.value.modelId,x.map(j=>j.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:z.entityId,entityRef:z.entityId,attributeRef:z.attributeId,patch:{dbAttrs:z.dbAttrs}});break}case"group.add":{const S=[];let C=!1;for(const g of p.spec.members){const I=ht(e,g);if(!I.ok){s.push(yt(I.reason,b,g,I.matches,E)),C=!0;continue}S.push(I.value.modelId)}if(C)break;const M=i(),B={modelId:M,excludeDDLGeneration:p.spec.excludeDDLGeneration??!1,memberEntityRefs:S,...p.spec.name?{name:p.spec.name}:{},...p.spec.packageName?{packageName:p.spec.packageName}:{},...p.spec.description?{description:p.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:M,value:B});break}case"group.update":{const S=dl(e,p.group);if(!S.ok){s.push(ul(S,b,p.group));break}const C=Co(p.patch,ab);if(C.length){s.push({code:"group-patch-unknown-key",opIndex:b,handle:p.group,keys:C});break}l.push({kind:"group.update",casUnit:"logical",containerRef:S.value.modelId,groupRef:S.value.modelId,patch:p.patch});break}case"group.remove":{const S=dl(e,p.group);if(!S.ok){s.push(ul(S,b,p.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:S.value.modelId});break}case"group.addMember":case"group.removeMember":{const S=dl(e,p.group);if(!S.ok){s.push(ul(S,b,p.group));break}const C=ht(e,p.entity);if(!C.ok){s.push(yt(C.reason,b,p.entity,C.matches,E));break}const M=S.value.memberEntityRefs.includes(C.value.modelId);if(p.kind==="group.addMember"?M:!M)break;if(p.kind==="group.removeMember"){if(k.has(_(S.value.modelId,C.value.modelId)))break;k.add(_(S.value.modelId,C.value.modelId))}l.push({kind:p.kind,casUnit:"logical",containerRef:S.value.modelId,groupRef:S.value.modelId,entityRef:C.value.modelId});break}}}),s.length||Eb(l,e,f,h),s.length||Nb(l,e,f,y,h,i),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function yt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function ru(e,n,o,i,a){const r=ht(e,n.from),l=ht(e,n.to);if(r.ok||i.push(yt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(yt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Jd(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:n}:{code:"association-ambiguous",opIndex:o,handle:n,matches:s.map(c=>c.modelId)}),null):s[0]}const lu={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},Ib={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},vb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Cb={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},Sn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},xb={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...Sn,description:"속성 설명(다국어)."},columnLogicalName:{...Sn,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},Sb={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},su={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Rb={type:"object",description:"일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)을 end 로 주면 거부된다(임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...su,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...su,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},Ab={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...lu,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},$b={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Sn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Tb={type:"object",properties:{name:{...Sn,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},Mb={type:"object",description:"기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부).",properties:{name:{type:"string"},type:{type:"string"},customType:{type:"string"},attrType:{type:"string",enum:[...Kd],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},derivedIdFieldName:{type:"string",description:"파생 식별(@MapsId) FK가 매핑되는 **스칼라 @Id 필드명**. 이 속성의 name은 연관 필드명(@MapsId @OneToOne 필드)이고 같은 관계가 두 Java 필드를 만든다. 단일 컬럼 @OneToOne 식별 FK에만 의미가 있고, 미설정 시 부모 PK 물리명의 camelCase로 파생된다(실물 관행). 컬럼은 공유하므로 속성은 하나이며 물리명은 지정하지 않는다."},description:{...Sn,description:"속성 설명(다국어)."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...Sn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},Vb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Bb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Db={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...Sn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Ob={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경. stereotype 은 JPA_EMBEDDABLE 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},Lb={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function rt(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const Pb={"entity.add":rt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":rt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":rt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":rt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":rt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":rt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":rt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":rt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":rt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":rt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":rt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":rt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":rt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":rt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":rt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":rt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":rt("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":rt("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":rt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":rt("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":rt("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":rt("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":rt("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},zb={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},Fb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...Sn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},cu={anyOf:jd.map(e=>Pb[e])},Ub={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:lu,nameHandle:Ib,groupHandle:zb,assocHandle:vb,entitySpec:Cb,attrSpec:xb,embeddableOverrides:Sb,assocSpec:Rb,indexSpec:Ab,operationSpec:$b,groupSpec:Tb,entityUpdatePatch:Ob,attrUpdatePatch:Mb,assocUpdatePatch:Vb,assocEndUpdatePatch:Lb,indexUpdatePatch:Bb,operationUpdatePatch:Db,groupUpdatePatch:Fb,symbolicOp:cu}};function Hb(e,n,o,i={}){const a=i.mkClientOpId??De,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const du={location:{x:0,y:0},size:{width:220,height:140}};function uu(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const jb=/^[-=_*~\s]{3,}$/;function Kb(e){return e.attrType&&e.attrType!=="NORMAL"||!jb.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Gb(e){return e.type===an&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Yb(e,n){if(e.attrType==="DIVIDER"||Kb(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=Gb(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(uu)}}function qb(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Wb(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(n=>({columnRef:n.targetColumn.refId,descending:n.descending}))}}function Jb(e){var n,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(Yb),operations:(n=e.operations)==null?void 0:n.map(qb),indexes:(o=e.indexes)==null?void 0:o.map(Wb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Xb(e){const n={};for(const i of e.attributes)i.style&&(n[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...du},style:e.style,attributeStyles:Object.keys(n).length?n:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function mu(e){return e.jpaAttribute?{fetchType:e.jpaAttribute.fetchType,cascadeTypes:e.jpaAttribute.cascadeTypes,orphanRemoval:e.jpaAttribute.orphanRemoval,orderBy:e.jpaAttribute.orderBy,collectionType:e.jpaAttribute.collectionType,collectionTable:e.jpaAttribute.collectionTable,orderColumn:e.jpaAttribute.orderColumn}:void 0}function hl(e){var n;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(n=e.attribute)==null?void 0:n.modelId,jpa:mu(e)}}function Zb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>yl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Qb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:Zb(e),end1:hl(e.end1),end2:hl(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:n,layout:o}}function yl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function fu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function pu(e){var o;const n=e.attribute;return(n==null?void 0:n.attrType)==="EMBED_OWN"&&(((o=n.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function hu(e,n){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:n,dbAttrs:(e.dbAttrs??[]).map(uu)}}function e_(e,n,o){var b,w;const i=yl(e.end1.attribute),a=yl(e.end2.attribute);if(i===a)return Qb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(w=(b=s.dbAttrs)==null?void 0:b[0])==null?void 0:w.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((A,$)=>Math.max(A,$.order),-1)+1:s.order??0,h={...hu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const f=n.get(r.endModel.refId),y=l.attribute;let k;if(y&&f&&r.navigable){const A=Ki(l.multiplicity);k={modelId:y.modelId??crypto.randomUUID(),name:ho(y.name??Yi((u==null?void 0:u.name)??l.endModel.refId,A),new Set(f.attributes.map($=>$.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce(($,L)=>Math.max($,L.order),-1)+1,dbAttrs:[]},f.attributes.push(k)}const _=(A,$)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:$?k==null?void 0:k.modelId:h.modelId,jpa:mu(A)}),E=r.endModel.refId===l.endModel.refId,N={modelId:e.modelId,description:e.description,identifying:!E&&h.identifier===!0?!0:void 0,end1:_(e.end1,i),end2:_(e.end2,a)},p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:h.modelId,targetColumnRef:i?h.modelId:d,style:e.style};return{assoc:N,layout:p}}function t_(e,n){const o=e.targetModelId?n.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function n_(e,n,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((k,_)=>Math.max(k,_.order),-1)+1:l.order??0,d={...hu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(k=>t_(k,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=k=>({...hl(k),legacyEmbedRaw:k.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function o_(e,n){var i,a,r,l;const o=[];for(const s of n){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function yu(e,n={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=o_(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+n.x,y:a.location.y+n.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function gu(e,n,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(n.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function i_(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(h=>h.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(h=>h.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=Ki(i.end2.multiplicity),u=Yi(r.name,d),m=ho(u,new Set(a.attributes.map(h=>h.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((h,f)=>Math.max(h,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function a_(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function bu(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if((l==null?void 0:l.stereotype)==="JPA_EMBEDDABLE")continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Xs(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function _u(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?r_(n):l_(n)}function r_(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:h,...f}=m;return h!=null&&(o[m.modelId]=h),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);i_(a,r),a_(a,r),bu(a,r);const{version:s,...c}=e.layout;gu(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function l_(e){var E,N;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(p,b)=>{o.push(Jb(p));const w=Xb(p);w.geo={location:{x:w.geo.location.x+b.x,y:w.geo.location.y+b.y},size:w.geo.size},i.push(w);for(const A of p.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const p of e.entities??[])d(p,u);const m=[];for(const p of e.groups??[]){const b=p.entities??[];l.push({modelId:p.modelId,name:p.name,description:p.description,packageName:p.packageName,excludeDDLGeneration:p.excludeDDLGeneration??!1,memberEntityRefs:b.map(A=>A.modelId)});const w=((E=p.geo)==null?void 0:E.location)??u;if(p.geo){const A=(p.notes??[]).map($=>$.modelId);s.push({groupRef:p.modelId,geo:p.geo,style:p.style,locked:p.locked,memberNoteRefs:A.length?A:void 0})}for(const A of b)d(A,w);for(const A of p.notes??[])m.push(yu(A,w))}const h=new Map(o.map(p=>[p.modelId,p])),f=new Map,y=new Map;for(const p of o)for(const b of p.attributes)for(const w of b.dbAttrs)f.set(w.modelId,b.modelId),y.set(w.modelId,w);for(const p of c)for(const b of[p.end1,p.end2]){const w=b.attribute;if(w&&(((N=w.dbAttrs)==null?void 0:N.length)??0)>0)for(const A of w.dbAttrs)A.modelId&&f.set(A.modelId,w.modelId)}for(const p of c){const b=fu(p.end1.attribute),w=fu(p.end2.attribute),A=pu(p.end1)||pu(p.end2),{assoc:$,layout:L}=b!==w||A?n_(p,h,y):e_(p,h,f);a.push($),r.push(L)}gu(o,a,r),Kc(o),bu(o,a);const k={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(p=>yu(p)),...m]}},_={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:k,meta:_}}function ku(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function s_(e,n){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(ku),style:n}}function c_(e,n){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:n}}function d_(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(n=>({targetColumn:{refId:n.columnRef},descending:n.descending}))}}function Rn(e,n){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:n??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function u_(e,n){const o=n==null?void 0:n.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...ku(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function m_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function Eu(e,n){const o=l=>{if(!l.attributeRef)return;const s=n.logical.entities.find(c=>c.modelId===l.entityRef);return s==null?void 0:s.attributes.find(c=>c.modelId===l.attributeRef)},i=o(e.end1),a=o(e.end2),r=l=>(l==null?void 0:l.attrType)==="RELATION_OWN"?l:void 0;return(i==null?void 0:i.attrType)==="RELATION_REF"?{navEnd:e.end1,fkEnd:e.end2,navAttr:i,fk:r(a)}:(a==null?void 0:a.attrType)==="RELATION_REF"?{navEnd:e.end2,fkEnd:e.end1,navAttr:a,fk:r(i)}:null}function f_(e){const n=new Set;for(const o of e.logical.associations){const i=Eu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function p_(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function h_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function y_(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:h_(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function g_(e,n,o){let i;for(const m of n.logical.entities){const h=m.attributes.find(f=>{var y;return((y=f.embedded)==null?void 0:y.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,h)=>y_(m,l[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Rn(e.end1,c?s:u),end2:Rn(e.end2,c?u:s)}}function b_(e,n,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:Rn(e.end1,e.end1.legacyEmbedRaw),end2:Rn(e.end2,e.end2.legacyEmbedRaw)};const a=g_(e,n,i);if(a)return a;const r=Eu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?u_(r.fk,l):void 0,c=m_(r.navAttr);return{...i,end1:Rn(e.end1,r.navEnd===e.end1?s:c),end2:Rn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:Rn(e.end1),end2:Rn(e.end2)}}function Nu(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(h=>h.entityRef===e.modelId),l=n.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>n.layout.associationLayouts.find(f=>f.associationRef===h),c=(r==null?void 0:r.geo)??{...du},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var f;return s_(h,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var f;return c_(h,(f=r==null?void 0:r.operationStyles)==null?void 0:f[h.modelId])}),ownedAssociations:l.map(h=>b_(h,n,s(h.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(d_),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function __(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>wu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Nu(c,n,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function wu(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function k_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=f_(e),r=p_(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:n.id,diagramVersion:n.diagramVersion,version:n.version,size:n.size??e.layout.canvasSize,packageName:n.packageName??e.logical.packageName,entities:i.map(s=>Nu(s,e,a,r)),groups:e.logical.groups.map(s=>__(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>wu(s))}}function E_(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,referenceOnly:n.referenceOnly,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const N_=["notNull"];function w_(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=_u(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(h=>[h.modelId,h]))]));for(const m of i.logical.entities){const h=c.get(m.modelId);if(h)for(const f of m.attributes){const y=h.get(f.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const k={};for(const _ of N_)f[_]===!0!=(y[_]===!0)&&(k[_]=f[_],s.attributeFieldsByName[_]=(s.attributeFieldsByName[_]??0)+1);Object.keys(k).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:k}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const h=d.get(m.modelId);h&&(m.end1.attributeRef&&m.end1.attributeRef!==h.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&h.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function ai(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function ln(e){return typeof e=="function"?e():t.unref(e)}const I_=typeof window<"u"&&typeof document<"u",v_=e=>typeof e<"u",C_=Object.prototype.toString,x_=e=>C_.call(e)==="[object Object]",S_=()=>{};function R_(e,n){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>n.apply(this,i),{fn:n,thisArg:this,args:i})).then(a).catch(r)})}return o}const Iu=e=>e();function A_(e=Iu){const n=t.ref(!0);function o(){n.value=!1}function i(){n.value=!0}const a=(...r)=>{n.value&&e(...r)};return{isActive:t.readonly(n),pause:o,resume:i,eventFilter:a}}function vu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function $_(e,n,o={}){const{eventFilter:i=Iu,...a}=o;return t.watch(e,R_(i,n),a)}function So(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=A_(i);return{stop:$_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function T_(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=ln(n.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function gl(e,n=!1){function o(m,{flush:h="sync",deep:f=!1,timeout:y,throwOnTimeout:k}={}){let _=null;const N=[new Promise(p=>{_=t.watch(e,b=>{m(b)!==n&&(_==null||_(),p(b))},{flush:h,deep:f,immediate:!0})})];return y!=null&&N.push(vu(y,k).then(()=>ln(e)).finally(()=>_==null?void 0:_())),Promise.race(N)}function i(m,h){if(!t.isRef(m))return o(b=>b===m,h);const{flush:f="sync",deep:y=!1,timeout:k,throwOnTimeout:_}=h??{};let E=null;const p=[new Promise(b=>{E=t.watch([e,m],([w,A])=>{n!==(w===A)&&(E==null||E(),b(w))},{flush:f,deep:y,immediate:!0})})];return k!=null&&p.push(vu(k,_).then(()=>ln(e)).finally(()=>(E==null||E(),ln(e)))),Promise.race(p)}function a(m){return o(h=>!!h,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,h){return o(f=>{const y=Array.from(f);return y.includes(m)||y.includes(ln(m))},h)}function d(m){return u(1,m)}function u(m=1,h){let f=-1;return o(()=>(f+=1,f>=m),h)}return Array.isArray(ln(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return gl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return gl(e,!n)}}}function bl(e){return gl(e)}function M_(e){var n;const o=ln(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Cu=I_?window:void 0;function xu(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Cu):[n,o,i,a]=e,!n)return S_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,h,f)=>(u.addEventListener(m,h,f),()=>u.removeEventListener(m,h,f)),c=t.watch(()=>[M_(n),ln(a)],([u,m])=>{if(l(),!u)return;const h=x_(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(y=>s(u,f,y,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ai(d),d}function V_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Su(...e){let n,o,i={};e.length===3?(n=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],i=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:a=Cu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=V_(n);return xu(a,r,u=>{u.repeat&&ln(s)||c(u)&&o(u)},l)}function B_(e){return JSON.parse(JSON.stringify(e))}function _l(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:h}=i,f=t.getCurrentInstance(),y=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let k=d;n||(n="modelValue"),k=k||`update:${n.toString()}`;const _=p=>s?typeof s=="function"?s(p):B_(p):p,E=()=>v_(e[n])?_(e[n]):m,N=p=>{h?h(p)&&y(k,p):y(k,p)};if(c){const p=E(),b=t.ref(p);let w=!1;return t.watch(()=>e[n],A=>{w||(w=!0,b.value=_(A),t.nextTick(()=>w=!1))}),t.watch(b,A=>{!w&&(A!==e[n]||u)&&N(A)},{deep:u}),b}else return t.computed({get(){return E()},set(p){N(p)}})}var D_={value:()=>{}};function pa(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new ha(o)}function ha(e){this._=e}function O_(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}ha.prototype=pa.prototype={constructor:ha,on:function(e,n){var o=this._,i=O_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=L_(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Ru(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Ru(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new ha(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function L_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Ru(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=D_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var kl="http://www.w3.org/1999/xhtml";const Au={svg:"http://www.w3.org/2000/svg",xhtml:kl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ya(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Au.hasOwnProperty(n)?{space:Au[n],local:e}:e}function P_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===kl&&n.documentElement.namespaceURI===kl?n.createElement(e):n.createElementNS(o,e)}}function z_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $u(e){var n=ya(e);return(n.local?z_:P_)(n)}function F_(){}function El(e){return e==null?F_:function(){return this.querySelector(e)}}function U_(e){typeof e!="function"&&(e=El(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Ct(i,this._parents)}function H_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function j_(){return[]}function Tu(e){return e==null?j_:function(){return this.querySelectorAll(e)}}function K_(e){return function(){return H_(e.apply(this,arguments))}}function G_(e){typeof e=="function"?e=K_(e):e=Tu(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Ct(i,a)}function Mu(e){return function(){return this.matches(e)}}function Vu(e){return function(n){return n.matches(e)}}var Y_=Array.prototype.find;function q_(e){return function(){return Y_.call(this.children,e)}}function W_(){return this.firstElementChild}function J_(e){return this.select(e==null?W_:q_(typeof e=="function"?e:Vu(e)))}var X_=Array.prototype.filter;function Z_(){return Array.from(this.children)}function Q_(e){return function(){return X_.call(this.children,e)}}function ek(e){return this.selectAll(e==null?Z_:Q_(typeof e=="function"?e:Vu(e)))}function tk(e){typeof e!="function"&&(e=Mu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Ct(i,this._parents)}function Bu(e){return new Array(e.length)}function nk(){return new Ct(this._enter||this._groups.map(Bu),this._parents)}function ga(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ga.prototype={constructor:ga,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ok(e){return function(){return e}}function ik(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new ga(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function ak(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(h[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ga(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function rk(e){return e.__data__}function lk(e,n){if(!arguments.length)return Array.from(this,rk);var o=n?ak:ik,i=this._parents,a=this._groups;typeof e!="function"&&(e=ok(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,f=sk(e.call(u,u&&u.__data__,d,i)),y=f.length,k=s[d]=new Array(y),_=l[d]=new Array(y),E=c[d]=new Array(h);o(u,m,k,_,E,f,n);for(var N=0,p=0,b,w;N<y;++N)if(b=k[N]){for(N>=p&&(p=N+1);!(w=_[p])&&++p<y;);b._next=w||null}}return l=new Ct(l,i),l._enter=s,l._exit=c,l}function sk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ck(){return new Ct(this._exit||this._groups.map(Bu),this._parents)}function dk(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function uk(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),f,y=0;y<m;++y)(f=d[y]||u[y])&&(h[y]=f);for(;c<a;++c)s[c]=o[c];return new Ct(s,this._parents)}function mk(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function fk(e){e||(e=pk);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Ct(a,this._parents).order()}function pk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function hk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function yk(){return Array.from(this)}function gk(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function bk(){let e=0;for(const n of this)++e;return e}function _k(){return!this.node()}function kk(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function Ek(e){return function(){this.removeAttribute(e)}}function Nk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wk(e,n){return function(){this.setAttribute(e,n)}}function Ik(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function vk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Ck(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function xk(e,n){var o=ya(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?Nk:Ek:typeof n=="function"?o.local?Ck:vk:o.local?Ik:wk)(o,n))}function Du(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Sk(e){return function(){this.style.removeProperty(e)}}function Rk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Ak(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function $k(e,n,o){return arguments.length>1?this.each((n==null?Sk:typeof n=="function"?Ak:Rk)(e,n,o??"")):Ro(this.node(),e)}function Ro(e,n){return e.style.getPropertyValue(n)||Du(e).getComputedStyle(e,null).getPropertyValue(n)}function Tk(e){return function(){delete this[e]}}function Mk(e,n){return function(){this[e]=n}}function Vk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Bk(e,n){return arguments.length>1?this.each((n==null?Tk:typeof n=="function"?Vk:Mk)(e,n)):this.node()[e]}function Ou(e){return e.trim().split(/^|\s+/)}function Nl(e){return e.classList||new Lu(e)}function Lu(e){this._node=e,this._names=Ou(e.getAttribute("class")||"")}Lu.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Pu(e,n){for(var o=Nl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function zu(e,n){for(var o=Nl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Dk(e){return function(){Pu(this,e)}}function Ok(e){return function(){zu(this,e)}}function Lk(e,n){return function(){(n.apply(this,arguments)?Pu:zu)(this,e)}}function Pk(e,n){var o=Ou(e+"");if(arguments.length<2){for(var i=Nl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Lk:n?Dk:Ok)(o,n))}function zk(){this.textContent=""}function Fk(e){return function(){this.textContent=e}}function Uk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Hk(e){return arguments.length?this.each(e==null?zk:(typeof e=="function"?Uk:Fk)(e)):this.node().textContent}function jk(){this.innerHTML=""}function Kk(e){return function(){this.innerHTML=e}}function Gk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Yk(e){return arguments.length?this.each(e==null?jk:(typeof e=="function"?Gk:Kk)(e)):this.node().innerHTML}function qk(){this.nextSibling&&this.parentNode.appendChild(this)}function Wk(){return this.each(qk)}function Jk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xk(){return this.each(Jk)}function Zk(e){var n=typeof e=="function"?e:$u(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Qk(){return null}function eE(e,n){var o=typeof e=="function"?e:$u(e),i=n==null?Qk:typeof n=="function"?n:El(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function tE(){var e=this.parentNode;e&&e.removeChild(this)}function nE(){return this.each(tE)}function oE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function iE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function aE(e){return this.select(e?iE:oE)}function rE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function lE(e){return function(n){e.call(this,n,this.__data__)}}function sE(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function cE(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function dE(e,n,o){return function(){var i=this.__on,a,r=lE(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function uE(e,n,o){var i=sE(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?dE:cE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Fu(e,n,o){var i=Du(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function mE(e,n){return function(){return Fu(this,e,n)}}function fE(e,n){return function(){return Fu(this,e,n.apply(this,arguments))}}function pE(e,n){return this.each((typeof n=="function"?fE:mE)(e,n))}function*hE(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Uu=[null];function Ct(e,n){this._groups=e,this._parents=n}function ri(){return new Ct([[document.documentElement]],Uu)}function yE(){return this}Ct.prototype=ri.prototype={constructor:Ct,select:U_,selectAll:G_,selectChild:J_,selectChildren:ek,filter:tk,data:lk,enter:nk,exit:ck,join:dk,merge:uk,selection:yE,order:mk,sort:fk,call:hk,nodes:yk,node:gk,size:bk,empty:_k,each:kk,attr:xk,style:$k,property:Bk,classed:Pk,text:Hk,html:Yk,raise:Wk,lower:Xk,append:Zk,insert:eE,remove:nE,clone:aE,datum:rE,on:uE,dispatch:pE,[Symbol.iterator]:hE};function Mt(e){return typeof e=="string"?new Ct([[document.querySelector(e)]],[document.documentElement]):new Ct([[e]],Uu)}function gE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Yt(e,n){if(e=gE(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const bE={passive:!1},li={capture:!0,passive:!1};function wl(e){e.stopImmediatePropagation()}function Ao(e){e.preventDefault(),e.stopImmediatePropagation()}function Hu(e){var n=e.document.documentElement,o=Mt(e).on("dragstart.drag",Ao,li);"onselectstart"in n?o.on("selectstart.drag",Ao,li):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function ju(e,n){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ao,li),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const ba=e=>()=>e;function Il(e,{sourceEvent:n,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}Il.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function _E(e){return!e.ctrlKey&&!e.button}function kE(){return this.parentNode}function EE(e,n){return n??{x:e.x,y:e.y}}function NE(){return navigator.maxTouchPoints||"ontouchstart"in this}function wE(){var e=_E,n=kE,o=EE,i=NE,a={},r=pa("start","drag","end"),l=0,s,c,d,u,m=0;function h(b){b.on("mousedown.drag",f).filter(i).on("touchstart.drag",_).on("touchmove.drag",E,bE).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(b,w){if(!(u||!e.call(this,b,w))){var A=p(this,n.call(this,b,w),b,w,"mouse");A&&(Mt(b.view).on("mousemove.drag",y,li).on("mouseup.drag",k,li),Hu(b.view),wl(b),d=!1,s=b.clientX,c=b.clientY,A("start",b))}}function y(b){if(Ao(b),!d){var w=b.clientX-s,A=b.clientY-c;d=w*w+A*A>m}a.mouse("drag",b)}function k(b){Mt(b.view).on("mousemove.drag mouseup.drag",null),ju(b.view,d),Ao(b),a.mouse("end",b)}function _(b,w){if(e.call(this,b,w)){var A=b.changedTouches,$=n.call(this,b,w),L=A.length,T,S;for(T=0;T<L;++T)(S=p(this,$,b,w,A[T].identifier,A[T]))&&(wl(b),S("start",b,A[T]))}}function E(b){var w=b.changedTouches,A=w.length,$,L;for($=0;$<A;++$)(L=a[w[$].identifier])&&(Ao(b),L("drag",b,w[$]))}function N(b){var w=b.changedTouches,A=w.length,$,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),$=0;$<A;++$)(L=a[w[$].identifier])&&(wl(b),L("end",b,w[$]))}function p(b,w,A,$,L,T){var S=r.copy(),C=Yt(T||A,w),M,B,g;if((g=o.call(b,new Il("beforestart",{sourceEvent:A,target:h,identifier:L,active:l,x:C[0],y:C[1],dx:0,dy:0,dispatch:S}),$))!=null)return M=g.x-C[0]||0,B=g.y-C[1]||0,function I(v,O,x){var z=C,j;switch(v){case"start":a[L]=I,j=l++;break;case"end":delete a[L],--l;case"drag":C=Yt(x||O,w),j=l;break}S.call(v,b,new Il(v,{sourceEvent:O,subject:g,target:h,identifier:L,active:j,x:C[0]+M,y:C[1]+B,dx:C[0]-z[0],dy:C[1]-z[1],dispatch:S}),$)}}return h.filter=function(b){return arguments.length?(e=typeof b=="function"?b:ba(!!b),h):e},h.container=function(b){return arguments.length?(n=typeof b=="function"?b:ba(b),h):n},h.subject=function(b){return arguments.length?(o=typeof b=="function"?b:ba(b),h):o},h.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:ba(!!b),h):i},h.on=function(){var b=r.on.apply(r,arguments);return b===r?h:b},h.clickDistance=function(b){return arguments.length?(m=(b=+b)*b,h):Math.sqrt(m)},h}function vl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Ku(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function si(){}var ci=.7,_a=1/ci,$o="\\s*([+-]?\\d+)\\s*",di="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",IE=/^#([0-9a-f]{3,8})$/,vE=new RegExp(`^rgb\\(${$o},${$o},${$o}\\)$`),CE=new RegExp(`^rgb\\(${qt},${qt},${qt}\\)$`),xE=new RegExp(`^rgba\\(${$o},${$o},${$o},${di}\\)$`),SE=new RegExp(`^rgba\\(${qt},${qt},${qt},${di}\\)$`),RE=new RegExp(`^hsl\\(${di},${qt},${qt}\\)$`),AE=new RegExp(`^hsla\\(${di},${qt},${qt},${di}\\)$`),Gu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};vl(si,Yn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Yu,formatHex:Yu,formatHex8:$E,formatHsl:TE,formatRgb:qu,toString:qu});function Yu(){return this.rgb().formatHex()}function $E(){return this.rgb().formatHex8()}function TE(){return Qu(this).formatHsl()}function qu(){return this.rgb().formatRgb()}function Yn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=IE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Wu(n):o===3?new Nt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ka(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ka(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=vE.exec(e))?new Nt(n[1],n[2],n[3],1):(n=CE.exec(e))?new Nt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=xE.exec(e))?ka(n[1],n[2],n[3],n[4]):(n=SE.exec(e))?ka(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=RE.exec(e))?Zu(n[1],n[2]/100,n[3]/100,1):(n=AE.exec(e))?Zu(n[1],n[2]/100,n[3]/100,n[4]):Gu.hasOwnProperty(e)?Wu(Gu[e]):e==="transparent"?new Nt(NaN,NaN,NaN,0):null}function Wu(e){return new Nt(e>>16&255,e>>8&255,e&255,1)}function ka(e,n,o,i){return i<=0&&(e=n=o=NaN),new Nt(e,n,o,i)}function ME(e){return e instanceof si||(e=Yn(e)),e?(e=e.rgb(),new Nt(e.r,e.g,e.b,e.opacity)):new Nt}function Cl(e,n,o,i){return arguments.length===1?ME(e):new Nt(e,n,o,i??1)}function Nt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}vl(Nt,Cl,Ku(si,{brighter(e){return e=e==null?_a:Math.pow(_a,e),new Nt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ci:Math.pow(ci,e),new Nt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Nt(qn(this.r),qn(this.g),qn(this.b),Ea(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ju,formatHex:Ju,formatHex8:VE,formatRgb:Xu,toString:Xu}));function Ju(){return`#${Wn(this.r)}${Wn(this.g)}${Wn(this.b)}`}function VE(){return`#${Wn(this.r)}${Wn(this.g)}${Wn(this.b)}${Wn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xu(){const e=Ea(this.opacity);return`${e===1?"rgb(":"rgba("}${qn(this.r)}, ${qn(this.g)}, ${qn(this.b)}${e===1?")":`, ${e})`}`}function Ea(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Wn(e){return e=qn(e),(e<16?"0":"")+e.toString(16)}function Zu(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Vt(e,n,o,i)}function Qu(e){if(e instanceof Vt)return new Vt(e.h,e.s,e.l,e.opacity);if(e instanceof si||(e=Yn(e)),!e)return new Vt;if(e instanceof Vt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Vt(l,s,c,e.opacity)}function BE(e,n,o,i){return arguments.length===1?Qu(e):new Vt(e,n,o,i??1)}function Vt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}vl(Vt,BE,Ku(si,{brighter(e){return e=e==null?_a:Math.pow(_a,e),new Vt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ci:Math.pow(ci,e),new Vt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new Nt(xl(e>=240?e-240:e+120,a,i),xl(e,a,i),xl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Vt(em(this.h),Na(this.s),Na(this.l),Ea(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ea(this.opacity);return`${e===1?"hsl(":"hsla("}${em(this.h)}, ${Na(this.s)*100}%, ${Na(this.l)*100}%${e===1?")":`, ${e})`}`}}));function em(e){return e=(e||0)%360,e<0?e+360:e}function Na(e){return Math.max(0,Math.min(1,e||0))}function xl(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Sl=e=>()=>e;function DE(e,n){return function(o){return e+o*n}}function OE(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function LE(e){return(e=+e)==1?tm:function(n,o){return o-n?OE(n,o,e):Sl(isNaN(n)?o:n)}}function tm(e,n){var o=n-e;return o?DE(e,o):Sl(isNaN(e)?n:e)}const wa=(function e(n){var o=LE(n);function i(a,r){var l=o((a=Cl(a)).r,(r=Cl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=tm(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function PE(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,i=n.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+n[a]*r;return i}}function zE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function FE(e,n){var o=n?n.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=ui(e[l],n[l]);for(;l<o;++l)r[l]=n[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function UE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function Wt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function HE(e,n){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in e?o[a]=ui(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Rl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Al=new RegExp(Rl.source,"g");function jE(e){return function(){return e}}function KE(e){return function(n){return e(n)+""}}function nm(e,n){var o=Rl.lastIndex=Al.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Rl.exec(e))&&(a=Al.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Wt(i,a)})),o=Al.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?KE(c[0].x):jE(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function ui(e,n){var o=typeof n,i;return n==null||o==="boolean"?Sl(n):(o==="number"?Wt:o==="string"?(i=Yn(n))?(n=i,wa):nm:n instanceof Yn?wa:n instanceof Date?UE:zE(n)?PE:Array.isArray(n)?FE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?HE:Wt)(e,n)}var om=180/Math.PI,$l={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function im(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*om,skewX:Math.atan(c)*om,scaleX:l,scaleY:s}}var Ia;function GE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?$l:im(n.a,n.b,n.c,n.d,n.e,n.f)}function YE(e){return e==null||(Ia||(Ia=document.createElementNS("http://www.w3.org/2000/svg","g")),Ia.setAttribute("transform",e),!(e=Ia.transform.baseVal.consolidate()))?$l:(e=e.matrix,im(e.a,e.b,e.c,e.d,e.e,e.f))}function am(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,f,y){if(d!==m||u!==h){var k=f.push("translate(",null,n,null,o);y.push({i:k-4,x:Wt(d,m)},{i:k-2,x:Wt(u,h)})}else(m||h)&&f.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Wt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Wt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,f,y){if(d!==m||u!==h){var k=f.push(a(f)+"scale(",null,",",null,")");y.push({i:k-4,x:Wt(d,m)},{i:k-2,x:Wt(u,h)})}else(m!==1||h!==1)&&f.push(a(f)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(f){for(var y=-1,k=h.length,_;++y<k;)m[(_=h[y]).i]=_.x(f);return m.join("")}}}var qE=am(GE,"px, ","px)","deg)"),WE=am(YE,", ",")",")"),JE=1e-12;function rm(e){return((e=Math.exp(e))+1/e)/2}function XE(e){return((e=Math.exp(e))-1/e)/2}function ZE(e){return((e=Math.exp(2*e))-1)/(e+1)}const va=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],f=u-s,y=m-c,k=f*f+y*y,_,E;if(k<JE)E=Math.log(h/d)/n,_=function($){return[s+$*f,c+$*y,d*Math.exp(n*$*E)]};else{var N=Math.sqrt(k),p=(h*h-d*d+i*k)/(2*d*o*N),b=(h*h-d*d-i*k)/(2*h*o*N),w=Math.log(Math.sqrt(p*p+1)-p),A=Math.log(Math.sqrt(b*b+1)-b);E=(A-w)/n,_=function($){var L=$*E,T=rm(w),S=d/(o*N)*(T*ZE(n*L+w)-XE(w));return[s+S*f,c+S*y,d*T/rm(n*L+w)]}}return _.duration=E*1e3*n/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var To=0,mi=0,fi=0,lm=1e3,Ca,pi,xa=0,Jn=0,Sa=0,hi=typeof performance=="object"&&performance.now?performance:Date,sm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Tl(){return Jn||(sm(QE),Jn=hi.now()+Sa)}function QE(){Jn=0}function Ra(){this._call=this._time=this._next=null}Ra.prototype=cm.prototype={constructor:Ra,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Tl():+o)+(n==null?0:+n),!this._next&&pi!==this&&(pi?pi._next=this:Ca=this,pi=this),this._call=e,this._time=o,Ml()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ml())}};function cm(e,n,o){var i=new Ra;return i.restart(e,n,o),i}function e1(){Tl(),++To;for(var e=Ca,n;e;)(n=Jn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--To}function dm(){Jn=(xa=hi.now())+Sa,To=mi=0;try{e1()}finally{To=0,n1(),Jn=0}}function t1(){var e=hi.now(),n=e-xa;n>lm&&(Sa-=n,xa=e)}function n1(){for(var e,n=Ca,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ca=o);pi=e,Ml(i)}function Ml(e){if(!To){mi&&(mi=clearTimeout(mi));var n=e-Jn;n>24?(e<1/0&&(mi=setTimeout(dm,e-hi.now()-Sa)),fi&&(fi=clearInterval(fi))):(fi||(xa=hi.now(),fi=setInterval(t1,lm)),To=1,sm(dm))}}function um(e,n,o){var i=new Ra;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var o1=pa("start","end","cancel","interrupt"),i1=[],mm=0,fm=1,Vl=2,Aa=3,pm=4,Bl=5,$a=6;function Ta(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;a1(e,o,{name:n,index:i,group:a,on:o1,tween:i1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:mm})}function Dl(e,n){var o=Bt(e,n);if(o.state>mm)throw new Error("too late; already scheduled");return o}function Jt(e,n){var o=Bt(e,n);if(o.state>Aa)throw new Error("too late; already running");return o}function Bt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function a1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=cm(r,0,o.time);function r(d){o.state=fm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,f;if(o.state!==fm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Aa)return um(l);f.state===pm?(f.state=$a,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=$a,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(um(function(){o.state===Aa&&(o.state=pm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Vl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Vl){for(o.state=Aa,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Bl,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Bl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=$a,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Ma(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>Vl&&i.state<Bl,i.state=$a,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function r1(e){return this.each(function(){Ma(this,e)})}function l1(e,n){var o,i;return function(){var a=Jt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function s1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Jt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function c1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Bt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?l1:s1)(o,e,n))}function Ol(e,n,o){var i=e._id;return e.each(function(){var a=Jt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Bt(a,i).value[n]}}function hm(e,n){var o;return(typeof n=="number"?Wt:n instanceof Yn?wa:(o=Yn(n))?(n=o,wa):nm)(e,n)}function d1(e){return function(){this.removeAttribute(e)}}function u1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function m1(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function f1(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function p1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function h1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function y1(e,n){var o=ya(e),i=o==="transform"?WE:hm;return this.attrTween(e,typeof n=="function"?(o.local?h1:p1)(o,i,Ol(this,"attr."+e,n)):n==null?(o.local?u1:d1)(o):(o.local?f1:m1)(o,i,n))}function g1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function b1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function _1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&b1(e,r)),o}return a._value=n,a}function k1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&g1(e,r)),o}return a._value=n,a}function E1(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=ya(e);return this.tween(o,(i.local?_1:k1)(i,n))}function N1(e,n){return function(){Dl(this,e).delay=+n.apply(this,arguments)}}function w1(e,n){return n=+n,function(){Dl(this,e).delay=n}}function I1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?N1:w1)(n,e)):Bt(this.node(),n).delay}function v1(e,n){return function(){Jt(this,e).duration=+n.apply(this,arguments)}}function C1(e,n){return n=+n,function(){Jt(this,e).duration=n}}function x1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?v1:C1)(n,e)):Bt(this.node(),n).duration}function S1(e,n){if(typeof n!="function")throw new Error;return function(){Jt(this,e).ease=n}}function R1(e){var n=this._id;return arguments.length?this.each(S1(n,e)):Bt(this.node(),n).ease}function A1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Jt(this,e).ease=o}}function $1(e){if(typeof e!="function")throw new Error;return this.each(A1(this._id,e))}function T1(e){typeof e!="function"&&(e=Mu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new sn(i,this._parents,this._name,this._id)}function M1(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,f=0;f<u;++f)(h=c[f]||d[f])&&(m[f]=h);for(;s<i;++s)l[s]=n[s];return new sn(l,this._parents,this._name,this._id)}function V1(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function B1(e,n,o){var i,a,r=V1(n)?Dl:Jt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function D1(e,n){var o=this._id;return arguments.length<2?Bt(this.node(),o).on.on(e):this.each(B1(o,e,n))}function O1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function L1(){return this.on("end.remove",O1(this._id))}function P1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=El(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,Ta(d[h],n,o,h,d,Bt(u,o)));return new sn(r,this._parents,n,o)}function z1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Tu(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),f,y=Bt(u,o),k=0,_=h.length;k<_;++k)(f=h[k])&&Ta(f,n,o,k,h,y);r.push(h),l.push(u)}return new sn(r,l,n,o)}var F1=ri.prototype.constructor;function U1(){return new F1(this._groups,this._parents)}function H1(e,n){var o,i,a;return function(){var r=Ro(this,e),l=(this.style.removeProperty(e),Ro(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function ym(e){return function(){this.style.removeProperty(e)}}function j1(e,n,o){var i,a=o+"",r;return function(){var l=Ro(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function K1(e,n,o){var i,a,r;return function(){var l=Ro(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Ro(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function G1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Jt(this,e),d=c.on,u=c.value[r]==null?s||(s=ym(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function Y1(e,n,o){var i=(e+="")=="transform"?qE:hm;return n==null?this.styleTween(e,H1(e,i)).on("end.style."+e,ym(e)):typeof n=="function"?this.styleTween(e,K1(e,i,Ol(this,"style."+e,n))).each(G1(this._id,e)):this.styleTween(e,j1(e,i,n),o).on("end.style."+e,null)}function q1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function W1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&q1(e,l,o)),i}return r._value=n,r}function J1(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,W1(e,n,o??""))}function X1(e){return function(){this.textContent=e}}function Z1(e){return function(){var n=e(this);this.textContent=n??""}}function Q1(e){return this.tween("text",typeof e=="function"?Z1(Ol(this,"text",e)):X1(e==null?"":e+""))}function e0(e){return function(n){this.textContent=e.call(this,n)}}function t0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&e0(a)),n}return i._value=e,i}function n0(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,t0(e))}function o0(){for(var e=this._name,n=this._id,o=gm(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Bt(c,n);Ta(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new sn(i,this._parents,e,o)}function i0(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Jt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var a0=0;function sn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function gm(){return++a0}var cn=ri.prototype;sn.prototype={constructor:sn,select:P1,selectAll:z1,selectChild:cn.selectChild,selectChildren:cn.selectChildren,filter:T1,merge:M1,selection:U1,transition:o0,call:cn.call,nodes:cn.nodes,node:cn.node,size:cn.size,empty:cn.empty,each:cn.each,on:D1,attr:y1,attrTween:E1,style:Y1,styleTween:J1,text:Q1,textTween:n0,remove:L1,tween:c1,delay:I1,duration:x1,ease:R1,easeVarying:$1,end:i0,[Symbol.iterator]:cn[Symbol.iterator]};function r0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var l0={time:null,delay:0,duration:250,ease:r0};function s0(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function c0(e){var n,o;e instanceof sn?(n=e._id,e=e._name):(n=gm(),(o=l0).time=Tl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Ta(c,e,n,d,l,o||s0(c,n));return new sn(i,this._parents,e,n)}ri.prototype.interrupt=r1,ri.prototype.transition=c0;const Va=e=>()=>e;function d0(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function dn(e,n,o){this.k=e,this.x=n,this.y=o}dn.prototype={constructor:dn,scale:function(e){return e===1?this:new dn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new dn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Mo=new dn(1,0,0);dn.prototype;function Ll(e){e.stopImmediatePropagation()}function yi(e){e.preventDefault(),e.stopImmediatePropagation()}function u0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function m0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function bm(){return this.__zoom||Mo}function f0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function p0(){return navigator.maxTouchPoints||"ontouchstart"in this}function h0(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function y0(){var e=u0,n=m0,o=h0,i=f0,a=p0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=va,d=pa("start","zoom","end"),u,m,h,f=500,y=150,k=0,_=10;function E(g){g.property("__zoom",bm).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(g,I,v,O){var x=g.selection?g.selection():g;x.property("__zoom",bm),g!==x?w(g,I,v,O):x.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},E.scaleBy=function(g,I,v,O){E.scaleTo(g,function(){var x=this.__zoom.k,z=typeof I=="function"?I.apply(this,arguments):I;return x*z},v,O)},E.scaleTo=function(g,I,v,O){E.transform(g,function(){var x=n.apply(this,arguments),z=this.__zoom,j=v==null?b(x):typeof v=="function"?v.apply(this,arguments):v,ne=z.invert(j),de=typeof I=="function"?I.apply(this,arguments):I;return o(p(N(z,de),j,ne),x,l)},v,O)},E.translateBy=function(g,I,v,O){E.transform(g,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,O)},E.translateTo=function(g,I,v,O,x){E.transform(g,function(){var z=n.apply(this,arguments),j=this.__zoom,ne=O==null?b(z):typeof O=="function"?O.apply(this,arguments):O;return o(Mo.translate(ne[0],ne[1]).scale(j.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),z,l)},O,x)};function N(g,I){return I=Math.max(r[0],Math.min(r[1],I)),I===g.k?g:new dn(I,g.x,g.y)}function p(g,I,v){var O=I[0]-v[0]*g.k,x=I[1]-v[1]*g.k;return O===g.x&&x===g.y?g:new dn(g.k,O,x)}function b(g){return[(+g[0][0]+ +g[1][0])/2,(+g[0][1]+ +g[1][1])/2]}function w(g,I,v,O){g.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var x=this,z=arguments,j=A(x,z).event(O),ne=n.apply(x,z),de=v==null?b(ne):typeof v=="function"?v.apply(x,z):v,pe=Math.max(ne[1][0]-ne[0][0],ne[1][1]-ne[0][1]),he=x.__zoom,fe=typeof I=="function"?I.apply(x,z):I,ye=c(he.invert(de).concat(pe/he.k),fe.invert(de).concat(pe/fe.k));return function(_e){if(_e===1)_e=fe;else{var Re=ye(_e),ce=pe/Re[2];_e=new dn(ce,de[0]-Re[0]*ce,de[1]-Re[1]*ce)}j.zoom(null,_e)}})}function A(g,I,v){return!v&&g.__zooming||new $(g,I)}function $(g,I){this.that=g,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(g,I),this.taps=0}$.prototype={event:function(g){return g&&(this.sourceEvent=g),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(g,I){return this.mouse&&g!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&g!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&g!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(g){var I=Mt(this.that).datum();d.call(g,this.that,new d0(g,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),I)}};function L(g,...I){if(!e.apply(this,arguments))return;var v=A(this,I).event(g),O=this.__zoom,x=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),z=Yt(g);if(v.wheel)(v.mouse[0][0]!==z[0]||v.mouse[0][1]!==z[1])&&(v.mouse[1]=O.invert(v.mouse[0]=z)),clearTimeout(v.wheel);else{if(O.k===x)return;v.mouse=[z,O.invert(z)],Ma(this),v.start()}yi(g),v.wheel=setTimeout(j,y),v.zoom("mouse",o(p(N(O,x),v.mouse[0],v.mouse[1]),v.extent,l));function j(){v.wheel=null,v.end()}}function T(g,...I){if(h||!e.apply(this,arguments))return;var v=g.currentTarget,O=A(this,I,!0).event(g),x=Mt(g.view).on("mousemove.zoom",de,!0).on("mouseup.zoom",pe,!0),z=Yt(g,v),j=g.clientX,ne=g.clientY;Hu(g.view),Ll(g),O.mouse=[z,this.__zoom.invert(z)],Ma(this),O.start();function de(he){if(yi(he),!O.moved){var fe=he.clientX-j,ye=he.clientY-ne;O.moved=fe*fe+ye*ye>k}O.event(he).zoom("mouse",o(p(O.that.__zoom,O.mouse[0]=Yt(he,v),O.mouse[1]),O.extent,l))}function pe(he){x.on("mousemove.zoom mouseup.zoom",null),ju(he.view,O.moved),yi(he),O.event(he).end()}}function S(g,...I){if(e.apply(this,arguments)){var v=this.__zoom,O=Yt(g.changedTouches?g.changedTouches[0]:g,this),x=v.invert(O),z=v.k*(g.shiftKey?.5:2),j=o(p(N(v,z),O,x),n.apply(this,I),l);yi(g),s>0?Mt(this).transition().duration(s).call(w,j,O,g):Mt(this).call(E.transform,j,O,g)}}function C(g,...I){if(e.apply(this,arguments)){var v=g.touches,O=v.length,x=A(this,I,g.changedTouches.length===O).event(g),z,j,ne,de;for(Ll(g),j=0;j<O;++j)ne=v[j],de=Yt(ne,this),de=[de,this.__zoom.invert(de),ne.identifier],x.touch0?!x.touch1&&x.touch0[2]!==de[2]&&(x.touch1=de,x.taps=0):(x.touch0=de,z=!0,x.taps=1+!!u);u&&(u=clearTimeout(u)),z&&(x.taps<2&&(m=de[0],u=setTimeout(function(){u=null},f)),Ma(this),x.start())}}function M(g,...I){if(this.__zooming){var v=A(this,I).event(g),O=g.changedTouches,x=O.length,z,j,ne,de;for(yi(g),z=0;z<x;++z)j=O[z],ne=Yt(j,this),v.touch0&&v.touch0[2]===j.identifier?v.touch0[0]=ne:v.touch1&&v.touch1[2]===j.identifier&&(v.touch1[0]=ne);if(j=v.that.__zoom,v.touch1){var pe=v.touch0[0],he=v.touch0[1],fe=v.touch1[0],ye=v.touch1[1],_e=(_e=fe[0]-pe[0])*_e+(_e=fe[1]-pe[1])*_e,Re=(Re=ye[0]-he[0])*Re+(Re=ye[1]-he[1])*Re;j=N(j,Math.sqrt(_e/Re)),ne=[(pe[0]+fe[0])/2,(pe[1]+fe[1])/2],de=[(he[0]+ye[0])/2,(he[1]+ye[1])/2]}else if(v.touch0)ne=v.touch0[0],de=v.touch0[1];else return;v.zoom("touch",o(p(j,ne,de),v.extent,l))}}function B(g,...I){if(this.__zooming){var v=A(this,I).event(g),O=g.changedTouches,x=O.length,z,j;for(Ll(g),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),z=0;z<x;++z)j=O[z],v.touch0&&v.touch0[2]===j.identifier?delete v.touch0:v.touch1&&v.touch1[2]===j.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(j=Yt(j,this),Math.hypot(m[0]-j[0],m[1]-j[1])<_)){var ne=Mt(this).on("dblclick.zoom");ne&&ne.apply(this,arguments)}}}return E.wheelDelta=function(g){return arguments.length?(i=typeof g=="function"?g:Va(+g),E):i},E.filter=function(g){return arguments.length?(e=typeof g=="function"?g:Va(!!g),E):e},E.touchable=function(g){return arguments.length?(a=typeof g=="function"?g:Va(!!g),E):a},E.extent=function(g){return arguments.length?(n=typeof g=="function"?g:Va([[+g[0][0],+g[0][1]],[+g[1][0],+g[1][1]]]),E):n},E.scaleExtent=function(g){return arguments.length?(r[0]=+g[0],r[1]=+g[1],E):[r[0],r[1]]},E.translateExtent=function(g){return arguments.length?(l[0][0]=+g[0][0],l[1][0]=+g[1][0],l[0][1]=+g[0][1],l[1][1]=+g[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(g){return arguments.length?(o=g,E):o},E.duration=function(g){return arguments.length?(s=+g,E):s},E.interpolate=function(g){return arguments.length?(c=g,E):c},E.on=function(){var g=d.on.apply(d,arguments);return g===d?E:g},E.clickDistance=function(g){return arguments.length?(k=(g=+g)*g,E):Math.sqrt(k)},E.tapDistance=function(g){return arguments.length?(_=+g,E):_},E}var Me=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Me||{}),Pl=(e=>(e.Partial="partial",e.Full="full",e))(Pl||{}),Xn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Xn||{}),un=(e=>(e.Strict="strict",e.Loose="loose",e))(un||{}),zl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(zl||{}),gi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(gi||{}),_m=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(_m||{});const g0=["INPUT","SELECT","TEXTAREA"],b0=typeof document<"u"?document:null;function Fl(e){var n,o;const i=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return g0.includes(i==null?void 0:i.nodeName)||a||!!r}function _0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function km(e,n,o,i){const a=n.replace("+",`
|
|
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 b0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=_0(o.code,e);return Array.isArray(e)?e.some(a=>ym(o[i],a,n,o.type==="keyup")):ym(o[i],e,n,o.type==="keyup")}}function _0(e,n){return n.includes(e)?"code":"key"}function yi(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??y0),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}),wu(["blur","contextmenu"],s),Iu((...d)=>l(...d),d=>{var u,m;const h=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,f=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=g0(d),(!a||a&&!h)&&Ll(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,_=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!f&&(a||!_)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Iu((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Ll(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"?b0(d,r):d}return i}const gm="vue-flow__node-desc",bm="vue-flow__edge-desc",k0="vue-flow__aria-live",_m=["Enter"," ","Escape"],Ao={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Va(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ba(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 Da(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Wn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function km(e,n){return{x:Wn(e.x,n[0][0],n[1][0]),y:Wn(e.y,n[0][1],n[1][1])}}function Em(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function xn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Jn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!xn(e)}function gi(e){return Jn(e)&&"computedPosition"in e}function Oa(e){return!Number.isNaN(e)&&Number.isFinite(e)}function E0(e){return Oa(e.width)&&Oa(e.height)&&Oa(e.x)&&Oa(e.y)}function N0(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function Nm(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function wm(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 w0(...e){if(e.length===3){const[r,l,s]=e;return wm(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>xn(r)&&r.source===i).map(r=>o.find(l=>Jn(l)&&l.id===r.target))}function I0(...e){if(e.length===3){const[r,l,s]=e;return wm(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>xn(r)&&r.target===i).map(r=>o.find(l=>Jn(l)&&l.id===r.source))}function Im({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function v0(e,n){return n.some(o=>xn(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 bi({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function _i({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?Pa(s,l):s}function vm(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 La({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function Cm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function C0(e,n){return Cm(vm(La(e),La(n)))}function Pl(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=vm(n,La({...i.computedPosition,...i.dimensions}))}return Cm(n)}function xm(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={..._i(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,h=c.height??s.height??null;if(a&&!d||u)continue;const f=Ba(r,Va(s)),y=m===null||h===null,g=i&&f>0,_=(m??0)*(h??0);(y||g||f>=_||s.dragging)&&l.push(s)}return l}function Xn(e,n){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return n.filter(i=>o.has(i.source)||o.has(i.target))}function $o(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 Ni(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function x0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=$o(e,o),a=$o(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=$o(e.top??e.y??0,o),a=$o(e.bottom??e.y??0,o),r=$o(e.left??e.x??0,n),l=$o(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 S0(e,n,o,i,a,r){const{x:l,y:s}=bi(e,{x:n,y:o,zoom:i}),{x:c,y:d}=bi({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 Sm(e,n,o,i,a,r=.1){const l=x0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=Wn(d,i,a),m=e.x+e.width/2,h=e.y+e.height/2,f=n/2-m*u,y=o/2-h*u,g=S0(e,f,y,u,n,o),_={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:f-_.left+_.right,y:y-_.top+_.bottom,zoom:u}}function R0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Rm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Rm(o,n):!1}function ki(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function zl(e){const n=e.ctrlKey&&Ei()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function Am(e,n,o){return e<n?Wn(Math.abs(e-n),1,n)/n:e>o?-Wn(Math.abs(e-o),1,n)/n:0}function $m(e,n,o=15,i=40){const a=Am(e.x,i,n.width-i)*o,r=Am(e.y,i,n.height-i)*o;return[a,r]}function Fl(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 Tm(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(gi(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&&gi(c)&&Fl(l,c)}break;case"dimensions":if(gi(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&&gi(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Fl(l,c):t.nextTick(()=>{Fl(l,c)}))}break}return n}function Sn(e,n){return{id:e,type:"select",selected:n}}function Mm(e){return{item:e,type:"add"}}function Vm(e){return{id:e,type:"remove"}}function Bm(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Rn(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(Sn(r.id,l)))}return i}const Dm=()=>{};function Re(e){const n=new Set;let o=Dm,i=()=>!1;const a=()=>n.size>0||i(),r=h=>{o=h},l=()=>{o=Dm},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{n.delete(h)};return{on:h=>{n.add(h);const f=()=>d(h);return oi(f),{off:f}},off:d,trigger:h=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(y=>y(h)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Om(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 A0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Rm(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 Ul({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 Lm(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 $0(e,n,o){const[i,a,r,l]=typeof e!="string"?Lm(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 T0(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=$0(a,e,i);r&&(a=r)}else n(new ft(st.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Lm(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 M0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Hl(e,n,o,i,a){const r=M0(e.dimensions,T0(e,o,i,a)),l=km(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 To(e,n,o=$e.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??O0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case $e.Top:return{x:a+l/2,y:r};case $e.Right:return{x:a+l,y:r+s/2};case $e.Bottom:return{x:a+l/2,y:r+s};case $e.Left:return{x:a,y:r+s/2}}}function Pm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function V0({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=La({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),h=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*h)>0}function B0(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var st=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(st||{});const zm={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 k0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=E0(o.code,e);return Array.isArray(e)?e.some(a=>km(o[i],a,n,o.type==="keyup")):km(o[i],e,n,o.type==="keyup")}}function E0(e,n){return n.includes(e)?"code":"key"}function bi(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??b0),i=t.shallowRef(t.toValue(e)===!0);let a=!1;const r=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),xu(["blur","contextmenu"],s),Su((...d)=>l(...d),d=>{var u,m;const h=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,f=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=_0(d),(!a||a&&!h)&&Fl(d))return;const k=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,_=(k==null?void 0:k.nodeName)==="BUTTON"||(k==null?void 0:k.nodeName)==="A";!f&&(a||!_)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Su((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Fl(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=t.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?k0(d,r):d}return i}const Em="vue-flow__node-desc",Nm="vue-flow__edge-desc",N0="vue-flow__aria-live",wm=["Enter"," ","Escape"],Vo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ba(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Da(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*i)}function Oa(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Zn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function Im(e,n){return{x:Zn(e.x,n[0][0],n[1][0]),y:Zn(e.y,n[0][1],n[1][1])}}function vm(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function An(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Qn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!An(e)}function _i(e){return Qn(e)&&"computedPosition"in e}function La(e){return!Number.isNaN(e)&&Number.isFinite(e)}function w0(e){return La(e.width)&&La(e.height)&&La(e.x)&&La(e.y)}function I0(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ut(e.data)?e.data:{},events:t.markRaw(ut(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function Cm(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:ut(e.data)?e.data:{},events:t.markRaw(ut(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function xm(e,n,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return n.filter(s=>r.has(s.id))}function v0(...e){if(e.length===3){const[r,l,s]=e;return xm(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>An(r)&&r.source===i).map(r=>o.find(l=>Qn(l)&&l.id===r.target))}function C0(...e){if(e.length===3){const[r,l,s]=e;return xm(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>An(r)&&r.target===i).map(r=>o.find(l=>Qn(l)&&l.id===r.source))}function Sm({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function x0(e,n){return n.some(o=>An(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function ki({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function Ei({x:e,y:n},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(n-i)/a};return r?za(s,l):s}function Rm(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function Pa({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function Am({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function S0(e,n){return Am(Rm(Pa(e),Pa(n)))}function Ul(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];n=Rm(n,Pa({...i.computedPosition,...i.dimensions}))}return Am(n)}function $m(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...Ei(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,h=c.height??s.height??null;if(a&&!d||u)continue;const f=Da(r,Ba(s)),y=m===null||h===null,k=i&&f>0,_=(m??0)*(h??0);(y||k||f>=_||s.dragging)&&l.push(s)}return l}function eo(e,n){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return n.filter(i=>o.has(i.source)||o.has(i.target))}function Bo(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(n*o*.01)}return Ii(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function R0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=Bo(e,o),a=Bo(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Bo(e.top??e.y??0,o),a=Bo(e.bottom??e.y??0,o),r=Bo(e.left??e.x??0,n),l=Bo(e.right??e.x??0,n);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function A0(e,n,o,i,a,r){const{x:l,y:s}=ki(e,{x:n,y:o,zoom:i}),{x:c,y:d}=ki({x:e.x+e.width,y:e.y+e.height},{x:n,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function Tm(e,n,o,i,a,r=.1){const l=R0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=Zn(d,i,a),m=e.x+e.width/2,h=e.y+e.height/2,f=n/2-m*u,y=o/2-h*u,k=A0(e,f,y,u,n,o),_={left:Math.min(k.left-l.left,0),top:Math.min(k.top-l.top,0),right:Math.min(k.right-l.right,0),bottom:Math.min(k.bottom-l.bottom,0)};return{x:f-_.left+_.right,y:y-_.top+_.bottom,zoom:u}}function $0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Mm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Mm(o,n):!1}function Ni(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Hl(e){const n=e.ctrlKey&&wi()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function Vm(e,n,o){return e<n?Zn(Math.abs(e-n),1,n)/n:e>o?-Zn(Math.abs(e-o),1,n)/n:0}function Bm(e,n,o=15,i=40){const a=Vm(e.x,i,n.width-i)*o,r=Vm(e.y,i,n.height-i)*o;return[a,r]}function jl(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,i=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof n.style=="function"?a={...n.style(n)}:n.style&&(a={...n.style}),a.width=a.width??`${n.dimensions.width}px`,a.height=a.height??`${n.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(n.position.x=n.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(n.position.y=n.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}n.dimensions.width=Number(a.width.toString().replace("px","")),n.dimensions.height=Number(a.height.toString().replace("px","")),typeof n.style=="function"?n.style=r=>{const l=n.style;return{...l(r),...a}}:n.style={...n.style,...a}}}}function Dm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(_i(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&_i(c)&&jl(l,c)}break;case"dimensions":if(_i(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&_i(c)&&(!!c.dimensions.width&&!!c.dimensions.height?jl(l,c):t.nextTick(()=>{jl(l,c)}))}break}return n}function $n(e,n){return{id:e,type:"select",selected:n}}function Om(e){return{item:e,type:"add"}}function Lm(e){return{id:e,type:"remove"}}function Pm(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Tn(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push($n(r.id,l)))}return i}const zm=()=>{};function Ae(e){const n=new Set;let o=zm,i=()=>!1;const a=()=>n.size>0||i(),r=h=>{o=h},l=()=>{o=zm},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{n.delete(h)};return{on:h=>{n.add(h);const f=()=>d(h);return ai(f),{off:f}},off:d,trigger:h=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(y=>y(h)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Fm(e,n,o){let i=e;do{if(i&&i.matches(n))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function T0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Mm(c,e))&&(c.draggable||n&&typeof c.draggable>"u")&&e.get(s)&&l.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((r=c.computedPosition)==null?void 0:r.y)||0},from:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(l.values())}function Kl({id:e,dragItems:n,findNode:o}){const i=[];for(const a of n){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function Um(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function M0(e,n,o){const[i,a,r,l]=typeof e!="string"?Um(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function V0(e,n,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const r=M0(a,e,i);r&&(a=r)}else n(new ft(dt.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Um(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function B0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Gl(e,n,o,i,a){const r=B0(e.dimensions,V0(e,o,i,a)),l=Im(n,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function Do(e,n,o=Me.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??P0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case Me.Top:return{x:a+l/2,y:r};case Me.Right:return{x:a+l,y:r+s/2};case Me.Bottom:return{x:a+l/2,y:r+s};case Me.Left:return{x:a,y:r+s/2}}}function Hm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function D0({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+a),y2:Math.max(e.y+i,n.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=Pa({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),h=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*h)>0}function O0(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var dt=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(dt||{});const jm={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
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 ft extends Error{constructor(n,...o){var i;super((i=zm[n])==null?void 0:i.call(zm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function jl(e){return"clientX"in e}function D0(e){return"sourceEvent"in e}function Xt(e,n){const o=jl(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 Ei=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function O0(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 Pa(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const L0=()=>!0;function Kl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function P0(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())Ba(a,Va(r))>0&&i.push(r);return i}const z0=250;function F0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=P0(e,o,n+z0);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:h,y:f}=To(d,m,m.position,!0),y=Math.sqrt((h-e.x)**2+(f-e.y)**2);y>n||(y<s?(l=[{...m,x:h,y:f}],s=y):y===s&&l.push({...m,x:h,y:f}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function Fm(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=L0},u,m,h,f){const y=r==="target",g=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:_,y:E}=Xt(e),N=l.elementFromPoint(_,E),p=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:g,k={handleDomNode:p,isValid:!1,connection:null,toHandle:null};if(p){const I=Um(void 0,p),A=p.getAttribute("data-nodeid"),$=p.getAttribute("data-handleid"),L=p.classList.contains("connectable"),V=p.classList.contains("connectableend");if(!A||!I)return k;const S={source:y?A:i,sourceHandle:y?$:a,target:y?i:A,targetHandle:y?a:$};k.connection=S;const T=L&&V&&(o===un.Strict?y&&I==="source"||!y&&I==="target":A!==i||$!==a);k.isValid=T&&d(S,{nodes:m,edges:u,sourceNode:h(S.source),targetNode:h(S.target)}),k.toHandle=Hm(A,I,$,f,o,!0)}return k}function Um(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function U0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function H0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Hm(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===un.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(h=>h.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...To(d,m,m.position,!0)}:m}const Gl={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},j0=["production","prod"];function Ni(e,...n){jm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function jm(){return!j0.includes(process.env.NODE_ENV||"")}function Km(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,...Da(l)}}):null}function Yl(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ct(e){return typeof t.unref(e)<"u"}function K0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ft(st.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return xn(e)?a=e:a={...e,id:Im(e)},a=Nm(a,void 0,i),v0(a,n)?!1:a}function G0(e,n,o,i,a){if(!n.source||!n.target)return a(new ft(st.EDGE_INVALID,e.id)),!1;if(!o)return a(new ft(st.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Im(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Gm(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Jn(l)){o(new ft(st.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=N0(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new ft(st.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Ym(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 ql(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}`;Ym("source",c,u,e,a,l),Ym("target",c,d,e,r,s)}}function qm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Wl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=xn(d)?d:K0(d,s,a,r);if(!u)continue;const m=o(u.source),h=o(u.target);if(!m||!h){a(new ft(st.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ft(st.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new ft(st.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:h})){a(new ft(st.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...Nm(u,f,r),sourceNode:m,targetNode:h})}return c}const Wm=Symbol("vueFlow"),Jm=Symbol("nodeId"),Xm=Symbol("nodeRef"),Y0=Symbol("edgeId"),q0=Symbol("edgeRef"),za=Symbol("slots");function Zm(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:h,findNode:f,multiSelectionActive:y,nodesSelectionActive:g,selectNodesOnDrag:_,removeSelectedElements:E,addSelectedNodes:N,updateNodePositions:p,emits:k}=je(),{onStart:I,onDrag:A,onStop:$,onClick:L,el:V,disabled:S,id:x,selectable:T,dragHandle:D}=e,b=t.shallowRef(!1);let w=[],v,O=null,M={x:void 0,y:void 0},z={x:0,y:0},j=null,ie=!1,pe=!1,ye=0,ge=!1;const me=X0(),se=({x:le,y:ue})=>{M={x:le,y:ue};let F=!1;if(w=w.map(P=>{const U={x:le-P.distance.x,y:ue-P.distance.y},{computedPosition:Q}=Hl(P,o.value?Pa(U,i.value):U,k.error,l.value,P.parentNode?f(P.parentNode):void 0);return F=F||P.position.x!==Q.x||P.position.y!==Q.y,P.position=Q,P}),pe=pe||F,!!F&&(p(w,!0,!0),b.value=!0,j)){const[P,U]=Ul({id:x,dragItems:w,findNode:f});A({event:j,node:P,nodes:U})}},ke=()=>{if(!O)return;const[le,ue]=$m(z,O,u.value);if(le!==0||ue!==0){const F={x:(M.x??0)-le/c.value.zoom,y:(M.y??0)-ue/c.value.zoom};h({x:le,y:ue})&&se(F)}ye=requestAnimationFrame(ke)},Se=(le,ue)=>{ie=!0;const F=f(x);!_.value&&!y.value&&F&&(F.selected||E()),F&&t.toValue(T)&&_.value&&Yl(F,y.value,N,E,g,!1,ue);const P=me(le.sourceEvent);if(M=P,w=A0(r.value,m.value,P,x),w.length){const[U,Q]=Ul({id:x,dragItems:w,findNode:f});I({event:le.sourceEvent,node:U,nodes:Q})}},ce=(le,ue)=>{var F;le.sourceEvent.type==="touchmove"&&le.sourceEvent.touches.length>1||(pe=!1,s.value===0&&Se(le,ue),M=me(le.sourceEvent),O=((F=n.value)==null?void 0:F.getBoundingClientRect())||null,z=Xt(le.sourceEvent,O))},fe=(le,ue)=>{const F=me(le.sourceEvent);if(!ge&&ie&&d.value&&(ge=!0,ke()),!ie){const P=F.xSnapped-(M.x??0),U=F.ySnapped-(M.y??0);Math.sqrt(P*P+U*U)>s.value&&Se(le,ue)}(M.x!==F.xSnapped||M.y!==F.ySnapped)&&w.length&&ie&&(j=le.sourceEvent,z=Xt(le.sourceEvent,O),se(F))},oe=le=>{let ue=!1;if(!ie&&!b.value&&!y.value){const F=le.sourceEvent,P=me(F),U=P.xSnapped-(M.x??0),Q=P.ySnapped-(M.y??0),X=Math.sqrt(U*U+Q*Q);X!==0&&X<=s.value&&(L==null||L(F),ue=!0)}if(w.length&&!ue){pe&&(p(w,!1,!1),pe=!1);const[F,P]=Ul({id:x,dragItems:w,findNode:f});$({event:le.sourceEvent,node:F,nodes:P})}w=[],b.value=!1,ge=!1,ie=!1,M={x:void 0,y:void 0},cancelAnimationFrame(ye)};return t.watch([()=>t.toValue(S),V],([le,ue],F,P)=>{if(ue){const U=Mt(ue);le||(v=EE().on("start",Q=>ce(Q,ue)).on("drag",Q=>fe(Q,ue)).on("end",Q=>oe(Q)).filter(Q=>{const X=Q.target,_e=t.toValue(D);return!Q.button&&(!a.value||!Om(X,`.${a.value}`,ue)&&(!_e||Om(X,_e,ue)))}),U.call(v)),P(()=>{U.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),b}function W0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),updateStart:Re(),update:Re(),updateEnd:Re()}}function J0(e,n){const o=W0();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 X0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=je();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=D0(a)?a.sourceEvent:a,{x:c,y:d}=Xt(s,l),u=_i({x:c,y:d},e.value),{x:m,y:h}=o.value?Pa(u,n.value):u;return{xSnapped:m,ySnapped:h,...u}}}function Fa(){return!0}function Qm({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:h,nodesConnectable:f,autoPanOnConnect:y,autoPanSpeed:g,findNode:_,panBy:E,startConnection:N,updateConnection:p,endConnection:k,emits:I,viewport:A,edges:$,nodes:L,isValidConnection:V,nodeLookup:S}=je();let x=null,T=!1,D=null;function b(v){var O;const M=t.toValue(o)==="target",z=jl(v),j=Em(v.target),ie=v.currentTarget;if(ie&&(z&&v.button===0||!z)){let pe=function(Ie){F=Xt(Ie,oe),se=F0(_i(F,A.value,!1,[1,1]),u.value,S.value,Q),P||(U(),P=!0);const q=Fm(Ie,{handle:se,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:M?"target":"source",isValidConnection:me,doc:j,lib:"vue",flowId:s,nodeLookup:S.value},$.value,L.value,_,S.value);D=q.handleDomNode,x=q.connection,T=H0(!!se,q.isValid);const K={...we,isValid:T,to:q.toHandle&&T?bi({x:q.toHandle.x,y:q.toHandle.y},A.value):F,toHandle:q.toHandle,toPosition:T&&q.toHandle?q.toHandle.position:Gl[Q.position],toNode:q.toHandle?S.value.get(q.toHandle.nodeId):null};if(T&&se&&(we!=null&&we.toHandle)&&K.toHandle&&we.toHandle.type===K.toHandle.type&&we.toHandle.nodeId===K.toHandle.nodeId&&we.toHandle.id===K.toHandle.id&&we.to.x===K.to.x&&we.to.y===K.to.y)return;const J=se??q.toHandle;if(p(J&&T?bi({x:J.x,y:J.y},A.value):F,J,U0(!!J,T)),we=K,!se&&!T&&!D)return Kl(ue);x&&x.source!==x.target&&D&&(Kl(ue),ue=D,D.classList.add("connecting","vue-flow__handle-connecting"),D.classList.toggle("valid",!!T),D.classList.toggle("vue-flow__handle-valid",!!T))},ye=function(Ie){"touches"in Ie&&Ie.touches.length>0||((se||D)&&x&&T&&(r?r(Ie,x):I.connect(x)),I.connectEnd(Ie),a&&(l==null||l(Ie)),Kl(ue),cancelAnimationFrame(ke),k(Ie),P=!1,T=!1,x=null,D=null,j.removeEventListener("mousemove",pe),j.removeEventListener("mouseup",ye),j.removeEventListener("touchmove",pe),j.removeEventListener("touchend",ye))};const ge=_(t.toValue(n));let me=t.toValue(i)||V.value||Fa;!me&&ge&&(me=(M?ge.isValidSourcePos:ge.isValidTargetPos)||Fa);let se,ke=0;const{x:Se,y:ce}=Xt(v),fe=Um(t.toValue(a),ie),oe=(O=c.value)==null?void 0:O.getBoundingClientRect();if(!oe||!fe)return;const le=Hm(t.toValue(n),fe,t.toValue(e),S.value,d.value);if(!le)return;let ue,F=Xt(v,oe),P=!1;const U=()=>{if(!y.value)return;const[Ie,q]=$m(F,oe,g.value);E({x:Ie,y:q}),ke=requestAnimationFrame(U)},Q={...le,nodeId:t.toValue(n),type:fe,position:le.position},X=S.value.get(t.toValue(n)),he={inProgress:!0,isValid:null,from:To(X,Q,$e.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:X,to:F,toHandle:null,toPosition:Gl[Q.position],toNode:null};N({nodeId:t.toValue(n),id:t.toValue(e),type:fe,position:(ie==null?void 0:ie.getAttribute("data-handlepos"))||$e.Top,...F},{x:Se-oe.left,y:ce-oe.top}),I.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:fe});let we=he;j.addEventListener("mousemove",pe),j.addEventListener("mouseup",ye),j.addEventListener("touchmove",pe),j.addEventListener("touchend",ye)}}function w(v){var O,M;if(!m.value)return;const z=t.toValue(o)==="target";if(!h.value){I.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),N({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:$e.Top,...Xt(v)},void 0,!0);return}let j=t.toValue(i)||V.value||Fa;const ie=_(t.toValue(n));if(!j&&ie&&(j=(z?ie.isValidSourcePos:ie.isValidTargetPos)||Fa),ie&&(typeof ie.connectable>"u"?f.value:ie.connectable)===!1)return;const pe=Em(v.target),ye=Fm(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:$e.Top,...Xt(v)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:j,doc:pe,lib:"vue",flowId:s,nodeLookup:S.value},$.value,L.value,_,S.value),ge=((O=ye.connection)==null?void 0:O.source)===((M=ye.connection)==null?void 0:M.target);ye.isValid&&ye.connection&&!ge&&I.connect(ye.connection),I.clickConnectEnd(v),k(v,!0)}return{handlePointerDown:b,handleClick:w}}function Z0(){return t.inject(Jm,"")}function ef(e){const n=e??Z0()??"",o=t.inject(Xm,t.ref(null)),{findNode:i,edges:a,emits:r}=je(),l=i(n);return l||r.error(new ft(st.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Xn([l],a.value))}}function Q0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),dragStart:Re(),drag:Re(),dragStop:Re()}}function eN(e,n){const o=Q0();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 tf(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=je();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,h=d?4:1,f=c.x*u*h,y=c.y*m*h,g=[];for(const _ of e.value)if(_.draggable||l&&typeof _.draggable>"u"){const E={x:_.computedPosition.x+f,y:_.computedPosition.y+y},{position:N}=Hl(_,E,s.error,n.value,_.parentNode?i(_.parentNode):void 0);g.push({id:_.id,position:N,from:_.position,distance:{x:c.x,y:c.y},dimensions:_.dimensions})}o(g,!0,!1)}}const Ua=.1,tN=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function An(){return Ni("Viewport not initialized yet."),Promise.resolve(!1)}const nN={zoomIn:An,zoomOut:An,zoomTo:An,fitView:An,setCenter:An,fitBounds:An,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:An,setTransform:An,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function oN(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ci:Ia).scaleBy(Jl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=km({x:-i,y:-a},e.translateExtent),m=Ro.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?ci:Ia).transform(Jl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>n(1.2,a),zoomOut:a=>n(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?ci:Ia).scaleTo(Jl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(a={padding:Ua,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!h.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const c=Pl(s),{x:d,y:u,zoom:m}=Sm(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ua);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:Ua})=>{const{x:l,y:s,zoom:c}=Sm(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Ua);return o(l,s,c,r)},project:a=>_i(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 _i(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 bi(s,e.viewport)}return{x:0,y:0}}}:nN)}function Jl(e,n=0,o=tN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function iN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,_,E=!!(o.nodes.value.length||o.edges.value.length);g=Io([e.modelValue,()=>{var N,p;return(p=(N=e.modelValue)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setElements(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=Io([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,p])=>{var k;(k=e.modelValue)!=null&&k.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...N,...p],t.nextTick(()=>{g==null||g.resume()}))},{immediate:E}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},r=()=>{i.run(()=>{let g,_,E=!!o.nodes.value.length;g=Io([e.nodes,()=>{var N,p;return(p=(N=e.nodes)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setNodes(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=Io([o.nodes,()=>o.nodes.value.length],([N])=>{var p;(p=e.nodes)!=null&&p.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...N],t.nextTick(()=>{g==null||g.resume()}))},{immediate:E}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},l=()=>{i.run(()=>{let g,_,E=!!o.edges.value.length;g=Io([e.edges,()=>{var N,p;return(p=(N=e.edges)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setEdges(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=Io([o.edges,()=>o.edges.value.length],([N])=>{var p;(p=e.edges)!=null&&p.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...N],t.nextTick(()=>{g==null||g.resume()}))},{immediate:E}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ct(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ct(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ct(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ct(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ct(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const g=async _=>{let E=_;typeof n.autoConnect=="function"&&(E=await n.autoConnect(_)),E!==!1&&o.addEdges([E])};t.watch(()=>n.autoConnect,()=>{ct(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(_,E,N)=>{_?o.onConnect(g):o.hooks.value.connect.off(g),N(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},f=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const _ of Object.keys(n)){const E=_;if(!g.includes(E)){const N=t.toRef(()=>n[E]),p=o[E];t.isRef(p)&&i.run(()=>{t.watch(N,k=>{ct(k)&&(p.value=k)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),h(),f()})()}),()=>i.stop()}function aN(){return{edgesChange:Re(),nodesChange:Re(),nodeDoubleClick:Re(),nodeClick:Re(),nodeMouseEnter:Re(),nodeMouseMove:Re(),nodeMouseLeave:Re(),nodeContextMenu:Re(),nodeDragStart:Re(),nodeDrag:Re(),nodeDragStop:Re(),nodesInitialized:Re(),miniMapNodeClick:Re(),miniMapNodeDoubleClick:Re(),miniMapNodeMouseEnter:Re(),miniMapNodeMouseMove:Re(),miniMapNodeMouseLeave:Re(),connect:Re(),connectStart:Re(),connectEnd:Re(),clickConnectStart:Re(),clickConnectEnd:Re(),paneReady:Re(),init:Re(),move:Re(),moveStart:Re(),moveEnd:Re(),selectionDragStart:Re(),selectionDrag:Re(),selectionDragStop:Re(),selectionContextMenu:Re(),selectionStart:Re(),selectionEnd:Re(),viewportChangeStart:Re(),viewportChange:Re(),viewportChangeEnd:Re(),paneScroll:Re(),paneClick:Re(),paneContextMenu:Re(),paneMouseEnter:Re(),paneMouseMove:Re(),paneMouseLeave:Re(),edgeContextMenu:Re(),edgeMouseEnter:Re(),edgeMouseMove:Re(),edgeMouseLeave:Re(),edgeDoubleClick:Re(),edgeClick:Re(),edgeUpdateStart:Re(),edgeUpdate:Re(),edgeUpdateEnd:Re(),updateNodeInternals:Re(),error:Re(e=>Ni(e.message))}}function rN(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),oi(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),oi(r.removeHasEmitListeners)}});function i(a){var r;const l=lN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function lN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function nf(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Dl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:hi.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:qn.Bezier,style:{}},connectionMode:un.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Ei()?"Meta":"Control",zoomActivationKeyCode:Ei()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:aN(),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 sN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function cN(e,n,o){const i=oN(e),a=F=>{const P=F??[];e.hooks.updateNodeInternals.trigger(P)},r=F=>I0(F,e.nodes,e.edges),l=F=>w0(F,e.nodes,e.edges),s=F=>Xn(F,e.edges),c=({id:F,type:P,nodeId:U})=>{var Q;const X=F?`-${P}-${F}`:`-${P}`;return Array.from(((Q=e.connectionLookup.get(`${U}${X}`))==null?void 0:Q.values())??[])},d=F=>{if(F)return n.value.get(F)},u=F=>{if(F)return o.value.get(F)},m=(F,P,U)=>{var Q,X;const _e=[];for(const he of F){const we={id:he.id,type:"position",dragging:U,from:he.from};if(P&&(we.position=he.position,he.parentNode)){const Ie=d(he.parentNode);we.position={x:we.position.x-(((Q=Ie==null?void 0:Ie.computedPosition)==null?void 0:Q.x)??0),y:we.position.y-(((X=Ie==null?void 0:Ie.computedPosition)==null?void 0:X.y)??0)}}_e.push(we)}_e!=null&&_e.length&&e.hooks.nodesChange.trigger(_e)},h=F=>{if(!e.vueFlowRef)return;const P=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!P)return;const U=window.getComputedStyle(P),{m22:Q}=new window.DOMMatrixReadOnly(U.transform),X=[];for(const _e of F){const he=_e,we=d(he.id);if(we){const Ie=Da(he.nodeElement);if(!!(Ie.width&&Ie.height&&(we.dimensions.width!==Ie.width||we.dimensions.height!==Ie.height||he.forceUpdate))){const K=he.nodeElement.getBoundingClientRect();we.dimensions=Ie,we.handleBounds.source=Km("source",he.nodeElement,K,Q,we.id),we.handleBounds.target=Km("target",he.nodeElement,K,Q,we.id),X.push({id:we.id,type:"dimensions",dimensions:Ie})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),X.length&&e.hooks.nodesChange.trigger(X)},f=(F,P)=>{const U=new Set,Q=new Set;for(const he of F)Jn(he)?U.add(he.id):xn(he)&&Q.add(he.id);const X=Rn(n.value,U,!0),_e=Rn(o.value,Q);if(e.multiSelectionActive){for(const he of U)X.push(Sn(he,P));for(const he of Q)_e.push(Sn(he,P))}X.length&&e.hooks.nodesChange.trigger(X),_e.length&&e.hooks.edgesChange.trigger(_e)},y=F=>{if(e.multiSelectionActive){const P=F.map(U=>Sn(U.id,!0));e.hooks.nodesChange.trigger(P);return}e.hooks.nodesChange.trigger(Rn(n.value,new Set(F.map(P=>P.id)),!0)),e.hooks.edgesChange.trigger(Rn(o.value))},g=F=>{if(e.multiSelectionActive){const P=F.map(U=>Sn(U.id,!0));e.hooks.edgesChange.trigger(P);return}e.hooks.edgesChange.trigger(Rn(o.value,new Set(F.map(P=>P.id)))),e.hooks.nodesChange.trigger(Rn(n.value,new Set,!0))},_=F=>{f(F,!0)},E=F=>{const U=(F||e.nodes).map(Q=>(Q.selected=!1,Sn(Q.id,!1)));e.hooks.nodesChange.trigger(U)},N=F=>{const U=(F||e.edges).map(Q=>(Q.selected=!1,Sn(Q.id,!1)));e.hooks.edgesChange.trigger(U)},p=F=>{if(!F||!F.length)return f([],!1);const P=F.reduce((U,Q)=>{const X=Sn(Q.id,!1);return Jn(Q)?U.nodes.push(X):U.edges.push(X),U},{nodes:[],edges:[]});P.nodes.length&&e.hooks.nodesChange.trigger(P.nodes),P.edges.length&&e.hooks.edgesChange.trigger(P.edges)},k=F=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([F,e.maxZoom]),e.minZoom=F},I=F=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([e.minZoom,F]),e.maxZoom=F},A=F=>{var P;(P=e.d3Zoom)==null||P.translateExtent(F),e.translateExtent=F},$=F=>{e.nodeExtent=F,a()},L=F=>{var P;(P=e.d3Zoom)==null||P.clickDistance(F)},V=F=>{e.nodesDraggable=F,e.nodesConnectable=F,e.elementsSelectable=F},S=F=>{const P=F instanceof Function?F(e.nodes):F;!e.initialized&&!P.length||(e.nodes=Gm(P,d,e.hooks.error.trigger))},x=F=>{const P=F instanceof Function?F(e.edges):F;if(!e.initialized&&!P.length)return;const U=Wl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ql(e.connectionLookup,o.value,U),e.edges=U},T=F=>{const P=F instanceof Function?F([...e.nodes,...e.edges]):F;!e.initialized&&!P.length||(S(P.filter(Jn)),x(P.filter(xn)))},D=F=>{let P=F instanceof Function?F(e.nodes):F;P=Array.isArray(P)?P:[P];const U=Gm(P,d,e.hooks.error.trigger),Q=[];for(const X of U)Q.push(Mm(X));Q.length&&e.hooks.nodesChange.trigger(Q)},b=F=>{let P=F instanceof Function?F(e.edges):F;P=Array.isArray(P)?P:[P];const U=Wl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const X of U)Q.push(Mm(X));Q.length&&e.hooks.edgesChange.trigger(Q)},w=(F,P=!0,U=!1)=>{const Q=F instanceof Function?F(e.nodes):F,X=Array.isArray(Q)?Q:[Q],_e=[],he=[];function we(q){const K=s(q);for(const J of K)(!ct(J.deletable)||J.deletable)&&he.push(Bm(J.id,J.source,J.target,J.sourceHandle,J.targetHandle))}function Ie(q){const K=[];for(const J of e.nodes)J.parentNode===q&&K.push(J);if(K.length){for(const J of K)_e.push(Vm(J.id));P&&we(K);for(const J of K)Ie(J.id)}}for(const q of X){const K=typeof q=="string"?d(q):q;K&&(ct(K.deletable)&&!K.deletable||(_e.push(Vm(K.id)),P&&we([K]),U&&Ie(K.id)))}he.length&&e.hooks.edgesChange.trigger(he),_e.length&&e.hooks.nodesChange.trigger(_e)},v=F=>{const P=F instanceof Function?F(e.edges):F,U=Array.isArray(P)?P:[P],Q=[];for(const X of U){const _e=typeof X=="string"?u(X):X;_e&&(ct(_e.deletable)&&!_e.deletable||Q.push(Bm(typeof X=="string"?X:X.id,_e.source,_e.target,_e.sourceHandle,_e.targetHandle)))}e.hooks.edgesChange.trigger(Q)},O=(F,P,U=!0)=>{const Q=u(F.id);if(!Q)return!1;const X=e.edges.indexOf(Q),_e=G0(F,P,Q,U,e.hooks.error.trigger);if(_e){const[he]=Wl([_e],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((we,Ie)=>Ie===X?he:we),ql(e.connectionLookup,o.value,[he]),he}return!1},M=(F,P,U={replace:!1})=>{const Q=u(F);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=U.replace?X:{...Q.data,...X}},z=F=>Tm(F,e.nodes),j=F=>{const P=Tm(F,e.edges);return ql(e.connectionLookup,o.value,P),P},ie=(F,P,U={replace:!1})=>{const Q=d(F);if(!Q)return;const X=typeof P=="function"?P(Q):P;U.replace?e.nodes.splice(e.nodes.indexOf(Q),1,X):Object.assign(Q,X)},pe=(F,P,U={replace:!1})=>{const Q=d(F);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=U.replace?X:{...Q.data,...X}},ye=(F,P,U=!1)=>{U?e.connectionClickStartHandle=F:e.connectionStartHandle=F,e.connectionEndHandle=null,e.connectionStatus=null,P&&(e.connectionPosition=P)},ge=(F,P=null,U=null)=>{e.connectionStartHandle&&(e.connectionPosition=F,e.connectionEndHandle=P,e.connectionStatus=U)},me=(F,P)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,P?e.connectionClickStartHandle=null:e.connectionStartHandle=null},se=F=>{const P=E0(F),U=P?null:gi(F)?F:d(F.id);return!P&&!U?[null,null,P]:[P?F:Va(U),U,P]},ke=(F,P=!0,U=e.nodes)=>{const[Q,X,_e]=se(F);if(!Q)return[];const he=[];for(const we of U||e.nodes){if(!_e&&(we.id===X.id||!we.computedPosition))continue;const Ie=Va(we),q=Ba(Ie,Q);(P&&q>0||q>=Ie.width*Ie.height||q>=Number(Q.width)*Number(Q.height))&&he.push(we)}return he},Se=(F,P,U=!0)=>{const[Q]=se(F);if(!Q)return!1;const X=Ba(Q,P);return U&&X>0||X>=Number(Q.width)*Number(Q.height)},ce=F=>{const{viewport:P,dimensions:U,d3Zoom:Q,d3Selection:X,translateExtent:_e}=e;if(!Q||!X||!F.x&&!F.y)return!1;const he=Ro.translate(P.x+F.x,P.y+F.y).scale(P.zoom),we=[[0,0],[U.width,U.height]],Ie=Q.constrain()(he,we,_e),q=e.viewport.x!==Ie.x||e.viewport.y!==Ie.y||e.viewport.zoom!==Ie.k;return Q.transform(X,Ie),q},fe=F=>{const P=F instanceof Function?F(e):F,U=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ct(P.defaultEdgeOptions)&&(e.defaultEdgeOptions=P.defaultEdgeOptions);const Q=P.modelValue||P.nodes||P.edges?[]:void 0;Q&&(P.modelValue&&Q.push(...P.modelValue),P.nodes&&Q.push(...P.nodes),P.edges&&Q.push(...P.edges),T(Q));const X=()=>{ct(P.maxZoom)&&I(P.maxZoom),ct(P.minZoom)&&k(P.minZoom),ct(P.translateExtent)&&A(P.translateExtent)};for(const _e of Object.keys(P)){const he=_e,we=P[he];![...sN,...U].includes(he)&&ct(we)&&(e[he]=we)}hl(()=>e.d3Zoom).not.toBeNull().then(X),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:h,setElements:T,setNodes:S,setEdges:x,addNodes:D,addEdges:b,removeNodes:w,removeEdges:v,findNode:d,findEdge:u,updateEdge:O,updateEdgeData:M,updateNode:ie,updateNodeData:pe,applyEdgeChanges:j,applyNodeChanges:z,addSelectedElements:_,addSelectedNodes:y,addSelectedEdges:g,setMinZoom:k,setMaxZoom:I,setTranslateExtent:A,setNodeExtent:$,setPaneClickDistance:L,removeSelectedElements:p,removeSelectedNodes:E,removeSelectedEdges:N,startConnection:ye,updateConnection:ge,endConnection:me,setInteractive:V,setState:fe,getIntersectingNodes:ke,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Se,panBy:ce,fitView:F=>i.value.fitView(F),zoomIn:F=>i.value.zoomIn(F),zoomOut:F=>i.value.zoomOut(F),zoomTo:(F,P)=>i.value.zoomTo(F,P),setViewport:(F,P)=>i.value.setViewport(F,P),setTransform:(F,P)=>i.value.setTransform(F,P),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(F,P,U)=>i.value.setCenter(F,P,U),fitBounds:(F,P)=>i.value.fitBounds(F,P),project:F=>i.value.project(F),screenToFlowCoordinate:F=>i.value.screenToFlowCoordinate(F),flowToScreenCoordinate:F=>i.value.flowToScreenCoordinate(F),toObject:()=>{const F=[],P=[];for(const U of e.nodes){const{computedPosition:Q,handleBounds:X,selected:_e,dimensions:he,isParent:we,resizing:Ie,dragging:q,events:K,...J}=U;F.push(J)}for(const U of e.edges){const{selected:Q,sourceNode:X,targetNode:_e,events:he,...we}=U;P.push(we)}return JSON.parse(JSON.stringify({nodes:F,edges:P,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:F=>new Promise(P=>{const{nodes:U,edges:Q,position:X,zoom:_e,viewport:he}=F;U&&S(U),Q&&x(Q);const[we,Ie]=he!=null&&he.x&&(he!=null&&he.y)?[he.x,he.y]:X??[null,null];if(we&&Ie){const q=(he==null?void 0:he.zoom)||_e||e.viewport.zoom;return hl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:we,y:Ie,zoom:q}).then(()=>{P(!0)})})}else P(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const F=nf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const P=Ro.translate(F.defaultViewport.x??0,F.defaultViewport.y??0).scale(Wn(F.defaultViewport.zoom??1,F.minZoom,F.maxZoom)),U=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[U.width,U.height]],X=e.d3Zoom.constrain()(P,Q,F.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}fe(F)},$destroy:()=>{}}}const dN=["data-id","data-handleid","data-nodeid","data-handlepos"],uN={name:"Handle",compatConfig:{MODE:3}},Zn=t.defineComponent({...uN,props:{id:{default:null},type:{},position:{default:()=>$e.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:h}=je(),{id:f,node:y,nodeEl:g,connectedEdges:_}=ef(),E=t.ref(),N=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),p=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),k=t.toRef(()=>{var x,T,D,b,w,v;return((x=l.value)==null?void 0:x.nodeId)===f&&((T=l.value)==null?void 0:T.id)===e.id&&((D=l.value)==null?void 0:D.type)===i.value||((b=c.value)==null?void 0:b.nodeId)===f&&((w=c.value)==null?void 0:w.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),I=t.toRef(()=>{var x,T,D;return((x=s.value)==null?void 0:x.nodeId)===f&&((T=s.value)==null?void 0:T.id)===e.id&&((D=s.value)==null?void 0:D.type)===i.value}),{handlePointerDown:A,handleClick:$}=Qm({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),L=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(x=>{const T=x[`${i.value}Handle`];return x[i.value]!==f?!1:T?T===e.id:!0}):typeof e.connectable=="number"?_.value.filter(x=>{const T=x[`${i.value}Handle`];return x[i.value]!==f?!1:T?T===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,_.value):ct(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var x;if(!y.dimensions.width||!y.dimensions.height)return;const T=(x=y.handleBounds[i.value])==null?void 0:x.find(z=>z.id===e.id);if(!d.value||T)return;const D=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!E.value||!D||!e.id)return;const b=g.value.getBoundingClientRect(),w=E.value.getBoundingClientRect(),v=window.getComputedStyle(D),{m22:O}=new window.DOMMatrixReadOnly(v.transform),M={id:e.id,position:e.position,x:(w.left-b.left)/O,y:(w.top-b.top)/O,type:i.value,nodeId:f,...Da(E.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],M]});function V(x){const T=jl(x);L.value&&N.value&&(T&&x.button===0||!T)&&A(x)}function S(x){!f||!s.value&&!N.value||L.value&&$(x)}return n({handleClick:$,handlePointerDown:A,onClick:S,onPointerDown:V}),(x,T)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:E,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":x.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${x.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(h),i.value,{connectable:L.value,connecting:I.value,connectablestart:N.value,connectableend:p.value,connectionindicator:L.value&&(N.value&&!k.value||p.value&&k.value)}]]),onMousedown:V,onTouchstartPassive:V,onClick:S},[t.renderSlot(x.$slots,"default",{id:x.id})],42,dN))}}),Ha=function({sourcePosition:e=$e.Bottom,targetPosition:n=$e.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Zn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Zn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Ha.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ha.inheritAttrs=!1,Ha.compatConfig={MODE:3};const mN=Ha,ja=function({targetPosition:e=$e.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Zn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};ja.props=["targetPosition","label","isValidTargetPos","connectable","data"],ja.inheritAttrs=!1,ja.compatConfig={MODE:3};const fN=ja,Ka=function({sourcePosition:e=$e.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Zn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ka.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ka.inheritAttrs=!1,Ka.compatConfig={MODE:3};const pN=Ka,hN=["transform"],yN=["width","height","x","y","rx","ry"],gN=["y"],bN={name:"EdgeText",compatConfig:{MODE:3}},_N=t.defineComponent({...bN,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,yN)):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,gN)],8,hN))}}),kN=["id","d","marker-end","marker-start"],EN=["d","stroke-width"],NN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ga=t.defineComponent({...NN,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,kN),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,EN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(_N,{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 of({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 af({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 Ya(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function rf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case $e.Left:l=n-Ya(n-i,r),s=o;break;case $e.Right:l=n+Ya(i-n,r),s=o;break;case $e.Top:l=n,s=o-Ya(o-a,r);break;case $e.Bottom:l=n,s=o+Ya(a-o,r);break}return[l,s]}function lf(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,curvature:s=.25}=e,[c,d]=rf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=rf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[h,f,y,g]=af({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,h,f,y,g]}function sf({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case $e.Left:case $e.Right:r=.5*(n+i),l=o;break;case $e.Top:case $e.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function cf(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top}=e,[s,c]=sf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=sf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,h,f,y]=af({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,h,f,y]}const df={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};function wN({source:e,sourcePosition:n=$e.Bottom,target:o}){return n===$e.Left||n===$e.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function uf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function IN({source:e,sourcePosition:n=$e.Bottom,target:o,targetPosition:i=$e.Top,center:a,offset:r}){const l=df[n],s=df[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=wN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",h=u[m];let f,y,g;const _={x:0,y:0},E={x:0,y:0},[N,p,k,I]=of({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??N,g=a.y??p;const $=[{x:y,y:c.y},{x:y,y:d.y}],L=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===h?f=m==="x"?$:L:f=m==="x"?L:$}else{const $=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===h?L:$:f=l.y===h?$:L,n===i){const D=Math.abs(e[m]-o[m]);if(D<=r){const b=Math.min(r-1,r-D);l[m]===h?_[m]=(c[m]>e[m]?-1:1)*b:E[m]=(d[m]>o[m]?-1:1)*b}}if(n!==i){const D=m==="x"?"y":"x",b=l[m]===s[D],w=c[D]>d[D],v=c[D]<d[D];(l[m]===1&&(!b&&w||b&&v)||l[m]!==1&&(!b&&v||b&&w))&&(f=m==="x"?$:L)}const V={x:c.x+_.x,y:c.y+_.y},S={x:d.x+E.x,y:d.y+E.y},x=Math.max(Math.abs(V.x-f[0].x),Math.abs(S.x-f[0].x)),T=Math.max(Math.abs(V.y-f[0].y),Math.abs(S.y-f[0].y));x>=T?(y=(V.x+S.x)/2,g=f[0].y):(y=f[0].x,g=(V.y+S.y)/2)}return[[e,{x:c.x+_.x,y:c.y+_.y},...f,{x:d.x+E.x,y:d.y+E.y},o],y,g,k,I]}function vN(e,n,o,i){const a=Math.min(uf(e,n)/2,uf(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 Xl(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,h,f,y,g]=IN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((E,N,p)=>{let k;return p>0&&p<m.length-1?k=vN(m[p-1],N,m[p+1],s):k=`${p===0?"M":"L"}${N.x} ${N.y}`,E+=k,E},""),h,f,y,g]}function CN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=of({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const xN=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]=CN(e);return t.h(Ga,{path:o,labelX:i,labelY:a,...n,...e})}}}),mf=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]=Xl({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ga,{path:o,labelX:i,labelY:a,...n,...e})}}}),SN=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(mf,{...e,...n,borderRadius:0})}}),RN=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]=lf({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ga,{path:o,labelX:i,labelY:a,...n,...e})}}}),AN=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??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ga,{path:o,labelX:i,labelY:a,...n,...e})}}}),$N={input:pN,default:mN,output:fN},TN={default:RN,straight:xN,step:SN,smoothstep:mf,simplebezier:AN};function MN(e,n,o){const i=t.computed(()=>g=>n.value.get(g)),a=t.computed(()=>g=>o.value.get(g)),r=t.computed(()=>{const g={...TN,...e.edgeTypes},_=Object.keys(g);for(const E of e.edges)E.type&&!_.includes(E.type)&&(g[E.type]=E.type);return g}),l=t.computed(()=>{const g={...$N,...e.nodeTypes},_=Object.keys(g);for(const E of e.nodes)E.type&&!_.includes(E.type)&&(g[E.type]=E.type);return g}),s=t.computed(()=>e.onlyRenderVisibleElements?xm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const _ of e.edges){const E=n.value.get(_.source),N=n.value.get(_.target);V0({sourcePos:E.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:E.dimensions.width,sourceHeight:E.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(_)}return g}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const g=[];for(const _ of e.nodes)_.selected&&g.push(_);return g}),m=t.computed(()=>{const g=[];for(const _ of e.edges)_.selected&&g.push(_);return g}),h=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const g=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&_.handleBounds!==void 0&&g.push(_);return g}),y=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:y}}class Qn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Qn.instance;return Qn.instance=i??new Qn,o&&(o.config.globalProperties.$vueFlowStorage=Qn.instance),Qn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=nf(),a=t.reactive(i),r={};for(const[h,f]of Object.entries(a.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=f.on}const l={};for(const[h,f]of Object.entries(a.hooks))l[h]=f.trigger;const s=t.computed(()=>{const h=new Map;for(const f of a.nodes)h.set(f.id,f);return h}),c=t.computed(()=>{const h=new Map;for(const f of a.edges)h.set(f.id,f);return h}),d=MN(a,s,c),u=cN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...A_(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function je(e){const n=Qn.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Wm,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,h,f)=>{const y=_=>{d.applyNodeChanges(_)},g=_=>{d.applyEdgeChanges(_)};m?(d.onNodesChange(y),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)),f(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),oi(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ni(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Wm,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ft(st.USEVUEFLOW_OPTIONS))}return s}function VN(e){const{emits:n,dimensions:o}=je();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Da(e.value);(s.width===0||s.height===0)&&n.error(new ft(st.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const BN={name:"UserSelection",compatConfig:{MODE:3}},DN=t.defineComponent({...BN,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))}}),ON=["tabIndex"],LN={name:"NodesSelection",compatConfig:{MODE:3}},PN=t.defineComponent({...LN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=je(),s=tf(),c=t.ref(null),d=Zm({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(()=>Pl(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(y){n.selectionContextMenu({event:y,nodes:i.value})}function f(y){r.value||Ao[y.key]&&(y.preventDefault(),s({x:Ao[y.key].x,y:Ao[y.key].y},y.shiftKey))}return(y,g)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:h,onKeydown:f},null,46,ON)],6)):t.createCommentVNode("",!0)}});function zN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const FN={name:"Pane",compatConfig:{MODE:3}},UN=t.defineComponent({...FN,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:h,removeEdges:f,selectionMode:y,deleteKeyCode:g,multiSelectionKeyCode:_,multiSelectionActive:E,edgeLookup:N,nodeLookup:p,connectionLookup:k,defaultEdgeOptions:I,connectionStartHandle:A,panOnDrag:$}=je(),L=t.shallowRef(null),V=t.shallowRef(new Set),S=t.shallowRef(new Set),x=t.shallowRef(null),T=t.toRef(()=>c.value&&(e.isSelecting||r.value)),D=t.toRef(()=>A.value!==null);let b=!1,w=!1;const v=yi(g,{actInsideInputWithModifier:!1}),O=yi(_);t.watch(v,me=>{me&&(h(m.value),f(u.value),d.value=!1)}),t.watch(O,me=>{E.value=me});function M(me,se){return ke=>{ke.target===se&&(me==null||me(ke))}}function z(me){if(b||D.value){b=!1;return}a.paneClick(me),l(),d.value=!1}function j(me){var se;if(Array.isArray($.value)&&((se=$.value)!=null&&se.includes(2))){me.preventDefault();return}a.paneContextMenu(me)}function ie(me){a.paneScroll(me)}function pe(me){var se,ke,Se;if(x.value=((se=n.value)==null?void 0:se.getBoundingClientRect())??null,!c.value||!e.isSelecting||me.button!==0||me.target!==L.value||!x.value)return;(Se=(ke=me.target)==null?void 0:ke.setPointerCapture)==null||Se.call(ke,me.pointerId);const{x:ce,y:fe}=zN(me,x.value);w=!0,b=!1,l(),s.value={width:0,height:0,startX:ce,startY:fe,x:ce,y:fe},a.selectionStart(me)}function ye(me){var se;if(!x.value||!s.value)return;b=!0;const{x:ke,y:Se}=Xt(me,x.value),{startX:ce=0,startY:fe=0}=s.value,oe={startX:ce,startY:fe,x:ke<ce?ke:ce,y:Se<fe?Se:fe,width:Math.abs(ke-ce),height:Math.abs(Se-fe)},le=V.value,ue=S.value;V.value=new Set(xm(o.value,oe,i.value,y.value===Dl.Partial,!0).map(P=>P.id)),S.value=new Set;const F=((se=I.value)==null?void 0:se.selectable)??!0;for(const P of V.value){const U=k.value.get(P);if(U)for(const{edgeId:Q}of U.values()){const X=N.value.get(Q);X&&(X.selectable??F)&&S.value.add(Q)}}if(!qm(le,V.value)){const P=Rn(p.value,V.value,!0);a.nodesChange(P)}if(!qm(ue,S.value)){const P=Rn(N.value,S.value);a.edgesChange(P)}s.value=oe,r.value=!0,d.value=!1}function ge(me){var se;me.button!==0||!w||((se=me.target)==null||se.releasePointerCapture(me.pointerId),!r.value&&s.value&&me.target===L.value&&z(me),r.value=!1,s.value=null,d.value=V.value.size>0,a.selectionEnd(me),e.selectionKeyPressed&&(b=!1),w=!1)}return(me,se)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:L,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:me.isSelecting}]),onClick:se[0]||(se[0]=ke=>T.value?void 0:M(z,L.value)(ke)),onContextmenu:se[1]||(se[1]=ke=>M(j,L.value)(ke)),onWheelPassive:se[2]||(se[2]=ke=>M(ie,L.value)(ke)),onPointerenter:se[3]||(se[3]=ke=>T.value?void 0:t.unref(a).paneMouseEnter(ke)),onPointerdown:se[4]||(se[4]=ke=>T.value?pe(ke):t.unref(a).paneMouseMove(ke)),onPointermove:se[5]||(se[5]=ke=>T.value?ye(ke):t.unref(a).paneMouseMove(ke)),onPointerup:se[6]||(se[6]=ke=>T.value?ge(ke):void 0),onPointerleave:se[7]||(se[7]=ke=>t.unref(a).paneMouseLeave(ke))},[t.renderSlot(me.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(DN,{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(PN,{key:1})):t.createCommentVNode("",!0)],34))}}),HN={name:"Transform",compatConfig:{MODE:3}},jN=t.defineComponent({...HN,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=je(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),KN={name:"Viewport",compatConfig:{MODE:3}},GN=t.defineComponent({...KN,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:h,zoomOnPinch:f,zoomOnScroll:y,preventScrolling:g,noWheelClassName:_,noPanClassName:E,emits:N,connectionStartHandle:p,userSelectionActive:k,paneDragging:I,d3Zoom:A,d3Selection:$,d3ZoomHandler:L,viewport:V,viewportRef:S,paneClickDistance:x}=je();VN(S);const T=t.shallowRef(!1),D=t.shallowRef(!1);let b=null,w=!1,v=0,O={x:0,y:0,zoom:0};const M=yi(s),z=yi(l),j=yi(r),ie=t.toRef(()=>(!z.value||z.value&&l.value===!0)&&(M.value||m.value)),pe=t.toRef(()=>M.value||c.value),ye=t.toRef(()=>l.value===!0&&ie.value!==!0),ge=t.toRef(()=>z.value&&l.value!==!0||k.value||ye.value),me=t.toRef(()=>p.value!==null);t.onMounted(()=>{if(!S.value){Ni("Viewport element is missing");return}const fe=S.value,oe=fe.getBoundingClientRect(),le=p0().clickDistance(x.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Mt(fe).call(le),F=ue.on("wheel.zoom"),P=Ro.translate(i.value.x??0,i.value.y??0).scale(Wn(i.value.zoom??1,n.value,o.value)),U=[[0,0],[oe.width,oe.height]],Q=le.constrain()(P,U,a.value);le.transform(ue,Q),le.wheelDelta(zl),A.value=le,$.value=ue,L.value=F,V.value={x:Q.x,y:Q.y,zoom:Q.k},le.on("start",X=>{var _e;if(!X.sourceEvent)return null;v=X.sourceEvent.button,T.value=!0;const he=Se(X.transform);((_e=X.sourceEvent)==null?void 0:_e.type)==="mousedown"&&(I.value=!0),O=he,N.viewportChangeStart(he),N.moveStart({event:X,flowTransform:he})}),le.on("end",X=>{if(!X.sourceEvent)return null;if(T.value=!1,I.value=!1,se(ie.value,v??0)&&!w&&N.paneContextMenu(X.sourceEvent),w=!1,ke(O,X.transform)){const _e=Se(X.transform);O=_e,N.viewportChangeEnd(_e),N.moveEnd({event:X,flowTransform:_e})}}),le.filter(X=>{var _e;const he=j.value||y.value,we=f.value&&X.ctrlKey,Ie=X.button,q=X.type==="wheel";if(Ie===1&&X.type==="mousedown"&&(ce(X,"vue-flow__node")||ce(X,"vue-flow__edge")))return!0;if(!ie.value&&!he&&!pe.value&&!h.value&&!f.value||k.value||me.value&&!q||!h.value&&X.type==="dblclick"||ce(X,_.value)&&q||ce(X,E.value)&&(!q||pe.value&&q&&!j.value)||!f.value&&X.ctrlKey&&q||!he&&!pe.value&&!we&&q)return!1;if(!f&&X.type==="touchstart"&&((_e=X.touches)==null?void 0:_e.length)>1)return X.preventDefault(),!1;if(!ie.value&&(X.type==="mousedown"||X.type==="touchstart")||ye.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ie===0||Array.isArray(m.value)&&!m.value.includes(Ie)&&(X.type==="mousedown"||X.type==="touchstart"))return!1;const K=Array.isArray(m.value)&&m.value.includes(Ie)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ie||Ie<=1;return(!X.ctrlKey||M.value||q)&&K}),t.watch([k,ie],()=>{k.value&&!T.value?le.on("zoom",null):k.value||le.on("zoom",X=>{V.value={x:X.transform.x,y:X.transform.y,zoom:X.transform.k};const _e=Se(X.transform);w=se(ie.value,v??0),N.viewportChange(_e),N.move({event:X,flowTransform:_e})})},{immediate:!0}),t.watch([k,pe,d,j,f,g,_],()=>{pe.value&&!j.value&&!k.value?ue.on("wheel.zoom",X=>{if(ce(X,_.value))return!1;const _e=j.value||y.value,he=f.value&&X.ctrlKey;if(!(!g.value||pe.value||_e||he))return!1;X.preventDefault(),X.stopImmediatePropagation();const Ie=ue.property("__zoom").k||1,q=Ei();if(!M.value&&X.ctrlKey&&f.value&&q){const G=Yt(X),te=zl(X),Y=Ie*2**te;le.scaleTo(ue,Y,G,X);return}const K=X.deltaMode===1?20:1;let J=d.value===hi.Vertical?0:X.deltaX*K,ve=d.value===hi.Horizontal?0:X.deltaY*K;!q&&X.shiftKey&&d.value!==hi.Vertical&&!J&&ve&&(J=ve,ve=0),le.translateBy(ue,-(J/Ie)*u.value,-(ve/Ie)*u.value);const Te=Se(ue.property("__zoom"));b&&clearTimeout(b),D.value?(N.move({event:X,flowTransform:Te}),N.viewportChange(Te),b=setTimeout(()=>{N.moveEnd({event:X,flowTransform:Te}),N.viewportChangeEnd(Te),D.value=!1},150)):(D.value=!0,N.moveStart({event:X,flowTransform:Te}),N.viewportChangeStart(Te))},{passive:!1}):typeof F<"u"&&ue.on("wheel.zoom",function(X,_e){const he=!g.value&&X.type==="wheel"&&!X.ctrlKey,we=j.value||y.value,Ie=f.value&&X.ctrlKey;if(!we&&!c.value&&!Ie&&X.type==="wheel"||he||ce(X,_.value))return null;X.preventDefault(),F.call(this,X,_e)},{passive:!1})},{immediate:!0})});function se(fe,oe){return oe===2&&Array.isArray(fe)&&fe.includes(2)}function ke(fe,oe){return fe.x!==oe.x&&!Number.isNaN(oe.x)||fe.y!==oe.y&&!Number.isNaN(oe.y)||fe.zoom!==oe.k&&!Number.isNaN(oe.k)}function Se(fe){return{x:fe.x,y:fe.y,zoom:fe.k}}function ce(fe,oe){return fe.target.closest(`.${oe}`)}return(fe,oe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:S,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(UN,{"is-selecting":ge.value,"selection-key-pressed":t.unref(z),class:t.normalizeClass({connecting:me.value,dragging:t.unref(I),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(jN,null,{default:t.withCtx(()=>[t.renderSlot(fe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),YN=["id"],qN=["id"],WN=["id"],JN={name:"A11yDescriptions",compatConfig:{MODE:3}},XN=t.defineComponent({...JN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(gm)}-${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,YN),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,qN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(k0)}-${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,WN))],64))}});function ZN(){const e=je();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function QN(e,n,o){return o===$e.Left?e-n:o===$e.Right?e+n:e}function ew(e,n,o){return o===$e.Top?e-n:o===$e.Bottom?e+n:e}const Zl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=$e.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:QN(n,e,i),cy:ew(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Zl.props=["radius","centerX","centerY","position","type"],Zl.compatConfig={MODE:3};const ff=Zl,tw=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:h,multiSelectionActive:f,disableKeyboardA11y:y,elementsSelectable:g,edgesUpdatable:_,edgesFocusable:E,hooks:N}=je(),p=t.computed(()=>u(e.id)),{emit:k,on:I}=J0(p.value,r),A=t.inject(za),$=t.getCurrentInstance(),L=t.ref(!1),V=t.ref(!1),S=t.ref(""),x=t.ref(null),T=t.ref("source"),D=t.ref(null),b=t.toRef(()=>typeof p.value.selectable>"u"?g.value:p.value.selectable),w=t.toRef(()=>typeof p.value.updatable>"u"?_.value:p.value.updatable),v=t.toRef(()=>typeof p.value.focusable>"u"?E.value:p.value.focusable);t.provide(Y0,e.id),t.provide(q0,D);const O=t.computed(()=>p.value.class instanceof Function?p.value.class(p.value):p.value.class),M=t.computed(()=>p.value.style instanceof Function?p.value.style(p.value):p.value.style),z=t.computed(()=>{const P=p.value.type||"default",U=A==null?void 0:A[`edge-${P}`];if(U)return U;let Q=p.value.template??c.value[P];if(typeof Q=="string"&&$){const X=Object.keys($.appContext.components);X&&X.includes(P)&&(Q=t.resolveComponent(P,!1))}return Q&&typeof Q!="string"?Q:(r.error(new ft(st.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:j}=Qm({nodeId:S,handleId:x,type:T,isValidConnection:h,edgeUpdaterType:T,onEdgeUpdate:ye,onEdgeUpdateEnd:ge});return()=>{const P=m(p.value.source),U=m(p.value.target),Q="pathOptions"in p.value?p.value.pathOptions:{};if(!P&&!U)return r.error(new ft(st.EDGE_SOURCE_TARGET_MISSING,p.value.id,p.value.source,p.value.target)),null;if(!P)return r.error(new ft(st.EDGE_SOURCE_MISSING,p.value.id,p.value.source)),null;if(!U)return r.error(new ft(st.EDGE_TARGET_MISSING,p.value.id,p.value.target)),null;if(!p.value||p.value.hidden||P.hidden||U.hidden)return null;let X;i.value===un.Strict?X=P.handleBounds.source:X=[...P.handleBounds.source||[],...P.handleBounds.target||[]];const _e=Pm(X,p.value.sourceHandle);let he;i.value===un.Strict?he=U.handleBounds.target:he=[...U.handleBounds.target||[],...U.handleBounds.source||[]];const we=Pm(he,p.value.targetHandle),Ie=(_e==null?void 0:_e.position)||$e.Bottom,q=(we==null?void 0:we.position)||$e.Top,{x:K,y:J}=To(P,_e,Ie),{x:ve,y:Te}=To(U,we,q);return p.value.sourceX=K,p.value.sourceY=J,p.value.targetX=ve,p.value.targetY=Te,t.h("g",{ref:D,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${z.value===!1?"default":p.value.type||"default"}`,s.value,O.value,{updating:L.value,selected:p.value.selected,animated:p.value.animated,inactive:!b.value&&!N.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":p.value.ariaLabel===null?void 0:p.value.ariaLabel??`Edge from ${p.value.source} to ${p.value.target}`,"aria-describedby":v.value?`${bm}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...p.value.domAttributes,onClick:se,onContextmenu:ke,onDblclick:Se,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onKeyDown:v.value?F:void 0},[V.value?null:t.h(z.value===!1?c.value.default:z.value,{id:e.id,sourceNode:P,targetNode:U,source:p.value.source,target:p.value.target,type:p.value.type,updatable:w.value,selected:p.value.selected,animated:p.value.animated,label:p.value.label,labelStyle:p.value.labelStyle,labelShowBg:p.value.labelShowBg,labelBgStyle:p.value.labelBgStyle,labelBgPadding:p.value.labelBgPadding,labelBgBorderRadius:p.value.labelBgBorderRadius,data:p.value.data,events:{...p.value.events,...I},style:M.value,markerStart:`url('#${ki(p.value.markerStart,n)}')`,markerEnd:`url('#${ki(p.value.markerEnd,n)}')`,sourcePosition:Ie,targetPosition:q,sourceX:K,sourceY:J,targetX:ve,targetY:Te,sourceHandleId:p.value.sourceHandle,targetHandleId:p.value.targetHandle,interactionWidth:p.value.interactionWidth,...Q}),[w.value==="source"||w.value===!0?[t.h("g",{onMousedown:le,onMouseenter:ie,onMouseout:pe},t.h(ff,{position:Ie,centerX:K,centerY:J,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:ie,onMouseout:pe},t.h(ff,{position:q,centerX:ve,centerY:Te,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ie(){L.value=!0}function pe(){L.value=!1}function ye(P,U){k.update({event:P,edge:p.value,connection:U})}function ge(P){k.updateEnd({event:P,edge:p.value}),V.value=!1}function me(P,U){P.button===0&&(V.value=!0,S.value=U?p.value.target:p.value.source,x.value=(U?p.value.targetHandle:p.value.sourceHandle)??null,T.value=U?"target":"source",k.updateStart({event:P,edge:p.value}),j(P))}function se(P){var U;const Q={event:P,edge:p.value};b.value&&(l.value=!1,p.value.selected&&f.value?(d([p.value]),(U=D.value)==null||U.blur()):o([p.value])),k.click(Q)}function ke(P){k.contextMenu({event:P,edge:p.value})}function Se(P){k.doubleClick({event:P,edge:p.value})}function ce(P){k.mouseEnter({event:P,edge:p.value})}function fe(P){k.mouseMove({event:P,edge:p.value})}function oe(P){k.mouseLeave({event:P,edge:p.value})}function le(P){me(P,!0)}function ue(P){me(P,!1)}function F(P){var U;!y.value&&_m.includes(P.key)&&b.value&&(P.key==="Escape"?((U=D.value)==null||U.blur(),d([u(e.id)])):o([u(e.id)]))}}}),nw=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=je(),h=(e=t.inject(za))==null?void 0:e["connection-line"],f=t.computed(()=>{var N;return m((N=i.value)==null?void 0:N.nodeId)}),y=t.computed(()=>{var N;return m((N=a.value)==null?void 0:N.nodeId)??null}),g=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),_=t.computed(()=>c.value.markerStart?`url(#${ki(c.value.markerStart,n)})`:""),E=t.computed(()=>c.value.markerEnd?`url(#${ki(c.value.markerEnd,n)})`:"");return()=>{var N,p,k;if(!f.value||!i.value)return null;const I=i.value.id,A=i.value.type,$=f.value.handleBounds;let L=($==null?void 0:$[A])??[];if(o.value===un.Loose){const M=($==null?void 0:$[A==="source"?"target":"source"])??[];L=[...L,...M]}if(!L)return null;const V=(I?L.find(M=>M.id===I):L[0])??null,S=(V==null?void 0:V.position)??$e.Top,{x,y:T}=To(f.value,V,S);let D=null;y.value&&(o.value===un.Strict?D=((N=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:N.find(M=>{var z;return M.id===((z=a.value)==null?void 0:z.id)}))||null:D=((p=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:p.find(M=>{var z;return M.id===((z=a.value)==null?void 0:z.id)}))||null);const b=((k=a.value)==null?void 0:k.position)??(S?Gl[S]:null);if(!S||!b)return null;const w=l.value??c.value.type??qn.Bezier;let v="";const O={sourceX:x,sourceY:T,sourcePosition:S,targetX:g.value.x,targetY:g.value.y,targetPosition:b};return w===qn.Bezier?[v]=lf(O):w===qn.Step?[v]=Xl({...O,borderRadius:0}):w===qn.SmoothStep?[v]=Xl(O):w===qn.SimpleBezier?[v]=cf(O):v=`M${x},${T} ${g.value.x},${g.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},h?t.h(h,{sourceX:x,sourceY:T,sourcePosition:S,targetX:g.value.x,targetY:g.value.y,targetPosition:b,sourceNode:f.value,sourceHandle:V,targetNode:y.value,targetHandle:D,markerEnd:E.value,markerStart:_.value,connectionStatus:d.value}):t.h("path",{d:v,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":E.value,"marker-start":_.value})))}}}),ow=["id","markerWidth","markerHeight","markerUnits","orient"],iw={name:"MarkerType",compatConfig:{MODE:3}},aw=t.defineComponent({...iw,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(Ol).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(Ol).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,ow))}}),rw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},lw={name:"MarkerDefinitions",compatConfig:{MODE:3}},sw=t.defineComponent({...lw,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=je(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=ki(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",rw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(aw,{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))])]))}}),cw={name:"Edges",compatConfig:{MODE:3}},dw=t.defineComponent({...cw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(sw),(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(B0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(tw),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(nw))],64))}}),uw=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:h,elevateNodesOnSelect:f,disableKeyboardA11y:y,ariaLiveMessage:g,snapToGrid:_,snapGrid:E,nodeDragThreshold:N,nodesDraggable:p,elementsSelectable:k,nodesConnectable:I,nodesFocusable:A,hooks:$}=je(),L=t.ref(null);t.provide(Xm,L),t.provide(Jm,e.id);const V=t.inject(za),S=t.getCurrentInstance(),x=tf(),{node:T,parentNode:D}=ef(e.id),{emit:b,on:w}=eN(T,l),v=t.toRef(()=>typeof T.draggable>"u"?p.value:T.draggable),O=t.toRef(()=>typeof T.selectable>"u"?k.value:T.selectable),M=t.toRef(()=>typeof T.connectable>"u"?I.value:T.connectable),z=t.toRef(()=>typeof T.focusable>"u"?A.value:T.focusable),j=t.computed(()=>O.value||v.value||$.value.nodeClick.hasListeners()||$.value.nodeDoubleClick.hasListeners()||$.value.nodeMouseEnter.hasListeners()||$.value.nodeMouseMove.hasListeners()||$.value.nodeMouseLeave.hasListeners()),ie=t.toRef(()=>!!T.dimensions.width&&!!T.dimensions.height),pe=t.computed(()=>{const U=T.type||"default",Q=V==null?void 0:V[`node-${U}`];if(Q)return Q;let X=T.template||m.value[U];if(typeof X=="string"&&S){const _e=Object.keys(S.appContext.components);_e&&_e.includes(U)&&(X=t.resolveComponent(U,!1))}return X&&typeof X!="string"?X:(l.error(new ft(st.NODE_TYPE_MISSING,X)),!1)}),ye=Zm({id:e.id,el:L,disabled:()=>!v.value,selectable:O,dragHandle:()=>T.dragHandle,onStart(U){b.dragStart(U)},onDrag(U){b.drag(U)},onStop(U){b.dragStop(U)},onClick(U){F(U)}}),ge=t.computed(()=>T.class instanceof Function?T.class(T):T.class),me=t.computed(()=>{const U=(T.style instanceof Function?T.style(T):T.style)||{},Q=T.width instanceof Function?T.width(T):T.width,X=T.height instanceof Function?T.height(T):T.height;return!U.width&&Q&&(U.width=typeof Q=="string"?Q:`${Q}px`),!U.height&&X&&(U.height=typeof X=="string"?X:`${X}px`),U}),se=t.toRef(()=>Number(T.zIndex??me.value.zIndex??0));return u(U=>{(U.includes(e.id)||!U.length)&&Se()}),t.onMounted(()=>{t.watch(()=>T.hidden,(U=!1,Q,X)=>{!U&&L.value&&(e.resizeObserver.observe(L.value),X(()=>{L.value&&e.resizeObserver.unobserve(L.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>T.type,()=>T.sourcePosition,()=>T.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])})}),t.watch([()=>T.position.x,()=>T.position.y,()=>{var U;return(U=D.value)==null?void 0:U.computedPosition.x},()=>{var U;return(U=D.value)==null?void 0:U.computedPosition.y},()=>{var U;return(U=D.value)==null?void 0:U.computedPosition.z},se,()=>T.selected,()=>T.dimensions.height,()=>T.dimensions.width,()=>{var U;return(U=D.value)==null?void 0:U.dimensions.height},()=>{var U;return(U=D.value)==null?void 0:U.dimensions.width}],([U,Q,X,_e,he,we])=>{const Ie={x:U,y:Q,z:we+(f.value&&T.selected?1e3:0)};typeof X<"u"&&typeof _e<"u"?T.computedPosition=R0({x:X,y:_e,z:he},Ie):T.computedPosition=Ie},{flush:"post",immediate:!0}),t.watch([()=>T.extent,h],([U,Q],[X,_e])=>{(U!==X||Q!==_e)&&ke()}),T.extent==="parent"||typeof T.extent=="object"&&"range"in T.extent&&T.extent.range==="parent"?hl(()=>ie).toBe(!0).then(ke):ke(),()=>T.hidden?null:t.h("div",{ref:L,"data-id":T.id,class:["vue-flow__node",`vue-flow__node-${pe.value===!1?"default":T.type||"default"}`,{[o.value]:v.value,dragging:ye==null?void 0:ye.value,draggable:v.value,selected:T.selected,selectable:O.value,parent:T.isParent},ge.value],style:{visibility:ie.value?"visible":"hidden",zIndex:T.computedPosition.z??se.value,transform:`translate(${T.computedPosition.x}px,${T.computedPosition.y}px)`,pointerEvents:j.value?"all":"none",...me.value},tabIndex:z.value?0:void 0,role:z.value?"group":void 0,"aria-describedby":y.value?void 0:`${gm}-${n}`,"aria-label":T.ariaLabel,"aria-roledescription":"node",...T.domAttributes,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onContextmenu:le,onClick:F,onDblclick:ue,onKeydown:P},[t.h(pe.value===!1?m.value.default:pe.value,{id:T.id,type:T.type,data:T.data,events:{...T.events,...w},selected:T.selected,resizing:T.resizing,dragging:ye.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??se.value,targetPosition:T.targetPosition,sourcePosition:T.sourcePosition,label:T.label,dragHandle:T.dragHandle,onUpdateNodeInternals:Se})]);function ke(){const U=T.computedPosition,{computedPosition:Q,position:X}=Hl(T,_.value?Pa(U,E.value):U,l.error,h.value,D.value);(T.computedPosition.x!==Q.x||T.computedPosition.y!==Q.y)&&(T.computedPosition={...T.computedPosition,...Q}),(T.position.x!==X.x||T.position.y!==X.y)&&(T.position=X)}function Se(){L.value&&d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])}function ce(U){ye!=null&&ye.value||b.mouseEnter({event:U,node:T})}function fe(U){ye!=null&&ye.value||b.mouseMove({event:U,node:T})}function oe(U){ye!=null&&ye.value||b.mouseLeave({event:U,node:T})}function le(U){return b.contextMenu({event:U,node:T})}function ue(U){return b.doubleClick({event:U,node:T})}function F(U){O.value&&(!i.value||!v.value||N.value>0)&&Yl(T,r.value,c,s,a,!1,L.value),b.click({event:U,node:T})}function P(U){if(!(Ll(U)||y.value))if(_m.includes(U.key)&&O.value){const Q=U.key==="Escape";Yl(T,r.value,c,s,a,Q,L.value)}else v.value&&T.selected&&Ao[U.key]&&(U.preventDefault(),g.value=`Moved selected node ${U.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~T.position.x}, y: ${~~T.position.y}`,x({x:Ao[U.key].x,y:Ao[U.key].y},U.shiftKey))}}});function mw(e={includeHiddenNodes:!1}){const{nodes:n}=je();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const fw={class:"vue-flow__nodes vue-flow__container"},pw={name:"Nodes",compatConfig:{MODE:3}},hw=t.defineComponent({...pw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=je(),a=mw(),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",fw,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const h=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,h))return m;const f=(t.openBlock(),t.createBlock(t.unref(uw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=h,f},s,0),128)):t.createCommentVNode("",!0)]))}});function yw(){const{emits:e}=je();t.onMounted(()=>{if(jm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ft(st.MISSING_STYLES))}})}const gw=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),bw={name:"VueFlow",compatConfig:{MODE:3}},_w=t.defineComponent({...bw,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=yl(i,"modelValue",o),l=yl(i,"nodes",o),s=yl(i,"edges",o),c=je(i),d=iN({modelValue:r,nodes:l,edges:s},i,c);return rN(o,c.hooks),ZN(),yw(),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(GN,null,{default:t.withCtx(()=>[t.createVNode(dw),gw,t.createVNode(hw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(XN)],512))}}),kw={name:"Panel",compatConfig:{MODE:3}},pf=t.defineComponent({...kw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=je(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),Ew=["width","height","innerHTML"],Nw=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,Ew))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ae=Ke(Nw,[["__scopeId","data-v-05aac699"]]),eo=["red","amber","green","teal","blue","indigo","violet","pink"],hf={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 ww(e){return typeof e=="string"&&e in hf}const Iw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},vw=.15;function Cw(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 xw(e){if(typeof e!="string")return null;const n=Cw(e);if(!n||n.s<vw)return null;let o=null,i=1/0;for(const a of eo){const r=Math.abs(n.h-Iw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function _t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(ww(n))return n;const o=e==null?void 0:e.properties;return xw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Ql(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Sw={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)"},Rw={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 yf(e,n=!1){return e?n?Rw[e]:Sw[e]:null}function to(e){return hf[e]}function Mo(e){return`var(--em-swatch-${e}-bar)`}function Aw(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 $w(e,n){const o=Aw(n);return o?e(o):n.split("-")[1]??n}function Tw(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function gf(e,n){const o=Tw(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 Mw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Vw={class:"em-inline-issue__msgs"},no=Ke(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode(Ae,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",Vw,[(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(gf)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Bw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Dw={key:0,class:"em-mlang__dot"},Ow=["id","role","aria-labelledby"],Lw=["title"],mn=Ke(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const E=o.defaultLang;return E&&o.languages.includes(E)?E:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const E=o.activeLang;return E&&o.languages.includes(E)?E:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(E){var N,p;return!!((p=(N=o.modelValue)==null?void 0:N[E])!=null&&p.trim())}const d=E=>`${o.name}-tab-${E}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function h(E){var k,I;const N=o.languages,p=N[(E+N.length)%N.length];p&&(l.value=p,await t.nextTick(),(I=(k=m.value)==null?void 0:k.querySelectorAll('[role="tab"]')[N.indexOf(p)])==null||I.focus())}function f(E){h(o.languages.indexOf(s.value)+E)}const y=t.computed(()=>o.languages.filter(E=>{var N,p;return E!==s.value&&!!((p=(N=o.modelValue)==null?void 0:N[E])!=null&&p.trim())})),g=t.computed(()=>{var E;return((E=o.modelValue)==null?void 0:E[s.value])??""});function _(E){const N={...o.modelValue};E.trim()===""?delete N[s.value]:N[s.value]=E,i("update:modelValue",N)}return(E,N)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,p=>(t.openBlock(),t.createElementBlock("span",{id:d(p),key:p,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===p}]),role:"tab","aria-selected":s.value===p,"aria-controls":u.value,tabindex:s.value===p?0:-1,onClick:k=>l.value=p,onKeydown:[t.withKeys(t.withModifiers(k=>l.value=p,["prevent"]),["enter"]),t.withKeys(t.withModifiers(k=>l.value=p,["prevent"]),["space"]),N[0]||(N[0]=t.withKeys(t.withModifiers(k=>f(-1),["prevent"]),["left"])),N[1]||(N[1]=t.withKeys(t.withModifiers(k=>f(1),["prevent"]),["right"])),N[2]||(N[2]=t.withKeys(t.withModifiers(k=>h(0),["prevent"]),["home"])),N[3]||(N[3]=t.withKeys(t.withModifiers(k=>h(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(p),1),c(p)?(t.openBlock(),t.createElementBlock("span",Dw,"•")):t.createCommentVNode("",!0)],42,Bw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(ee.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":_},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":_},null,8,["name","placeholder","model-value"]))],8,Ow),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,Lw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Pw=["disabled"],zw={class:"em-panel__sub-label"},Fw={class:"em-field"},Uw={class:"em-field"},Hw={class:"em-field"},jw={class:"em-class"},Kw={class:"em-field"},Gw={class:"em-field"},Yw={class:"em-field"},qw={class:"em-field"},Ww={class:"em-multilang"},Jw={class:"em-multilang"},Xw={class:"em-jpa"},Zw={class:"em-field"},Qw={class:"em-field"},eI={class:"em-field"},tI=["title"],nI={class:"em-swatch"},oI={class:"em-swatch__row"},iI=["title"],aI=["title","onClick"],bf=Ke(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(D=>D.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(D=>D.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var D;return _t(((D=l.value)==null?void 0:D.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=D=>D;function h(D){return D==="inherit"?a.t("em.common.inherit"):D}function f(D){r.value&&a.updateEntity(r.value.modelId,D)}function y(D,b,w){var O;const v=((O=r.value)==null?void 0:O.table)??{physicalName:""};f(D==="physicalName"?{table:{...v,physicalName:w}}:{table:{...v,logicalName:{...v.logicalName,[b]:w}}})}function g(D){f({description:Object.keys(D).length?D:void 0})}function _(D,b){var w;f({jpaAttrs:{...(w=r.value)==null?void 0:w.jpaAttrs,[D]:b}})}function E(D,b){_(D,b)}const N=t.computed(()=>{var D,b;return((b=(D=r.value)==null?void 0:D.jpaAttrs)==null?void 0:b.discriminatorType)??"inherit"}),p=t.computed(()=>{var D,b;return!((b=(D=r.value)==null?void 0:D.jpaAttrs)!=null&&b.useDiscriminator)});function k(D){_("discriminatorType",D==="inherit"?void 0:D)}function I(D){f({hasPersonalInfo:D})}function A(D){f({referenceOnly:D?!0:void 0})}function $(D){f({superClass:D.trim()||void 0})}function L(D){f({schema:D.trim()||void 0})}function V(D){f({abstractClass:D})}const S=t.computed(()=>{var D,b;return((b=(D=r.value)==null?void 0:D.declarationOfInterfaces)==null?void 0:b.join(", "))??""});function x(D){const b=D.split(",").map(w=>w.trim()).filter(Boolean);f({declarationOfInterfaces:b.length?b:void 0})}function T(D){r.value&&a.setEntitySwatch(r.value.modelId,D)}return(D,b)=>{var w,v,O;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:b[0]||(b[0]=M=>i("toggle"))},[t.createElementVNode("span",zw,[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(no,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Fw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":b[1]||(b[1]=M=>f({name:M}))},null,8,["model-value"])]),t.createElementVNode("label",Uw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(Go),"onUpdate:modelValue":b[2]||(b[2]=M=>f({stereotype:M}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Hw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":b[3]||(b[3]=M=>f({packageName:M}))},null,8,["model-value"])]),t.createElementVNode("fieldset",jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Kw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":b[4]||(b[4]=M=>$(M))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",Gw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":S.value,"onUpdate:modelValue":b[5]||(b[5]=M=>x(M))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":b[6]||(b[6]=M=>V(M))},null,8,["label","model-value"])]),t.createElementVNode("label",Yw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-table",width:"100%","model-value":((w=r.value.table)==null?void 0:w.physicalName)??"","onUpdate:modelValue":b[7]||(b[7]=M=>y("physicalName",null,M))},null,8,["model-value"])]),t.createElementVNode("label",qw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":b[8]||(b[8]=M=>L(M))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",Ww,[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 z,j;return t.openBlock(),t.createElementBlock("label",{key:M,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(M),1),t.createVNode(t.unref(ee.BSTextInput),{name:`ent-logical-${M}`,width:"100%","model-value":((j=(z=r.value.table)==null?void 0:z.logicalName)==null?void 0:j[M])??"","onUpdate:modelValue":ie=>y("logicalName",M,ie)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",Jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Xw,[b[13]||(b[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,M=>{var z;return t.createVNode(t.unref(ee.BSCheckbox),{key:M.key,name:`jpa-${M.key}`,class:"em-check",label:M.label,"model-value":!!((z=r.value.jpaAttrs)!=null&&z[M.key]),"onUpdate:modelValue":j=>E(M.key,j)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Zw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:p.value,"model-value":((v=r.value.jpaAttrs)==null?void 0:v.discriminatorColumnName)??"","onUpdate:modelValue":b[9]||(b[9]=M=>_("discriminatorColumnName",M.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",Qw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(ee.BSSelect),{disabled:p.value,"model-value":N.value,items:u,"value-provider":m,"label-provider":h,"onUpdate:modelValue":b[10]||(b[10]=M=>M&&k(M))},null,8,["disabled","model-value"])]),t.createElementVNode("label",eI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(ee.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:p.value,"model-value":(O=r.value.jpaAttrs)==null?void 0:O.discriminatorLength,"onUpdate:modelValue":b[11]||(b[11]=M=>_("discriminatorLength",M||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":I},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":A},null,8,["label","model-value"])],8,tI),t.createElementVNode("fieldset",nI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",oI,[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:b[12]||(b[12]=M=>T(null))},"∅",10,iI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),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(Mo)(M)}),title:t.unref(a).t(t.unref(to)(M)),onClick:z=>T(M)},null,14,aI))),128))])])],64)):t.createCommentVNode("",!0)],8,Pw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),rI=["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"],_f=["inherit","true","false"],qa="__OWN__";function kf(e,n){const o=t.computed(()=>e.state.logical.entities.find(G=>G.modelId===n())??null),i=t.computed(()=>{var G;return((G=o.value)==null?void 0:G.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(G){return G==="none"?e.t("em.common.noneParen"):G}const l=G=>G;function s(G,te){o.value&&e.updateAttribute(o.value.modelId,G.modelId,te)}function c(G){return!!o.value&&!!Xi(e.state.logical,o.value.modelId,G.modelId)}function d(G,te){s(G,{naturalId:te||void 0,naturalIdMutable:te?G.naturalIdMutable:void 0})}function u(){return{naturalId:void 0,naturalIdMutable:void 0}}function m(G,te){s(G,{identifier:te,...te?u():{}})}function h(G,te){s(G,{transient:te||void 0,...te?u():{}})}function f(G){return!!G.transient||G.attrType==="RELATION_REF"}function y(G){return Li(G)}function g(G,te=0){var Y;return((Y=Pi(G,o.value,e.state.logical.entities,e.state.logical.associations,te))==null?void 0:Y.physicalName)||void 0}const _=G=>G.value,E=G=>G.label;function N(G,te){if(!te)return;const Y=x.value.find(ae=>ae.type===te);if(Y){const ae=G.dbAttrs[0]??{modelId:G.modelId+".c",physicalName:G.name,dataType:"VARCHAR"};s(G,{type:te,customType:void 0,dbAttrs:[{...ae,dataType:Y.dataType,length:Y.length,scale:Y.scale}]});return}s(G,te===an?{type:te}:{type:te,customType:void 0})}function p(G,te){s(G,{customType:te.trim()===""?void 0:te})}function k(G,te){if(G.attrType==="RELATION_REF")return;const ae={...G.dbAttrs[0]??{modelId:G.modelId+".c",physicalName:G.name,dataType:"VARCHAR"},...te};te.dataType!==void 0&&!Ar.has(ae.dataType)&&(ae.scale=void 0),s(G,{dbAttrs:[ae]})}function I(G){var te;return Ar.has(((te=G.dbAttrs[0])==null?void 0:te.dataType)??"")}function A(G){return!I(G)&&!y(G)&&!f(G)?e.t("em.attr.scaleTypeHint"):void 0}function $(G,te){k(G,{logicalName:Object.keys(te).length?te:void 0})}function L(G,te){s(G,{description:Object.keys(te).length?te:void 0})}function V(G){return G.personalInfoAttributeType??"none"}function S(G,te){s(G,{personalInfoAttributeType:te==="none"?void 0:te})}const x=t.computed(()=>e.predefinedCustomTypeCatalog.value),T=t.computed(()=>e.embeddableCatalog.value);function D(G){var te,Y,ae;return((te=G.label)==null?void 0:te[e.userLanguage.value])??((Y=G.label)==null?void 0:Y.ko)??((ae=G.label)==null?void 0:ae.en)??G.type}const b=t.computed(()=>e.groupCodeCatalog.value);function w(G){var te;return((te=b.value.find(Y=>Y.groupCode===G.groupCode))==null?void 0:te.codes)??[]}function v(G){return["none",...w(G)]}function O(G){return G==="none"?"none":G.code}function M(G){var Y,ae,Be;if(G==="none")return e.t("em.common.noneParen");const te=((Y=G.label)==null?void 0:Y[e.userLanguage.value])??((ae=G.label)==null?void 0:ae.ko)??((Be=G.label)==null?void 0:Be.en);return te?`${G.code} (${te})`:G.code}function z(G,te){o.value&&e.setAttributeGroupCode(o.value.modelId,G.modelId,te)}function j(G,te){s(G,{defaultValue:te==="none"?void 0:te})}function ie(G,te){s(G,{defaultValue:te.trim()===""?void 0:te})}function pe(G){return G.attrType.startsWith("EMBED")&&G.dbAttrs.length>0}function ye(G,te,Y){const ae=G.dbAttrs.map((Be,Ve)=>{if(Ve!==te)return Be;const H={...Be,...Y};for(const B of Object.keys(Y))Y[B]===void 0&&delete H[B];return H});o.value&&e.setEmbedColumns(o.value.modelId,G.modelId,ae)}function ge(G,te,Y){ye(G,te,{logicalName:Object.keys(Y).length?Y:void 0})}function me(G,te){var Be,Ve,H;if(G.attrType==="EMBED_PREDEF"){const B=(Be=e.embeddableCatalog.value.find(Pe=>Pe.type===G.type))==null?void 0:Be.fields[te];return B?{name:B.name,physicalName:B.physicalName,dataType:B.dataType,length:B.length,scale:B.scale,shareable:B.shareable,logicalName:B.logicalName}:void 0}const Y=(Ve=G.embedded)==null?void 0:Ve.embeddableRef;if(!Y)return;const ae=(H=e.state.logical.entities.find(B=>B.modelId===Y))==null?void 0:H.attributes.flatMap(B=>B.dbAttrs)[te];return ae?{physicalName:ae.physicalName,dataType:ae.dataType,length:ae.length,scale:ae.scale,logicalName:ae.logicalName}:void 0}function se(G,te){var Y,ae;return((Y=me(G,te))==null?void 0:Y.dataType)||((ae=G.dbAttrs[te])==null?void 0:ae.dataType)||""}function ke(G,te){var Y,ae;return((Y=me(G,te))==null?void 0:Y.length)??((ae=G.dbAttrs[te])==null?void 0:ae.length)}function Se(G,te){var Y,ae;return((Y=me(G,te))==null?void 0:Y.scale)??((ae=G.dbAttrs[te])==null?void 0:ae.scale)}const ce=_f;function fe(G){return G==="inherit"?e.t("em.common.inherit"):G}function oe(G){return(G==null?void 0:G.updatable)===void 0?"inherit":G.updatable?"true":"false"}function le(G,te,Y){ye(G,te,{updatable:Y==="inherit"?void 0:Y==="true"})}function ue(G,te){k(G,{updatable:te==="inherit"?void 0:te==="true"})}const F=_f;function P(G){return G==="inherit"?e.t("em.common.inherit"):G}function U(G){return(G==null?void 0:G.insertable)===void 0?"inherit":G.insertable?"true":"false"}function Q(G,te,Y){ye(G,te,{insertable:Y==="inherit"?void 0:Y==="true"})}function X(G,te){k(G,{insertable:te==="inherit"?void 0:te==="true"})}const _e=t.computed(()=>o.value?wr(o.value,e.state.logical.entities):[]),he=t.computed(()=>co(_e.value.flatMap(G=>G.attributes.flatMap(te=>te.dbAttrs)))),we=t.computed(()=>_e.value.flatMap(G=>G.attributes.filter(te=>te.attrType==="NORMAL"&&te.dbAttrs.length===1&&te.dbAttrs[0]).map(te=>{var Y;return{modelId:te.dbAttrs[0].modelId,physical:te.dbAttrs[0].physicalName||te.name,isCurrency:te.type==="Currency",ownerName:G.modelId===((Y=o.value)==null?void 0:Y.modelId)?void 0:G.name}})));function Ie(){const G=[...we.value].sort((te,Y)=>Number(Y.isCurrency)-Number(te.isCurrency));return[qa,...G.map(te=>te.modelId)]}function q(G){if(G===qa)return e.t("em.attr.sharedOwn");const te=we.value.find(ae=>ae.modelId===G);if(!te)return G;const Y=te.ownerName?`${te.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:Y,physical:te.physical,mode:te.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function K(G){return(G==null?void 0:G.sharedColumnRef)??qa}function J(G,te,Y){ye(G,te,{sharedColumnRef:Y===qa?void 0:Y})}function ve(G){return(G==null?void 0:G.sharedColumnRef)!=null}function Te(G){var te;return((te=Dn(G,he.value))==null?void 0:te.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:rI,piiLabel:r,idn:l,setAttr:s,isManagedFk:c,setNaturalId:d,clearNaturalIdPatch:u,setIdentifier:m,setTransient:h,dbLocked:f,fkDerived:y,fkOriginPhysical:g,typeValueOf:_,typeLabelOf:E,setAttrType:N,setAttrCustomType:p,setDb:k,scaleApplicable:I,scaleHint:A,setDbLogical:$,setAttrDescription:L,attrPiiValue:V,setAttrPii:S,predefinedCustomTypeCatalog:x,embeddableCatalog:T,predefinedLabel:D,groupCodeCatalog:b,attrGroupCodes:w,attrCodeItems:v,codeValueOf:O,codeLabelOf:M,setAttrGroupCode:z,setAttrCode:j,setAttrDefaultValue:ie,isEmbedExpanded:pe,setDbAt:ye,setDbLogicalAt:ge,embedColMeta:me,fixedDataType:se,fixedLength:ke,fixedScale:Se,updatableItems:ce,updatableLabel:fe,updatableValue:oe,setUpdatableAt:le,setUpdatable:ue,insertableItems:F,insertableLabel:P,insertableValue:U,setInsertableAt:Q,setInsertable:X,scopeEntities:_e,columnsById:he,sharedCandidates:we,sharedItems:Ie,sharedLabel:q,sharedValue:K,setSharedAt:J,isShared:ve,sharedPhysical:Te}}const Ef={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every embedded column in this entity","em.node.embedAllShow":"Expand all collapsed embedded columns","em.node.embedAllSummary":"{n} embedded column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},Nf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティの埋め込み列をすべて折りたたむ","em.node.embedAllShow":"折りたたまれた埋め込み列をすべて展開","em.node.embedAllSummary":"埋め込み列 {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},wf={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 임베드 컬럼 모두 접기","em.node.embedAllShow":"접힌 임베드 컬럼 모두 펼치기","em.node.embedAllSummary":"임베드 컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},lI=["ko","en","ja"],es={ko:wf,en:Ef,ja:Nf};function Dt(e,n,o){let a=(es[e]??es.ko)[n]??es.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const If=["ko","en","ja","zh"];function sI(e){if(e)for(const n of If){const o=e[n];if(o)return o}}function ts(e){const n=sI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function cI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:If.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const dI=["aria-expanded","placeholder"],uI=["aria-selected","onClick","onMouseenter"],mI={key:0,class:"gcc__opt gcc__opt--empty"},vf=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(V,S)=>Dt(o.locale??"ko",V,S),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),h=t.computed(()=>o.items.find(V=>V.groupCode===o.modelValue)),f=t.computed(()=>h.value?ts(h.value):"");t.watch(f,V=>{d.value||(c.value=V)},{immediate:!0});const y=t.computed(()=>c.value===f.value?o.items:cI(o.items,c.value));function g(){var S;const V=(S=r.value)==null?void 0:S.getBoundingClientRect();V&&(m.value={left:`${V.left}px`,top:`${V.bottom}px`,width:`${V.width}px`})}function _(){d.value=!0,g(),u.value=Math.max(0,y.value.findIndex(V=>V.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",L)}function E(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",L)}t.onBeforeUnmount(E);function N(){_(),t.nextTick(()=>{var V;return(V=l.value)==null?void 0:V.select()})}function p(){d.value||_(),u.value=0}function k(V){i("update:modelValue",V.groupCode),c.value=ts(V),E()}function I(){i("update:modelValue",void 0),c.value="",E()}function A(){c.value.trim()===""?I():(c.value=f.value,E())}function $(V){var S;if(V.key==="ArrowDown")d.value||_(),u.value=Math.min(u.value+1,y.value.length-1),V.preventDefault();else if(V.key==="ArrowUp")u.value=Math.max(u.value-1,0),V.preventDefault();else if(V.key==="Enter"){const x=y.value[u.value];x&&k(x),V.preventDefault()}else V.key==="Escape"&&(c.value=f.value,E(),(S=l.value)==null||S.blur())}function L(V){var x,T;const S=V.target;!((x=r.value)!=null&&x.contains(S))&&!((T=s.value)!=null&&T.contains(S))&&A()}return(V,S)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":S[0]||(S[0]=x=>c.value=x),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:N,onInput:p,onKeydown:$},null,40,dI),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:S[1]||(S[1]=t.withModifiers(()=>{},["prevent"])),onClick:I},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(x,T)=>(t.openBlock(),t.createElementBlock("li",{key:x.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":T===u.value,"is-selected":x.groupCode===e.modelValue}]),role:"option","aria-selected":x.groupCode===e.modelValue,onMousedown:S[2]||(S[2]=t.withModifiers(()=>{},["prevent"])),onClick:D=>k(x),onMouseenter:D=>u.value=T},t.toDisplayString(t.unref(ts)(x)),43,uI))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",mI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),fI=["aria-labelledby"],pI=["aria-checked","tabindex","onClick","onKeydown"],Cf=Ke(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,pI))),128))],8,fI))}}),[["__scopeId","data-v-5c793bbb"]]),hI=["disabled"],yI={class:"em-aw__toolbar"},gI={class:"em-aw__count"},bI={class:"em-aw__scroll"},_I={class:"em-aw__table"},kI={class:"c-name"},EI={class:"c-type"},NI={class:"c-logical"},wI=["id"],II={class:"c-col"},vI={class:"c-constraints"},CI={class:"c-del"},xI={class:"c-expand"},SI=["title","onClick","onKeydown"],RI=["title"],AI={key:1,class:"em-aw__muted"},$I=["title"],TI=["title"],MI=["title"],VI={class:"em-aw__cflags"},BI=["title"],DI={colspan:"8"},OI={class:"em-aw__detail"},LI={class:"em-aw__dgroup"},PI=["title"],zI={class:"em-aw__df"},FI={class:"em-aw__df"},UI={class:"em-aw__dgroup"},HI={key:0,class:"em-aw__dgroup"},jI={class:"em-aw__df"},KI={key:0,class:"em-aw__df"},GI={class:"em-aw__df"},YI={class:"em-aw__dgroup em-aw__ddesc"},qI={class:"c-expand"},WI={class:"em-aw__caret is-static","aria-hidden":"true"},JI={class:"c-del"},XI={class:"c-expand"},ZI=["title","onClick","onKeydown"],QI={class:"em-aw__embed-label"},ev=["title"],tv=["title"],nv={class:"em-aw__ro"},ov=["title"],iv={class:"em-aw__ro"},av=["title"],rv={class:"em-aw__ro"},lv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},sv={colspan:"8"},cv={class:"em-aw__detail"},dv={class:"em-aw__dgroup"},uv={key:0,class:"em-aw__df"},mv={class:"em-aw__df"},fv={class:"em-aw__df"},pv={key:0},hv={colspan:"99",class:"em-aw__empty"},yv=6,gv=5,bv=Ke(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:h,setTransient:f,dbLocked:y,fkDerived:g,fkOriginPhysical:_,typeValueOf:E,typeLabelOf:N,setAttrType:p,setAttrCustomType:k,setDb:I,scaleApplicable:A,scaleHint:$,setDbLogical:L,attrPiiValue:V,setAttrPii:S,predefinedCustomTypeCatalog:x,embeddableCatalog:T,predefinedLabel:D,groupCodeCatalog:b,attrGroupCodes:w,attrCodeItems:v,codeValueOf:O,codeLabelOf:M,setAttrGroupCode:z,setAttrCode:j,setAttrDefaultValue:ie,setAttrDescription:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:F,insertableItems:P,insertableLabel:U,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:q,isShared:K,sharedPhysical:J}=kf(o,()=>n.entityId),ve=t.computed(()=>{var Ve;return[...((Ve=i.value)==null?void 0:Ve.attributes)??[]].sort((H,B)=>H.order-B.order)}),Te=t.computed(()=>{var Ve;return(((Ve=i.value)==null?void 0:Ve.attributes)??[]).filter(H=>H.attrType!=="DIVIDER").length}),G=t.ref(new Set);function te(Ve){return G.value.has(Ve)}function Y(Ve){const H=new Set(G.value);H.has(Ve)?H.delete(Ve):H.add(Ve),G.value=H}const ae=t.ref(o.userLanguage.value);function Be(Ve){!Ve||!i.value||o.addPredefinedEmbed(i.value.modelId,Ve)}return(Ve,H)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",yI,[t.createElementVNode("span",gI,t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:H[0]||(H[0]=B=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:H[1]||(H[1]=B=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(T).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(T),"value-provider":B=>B.type,"label-provider":t.unref(D),"onUpdate:modelValue":Be},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",bI,[t.createElementVNode("table",_I,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[H[3]||(H[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",kI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",EI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",NI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,wI),t.createVNode(Cf,{modelValue:ae.value,"onUpdate:modelValue":H[2]||(H[2]=B=>ae.value=B),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",II,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),H[4]||(H[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),H[5]||(H[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",vI,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),H[6]||(H[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value,B=>{var Pe,Ze,Ue,Le,De,Z,dt,bn,Et,_n;return t.openBlock(),t.createElementBlock(t.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(B.modelId)}])},[H[7]||(H[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":B.name,"onUpdate:modelValue":Ee=>t.unref(d)(B,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:yv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",CI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,B.modelId)},null,8,["onClick"])])],2)):t.unref(ye)(B)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(B.modelId)}])},[t.createElementVNode("td",qI,[t.createElementVNode("span",WI,[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":Ee=>t.unref(d)(B,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:gv,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:B.dbAttrs.length})),1),t.createElementVNode("td",JI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,B.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.dbAttrs,(Ee,at)=>{var zt,ut,en,tn,Ne,et,Ft,pt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":te(Ee.modelId)}])},[t.createElementVNode("td",XI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(Ee.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(Ee.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:nt=>Y(Ee.modelId),onKeydown:[t.withKeys(t.withModifiers(nt=>Y(Ee.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(nt=>Y(Ee.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,ZI)]),t.createElementVNode("td",QI,"↳ "+t.toDisplayString(((zt=t.unref(se)(B,at))==null?void 0:zt.name)??((ut=t.unref(se)(B,at))==null?void 0:ut.physicalName)??t.unref(o).t("em.attr.colFallback",{n:at+1})),1),H[14]||(H[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(mn,{name:`aw-embed-logical-${Ee.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:((tn=(en=t.unref(se)(B,at))==null?void 0:en.logicalName)==null?void 0:tn[ae.value])??((et=(Ne=t.unref(se)(B,at))==null?void 0:Ne.logicalName)==null?void 0:et.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ee.logicalName,"onUpdate:modelValue":nt=>t.unref(me)(B,at,nt)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(K)(Ee)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-embed-col-${Ee.modelId}`,width:"100%",disabled:t.unref(K)(Ee),placeholder:((Ft=t.unref(se)(B,at))==null?void 0:Ft.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(K)(Ee)?t.unref(J)(Ee):Ee.physicalName,"onUpdate:modelValue":nt=>t.unref(ge)(B,at,{physicalName:nt})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(no,{controller:t.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"])],8,ev),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",nv,t.toDisplayString(t.unref(ke)(B,at)),1)],8,tv),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",iv,t.toDisplayString(t.unref(Se)(B,at)??""),1)],8,ov),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",rv,t.toDisplayString(t.unref(ce)(B,at)!=null?`scale ${t.unref(ce)(B,at)}`:""),1)],8,av),H[15]||(H[15]=t.createElementVNode("td",null,null,-1))],2),te(Ee.modelId)?(t.openBlock(),t.createElementBlock("tr",lv,[H[18]||(H[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",sv,[t.createElementVNode("div",cv,[t.createElementVNode("fieldset",dv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(pt=t.unref(se)(B,at))!=null&&pt.shareable?(t.openBlock(),t.createElementBlock("label",uv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(Ie)(Ee),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":nt=>nt&&t.unref(q)(B,at,nt)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",mv,[H[16]||(H[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(K)(Ee),"model-value":t.unref(K)(Ee)?"false":t.unref(Q)(Ee),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(U),"onUpdate:modelValue":nt=>nt&&t.unref(X)(B,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",fv,[H[17]||(H[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(K)(Ee),"model-value":t.unref(K)(Ee)?"false":t.unref(le)(Ee),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":nt=>nt&&t.unref(ue)(B,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(r).has(B.modelId),"em-aw__open":te(B.modelId)})},[t.createElementVNode("td",xI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(B.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(B.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:Ee=>Y(B.modelId),onKeydown:[t.withKeys(t.withModifiers(Ee=>Y(B.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Ee=>Y(B.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,SI)]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":Ee=>t.unref(d)(B,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(g)(B)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!B.groupCode||B.attrType==="RELATION_REF"||t.unref(g)(B),items:t.unref(oc)(B.type,t.unref(x)),"value-provider":t.unref(E),"label-provider":t.unref(N),"model-value":B.type,"onUpdate:modelValue":Ee=>t.unref(p)(B,Ee)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),B.type===t.unref(an)&&!t.unref(g)(B)?(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":B.customType??"","onUpdate:modelValue":Ee=>t.unref(k)(B,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,RI),t.createElementVNode("td",null,[B.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(mn,{key:0,name:`aw-logical-${B.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Pe=B.dbAttrs[0])==null?void 0:Pe.logicalName,"onUpdate:modelValue":Ee=>t.unref(L)(B,Ee)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",AI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:t.unref(_)(B)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(y)(B),"model-value":((Ze=B.dbAttrs[0])==null?void 0:Ze.physicalName)??"","onUpdate:modelValue":Ee=>t.unref(I)(B,{physicalName:Ee})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(no,{controller:t.unref(o),"ref-id":(Ue=B.dbAttrs[0])==null?void 0:Ue.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(g)(B)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(y)(B)||t.unref(g)(B),items:t.unref(ec)(((Le=B.dbAttrs[0])==null?void 0:Le.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Rr),"model-value":((De=B.dbAttrs[0])==null?void 0:De.dataType)??"","onUpdate:modelValue":Ee=>Ee&&t.unref(I)(B,{dataType:Ee})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,$I),t.createElementVNode("td",{title:t.unref(g)(B)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(y)(B)||t.unref(g)(B),"model-value":(Z=B.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":Ee=>t.unref(I)(B,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,TI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(g)(B)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",VI,[t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-pk-${B.modelId}`,label:"PK","model-value":B.identifier,disabled:t.unref(a)||t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(h)(B,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nn-${B.modelId}`,label:"NN","model-value":B.notNull,disabled:t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(d)(B,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-uq-${B.modelId}`,label:"UQ","model-value":!!((dt=B.dbAttrs[0])!=null&&dt.unique),disabled:t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(I)(B,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,MI),t.createElementVNode("td",{class:"c-del",title:t.unref(u)(B)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,B.modelId)},null,8,["onClick"])],8,BI)],2),te(B.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(B.modelId)}])},[H[13]||(H[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",DI,[t.createElementVNode("div",OI,[t.createElementVNode("fieldset",LI,[H[11]||(H[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref($)(B)},[H[8]||(H[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(y)(B)||t.unref(g)(B)||!t.unref(A)(B),"model-value":(bn=B.dbAttrs[0])==null?void 0:bn.scale,"onUpdate:modelValue":Ee=>t.unref(I)(B,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,PI),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-ai-${B.modelId}`,label:"Auto Increment","model-value":!!((Et=B.dbAttrs[0])!=null&&Et.autoIncrement),disabled:t.unref(y)(B)||t.unref(g)(B)||!B.identifier,"onUpdate:modelValue":Ee=>t.unref(I)(B,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",zI,[H[9]||(H[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-ins-${B.modelId}`,width:"110px",disabled:t.unref(y)(B),"model-value":t.unref(Q)(B.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(U),"onUpdate:modelValue":Ee=>Ee&&t.unref(_e)(B,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",FI,[H[10]||(H[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-upd-${B.modelId}`,width:"110px",disabled:t.unref(y)(B),"model-value":t.unref(le)(B.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ee=>Ee&&t.unref(F)(B,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",UI,[H[12]||(H[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-tr-${B.modelId}`,label:"@Transient","model-value":!!B.transient,disabled:B.identifier||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(f)(B,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nid-${B.modelId}`,label:"@NaturalId","model-value":!!B.naturalId,disabled:B.identifier||t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(m)(B,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${B.modelId}`,label:"mutable","model-value":!!B.naturalIdMutable,disabled:t.unref(y)(B)||!B.naturalId,"onUpdate:modelValue":Ee=>t.unref(d)(B,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-mv-${B.modelId}`,label:"Multi-Value (Set)","model-value":!!((_n=B.dbAttrs[0])!=null&&_n.multiValue),disabled:t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(I)(B,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(g)(B)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",HI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",jI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(V)(B),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ee=>Ee&&t.unref(S)(B,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(b).length?(t.openBlock(),t.createElementBlock("label",KI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(vf,{"model-value":B.groupCode,items:t.unref(b),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ee=>t.unref(z)(B,Ee)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",GI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(w)(B).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"150px","model-value":B.defaultValue??"none",items:t.unref(v)(B),"value-provider":t.unref(O),"label-provider":t.unref(M),"onUpdate:modelValue":Ee=>Ee&&t.unref(j)(B,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":B.defaultValue??"","onUpdate:modelValue":Ee=>t.unref(ie)(B,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",YI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`aw-desc-${B.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":B.description,"onUpdate:modelValue":Ee=>t.unref(pe)(B,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",pv,[t.createElementVNode("td",hv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,hI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-559a29b3"]]);function ns(e,n){return n&&n!==e?`${e} (${n})`:e}function xf(e,n,o){const i=e.dbAttrs[n];return i?Yo(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function Sf(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}):ns(o,xf(e,0,n))}function Rf(e,n){var l;if(Bn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?ns(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 ns(i,xf(o,r<0?0:r,n))}const _v=["disabled"],kv={class:"em-idxw__list"},Ev={class:"em-idxw__list-head"},Nv=["aria-label"],wv=["aria-current","onClick","onKeydown"],Iv={class:"em-idxw__item-name"},vv={key:0,class:"em-idxw__badge"},Cv={class:"em-idxw__item-cnt"},xv={key:0,class:"em-idxw__empty"},Sv={key:0,class:"em-idxw__edit"},Rv={class:"em-idxw__form"},Av={class:"em-field em-idxw__name"},$v={class:"em-field"},Tv=["value","placeholder"],Mv={class:"em-idxw__transfer"},Vv={class:"em-idxw__pane"},Bv={class:"em-idxw__pane-head"},Dv=["aria-label"],Ov=["aria-pressed","onClick","onKeydown"],Lv=["title"],Pv={key:0,class:"em-idxw__empty"},zv={class:"em-idxw__arrows"},Fv={class:"em-idxw__pane"},Uv={class:"em-idxw__pane-head"},Hv={class:"em-idxw__col-name"},jv=["title"],Kv={class:"em-idxw__col-ops"},Gv=["title","disabled","onClick"],Yv=["title","disabled","onClick"],qv=["title","onClick"],Wv={key:0,class:"em-idxw__empty"},Jv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Xv=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(b=>b.modelId===n.entityId)??null),a=t.computed(()=>{var b;return((b=i.value)==null?void 0:b.indexes)??[]}),r=t.computed(()=>{var b;return((b=i.value)==null?void 0:b.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,b=>{var w;b.some(v=>v.modelId===s.value)||(s.value=((w=b[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(b=>b.modelId===s.value)??null),d=t.computed(()=>i.value?Ko(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Vn(r.value)),m=b=>u.value.canon(b),h=t.computed(()=>{var b;return new Set((((b=c.value)==null?void 0:b.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(b){return Sf(b,f.value)}function g(b){return b.physicalName&&b.physicalName!==b.field?`${b.field} (${b.physicalName})`:b.field}function _(b){return Rf(b,f.value)}const E=t.computed(()=>[...r.value.filter(b=>b.dbAttrs.length>0&&!h.value.has(m(b.modelId))).map(b=>({ref:b.modelId,label:y(b),inherited:!1})),...d.value.filter(b=>!h.value.has(m(b.modelId))).map(b=>({ref:b.modelId,label:g(b),inherited:!0}))]),N=t.ref(new Set);t.watch(s,()=>N.value=new Set);function p(b){return Bn(b)}function k(b,w){i.value&&o.updateIndex(i.value.modelId,b,w)}function I(){var w;if(!i.value)return;const b=Me();o.addIndex(i.value.modelId,{modelId:b,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=b}function A(b){i.value&&o.removeIndex(i.value.modelId,b)}function $(b){c.value&&k(c.value.modelId,{parameters:b.trim()===""?void 0:b})}function L(b){const w=new Set(N.value);w.has(b)?w.delete(b):w.add(b),N.value=w}function V(){const b=c.value;if(!b||!N.value.size)return;const w=[...N.value].map(v=>({columnRef:v,descending:!1}));k(b.modelId,{columns:[...b.columns,...w]}),N.value=new Set}function S(b){const w=c.value;w&&k(w.modelId,{columns:w.columns.filter((v,O)=>O!==b)})}function x(b,w){const v=c.value;v&&k(v.modelId,{columns:v.columns.map((O,M)=>M===b?{...O,descending:w}:O)})}function T(b,w){const v=c.value;if(!v)return;const O=b+w;if(O<0||O>=v.columns.length)return;const M=[...v.columns];[M[b],M[O]]=[M[O],M[b]],k(v.modelId,{columns:M}),D(O,w)}async function D(b,w){var j,ie;await t.nextTick();const v=(j=l.value)==null?void 0:j.querySelectorAll(".em-idxw__col--idx")[b];if(!v)return;const O=pe=>v.querySelector(`[data-move="${pe}"]`),M=O(w<0?"up":"down"),z=O(w<0?"down":"up");(ie=M&&!M.disabled?M:z)==null||ie.focus()}return(b,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",kv,[t.createElementVNode("div",Ev,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:I},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":v.modelId===s.value}]),role:"button",tabindex:"0","aria-current":v.modelId===s.value?"true":void 0,onClick:O=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(O=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",Iv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",vv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",Cv,t.toDisplayString(v.columns.length),1)],42,wv))),128))],8,Nv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",xv,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Sv,[t.createElementVNode("div",Rv,[t.createElementVNode("label",Av,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=v=>k(c.value.modelId,{name:v}))},null,8,["model-value"]),t.createVNode(no,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=v=>k(c.value.modelId,{unique:v}))},null,8,["model-value"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=v=>A(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",$v,[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=>$(v.target.value))},null,40,Tv)]),t.createElementVNode("div",Mv,[t.createElementVNode("div",Vv,[t.createElementVNode("div",Bv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:E.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:E.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":N.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":N.value.has(v.ref),onClick:O=>L(v.ref),onKeydown:[t.withKeys(t.withModifiers(O=>L(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>L(v.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(v.label),1),v.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Lv)):t.createCommentVNode("",!0)],42,Ov))),128))],8,Dv),E.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Pv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",zv,[t.createVNode(t.unref(ee.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!N.value.size,onClick:V},null,8,["caption","disabled"])]),t.createElementVNode("div",Fv,[t.createElementVNode("div",Uv,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(v,O)=>(t.openBlock(),t.createElementBlock("li",{key:O,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",Hv,[t.createTextVNode(t.toDisplayString(_(v.columnRef)),1),p(v.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,jv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idxw-desc-${O}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":M=>x(O,M)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",Kv,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:O===0,onClick:M=>T(O,-1)},"↑",8,Gv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:O===c.value.columns.length-1,onClick:M=>T(O,1)},"↓",8,Yv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:M=>S(O)},"✕",8,qv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Wv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",Jv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,_v)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),Zv={class:"em-op-src"},Qv=["placeholder"],eC={class:"em-op-src__actions"},Af=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(l,s)=>Dt(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",Zv,[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,Qv),[[t.vModelText,a.value]]),t.createElementVNode("div",eC,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),tC=["disabled"],nC={class:"em-ow__toolbar"},oC={class:"em-ow__count"},iC={class:"em-ow__scroll"},aC={class:"em-ow__table"},rC={class:"c-name"},lC={class:"c-desc"},sC=["id"],cC={class:"c-pii"},dC={class:"c-src"},uC={class:"c-del"},mC={key:0},fC={colspan:"6",class:"em-ow__empty"},pC=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModal(),a=t.computed(()=>o.state.logical.entities.find(_=>_.modelId===n.entityId)??null),r=t.computed(()=>{var _;return[...((_=a.value)==null?void 0:_.operations)??[]].sort((E,N)=>E.order-N.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(_){return _==="none"?o.t("em.common.noneParen"):_}const u=_=>_;function m(_,E){a.value&&o.updateOperation(a.value.modelId,_.modelId,E)}function h(_,E){m(_,{description:Object.keys(E).length?E:void 0})}function f(_){return _.personalInfoAttributeType??"none"}function y(_,E){m(_,{personalInfoAttributeType:E==="none"?void 0:E})}function g(_){i.openModal({component:Af,bind:{operationName:_.name,sourceCode:_.sourceCode??"",locale:o.uiLocale.value,onSave:E=>m(_,{sourceCode:E})}})}return(_,E)=>{var N,p;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",nC,[t.createElementVNode("span",oC,t.toDisplayString(t.unref(o).t("em.op.section",{n:((N=a.value.operations)==null?void 0:N.length)??0})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:E[0]||(E[0]=k=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",iC,[t.createElementVNode("table",aC,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",rC,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),E[2]||(E[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",lC,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,sC),t.createVNode(Cf,{modelValue:l.value,"onUpdate:modelValue":E[1]||(E[1]=k=>l.value=k),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",cC,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",dC,t.toDisplayString(t.unref(o).t("em.op.body")),1),E[3]||(E[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,k=>(t.openBlock(),t.createElementBlock("tr",{key:k.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`ow-name-${k.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":k.name,"onUpdate:modelValue":I=>m(k,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":k.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&m(k,{visibility:I})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(mn,{name:`ow-desc-${k.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":k.description,"onUpdate:modelValue":I=>h(k,I)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":f(k),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":I=>I&&y(k,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t(k.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:I=>g(k)},null,8,["caption","onClick"])]),t.createElementVNode("td",uC,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(o).removeOperation(a.value.modelId,k.modelId)},null,8,["onClick"])])]))),128)),(p=a.value.operations)!=null&&p.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",mC,[t.createElementVNode("td",fC,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,tC)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),hC={class:"em-detail__tabs"},yC=["onClick"],gC={key:0,class:"em-detail__lock"},bC=["disabled"],_C={key:0,class:"em-detail__narrow"},kC=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",hC,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:h=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,yC)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",gC,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",_C,[t.createVNode(bf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(bv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(Xv,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(pC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,bC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Wa(e,n,o){e.openModal({component:kC,bind:{controller:t.markRaw(n),entityId:o}})}function fn(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>dd(e,r))}function Ot(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of Ud(l,r))i.push(ua(a,s.indexRef,{columns:s.columns}))}return i}function Ja(e,n,o,i){var c;const a=[];a.push(...fn(n,o.remove,i));for(const d of o.update)a.push(Kt(n,d.attributeId,d.patch));for(const d of o.add)a.push(jt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const h=l.filter(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,y)=>f.order-y.order)[0];h&&a.push(Tt(d.modelId,"end2",{attributeRef:h.modelId}))}return a}function Vo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function wi(e,n,o){const i=[];for(const[a,r]of Ec(e,n,Me))i.push(...Ja(e,a,r,o));for(const a of Hd(e,n,Me))i.push(Kt(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function EC(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=qr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return jd(e,n,r).map(l=>Kt(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function $f(e,n,o){return Kd(e,n,o).map(i=>Kt(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function NC(e,n,o){const i=new Set(o.remove);return Vo(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 Xa(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of Nc(e,r,Me)){const c=i.get(l);i.set(l,c?kc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...Ja(e,r,wC(l),o));return a}function wC(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 Tf(e){return nn(e).map(n=>({...n.col,modelId:Me()}))}function IC(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=Rt(o.attributes),h=new Set(o.attributes.map(y=>y.name));let f="id";for(let y=2;h.has(f);y++)f=`id${y}`;a={modelId:Me(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Me(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(jt(n,a))}const r=[];for(const m of e.entities)for(const h of m.attributes){if(((u=h.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(E=>E.modelId===h.embedded.associationRef);if(!f)continue;const y=f.end1.entityRef===m.modelId,g=y?f.end1:f.end2,_=y?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:h.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1},end2:{entityRef:n,multiplicity:_.multiplicity,navigable:_.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const h=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return h.size?{...m,attributes:m.attributes.filter(f=>!h.has(f.modelId))}:m}),associations:e.associations.map(m=>{const h=r.find(f=>f.assocId===m.modelId);return h?{...m,end1:h.end1,end2:h.end2}:m})},s=Jo(l,n,Me);for(const m of r){const h=s.add.find(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===m.assocId});h&&(m.end2.attributeRef=h.modelId)}const c=[];for(const m of r)i.push(...fn(m.ownerId,[m.dispId],c)),i.push(da(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Ja(l,n,s,c));const d=NC(l,n,s);return i.push(...wi(d,n,c)),i.push(...Ot(e,c)),i}function vC(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(p=>p.modelId===c);if(!d||d.attributes.some(p=>{var k;return((k=p.embedded)==null?void 0:k.associationRef)===r.modelId}))continue;const u=Me(),m=Rt(d.attributes),h=new Set(d.attributes.map(p=>p.name)),f=a(o.name);let y=f;for(let p=2;h.has(y);p++)y=`${f}${p}`;const g=o.attributes.filter(p=>!p.identifier&&!p.derivedFrom).flatMap(p=>p.dbAttrs).map(p=>({...p,modelId:Me()})),_={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(jt(c,_));const E=l?"end2":"end1",N=l?"end1":"end2";i.push(da(r.modelId,{identifying:!1,[E]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Me()},[N]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Mf(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=[rd(n,o),...i.map(u=>Eo(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const h=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);h&&h.waypoints.length&&c.push(Nd(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const h=e.layout.notes.find(f=>f.modelId===m);h&&c.push(ni(m,{x:h.geo.location.x+l,y:h.geo.location.y+s}))}}return c}function CC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Me(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},h={...n.logical,associations:[...n.logical.associations,m]},f=Jo(h,s,Me),y=f.add[0];y&&(m.end2.attributeRef=y.modelId);const g={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},_=ca(m,g),E=Ja(h,s,f,[]);return i(E.length?We("관계 추가",[_,...E]):_),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(A=>A.modelId===l),d=n.logical.entities.find(A=>A.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Me(),m=Me(),h=Me(),f=Rt(c.attributes),y=Tf(d),g=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),_=new Set(c.attributes.map(A=>A.name)),E=g(d.name);let N=E;for(let A=2;_.has(N);A++)N=`${E}${A}`;const p={modelId:m,name:N,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},k={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:h},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},I={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(We("임베드 추가",[jt(l,p),ca(k,I)])),u},setEmbedCardinality(l,s){var E;if(r(l))return;const c=n.logical.associations.find(N=>N.modelId===l);if(!c)return;let d,u;for(const N of n.logical.entities){const p=N.attributes.find(k=>{var I;return((I=k.embedded)==null?void 0:I.associationRef)===l&&k.attrType==="EMBED_OWN"});if(p){d=N.modelId,u=p;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,h=c.end2.entityRef===m?"end2":"end1",f=c[h];if(f.multiplicity===s)return;const y=N=>N==="ZERO_OR_MORE_INSTANCES"||N==="ONE_OR_MORE_INSTANCES",g=y(f.multiplicity),_=y(s);if(g===_){i(Tt(l,h,{multiplicity:s}));return}if(_)i(We("임베드 컬렉션 전환",[Kt(d,u.modelId,{dbAttrs:[]}),Tt(l,h,{multiplicity:s,jpa:{...f.jpa,collectionType:((E=f.jpa)==null?void 0:E.collectionType)??"LIST"}})]));else{const N=n.logical.entities.find(p=>p.modelId===m);if(!N)return;i(We("임베드 단일 전환",[Kt(d,u.modelId,{dbAttrs:Tf(N)}),Tt(l,h,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=gd(l);if(!s){i(c);return}for(const f of n.logical.entities){const y=f.attributes.find(g=>{var _;return((_=g.embedded)==null?void 0:_.associationRef)===l});if(y){const g=[];i(We("임베드 삭제",[c,...fn(f.modelId,[y.modelId],g),...Ot(n.logical,g)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],h=Xa(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(g=>g.modelId===s.end1.entityRef),y=f==null?void 0:f.attributes.find(g=>g.modelId===s.end1.attributeRef&&g.attrType==="RELATION_REF");y&&h.push(...fn(f.modelId,[y.modelId],m))}h.push(...Ot(n.logical,m)),i(h.length?We("관계 삭제",[c,...h]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=da(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(y=>y.modelId===l?{...y,identifying:s}:y)},h=[],f=Xa(m,[u],h);f.push(...Ot(n.logical,h)),i(f.length?We("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.modelId===d.end2.entityRef),h=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!h){if(c.navigable===!0&&!d.end1.attributeRef){const f=Hi(d.end2.multiplicity),y=d.end1.navFieldNameHint||Ki(m.name,f),g=mo(y,new Set(u.attributes.map(p=>p.name))),_=Me(),E=Rt(u.attributes),N={modelId:_,name:g,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:E,dbAttrs:[]};i(We("inverse nav 추가",[jt(d.end1.entityRef,N),Tt(l,"end1",{...c,attributeRef:_,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,y=u.attributes.find(N=>N.modelId===f&&N.attrType==="RELATION_REF"),g=Tt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),_=[],E=y?fn(d.end1.entityRef,[f],_):[];i(y?We("inverse nav 제거",[...E,g,...Ot(n.logical,_)]):g);return}}}i(Tt(l,s,c))}}}function xC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,h)=>{if(a(u))return;const f=Kt(u,m,h),y=Vo(n.logical,u,E=>E.map(N=>N.modelId===m?{...N,...h}:N)),g=[],_=wi(y,u,g);_.push(...Ot(n.logical,g)),i(_.length?We("속성 수정",[f,..._]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const h=r.value.find(N=>N.type===m),f=n.logical.entities.find(N=>N.modelId===u);if(!h||!f)return null;const y=Rt(f.attributes),g=Me(),_=h.fields.map(()=>({modelId:Me(),physicalName:"",dataType:""})),E={modelId:g,name:h.defaultName,type:h.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:_};return i(jt(u,E)),g},addAttribute(u,m={}){if(!o.value||a(u))return null;const h=n.logical.entities.find(I=>I.modelId===u),f=h?Rt(h.attributes):0,y=m.modelId??Me(),g=m.name??`field${f}`,_={modelId:y,name:g,type:m.type??$r,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Me(),physicalName:g,dataType:"VARCHAR"}],...m},E=jt(u,_),N=Vo(n.logical,u,I=>[...I,_]),p=[],k=wi(N,u,p);return k.push(...Ot(n.logical,p)),i(k.length?We("속성 추가",[E,...k]):E),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(g=>g.modelId===u),h=m?Rt(m.attributes):0,f=Me();return i(jt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:h,dbAttrs:[]})),f},updateAttribute(u,m,h){d(u,m,h)},setAttributeGroupCode(u,m,h){d(u,m,{groupCode:h,type:h?On:$r})},setEmbedColumns(u,m,h){var N,p;if(a(u))return;const f=Kt(u,m,{dbAttrs:h}),y=(N=n.logical.entities.find(k=>k.modelId===u))==null?void 0:N.attributes.find(k=>k.modelId===m),g=(p=y==null?void 0:y.embedded)==null?void 0:p.associationRef,_=g?n.logical.associations.find(k=>k.modelId===g):void 0,E=[];_&&g&&(_.end1.legacyEmbedRaw&&E.push(Tt(g,"end1",{legacyEmbedRaw:void 0})),_.end2.legacyEmbedRaw&&E.push(Tt(g,"end2",{legacyEmbedRaw:void 0}))),i(E.length?We("임베드 컬럼 수정",[f,...E]):f)},removeAttribute(u,m){if(a(u))return;if(Xi(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const h=[],f=fn(u,[m],h),y=Vo(n.logical,u,E=>E.filter(N=>N.modelId!==m)),g=[...wi(y,u,h),...Ot(n.logical,h),...$f(n.logical,u,[m])],_=[...f,...g];i(_.length===1?_[0]:We("속성 삭제",_))},removeAttributes(u,m){var N;if(!m.length||a(u))return;const h=m.filter(p=>!Xi(n.logical,u,p));if(h.length<m.length&&s(l("em.attr.fkDeleteHint")),!h.length)return;const f=[],y=fn(u,h,f),g=new Set(h),_=Vo(n.logical,u,p=>p.filter(k=>!g.has(k.modelId))),E=[...y,...wi(_,u,f),...Ot(n.logical,f),...$f(n.logical,u,h)];i(E.length===1?E[0]:We("속성 삭제",E)),((N=c.value)==null?void 0:N.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,h){i(ra(u,m,h))},setAttributeSwatches(u,m,h){m.length&&(m.length===1?i(ra(u,m[0],h)):i(We("속성 색상",m.map(f=>ra(u,f,h)))))},reorderAttributes(u,m,h){if(!m.length||a(u))return;const f=al(u,m,h),y=EC(n.logical,u,m,h);i(y.length?We("속성 재정렬",[f,...y]):f)}}}function SC(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Me(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=Me();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Me()}for(const a of n.indexes??[]){a.modelId=Me();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Me();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const RC=220;function AC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||RC));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 os=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function $C(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const g=c.filter(_=>n.logical.entities.some(E=>E.modelId===_));if(g.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:g}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const g=n.logical.entities.find(E=>E.modelId===d.entityId);if(!g)return;const _=[...g.attributes].sort((E,N)=>E.order-N.order).filter(E=>d.ids.includes(E.modelId));if(!_.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:_}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(g=>g.modelId===u),h=n.layout.entityLayouts.find(g=>g.entityRef===u);if(!m)return;const f=(h==null?void 0:h.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(h){const{entityRef:g,geo:_,locked:E,...N}=h;Object.keys(N).length&&(y=N)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:y}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const y=n.logical.entities.find(k=>k.modelId===f);if(!y)return[];const g=new Set(y.attributes.map(k=>k.name)),_=new Set(y.attributes.flatMap(k=>k.dbAttrs.map(I=>I.physicalName))),E=Rt(y.attributes),N=[],p=c.attributes.map((k,I)=>{const A=JSON.parse(JSON.stringify(k));A.modelId=Me();for(const $ of A.dbAttrs)$.modelId=Me();g.has(A.name)&&(A.name=mo(`${A.name}_copy`,g)),g.add(A.name);for(const $ of A.dbAttrs)$.physicalName&&_.has($.physicalName)&&($.physicalName=mo(`${$.physicalName}_copy`,_)),$.physicalName&&_.add($.physicalName);return A.order=E+I,N.push(A.modelId),jt(f,A)});return l(p.length===1?p[0]:We("속성 붙여넣기",p)),i.value={kind:"attribute",entityId:f,ids:N,anchor:N[N.length-1]},[]}const{clone:d,idMap:u}=SC(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let h;if(c.layoutExtras){const f={...c.layoutExtras},y=g=>u.get(g);f.attributeStyles&&(f.attributeStyles=na(f.attributeStyles,y)),f.operationStyles&&(f.operationStyles=na(f.operationStyles,y)),h=f}return l(aa(d,m,h)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Uc(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const h=(u==null?void 0:u.placement)??"append-right",f=h==="append-right"?AC(n.layout,m.layout):h.offset,y=new Map(m.layout.entityLayouts.map(p=>[p.entityRef,p])),g=new Map(m.layout.associationLayouts.map(p=>[p.associationRef,p])),_=new Map(m.layout.groupLayouts.map(p=>[p.groupRef,p])),E=[];let N=80;for(const p of m.logical.entities){const k=y.get(p.modelId),I=k?{location:os(k.geo.location,f),size:{...k.geo.size}}:{location:{x:N+=40,y:80},size:{width:220,height:140}};let A;if(k){const{entityRef:$,geo:L,locked:V,...S}=k;A=S}E.push(aa(p,I,A))}for(const p of m.logical.associations){const k=g.get(p.modelId),I=k?{...k,waypoints:k.waypoints.map(A=>os(A,f))}:{associationRef:p.modelId,waypoints:[]};E.push(ca(p,I))}for(const p of m.logical.groups){const k=_.get(p.modelId),I=k?{location:os(k.geo.location,f),size:{...k.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(k){const{groupRef:$,geo:L,locked:V,memberNoteRefs:S,...x}=k;A=x}E.push(la(p,I,A))}return l(We("다이어그램 가져오기",E)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(p=>p.modelId)}};return s}function TC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l}=e;return{addEntity(s="NewEntity",c={x:80,y:80}){if(!o.value)return null;const d=Me(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Me(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Me(),physicalName:"id",dataType:"BIGINT"}]}]};return i(aa(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(Zc(s,c))},updateEntity(s,c){if(a(s))return;const d=Xc(s,c),u=n.logical.entities.find(f=>f.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",h=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const f=u.attributes.filter(p=>p.identifier&&!p.derivedFrom).map(p=>Kt(s,p.modelId,{identifier:!1})),y=Vo({...n.logical,entities:n.logical.entities.map(p=>p.modelId===s?{...p,stereotype:"JPA_EMBEDDABLE"}:p)},s,p=>p.map(k=>k.identifier&&!k.derivedFrom?{...k,identifier:!1}:k)),g=[],_=Xa(y,[s],g);_.push(...Ot(n.logical,g));const E=vC(n.logical,s),N=[d,...f,..._,...E];i(N.length>1?We("임베더블 변환",N):d);return}if(h){const f=IC(n.logical,s),y=[d,...f];i(y.length>1?We("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(Eo(s,c))},resizeEntity(s,c){a(s)||i(Qc(s,c))},removeEntity(s){if(a(s))return;const c=Jc(s);if(!n.logical.entities.find(_=>_.modelId===s)){i(c);return}const u=n.logical.associations.filter(_=>_.end1.entityRef===s||_.end2.entityRef===s),m=new Set(u.map(_=>_.modelId)),h=[],f=[];for(const _ of n.logical.entities)if(_.modelId!==s)for(const E of _.attributes)E.embedded&&m.has(E.embedded.associationRef)&&h.push(...fn(_.modelId,[E.modelId],f));for(const _ of u){if(_.end1.entityRef===s||!_.end1.attributeRef)continue;const E=n.logical.entities.find(p=>p.modelId===_.end1.entityRef),N=E==null?void 0:E.attributes.find(p=>p.modelId===_.end1.attributeRef&&p.attrType==="RELATION_REF");N&&h.push(...fn(E.modelId,[N.modelId],f))}const y={...n.logical,entities:n.logical.entities.filter(_=>_.modelId!==s),associations:n.logical.associations.filter(_=>!m.has(_.modelId))},g=new Set(u.filter(_=>_.end1.entityRef===s&&_.end2.entityRef!==s).map(_=>_.end2.entityRef));h.push(...Xa(y,[...g],f)),h.push(...Ot(n.logical,f.filter(_=>_.entityId!==s))),i(h.length?We("엔티티 삭제",[c,...h]):c)},setEntitySwatch(s,c){i(ed(s,c))},setEntityCollapsed(s,c){i(td(s,c))},setEntityLocked(s,c){i(nd(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(il(!0))},expandAll(){i(il(!1))}}}function MC(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(E=>n.layout.entityLayouts.find(N=>N.entityRef===E)).filter(E=>!!E);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,h=1/0,f=-1/0,y=-1/0;for(const E of u){const N=E.geo.size.width||220,p=E.geo.size.height||140;m=Math.min(m,E.geo.location.x),h=Math.min(h,E.geo.location.y),f=Math.max(f,E.geo.location.x+N),y=Math.max(y,E.geo.location.y+p)}const g=40,_=28;return{location:{x:m-g,y:h-g-_},size:{width:f-m+g*2,height:y-h+g*2+_}}}return{dragGroup(d,u,m){l(d)||i(We("그룹 이동",Mf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(ld(d,u))},setGroupSwatch(d,u){i(sd(d,u))},setGroupLocked(d,u){i(cd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(od(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const g of d)y.memberEntityRefs.includes(g)&&m.push(sa(y.modelId,g));const h=Me(),f={modelId:h,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(la(f,c(d))),i(We("그룹 생성",m)),a.value=null,h},addEmptyGroup(d,u){if(!o.value)return null;const m=Me();return i(la({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(id(d))},dropEntity(d,u,m){var y;if(r(d))return;const h=((y=n.logical.groups.find(g=>g.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,f=[Eo(d,u)];h!==m&&(h&&f.push(sa(h,d)),m&&f.push(ad(m,d))),i(We("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(sa(u.modelId,d))},dropNote(d,u,m){var y;const h=((y=n.layout.groupLayouts.find(g=>{var _;return(_=g.memberNoteRefs)==null?void 0:_.includes(d)}))==null?void 0:y.groupRef)??null,f=[ni(d,u)];h!==m&&(h&&f.push($d(h,d)),m&&f.push(Ad(m,d))),i(We("이동",f))}}}function VC(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(g,_){if(d(),!o.value||!e.opTransport)return;const E=new Pd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:N=>{i.value=!1,a.value=N},onError:e.onOpError});E.seed((_==null?void 0:_.revSeed)??{}),c=E.attach(g),s=E}const m=t.computed(()=>o.value&&r!==void 0),h=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function y(g){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let _;try{_=await l(g)}catch(E){return{ok:!1,reason:E instanceof Error?E.message:String(E)}}return _.ok&&h.value++,_}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:y,reloadRequest:h}}function BC(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Me();return o(vd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(Cd(i))},moveNote(i,a){o(ni(i,a))},resizeNote(i,a){o(xd(i,a))},setNoteMemo(i,a){o(Sd(i,a))},setNoteSwatch(i,a){o(Rd(i,a))},addNoteConnection(i,a){o(Td(i,a))},removeNoteConnection(i,a){o(Md(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Vd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Bd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Dd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Od(i,a))}}}function DC(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const h=o.value,f=(h==null?void 0:h.kind)==="attribute"&&h.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const k=h.ids.includes(u),I=k?h.ids.filter($=>$!==u):[...h.ids,u];if(!I.length){o.value=null;return}const A=k&&h.anchor===u?I[I.length-1]:k?h.anchor:u;o.value={kind:"attribute",entityId:d,ids:I,anchor:A};return}const y=n.logical.entities.find(k=>k.modelId===d),g=[...(y==null?void 0:y.attributes)??[]].sort((k,I)=>k.order-I.order).map(k=>k.modelId),_=g.indexOf(h.anchor),E=g.indexOf(u);if(_<0||E<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[N,p]=_<=E?[_,E]:[E,_];o.value={kind:"attribute",entityId:d,ids:g.slice(N,p+1),anchor:h.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(g=>g.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const h=m.attributes.findIndex(g=>g.modelId===u.anchor);if(h<0)return!1;const f=Math.min(Math.max(h+d,0),m.attributes.length-1);if(f===h)return!0;const y=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[y],anchor:y},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(k=>k.modelId===u.entityId);if(!m)return!1;const h=m.attributes,f=new Set(u.ids),y=h.map((k,I)=>f.has(k.modelId)?I:-1).filter(k=>k>=0);if(!y.length)return!1;const g=Math.min(...y),_=h.filter(k=>!f.has(k.modelId)),E=h.slice(0,g).filter(k=>!f.has(k.modelId)).length;let N;if(d<0){if(E<=0)return!0;N=E-1}else{if(_.length-E<=0)return!0;N=E+1}if(r(u.entityId))return!0;const p=h.filter(k=>f.has(k.modelId)).map(k=>k.modelId);return a(al(u.entityId,p,N)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const h=new Set(n.logical.entities.map(N=>N.modelId)),f=new Set(n.logical.groups.map(N=>N.modelId)),y=new Set(n.layout.notes.map(N=>N.modelId)),g=new Set;for(const N of d){if(!f.has(N))continue;const p=n.logical.groups.find(k=>k.modelId===N);for(const k of(p==null?void 0:p.memberEntityRefs)??[])g.add(k)}const _=[],E=[];for(const N of d)if(f.has(N)){if(s(N))continue;const p=n.layout.groupLayouts.find($=>$.groupRef===N);if(!p)continue;const k=n.logical.groups.find($=>$.modelId===N),I=((k==null?void 0:k.memberEntityRefs)??[]).map($=>{var V;const L=((V=n.layout.entityLayouts.find(S=>S.entityRef===$))==null?void 0:V.geo.location)??{x:0,y:0};return{id:$,location:{x:L.x+u,y:L.y+m}}}),A={x:p.geo.location.x+u,y:p.geo.location.y+m};_.push(We("그룹 이동",Mf(n,N,A,I))),E.push("g:"+N)}else if(h.has(N)){if(g.has(N)||l(N))continue;const p=n.layout.entityLayouts.find(k=>k.entityRef===N);if(!p)continue;_.push(Eo(N,{x:p.geo.location.x+u,y:p.geo.location.y+m})),E.push("e:"+N)}else if(y.has(N)){const p=n.layout.notes.find(k=>k.modelId===N);if(!p)continue;_.push(ni(N,{x:p.geo.location.x+u,y:p.geo.location.y+m})),E.push("n:"+N)}return _.length?(a(We("이동",_,"nudge:"+E.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const oo=Symbol("editorController");function Vf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function OC(e=Vf(),n={}){var ae,Be,Ve;const o=t.reactive(e);let i=new ol(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),u=t.ref(n.uiLocale??"ko"),m=(H,B)=>Dt(u.value,H,B),h=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),g=t.ref(n.flagEntitiesWithoutRelations??!1),_=t.ref(!1),E=t.ref(!1),N=t.ref(!1),p=t.ref(0),k=t.ref(null);let I=0;const A=H=>{if(n.onNotice){n.onNotice(H);return}k.value={text:H,id:++I}},$=t.ref(((ae=n.meta)==null?void 0:ae.schemaVersion)??1),L=t.ref(((Be=n.meta)==null?void 0:Be.opWriteEnabled)??!1),V=t.ref(((Ve=n.meta)==null?void 0:Ve.referenceOnly)??!1),S=t.computed(()=>$.value>=2&&L.value),x=t.ref(!($.value>=2&&L.value===!1)),T=t.ref("LOGICAL_PHYSICAL"),D=t.ref("straight"),b=t.ref(!0),w=t.ref(!0),v=t.ref(null),O=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),M=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?v.value.ids:[]}),z=t.computed(()=>{var H,B;return((H=v.value)==null?void 0:H.kind)==="entity"?v.value.id:((B=v.value)==null?void 0:B.kind)==="attribute"?v.value.entityId:null}),j=t.ref(null),ie=t.ref(null),pe=t.ref(null),ye=t.ref(null),ge=VC({state:o,opMode:S,editable:x,opConflict:pe,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function me(){i.onChange(()=>{_.value=i.canUndo,E.value=i.canRedo,N.value=i.isDirty,p.value++})}me(),ge.setupOpAdapter(i,n.meta);const se=t.computed(()=>$s(o.logical,o.layout)),ke=t.computed(()=>({reservedWords:h.value,selectableDataTypes:f.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Se=()=>vr(o.logical,V.value),ce=n.validationDebounceMs??250;let fe,oe=()=>{};if(ce>0){const H=t.shallowRef(Zi(Se(),ke.value));let B;oe=()=>{B!==void 0&&(clearTimeout(B),B=void 0),H.value=Zi(Se(),ke.value)},t.watch([p,ke,V],()=>{B!==void 0&&clearTimeout(B),B=setTimeout(oe,ce)},{flush:"sync"}),fe=t.computed(()=>H.value)}else fe=t.computed(()=>Zi(Se(),ke.value));const le=t.computed(()=>{const H=new Map;for(const B of fe.value){if(!B.targetRef)continue;const Pe=H.get(B.targetRef);Pe?Pe.push(B):H.set(B.targetRef,[B])}return H}),ue=1500,F=new Map,P=H=>{const B=Date.now();B-(F.get(H)??0)<ue||(F.set(H,B),A(H))},U=H=>{if(!ye.value){if(!x.value){P(m("em.notice.readOnly"));return}try{i.execute(H)}catch(B){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${H.label}):`,B),x.value=!1,ye.value={label:H.label}}}},Q=H=>o.layout.entityLayouts.some(B=>B.entityRef===H&&!!B.locked),X=H=>o.layout.groupLayouts.some(B=>B.groupRef===H&&!!B.locked),_e=H=>{const B=o.logical.associations.find(Pe=>Pe.modelId===H);return!!B&&(Q(B.end1.entityRef)||Q(B.end2.entityRef))},he=H=>Q(H)?(P(m("em.notice.entityLocked")),!0):!1,we=H=>X(H)?(P(m("em.notice.groupLocked")),!0):!1,Ie=H=>_e(H)?(P(m("em.notice.assocLocked")),!0):!1,q=$C({state:o,clipboard:ie,selection:v,inspectedEntityId:z,editable:x,run:U}),K=DC({state:o,selection:v,focusRequest:j,run:U,gateEntityLocked:he,isEntityLockedFn:Q,isGroupLockedFn:X}),J=TC({state:o,editable:x,run:U,gateEntityLocked:he,isEntityLockedFn:Q,isAssocLockedFn:_e}),ve=xC({state:o,editable:x,run:U,gateEntityLocked:he,embeddableCatalog:a,t:m,emitGateNotice:P,selection:v}),Te=MC({state:o,editable:x,run:U,selection:v,gateEntityLocked:he,gateGroupLocked:we,isGroupLockedFn:X}),G=BC({editable:x,run:U}),te=CC({state:o,editable:x,run:U,gateEntityLocked:he,gateAssocLocked:Ie});return{state:o,resolved:se,issues:fe,issuesByRef:le,flagEntitiesWithoutRelations:g,canUndo:_,canRedo:E,dirty:N,revision:p,notice:k,editable:x,schemaVersion:$,opWriteEnabled:L,opMode:S,opConflict:pe,commandFailure:ye,historyTransport:ge.historyTransport,historyAvailable:ge.historyAvailable,restoreTransport:ge.restoreTransport,restoreAvailable:ge.restoreAvailable,restoreToSeq:ge.restoreToSeq,reloadRequest:ge.reloadRequest,displayMode:T,routingMode:D,showGrid:b,showMinimap:w,selection:v,selectedAttr:O,selectedAttrIds:M,inspectedEntityId:z,focusRequest:j,clipboard:ie,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:V,uiLocale:u,t:m,selectableDataTypes:f,setEditable(H){x.value=H&&S.value},setEmbeddableCatalog(H){a.value=H},setGroupCodeCatalog(H){r.value=H},setPredefinedCustomTypeCatalog(H){l.value=H},setSuperClassCatalog(H){s.value=H},selectAttribute:K.selectAttribute,moveAttributeFocus:K.moveAttributeFocus,nudgeSelectedAttributes:K.nudgeSelectedAttributes,nudgeNodes:K.nudgeNodes,requestFocus:K.requestFocus,deleteSelection(){if(!x.value)return!1;const H=v.value;if(!H)return!1;if(H.kind==="attribute"){if(he(H.entityId))return!1;const B=H.ids;if(!B.length)return!1;B.length===1?ve.removeAttribute(H.entityId,B[0]):ve.removeAttributes(H.entityId,B)}else if(H.kind==="entity"){if(he(H.id))return!1;J.removeEntity(H.id)}else if(H.kind==="note")G.removeNote(H.id);else if(H.kind==="group"){if(we(H.id))return!1;Te.removeGroup(H.id)}else te.removeAssociation(H.id);return v.value=null,!0},undo:()=>{x.value&&i.undo()},redo:()=>{x.value&&i.redo()},markSaved:()=>{x.value&&(ge.flush(),i.markSavePoint())},loadDiagram(H,B){ge.teardownOpAdapter(),o.logical=H.logical,o.layout=H.layout,i=new ol(o),me(),$.value=(B==null?void 0:B.schemaVersion)??1,L.value=(B==null?void 0:B.opWriteEnabled)??!1,V.value=(B==null?void 0:B.referenceOnly)??!1,x.value=!($.value>=2&&L.value===!1),pe.value=null,ye.value=null,v.value=null,_.value=i.canUndo,E.value=i.canRedo,N.value=i.isDirty,ge.setupOpAdapter(i,B),oe()},flush:ge.flush,whenOpsSettled:ge.whenOpsSettled,addEntity:J.addEntity,renameEntity:J.renameEntity,updateEntity:J.updateEntity,moveEntity:J.moveEntity,resizeEntity:J.resizeEntity,removeEntity:J.removeEntity,setEntitySwatch:J.setEntitySwatch,setEntityCollapsed:J.setEntityCollapsed,setEntityLocked:J.setEntityLocked,isEntityLocked:J.isEntityLocked,isAssociationLocked:J.isAssociationLocked,collapseAll:J.collapseAll,expandAll:J.expandAll,setAttributeSwatch:ve.setAttributeSwatch,dragGroup:Te.dragGroup,resizeGroup:Te.resizeGroup,setGroupSwatch:Te.setGroupSwatch,setGroupLocked:Te.setGroupLocked,isGroupLocked:Te.isGroupLocked,updateGroup:Te.updateGroup,createGroup:Te.createGroup,addEmptyGroup:Te.addEmptyGroup,removeGroup:Te.removeGroup,dropEntity:Te.dropEntity,ungroupEntity:Te.ungroupEntity,dropNote:Te.dropNote,addPredefinedEmbed:ve.addPredefinedEmbed,addAttribute:ve.addAttribute,addDivider:ve.addDivider,updateAttribute:ve.updateAttribute,setAttributeGroupCode:ve.setAttributeGroupCode,setEmbedColumns:ve.setEmbedColumns,removeAttribute:ve.removeAttribute,removeAttributes:ve.removeAttributes,setAttributeSwatches:ve.setAttributeSwatches,reorderAttributes:ve.reorderAttributes,addIndex(H,B){he(H)||U(bd(H,B))},updateIndex(H,B,Pe){he(H)||U(ua(H,B,Pe))},removeIndex(H,B){he(H)||U(_d(H,B))},addOperation(H,B={}){if(!x.value||he(H))return null;const Pe=o.logical.entities.find(De=>De.modelId===H),Ze=Pe!=null&&Pe.operations?Rt(Pe.operations):0,Ue=B.modelId??Me(),Le={modelId:Ue,name:B.name??`method${Ze}`,visibility:B.visibility??"PACKAGE",order:Ze,...B};return U(md(H,Le)),Ue},updateOperation(H,B,Pe){he(H)||U(fd(H,B,Pe))},removeOperation(H,B){he(H)||U(pd(H,B))},reorderOperations(H,B,Pe){!B.length||he(H)||U(hd(H,B,Pe))},setOperationSwatch(H,B,Pe){U(yd(H,B,Pe))},addAssociation:te.addAssociation,addEmbedAssociation:te.addEmbedAssociation,setEmbedCardinality:te.setEmbedCardinality,removeAssociation:te.removeAssociation,setAssociationIdentifying:te.setAssociationIdentifying,updateAssociationEnd:te.updateAssociationEnd,hasQuickFix(H){if(!x.value)return!1;const B=Hr(H,o.logical);return B?B.kind==="setEndCascades"?!_e(B.assocRef):!Q(B.entityRef):!1},applyQuickFix(H){if(!x.value)return!1;const B=Hr(H,o.logical);if(!B)return!1;if(B.kind==="setIndexColumns")return he(B.entityRef)?!1:(U(ua(B.entityRef,B.indexRef,{columns:B.columns})),!0);if(Ie(B.assocRef))return!1;const Pe=o.logical.associations.find(Ze=>Ze.modelId===B.assocRef);return Pe?(U(Tt(B.assocRef,B.which,{jpa:{...Pe[B.which].jpa,cascadeTypes:B.cascades}})),!0):!1},moveWaypoint(H,B,Pe){U(kd(H,B,Pe))},addWaypoint(H,B,Pe){U(Id(H,B,Pe))},removeWaypoint(H,B){U(Ed(H,B))},clearWaypoints(H){U(wd(H))},addNote:G.addNote,removeNote:G.removeNote,moveNote:G.moveNote,resizeNote:G.resizeNote,setNoteMemo:G.setNoteMemo,setNoteSwatch:G.setNoteSwatch,addNoteConnection:G.addNoteConnection,removeNoteConnection:G.removeNoteConnection,moveNoteConnectionWaypoint:G.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:G.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:G.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:G.clearNoteConnectionWaypoints,autoLayout(){const H=Ts(o.logical,o.layout);H.length&&U(We("자동 배치",H.map(B=>Eo(B.id,B.location))))},copy:q.copy,paste:q.paste,importEntities:q.importEntities}}const Za=Symbol("groupHover"),Bf=Symbol("groupDrag"),Bo=Symbol("relationHighlight"),Df=Symbol("diffOverlay"),Of=Symbol("nodeInternals"),Lf=Symbol("columnResolution");function LC(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 Pf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!LC(e[o],n[o]))return!1;return!0}function PC(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(!Pf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function zC(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function FC(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||!zC(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!PC(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Pf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function UC(){let e;return(n,o)=>e=HC(n,o,e)}function HC(e,n,o){const i=e.entities,a=new Map;for(const r of i){const l=new Map,s=new Map,c=new Map;let d=null;const u=()=>d??(d=co(Nn(r,i)));for(const g of r.attributes){if(Li(g)){const p=g.dbAttrs[0];if(!(p!=null&&p.physicalName&&(p!=null&&p.dataType))){const k=Pi(g,r,i,e.associations);k&&l.set(g.modelId,{...g,dbAttrs:[{...p,physicalName:(p==null?void 0:p.physicalName)||k.physicalName,dataType:(p==null?void 0:p.dataType)||k.dataType,length:(p==null?void 0:p.length)??k.length,scale:(p==null?void 0:p.scale)??k.scale},...g.dbAttrs.slice(1)]})}}const _=Tr(g,e.associations);if(_&&c.set(g.modelId,_),!g.attrType.startsWith("EMBED")||g.dbAttrs.length===0)continue;if(g.attrType!=="EMBED_PREDEF"){const p=u();s.set(g.modelId,g.dbAttrs.map((k,I)=>{const A=Dn(k,p);return A?{...k,physicalName:A.physicalName}:on(g,k,I,r,e)}));continue}const E=n==null?void 0:n.find(p=>p.type===g.type);if(!E)continue;const N=u();s.set(g.modelId,g.dbAttrs.map((p,k)=>{const I=E.fields[k],A=Dn(p,N);return A?{...p,physicalName:A.physicalName,logicalName:p.logicalName??(I==null?void 0:I.logicalName),dataType:p.dataType||(I==null?void 0:I.dataType)||""}:I?{...p,physicalName:p.physicalName||I.physicalName,logicalName:p.logicalName??I.logicalName,dataType:p.dataType||I.dataType,length:p.length??I.length}:p}))}const m=new Map,h=new Map;for(const g of r.attributes){const _=s.get(g.modelId);if(_)for(let E=0;E<_.length;E++){const N=`${g.attrType}\0${g.type??""}\0${E}`,p={attrId:g.modelId,slot:E,name:_[E].physicalName??""},k=h.get(N);k?k.push(p):h.set(N,[p])}}for(const g of h.values()){if(g.length<2)continue;const _=new Map;for(const E of g)_.set(E.name,(_.get(E.name)??0)+1);for(const E of g){if((_.get(E.name)??0)<2)continue;const N=m.get(E.attrId);N?N.add(E.slot):m.set(E.attrId,new Set([E.slot]))}}const f={effectiveAttrs:l,embedCols:s,collectionTypes:c,redundantSlots:m},y=o==null?void 0:o.get(r.modelId);a.set(r.modelId,y&&FC(f,y)?y:f)}return a}const zf=Symbol("embedSlotCollapse"),Ff=(e,n)=>`${e}:${n}`,Uf="all:",Hf="one:",jf=e=>`${Uf}${e}`,Kf=(e,n)=>`${Hf}${e}:${n}`,jC=e=>!e.startsWith(Uf)&&!e.startsWith(Hf),KC=["title"],GC={key:0,class:"em-sel","aria-hidden":"true"},YC=["title","aria-expanded","disabled"],qC={class:"em-entity__stereotype"},WC={key:1,class:"em-entity__name"},JC=["title","aria-expanded"],XC={"aria-hidden":"true"},ZC=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],QC=["onPointerdown"],ex={key:1,class:"em-entity__divider-label"},tx=["title"],nx={class:"em-key-slot"},ox={class:"em-key-slot"},ix=["title","aria-expanded","onClick"],ax=["title","onClick"],rx=["title","aria-expanded","onClick"],lx={key:2,class:"em-entity__type"},sx=["onClick"],cx={class:"em-entity__attrname"},dx={class:"em-entity__type"},ux={key:1,class:"em-entity__embed-summary"},mx=["title"],fx=["data-op"],px=["onPointerdown"],hx={class:"em-entity__op-vis","aria-hidden":"true"},yx=["title"],gx={key:4,class:"em-entity__footer"},Gf=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(oo,null),i=(C,R)=>o?o.t(C,R):Dt("ko",C,R),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=ee.useModal();function l(){o&&Wa(r,o,n.id)}const s=t.inject(Za,null),c=t.inject(Bo,null),d=t.inject(Df,null),u=t.computed(()=>{var C;return((C=d==null?void 0:d.marks.value)==null?void 0:C.get(n.id))??null}),m=t.inject(Lf,null),h=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(zf,void 0),y=t.inject(Of,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const g=t.computed(()=>!!o&&o.editable.value);function _(){s&&(s.value=n.data.groupRef??null)}function E(){c==null||c.setEntityHover(n.id)}function N(){c==null||c.setEntityHover(null)}const p=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),k=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!p.value),I=t.computed(()=>{var C;return((C=o==null?void 0:o.selection.value)==null?void 0:C.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!I.value),$=t.computed(()=>{var C;return o&&((C=o.selectedAttr.value)==null?void 0:C.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),L=t.computed(()=>$.value.size>0);function V(C,R){const W=R.shiftKey?"range":R.metaKey||R.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,C.modelId,W)}const S=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!I.value),x=t.computed(()=>n.data.entity),T=t.computed(()=>Ph(x.value,o==null?void 0:o.referenceOnlyDocument.value)),D=t.computed(()=>[...x.value.attributes].sort((C,R)=>C.order-R.order)),b=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>n.data.collapsed??!1),v=t.computed(()=>n.data.locked??!1),O=t.computed(()=>g.value&&!v.value);function M(){g.value&&(o==null||o.setEntityCollapsed(n.id,!w.value))}const z=t.computed(()=>b.value==="PHYSICAL"||b.value==="LOGICAL_PHYSICAL"),j=t.computed(()=>{const C=b.value==="PHYSICAL"||b.value==="LOGICAL_PHYSICAL",R={};for(const W of D.value){const re=W.attrType.startsWith("RELATION")&&W.dbAttrs.length>0;R[W.modelId]={pk:W.identifier,fk:re&&C,required:W.notNull&&!W.identifier}}return R});function ie(C){if(!C)return"";const R=[];return C.pk&&C.fk?R.push(i("em.node.keyPfk")):C.pk?R.push(i("em.node.keyPk")):C.fk&&R.push(i("em.node.keyFk")),C.required&&R.push(i("em.node.required")),R.join(" · ")}const pe=t.computed(()=>{const C=Ql(_t(n.data.style)),R={};return C&&(R["--em-header-bg"]=C.bar,R["--em-header-fg"]=C.barOn),R});function ye(C){var R,W;return(W=Ql(_t((R=n.data.attributeStyles)==null?void 0:R[C.modelId])))==null?void 0:W.text}const ge=t.computed(()=>[...x.value.operations??[]].sort((C,R)=>C.order-R.order)),me=t.computed(()=>b.value==="CLASS"&&ge.value.length>0),se={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ke(C){return C?se[C]:"~"}function Se(C){var R,W;return(W=Ql(_t((R=n.data.operationStyles)==null?void 0:R[C.modelId])))==null?void 0:W.text}function ce(C,R,W){switch(b.value){case"CLASS":return[{text:C}];case"PHYSICAL":return[{text:W||C}];case"LOGICAL":return[R?{text:R}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=R?{text:R}:{text:i("em.node.logicalMissing"),missing:!0};return W?[re,{text:` · ${W}`}]:[re]}}}function fe(C){var R;return((R=h.value)==null?void 0:R.effectiveAttrs.get(C.modelId))??C}function oe(C){var W,re,ne;if(le(C))return[{text:C.name}];const R=fe(C);return ce(C.name,(re=(W=R.dbAttrs[0])==null?void 0:W.logicalName)==null?void 0:re[a.value],((ne=R.dbAttrs[0])==null?void 0:ne.physicalName)??"")}function le(C){return C.attrType.startsWith("EMBED")&&C.dbAttrs.length>0}function ue(C){return C.attrType==="DIVIDER"}function F(C){var R;return((R=h.value)==null?void 0:R.embedCols.get(C.modelId))??C.dbAttrs}function P(C){var R;return(R=h.value)==null?void 0:R.redundantSlots.get(C.modelId)}const U=t.computed(()=>(f==null?void 0:f.isCollapsed(jf(n.id)))??!1),Q=t.computed(()=>U.value&&z.value?D.value.reduce((C,R)=>le(R)?C+F(R).length:C,0):0),X=t.computed(()=>D.value.some(C=>le(C)));function _e(C){const R=P(C);return!R||R.size===0?!1:f?f.isCollapsed(Ff(n.id,C.modelId)):!1}function he(C){var R;return _e(C)?((R=P(C))==null?void 0:R.size)??0:0}function we(C){return f?f.isCollapsed(Kf(n.id,C.modelId)):!1}function Ie(C){var R;return!z.value||U.value?null:we(C)?"attr":(((R=P(C))==null?void 0:R.size)??0)>0?"slot":null}function q(C){return!U.value&&le(C)}function K(C){return we(C)?F(C).length:0}function J(C){if(U.value||we(C))return[];const R=F(C);if(!_e(C))return R;const W=P(C);return R.filter((re,ne)=>!W.has(ne))}function ve(C){f==null||f.toggle(Ff(n.id,C.modelId))}function Te(C){f==null||f.toggle(Kf(n.id,C.modelId))}function G(){f==null||f.toggle(jf(n.id))}function te(C){var R;return ce(C.physicalName,(R=C.logicalName)==null?void 0:R[a.value],C.physicalName)}function Y(C){var W;const R=(W=h.value)==null?void 0:W.collectionTypes.get(C.modelId);return Mr(b.value,fe(C),R)}const ae=t.computed(()=>{const C={};for(const R of D.value)C[R.modelId]=Y(R);return C}),Be=t.computed(()=>{var C,R,W;return ce(x.value.name,(R=(C=x.value.table)==null?void 0:C.logicalName)==null?void 0:R[a.value],((W=x.value.table)==null?void 0:W.physicalName)??"")}),Ve=t.ref(!1),H=t.ref(""),B=t.ref(null);async function Pe(){var C,R;O.value&&(H.value=x.value.name,Ve.value=!0,await t.nextTick(),(C=B.value)==null||C.focus(),(R=B.value)==null||R.select())}function Ze(){if(!Ve.value)return;Ve.value=!1;const C=H.value.trim();C&&C!==x.value.name&&(o==null||o.renameEntity(n.id,C))}function Ue(){o==null||o.addAttribute(n.id)}function Le(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:De,findNode:Z}=je(),dt=t.ref(null),bn=t.computed(()=>{const C=dt.value??n.data.size;return C?{width:`${C.width}px`,minHeight:`${C.height}px`}:void 0});let Et=null;function _n(C){var re,ne,Ce;if(!O.value)return;C.stopPropagation();const R=(re=Z(n.id))==null?void 0:re.dimensions,W=De({x:C.clientX,y:C.clientY});Et={fx:W.x,fy:W.y,w:(R==null?void 0:R.width)??((ne=n.data.size)==null?void 0:ne.width)??200,h:(R==null?void 0:R.height)??((Ce=n.data.size)==null?void 0:Ce.height)??120},C.target.setPointerCapture(C.pointerId)}function Ee(C){if(!Et)return;const R=De({x:C.clientX,y:C.clientY});dt.value={width:Math.max(40,Et.w+(R.x-Et.fx)),height:Math.max(40,Et.h+(R.y-Et.fy))}}function at(C){var R,W,re;if(Et&&dt.value&&o){const ne=(R=Z(n.id))==null?void 0:R.dimensions;o.resizeEntity(n.id,{width:Math.round((ne==null?void 0:ne.width)??dt.value.width),height:Math.round((ne==null?void 0:ne.height)??dt.value.height)})}Et=null,dt.value=null,(re=(W=C.target).releasePointerCapture)==null||re.call(W,C.pointerId)}const zt=t.ref(null),ut=t.ref(null);function en(C,R){if(!O.value)return;R.stopPropagation(),R.preventDefault();const W=$.value,re=W.has(C.modelId)?new Set(W):new Set([C.modelId]);ut.value={ids:re,dropIndex:-1,lineY:0},R.target.setPointerCapture(R.pointerId)}function tn(C){if(!ut.value||!zt.value)return;const R=Array.from(zt.value.querySelectorAll(".em-entity__row"));if(!R.length)return;let W=R.length;for(let Ce=0;Ce<R.length;Ce++){const de=R[Ce].getBoundingClientRect();if(C.clientY<de.top+de.height/2){W=Ce;break}}const re=R[R.length-1],ne=W<R.length?R[W].offsetTop:re.offsetTop+re.offsetHeight;ut.value={...ut.value,dropIndex:W,lineY:ne}}function Ne(){const C=ut.value;if(ut.value=null,!C||C.dropIndex<0)return;const R=D.value,W=R.filter(xe=>C.ids.has(xe.modelId)).map(xe=>xe.modelId),re=R.filter((xe,Fe)=>C.ids.has(xe.modelId)&&Fe<C.dropIndex).length,ne=C.dropIndex-re,Ce=R.filter(xe=>!C.ids.has(xe.modelId)).map(xe=>xe.modelId);[...Ce.slice(0,ne),...W,...Ce.slice(ne)].join(",")!==R.map(xe=>xe.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,W,ne))}function et(){ut.value=null}const Ft=t.ref(null),pt=t.ref(null);function nt(C,R){O.value&&(R.stopPropagation(),R.preventDefault(),pt.value={id:C.modelId,dropIndex:-1,lineY:0},R.target.setPointerCapture(R.pointerId))}function Uo(C){if(!pt.value||!Ft.value)return;const R=Array.from(Ft.value.querySelectorAll(".em-entity__op-row"));if(!R.length)return;let W=R.length;for(let Ce=0;Ce<R.length;Ce++){const de=R[Ce].getBoundingClientRect();if(C.clientY<de.top+de.height/2){W=Ce;break}}const re=R[R.length-1],ne=W<R.length?R[W].offsetTop:re.offsetTop+re.offsetHeight;pt.value={...pt.value,dropIndex:W,lineY:ne}}function Ho(){const C=pt.value;if(pt.value=null,!C||C.dropIndex<0)return;const W=ge.value.findIndex(ne=>ne.modelId===C.id);if(W<0)return;const re=C.dropIndex-(W<C.dropIndex?1:0);re!==W&&(o==null||o.reorderOperations(n.id,[C.id],re))}function jo(){pt.value=null}return(C,R)=>{var W,re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":p.value,"is-related":k.value,"is-dimmed":S.value,"is-selected":I.value,"is-multi-selected":A.value,"has-focused-attr":L.value,"is-locked":v.value,"is-reference-only":T.value,"is-diff-added":((W=u.value)==null?void 0:W.verb)==="added","is-diff-modified":((re=u.value)==null?void 0:re.verb)==="modified"}]),tabindex:"-1",title:T.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(bn.value),onPointerdown:_,onMouseenter:E,onMouseleave:N,onDblclick:l},[I.value?(t.openBlock(),t.createElementBlock("div",GC,[...R[11]||(R[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(pe.value),onDblclick:t.withModifiers(Pe,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(w.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!w.value,disabled:!g.value,onClick:t.withModifiers(M,["stop"]),onPointerdown:R[0]||(R[0]=t.withModifiers(()=>{},["stop"])),onDblclick:R[1]||(R[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(w.value?"▸":"▾"),41,YC),t.createElementVNode("span",qC,"«"+t.toDisplayString(t.unref(Go)(x.value.stereotype))+"»",1),Ve.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:B,"onUpdate:modelValue":R[2]||(R[2]=ne=>H.value=ne),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Ze,["enter"]),R[3]||(R[3]=t.withKeys(ne=>Ve.value=!1,["esc"]))],onBlur:Ze,onPointerdown:R[4]||(R[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,H.value]]):(t.openBlock(),t.createElementBlock("span",WC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Be.value,(ne,Ce)=>(t.openBlock(),t.createElementBlock("span",{key:Ce,class:t.normalizeClass({"em-entity__missing":ne.missing})},t.toDisplayString(ne.text),3))),128))])),!w.value&&z.value&&X.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:U.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!U.value,onClick:t.withModifiers(G,["stop"]),onPointerdown:R[5]||(R[5]=t.withModifiers(()=>{},["stop"])),onDblclick:R[6]||(R[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",XC,t.toDisplayString(U.value?"▸":"▾"),1)],40,JC)):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(Ae,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:zt,class:"em-entity__attrs"},[ut.value&&ut.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ut.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.value,ne=>{var Ce,de,xe,Fe,He,rt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ne.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":$.value.has(ne.modelId),"is-dragging":(Ce=ut.value)==null?void 0:Ce.ids.has(ne.modelId),"is-embed":le(ne),"is-divider":ue(ne),"has-embed-badge":!!Ie(ne),nodrag:ue(ne)&&O.value,"is-diff-changed":!!((de=u.value)!=null&&de.changedAttributeIds.has(ne.modelId))}]),"data-attr":ne.modelId,onClick:t.withModifiers(ze=>V(ne,ze),["stop"]),onPointerdown:ze=>ue(ne)?en(ne,ze):void 0,onPointermove:ze=>ue(ne)?tn(ze):void 0,onPointerup:ze=>ue(ne)?Ne():void 0,onPointercancel:ze=>ue(ne)?et():void 0},[O.value&&!ue(ne)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ze=>en(ne,ze),onPointermove:tn,onPointerup:Ne,onPointercancel:et,onClick:R[7]||(R[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,QC)):t.createCommentVNode("",!0),ue(ne)?(t.openBlock(),t.createElementBlock("span",ex,t.toDisplayString(ne.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Zn),{id:`l:${ne.modelId}`,type:"target",position:t.unref($e).Left,class:"em-handle",title:O.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:ie(j.value[ne.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",nx,[(xe=j.value[ne.modelId])!=null&&xe.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Fe=j.value[ne.modelId])!=null&&Fe.required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",ox,[z.value&&q(ne)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:we(ne)?i("em.node.embedAttrShow",{count:K(ne)}):i("em.node.embedAttrHide"),"aria-expanded":!we(ne),onClick:t.withModifiers(ze=>Te(ne),["stop"]),onPointerdown:R[8]||(R[8]=t.withModifiers(()=>{},["stop"])),onDblclick:R[9]||(R[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(we(ne)?"▸":"▾"),41,ix)):le(ne)?(t.openBlock(),t.createBlock(Ae,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(He=j.value[ne.modelId])!=null&&He.fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,tx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:ye(ne)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe(ne),(ze,ot)=>(t.openBlock(),t.createElementBlock("span",{key:ot,class:t.normalizeClass({"em-entity__missing":ze.missing})},t.toDisplayString(ze.text),3))),128))],4),Ie(ne)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:K(ne)}),onClick:t.withModifiers(ze=>Te(ne),["stop"])},"+"+t.toDisplayString(K(ne)),9,ax)):Ie(ne)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:_e(ne)?i("em.node.embedRepeatedShow",{count:((rt=P(ne))==null?void 0:rt.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!_e(ne),onClick:t.withModifiers(ze=>ve(ne),["stop"])},t.toDisplayString(_e(ne)?`+${he(ne)}`:"−"),9,rx)):t.createCommentVNode("",!0),ae.value[ne.modelId]?(t.openBlock(),t.createElementBlock("span",lx,t.toDisplayString(ae.value[ne.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Zn),{id:`r:${ne.modelId}`,type:"source",position:t.unref($e).Right,class:"em-handle",title:O.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,ZC),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le(ne)&&z.value?J(ne):[],ze=>(t.openBlock(),t.createElementBlock("li",{key:`${ne.modelId}:${ze.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":$.value.has(ne.modelId)}]),onClick:t.withModifiers(ot=>V(ne,ot),["stop"])},[R[12]||(R[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",cx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te(ze),(ot,tt)=>(t.openBlock(),t.createElementBlock("span",{key:tt,class:t.normalizeClass({"em-entity__missing":ot.missing})},t.toDisplayString(ot.text),3))),128))]),t.createElementVNode("span",dx,t.toDisplayString(ze.dataType),1)],10,sx))),128))],64)}),128)),Q.value?(t.openBlock(),t.createElementBlock("li",ux,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(G,["stop"])},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:Q.value})),1)],8,mx)])):t.createCommentVNode("",!0)],512)),!w.value&&me.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ft,class:"em-entity__ops"},[pt.value&&pt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${pt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,ne=>{var Ce,de;return t.openBlock(),t.createElementBlock("li",{key:ne.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ce=pt.value)==null?void 0:Ce.id)===ne.modelId,"is-diff-changed":!!((de=u.value)!=null&&de.changedOperationIds.has(ne.modelId))}]),"data-op":ne.modelId},[O.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:xe=>nt(ne,xe),onPointermove:Uo,onPointerup:Ho,onPointercancel:jo,onClick:R[10]||(R[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,px)):t.createCommentVNode("",!0),t.createElementVNode("span",hx,t.toDisplayString(ke(ne.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:Se(ne)})},t.toDisplayString(ne.name)+"()",5)],10,fx)}),128))],512)):ge.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ge.value.length})},[t.createVNode(Ae,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ge.value.length})),1)],8,yx)):t.createCommentVNode("",!0),O.value?(t.openBlock(),t.createElementBlock("footer",gx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Ue},t.toDisplayString(i("em.node.addAttr")),1),R[13]||(R[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Le},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),O.value&&!Ve.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:_n,onPointermove:Ee,onPointerup:at},null,32)):t.createCommentVNode("",!0)],46,KC)}}}),[["__scopeId","data-v-4dfeab79"]]),bx={key:0,class:"em-sel","aria-hidden":"true"},_x={class:"em-group__label"},kx={class:"em-group__name"},Ex={key:0,class:"em-group__pkg"},Nx={key:1,class:"em-group__flag"},Yf=Ke(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>_t(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(oo,null),s=(x,T)=>l?l.t(x,T):Dt("ko",x,T),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var x;return!!n.id&&((x=l==null?void 0:l.selection.value)==null?void 0:x.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Za,null),h=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Bo,null);function y(){n.id&&(f==null||f.setGroupHover(n.id))}function g(){f==null||f.setGroupHover(null)}const _=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),E=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:N,findNode:p}=je();let k=null,I=null;function A(x){var b;if(!n.id||!c.value)return;x.stopPropagation();const T=((b=p(n.id))==null?void 0:b.dimensions)??{width:400,height:300},D=N({x:x.clientX,y:x.clientY});k={fx:D.x,fy:D.y,w:T.width,h:T.height},x.target.setPointerCapture(x.pointerId)}function $(x){if(!k||!n.id)return;const T=N({x:x.clientX,y:x.clientY});I={width:Math.max(160,k.w+(T.x-k.fx)),height:Math.max(120,k.h+(T.y-k.fy))};const D=p(n.id);D&&(D.style={width:`${I.width}px`,height:`${I.height}px`})}function L(x){var T,D;k&&I&&n.id&&l&&l.resizeGroup(n.id,I),k=null,I=null,(D=(T=x.target).releasePointerCapture)==null||D.call(T,x.pointerId)}const V=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),S=t.computed(()=>{const x=o.value.name;return(x==null?void 0:x[V.value])||(x==null?void 0:x.ko)||(x==null?void 0:x.en)||(x==null?void 0:x.ja)||(x==null?void 0:x.zh)||o.value.packageName||s("em.group.fallback")});return(x,T)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":h.value,"is-hover-origin":_.value,"is-dimmed":E.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:g},[d.value?(t.openBlock(),t.createElementBlock("div",bx,[...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",_x,[t.createElementVNode("span",kx,t.toDisplayString(S.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Ex,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",Nx,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ae,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:$,onPointerup:L},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),wx={key:0,class:"em-sel","aria-hidden":"true"},Ix={key:2,class:"em-note__text"},qf=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(oo,null),i=t.inject(Za,null),a=t.inject(Bo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>_t(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const h=t.computed(()=>{var b;return((b=a==null?void 0:a.source.value)==null?void 0:b.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!h.value),y=t.computed(()=>{var b;return((b=o==null?void 0:o.selection.value)==null?void 0:b.kind)==="note"&&o.selection.value.id===n.id}),g=t.computed(()=>!!n.selected&&!y.value),_=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),E=[{id:"n-top",pos:$e.Top},{id:"n-right",pos:$e.Right},{id:"n-bottom",pos:$e.Bottom},{id:"n-left",pos:$e.Left}],N=t.ref(!1),p=t.ref(""),k=t.ref(null);async function I(){var b;l.value&&(p.value=r.value.memo,N.value=!0,await t.nextTick(),(b=k.value)==null||b.focus())}function A(){N.value&&(N.value=!1,p.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,p.value)))}const{screenToFlowCoordinate:$,findNode:L}=je();let V=null,S=null;function x(b){var O;if(!l.value)return;b.stopPropagation();const w=((O=L(n.id))==null?void 0:O.dimensions)??r.value.geo.size,v=$({x:b.clientX,y:b.clientY});V={fx:v.x,fy:v.y,w:w.width,h:w.height},b.target.setPointerCapture(b.pointerId)}function T(b){if(!V)return;const w=$({x:b.clientX,y:b.clientY});S={width:Math.max(140,V.w+(w.x-V.fx)),height:Math.max(60,V.h+(w.y-V.fy))};const v=L(n.id);v&&(v.style={width:`${S.width}px`,height:`${S.height}px`})}function D(b){var w,v;V&&S&&o&&o.resizeNote(n.id,S),V=null,S=null,(v=(w=b.target).releasePointerCapture)==null||v.call(w,b.pointerId)}return(b,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":f.value,"is-dimmed":_.value,"is-selected":y.value,"is-multi-selected":g.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:I,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",wx,[...w[4]||(w[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),N.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:k,"onUpdate:modelValue":w[0]||(w[0]=v=>p.value=v),class:"em-note__edit nodrag",onBlur:A,onKeydown:w[1]||(w[1]=t.withKeys(v=>N.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,p.value]]):(t.openBlock(),t.createElementBlock("div",Ix,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(E,v=>t.createVNode(t.unref(Zn),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!N.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:x,onPointermove:T,onPointerup:D},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Qa(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 Do=.5;function Wf(e,n,o,i,a,r){const l=Qa(n),s=Qa(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let h=e;const f=(_,E)=>{(Math.abs(_.x-h.x)>=Do||Math.abs(_.y-h.y)>=Do)&&(m.push({a:h,b:_,seg:E}),h=_)};f(c,0);let y=l.x!==0,g=c;for(let _=1;_<u.length;_++){const E=u[_],N=_<=o.length?_-1:o.length,p=Math.abs(E.x-g.x)<Do,k=Math.abs(E.y-g.y)<Do;p&&k||(p?(f(E,N),y=!1):k?(f(E,N),y=!0):y?(f({x:g.x,y:E.y},N),f(E,N),y=!0):(f({x:E.x,y:g.y},N),f(E,N),y=!1),g=E)}return f(i,o.length),m}function Jf(e,n,o,i,a,r=20){const l=Wf(e,n,o,i,a,r);let s=`M ${kt(e.x)},${kt(e.y)}`;for(const c of l)s+=` L ${kt(c.b.x)},${kt(c.b.y)}`;return s}const vx=14;function Xf(e,n,o,i,a,r=20){return Wf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=vx).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function kt(e){return Math.round(e*100)/100}const Cx=36;function xx(e,n,o=Cx){const i=Math.max(e.x,n.x)+o;return`M ${kt(e.x)},${kt(e.y)} L ${kt(i)},${kt(e.y)} L ${kt(i)},${kt(n.y)} L ${kt(n.x)},${kt(n.y)}`}function Zf(e,n,o){const i=[e,...n,o];let a=`M ${kt(i[0].x)},${kt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${kt(i[r].x)},${kt(i[r].y)}`;return a}function Sx(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Qf(e,n){const o=Sx(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Do&&Math.abs(l)<Do)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 ep(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 tp(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 Rx=20,Ax=22,$x=7,Tx=22,np=31,op=7,Mx=20,ip=11,ap=11,Vx=np+op;function Bx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Dx(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function er(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 rp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function tr(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function lp(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:rp(e,n);return[tr(o,a,r-Math.PI/2),tr(o,a,r+Math.PI/2)]}function sp(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 cp(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=er(e,n,Rx),[d,u]=lp(e,n,c,Ax);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}),Bx(o.multiplicity)){const m=er(e,n,np);r.push({cx:m.x,cy:m.y,r:op})}if(Dx(o.multiplicity)){const m=er(e,n,$x),[h,f]=lp(e,n,m,Tx);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=er(e,n,Mx),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=rp(e,n),m=tr(d,ip/2,u-Math.PI/2),h=tr(d,ip/2,u+Math.PI/2);l.push({points:[e,m,c,h]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=sp(s,c,ap,!0),u=sp(s,c,ap,!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 dp=200,up=120,is=24;function mp(e){var a,r;if(!e)return{x:0,y:0,width:dp,height:up};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||dp,i=((r=e.dimensions)==null?void 0:r.height)||up;return{x:n.x,y:n.y,width:o,height:i}}function fp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pp(e){const n=t.computed(()=>mp(e.sourceNode())),o=t.computed(()=>mp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,y;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,h=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(h-m)<is){const g=(m+h)/2;m=g-is/2,h=g+is/2}return{source:{x:u,y:m},target:{x:u,y:h}}}),r=t.computed(()=>e.waypoints()[0]??fp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??fp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ep(n.value,d,r.value.x):Qf(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ep(o.value,d,l.value.x):Qf(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const as=Symbol("waypointController"),Ox=["d"],Lx=["d"],Px=["d"],zx=["x1","y1","x2","y2"],Fx=["cx","cy","r"],Ux=["x","y"],Hx=["x","y"],jx=["cx","cy","onDblclick"],Kx=["x","y","onPointerdown","onDblclick"],hp=Ke(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(as),a=t.inject(oo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Bf,null),s=t.inject(Bo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var oe;return((oe=a==null?void 0:a.selection.value)==null?void 0:oe.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const oe=l==null?void 0:l.value;if(!oe||!a)return null;const le=a.resolved.value.entities,ue=P=>{var U;return(U=le.find(Q=>Q.entity.modelId===P))==null?void 0:U.groupRef},F=n.data.association;return ue(F.end1.entityRef)===oe.groupId&&ue(F.end2.entityRef)===oe.groupId?{dx:oe.dx,dy:oe.dy}:null}),h=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),y=t.ref({x:0,y:0}),g=t.computed(()=>{const oe=m.value;return h.value.map((le,ue)=>ue===f.value?y.value:oe?{x:le.x+oe.dx,y:le.y+oe.dy}:le)}),_=t.computed(()=>{var oe;return!!((oe=n.sourceNode.data)!=null&&oe.collapsed)}),E=t.computed(()=>{var oe;return!!((oe=n.targetNode.data)!=null&&oe.collapsed)}),{source:N,target:p,sourceSide:k,targetSide:I,isSelf:A}=pp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>g.value,sourceRowY:()=>n.data.sourceColumnRef&&!_.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!E.value?n.targetY:void 0}),$=Vx+4,L=t.computed(()=>A.value?xx(N.value,p.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Jf(N.value,k.value,g.value,p.value,I.value,$):Zf(N.value,g.value,p.value)),V=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Xf(N.value,k.value,g.value,p.value,I.value,$):tp(N.value,g.value,p.value).map((oe,le)=>({point:oe,segIndex:le}))),S=t.computed(()=>A.value||!r.value?[]:g.value),x=ji;function T(oe,le){f.value=oe,y.value={...h.value[oe]},le.target.setPointerCapture(le.pointerId),le.stopPropagation()}function D(oe){if(f.value<0)return;const le=o({x:oe.clientX,y:oe.clientY});y.value={x:le.x,y:le.y}}function b(oe){var le,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...y.value}),f.value=-1,(ue=(le=oe.target).releasePointerCapture)==null||ue.call(le,oe.pointerId)}function w(oe,le){le.stopPropagation(),i==null||i.removePoint(n.id,oe)}function v(oe,le){if(!i)return;const ue=o({x:le.clientX,y:le.clientY});i.insertPoint(n.id,oe,{x:ue.x,y:ue.y})}const O=t.computed(()=>x(n.data.association.end1.multiplicity)),M=t.computed(()=>x(n.data.association.end2.multiplicity)),z=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),j=t.computed(()=>z.value==="class"),ie=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const oe=Qa(k.value);return{x:N.value.x+oe.x*10,y:N.value.y+oe.y*10}}return g.value[0]??p.value}),pe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const le=Qa(I.value);return{x:p.value.x+le.x*10,y:p.value.y+le.y*10}}const oe=g.value;return oe[oe.length-1]??N.value}),ye=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end1.multiplicity,navigable:oe.end1.navigable,composition:oe.end1.composition,otherNavigable:oe.end2.navigable}}),ge=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end2.multiplicity,navigable:oe.end2.navigable,composition:oe.end2.composition,otherNavigable:oe.end1.navigable}}),me=t.computed(()=>cp(N.value,ie.value,ye.value,z.value)),se=t.computed(()=>cp(p.value,pe.value,ge.value,z.value)),ke=t.computed(()=>[...me.value.lines,...se.value.lines]),Se=t.computed(()=>[...me.value.circles,...se.value.circles]),ce=t.computed(()=>[...me.value.polygons,...se.value.polygons].map(oe=>`M${oe.points.map(le=>`${le.x},${le.y}`).join(" L")} Z`)),fe=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(oe,le)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:L.value,fill:"none",class:"em-edge__hit"},null,8,Ox),t.createElementVNode("path",{d:L.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,Lx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,(ue,F)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${F}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",fe.value])},null,10,Px))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ke.value,(ue,F)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${F}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,zx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(ue,F)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${F}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,Fx))),128)),j.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(N).x+8,y:t.unref(N).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(O.value),11,Ux),t.createElementVNode("text",{x:t.unref(p).x-8,y:t.unref(p).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(M.value),11,Hx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.value,(ue,F)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${F}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(P=>v(ue.segIndex,P),["stop"])},null,42,jx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,(ue,F)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${F}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:P=>T(F,P),onPointermove:D,onPointerup:b,onDblclick:P=>w(F,P)},null,42,Kx))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var pn=(e=>(e.Lines="lines",e.Dots="dots",e))(pn||{});const yp=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]}`})},gp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};pn.Lines+"",pn.Dots+"";const Gx={[pn.Dots]:"#81818a",[pn.Lines]:"#eee"},Yx=["id","x","y","width","height","patternTransform"],qx={key:2,height:"100",width:"100"},Wx=["fill"],Jx=["x","y","fill"],Xx={name:"Background",compatConfig:{MODE:3}},Zx=t.defineComponent({...Xx,props:{id:{},variant:{default:()=>pn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=je(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,h*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||Gx[e.variant||pn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(pn).Lines?(t.openBlock(),t.createBlock(t.unref(yp),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(pn).Dots?(t.openBlock(),t.createBlock(t.unref(gp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",qx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Wx)])):t.createCommentVNode("",!0)])],8,Yx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Jx),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),Qx={name:"ControlButton",compatConfig:{MODE:3}},eS=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},tS={type:"button",class:"vue-flow__controls-button"};function nS(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",tS,[t.renderSlot(e.$slots,"default")])}const io=eS(Qx,[["render",nS]]),oS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},iS=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function aS(e,n){return t.openBlock(),t.createElementBlock("svg",oS,iS)}const rS={render:aS},lS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},sS=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function cS(e,n){return t.openBlock(),t.createElementBlock("svg",lS,sS)}const dS={render:cS},uS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},mS=[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 fS(e,n){return t.openBlock(),t.createElementBlock("svg",uS,mS)}const pS={render:fS},hS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},yS=[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 gS(e,n){return t.openBlock(),t.createElementBlock("svg",hS,yS)}const bS={render:gS},_S={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},kS=[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 ES(e,n){return t.openBlock(),t.createElementBlock("svg",_S,kS)}const NS={render:ES},wS={name:"Controls",compatConfig:{MODE:3}},IS=t.defineComponent({...wS,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>hm.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=je(),h=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function g(){l(),n("zoomIn")}function _(){s(),n("zoomOut")}function E(){c(e.fitViewParams),n("fitView")}function N(){r(!h.value),n("interactionChange",!h.value)}return(p,k)=>(t.openBlock(),t.createBlock(t.unref(pf),{class:"vue-flow__controls",position:p.position},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"top"),p.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(p.$slots,"control-zoom-in",{},()=>[t.createVNode(io,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(rS))))])]),_:3},8,["disabled"])]),t.renderSlot(p.$slots,"control-zoom-out",{},()=>[t.createVNode(io,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(dS))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),p.showFitView?t.renderSlot(p.$slots,"control-fit-view",{key:1},()=>[t.createVNode(io,{class:"vue-flow__controls-fitview",onClick:E},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(pS))))])]),_:3})]):t.createCommentVNode("",!0),p.showInteractive?t.renderSlot(p.$slots,"control-interactive",{key:2},()=>[p.showInteractive?(t.openBlock(),t.createBlock(io,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:t.withCtx(()=>[h.value?t.renderSlot(p.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(NS))))]):t.createCommentVNode("",!0),h.value?t.createCommentVNode("",!0):t.renderSlot(p.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(bS))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(p.$slots,"default")]),_:3},8,["position"]))}});var vS={value:()=>{}};function rs(){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 nr(o)}function nr(e){this._=e}function CS(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}})}nr.prototype=rs.prototype={constructor:nr,on:function(e,n){var o=this._,i=CS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=xS(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]=bp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=bp(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 nr(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 xS(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function bp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=vS,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ls="http://www.w3.org/1999/xhtml";const _p={svg:"http://www.w3.org/2000/svg",xhtml:ls,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function or(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),_p.hasOwnProperty(n)?{space:_p[n],local:e}:e}function SS(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ls&&n.documentElement.namespaceURI===ls?n.createElement(e):n.createElementNS(o,e)}}function RS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function kp(e){var n=or(e);return(n.local?RS:SS)(n)}function AS(){}function ss(e){return e==null?AS:function(){return this.querySelector(e)}}function $S(e){typeof e!="function"&&(e=ss(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new St(i,this._parents)}function TS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function MS(){return[]}function Ep(e){return e==null?MS:function(){return this.querySelectorAll(e)}}function VS(e){return function(){return TS(e.apply(this,arguments))}}function BS(e){typeof e=="function"?e=VS(e):e=Ep(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new St(i,a)}function Np(e){return function(){return this.matches(e)}}function wp(e){return function(n){return n.matches(e)}}var DS=Array.prototype.find;function OS(e){return function(){return DS.call(this.children,e)}}function LS(){return this.firstElementChild}function PS(e){return this.select(e==null?LS:OS(typeof e=="function"?e:wp(e)))}var zS=Array.prototype.filter;function FS(){return Array.from(this.children)}function US(e){return function(){return zS.call(this.children,e)}}function HS(e){return this.selectAll(e==null?FS:US(typeof e=="function"?e:wp(e)))}function jS(e){typeof e!="function"&&(e=Np(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new St(i,this._parents)}function Ip(e){return new Array(e.length)}function KS(){return new St(this._enter||this._groups.map(Ip),this._parents)}function ir(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ir.prototype={constructor:ir,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 GS(e){return function(){return e}}function YS(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 ir(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function qS(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(h[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ir(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function WS(e){return e.__data__}function JS(e,n){if(!arguments.length)return Array.from(this,WS);var o=n?qS:YS,i=this._parents,a=this._groups;typeof e!="function"&&(e=GS(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,f=XS(e.call(u,u&&u.__data__,d,i)),y=f.length,g=s[d]=new Array(y),_=l[d]=new Array(y),E=c[d]=new Array(h);o(u,m,g,_,E,f,n);for(var N=0,p=0,k,I;N<y;++N)if(k=g[N]){for(N>=p&&(p=N+1);!(I=_[p])&&++p<y;);k._next=I||null}}return l=new St(l,i),l._enter=s,l._exit=c,l}function XS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ZS(){return new St(this._exit||this._groups.map(Ip),this._parents)}function QS(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 eR(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),f,y=0;y<m;++y)(f=d[y]||u[y])&&(h[y]=f);for(;c<a;++c)s[c]=o[c];return new St(s,this._parents)}function tR(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function nR(e){e||(e=oR);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new St(a,this._parents).order()}function oR(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function iR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function aR(){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 lR(){let e=0;for(const n of this)++e;return e}function sR(){return!this.node()}function cR(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 dR(e){return function(){this.removeAttribute(e)}}function uR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mR(e,n){return function(){this.setAttribute(e,n)}}function fR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function pR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function hR(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 yR(e,n){var o=or(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?uR:dR:typeof n=="function"?o.local?hR:pR:o.local?fR:mR)(o,n))}function vp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gR(e){return function(){this.style.removeProperty(e)}}function bR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function _R(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function kR(e,n,o){return arguments.length>1?this.each((n==null?gR:typeof n=="function"?_R:bR)(e,n,o??"")):Oo(this.node(),e)}function Oo(e,n){return e.style.getPropertyValue(n)||vp(e).getComputedStyle(e,null).getPropertyValue(n)}function ER(e){return function(){delete this[e]}}function NR(e,n){return function(){this[e]=n}}function wR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function IR(e,n){return arguments.length>1?this.each((n==null?ER:typeof n=="function"?wR:NR)(e,n)):this.node()[e]}function Cp(e){return e.trim().split(/^|\s+/)}function cs(e){return e.classList||new xp(e)}function xp(e){this._node=e,this._names=Cp(e.getAttribute("class")||"")}xp.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 Sp(e,n){for(var o=cs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Rp(e,n){for(var o=cs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function vR(e){return function(){Sp(this,e)}}function CR(e){return function(){Rp(this,e)}}function xR(e,n){return function(){(n.apply(this,arguments)?Sp:Rp)(this,e)}}function SR(e,n){var o=Cp(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?vR:CR)(o,n))}function RR(){this.textContent=""}function AR(e){return function(){this.textContent=e}}function $R(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function TR(e){return arguments.length?this.each(e==null?RR:(typeof e=="function"?$R:AR)(e)):this.node().textContent}function MR(){this.innerHTML=""}function VR(e){return function(){this.innerHTML=e}}function BR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function DR(e){return arguments.length?this.each(e==null?MR:(typeof e=="function"?BR:VR)(e)):this.node().innerHTML}function OR(){this.nextSibling&&this.parentNode.appendChild(this)}function LR(){return this.each(OR)}function PR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zR(){return this.each(PR)}function FR(e){var n=typeof e=="function"?e:kp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function UR(){return null}function HR(e,n){var o=typeof e=="function"?e:kp(e),i=n==null?UR:typeof n=="function"?n:ss(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function jR(){var e=this.parentNode;e&&e.removeChild(this)}function KR(){return this.each(jR)}function GR(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function YR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function qR(e){return this.select(e?YR:GR)}function WR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function JR(e){return function(n){e.call(this,n,this.__data__)}}function XR(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 ZR(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 QR(e,n,o){return function(){var i=this.__on,a,r=JR(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function eA(e,n,o){var i=XR(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?QR:ZR,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Ap(e,n,o){var i=vp(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 tA(e,n){return function(){return Ap(this,e,n)}}function nA(e,n){return function(){return Ap(this,e,n.apply(this,arguments))}}function oA(e,n){return this.each((typeof n=="function"?nA:tA)(e,n))}function*iA(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var $p=[null];function St(e,n){this._groups=e,this._parents=n}function Ii(){return new St([[document.documentElement]],$p)}function aA(){return this}St.prototype=Ii.prototype={constructor:St,select:$S,selectAll:BS,selectChild:PS,selectChildren:HS,filter:jS,data:JS,enter:KS,exit:ZS,join:QS,merge:eR,selection:aA,order:tR,sort:nR,call:iR,nodes:aR,node:rR,size:lR,empty:sR,each:cR,attr:yR,style:kR,property:IR,classed:SR,text:TR,html:DR,raise:LR,lower:zR,append:FR,insert:HR,remove:KR,clone:qR,datum:WR,on:eA,dispatch:oA,[Symbol.iterator]:iA};function $n(e){return typeof e=="string"?new St([[document.querySelector(e)]],[document.documentElement]):new St([[e]],$p)}function rA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Tn(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 ds={capture:!0,passive:!1};function us(e){e.preventDefault(),e.stopImmediatePropagation()}function lA(e){var n=e.document.documentElement,o=$n(e).on("dragstart.drag",us,ds);"onselectstart"in n?o.on("selectstart.drag",us,ds):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function sA(e,n){var o=e.document.documentElement,i=$n(e).on("dragstart.drag",null);n&&(i.on("click.drag",us,ds),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 ms(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Tp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function vi(){}var Ci=.7,ar=1/Ci,Lo="\\s*([+-]?\\d+)\\s*",xi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",cA=/^#([0-9a-f]{3,8})$/,dA=new RegExp(`^rgb\\(${Lo},${Lo},${Lo}\\)$`),uA=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),mA=new RegExp(`^rgba\\(${Lo},${Lo},${Lo},${xi}\\)$`),fA=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${xi}\\)$`),pA=new RegExp(`^hsl\\(${xi},${Zt},${Zt}\\)$`),hA=new RegExp(`^hsla\\(${xi},${Zt},${Zt},${xi}\\)$`),Mp={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};ms(vi,Si,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vp,formatHex:Vp,formatHex8:yA,formatHsl:gA,formatRgb:Bp,toString:Bp});function Vp(){return this.rgb().formatHex()}function yA(){return this.rgb().formatHex8()}function gA(){return zp(this).formatHsl()}function Bp(){return this.rgb().formatRgb()}function Si(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=cA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Dp(n):o===3?new It(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?rr(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?rr(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=dA.exec(e))?new It(n[1],n[2],n[3],1):(n=uA.exec(e))?new It(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=mA.exec(e))?rr(n[1],n[2],n[3],n[4]):(n=fA.exec(e))?rr(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=pA.exec(e))?Pp(n[1],n[2]/100,n[3]/100,1):(n=hA.exec(e))?Pp(n[1],n[2]/100,n[3]/100,n[4]):Mp.hasOwnProperty(e)?Dp(Mp[e]):e==="transparent"?new It(NaN,NaN,NaN,0):null}function Dp(e){return new It(e>>16&255,e>>8&255,e&255,1)}function rr(e,n,o,i){return i<=0&&(e=n=o=NaN),new It(e,n,o,i)}function bA(e){return e instanceof vi||(e=Si(e)),e?(e=e.rgb(),new It(e.r,e.g,e.b,e.opacity)):new It}function fs(e,n,o,i){return arguments.length===1?bA(e):new It(e,n,o,i??1)}function It(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}ms(It,fs,Tp(vi,{brighter(e){return e=e==null?ar:Math.pow(ar,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new It(ao(this.r),ao(this.g),ao(this.b),lr(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:Op,formatHex:Op,formatHex8:_A,formatRgb:Lp,toString:Lp}));function Op(){return`#${ro(this.r)}${ro(this.g)}${ro(this.b)}`}function _A(){return`#${ro(this.r)}${ro(this.g)}${ro(this.b)}${ro((isNaN(this.opacity)?1:this.opacity)*255)}`}function Lp(){const e=lr(this.opacity);return`${e===1?"rgb(":"rgba("}${ao(this.r)}, ${ao(this.g)}, ${ao(this.b)}${e===1?")":`, ${e})`}`}function lr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ao(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ro(e){return e=ao(e),(e<16?"0":"")+e.toString(16)}function Pp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Lt(e,n,o,i)}function zp(e){if(e instanceof Lt)return new Lt(e.h,e.s,e.l,e.opacity);if(e instanceof vi||(e=Si(e)),!e)return new Lt;if(e instanceof Lt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Lt(l,s,c,e.opacity)}function kA(e,n,o,i){return arguments.length===1?zp(e):new Lt(e,n,o,i??1)}function Lt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}ms(Lt,kA,Tp(vi,{brighter(e){return e=e==null?ar:Math.pow(ar,e),new Lt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,e),new Lt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new It(ps(e>=240?e-240:e+120,a,i),ps(e,a,i),ps(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Lt(Fp(this.h),sr(this.s),sr(this.l),lr(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=lr(this.opacity);return`${e===1?"hsl(":"hsla("}${Fp(this.h)}, ${sr(this.s)*100}%, ${sr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Fp(e){return e=(e||0)%360,e<0?e+360:e}function sr(e){return Math.max(0,Math.min(1,e||0))}function ps(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 Up=e=>()=>e;function EA(e,n){return function(o){return e+o*n}}function NA(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 wA(e){return(e=+e)==1?Hp:function(n,o){return o-n?NA(n,o,e):Up(isNaN(n)?o:n)}}function Hp(e,n){var o=n-e;return o?EA(e,o):Up(isNaN(e)?n:e)}const jp=(function e(n){var o=wA(n);function i(a,r){var l=o((a=fs(a)).r,(r=fs(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Hp(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 Mn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var hs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ys=new RegExp(hs.source,"g");function IA(e){return function(){return e}}function vA(e){return function(n){return e(n)+""}}function CA(e,n){var o=hs.lastIndex=ys.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=hs.exec(e))&&(a=ys.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:Mn(i,a)})),o=ys.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?vA(c[0].x):IA(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 Kp=180/Math.PI,gs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Gp(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)*Kp,skewX:Math.atan(c)*Kp,scaleX:l,scaleY:s}}var cr;function xA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?gs:Gp(n.a,n.b,n.c,n.d,n.e,n.f)}function SA(e){return e==null||(cr||(cr=document.createElementNS("http://www.w3.org/2000/svg","g")),cr.setAttribute("transform",e),!(e=cr.transform.baseVal.consolidate()))?gs:(e=e.matrix,Gp(e.a,e.b,e.c,e.d,e.e,e.f))}function Yp(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,f,y){if(d!==m||u!==h){var g=f.push("translate(",null,n,null,o);y.push({i:g-4,x:Mn(d,m)},{i:g-2,x:Mn(u,h)})}else(m||h)&&f.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Mn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Mn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,f,y){if(d!==m||u!==h){var g=f.push(a(f)+"scale(",null,",",null,")");y.push({i:g-4,x:Mn(d,m)},{i:g-2,x:Mn(u,h)})}else(m!==1||h!==1)&&f.push(a(f)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(f){for(var y=-1,g=h.length,_;++y<g;)m[(_=h[y]).i]=_.x(f);return m.join("")}}}var RA=Yp(xA,"px, ","px)","deg)"),AA=Yp(SA,", ",")",")"),$A=1e-12;function qp(e){return((e=Math.exp(e))+1/e)/2}function TA(e){return((e=Math.exp(e))-1/e)/2}function MA(e){return((e=Math.exp(2*e))-1)/(e+1)}const VA=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],f=u-s,y=m-c,g=f*f+y*y,_,E;if(g<$A)E=Math.log(h/d)/n,_=function($){return[s+$*f,c+$*y,d*Math.exp(n*$*E)]};else{var N=Math.sqrt(g),p=(h*h-d*d+i*g)/(2*d*o*N),k=(h*h-d*d-i*g)/(2*h*o*N),I=Math.log(Math.sqrt(p*p+1)-p),A=Math.log(Math.sqrt(k*k+1)-k);E=(A-I)/n,_=function($){var L=$*E,V=qp(I),S=d/(o*N)*(V*MA(n*L+I)-TA(I));return[s+S*f,c+S*y,d*V/qp(n*L+I)]}}return _.duration=E*1e3*n/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Po=0,Ri=0,Ai=0,Wp=1e3,dr,$i,ur=0,lo=0,mr=0,Ti=typeof performance=="object"&&performance.now?performance:Date,Jp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function bs(){return lo||(Jp(BA),lo=Ti.now()+mr)}function BA(){lo=0}function fr(){this._call=this._time=this._next=null}fr.prototype=Xp.prototype={constructor:fr,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&&$i!==this&&($i?$i._next=this:dr=this,$i=this),this._call=e,this._time=o,_s()},stop:function(){this._call&&(this._call=null,this._time=1/0,_s())}};function Xp(e,n,o){var i=new fr;return i.restart(e,n,o),i}function DA(){bs(),++Po;for(var e=dr,n;e;)(n=lo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Po}function Zp(){lo=(ur=Ti.now())+mr,Po=Ri=0;try{DA()}finally{Po=0,LA(),lo=0}}function OA(){var e=Ti.now(),n=e-ur;n>Wp&&(mr-=n,ur=e)}function LA(){for(var e,n=dr,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:dr=o);$i=e,_s(i)}function _s(e){if(!Po){Ri&&(Ri=clearTimeout(Ri));var n=e-lo;n>24?(e<1/0&&(Ri=setTimeout(Zp,e-Ti.now()-mr)),Ai&&(Ai=clearInterval(Ai))):(Ai||(ur=Ti.now(),Ai=setInterval(OA,Wp)),Po=1,Jp(Zp))}}function Qp(e,n,o){var i=new fr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var PA=rs("start","end","cancel","interrupt"),zA=[],eh=0,th=1,ks=2,pr=3,nh=4,Es=5,hr=6;function yr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;FA(e,o,{name:n,index:i,group:a,on:PA,tween:zA,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:eh})}function Ns(e,n){var o=Pt(e,n);if(o.state>eh)throw new Error("too late; already scheduled");return o}function Qt(e,n){var o=Pt(e,n);if(o.state>pr)throw new Error("too late; already running");return o}function Pt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function FA(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Xp(r,0,o.time);function r(d){o.state=th,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,f;if(o.state!==th)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===pr)return Qp(l);f.state===nh?(f.state=hr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=hr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Qp(function(){o.state===pr&&(o.state=nh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ks,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ks){for(o.state=pr,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Es,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Es&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=hr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function gr(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>ks&&i.state<Es,i.state=hr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function UA(e){return this.each(function(){gr(this,e)})}function HA(e,n){var o,i;return function(){var a=Qt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function jA(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Qt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function KA(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Pt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?HA:jA)(o,e,n))}function ws(e,n,o){var i=e._id;return e.each(function(){var a=Qt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Pt(a,i).value[n]}}function oh(e,n){var o;return(typeof n=="number"?Mn:n instanceof Si?jp:(o=Si(n))?(n=o,jp):CA)(e,n)}function GA(e){return function(){this.removeAttribute(e)}}function YA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qA(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 WA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function JA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function XA(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 ZA(e,n){var o=or(e),i=o==="transform"?AA:oh;return this.attrTween(e,typeof n=="function"?(o.local?XA:JA)(o,i,ws(this,"attr."+e,n)):n==null?(o.local?YA:GA)(o):(o.local?WA:qA)(o,i,n))}function QA(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function e$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function t$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&e$(e,r)),o}return a._value=n,a}function n$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&QA(e,r)),o}return a._value=n,a}function o$(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=or(e);return this.tween(o,(i.local?t$:n$)(i,n))}function i$(e,n){return function(){Ns(this,e).delay=+n.apply(this,arguments)}}function a$(e,n){return n=+n,function(){Ns(this,e).delay=n}}function r$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?i$:a$)(n,e)):Pt(this.node(),n).delay}function l$(e,n){return function(){Qt(this,e).duration=+n.apply(this,arguments)}}function s$(e,n){return n=+n,function(){Qt(this,e).duration=n}}function c$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?l$:s$)(n,e)):Pt(this.node(),n).duration}function d$(e,n){if(typeof n!="function")throw new Error;return function(){Qt(this,e).ease=n}}function u$(e){var n=this._id;return arguments.length?this.each(d$(n,e)):Pt(this.node(),n).ease}function m$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Qt(this,e).ease=o}}function f$(e){if(typeof e!="function")throw new Error;return this.each(m$(this._id,e))}function p$(e){typeof e!="function"&&(e=Np(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new hn(i,this._parents,this._name,this._id)}function h$(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,f=0;f<u;++f)(h=c[f]||d[f])&&(m[f]=h);for(;s<i;++s)l[s]=n[s];return new hn(l,this._parents,this._name,this._id)}function y$(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 g$(e,n,o){var i,a,r=y$(n)?Ns:Qt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function b$(e,n){var o=this._id;return arguments.length<2?Pt(this.node(),o).on.on(e):this.each(g$(o,e,n))}function _$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function k$(){return this.on("end.remove",_$(this._id))}function E$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ss(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,yr(d[h],n,o,h,d,Pt(u,o)));return new hn(r,this._parents,n,o)}function N$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Ep(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),f,y=Pt(u,o),g=0,_=h.length;g<_;++g)(f=h[g])&&yr(f,n,o,g,h,y);r.push(h),l.push(u)}return new hn(r,l,n,o)}var w$=Ii.prototype.constructor;function I$(){return new w$(this._groups,this._parents)}function v$(e,n){var o,i,a;return function(){var r=Oo(this,e),l=(this.style.removeProperty(e),Oo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function ih(e){return function(){this.style.removeProperty(e)}}function C$(e,n,o){var i,a=o+"",r;return function(){var l=Oo(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=Oo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Oo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function S$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Qt(this,e),d=c.on,u=c.value[r]==null?s||(s=ih(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function R$(e,n,o){var i=(e+="")=="transform"?RA:oh;return n==null?this.styleTween(e,v$(e,i)).on("end.style."+e,ih(e)):typeof n=="function"?this.styleTween(e,x$(e,i,ws(this,"style."+e,n))).each(S$(this._id,e)):this.styleTween(e,C$(e,i,n),o).on("end.style."+e,null)}function A$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function $$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&A$(e,l,o)),i}return r._value=n,r}function T$(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,$$(e,n,o??""))}function M$(e){return function(){this.textContent=e}}function V$(e){return function(){var n=e(this);this.textContent=n??""}}function B$(e){return this.tween("text",typeof e=="function"?V$(ws(this,"text",e)):M$(e==null?"":e+""))}function D$(e){return function(n){this.textContent=e.call(this,n)}}function O$(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&D$(a)),n}return i._value=e,i}function L$(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,O$(e))}function P$(){for(var e=this._name,n=this._id,o=ah(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Pt(c,n);yr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new hn(i,this._parents,e,o)}function z$(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Qt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var F$=0;function hn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function ah(){return++F$}var yn=Ii.prototype;hn.prototype={constructor:hn,select:E$,selectAll:N$,selectChild:yn.selectChild,selectChildren:yn.selectChildren,filter:p$,merge:h$,selection:I$,transition:P$,call:yn.call,nodes:yn.nodes,node:yn.node,size:yn.size,empty:yn.empty,each:yn.each,on:b$,attr:ZA,attrTween:o$,style:R$,styleTween:T$,text:B$,textTween:L$,remove:k$,tween:KA,delay:r$,duration:c$,ease:u$,easeVarying:f$,end:z$,[Symbol.iterator]:yn[Symbol.iterator]};function U$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var H$={time:null,delay:0,duration:250,ease:U$};function j$(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 K$(e){var n,o;e instanceof hn?(n=e._id,e=e._name):(n=ah(),(o=H$).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])&&yr(c,e,n,d,l,o||j$(c,n));return new hn(i,this._parents,e,n)}Ii.prototype.interrupt=UA,Ii.prototype.transition=K$;const br=e=>()=>e;function G$(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function gn(e,n,o){this.k=e,this.x=n,this.y=o}gn.prototype={constructor:gn,scale:function(e){return e===1?this:new gn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new gn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Is=new gn(1,0,0);gn.prototype;function vs(e){e.stopImmediatePropagation()}function Mi(e){e.preventDefault(),e.stopImmediatePropagation()}function Y$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function q$(){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 rh(){return this.__zoom||Is}function W$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function J$(){return navigator.maxTouchPoints||"ontouchstart"in this}function X$(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 Z$(){var e=Y$,n=q$,o=X$,i=W$,a=J$,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=VA,d=rs("start","zoom","end"),u,m,h,f=500,y=150,g=0,_=10;function E(b){b.property("__zoom",rh).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",x).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(b,w,v,O){var M=b.selection?b.selection():b;M.property("__zoom",rh),b!==M?I(b,w,v,O):M.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},E.scaleBy=function(b,w,v,O){E.scaleTo(b,function(){var M=this.__zoom.k,z=typeof w=="function"?w.apply(this,arguments):w;return M*z},v,O)},E.scaleTo=function(b,w,v,O){E.transform(b,function(){var M=n.apply(this,arguments),z=this.__zoom,j=v==null?k(M):typeof v=="function"?v.apply(this,arguments):v,ie=z.invert(j),pe=typeof w=="function"?w.apply(this,arguments):w;return o(p(N(z,pe),j,ie),M,l)},v,O)},E.translateBy=function(b,w,v,O){E.transform(b,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,O)},E.translateTo=function(b,w,v,O,M){E.transform(b,function(){var z=n.apply(this,arguments),j=this.__zoom,ie=O==null?k(z):typeof O=="function"?O.apply(this,arguments):O;return o(Is.translate(ie[0],ie[1]).scale(j.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),z,l)},O,M)};function N(b,w){return w=Math.max(r[0],Math.min(r[1],w)),w===b.k?b:new gn(w,b.x,b.y)}function p(b,w,v){var O=w[0]-v[0]*b.k,M=w[1]-v[1]*b.k;return O===b.x&&M===b.y?b:new gn(b.k,O,M)}function k(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function I(b,w,v,O){b.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var M=this,z=arguments,j=A(M,z).event(O),ie=n.apply(M,z),pe=v==null?k(ie):typeof v=="function"?v.apply(M,z):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=M.__zoom,me=typeof w=="function"?w.apply(M,z):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new gn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}j.zoom(null,ke)}})}function A(b,w,v){return!v&&b.__zooming||new $(b,w)}function $(b,w){this.that=b,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(b,w),this.taps=0}$.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,w){return this.mouse&&b!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var w=$n(this.that).datum();d.call(b,this.that,new G$(b,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),w)}};function L(b,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(b),O=this.__zoom,M=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),z=Tn(b);if(v.wheel)(v.mouse[0][0]!==z[0]||v.mouse[0][1]!==z[1])&&(v.mouse[1]=O.invert(v.mouse[0]=z)),clearTimeout(v.wheel);else{if(O.k===M)return;v.mouse=[z,O.invert(z)],gr(this),v.start()}Mi(b),v.wheel=setTimeout(j,y),v.zoom("mouse",o(p(N(O,M),v.mouse[0],v.mouse[1]),v.extent,l));function j(){v.wheel=null,v.end()}}function V(b,...w){if(h||!e.apply(this,arguments))return;var v=b.currentTarget,O=A(this,w,!0).event(b),M=$n(b.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),z=Tn(b,v),j=b.clientX,ie=b.clientY;lA(b.view),vs(b),O.mouse=[z,this.__zoom.invert(z)],gr(this),O.start();function pe(ge){if(Mi(ge),!O.moved){var me=ge.clientX-j,se=ge.clientY-ie;O.moved=me*me+se*se>g}O.event(ge).zoom("mouse",o(p(O.that.__zoom,O.mouse[0]=Tn(ge,v),O.mouse[1]),O.extent,l))}function ye(ge){M.on("mousemove.zoom mouseup.zoom",null),sA(ge.view,O.moved),Mi(ge),O.event(ge).end()}}function S(b,...w){if(e.apply(this,arguments)){var v=this.__zoom,O=Tn(b.changedTouches?b.changedTouches[0]:b,this),M=v.invert(O),z=v.k*(b.shiftKey?.5:2),j=o(p(N(v,z),O,M),n.apply(this,w),l);Mi(b),s>0?$n(this).transition().duration(s).call(I,j,O,b):$n(this).call(E.transform,j,O,b)}}function x(b,...w){if(e.apply(this,arguments)){var v=b.touches,O=v.length,M=A(this,w,b.changedTouches.length===O).event(b),z,j,ie,pe;for(vs(b),j=0;j<O;++j)ie=v[j],pe=Tn(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],M.touch0?!M.touch1&&M.touch0[2]!==pe[2]&&(M.touch1=pe,M.taps=0):(M.touch0=pe,z=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),z&&(M.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),gr(this),M.start())}}function T(b,...w){if(this.__zooming){var v=A(this,w).event(b),O=b.changedTouches,M=O.length,z,j,ie,pe;for(Mi(b),z=0;z<M;++z)j=O[z],ie=Tn(j,this),v.touch0&&v.touch0[2]===j.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===j.identifier&&(v.touch1[0]=ie);if(j=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;j=N(j,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(p(j,ie,pe),v.extent,l))}}function D(b,...w){if(this.__zooming){var v=A(this,w).event(b),O=b.changedTouches,M=O.length,z,j;for(vs(b),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),z=0;z<M;++z)j=O[z],v.touch0&&v.touch0[2]===j.identifier?delete v.touch0:v.touch1&&v.touch1[2]===j.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(j=Tn(j,this),Math.hypot(m[0]-j[0],m[1]-j[1])<_)){var ie=$n(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return E.wheelDelta=function(b){return arguments.length?(i=typeof b=="function"?b:br(+b),E):i},E.filter=function(b){return arguments.length?(e=typeof b=="function"?b:br(!!b),E):e},E.touchable=function(b){return arguments.length?(a=typeof b=="function"?b:br(!!b),E):a},E.extent=function(b){return arguments.length?(n=typeof b=="function"?b:br([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),E):n},E.scaleExtent=function(b){return arguments.length?(r[0]=+b[0],r[1]=+b[1],E):[r[0],r[1]]},E.translateExtent=function(b){return arguments.length?(l[0][0]=+b[0][0],l[1][0]=+b[1][0],l[0][1]=+b[0][1],l[1][1]=+b[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(b){return arguments.length?(o=b,E):o},E.duration=function(b){return arguments.length?(s=+b,E):s},E.interpolate=function(b){return arguments.length?(c=b,E):c},E.on=function(){var b=d.on.apply(d,arguments);return b===d?E:b},E.clickDistance=function(b){return arguments.length?(g=(b=+b)*b,E):Math.sqrt(g)},E.tapDistance=function(b){return arguments.length?(_=+b,E):_},E}const lh=Symbol("MiniMapSlots"),Q$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],eT={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},tT=t.defineComponent({...eT,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(lh),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,h)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,Q$))],64)):t.createCommentVNode("",!0)}}),nT=["width","height","viewBox","aria-labelledby"],oT=["id"],iT=["d","fill","stroke","stroke-width"],aT={name:"MiniMap",compatConfig:{MODE:3}},rT=t.defineComponent({...aT,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:h,d3Zoom:f,getNodesInitialized:y}=je(),g=t.ref();t.provide(lh,o);const _=t.toRef(()=>{var M;return e.width??((M=i.style)==null?void 0:M.width)??a}),E=t.toRef(()=>{var M;return e.height??((M=i.style)==null?void 0:M.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",p=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),k=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),I=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=t.computed(()=>Pl(y.value.filter(M=>!M.hidden))),$=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),L=t.computed(()=>y.value&&y.value.length?C0(A.value,$.value):$.value),V=t.computed(()=>{const M=L.value.width/_.value,z=L.value.height/E.value;return Math.max(M,z)}),S=t.computed(()=>{const M=V.value*_.value,z=V.value*E.value,j=e.offsetScale*V.value;return{offset:j,x:L.value.x-(M-L.value.width)/2-j,y:L.value.y-(z-L.value.height)/2-j,width:M+j*2,height:z+j*2}}),x=t.computed(()=>!S.value.x||!S.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 ft extends Error{constructor(n,...o){var i;super((i=jm[n])==null?void 0:i.call(jm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Yl(e){return"clientX"in e}function L0(e){return"sourceEvent"in e}function Xt(e,n){const o=Yl(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}}const wi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function P0(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function za(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const z0=()=>!0;function ql(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function F0(e,n,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of n.values())Da(a,Ba(r))>0&&i.push(r);return i}const U0=250;function H0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=F0(e,o,n+U0);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:h,y:f}=Do(d,m,m.position,!0),y=Math.sqrt((h-e.x)**2+(f-e.y)**2);y>n||(y<s?(l=[{...m,x:h,y:f}],s=y):y===s&&l.push({...m,x:h,y:f}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function Km(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=z0},u,m,h,f){const y=r==="target",k=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:_,y:E}=Xt(e),N=l.elementFromPoint(_,E),p=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:k,b={handleDomNode:p,isValid:!1,connection:null,toHandle:null};if(p){const w=Gm(void 0,p),A=p.getAttribute("data-nodeid"),$=p.getAttribute("data-handleid"),L=p.classList.contains("connectable"),T=p.classList.contains("connectableend");if(!A||!w)return b;const S={source:y?A:i,sourceHandle:y?$:a,target:y?i:A,targetHandle:y?a:$};b.connection=S;const M=L&&T&&(o===un.Strict?y&&w==="source"||!y&&w==="target":A!==i||$!==a);b.isValid=M&&d(S,{nodes:m,edges:u,sourceNode:h(S.source),targetNode:h(S.target)}),b.toHandle=Ym(A,w,$,f,o,!0)}return b}function Gm(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function j0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function K0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Ym(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===un.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(h=>h.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...Do(d,m,m.position,!0)}:m}const Wl={[Me.Left]:Me.Right,[Me.Right]:Me.Left,[Me.Top]:Me.Bottom,[Me.Bottom]:Me.Top},G0=["production","prod"];function Ii(e,...n){qm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function qm(){return!G0.includes(process.env.NODE_ENV||"")}function Wm(e,n,o,i,a){const r=n.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Oa(l)}}):null}function Jl(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ut(e){return typeof t.unref(e)<"u"}function Y0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ft(dt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return An(e)?a=e:a={...e,id:Sm(e)},a=Cm(a,void 0,i),x0(a,n)?!1:a}function q0(e,n,o,i,a){if(!n.source||!n.target)return a(new ft(dt.EDGE_INVALID,e.id)),!1;if(!o)return a(new ft(dt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Sm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Jm(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Qn(l)){o(new ft(dt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=I0(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new ft(dt.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Xm(e,n,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,n)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,n)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,n))}}function Xl(e,n,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;Xm("source",c,u,e,a,l),Xm("target",c,d,e,r,s)}}function Zm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Zl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=An(d)?d:Y0(d,s,a,r);if(!u)continue;const m=o(u.source),h=o(u.target);if(!m||!h){a(new ft(dt.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ft(dt.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new ft(dt.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:h})){a(new ft(dt.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...Cm(u,f,r),sourceNode:m,targetNode:h})}return c}const Qm=Symbol("vueFlow"),ef=Symbol("nodeId"),tf=Symbol("nodeRef"),W0=Symbol("edgeId"),J0=Symbol("edgeRef"),Fa=Symbol("slots");function nf(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:h,findNode:f,multiSelectionActive:y,nodesSelectionActive:k,selectNodesOnDrag:_,removeSelectedElements:E,addSelectedNodes:N,updateNodePositions:p,emits:b}=qe(),{onStart:w,onDrag:A,onStop:$,onClick:L,el:T,disabled:S,id:C,selectable:M,dragHandle:B}=e,g=t.shallowRef(!1);let I=[],v,O=null,x={x:void 0,y:void 0},z={x:0,y:0},j=null,ne=!1,de=!1,pe=0,he=!1;const fe=Q0(),ye=({x:se,y:ue})=>{x={x:se,y:ue};let U=!1;if(I=I.map(F=>{const H={x:se-F.distance.x,y:ue-F.distance.y},{computedPosition:Z}=Gl(F,o.value?za(H,i.value):H,b.error,l.value,F.parentNode?f(F.parentNode):void 0);return U=U||F.position.x!==Z.x||F.position.y!==Z.y,F.position=Z,F}),de=de||U,!!U&&(p(I,!0,!0),g.value=!0,j)){const[F,H]=Kl({id:C,dragItems:I,findNode:f});A({event:j,node:F,nodes:H})}},_e=()=>{if(!O)return;const[se,ue]=Bm(z,O,u.value);if(se!==0||ue!==0){const U={x:(x.x??0)-se/c.value.zoom,y:(x.y??0)-ue/c.value.zoom};h({x:se,y:ue})&&ye(U)}pe=requestAnimationFrame(_e)},Re=(se,ue)=>{ne=!0;const U=f(C);!_.value&&!y.value&&U&&(U.selected||E()),U&&t.toValue(M)&&_.value&&Jl(U,y.value,N,E,k,!1,ue);const F=fe(se.sourceEvent);if(x=F,I=T0(r.value,m.value,F,C),I.length){const[H,Z]=Kl({id:C,dragItems:I,findNode:f});w({event:se.sourceEvent,node:H,nodes:Z})}},ce=(se,ue)=>{var U;se.sourceEvent.type==="touchmove"&&se.sourceEvent.touches.length>1||(de=!1,s.value===0&&Re(se,ue),x=fe(se.sourceEvent),O=((U=n.value)==null?void 0:U.getBoundingClientRect())||null,z=Xt(se.sourceEvent,O))},le=(se,ue)=>{const U=fe(se.sourceEvent);if(!he&&ne&&d.value&&(he=!0,_e()),!ne){const F=U.xSnapped-(x.x??0),H=U.ySnapped-(x.y??0);Math.sqrt(F*F+H*H)>s.value&&Re(se,ue)}(x.x!==U.xSnapped||x.y!==U.ySnapped)&&I.length&&ne&&(j=se.sourceEvent,z=Xt(se.sourceEvent,O),ye(U))},ae=se=>{let ue=!1;if(!ne&&!g.value&&!y.value){const U=se.sourceEvent,F=fe(U),H=F.xSnapped-(x.x??0),Z=F.ySnapped-(x.y??0),X=Math.sqrt(H*H+Z*Z);X!==0&&X<=s.value&&(L==null||L(U),ue=!0)}if(I.length&&!ue){de&&(p(I,!1,!1),de=!1);const[U,F]=Kl({id:C,dragItems:I,findNode:f});$({event:se.sourceEvent,node:U,nodes:F})}I=[],g.value=!1,he=!1,ne=!1,x={x:void 0,y:void 0},cancelAnimationFrame(pe)};return t.watch([()=>t.toValue(S),T],([se,ue],U,F)=>{if(ue){const H=Mt(ue);se||(v=wE().on("start",Z=>ce(Z,ue)).on("drag",Z=>le(Z,ue)).on("end",Z=>ae(Z)).filter(Z=>{const X=Z.target,Ne=t.toValue(B);return!Z.button&&(!a.value||!Fm(X,`.${a.value}`,ue)&&(!Ne||Fm(X,Ne,ue)))}),H.call(v)),F(()=>{H.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),g}function X0(){return{doubleClick:Ae(),click:Ae(),mouseEnter:Ae(),mouseMove:Ae(),mouseLeave:Ae(),contextMenu:Ae(),updateStart:Ae(),update:Ae(),updateEnd:Ae()}}function Z0(e,n){const o=X0();return o.doubleClick.on(i=>{var a,r;n.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;n.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;n.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;n.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function Q0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=qe();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=L0(a)?a.sourceEvent:a,{x:c,y:d}=Xt(s,l),u=Ei({x:c,y:d},e.value),{x:m,y:h}=o.value?za(u,n.value):u;return{xSnapped:m,ySnapped:h,...u}}}function Ua(){return!0}function of({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:h,nodesConnectable:f,autoPanOnConnect:y,autoPanSpeed:k,findNode:_,panBy:E,startConnection:N,updateConnection:p,endConnection:b,emits:w,viewport:A,edges:$,nodes:L,isValidConnection:T,nodeLookup:S}=qe();let C=null,M=!1,B=null;function g(v){var O;const x=t.toValue(o)==="target",z=Yl(v),j=vm(v.target),ne=v.currentTarget;if(ne&&(z&&v.button===0||!z)){let de=function(ve){U=Xt(ve,ae),ye=H0(Ei(U,A.value,!1,[1,1]),u.value,S.value,Z),F||(H(),F=!0);const G=Km(ve,{handle:ye,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:x?"target":"source",isValidConnection:fe,doc:j,lib:"vue",flowId:s,nodeLookup:S.value},$.value,L.value,_,S.value);B=G.handleDomNode,C=G.connection,M=K0(!!ye,G.isValid);const q={...Se,isValid:M,to:G.toHandle&&M?ki({x:G.toHandle.x,y:G.toHandle.y},A.value):U,toHandle:G.toHandle,toPosition:M&&G.toHandle?G.toHandle.position:Wl[Z.position],toNode:G.toHandle?S.value.get(G.toHandle.nodeId):null};if(M&&ye&&(Se!=null&&Se.toHandle)&&q.toHandle&&Se.toHandle.type===q.toHandle.type&&Se.toHandle.nodeId===q.toHandle.nodeId&&Se.toHandle.id===q.toHandle.id&&Se.to.x===q.to.x&&Se.to.y===q.to.y)return;const Y=ye??G.toHandle;if(p(Y&&M?ki({x:Y.x,y:Y.y},A.value):U,Y,j0(!!Y,M)),Se=q,!ye&&!M&&!B)return ql(ue);C&&C.source!==C.target&&B&&(ql(ue),ue=B,B.classList.add("connecting","vue-flow__handle-connecting"),B.classList.toggle("valid",!!M),B.classList.toggle("vue-flow__handle-valid",!!M))},pe=function(ve){"touches"in ve&&ve.touches.length>0||((ye||B)&&C&&M&&(r?r(ve,C):w.connect(C)),w.connectEnd(ve),a&&(l==null||l(ve)),ql(ue),cancelAnimationFrame(_e),b(ve),F=!1,M=!1,C=null,B=null,j.removeEventListener("mousemove",de),j.removeEventListener("mouseup",pe),j.removeEventListener("touchmove",de),j.removeEventListener("touchend",pe))};const he=_(t.toValue(n));let fe=t.toValue(i)||T.value||Ua;!fe&&he&&(fe=(x?he.isValidSourcePos:he.isValidTargetPos)||Ua);let ye,_e=0;const{x:Re,y:ce}=Xt(v),le=Gm(t.toValue(a),ne),ae=(O=c.value)==null?void 0:O.getBoundingClientRect();if(!ae||!le)return;const se=Ym(t.toValue(n),le,t.toValue(e),S.value,d.value);if(!se)return;let ue,U=Xt(v,ae),F=!1;const H=()=>{if(!y.value)return;const[ve,G]=Bm(U,ae,k.value);E({x:ve,y:G}),_e=requestAnimationFrame(H)},Z={...se,nodeId:t.toValue(n),type:le,position:se.position},X=S.value.get(t.toValue(n)),me={inProgress:!0,isValid:null,from:Do(X,Z,Me.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:X,to:U,toHandle:null,toPosition:Wl[Z.position],toNode:null};N({nodeId:t.toValue(n),id:t.toValue(e),type:le,position:(ne==null?void 0:ne.getAttribute("data-handlepos"))||Me.Top,...U},{x:Re-ae.left,y:ce-ae.top}),w.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:le});let Se=me;j.addEventListener("mousemove",de),j.addEventListener("mouseup",pe),j.addEventListener("touchmove",de),j.addEventListener("touchend",pe)}}function I(v){var O,x;if(!m.value)return;const z=t.toValue(o)==="target";if(!h.value){w.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),N({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Me.Top,...Xt(v)},void 0,!0);return}let j=t.toValue(i)||T.value||Ua;const ne=_(t.toValue(n));if(!j&&ne&&(j=(z?ne.isValidSourcePos:ne.isValidTargetPos)||Ua),ne&&(typeof ne.connectable>"u"?f.value:ne.connectable)===!1)return;const de=vm(v.target),pe=Km(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Me.Top,...Xt(v)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:j,doc:de,lib:"vue",flowId:s,nodeLookup:S.value},$.value,L.value,_,S.value),he=((O=pe.connection)==null?void 0:O.source)===((x=pe.connection)==null?void 0:x.target);pe.isValid&&pe.connection&&!he&&w.connect(pe.connection),w.clickConnectEnd(v),b(v,!0)}return{handlePointerDown:g,handleClick:I}}function eN(){return t.inject(ef,"")}function af(e){const n=e??eN()??"",o=t.inject(tf,t.ref(null)),{findNode:i,edges:a,emits:r}=qe(),l=i(n);return l||r.error(new ft(dt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>eo([l],a.value))}}function tN(){return{doubleClick:Ae(),click:Ae(),mouseEnter:Ae(),mouseMove:Ae(),mouseLeave:Ae(),contextMenu:Ae(),dragStart:Ae(),drag:Ae(),dragStop:Ae()}}function nN(e,n){const o=tN();return o.doubleClick.on(i=>{var a,r;n.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;n.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;n.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;n.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function rf(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=qe();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,h=d?4:1,f=c.x*u*h,y=c.y*m*h,k=[];for(const _ of e.value)if(_.draggable||l&&typeof _.draggable>"u"){const E={x:_.computedPosition.x+f,y:_.computedPosition.y+y},{position:N}=Gl(_,E,s.error,n.value,_.parentNode?i(_.parentNode):void 0);k.push({id:_.id,position:N,from:_.position,distance:{x:c.x,y:c.y},dimensions:_.dimensions})}o(k,!0,!1)}}const Ha=.1,oN=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Mn(){return Ii("Viewport not initialized yet."),Promise.resolve(!1)}const iN={zoomIn:Mn,zoomOut:Mn,zoomTo:Mn,fitView:Mn,setCenter:Mn,fitBounds:Mn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Mn,setTransform:Mn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function aN(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ui:va).scaleBy(Ql(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=Im({x:-i,y:-a},e.translateExtent),m=Mo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?ui:va).transform(Ql(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>n(1.2,a),zoomOut:a=>n(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?ui:va).scaleTo(Ql(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(a={padding:Ha,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!h.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const c=Ul(s),{x:d,y:u,zoom:m}=Tm(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ha);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:Ha})=>{const{x:l,y:s,zoom:c}=Tm(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Ha);return o(l,s,c,r)},project:a=>Ei(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return Ei(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return ki(s,e.viewport)}return{x:0,y:0}}}:iN)}function Ql(e,n=0,o=oN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function rN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let k,_,E=!!(o.nodes.value.length||o.edges.value.length);k=So([e.modelValue,()=>{var N,p;return(p=(N=e.modelValue)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setElements(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=So([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,p])=>{var b;(b=e.modelValue)!=null&&b.value&&Array.isArray(e.modelValue.value)&&(k==null||k.pause(),e.modelValue.value=[...N,...p],t.nextTick(()=>{k==null||k.resume()}))},{immediate:E}),t.onScopeDispose(()=>{k==null||k.stop(),_==null||_.stop()})})},r=()=>{i.run(()=>{let k,_,E=!!o.nodes.value.length;k=So([e.nodes,()=>{var N,p;return(p=(N=e.nodes)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setNodes(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=So([o.nodes,()=>o.nodes.value.length],([N])=>{var p;(p=e.nodes)!=null&&p.value&&Array.isArray(e.nodes.value)&&(k==null||k.pause(),e.nodes.value=[...N],t.nextTick(()=>{k==null||k.resume()}))},{immediate:E}),t.onScopeDispose(()=>{k==null||k.stop(),_==null||_.stop()})})},l=()=>{i.run(()=>{let k,_,E=!!o.edges.value.length;k=So([e.edges,()=>{var N,p;return(p=(N=e.edges)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setEdges(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=So([o.edges,()=>o.edges.value.length],([N])=>{var p;(p=e.edges)!=null&&p.value&&Array.isArray(e.edges.value)&&(k==null||k.pause(),e.edges.value=[...N],t.nextTick(()=>{k==null||k.resume()}))},{immediate:E}),t.onScopeDispose(()=>{k==null||k.stop(),_==null||_.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ut(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ut(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ut(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ut(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ut(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const k=async _=>{let E=_;typeof n.autoConnect=="function"&&(E=await n.autoConnect(_)),E!==!1&&o.addEdges([E])};t.watch(()=>n.autoConnect,()=>{ut(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(_,E,N)=>{_?o.onConnect(k):o.hooks.value.connect.off(k),N(()=>{o.hooks.value.connect.off(k)})},{immediate:!0})})},f=()=>{const k=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const _ of Object.keys(n)){const E=_;if(!k.includes(E)){const N=t.toRef(()=>n[E]),p=o[E];t.isRef(p)&&i.run(()=>{t.watch(N,b=>{ut(b)&&(p.value=b)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),h(),f()})()}),()=>i.stop()}function lN(){return{edgesChange:Ae(),nodesChange:Ae(),nodeDoubleClick:Ae(),nodeClick:Ae(),nodeMouseEnter:Ae(),nodeMouseMove:Ae(),nodeMouseLeave:Ae(),nodeContextMenu:Ae(),nodeDragStart:Ae(),nodeDrag:Ae(),nodeDragStop:Ae(),nodesInitialized:Ae(),miniMapNodeClick:Ae(),miniMapNodeDoubleClick:Ae(),miniMapNodeMouseEnter:Ae(),miniMapNodeMouseMove:Ae(),miniMapNodeMouseLeave:Ae(),connect:Ae(),connectStart:Ae(),connectEnd:Ae(),clickConnectStart:Ae(),clickConnectEnd:Ae(),paneReady:Ae(),init:Ae(),move:Ae(),moveStart:Ae(),moveEnd:Ae(),selectionDragStart:Ae(),selectionDrag:Ae(),selectionDragStop:Ae(),selectionContextMenu:Ae(),selectionStart:Ae(),selectionEnd:Ae(),viewportChangeStart:Ae(),viewportChange:Ae(),viewportChangeEnd:Ae(),paneScroll:Ae(),paneClick:Ae(),paneContextMenu:Ae(),paneMouseEnter:Ae(),paneMouseMove:Ae(),paneMouseLeave:Ae(),edgeContextMenu:Ae(),edgeMouseEnter:Ae(),edgeMouseMove:Ae(),edgeMouseLeave:Ae(),edgeDoubleClick:Ae(),edgeClick:Ae(),edgeUpdateStart:Ae(),edgeUpdate:Ae(),edgeUpdateEnd:Ae(),updateNodeInternals:Ae(),error:Ae(e=>Ii(e.message))}}function sN(e,n){const o=t.getCurrentInstance();t.onBeforeMount(()=>{for(const[a,r]of Object.entries(n.value)){const l=s=>{e(a,s)};r.setEmitter(l),ai(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),ai(r.removeHasEmitListeners)}});function i(a){var r;const l=cN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function cN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function lf(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Pl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:gi.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Xn.Bezier,style:{}},connectionMode:un.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:wi()?"Meta":"Control",zoomActivationKeyCode:wi()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:lN(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const dN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function uN(e,n,o){const i=aN(e),a=U=>{const F=U??[];e.hooks.updateNodeInternals.trigger(F)},r=U=>C0(U,e.nodes,e.edges),l=U=>v0(U,e.nodes,e.edges),s=U=>eo(U,e.edges),c=({id:U,type:F,nodeId:H})=>{var Z;const X=U?`-${F}-${U}`:`-${F}`;return Array.from(((Z=e.connectionLookup.get(`${H}${X}`))==null?void 0:Z.values())??[])},d=U=>{if(U)return n.value.get(U)},u=U=>{if(U)return o.value.get(U)},m=(U,F,H)=>{var Z,X;const Ne=[];for(const me of U){const Se={id:me.id,type:"position",dragging:H,from:me.from};if(F&&(Se.position=me.position,me.parentNode)){const ve=d(me.parentNode);Se.position={x:Se.position.x-(((Z=ve==null?void 0:ve.computedPosition)==null?void 0:Z.x)??0),y:Se.position.y-(((X=ve==null?void 0:ve.computedPosition)==null?void 0:X.y)??0)}}Ne.push(Se)}Ne!=null&&Ne.length&&e.hooks.nodesChange.trigger(Ne)},h=U=>{if(!e.vueFlowRef)return;const F=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!F)return;const H=window.getComputedStyle(F),{m22:Z}=new window.DOMMatrixReadOnly(H.transform),X=[];for(const Ne of U){const me=Ne,Se=d(me.id);if(Se){const ve=Oa(me.nodeElement);if(!!(ve.width&&ve.height&&(Se.dimensions.width!==ve.width||Se.dimensions.height!==ve.height||me.forceUpdate))){const q=me.nodeElement.getBoundingClientRect();Se.dimensions=ve,Se.handleBounds.source=Wm("source",me.nodeElement,q,Z,Se.id),Se.handleBounds.target=Wm("target",me.nodeElement,q,Z,Se.id),X.push({id:Se.id,type:"dimensions",dimensions:ve})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),X.length&&e.hooks.nodesChange.trigger(X)},f=(U,F)=>{const H=new Set,Z=new Set;for(const me of U)Qn(me)?H.add(me.id):An(me)&&Z.add(me.id);const X=Tn(n.value,H,!0),Ne=Tn(o.value,Z);if(e.multiSelectionActive){for(const me of H)X.push($n(me,F));for(const me of Z)Ne.push($n(me,F))}X.length&&e.hooks.nodesChange.trigger(X),Ne.length&&e.hooks.edgesChange.trigger(Ne)},y=U=>{if(e.multiSelectionActive){const F=U.map(H=>$n(H.id,!0));e.hooks.nodesChange.trigger(F);return}e.hooks.nodesChange.trigger(Tn(n.value,new Set(U.map(F=>F.id)),!0)),e.hooks.edgesChange.trigger(Tn(o.value))},k=U=>{if(e.multiSelectionActive){const F=U.map(H=>$n(H.id,!0));e.hooks.edgesChange.trigger(F);return}e.hooks.edgesChange.trigger(Tn(o.value,new Set(U.map(F=>F.id)))),e.hooks.nodesChange.trigger(Tn(n.value,new Set,!0))},_=U=>{f(U,!0)},E=U=>{const H=(U||e.nodes).map(Z=>(Z.selected=!1,$n(Z.id,!1)));e.hooks.nodesChange.trigger(H)},N=U=>{const H=(U||e.edges).map(Z=>(Z.selected=!1,$n(Z.id,!1)));e.hooks.edgesChange.trigger(H)},p=U=>{if(!U||!U.length)return f([],!1);const F=U.reduce((H,Z)=>{const X=$n(Z.id,!1);return Qn(Z)?H.nodes.push(X):H.edges.push(X),H},{nodes:[],edges:[]});F.nodes.length&&e.hooks.nodesChange.trigger(F.nodes),F.edges.length&&e.hooks.edgesChange.trigger(F.edges)},b=U=>{var F;(F=e.d3Zoom)==null||F.scaleExtent([U,e.maxZoom]),e.minZoom=U},w=U=>{var F;(F=e.d3Zoom)==null||F.scaleExtent([e.minZoom,U]),e.maxZoom=U},A=U=>{var F;(F=e.d3Zoom)==null||F.translateExtent(U),e.translateExtent=U},$=U=>{e.nodeExtent=U,a()},L=U=>{var F;(F=e.d3Zoom)==null||F.clickDistance(U)},T=U=>{e.nodesDraggable=U,e.nodesConnectable=U,e.elementsSelectable=U},S=U=>{const F=U instanceof Function?U(e.nodes):U;!e.initialized&&!F.length||(e.nodes=Jm(F,d,e.hooks.error.trigger))},C=U=>{const F=U instanceof Function?U(e.edges):U;if(!e.initialized&&!F.length)return;const H=Zl(F,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Xl(e.connectionLookup,o.value,H),e.edges=H},M=U=>{const F=U instanceof Function?U([...e.nodes,...e.edges]):U;!e.initialized&&!F.length||(S(F.filter(Qn)),C(F.filter(An)))},B=U=>{let F=U instanceof Function?U(e.nodes):U;F=Array.isArray(F)?F:[F];const H=Jm(F,d,e.hooks.error.trigger),Z=[];for(const X of H)Z.push(Om(X));Z.length&&e.hooks.nodesChange.trigger(Z)},g=U=>{let F=U instanceof Function?U(e.edges):U;F=Array.isArray(F)?F:[F];const H=Zl(F,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Z=[];for(const X of H)Z.push(Om(X));Z.length&&e.hooks.edgesChange.trigger(Z)},I=(U,F=!0,H=!1)=>{const Z=U instanceof Function?U(e.nodes):U,X=Array.isArray(Z)?Z:[Z],Ne=[],me=[];function Se(G){const q=s(G);for(const Y of q)(!ut(Y.deletable)||Y.deletable)&&me.push(Pm(Y.id,Y.source,Y.target,Y.sourceHandle,Y.targetHandle))}function ve(G){const q=[];for(const Y of e.nodes)Y.parentNode===G&&q.push(Y);if(q.length){for(const Y of q)Ne.push(Lm(Y.id));F&&Se(q);for(const Y of q)ve(Y.id)}}for(const G of X){const q=typeof G=="string"?d(G):G;q&&(ut(q.deletable)&&!q.deletable||(Ne.push(Lm(q.id)),F&&Se([q]),H&&ve(q.id)))}me.length&&e.hooks.edgesChange.trigger(me),Ne.length&&e.hooks.nodesChange.trigger(Ne)},v=U=>{const F=U instanceof Function?U(e.edges):U,H=Array.isArray(F)?F:[F],Z=[];for(const X of H){const Ne=typeof X=="string"?u(X):X;Ne&&(ut(Ne.deletable)&&!Ne.deletable||Z.push(Pm(typeof X=="string"?X:X.id,Ne.source,Ne.target,Ne.sourceHandle,Ne.targetHandle)))}e.hooks.edgesChange.trigger(Z)},O=(U,F,H=!0)=>{const Z=u(U.id);if(!Z)return!1;const X=e.edges.indexOf(Z),Ne=q0(U,F,Z,H,e.hooks.error.trigger);if(Ne){const[me]=Zl([Ne],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Se,ve)=>ve===X?me:Se),Xl(e.connectionLookup,o.value,[me]),me}return!1},x=(U,F,H={replace:!1})=>{const Z=u(U);if(!Z)return;const X=typeof F=="function"?F(Z):F;Z.data=H.replace?X:{...Z.data,...X}},z=U=>Dm(U,e.nodes),j=U=>{const F=Dm(U,e.edges);return Xl(e.connectionLookup,o.value,F),F},ne=(U,F,H={replace:!1})=>{const Z=d(U);if(!Z)return;const X=typeof F=="function"?F(Z):F;H.replace?e.nodes.splice(e.nodes.indexOf(Z),1,X):Object.assign(Z,X)},de=(U,F,H={replace:!1})=>{const Z=d(U);if(!Z)return;const X=typeof F=="function"?F(Z):F;Z.data=H.replace?X:{...Z.data,...X}},pe=(U,F,H=!1)=>{H?e.connectionClickStartHandle=U:e.connectionStartHandle=U,e.connectionEndHandle=null,e.connectionStatus=null,F&&(e.connectionPosition=F)},he=(U,F=null,H=null)=>{e.connectionStartHandle&&(e.connectionPosition=U,e.connectionEndHandle=F,e.connectionStatus=H)},fe=(U,F)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,F?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ye=U=>{const F=w0(U),H=F?null:_i(U)?U:d(U.id);return!F&&!H?[null,null,F]:[F?U:Ba(H),H,F]},_e=(U,F=!0,H=e.nodes)=>{const[Z,X,Ne]=ye(U);if(!Z)return[];const me=[];for(const Se of H||e.nodes){if(!Ne&&(Se.id===X.id||!Se.computedPosition))continue;const ve=Ba(Se),G=Da(ve,Z);(F&&G>0||G>=ve.width*ve.height||G>=Number(Z.width)*Number(Z.height))&&me.push(Se)}return me},Re=(U,F,H=!0)=>{const[Z]=ye(U);if(!Z)return!1;const X=Da(Z,F);return H&&X>0||X>=Number(Z.width)*Number(Z.height)},ce=U=>{const{viewport:F,dimensions:H,d3Zoom:Z,d3Selection:X,translateExtent:Ne}=e;if(!Z||!X||!U.x&&!U.y)return!1;const me=Mo.translate(F.x+U.x,F.y+U.y).scale(F.zoom),Se=[[0,0],[H.width,H.height]],ve=Z.constrain()(me,Se,Ne),G=e.viewport.x!==ve.x||e.viewport.y!==ve.y||e.viewport.zoom!==ve.k;return Z.transform(X,ve),G},le=U=>{const F=U instanceof Function?U(e):U,H=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ut(F.defaultEdgeOptions)&&(e.defaultEdgeOptions=F.defaultEdgeOptions);const Z=F.modelValue||F.nodes||F.edges?[]:void 0;Z&&(F.modelValue&&Z.push(...F.modelValue),F.nodes&&Z.push(...F.nodes),F.edges&&Z.push(...F.edges),M(Z));const X=()=>{ut(F.maxZoom)&&w(F.maxZoom),ut(F.minZoom)&&b(F.minZoom),ut(F.translateExtent)&&A(F.translateExtent)};for(const Ne of Object.keys(F)){const me=Ne,Se=F[me];![...dN,...H].includes(me)&&ut(Se)&&(e[me]=Se)}bl(()=>e.d3Zoom).not.toBeNull().then(X),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:h,setElements:M,setNodes:S,setEdges:C,addNodes:B,addEdges:g,removeNodes:I,removeEdges:v,findNode:d,findEdge:u,updateEdge:O,updateEdgeData:x,updateNode:ne,updateNodeData:de,applyEdgeChanges:j,applyNodeChanges:z,addSelectedElements:_,addSelectedNodes:y,addSelectedEdges:k,setMinZoom:b,setMaxZoom:w,setTranslateExtent:A,setNodeExtent:$,setPaneClickDistance:L,removeSelectedElements:p,removeSelectedNodes:E,removeSelectedEdges:N,startConnection:pe,updateConnection:he,endConnection:fe,setInteractive:T,setState:le,getIntersectingNodes:_e,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Re,panBy:ce,fitView:U=>i.value.fitView(U),zoomIn:U=>i.value.zoomIn(U),zoomOut:U=>i.value.zoomOut(U),zoomTo:(U,F)=>i.value.zoomTo(U,F),setViewport:(U,F)=>i.value.setViewport(U,F),setTransform:(U,F)=>i.value.setTransform(U,F),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(U,F,H)=>i.value.setCenter(U,F,H),fitBounds:(U,F)=>i.value.fitBounds(U,F),project:U=>i.value.project(U),screenToFlowCoordinate:U=>i.value.screenToFlowCoordinate(U),flowToScreenCoordinate:U=>i.value.flowToScreenCoordinate(U),toObject:()=>{const U=[],F=[];for(const H of e.nodes){const{computedPosition:Z,handleBounds:X,selected:Ne,dimensions:me,isParent:Se,resizing:ve,dragging:G,events:q,...Y}=H;U.push(Y)}for(const H of e.edges){const{selected:Z,sourceNode:X,targetNode:Ne,events:me,...Se}=H;F.push(Se)}return JSON.parse(JSON.stringify({nodes:U,edges:F,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:U=>new Promise(F=>{const{nodes:H,edges:Z,position:X,zoom:Ne,viewport:me}=U;H&&S(H),Z&&C(Z);const[Se,ve]=me!=null&&me.x&&(me!=null&&me.y)?[me.x,me.y]:X??[null,null];if(Se&&ve){const G=(me==null?void 0:me.zoom)||Ne||e.viewport.zoom;return bl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Se,y:ve,zoom:G}).then(()=>{F(!0)})})}else F(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const U=lf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const F=Mo.translate(U.defaultViewport.x??0,U.defaultViewport.y??0).scale(Zn(U.defaultViewport.zoom??1,U.minZoom,U.maxZoom)),H=e.viewportRef.getBoundingClientRect(),Z=[[0,0],[H.width,H.height]],X=e.d3Zoom.constrain()(F,Z,U.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}le(U)},$destroy:()=>{}}}const mN=["data-id","data-handleid","data-nodeid","data-handlepos"],fN={name:"Handle",compatConfig:{MODE:3}},to=t.defineComponent({...fN,props:{id:{default:null},type:{},position:{default:()=>Me.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:h}=qe(),{id:f,node:y,nodeEl:k,connectedEdges:_}=af(),E=t.ref(),N=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),p=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),b=t.toRef(()=>{var C,M,B,g,I,v;return((C=l.value)==null?void 0:C.nodeId)===f&&((M=l.value)==null?void 0:M.id)===e.id&&((B=l.value)==null?void 0:B.type)===i.value||((g=c.value)==null?void 0:g.nodeId)===f&&((I=c.value)==null?void 0:I.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),w=t.toRef(()=>{var C,M,B;return((C=s.value)==null?void 0:C.nodeId)===f&&((M=s.value)==null?void 0:M.id)===e.id&&((B=s.value)==null?void 0:B.type)===i.value}),{handlePointerDown:A,handleClick:$}=of({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),L=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(C=>{const M=C[`${i.value}Handle`];return C[i.value]!==f?!1:M?M===e.id:!0}):typeof e.connectable=="number"?_.value.filter(C=>{const M=C[`${i.value}Handle`];return C[i.value]!==f?!1:M?M===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,_.value):ut(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var C;if(!y.dimensions.width||!y.dimensions.height)return;const M=(C=y.handleBounds[i.value])==null?void 0:C.find(z=>z.id===e.id);if(!d.value||M)return;const B=d.value.querySelector(".vue-flow__transformationpane");if(!k.value||!E.value||!B||!e.id)return;const g=k.value.getBoundingClientRect(),I=E.value.getBoundingClientRect(),v=window.getComputedStyle(B),{m22:O}=new window.DOMMatrixReadOnly(v.transform),x={id:e.id,position:e.position,x:(I.left-g.left)/O,y:(I.top-g.top)/O,type:i.value,nodeId:f,...Oa(E.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],x]});function T(C){const M=Yl(C);L.value&&N.value&&(M&&C.button===0||!M)&&A(C)}function S(C){!f||!s.value&&!N.value||L.value&&$(C)}return n({handleClick:$,handlePointerDown:A,onClick:S,onPointerDown:T}),(C,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:E,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":C.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${C.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(h),i.value,{connectable:L.value,connecting:w.value,connectablestart:N.value,connectableend:p.value,connectionindicator:L.value&&(N.value&&!b.value||p.value&&b.value)}]]),onMousedown:T,onTouchstartPassive:T,onClick:S},[t.renderSlot(C.$slots,"default",{id:C.id})],42,mN))}}),ja=function({sourcePosition:e=Me.Bottom,targetPosition:n=Me.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(to,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(to,{type:"source",position:e,connectable:i,isValidConnection:r})]};ja.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],ja.inheritAttrs=!1,ja.compatConfig={MODE:3};const pN=ja,Ka=function({targetPosition:e=Me.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(to,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};Ka.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ka.inheritAttrs=!1,Ka.compatConfig={MODE:3};const hN=Ka,Ga=function({sourcePosition:e=Me.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(to,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ga.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ga.inheritAttrs=!1,Ga.compatConfig={MODE:3};const yN=Ga,gN=["transform"],bN=["width","height","x","y","rx","ry"],_N=["y"],kN={name:"EdgeText",compatConfig:{MODE:3}},EN=t.defineComponent({...kN,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),i=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(a),t.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==n.value.width||r.height!==n.value.height)&&(n.value=r)}return(r,l)=>(t.openBlock(),t.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*r.labelBgPadding[0]}px`,height:`${n.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:t.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,bN)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:r.labelStyle}),[t.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(r.label),1)],64))])],16,_N)],8,gN))}}),NN=["id","d","marker-end","marker-start"],wN=["d","stroke-width"],IN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ya=t.defineComponent({...IN,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),i=t.ref(null),a=t.ref(null),r=t.useAttrs();return n({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,NN),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,wN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(EN,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function sf({sourceX:e,sourceY:n,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-n)/2,s=i<n?i+l:i-l;return[r,s,a,l]}function cf({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=n*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function qa(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function df({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Me.Left:l=n-qa(n-i,r),s=o;break;case Me.Right:l=n+qa(i-n,r),s=o;break;case Me.Top:l=n,s=o-qa(o-a,r);break;case Me.Bottom:l=n,s=o+qa(a-o,r);break}return[l,s]}function uf(e){const{sourceX:n,sourceY:o,sourcePosition:i=Me.Bottom,targetX:a,targetY:r,targetPosition:l=Me.Top,curvature:s=.25}=e,[c,d]=df({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=df({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[h,f,y,k]=cf({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,h,f,y,k]}function mf({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Me.Left:case Me.Right:r=.5*(n+i),l=o;break;case Me.Top:case Me.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function ff(e){const{sourceX:n,sourceY:o,sourcePosition:i=Me.Bottom,targetX:a,targetY:r,targetPosition:l=Me.Top}=e,[s,c]=mf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=mf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,h,f,y]=cf({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,h,f,y]}const pf={[Me.Left]:{x:-1,y:0},[Me.Right]:{x:1,y:0},[Me.Top]:{x:0,y:-1},[Me.Bottom]:{x:0,y:1}};function vN({source:e,sourcePosition:n=Me.Bottom,target:o}){return n===Me.Left||n===Me.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function hf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function CN({source:e,sourcePosition:n=Me.Bottom,target:o,targetPosition:i=Me.Top,center:a,offset:r}){const l=pf[n],s=pf[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=vN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",h=u[m];let f,y,k;const _={x:0,y:0},E={x:0,y:0},[N,p,b,w]=sf({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??N,k=a.y??p;const $=[{x:y,y:c.y},{x:y,y:d.y}],L=[{x:c.x,y:k},{x:d.x,y:k}];l[m]===h?f=m==="x"?$:L:f=m==="x"?L:$}else{const $=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===h?L:$:f=l.y===h?$:L,n===i){const B=Math.abs(e[m]-o[m]);if(B<=r){const g=Math.min(r-1,r-B);l[m]===h?_[m]=(c[m]>e[m]?-1:1)*g:E[m]=(d[m]>o[m]?-1:1)*g}}if(n!==i){const B=m==="x"?"y":"x",g=l[m]===s[B],I=c[B]>d[B],v=c[B]<d[B];(l[m]===1&&(!g&&I||g&&v)||l[m]!==1&&(!g&&v||g&&I))&&(f=m==="x"?$:L)}const T={x:c.x+_.x,y:c.y+_.y},S={x:d.x+E.x,y:d.y+E.y},C=Math.max(Math.abs(T.x-f[0].x),Math.abs(S.x-f[0].x)),M=Math.max(Math.abs(T.y-f[0].y),Math.abs(S.y-f[0].y));C>=M?(y=(T.x+S.x)/2,k=f[0].y):(y=f[0].x,k=(T.y+S.y)/2)}return[[e,{x:c.x+_.x,y:c.y+_.y},...f,{x:d.x+E.x,y:d.y+E.y},o],y,k,b,w]}function xN(e,n,o,i){const a=Math.min(hf(e,n)/2,hf(n,o)/2,i),{x:r,y:l}=n;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function es(e){const{sourceX:n,sourceY:o,sourcePosition:i=Me.Bottom,targetX:a,targetY:r,targetPosition:l=Me.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,h,f,y,k]=CN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((E,N,p)=>{let b;return p>0&&p<m.length-1?b=xN(m[p-1],N,m[p+1],s):b=`${p===0?"M":"L"}${N.x} ${N.y}`,E+=b,E},""),h,f,y,k]}function SN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=sf({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const RN=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=SN(e);return t.h(Ya,{path:o,labelX:i,labelY:a,...n,...e})}}}),yf=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=es({...e,sourcePosition:e.sourcePosition??Me.Bottom,targetPosition:e.targetPosition??Me.Top});return t.h(Ya,{path:o,labelX:i,labelY:a,...n,...e})}}}),AN=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(yf,{...e,...n,borderRadius:0})}}),$N=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=uf({...e,sourcePosition:e.sourcePosition??Me.Bottom,targetPosition:e.targetPosition??Me.Top});return t.h(Ya,{path:o,labelX:i,labelY:a,...n,...e})}}}),TN=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=ff({...e,sourcePosition:e.sourcePosition??Me.Bottom,targetPosition:e.targetPosition??Me.Top});return t.h(Ya,{path:o,labelX:i,labelY:a,...n,...e})}}}),MN={input:yN,default:pN,output:hN},VN={default:$N,straight:RN,step:AN,smoothstep:yf,simplebezier:TN};function BN(e,n,o){const i=t.computed(()=>k=>n.value.get(k)),a=t.computed(()=>k=>o.value.get(k)),r=t.computed(()=>{const k={...VN,...e.edgeTypes},_=Object.keys(k);for(const E of e.edges)E.type&&!_.includes(E.type)&&(k[E.type]=E.type);return k}),l=t.computed(()=>{const k={...MN,...e.nodeTypes},_=Object.keys(k);for(const E of e.nodes)E.type&&!_.includes(E.type)&&(k[E.type]=E.type);return k}),s=t.computed(()=>e.onlyRenderVisibleElements?$m(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const k=[];for(const _ of e.edges){const E=n.value.get(_.source),N=n.value.get(_.target);D0({sourcePos:E.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:E.dimensions.width,sourceHeight:E.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&k.push(_)}return k}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const k=[];for(const _ of e.nodes)_.selected&&k.push(_);return k}),m=t.computed(()=>{const k=[];for(const _ of e.edges)_.selected&&k.push(_);return k}),h=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const k=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&_.handleBounds!==void 0&&k.push(_);return k}),y=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:y}}class no{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??no.instance;return no.instance=i??new no,o&&(o.config.globalProperties.$vueFlowStorage=no.instance),no.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=lf(),a=t.reactive(i),r={};for(const[h,f]of Object.entries(a.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=f.on}const l={};for(const[h,f]of Object.entries(a.hooks))l[h]=f.trigger;const s=t.computed(()=>{const h=new Map;for(const f of a.nodes)h.set(f.id,f);return h}),c=t.computed(()=>{const h=new Map;for(const f of a.edges)h.set(f.id,f);return h}),d=BN(a,s,c),u=uN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...T_(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function qe(e){const n=no.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Qm,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,h,f)=>{const y=_=>{d.applyNodeChanges(_)},k=_=>{d.applyEdgeChanges(_)};m?(d.onNodesChange(y),d.onEdgesChange(k)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(k)),f(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(k)})},{immediate:!0}),ai(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ii(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Qm,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ft(dt.USEVUEFLOW_OPTIONS))}return s}function DN(e){const{emits:n,dimensions:o}=qe();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Oa(e.value);(s.width===0||s.height===0)&&n.error(new ft(dt.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const ON={name:"UserSelection",compatConfig:{MODE:3}},LN=t.defineComponent({...ON,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),PN=["tabIndex"],zN={name:"NodesSelection",compatConfig:{MODE:3}},FN=t.defineComponent({...zN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=qe(),s=rf(),c=t.ref(null),d=nf({el:c,onStart(y){n.selectionDragStart(y),n.nodeDragStart(y)},onDrag(y){n.selectionDrag(y),n.nodeDrag(y)},onStop(y){n.selectionDragStop(y),n.nodeDragStop(y)}});t.onMounted(()=>{var y;r.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=t.computed(()=>Ul(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(y){n.selectionContextMenu({event:y,nodes:i.value})}function f(y){r.value||Vo[y.key]&&(y.preventDefault(),s({x:Vo[y.key].x,y:Vo[y.key].y},y.shiftKey))}return(y,k)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:h,onKeydown:f},null,46,PN)],6)):t.createCommentVNode("",!0)}});function UN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const HN={name:"Pane",compatConfig:{MODE:3}},jN=t.defineComponent({...HN,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:h,removeEdges:f,selectionMode:y,deleteKeyCode:k,multiSelectionKeyCode:_,multiSelectionActive:E,edgeLookup:N,nodeLookup:p,connectionLookup:b,defaultEdgeOptions:w,connectionStartHandle:A,panOnDrag:$}=qe(),L=t.shallowRef(null),T=t.shallowRef(new Set),S=t.shallowRef(new Set),C=t.shallowRef(null),M=t.toRef(()=>c.value&&(e.isSelecting||r.value)),B=t.toRef(()=>A.value!==null);let g=!1,I=!1;const v=bi(k,{actInsideInputWithModifier:!1}),O=bi(_);t.watch(v,fe=>{fe&&(h(m.value),f(u.value),d.value=!1)}),t.watch(O,fe=>{E.value=fe});function x(fe,ye){return _e=>{_e.target===ye&&(fe==null||fe(_e))}}function z(fe){if(g||B.value){g=!1;return}a.paneClick(fe),l(),d.value=!1}function j(fe){var ye;if(Array.isArray($.value)&&((ye=$.value)!=null&&ye.includes(2))){fe.preventDefault();return}a.paneContextMenu(fe)}function ne(fe){a.paneScroll(fe)}function de(fe){var ye,_e,Re;if(C.value=((ye=n.value)==null?void 0:ye.getBoundingClientRect())??null,!c.value||!e.isSelecting||fe.button!==0||fe.target!==L.value||!C.value)return;(Re=(_e=fe.target)==null?void 0:_e.setPointerCapture)==null||Re.call(_e,fe.pointerId);const{x:ce,y:le}=UN(fe,C.value);I=!0,g=!1,l(),s.value={width:0,height:0,startX:ce,startY:le,x:ce,y:le},a.selectionStart(fe)}function pe(fe){var ye;if(!C.value||!s.value)return;g=!0;const{x:_e,y:Re}=Xt(fe,C.value),{startX:ce=0,startY:le=0}=s.value,ae={startX:ce,startY:le,x:_e<ce?_e:ce,y:Re<le?Re:le,width:Math.abs(_e-ce),height:Math.abs(Re-le)},se=T.value,ue=S.value;T.value=new Set($m(o.value,ae,i.value,y.value===Pl.Partial,!0).map(F=>F.id)),S.value=new Set;const U=((ye=w.value)==null?void 0:ye.selectable)??!0;for(const F of T.value){const H=b.value.get(F);if(H)for(const{edgeId:Z}of H.values()){const X=N.value.get(Z);X&&(X.selectable??U)&&S.value.add(Z)}}if(!Zm(se,T.value)){const F=Tn(p.value,T.value,!0);a.nodesChange(F)}if(!Zm(ue,S.value)){const F=Tn(N.value,S.value);a.edgesChange(F)}s.value=ae,r.value=!0,d.value=!1}function he(fe){var ye;fe.button!==0||!I||((ye=fe.target)==null||ye.releasePointerCapture(fe.pointerId),!r.value&&s.value&&fe.target===L.value&&z(fe),r.value=!1,s.value=null,d.value=T.value.size>0,a.selectionEnd(fe),e.selectionKeyPressed&&(g=!1),I=!1)}return(fe,ye)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:L,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:fe.isSelecting}]),onClick:ye[0]||(ye[0]=_e=>M.value?void 0:x(z,L.value)(_e)),onContextmenu:ye[1]||(ye[1]=_e=>x(j,L.value)(_e)),onWheelPassive:ye[2]||(ye[2]=_e=>x(ne,L.value)(_e)),onPointerenter:ye[3]||(ye[3]=_e=>M.value?void 0:t.unref(a).paneMouseEnter(_e)),onPointerdown:ye[4]||(ye[4]=_e=>M.value?de(_e):t.unref(a).paneMouseMove(_e)),onPointermove:ye[5]||(ye[5]=_e=>M.value?pe(_e):t.unref(a).paneMouseMove(_e)),onPointerup:ye[6]||(ye[6]=_e=>M.value?he(_e):void 0),onPointerleave:ye[7]||(ye[7]=_e=>t.unref(a).paneMouseLeave(_e))},[t.renderSlot(fe.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(LN,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(FN,{key:1})):t.createCommentVNode("",!0)],34))}}),KN={name:"Transform",compatConfig:{MODE:3}},GN=t.defineComponent({...KN,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=qe(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),YN={name:"Viewport",compatConfig:{MODE:3}},qN=t.defineComponent({...YN,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:h,zoomOnPinch:f,zoomOnScroll:y,preventScrolling:k,noWheelClassName:_,noPanClassName:E,emits:N,connectionStartHandle:p,userSelectionActive:b,paneDragging:w,d3Zoom:A,d3Selection:$,d3ZoomHandler:L,viewport:T,viewportRef:S,paneClickDistance:C}=qe();DN(S);const M=t.shallowRef(!1),B=t.shallowRef(!1);let g=null,I=!1,v=0,O={x:0,y:0,zoom:0};const x=bi(s),z=bi(l),j=bi(r),ne=t.toRef(()=>(!z.value||z.value&&l.value===!0)&&(x.value||m.value)),de=t.toRef(()=>x.value||c.value),pe=t.toRef(()=>l.value===!0&&ne.value!==!0),he=t.toRef(()=>z.value&&l.value!==!0||b.value||pe.value),fe=t.toRef(()=>p.value!==null);t.onMounted(()=>{if(!S.value){Ii("Viewport element is missing");return}const le=S.value,ae=le.getBoundingClientRect(),se=y0().clickDistance(C.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Mt(le).call(se),U=ue.on("wheel.zoom"),F=Mo.translate(i.value.x??0,i.value.y??0).scale(Zn(i.value.zoom??1,n.value,o.value)),H=[[0,0],[ae.width,ae.height]],Z=se.constrain()(F,H,a.value);se.transform(ue,Z),se.wheelDelta(Hl),A.value=se,$.value=ue,L.value=U,T.value={x:Z.x,y:Z.y,zoom:Z.k},se.on("start",X=>{var Ne;if(!X.sourceEvent)return null;v=X.sourceEvent.button,M.value=!0;const me=Re(X.transform);((Ne=X.sourceEvent)==null?void 0:Ne.type)==="mousedown"&&(w.value=!0),O=me,N.viewportChangeStart(me),N.moveStart({event:X,flowTransform:me})}),se.on("end",X=>{if(!X.sourceEvent)return null;if(M.value=!1,w.value=!1,ye(ne.value,v??0)&&!I&&N.paneContextMenu(X.sourceEvent),I=!1,_e(O,X.transform)){const Ne=Re(X.transform);O=Ne,N.viewportChangeEnd(Ne),N.moveEnd({event:X,flowTransform:Ne})}}),se.filter(X=>{var Ne;const me=j.value||y.value,Se=f.value&&X.ctrlKey,ve=X.button,G=X.type==="wheel";if(ve===1&&X.type==="mousedown"&&(ce(X,"vue-flow__node")||ce(X,"vue-flow__edge")))return!0;if(!ne.value&&!me&&!de.value&&!h.value&&!f.value||b.value||fe.value&&!G||!h.value&&X.type==="dblclick"||ce(X,_.value)&&G||ce(X,E.value)&&(!G||de.value&&G&&!j.value)||!f.value&&X.ctrlKey&&G||!me&&!de.value&&!Se&&G)return!1;if(!f&&X.type==="touchstart"&&((Ne=X.touches)==null?void 0:Ne.length)>1)return X.preventDefault(),!1;if(!ne.value&&(X.type==="mousedown"||X.type==="touchstart")||pe.value&&Array.isArray(m.value)&&m.value.includes(0)&&ve===0||Array.isArray(m.value)&&!m.value.includes(ve)&&(X.type==="mousedown"||X.type==="touchstart"))return!1;const q=Array.isArray(m.value)&&m.value.includes(ve)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!ve||ve<=1;return(!X.ctrlKey||x.value||G)&&q}),t.watch([b,ne],()=>{b.value&&!M.value?se.on("zoom",null):b.value||se.on("zoom",X=>{T.value={x:X.transform.x,y:X.transform.y,zoom:X.transform.k};const Ne=Re(X.transform);I=ye(ne.value,v??0),N.viewportChange(Ne),N.move({event:X,flowTransform:Ne})})},{immediate:!0}),t.watch([b,de,d,j,f,k,_],()=>{de.value&&!j.value&&!b.value?ue.on("wheel.zoom",X=>{if(ce(X,_.value))return!1;const Ne=j.value||y.value,me=f.value&&X.ctrlKey;if(!(!k.value||de.value||Ne||me))return!1;X.preventDefault(),X.stopImmediatePropagation();const ve=ue.property("__zoom").k||1,G=wi();if(!x.value&&X.ctrlKey&&f.value&&G){const Ve=Yt(X),Le=Hl(X),oe=ve*2**Le;se.scaleTo(ue,oe,Ve,X);return}const q=X.deltaMode===1?20:1;let Y=d.value===gi.Vertical?0:X.deltaX*q,xe=d.value===gi.Horizontal?0:X.deltaY*q;!G&&X.shiftKey&&d.value!==gi.Vertical&&!Y&&xe&&(Y=xe,xe=0),se.translateBy(ue,-(Y/ve)*u.value,-(xe/ve)*u.value);const Be=Re(ue.property("__zoom"));g&&clearTimeout(g),B.value?(N.move({event:X,flowTransform:Be}),N.viewportChange(Be),g=setTimeout(()=>{N.moveEnd({event:X,flowTransform:Be}),N.viewportChangeEnd(Be),B.value=!1},150)):(B.value=!0,N.moveStart({event:X,flowTransform:Be}),N.viewportChangeStart(Be))},{passive:!1}):typeof U<"u"&&ue.on("wheel.zoom",function(X,Ne){const me=!k.value&&X.type==="wheel"&&!X.ctrlKey,Se=j.value||y.value,ve=f.value&&X.ctrlKey;if(!Se&&!c.value&&!ve&&X.type==="wheel"||me||ce(X,_.value))return null;X.preventDefault(),U.call(this,X,Ne)},{passive:!1})},{immediate:!0})});function ye(le,ae){return ae===2&&Array.isArray(le)&&le.includes(2)}function _e(le,ae){return le.x!==ae.x&&!Number.isNaN(ae.x)||le.y!==ae.y&&!Number.isNaN(ae.y)||le.zoom!==ae.k&&!Number.isNaN(ae.k)}function Re(le){return{x:le.x,y:le.y,zoom:le.k}}function ce(le,ae){return le.target.closest(`.${ae}`)}return(le,ae)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:S,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(jN,{"is-selecting":he.value,"selection-key-pressed":t.unref(z),class:t.normalizeClass({connecting:fe.value,dragging:t.unref(w),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(GN,null,{default:t.withCtx(()=>[t.renderSlot(le.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),WN=["id"],JN=["id"],XN=["id"],ZN={name:"A11yDescriptions",compatConfig:{MODE:3}},QN=t.defineComponent({...ZN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=qe();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(Em)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,WN),t.createElementVNode("div",{id:`${t.unref(Nm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,JN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(N0)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(i)),9,XN))],64))}});function ew(){const e=qe();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function tw(e,n,o){return o===Me.Left?e-n:o===Me.Right?e+n:e}function nw(e,n,o){return o===Me.Top?e-n:o===Me.Bottom?e+n:e}const ts=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Me.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:tw(n,e,i),cy:nw(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ts.props=["radius","centerX","centerY","position","type"],ts.compatConfig={MODE:3};const gf=ts,ow=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:h,multiSelectionActive:f,disableKeyboardA11y:y,elementsSelectable:k,edgesUpdatable:_,edgesFocusable:E,hooks:N}=qe(),p=t.computed(()=>u(e.id)),{emit:b,on:w}=Z0(p.value,r),A=t.inject(Fa),$=t.getCurrentInstance(),L=t.ref(!1),T=t.ref(!1),S=t.ref(""),C=t.ref(null),M=t.ref("source"),B=t.ref(null),g=t.toRef(()=>typeof p.value.selectable>"u"?k.value:p.value.selectable),I=t.toRef(()=>typeof p.value.updatable>"u"?_.value:p.value.updatable),v=t.toRef(()=>typeof p.value.focusable>"u"?E.value:p.value.focusable);t.provide(W0,e.id),t.provide(J0,B);const O=t.computed(()=>p.value.class instanceof Function?p.value.class(p.value):p.value.class),x=t.computed(()=>p.value.style instanceof Function?p.value.style(p.value):p.value.style),z=t.computed(()=>{const F=p.value.type||"default",H=A==null?void 0:A[`edge-${F}`];if(H)return H;let Z=p.value.template??c.value[F];if(typeof Z=="string"&&$){const X=Object.keys($.appContext.components);X&&X.includes(F)&&(Z=t.resolveComponent(F,!1))}return Z&&typeof Z!="string"?Z:(r.error(new ft(dt.EDGE_TYPE_MISSING,Z)),!1)}),{handlePointerDown:j}=of({nodeId:S,handleId:C,type:M,isValidConnection:h,edgeUpdaterType:M,onEdgeUpdate:pe,onEdgeUpdateEnd:he});return()=>{const F=m(p.value.source),H=m(p.value.target),Z="pathOptions"in p.value?p.value.pathOptions:{};if(!F&&!H)return r.error(new ft(dt.EDGE_SOURCE_TARGET_MISSING,p.value.id,p.value.source,p.value.target)),null;if(!F)return r.error(new ft(dt.EDGE_SOURCE_MISSING,p.value.id,p.value.source)),null;if(!H)return r.error(new ft(dt.EDGE_TARGET_MISSING,p.value.id,p.value.target)),null;if(!p.value||p.value.hidden||F.hidden||H.hidden)return null;let X;i.value===un.Strict?X=F.handleBounds.source:X=[...F.handleBounds.source||[],...F.handleBounds.target||[]];const Ne=Hm(X,p.value.sourceHandle);let me;i.value===un.Strict?me=H.handleBounds.target:me=[...H.handleBounds.target||[],...H.handleBounds.source||[]];const Se=Hm(me,p.value.targetHandle),ve=(Ne==null?void 0:Ne.position)||Me.Bottom,G=(Se==null?void 0:Se.position)||Me.Top,{x:q,y:Y}=Do(F,Ne,ve),{x:xe,y:Be}=Do(H,Se,G);return p.value.sourceX=q,p.value.sourceY=Y,p.value.targetX=xe,p.value.targetY=Be,t.h("g",{ref:B,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${z.value===!1?"default":p.value.type||"default"}`,s.value,O.value,{updating:L.value,selected:p.value.selected,animated:p.value.animated,inactive:!g.value&&!N.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":p.value.ariaLabel===null?void 0:p.value.ariaLabel??`Edge from ${p.value.source} to ${p.value.target}`,"aria-describedby":v.value?`${Nm}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...p.value.domAttributes,onClick:ye,onContextmenu:_e,onDblclick:Re,onMouseenter:ce,onMousemove:le,onMouseleave:ae,onKeyDown:v.value?U:void 0},[T.value?null:t.h(z.value===!1?c.value.default:z.value,{id:e.id,sourceNode:F,targetNode:H,source:p.value.source,target:p.value.target,type:p.value.type,updatable:I.value,selected:p.value.selected,animated:p.value.animated,label:p.value.label,labelStyle:p.value.labelStyle,labelShowBg:p.value.labelShowBg,labelBgStyle:p.value.labelBgStyle,labelBgPadding:p.value.labelBgPadding,labelBgBorderRadius:p.value.labelBgBorderRadius,data:p.value.data,events:{...p.value.events,...w},style:x.value,markerStart:`url('#${Ni(p.value.markerStart,n)}')`,markerEnd:`url('#${Ni(p.value.markerEnd,n)}')`,sourcePosition:ve,targetPosition:G,sourceX:q,sourceY:Y,targetX:xe,targetY:Be,sourceHandleId:p.value.sourceHandle,targetHandleId:p.value.targetHandle,interactionWidth:p.value.interactionWidth,...Z}),[I.value==="source"||I.value===!0?[t.h("g",{onMousedown:se,onMouseenter:ne,onMouseout:de},t.h(gf,{position:ve,centerX:q,centerY:Y,radius:a.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:ne,onMouseout:de},t.h(gf,{position:G,centerX:xe,centerY:Be,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ne(){L.value=!0}function de(){L.value=!1}function pe(F,H){b.update({event:F,edge:p.value,connection:H})}function he(F){b.updateEnd({event:F,edge:p.value}),T.value=!1}function fe(F,H){F.button===0&&(T.value=!0,S.value=H?p.value.target:p.value.source,C.value=(H?p.value.targetHandle:p.value.sourceHandle)??null,M.value=H?"target":"source",b.updateStart({event:F,edge:p.value}),j(F))}function ye(F){var H;const Z={event:F,edge:p.value};g.value&&(l.value=!1,p.value.selected&&f.value?(d([p.value]),(H=B.value)==null||H.blur()):o([p.value])),b.click(Z)}function _e(F){b.contextMenu({event:F,edge:p.value})}function Re(F){b.doubleClick({event:F,edge:p.value})}function ce(F){b.mouseEnter({event:F,edge:p.value})}function le(F){b.mouseMove({event:F,edge:p.value})}function ae(F){b.mouseLeave({event:F,edge:p.value})}function se(F){fe(F,!0)}function ue(F){fe(F,!1)}function U(F){var H;!y.value&&wm.includes(F.key)&&g.value&&(F.key==="Escape"?((H=B.value)==null||H.blur(),d([u(e.id)])):o([u(e.id)]))}}}),iw=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=qe(),h=(e=t.inject(Fa))==null?void 0:e["connection-line"],f=t.computed(()=>{var N;return m((N=i.value)==null?void 0:N.nodeId)}),y=t.computed(()=>{var N;return m((N=a.value)==null?void 0:N.nodeId)??null}),k=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),_=t.computed(()=>c.value.markerStart?`url(#${Ni(c.value.markerStart,n)})`:""),E=t.computed(()=>c.value.markerEnd?`url(#${Ni(c.value.markerEnd,n)})`:"");return()=>{var N,p,b;if(!f.value||!i.value)return null;const w=i.value.id,A=i.value.type,$=f.value.handleBounds;let L=($==null?void 0:$[A])??[];if(o.value===un.Loose){const x=($==null?void 0:$[A==="source"?"target":"source"])??[];L=[...L,...x]}if(!L)return null;const T=(w?L.find(x=>x.id===w):L[0])??null,S=(T==null?void 0:T.position)??Me.Top,{x:C,y:M}=Do(f.value,T,S);let B=null;y.value&&(o.value===un.Strict?B=((N=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:N.find(x=>{var z;return x.id===((z=a.value)==null?void 0:z.id)}))||null:B=((p=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:p.find(x=>{var z;return x.id===((z=a.value)==null?void 0:z.id)}))||null);const g=((b=a.value)==null?void 0:b.position)??(S?Wl[S]:null);if(!S||!g)return null;const I=l.value??c.value.type??Xn.Bezier;let v="";const O={sourceX:C,sourceY:M,sourcePosition:S,targetX:k.value.x,targetY:k.value.y,targetPosition:g};return I===Xn.Bezier?[v]=uf(O):I===Xn.Step?[v]=es({...O,borderRadius:0}):I===Xn.SmoothStep?[v]=es(O):I===Xn.SimpleBezier?[v]=ff(O):v=`M${C},${M} ${k.value.x},${k.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},h?t.h(h,{sourceX:C,sourceY:M,sourcePosition:S,targetX:k.value.x,targetY:k.value.y,targetPosition:g,sourceNode:f.value,sourceHandle:T,targetNode:y.value,targetHandle:B,markerEnd:E.value,markerStart:_.value,connectionStatus:d.value}):t.h("path",{d:v,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":E.value,"marker-start":_.value})))}}}),aw=["id","markerWidth","markerHeight","markerUnits","orient"],rw={name:"MarkerType",compatConfig:{MODE:3}},lw=t.defineComponent({...rw,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(zl).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref(zl).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,aw))}}),sw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},cw={name:"MarkerDefinitions",compatConfig:{MODE:3}},dw=t.defineComponent({...cw,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=qe(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Ni(d,n);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.add(u))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const u of[d.markerStart,d.markerEnd])c(u);return s.sort((d,u)=>d.id.localeCompare(u.id))});return(l,s)=>(t.openBlock(),t.createElementBlock("svg",sw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(lw,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),uw={name:"Edges",compatConfig:{MODE:3}},mw=t.defineComponent({...uw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=qe();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(dw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(O0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(ow),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(iw))],64))}}),fw=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:h,elevateNodesOnSelect:f,disableKeyboardA11y:y,ariaLiveMessage:k,snapToGrid:_,snapGrid:E,nodeDragThreshold:N,nodesDraggable:p,elementsSelectable:b,nodesConnectable:w,nodesFocusable:A,hooks:$}=qe(),L=t.ref(null);t.provide(tf,L),t.provide(ef,e.id);const T=t.inject(Fa),S=t.getCurrentInstance(),C=rf(),{node:M,parentNode:B}=af(e.id),{emit:g,on:I}=nN(M,l),v=t.toRef(()=>typeof M.draggable>"u"?p.value:M.draggable),O=t.toRef(()=>typeof M.selectable>"u"?b.value:M.selectable),x=t.toRef(()=>typeof M.connectable>"u"?w.value:M.connectable),z=t.toRef(()=>typeof M.focusable>"u"?A.value:M.focusable),j=t.computed(()=>O.value||v.value||$.value.nodeClick.hasListeners()||$.value.nodeDoubleClick.hasListeners()||$.value.nodeMouseEnter.hasListeners()||$.value.nodeMouseMove.hasListeners()||$.value.nodeMouseLeave.hasListeners()),ne=t.toRef(()=>!!M.dimensions.width&&!!M.dimensions.height),de=t.computed(()=>{const H=M.type||"default",Z=T==null?void 0:T[`node-${H}`];if(Z)return Z;let X=M.template||m.value[H];if(typeof X=="string"&&S){const Ne=Object.keys(S.appContext.components);Ne&&Ne.includes(H)&&(X=t.resolveComponent(H,!1))}return X&&typeof X!="string"?X:(l.error(new ft(dt.NODE_TYPE_MISSING,X)),!1)}),pe=nf({id:e.id,el:L,disabled:()=>!v.value,selectable:O,dragHandle:()=>M.dragHandle,onStart(H){g.dragStart(H)},onDrag(H){g.drag(H)},onStop(H){g.dragStop(H)},onClick(H){U(H)}}),he=t.computed(()=>M.class instanceof Function?M.class(M):M.class),fe=t.computed(()=>{const H=(M.style instanceof Function?M.style(M):M.style)||{},Z=M.width instanceof Function?M.width(M):M.width,X=M.height instanceof Function?M.height(M):M.height;return!H.width&&Z&&(H.width=typeof Z=="string"?Z:`${Z}px`),!H.height&&X&&(H.height=typeof X=="string"?X:`${X}px`),H}),ye=t.toRef(()=>Number(M.zIndex??fe.value.zIndex??0));return u(H=>{(H.includes(e.id)||!H.length)&&Re()}),t.onMounted(()=>{t.watch(()=>M.hidden,(H=!1,Z,X)=>{!H&&L.value&&(e.resizeObserver.observe(L.value),X(()=>{L.value&&e.resizeObserver.unobserve(L.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>M.type,()=>M.sourcePosition,()=>M.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])})}),t.watch([()=>M.position.x,()=>M.position.y,()=>{var H;return(H=B.value)==null?void 0:H.computedPosition.x},()=>{var H;return(H=B.value)==null?void 0:H.computedPosition.y},()=>{var H;return(H=B.value)==null?void 0:H.computedPosition.z},ye,()=>M.selected,()=>M.dimensions.height,()=>M.dimensions.width,()=>{var H;return(H=B.value)==null?void 0:H.dimensions.height},()=>{var H;return(H=B.value)==null?void 0:H.dimensions.width}],([H,Z,X,Ne,me,Se])=>{const ve={x:H,y:Z,z:Se+(f.value&&M.selected?1e3:0)};typeof X<"u"&&typeof Ne<"u"?M.computedPosition=$0({x:X,y:Ne,z:me},ve):M.computedPosition=ve},{flush:"post",immediate:!0}),t.watch([()=>M.extent,h],([H,Z],[X,Ne])=>{(H!==X||Z!==Ne)&&_e()}),M.extent==="parent"||typeof M.extent=="object"&&"range"in M.extent&&M.extent.range==="parent"?bl(()=>ne).toBe(!0).then(_e):_e(),()=>M.hidden?null:t.h("div",{ref:L,"data-id":M.id,class:["vue-flow__node",`vue-flow__node-${de.value===!1?"default":M.type||"default"}`,{[o.value]:v.value,dragging:pe==null?void 0:pe.value,draggable:v.value,selected:M.selected,selectable:O.value,parent:M.isParent},he.value],style:{visibility:ne.value?"visible":"hidden",zIndex:M.computedPosition.z??ye.value,transform:`translate(${M.computedPosition.x}px,${M.computedPosition.y}px)`,pointerEvents:j.value?"all":"none",...fe.value},tabIndex:z.value?0:void 0,role:z.value?"group":void 0,"aria-describedby":y.value?void 0:`${Em}-${n}`,"aria-label":M.ariaLabel,"aria-roledescription":"node",...M.domAttributes,onMouseenter:ce,onMousemove:le,onMouseleave:ae,onContextmenu:se,onClick:U,onDblclick:ue,onKeydown:F},[t.h(de.value===!1?m.value.default:de.value,{id:M.id,type:M.type,data:M.data,events:{...M.events,...I},selected:M.selected,resizing:M.resizing,dragging:pe.value,connectable:x.value,position:M.computedPosition,dimensions:M.dimensions,isValidTargetPos:M.isValidTargetPos,isValidSourcePos:M.isValidSourcePos,parent:M.parentNode,parentNodeId:M.parentNode,zIndex:M.computedPosition.z??ye.value,targetPosition:M.targetPosition,sourcePosition:M.sourcePosition,label:M.label,dragHandle:M.dragHandle,onUpdateNodeInternals:Re})]);function _e(){const H=M.computedPosition,{computedPosition:Z,position:X}=Gl(M,_.value?za(H,E.value):H,l.error,h.value,B.value);(M.computedPosition.x!==Z.x||M.computedPosition.y!==Z.y)&&(M.computedPosition={...M.computedPosition,...Z}),(M.position.x!==X.x||M.position.y!==X.y)&&(M.position=X)}function Re(){L.value&&d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])}function ce(H){pe!=null&&pe.value||g.mouseEnter({event:H,node:M})}function le(H){pe!=null&&pe.value||g.mouseMove({event:H,node:M})}function ae(H){pe!=null&&pe.value||g.mouseLeave({event:H,node:M})}function se(H){return g.contextMenu({event:H,node:M})}function ue(H){return g.doubleClick({event:H,node:M})}function U(H){O.value&&(!i.value||!v.value||N.value>0)&&Jl(M,r.value,c,s,a,!1,L.value),g.click({event:H,node:M})}function F(H){if(!(Fl(H)||y.value))if(wm.includes(H.key)&&O.value){const Z=H.key==="Escape";Jl(M,r.value,c,s,a,Z,L.value)}else v.value&&M.selected&&Vo[H.key]&&(H.preventDefault(),k.value=`Moved selected node ${H.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.position.x}, y: ${~~M.position.y}`,C({x:Vo[H.key].x,y:Vo[H.key].y},H.shiftKey))}}});function pw(e={includeHiddenNodes:!1}){const{nodes:n}=qe();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const hw={class:"vue-flow__nodes vue-flow__container"},yw={name:"Nodes",compatConfig:{MODE:3}},gw=t.defineComponent({...yw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=qe(),a=pw(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",hw,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const h=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,h))return m;const f=(t.openBlock(),t.createBlock(t.unref(fw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=h,f},s,0),128)):t.createCommentVNode("",!0)]))}});function bw(){const{emits:e}=qe();t.onMounted(()=>{if(qm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ft(dt.MISSING_STYLES))}})}const _w=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),kw={name:"VueFlow",compatConfig:{MODE:3}},Ew=t.defineComponent({...kw,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const i=e,a=t.useSlots(),r=_l(i,"modelValue",o),l=_l(i,"nodes",o),s=_l(i,"edges",o),c=qe(i),d=rN({modelValue:r,nodes:l,edges:s},i,c);return sN(o,c.hooks),ew(),bw(),t.provide(Fa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(qN,null,{default:t.withCtx(()=>[t.createVNode(mw),_w,t.createVNode(gw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(QN)],512))}}),Nw={name:"Panel",compatConfig:{MODE:3}},bf=t.defineComponent({...Nw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=qe(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),ww=["width","height","innerHTML"],Iw=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(t.openBlock(),t.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:n[e.name]??""},null,8,ww))}}),We=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},$e=We(Iw,[["__scopeId","data-v-05aac699"]]),oo=["red","amber","green","teal","blue","indigo","violet","pink"],_f={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function vw(e){return typeof e=="string"&&e in _f}const Cw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},xw=.15;function Sw(e){const n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n)return null;let o=n[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function Rw(e){if(typeof e!="string")return null;const n=Sw(e);if(!n||n.s<xw)return null;let o=null,i=1/0;for(const a of oo){const r=Math.abs(n.h-Cw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function bt(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(vw(n))return n;const o=e==null?void 0:e.properties;return Rw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function ns(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Aw={red:"var(--em-swatch-red-bar)",amber:"var(--em-swatch-amber-bar)",green:"var(--em-swatch-green-bar)",teal:"var(--em-swatch-teal-bar)",blue:"var(--em-swatch-blue-bar)",indigo:"var(--em-swatch-indigo-bar)",violet:"var(--em-swatch-violet-bar)",pink:"var(--em-swatch-pink-bar)"},$w={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function kf(e,n=!1){return e?n?$w[e]:Aw[e]:null}function io(e){return _f[e]}function Oo(e){return`var(--em-swatch-${e}-bar)`}function Tw(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function Mw(e,n){const o=Tw(n);return o?e(o):n.split("-")[1]??n}function Vw(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function Ef(e,n){const o=Vw(n);if(n.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=n.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,n.params)}function Bw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Dw={class:"em-inline-issue__msgs"},ao=We(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode($e,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",Dw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(c,d)=>(t.openBlock(),t.createElementBlock("span",{key:d},t.toDisplayString(t.unref(Ef)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Ow=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Lw={key:0,class:"em-mlang__dot"},Pw=["id","role","aria-labelledby"],zw=["title"],mn=We(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const E=o.defaultLang;return E&&o.languages.includes(E)?E:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const E=o.activeLang;return E&&o.languages.includes(E)?E:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(E){var N,p;return!!((p=(N=o.modelValue)==null?void 0:N[E])!=null&&p.trim())}const d=E=>`${o.name}-tab-${E}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function h(E){var b,w;const N=o.languages,p=N[(E+N.length)%N.length];p&&(l.value=p,await t.nextTick(),(w=(b=m.value)==null?void 0:b.querySelectorAll('[role="tab"]')[N.indexOf(p)])==null||w.focus())}function f(E){h(o.languages.indexOf(s.value)+E)}const y=t.computed(()=>o.languages.filter(E=>{var N,p;return E!==s.value&&!!((p=(N=o.modelValue)==null?void 0:N[E])!=null&&p.trim())})),k=t.computed(()=>{var E;return((E=o.modelValue)==null?void 0:E[s.value])??""});function _(E){const N={...o.modelValue};E.trim()===""?delete N[s.value]:N[s.value]=E,i("update:modelValue",N)}return(E,N)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,p=>(t.openBlock(),t.createElementBlock("span",{id:d(p),key:p,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===p}]),role:"tab","aria-selected":s.value===p,"aria-controls":u.value,tabindex:s.value===p?0:-1,onClick:b=>l.value=p,onKeydown:[t.withKeys(t.withModifiers(b=>l.value=p,["prevent"]),["enter"]),t.withKeys(t.withModifiers(b=>l.value=p,["prevent"]),["space"]),N[0]||(N[0]=t.withKeys(t.withModifiers(b=>f(-1),["prevent"]),["left"])),N[1]||(N[1]=t.withKeys(t.withModifiers(b=>f(1),["prevent"]),["right"])),N[2]||(N[2]=t.withKeys(t.withModifiers(b=>h(0),["prevent"]),["home"])),N[3]||(N[3]=t.withKeys(t.withModifiers(b=>h(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(p),1),c(p)?(t.openBlock(),t.createElementBlock("span",Lw,"•")):t.createCommentVNode("",!0)],42,Ow))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(ee.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":k.value,"onUpdate:modelValue":_},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":k.value,"onUpdate:modelValue":_},null,8,["name","placeholder","model-value"]))],8,Pw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,zw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Fw=["disabled"],Uw={class:"em-panel__sub-label"},Hw={class:"em-field"},jw={class:"em-field"},Kw={class:"em-field"},Gw={class:"em-class"},Yw={class:"em-field"},qw={class:"em-field"},Ww={class:"em-field"},Jw={class:"em-field"},Xw={class:"em-multilang"},Zw={class:"em-multilang"},Qw={class:"em-jpa"},eI={class:"em-field"},tI={class:"em-field"},nI={class:"em-field"},oI=["title"],iI={class:"em-swatch"},aI={class:"em-swatch__row"},rI=["title"],lI=["title","onClick"],Nf=We(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(B=>B.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(B=>B.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var B;return bt(((B=l.value)==null?void 0:B.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],m=B=>B;function h(B){return B==="inherit"?a.t("em.common.inherit"):B}function f(B){r.value&&a.updateEntity(r.value.modelId,B)}function y(B,g,I){var O;const v=((O=r.value)==null?void 0:O.table)??{physicalName:""};f(B==="physicalName"?{table:{...v,physicalName:I}}:{table:{...v,logicalName:{...v.logicalName,[g]:I}}})}function k(B){f({description:Object.keys(B).length?B:void 0})}function _(B,g){var I;f({jpaAttrs:{...(I=r.value)==null?void 0:I.jpaAttrs,[B]:g}})}function E(B,g){_(B,g)}const N=t.computed(()=>{var B,g;return((g=(B=r.value)==null?void 0:B.jpaAttrs)==null?void 0:g.discriminatorType)??"inherit"}),p=t.computed(()=>{var B,g;return!((g=(B=r.value)==null?void 0:B.jpaAttrs)!=null&&g.useDiscriminator)});function b(B){_("discriminatorType",B==="inherit"?void 0:B)}function w(B){f({hasPersonalInfo:B})}function A(B){f({referenceOnly:B?!0:void 0})}function $(B){f({superClass:B.trim()||void 0})}function L(B){f({schema:B.trim()||void 0})}function T(B){f({abstractClass:B})}const S=t.computed(()=>{var B,g;return((g=(B=r.value)==null?void 0:B.declarationOfInterfaces)==null?void 0:g.join(", "))??""});function C(B){const g=B.split(",").map(I=>I.trim()).filter(Boolean);f({declarationOfInterfaces:g.length?g:void 0})}function M(B){r.value&&a.setEntitySwatch(r.value.modelId,B)}return(B,g)=>{var I,v,O;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:g[0]||(g[0]=x=>i("toggle"))},[t.createElementVNode("span",Uw,[t.createVNode($e,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(ao,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Hw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":g[1]||(g[1]=x=>f({name:x}))},null,8,["model-value"])]),t.createElementVNode("label",jw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(Yo),"onUpdate:modelValue":g[2]||(g[2]=x=>f({stereotype:x}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Kw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":g[3]||(g[3]=x=>f({packageName:x}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Gw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Yw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":g[4]||(g[4]=x=>$(x))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",qw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":S.value,"onUpdate:modelValue":g[5]||(g[5]=x=>C(x))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":g[6]||(g[6]=x=>T(x))},null,8,["label","model-value"])]),t.createElementVNode("label",Ww,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-table",width:"100%","model-value":((I=r.value.table)==null?void 0:I.physicalName)??"","onUpdate:modelValue":g[7]||(g[7]=x=>y("physicalName",null,x))},null,8,["model-value"])]),t.createElementVNode("label",Jw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":g[8]||(g[8]=x=>L(x))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",Xw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,x=>{var z,j;return t.openBlock(),t.createElementBlock("label",{key:x,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(x),1),t.createVNode(t.unref(ee.BSTextInput),{name:`ent-logical-${x}`,width:"100%","model-value":((j=(z=r.value.table)==null?void 0:z.logicalName)==null?void 0:j[x])??"","onUpdate:modelValue":ne=>y("logicalName",x,ne)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",Zw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":k},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Qw,[g[13]||(g[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,x=>{var z;return t.createVNode(t.unref(ee.BSCheckbox),{key:x.key,name:`jpa-${x.key}`,class:"em-check",label:x.label,"model-value":!!((z=r.value.jpaAttrs)!=null&&z[x.key]),"onUpdate:modelValue":j=>E(x.key,j)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",eI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:p.value,"model-value":((v=r.value.jpaAttrs)==null?void 0:v.discriminatorColumnName)??"","onUpdate:modelValue":g[9]||(g[9]=x=>_("discriminatorColumnName",x.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",tI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(ee.BSSelect),{disabled:p.value,"model-value":N.value,items:u,"value-provider":m,"label-provider":h,"onUpdate:modelValue":g[10]||(g[10]=x=>x&&b(x))},null,8,["disabled","model-value"])]),t.createElementVNode("label",nI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(ee.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:p.value,"model-value":(O=r.value.jpaAttrs)==null?void 0:O.discriminatorLength,"onUpdate:modelValue":g[11]||(g[11]=x=>_("discriminatorLength",x||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":w},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":A},null,8,["label","model-value"])],8,oI),t.createElementVNode("fieldset",iI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",aI,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:g[12]||(g[12]=x=>M(null))},"∅",10,rI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),x=>(t.openBlock(),t.createElementBlock("button",{key:x,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===x}]),style:t.normalizeStyle({background:t.unref(Oo)(x)}),title:t.unref(a).t(t.unref(io)(x)),onClick:z=>M(x)},null,14,lI))),128))])])],64)):t.createCommentVNode("",!0)],8,Fw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),sI=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"],wf=["inherit","true","false"],Wa="__OWN__";function If(e,n){const o=t.computed(()=>e.state.logical.entities.find(K=>K.modelId===n())??null),i=t.computed(()=>{var K;return((K=o.value)==null?void 0:K.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(K){return K==="none"?e.t("em.common.noneParen"):K}const l=K=>K;function s(K,V){o.value&&e.updateAttribute(o.value.modelId,K.modelId,V)}function c(K){if(!o.value)return;const V=ko(e.state.logical,o.value.modelId,K.modelId);return V&&Gr(K,V)?V:void 0}function d(K){return!!c(K)}function u(K){return d(K)?K.derivedIdFieldName??"":K.name??""}function m(K){const V=c(K);if(!V)return e.t("em.attr.namePlaceholder");const W=new Map(e.state.logical.entities.map(Ce=>[Ce.modelId,Ce]));return Yr({...K,derivedIdFieldName:void 0},V,W)||e.t("em.attr.namePlaceholder")}function h(K,V){d(K)?s(K,{derivedIdFieldName:V||void 0}):s(K,{name:V})}function f(K){return!!o.value&&!!ko(e.state.logical,o.value.modelId,K.modelId)}function y(K,V){s(K,{naturalId:V||void 0,naturalIdMutable:V?K.naturalIdMutable:void 0})}function k(){return{naturalId:void 0,naturalIdMutable:void 0}}function _(K,V){s(K,{identifier:V,...V?k():{}})}function E(K,V){s(K,{transient:V||void 0,...V?k():{}})}function N(K){return!!K.transient||K.attrType==="RELATION_REF"}function p(K){return zi(K)}function b(K,V=0){var W;return((W=Fi(K,o.value,e.state.logical.entities,e.state.logical.associations,V))==null?void 0:W.physicalName)||void 0}const w=K=>K.value,A=K=>K.label;function $(K,V){if(!V)return;const W=v.value.find(Ce=>Ce.type===V);if(W){const Ce=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};s(K,{type:V,customType:void 0,dbAttrs:[{...Ce,dataType:W.dataType,length:W.length,scale:W.scale}]});return}s(K,V===an?{type:V}:{type:V,customType:void 0})}function L(K,V){s(K,{customType:V.trim()===""?void 0:V})}function T(K,V){if(K.attrType==="RELATION_REF")return;const Ce={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...V};V.dataType!==void 0&&!$r.has(Ce.dataType)&&(Ce.scale=void 0),s(K,{dbAttrs:[Ce]})}function S(K){var V;return $r.has(((V=K.dbAttrs[0])==null?void 0:V.dataType)??"")}function C(K){return!S(K)&&!p(K)&&!N(K)?e.t("em.attr.scaleTypeHint"):void 0}function M(K,V){T(K,{logicalName:Object.keys(V).length?V:void 0})}function B(K,V){s(K,{description:Object.keys(V).length?V:void 0})}function g(K){return K.personalInfoAttributeType??"none"}function I(K,V){s(K,{personalInfoAttributeType:V==="none"?void 0:V})}const v=t.computed(()=>e.predefinedCustomTypeCatalog.value),O=t.computed(()=>e.embeddableCatalog.value);function x(K){var V,W,Ce;return((V=K.label)==null?void 0:V[e.userLanguage.value])??((W=K.label)==null?void 0:W.ko)??((Ce=K.label)==null?void 0:Ce.en)??K.type}const z=t.computed(()=>e.groupCodeCatalog.value);function j(K){var V;return((V=z.value.find(W=>W.groupCode===K.groupCode))==null?void 0:V.codes)??[]}function ne(K){return["none",...j(K)]}function de(K){return K==="none"?"none":K.code}function pe(K){var W,Ce,ze;if(K==="none")return e.t("em.common.noneParen");const V=((W=K.label)==null?void 0:W[e.userLanguage.value])??((Ce=K.label)==null?void 0:Ce.ko)??((ze=K.label)==null?void 0:ze.en);return V?`${K.code} (${V})`:K.code}function he(K,V){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,V)}function fe(K,V){s(K,{defaultValue:V==="none"?void 0:V})}function ye(K,V){s(K,{defaultValue:V.trim()===""?void 0:V})}function _e(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}function Re(K,V,W){const Ce=K.dbAttrs.map((ze,Ie)=>{if(Ie!==V)return ze;const J={...ze,...W};for(const He of Object.keys(W))W[He]===void 0&&delete J[He];return J});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,Ce)}function ce(K,V,W){Re(K,V,{logicalName:Object.keys(W).length?W:void 0})}function le(K,V){var ze,Ie,J;if(K.attrType==="EMBED_PREDEF"){const He=(ze=e.embeddableCatalog.value.find(ot=>ot.type===K.type))==null?void 0:ze.fields[V];return He?{name:He.name,physicalName:He.physicalName,dataType:He.dataType,length:He.length,scale:He.scale,shareable:He.shareable,logicalName:He.logicalName}:void 0}const W=(Ie=K.embedded)==null?void 0:Ie.embeddableRef;if(!W)return;const Ce=(J=e.state.logical.entities.find(He=>He.modelId===W))==null?void 0:J.attributes.flatMap(He=>He.dbAttrs)[V];return Ce?{physicalName:Ce.physicalName,dataType:Ce.dataType,length:Ce.length,scale:Ce.scale,logicalName:Ce.logicalName}:void 0}function ae(K,V){var W,Ce;return((W=le(K,V))==null?void 0:W.dataType)||((Ce=K.dbAttrs[V])==null?void 0:Ce.dataType)||""}function se(K,V){var W,Ce;return((W=le(K,V))==null?void 0:W.length)??((Ce=K.dbAttrs[V])==null?void 0:Ce.length)}function ue(K,V){var W,Ce;return((W=le(K,V))==null?void 0:W.scale)??((Ce=K.dbAttrs[V])==null?void 0:Ce.scale)}const U=wf;function F(K){return K==="inherit"?e.t("em.common.inherit"):K}function H(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function Z(K,V,W){Re(K,V,{updatable:W==="inherit"?void 0:W==="true"})}function X(K,V){T(K,{updatable:V==="inherit"?void 0:V==="true"})}const Ne=wf;function me(K){return K==="inherit"?e.t("em.common.inherit"):K}function Se(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function ve(K,V,W){Re(K,V,{insertable:W==="inherit"?void 0:W==="true"})}function G(K,V){T(K,{insertable:V==="inherit"?void 0:V==="true"})}const q=t.computed(()=>o.value?Ir(o.value,e.state.logical.entities):[]),Y=t.computed(()=>fo(q.value.flatMap(K=>K.attributes.flatMap(V=>V.dbAttrs)))),xe=t.computed(()=>q.value.flatMap(K=>K.attributes.filter(V=>V.attrType==="NORMAL"&&V.dbAttrs.length===1&&V.dbAttrs[0]).map(V=>{var W;return{modelId:V.dbAttrs[0].modelId,physical:V.dbAttrs[0].physicalName||V.name,isCurrency:V.type==="Currency",ownerName:K.modelId===((W=o.value)==null?void 0:W.modelId)?void 0:K.name}})));function Be(){const K=[...xe.value].sort((V,W)=>Number(W.isCurrency)-Number(V.isCurrency));return[Wa,...K.map(V=>V.modelId)]}function Ve(K){if(K===Wa)return e.t("em.attr.sharedOwn");const V=xe.value.find(Ce=>Ce.modelId===K);if(!V)return K;const W=V.ownerName?`${V.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:W,physical:V.physical,mode:V.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function Le(K){return(K==null?void 0:K.sharedColumnRef)??Wa}function oe(K,V,W){Re(K,V,{sharedColumnRef:W===Wa?void 0:W})}function we(K){return(K==null?void 0:K.sharedColumnRef)!=null}function Fe(K){var V;return((V=Pn(K,Y.value))==null?void 0:V.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:sI,piiLabel:r,idn:l,setAttr:s,isDerivedIdRow:d,rowName:u,rowNamePlaceholder:m,setRowName:h,isManagedFk:f,setNaturalId:y,clearNaturalIdPatch:k,setIdentifier:_,setTransient:E,dbLocked:N,fkDerived:p,fkOriginPhysical:b,typeValueOf:w,typeLabelOf:A,setAttrType:$,setAttrCustomType:L,setDb:T,scaleApplicable:S,scaleHint:C,setDbLogical:M,setAttrDescription:B,attrPiiValue:g,setAttrPii:I,predefinedCustomTypeCatalog:v,embeddableCatalog:O,predefinedLabel:x,groupCodeCatalog:z,attrGroupCodes:j,attrCodeItems:ne,codeValueOf:de,codeLabelOf:pe,setAttrGroupCode:he,setAttrCode:fe,setAttrDefaultValue:ye,isEmbedExpanded:_e,setDbAt:Re,setDbLogicalAt:ce,embedColMeta:le,fixedDataType:ae,fixedLength:se,fixedScale:ue,updatableItems:U,updatableLabel:F,updatableValue:H,setUpdatableAt:Z,setUpdatable:X,insertableItems:Ne,insertableLabel:me,insertableValue:Se,setInsertableAt:ve,setInsertable:G,scopeEntities:q,columnsById:Y,sharedCandidates:xe,sharedItems:Be,sharedLabel:Ve,sharedValue:Le,setSharedAt:oe,isShared:we,sharedPhysical:Fe}}const vf={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.derivedIdNote":"Scalar @Id field name for derived identity (@MapsId). Edit the association field name by clicking the relation; leave blank to derive from the parent PK column name.","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every embedded column in this entity","em.node.embedAllShow":"Expand all collapsed embedded columns","em.node.embedAllSummary":"{n} embedded column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},Cf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.derivedIdNote":"派生識別(@MapsId)のスカラー @Id フィールド名です。関連フィールド名は関連線をクリックして編集し、空欄にすると親 PK の物理名から派生します。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティの埋め込み列をすべて折りたたむ","em.node.embedAllShow":"折りたたまれた埋め込み列をすべて展開","em.node.embedAllSummary":"埋め込み列 {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},xf={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.derivedIdNote":"파생 식별(@MapsId) 스칼라 @Id 필드명입니다. 연관 필드명은 관계선을 클릭해 편집하며, 비우면 부모 PK 물리명에서 파생됩니다.","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 임베드 컬럼 모두 접기","em.node.embedAllShow":"접힌 임베드 컬럼 모두 펼치기","em.node.embedAllSummary":"임베드 컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},cI=["ko","en","ja"],os={ko:xf,en:vf,ja:Cf};function Dt(e,n,o){let a=(os[e]??os.ko)[n]??os.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const Sf=["ko","en","ja","zh"];function dI(e){if(e)for(const n of Sf){const o=e[n];if(o)return o}}function is(e){const n=dI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function uI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Sf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const mI=["aria-expanded","placeholder"],fI=["aria-selected","onClick","onMouseenter"],pI={key:0,class:"gcc__opt gcc__opt--empty"},Rf=We(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(T,S)=>Dt(o.locale??"ko",T,S),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),h=t.computed(()=>o.items.find(T=>T.groupCode===o.modelValue)),f=t.computed(()=>h.value?is(h.value):"");t.watch(f,T=>{d.value||(c.value=T)},{immediate:!0});const y=t.computed(()=>c.value===f.value?o.items:uI(o.items,c.value));function k(){var S;const T=(S=r.value)==null?void 0:S.getBoundingClientRect();T&&(m.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function _(){d.value=!0,k(),u.value=Math.max(0,y.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),document.addEventListener("mousedown",L)}function E(){d.value=!1,window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),document.removeEventListener("mousedown",L)}t.onBeforeUnmount(E);function N(){_(),t.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function p(){d.value||_(),u.value=0}function b(T){i("update:modelValue",T.groupCode),c.value=is(T),E()}function w(){i("update:modelValue",void 0),c.value="",E()}function A(){c.value.trim()===""?w():(c.value=f.value,E())}function $(T){var S;if(T.key==="ArrowDown")d.value||_(),u.value=Math.min(u.value+1,y.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")u.value=Math.max(u.value-1,0),T.preventDefault();else if(T.key==="Enter"){const C=y.value[u.value];C&&b(C),T.preventDefault()}else T.key==="Escape"&&(c.value=f.value,E(),(S=l.value)==null||S.blur())}function L(T){var C,M;const S=T.target;!((C=r.value)!=null&&C.contains(S))&&!((M=s.value)!=null&&M.contains(S))&&A()}return(T,S)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":S[0]||(S[0]=C=>c.value=C),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:N,onInput:p,onKeydown:$},null,40,mI),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:S[1]||(S[1]=t.withModifiers(()=>{},["prevent"])),onClick:w},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(C,M)=>(t.openBlock(),t.createElementBlock("li",{key:C.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":M===u.value,"is-selected":C.groupCode===e.modelValue}]),role:"option","aria-selected":C.groupCode===e.modelValue,onMousedown:S[2]||(S[2]=t.withModifiers(()=>{},["prevent"])),onClick:B=>b(C),onMouseenter:B=>u.value=M},t.toDisplayString(t.unref(is)(C)),43,fI))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",pI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),hI=["aria-labelledby"],yI=["aria-checked","tabindex","onClick","onKeydown"],Af=We(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,yI))),128))],8,hI))}}),[["__scopeId","data-v-5c793bbb"]]),gI=["disabled"],bI={class:"em-aw__toolbar"},_I={class:"em-aw__count"},kI={class:"em-aw__scroll"},EI={class:"em-aw__table"},NI={class:"c-name"},wI={class:"c-type"},II={class:"c-logical"},vI=["id"],CI={class:"c-col"},xI={class:"c-constraints"},SI={class:"c-del"},RI={class:"c-expand"},AI=["title","onClick","onKeydown"],$I=["title"],TI=["title"],MI={key:1,class:"em-aw__muted"},VI=["title"],BI=["title"],DI=["title"],OI={class:"em-aw__cflags"},LI=["title"],PI={colspan:"8"},zI={class:"em-aw__detail"},FI={class:"em-aw__dgroup"},UI=["title"],HI={class:"em-aw__df"},jI={class:"em-aw__df"},KI={class:"em-aw__dgroup"},GI={key:0,class:"em-aw__dgroup"},YI={class:"em-aw__df"},qI={key:0,class:"em-aw__df"},WI={class:"em-aw__df"},JI={class:"em-aw__dgroup em-aw__ddesc"},XI={class:"c-expand"},ZI={class:"em-aw__caret is-static","aria-hidden":"true"},QI={class:"c-del"},ev={class:"c-expand"},tv=["title","onClick","onKeydown"],nv={class:"em-aw__embed-label"},ov=["title"],iv=["title"],av={class:"em-aw__ro"},rv=["title"],lv={class:"em-aw__ro"},sv=["title"],cv={class:"em-aw__ro"},dv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},uv={colspan:"8"},mv={class:"em-aw__detail"},fv={class:"em-aw__dgroup"},pv={key:0,class:"em-aw__df"},hv={class:"em-aw__df"},yv={class:"em-aw__df"},gv={key:0},bv={colspan:"99",class:"em-aw__empty"},_v=6,kv=5,Ev=We(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:h,setRowName:f,isManagedFk:y,setNaturalId:k,setIdentifier:_,setTransient:E,dbLocked:N,fkDerived:p,fkOriginPhysical:b,typeValueOf:w,typeLabelOf:A,setAttrType:$,setAttrCustomType:L,setDb:T,scaleApplicable:S,scaleHint:C,setDbLogical:M,attrPiiValue:B,setAttrPii:g,predefinedCustomTypeCatalog:I,embeddableCatalog:v,predefinedLabel:O,groupCodeCatalog:x,attrGroupCodes:z,attrCodeItems:j,codeValueOf:ne,codeLabelOf:de,setAttrGroupCode:pe,setAttrCode:he,setAttrDefaultValue:fe,setAttrDescription:ye,isEmbedExpanded:_e,setDbAt:Re,setDbLogicalAt:ce,embedColMeta:le,fixedDataType:ae,fixedLength:se,fixedScale:ue,updatableItems:U,updatableLabel:F,updatableValue:H,setUpdatableAt:Z,setUpdatable:X,insertableItems:Ne,insertableLabel:me,insertableValue:Se,setInsertableAt:ve,setInsertable:G,sharedItems:q,sharedLabel:Y,sharedValue:xe,setSharedAt:Be,isShared:Ve,sharedPhysical:Le}=If(o,()=>n.entityId),oe=t.computed(()=>{var ze;return[...((ze=i.value)==null?void 0:ze.attributes)??[]].sort((Ie,J)=>Ie.order-J.order)}),we=t.computed(()=>{var ze;return(((ze=i.value)==null?void 0:ze.attributes)??[]).filter(Ie=>Ie.attrType!=="DIVIDER").length}),Fe=t.ref(new Set);function K(ze){return Fe.value.has(ze)}function V(ze){const Ie=new Set(Fe.value);Ie.has(ze)?Ie.delete(ze):Ie.add(ze),Fe.value=Ie}const W=t.ref(o.userLanguage.value);function Ce(ze){!ze||!i.value||o.addPredefinedEmbed(i.value.modelId,ze)}return(ze,Ie)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",bI,[t.createElementVNode("span",_I,t.toDisplayString(t.unref(o).t("em.attr.section",{n:we.value})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ie[0]||(Ie[0]=J=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:Ie[1]||(Ie[1]=J=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(v).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(v),"value-provider":J=>J.type,"label-provider":t.unref(O),"onUpdate:modelValue":Ce},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",kI,[t.createElementVNode("table",EI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[Ie[3]||(Ie[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",NI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",wI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",II,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,vI),t.createVNode(Af,{modelValue:W.value,"onUpdate:modelValue":Ie[2]||(Ie[2]=J=>W.value=J),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",CI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),Ie[4]||(Ie[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),Ie[5]||(Ie[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",xI,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),Ie[6]||(Ie[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe.value,J=>{var He,ot,bn,Ue,Ge,Q,kt,_n,kn,St;return t.openBlock(),t.createElementBlock(t.Fragment,{key:J.modelId},[J.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(J.modelId)}])},[Ie[7]||(Ie[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-divlabel-${J.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":J.name,"onUpdate:modelValue":ge=>t.unref(d)(J,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:_v,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",SI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,J.modelId)},null,8,["onClick"])])],2)):t.unref(_e)(J)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(J.modelId)}])},[t.createElementVNode("td",XI,[t.createElementVNode("span",ZI,[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${J.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":J.name,"onUpdate:modelValue":ge=>t.unref(d)(J,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-type-${J.modelId}`,width:"100%",disabled:"","model-value":J.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:kv,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:J.dbAttrs.length})),1),t.createElementVNode("td",QI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,J.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.dbAttrs,(ge,at)=>{var en,zt,tn,Ft,ke,lt,En,Nn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ge.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":K(ge.modelId)}])},[t.createElementVNode("td",ev,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":K(ge.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(K(ge.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:D=>V(ge.modelId),onKeydown:[t.withKeys(t.withModifiers(D=>V(ge.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(D=>V(ge.modelId),["prevent"]),["space"])]},[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,tv)]),t.createElementVNode("td",nv,"↳ "+t.toDisplayString(((en=t.unref(le)(J,at))==null?void 0:en.name)??((zt=t.unref(le)(J,at))==null?void 0:zt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:at+1})),1),Ie[14]||(Ie[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(mn,{name:`aw-embed-logical-${ge.modelId}`,languages:t.unref(o).languages.value,"active-lang":W.value,placeholder:((Ft=(tn=t.unref(le)(J,at))==null?void 0:tn.logicalName)==null?void 0:Ft[W.value])??((lt=(ke=t.unref(le)(J,at))==null?void 0:ke.logicalName)==null?void 0:lt.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ge.logicalName,"onUpdate:modelValue":D=>t.unref(ce)(J,at,D)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(Ve)(ge)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-embed-col-${ge.modelId}`,width:"100%",disabled:t.unref(Ve)(ge),placeholder:((En=t.unref(le)(J,at))==null?void 0:En.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Ve)(ge)?t.unref(Le)(ge):ge.physicalName,"onUpdate:modelValue":D=>t.unref(Re)(J,at,{physicalName:D})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(ao,{controller:t.unref(o),"ref-id":ge.modelId},null,8,["controller","ref-id"])],8,ov),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",av,t.toDisplayString(t.unref(ae)(J,at)),1)],8,iv),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",lv,t.toDisplayString(t.unref(se)(J,at)??""),1)],8,rv),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",cv,t.toDisplayString(t.unref(ue)(J,at)!=null?`scale ${t.unref(ue)(J,at)}`:""),1)],8,sv),Ie[15]||(Ie[15]=t.createElementVNode("td",null,null,-1))],2),K(ge.modelId)?(t.openBlock(),t.createElementBlock("tr",dv,[Ie[18]||(Ie[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",uv,[t.createElementVNode("div",mv,[t.createElementVNode("fieldset",fv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(Nn=t.unref(le)(J,at))!=null&&Nn.shareable?(t.openBlock(),t.createElementBlock("label",pv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(xe)(ge),items:t.unref(q)(),"value-provider":t.unref(c),"label-provider":t.unref(Y),"onUpdate:modelValue":D=>D&&t.unref(Be)(J,at,D)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",hv,[Ie[16]||(Ie[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(Ve)(ge),"model-value":t.unref(Ve)(ge)?"false":t.unref(Se)(ge),items:t.unref(Ne),"value-provider":t.unref(c),"label-provider":t.unref(me),"onUpdate:modelValue":D=>D&&t.unref(ve)(J,at,D)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",yv,[Ie[17]||(Ie[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(Ve)(ge),"model-value":t.unref(Ve)(ge)?"false":t.unref(H)(ge),items:t.unref(U),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":D=>D&&t.unref(Z)(J,at,D)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(r).has(J.modelId),"em-aw__open":K(J.modelId)})},[t.createElementVNode("td",RI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":K(J.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(K(J.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>V(J.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>V(J.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>V(J.modelId),["prevent"]),["space"])]},[t.createVNode($e,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,AI)]),t.createElementVNode("td",{title:t.unref(u)(J)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${J.modelId}`,width:"100%",placeholder:t.unref(h)(J),"model-value":t.unref(m)(J),"onUpdate:modelValue":ge=>t.unref(f)(J,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,$I),t.createElementVNode("td",{title:t.unref(p)(J)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-type-${J.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!J.groupCode||J.attrType==="RELATION_REF"||t.unref(p)(J),items:t.unref(rc)(J.type,t.unref(I)),"value-provider":t.unref(w),"label-provider":t.unref(A),"model-value":J.type,"onUpdate:modelValue":ge=>t.unref($)(J,ge)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),J.type===t.unref(an)&&!t.unref(p)(J)?(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:0,name:`aw-customtype-${J.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":J.customType??"","onUpdate:modelValue":ge=>t.unref(L)(J,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,TI),t.createElementVNode("td",null,[J.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(mn,{key:0,name:`aw-logical-${J.modelId}`,languages:t.unref(o).languages.value,"active-lang":W.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(He=J.dbAttrs[0])==null?void 0:He.logicalName,"onUpdate:modelValue":ge=>t.unref(M)(J,ge)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",MI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-col-${J.modelId}`,width:"100%",placeholder:t.unref(b)(J)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(N)(J),"model-value":((ot=J.dbAttrs[0])==null?void 0:ot.physicalName)??"","onUpdate:modelValue":ge=>t.unref(T)(J,{physicalName:ge})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(ao,{controller:t.unref(o),"ref-id":(bn=J.dbAttrs[0])==null?void 0:bn.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(p)(J)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-dtype-${J.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(N)(J)||t.unref(p)(J),items:t.unref(oc)(((Ue=J.dbAttrs[0])==null?void 0:Ue.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Ar),"model-value":((Ge=J.dbAttrs[0])==null?void 0:Ge.dataType)??"","onUpdate:modelValue":ge=>ge&&t.unref(T)(J,{dataType:ge})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,VI),t.createElementVNode("td",{title:t.unref(p)(J)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-len-${J.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(N)(J)||t.unref(p)(J),"model-value":(Q=J.dbAttrs[0])==null?void 0:Q.length,"onUpdate:modelValue":ge=>t.unref(T)(J,{length:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,BI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(p)(J)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",OI,[t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-pk-${J.modelId}`,label:"PK","model-value":J.identifier,disabled:t.unref(a)||t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(_)(J,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nn-${J.modelId}`,label:"NN","model-value":J.notNull,disabled:t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(d)(J,{notNull:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-uq-${J.modelId}`,label:"UQ","model-value":!!((kt=J.dbAttrs[0])!=null&&kt.unique),disabled:t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(T)(J,{unique:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,DI),t.createElementVNode("td",{class:"c-del",title:t.unref(y)(J)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,J.modelId)},null,8,["onClick"])],8,LI)],2),K(J.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(J.modelId)}])},[Ie[13]||(Ie[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",PI,[t.createElementVNode("div",zI,[t.createElementVNode("fieldset",FI,[Ie[11]||(Ie[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(C)(J)},[Ie[8]||(Ie[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-scale-${J.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(N)(J)||t.unref(p)(J)||!t.unref(S)(J),"model-value":(_n=J.dbAttrs[0])==null?void 0:_n.scale,"onUpdate:modelValue":ge=>t.unref(T)(J,{scale:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,UI),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-ai-${J.modelId}`,label:"Auto Increment","model-value":!!((kn=J.dbAttrs[0])!=null&&kn.autoIncrement),disabled:t.unref(N)(J)||t.unref(p)(J)||!J.identifier,"onUpdate:modelValue":ge=>t.unref(T)(J,{autoIncrement:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",HI,[Ie[9]||(Ie[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-ins-${J.modelId}`,width:"110px",disabled:t.unref(N)(J),"model-value":t.unref(Se)(J.dbAttrs[0]),items:t.unref(Ne),"value-provider":t.unref(c),"label-provider":t.unref(me),"onUpdate:modelValue":ge=>ge&&t.unref(G)(J,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",jI,[Ie[10]||(Ie[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-upd-${J.modelId}`,width:"110px",disabled:t.unref(N)(J),"model-value":t.unref(H)(J.dbAttrs[0]),items:t.unref(U),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":ge=>ge&&t.unref(X)(J,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",KI,[Ie[12]||(Ie[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-tr-${J.modelId}`,label:"@Transient","model-value":!!J.transient,disabled:J.identifier||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(E)(J,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nid-${J.modelId}`,label:"@NaturalId","model-value":!!J.naturalId,disabled:J.identifier||t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(k)(J,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${J.modelId}`,label:"mutable","model-value":!!J.naturalIdMutable,disabled:t.unref(N)(J)||!J.naturalId,"onUpdate:modelValue":ge=>t.unref(d)(J,{naturalIdMutable:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-mv-${J.modelId}`,label:"Multi-Value (Set)","model-value":!!((St=J.dbAttrs[0])!=null&&St.multiValue),disabled:t.unref(N)(J)||t.unref(p)(J),"onUpdate:modelValue":ge=>t.unref(T)(J,{multiValue:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(p)(J)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",GI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",YI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(B)(J),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":ge=>ge&&t.unref(g)(J,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(x).length?(t.openBlock(),t.createElementBlock("label",qI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Rf,{"model-value":J.groupCode,items:t.unref(x),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ge=>t.unref(pe)(J,ge)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",WI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(z)(J).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"150px","model-value":J.defaultValue??"none",items:t.unref(j)(J),"value-provider":t.unref(ne),"label-provider":t.unref(de),"onUpdate:modelValue":ge=>ge&&t.unref(he)(J,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`aw-default-${J.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":J.defaultValue??"","onUpdate:modelValue":ge=>t.unref(fe)(J,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",JI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`aw-desc-${J.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":J.description,"onUpdate:modelValue":ge=>t.unref(ye)(J,ge)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",gv,[t.createElementVNode("td",bv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,gI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-65126a6b"]]);function as(e,n){return n&&n!==e?`${e} (${n})`:e}function $f(e,n,o){const i=e.dbAttrs[n];return i?qo(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function Tf(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):as(o,$f(e,0,n))}function Mf(e,n){var l;if(Ln(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?as(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return as(i,$f(o,r<0?0:r,n))}const Nv=["disabled"],wv={class:"em-idxw__list"},Iv={class:"em-idxw__list-head"},vv=["aria-label"],Cv=["aria-current","onClick","onKeydown"],xv={class:"em-idxw__item-name"},Sv={key:0,class:"em-idxw__badge"},Rv={class:"em-idxw__item-cnt"},Av={key:0,class:"em-idxw__empty"},$v={key:0,class:"em-idxw__edit"},Tv={class:"em-idxw__form"},Mv={class:"em-field em-idxw__name"},Vv={class:"em-field"},Bv=["value","placeholder"],Dv={class:"em-idxw__transfer"},Ov={class:"em-idxw__pane"},Lv={class:"em-idxw__pane-head"},Pv=["aria-label"],zv=["aria-pressed","onClick","onKeydown"],Fv=["title"],Uv={key:0,class:"em-idxw__empty"},Hv={class:"em-idxw__arrows"},jv={class:"em-idxw__pane"},Kv={class:"em-idxw__pane-head"},Gv={class:"em-idxw__col-name"},Yv=["title"],qv={class:"em-idxw__col-ops"},Wv=["title","disabled","onClick"],Jv=["title","disabled","onClick"],Xv=["title","onClick"],Zv={key:0,class:"em-idxw__empty"},Qv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},eC=We(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(g=>g.modelId===n.entityId)??null),a=t.computed(()=>{var g;return((g=i.value)==null?void 0:g.indexes)??[]}),r=t.computed(()=>{var g;return((g=i.value)==null?void 0:g.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,g=>{var I;g.some(v=>v.modelId===s.value)||(s.value=((I=g[0])==null?void 0:I.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(g=>g.modelId===s.value)??null),d=t.computed(()=>i.value?Go(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>On(r.value)),m=g=>u.value.canon(g),h=t.computed(()=>{var g;return new Set((((g=c.value)==null?void 0:g.columns)??[]).map(I=>m(I.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function y(g){return Tf(g,f.value)}function k(g){return g.physicalName&&g.physicalName!==g.field?`${g.field} (${g.physicalName})`:g.field}function _(g){return Mf(g,f.value)}const E=t.computed(()=>[...r.value.filter(g=>g.dbAttrs.length>0&&!h.value.has(m(g.modelId))).map(g=>({ref:g.modelId,label:y(g),inherited:!1})),...d.value.filter(g=>!h.value.has(m(g.modelId))).map(g=>({ref:g.modelId,label:k(g),inherited:!0}))]),N=t.ref(new Set);t.watch(s,()=>N.value=new Set);function p(g){return Ln(g)}function b(g,I){i.value&&o.updateIndex(i.value.modelId,g,I)}function w(){var I;if(!i.value)return;const g=De();o.addIndex(i.value.modelId,{modelId:g,name:`idx_${(((I=i.value.indexes)==null?void 0:I.length)??0)+1}`,unique:!1,columns:[]}),s.value=g}function A(g){i.value&&o.removeIndex(i.value.modelId,g)}function $(g){c.value&&b(c.value.modelId,{parameters:g.trim()===""?void 0:g})}function L(g){const I=new Set(N.value);I.has(g)?I.delete(g):I.add(g),N.value=I}function T(){const g=c.value;if(!g||!N.value.size)return;const I=[...N.value].map(v=>({columnRef:v,descending:!1}));b(g.modelId,{columns:[...g.columns,...I]}),N.value=new Set}function S(g){const I=c.value;I&&b(I.modelId,{columns:I.columns.filter((v,O)=>O!==g)})}function C(g,I){const v=c.value;v&&b(v.modelId,{columns:v.columns.map((O,x)=>x===g?{...O,descending:I}:O)})}function M(g,I){const v=c.value;if(!v)return;const O=g+I;if(O<0||O>=v.columns.length)return;const x=[...v.columns];[x[g],x[O]]=[x[O],x[g]],b(v.modelId,{columns:x}),B(O,I)}async function B(g,I){var j,ne;await t.nextTick();const v=(j=l.value)==null?void 0:j.querySelectorAll(".em-idxw__col--idx")[g];if(!v)return;const O=de=>v.querySelector(`[data-move="${de}"]`),x=O(I<0?"up":"down"),z=O(I<0?"down":"up");(ne=x&&!x.disabled?x:z)==null||ne.focus()}return(g,I)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",wv,[t.createElementVNode("div",Iv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:w},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":v.modelId===s.value}]),role:"button",tabindex:"0","aria-current":v.modelId===s.value?"true":void 0,onClick:O=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(O=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",xv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",Sv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",Rv,t.toDisplayString(v.columns.length),1)],42,Cv))),128))],8,vv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Av,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",$v,[t.createElementVNode("div",Tv,[t.createElementVNode("label",Mv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":I[0]||(I[0]=v=>b(c.value.modelId,{name:v}))},null,8,["model-value"]),t.createVNode(ao,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":I[1]||(I[1]=v=>b(c.value.modelId,{unique:v}))},null,8,["model-value"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:I[2]||(I[2]=v=>A(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",Vv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:I[3]||(I[3]=v=>$(v.target.value))},null,40,Bv)]),t.createElementVNode("div",Dv,[t.createElementVNode("div",Ov,[t.createElementVNode("div",Lv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:E.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:E.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":N.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":N.value.has(v.ref),onClick:O=>L(v.ref),onKeydown:[t.withKeys(t.withModifiers(O=>L(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>L(v.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(v.label),1),v.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Fv)):t.createCommentVNode("",!0)],42,zv))),128))],8,Pv),E.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Uv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",Hv,[t.createVNode(t.unref(ee.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!N.value.size,onClick:T},null,8,["caption","disabled"])]),t.createElementVNode("div",jv,[t.createElementVNode("div",Kv,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(v,O)=>(t.openBlock(),t.createElementBlock("li",{key:O,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",Gv,[t.createTextVNode(t.toDisplayString(_(v.columnRef)),1),p(v.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Yv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idxw-desc-${O}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":x=>C(O,x)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",qv,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:O===0,onClick:x=>M(O,-1)},"↑",8,Wv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:O===c.value.columns.length-1,onClick:x=>M(O,1)},"↓",8,Jv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:x=>S(O)},"✕",8,Xv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Zv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",Qv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,Nv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),tC={class:"em-op-src"},nC=["placeholder"],oC={class:"em-op-src__actions"},Vf=We(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(l,s)=>Dt(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",tC,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,nC),[[t.vModelText,a.value]]),t.createElementVNode("div",oC,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),iC=["disabled"],aC={class:"em-ow__toolbar"},rC={class:"em-ow__count"},lC={class:"em-ow__scroll"},sC={class:"em-ow__table"},cC={class:"c-name"},dC={class:"c-desc"},uC=["id"],mC={class:"c-pii"},fC={class:"c-src"},pC={class:"c-del"},hC={key:0},yC={colspan:"6",class:"em-ow__empty"},gC=We(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModal(),a=t.computed(()=>o.state.logical.entities.find(_=>_.modelId===n.entityId)??null),r=t.computed(()=>{var _;return[...((_=a.value)==null?void 0:_.operations)??[]].sort((E,N)=>E.order-N.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(_){return _==="none"?o.t("em.common.noneParen"):_}const u=_=>_;function m(_,E){a.value&&o.updateOperation(a.value.modelId,_.modelId,E)}function h(_,E){m(_,{description:Object.keys(E).length?E:void 0})}function f(_){return _.personalInfoAttributeType??"none"}function y(_,E){m(_,{personalInfoAttributeType:E==="none"?void 0:E})}function k(_){i.openModal({component:Vf,bind:{operationName:_.name,sourceCode:_.sourceCode??"",locale:o.uiLocale.value,onSave:E=>m(_,{sourceCode:E})}})}return(_,E)=>{var N,p;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",aC,[t.createElementVNode("span",rC,t.toDisplayString(t.unref(o).t("em.op.section",{n:((N=a.value.operations)==null?void 0:N.length)??0})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:E[0]||(E[0]=b=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",lC,[t.createElementVNode("table",sC,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",cC,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),E[2]||(E[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",dC,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,uC),t.createVNode(Af,{modelValue:l.value,"onUpdate:modelValue":E[1]||(E[1]=b=>l.value=b),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",mC,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",fC,t.toDisplayString(t.unref(o).t("em.op.body")),1),E[3]||(E[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,b=>(t.openBlock(),t.createElementBlock("tr",{key:b.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`ow-name-${b.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":b.name,"onUpdate:modelValue":w=>m(b,{name:w})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":b.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":w=>w&&m(b,{visibility:w})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(mn,{name:`ow-desc-${b.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":b.description,"onUpdate:modelValue":w=>h(b,w)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":f(b),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":w=>w&&y(b,w)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t(b.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:w=>k(b)},null,8,["caption","onClick"])]),t.createElementVNode("td",pC,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeOperation(a.value.modelId,b.modelId)},null,8,["onClick"])])]))),128)),(p=a.value.operations)!=null&&p.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",hC,[t.createElementVNode("td",yC,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,iC)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),bC={class:"em-detail__tabs"},_C=["onClick"],kC={key:0,class:"em-detail__lock"},EC=["disabled"],NC={key:0,class:"em-detail__narrow"},wC=We(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",bC,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:h=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,_C)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",kC,[t.createVNode($e,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",NC,[t.createVNode(Nf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(Ev,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(eC,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(gC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,EC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Ja(e,n,o){e.openModal({component:wC,bind:{controller:t.markRaw(n),entityId:o}})}function fn(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>pd(e,r))}function Ot(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of Gd(l,r))i.push(ma(a,s.indexRef,{columns:s.columns}))}return i}function Xa(e,n,o,i){var c;const a=[];a.push(...fn(n,o.remove,i));for(const d of o.update)a.push(Kt(n,d.attributeId,d.patch));for(const d of o.add)a.push(jt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const h=l.filter(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,y)=>f.order-y.order)[0];h&&a.push(Tt(d.modelId,"end2",{attributeRef:h.modelId}))}return a}function Lo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function vi(e,n,o){const i=[];for(const[a,r]of Ic(e,n,De))i.push(...Xa(e,a,r,o));for(const a of Yd(e,n,De))i.push(Kt(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function IC(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Xr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return qd(e,n,r).map(l=>Kt(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function Bf(e,n,o){return Wd(e,n,o).map(i=>Kt(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function vC(e,n,o){const i=new Set(o.remove);return Lo(e,n,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function Za(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of vc(e,r,De)){const c=i.get(l);i.set(l,c?wc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...Xa(e,r,CC(l),o));return a}function CC(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function Df(e){return nn(e).map(n=>({...n.col,modelId:De()}))}function xC(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=Rt(o.attributes),h=new Set(o.attributes.map(y=>y.name));let f="id";for(let y=2;h.has(f);y++)f=`id${y}`;a={modelId:De(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:De(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(jt(n,a))}const r=[];for(const m of e.entities)for(const h of m.attributes){if(((u=h.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(E=>E.modelId===h.embedded.associationRef);if(!f)continue;const y=f.end1.entityRef===m.modelId,k=y?f.end1:f.end2,_=y?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:h.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:k.multiplicity,navigable:k.navigable,composition:!1},end2:{entityRef:n,multiplicity:_.multiplicity,navigable:_.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const h=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return h.size?{...m,attributes:m.attributes.filter(f=>!h.has(f.modelId))}:m}),associations:e.associations.map(m=>{const h=r.find(f=>f.assocId===m.modelId);return h?{...m,end1:h.end1,end2:h.end2}:m})},s=Xo(l,n,De);for(const m of r){const h=s.add.find(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===m.assocId});h&&(m.end2.attributeRef=h.modelId)}const c=[];for(const m of r)i.push(...fn(m.ownerId,[m.dispId],c)),i.push(ua(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Xa(l,n,s,c));const d=vC(l,n,s);return i.push(...vi(d,n,c)),i.push(...Ot(e,c)),i}function SC(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(p=>p.modelId===c);if(!d||d.attributes.some(p=>{var b;return((b=p.embedded)==null?void 0:b.associationRef)===r.modelId}))continue;const u=De(),m=Rt(d.attributes),h=new Set(d.attributes.map(p=>p.name)),f=a(o.name);let y=f;for(let p=2;h.has(y);p++)y=`${f}${p}`;const k=o.attributes.filter(p=>!p.identifier&&!p.derivedFrom).flatMap(p=>p.dbAttrs).map(p=>({...p,modelId:De()})),_={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:k,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(jt(c,_));const E=l?"end2":"end1",N=l?"end1":"end2";i.push(ua(r.modelId,{identifying:!1,[E]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:De()},[N]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Of(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[dd(n,o),...i.map(u=>vo(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const h=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);h&&h.waypoints.length&&c.push(Cd(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const h=e.layout.notes.find(f=>f.modelId===m);h&&c.push(ii(m,{x:h.geo.location.x+l,y:h.geo.location.y+s}))}}return c}function RC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=De(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},h={...n.logical,associations:[...n.logical.associations,m]},f=Xo(h,s,De),y=f.add[0];y&&(m.end2.attributeRef=y.modelId);const k={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},_=da(m,k),E=Xa(h,s,f,[]);return i(E.length?Qe("관계 추가",[_,...E]):_),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(A=>A.modelId===l),d=n.logical.entities.find(A=>A.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=De(),m=De(),h=De(),f=Rt(c.attributes),y=Df(d),k=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),_=new Set(c.attributes.map(A=>A.name)),E=k(d.name);let N=E;for(let A=2;_.has(N);A++)N=`${E}${A}`;const p={modelId:m,name:N,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},b={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:h},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},w={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(Qe("임베드 추가",[jt(l,p),da(b,w)])),u},setEmbedCardinality(l,s){var E;if(r(l))return;const c=n.logical.associations.find(N=>N.modelId===l);if(!c)return;let d,u;for(const N of n.logical.entities){const p=N.attributes.find(b=>{var w;return((w=b.embedded)==null?void 0:w.associationRef)===l&&b.attrType==="EMBED_OWN"});if(p){d=N.modelId,u=p;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,h=c.end2.entityRef===m?"end2":"end1",f=c[h];if(f.multiplicity===s)return;const y=N=>N==="ZERO_OR_MORE_INSTANCES"||N==="ONE_OR_MORE_INSTANCES",k=y(f.multiplicity),_=y(s);if(k===_){i(Tt(l,h,{multiplicity:s}));return}if(_)i(Qe("임베드 컬렉션 전환",[Kt(d,u.modelId,{dbAttrs:[]}),Tt(l,h,{multiplicity:s,jpa:{...f.jpa,collectionType:((E=f.jpa)==null?void 0:E.collectionType)??"LIST"}})]));else{const N=n.logical.entities.find(p=>p.modelId===m);if(!N)return;i(Qe("임베드 단일 전환",[Kt(d,u.modelId,{dbAttrs:Df(N)}),Tt(l,h,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=Ed(l);if(!s){i(c);return}for(const f of n.logical.entities){const y=f.attributes.find(k=>{var _;return((_=k.embedded)==null?void 0:_.associationRef)===l});if(y){const k=[];i(Qe("임베드 삭제",[c,...fn(f.modelId,[y.modelId],k),...Ot(n.logical,k)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],h=Za(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(k=>k.modelId===s.end1.entityRef),y=f==null?void 0:f.attributes.find(k=>k.modelId===s.end1.attributeRef&&k.attrType==="RELATION_REF");y&&h.push(...fn(f.modelId,[y.modelId],m))}h.push(...Ot(n.logical,m)),i(h.length?Qe("관계 삭제",[c,...h]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=ua(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(y=>y.modelId===l?{...y,identifying:s}:y)},h=[],f=Za(m,[u],h);f.push(...Ot(n.logical,h)),i(f.length?Qe("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.modelId===d.end2.entityRef),h=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!h){if(c.navigable===!0&&!d.end1.attributeRef){const f=Ki(d.end2.multiplicity),y=d.end1.navFieldNameHint||Yi(m.name,f),k=ho(y,new Set(u.attributes.map(p=>p.name))),_=De(),E=Rt(u.attributes),N={modelId:_,name:k,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:E,dbAttrs:[]};i(Qe("inverse nav 추가",[jt(d.end1.entityRef,N),Tt(l,"end1",{...c,attributeRef:_,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,y=u.attributes.find(N=>N.modelId===f&&N.attrType==="RELATION_REF"),k=Tt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),_=[],E=y?fn(d.end1.entityRef,[f],_):[];i(y?Qe("inverse nav 제거",[...E,k,...Ot(n.logical,_)]):k);return}}}i(Tt(l,s,c))}}}function AC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,h)=>{if(a(u))return;const f=Kt(u,m,h),y=Lo(n.logical,u,E=>E.map(N=>N.modelId===m?{...N,...h}:N)),k=[],_=vi(y,u,k);_.push(...Ot(n.logical,k)),i(_.length?Qe("속성 수정",[f,..._]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const h=r.value.find(N=>N.type===m),f=n.logical.entities.find(N=>N.modelId===u);if(!h||!f)return null;const y=Rt(f.attributes),k=De(),_=h.fields.map(()=>({modelId:De(),physicalName:"",dataType:""})),E={modelId:k,name:h.defaultName,type:h.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:_};return i(jt(u,E)),k},addAttribute(u,m={}){if(!o.value||a(u))return null;const h=n.logical.entities.find(w=>w.modelId===u),f=h?Rt(h.attributes):0,y=m.modelId??De(),k=m.name??`field${f}`,_={modelId:y,name:k,type:m.type??Tr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:De(),physicalName:k,dataType:"VARCHAR"}],...m},E=jt(u,_),N=Lo(n.logical,u,w=>[...w,_]),p=[],b=vi(N,u,p);return b.push(...Ot(n.logical,p)),i(b.length?Qe("속성 추가",[E,...b]):E),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(k=>k.modelId===u),h=m?Rt(m.attributes):0,f=De();return i(jt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:h,dbAttrs:[]})),f},updateAttribute(u,m,h){d(u,m,h)},setAttributeGroupCode(u,m,h){d(u,m,{groupCode:h,type:h?zn:Tr})},setEmbedColumns(u,m,h){var N,p;if(a(u))return;const f=Kt(u,m,{dbAttrs:h}),y=(N=n.logical.entities.find(b=>b.modelId===u))==null?void 0:N.attributes.find(b=>b.modelId===m),k=(p=y==null?void 0:y.embedded)==null?void 0:p.associationRef,_=k?n.logical.associations.find(b=>b.modelId===k):void 0,E=[];_&&k&&(_.end1.legacyEmbedRaw&&E.push(Tt(k,"end1",{legacyEmbedRaw:void 0})),_.end2.legacyEmbedRaw&&E.push(Tt(k,"end2",{legacyEmbedRaw:void 0}))),i(E.length?Qe("임베드 컬럼 수정",[f,...E]):f)},removeAttribute(u,m){if(a(u))return;if(ko(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const h=[],f=fn(u,[m],h),y=Lo(n.logical,u,E=>E.filter(N=>N.modelId!==m)),k=[...vi(y,u,h),...Ot(n.logical,h),...Bf(n.logical,u,[m])],_=[...f,...k];i(_.length===1?_[0]:Qe("속성 삭제",_))},removeAttributes(u,m){var N;if(!m.length||a(u))return;const h=m.filter(p=>!ko(n.logical,u,p));if(h.length<m.length&&s(l("em.attr.fkDeleteHint")),!h.length)return;const f=[],y=fn(u,h,f),k=new Set(h),_=Lo(n.logical,u,p=>p.filter(b=>!k.has(b.modelId))),E=[...y,...vi(_,u,f),...Ot(n.logical,f),...Bf(n.logical,u,h)];i(E.length===1?E[0]:Qe("속성 삭제",E)),((N=c.value)==null?void 0:N.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,h){i(la(u,m,h))},setAttributeSwatches(u,m,h){m.length&&(m.length===1?i(la(u,m[0],h)):i(Qe("속성 색상",m.map(f=>la(u,f,h)))))},reorderAttributes(u,m,h){if(!m.length||a(u))return;const f=sl(u,m,h),y=IC(n.logical,u,m,h);i(y.length?Qe("속성 재정렬",[f,...y]):f)}}}function $C(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=De(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=De();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=De()}for(const a of n.indexes??[]){a.modelId=De();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=De();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const TC=220;function MC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||TC));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of n.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of n.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const rs=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function VC(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const k=c.filter(_=>n.logical.entities.some(E=>E.modelId===_));if(k.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:k}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const k=n.logical.entities.find(E=>E.modelId===d.entityId);if(!k)return;const _=[...k.attributes].sort((E,N)=>E.order-N.order).filter(E=>d.ids.includes(E.modelId));if(!_.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:_}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(k=>k.modelId===u),h=n.layout.entityLayouts.find(k=>k.entityRef===u);if(!m)return;const f=(h==null?void 0:h.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(h){const{entityRef:k,geo:_,locked:E,...N}=h;Object.keys(N).length&&(y=N)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:y}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const y=n.logical.entities.find(b=>b.modelId===f);if(!y)return[];const k=new Set(y.attributes.map(b=>b.name)),_=new Set(y.attributes.flatMap(b=>b.dbAttrs.map(w=>w.physicalName))),E=Rt(y.attributes),N=[],p=c.attributes.map((b,w)=>{const A=JSON.parse(JSON.stringify(b));A.modelId=De();for(const $ of A.dbAttrs)$.modelId=De();k.has(A.name)&&(A.name=ho(`${A.name}_copy`,k)),k.add(A.name);for(const $ of A.dbAttrs)$.physicalName&&_.has($.physicalName)&&($.physicalName=ho(`${$.physicalName}_copy`,_)),$.physicalName&&_.add($.physicalName);return A.order=E+w,N.push(A.modelId),jt(f,A)});return l(p.length===1?p[0]:Qe("속성 붙여넣기",p)),i.value={kind:"attribute",entityId:f,ids:N,anchor:N[N.length-1]},[]}const{clone:d,idMap:u}=$C(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let h;if(c.layoutExtras){const f={...c.layoutExtras},y=k=>u.get(k);f.attributeStyles&&(f.attributeStyles=oa(f.attributeStyles,y)),f.operationStyles&&(f.operationStyles=oa(f.operationStyles,y)),h=f}return l(ra(d,m,h)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Gc(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const h=(u==null?void 0:u.placement)??"append-right",f=h==="append-right"?MC(n.layout,m.layout):h.offset,y=new Map(m.layout.entityLayouts.map(p=>[p.entityRef,p])),k=new Map(m.layout.associationLayouts.map(p=>[p.associationRef,p])),_=new Map(m.layout.groupLayouts.map(p=>[p.groupRef,p])),E=[];let N=80;for(const p of m.logical.entities){const b=y.get(p.modelId),w=b?{location:rs(b.geo.location,f),size:{...b.geo.size}}:{location:{x:N+=40,y:80},size:{width:220,height:140}};let A;if(b){const{entityRef:$,geo:L,locked:T,...S}=b;A=S}E.push(ra(p,w,A))}for(const p of m.logical.associations){const b=k.get(p.modelId),w=b?{...b,waypoints:b.waypoints.map(A=>rs(A,f))}:{associationRef:p.modelId,waypoints:[]};E.push(da(p,w))}for(const p of m.logical.groups){const b=_.get(p.modelId),w=b?{location:rs(b.geo.location,f),size:{...b.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(b){const{groupRef:$,geo:L,locked:T,memberNoteRefs:S,...C}=b;A=C}E.push(sa(p,w,A))}return l(Qe("다이어그램 가져오기",E)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(p=>p.modelId)}};return s}function BC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l}=e;return{addEntity(s="NewEntity",c={x:80,y:80}){if(!o.value)return null;const d=De(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:De(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:De(),physicalName:"id",dataType:"BIGINT"}]}]};return i(ra(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(nd(s,c))},updateEntity(s,c){if(a(s))return;const d=td(s,c),u=n.logical.entities.find(f=>f.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",h=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const f=u.attributes.filter(p=>p.identifier&&!p.derivedFrom).map(p=>Kt(s,p.modelId,{identifier:!1})),y=Lo({...n.logical,entities:n.logical.entities.map(p=>p.modelId===s?{...p,stereotype:"JPA_EMBEDDABLE"}:p)},s,p=>p.map(b=>b.identifier&&!b.derivedFrom?{...b,identifier:!1}:b)),k=[],_=Za(y,[s],k);_.push(...Ot(n.logical,k));const E=SC(n.logical,s),N=[d,...f,..._,...E];i(N.length>1?Qe("임베더블 변환",N):d);return}if(h){const f=xC(n.logical,s),y=[d,...f];i(y.length>1?Qe("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(vo(s,c))},resizeEntity(s,c){a(s)||i(od(s,c))},removeEntity(s){if(a(s))return;const c=ed(s);if(!n.logical.entities.find(_=>_.modelId===s)){i(c);return}const u=n.logical.associations.filter(_=>_.end1.entityRef===s||_.end2.entityRef===s),m=new Set(u.map(_=>_.modelId)),h=[],f=[];for(const _ of n.logical.entities)if(_.modelId!==s)for(const E of _.attributes)E.embedded&&m.has(E.embedded.associationRef)&&h.push(...fn(_.modelId,[E.modelId],f));for(const _ of u){if(_.end1.entityRef===s||!_.end1.attributeRef)continue;const E=n.logical.entities.find(p=>p.modelId===_.end1.entityRef),N=E==null?void 0:E.attributes.find(p=>p.modelId===_.end1.attributeRef&&p.attrType==="RELATION_REF");N&&h.push(...fn(E.modelId,[N.modelId],f))}const y={...n.logical,entities:n.logical.entities.filter(_=>_.modelId!==s),associations:n.logical.associations.filter(_=>!m.has(_.modelId))},k=new Set(u.filter(_=>_.end1.entityRef===s&&_.end2.entityRef!==s).map(_=>_.end2.entityRef));h.push(...Za(y,[...k],f)),h.push(...Ot(n.logical,f.filter(_=>_.entityId!==s))),i(h.length?Qe("엔티티 삭제",[c,...h]):c)},setEntitySwatch(s,c){i(id(s,c))},setEntityCollapsed(s,c){i(ad(s,c))},setEntityLocked(s,c){i(rd(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(ll(!0))},expandAll(){i(ll(!1))}}}function DC(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(E=>n.layout.entityLayouts.find(N=>N.entityRef===E)).filter(E=>!!E);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,h=1/0,f=-1/0,y=-1/0;for(const E of u){const N=E.geo.size.width||220,p=E.geo.size.height||140;m=Math.min(m,E.geo.location.x),h=Math.min(h,E.geo.location.y),f=Math.max(f,E.geo.location.x+N),y=Math.max(y,E.geo.location.y+p)}const k=40,_=28;return{location:{x:m-k,y:h-k-_},size:{width:f-m+k*2,height:y-h+k*2+_}}}return{dragGroup(d,u,m){l(d)||i(Qe("그룹 이동",Of(n,d,u,m)))},resizeGroup(d,u){l(d)||i(ud(d,u))},setGroupSwatch(d,u){i(md(d,u))},setGroupLocked(d,u){i(fd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(ld(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const k of d)y.memberEntityRefs.includes(k)&&m.push(ca(y.modelId,k));const h=De(),f={modelId:h,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(sa(f,c(d))),i(Qe("그룹 생성",m)),a.value=null,h},addEmptyGroup(d,u){if(!o.value)return null;const m=De();return i(sa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(sd(d))},dropEntity(d,u,m){var y;if(r(d))return;const h=((y=n.logical.groups.find(k=>k.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,f=[vo(d,u)];h!==m&&(h&&f.push(ca(h,d)),m&&f.push(cd(m,d))),i(Qe("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(ca(u.modelId,d))},dropNote(d,u,m){var y;const h=((y=n.layout.groupLayouts.find(k=>{var _;return(_=k.memberNoteRefs)==null?void 0:_.includes(d)}))==null?void 0:y.groupRef)??null,f=[ii(d,u)];h!==m&&(h&&f.push(Bd(h,d)),m&&f.push(Vd(m,d))),i(Qe("이동",f))}}}function OC(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(k,_){if(d(),!o.value||!e.opTransport)return;const E=new Hd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:N=>{i.value=!1,a.value=N},onError:e.onOpError});E.seed((_==null?void 0:_.revSeed)??{}),c=E.attach(k),s=E}const m=t.computed(()=>o.value&&r!==void 0),h=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function y(k){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let _;try{_=await l(k)}catch(E){return{ok:!1,reason:E instanceof Error?E.message:String(E)}}return _.ok&&h.value++,_}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:y,reloadRequest:h}}function LC(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=De();return o(Rd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(Ad(i))},moveNote(i,a){o(ii(i,a))},resizeNote(i,a){o($d(i,a))},setNoteMemo(i,a){o(Td(i,a))},setNoteSwatch(i,a){o(Md(i,a))},addNoteConnection(i,a){o(Dd(i,a))},removeNoteConnection(i,a){o(Od(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Ld(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Pd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(zd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Fd(i,a))}}}function PC(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const h=o.value,f=(h==null?void 0:h.kind)==="attribute"&&h.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const b=h.ids.includes(u),w=b?h.ids.filter($=>$!==u):[...h.ids,u];if(!w.length){o.value=null;return}const A=b&&h.anchor===u?w[w.length-1]:b?h.anchor:u;o.value={kind:"attribute",entityId:d,ids:w,anchor:A};return}const y=n.logical.entities.find(b=>b.modelId===d),k=[...(y==null?void 0:y.attributes)??[]].sort((b,w)=>b.order-w.order).map(b=>b.modelId),_=k.indexOf(h.anchor),E=k.indexOf(u);if(_<0||E<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[N,p]=_<=E?[_,E]:[E,_];o.value={kind:"attribute",entityId:d,ids:k.slice(N,p+1),anchor:h.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(k=>k.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const h=m.attributes.findIndex(k=>k.modelId===u.anchor);if(h<0)return!1;const f=Math.min(Math.max(h+d,0),m.attributes.length-1);if(f===h)return!0;const y=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[y],anchor:y},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(b=>b.modelId===u.entityId);if(!m)return!1;const h=m.attributes,f=new Set(u.ids),y=h.map((b,w)=>f.has(b.modelId)?w:-1).filter(b=>b>=0);if(!y.length)return!1;const k=Math.min(...y),_=h.filter(b=>!f.has(b.modelId)),E=h.slice(0,k).filter(b=>!f.has(b.modelId)).length;let N;if(d<0){if(E<=0)return!0;N=E-1}else{if(_.length-E<=0)return!0;N=E+1}if(r(u.entityId))return!0;const p=h.filter(b=>f.has(b.modelId)).map(b=>b.modelId);return a(sl(u.entityId,p,N)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const h=new Set(n.logical.entities.map(N=>N.modelId)),f=new Set(n.logical.groups.map(N=>N.modelId)),y=new Set(n.layout.notes.map(N=>N.modelId)),k=new Set;for(const N of d){if(!f.has(N))continue;const p=n.logical.groups.find(b=>b.modelId===N);for(const b of(p==null?void 0:p.memberEntityRefs)??[])k.add(b)}const _=[],E=[];for(const N of d)if(f.has(N)){if(s(N))continue;const p=n.layout.groupLayouts.find($=>$.groupRef===N);if(!p)continue;const b=n.logical.groups.find($=>$.modelId===N),w=((b==null?void 0:b.memberEntityRefs)??[]).map($=>{var T;const L=((T=n.layout.entityLayouts.find(S=>S.entityRef===$))==null?void 0:T.geo.location)??{x:0,y:0};return{id:$,location:{x:L.x+u,y:L.y+m}}}),A={x:p.geo.location.x+u,y:p.geo.location.y+m};_.push(Qe("그룹 이동",Of(n,N,A,w))),E.push("g:"+N)}else if(h.has(N)){if(k.has(N)||l(N))continue;const p=n.layout.entityLayouts.find(b=>b.entityRef===N);if(!p)continue;_.push(vo(N,{x:p.geo.location.x+u,y:p.geo.location.y+m})),E.push("e:"+N)}else if(y.has(N)){const p=n.layout.notes.find(b=>b.modelId===N);if(!p)continue;_.push(ii(N,{x:p.geo.location.x+u,y:p.geo.location.y+m})),E.push("n:"+N)}return _.length?(a(Qe("이동",_,"nudge:"+E.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const ro=Symbol("editorController");function Lf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function zC(e=Lf(),n={}){var we,Fe,K;const o=t.reactive(e);let i=new rl(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),u=t.ref(n.uiLocale??"ko"),m=(V,W)=>Dt(u.value,V,W),h=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),k=t.ref(n.flagEntitiesWithoutRelations??!1),_=t.ref(!1),E=t.ref(!1),N=t.ref(!1),p=t.ref(0),b=t.ref(null);let w=0;const A=V=>{if(n.onNotice){n.onNotice(V);return}b.value={text:V,id:++w}},$=t.ref(((we=n.meta)==null?void 0:we.schemaVersion)??1),L=t.ref(((Fe=n.meta)==null?void 0:Fe.opWriteEnabled)??!1),T=t.ref(((K=n.meta)==null?void 0:K.referenceOnly)??!1),S=t.computed(()=>$.value>=2&&L.value),C=t.ref(!($.value>=2&&L.value===!1)),M=t.ref("LOGICAL_PHYSICAL"),B=t.ref("straight"),g=t.ref(!0),I=t.ref(!0),v=t.ref(null),O=t.computed(()=>{var V;return((V=v.value)==null?void 0:V.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),x=t.computed(()=>{var V;return((V=v.value)==null?void 0:V.kind)==="attribute"?v.value.ids:[]}),z=t.computed(()=>{var V,W;return((V=v.value)==null?void 0:V.kind)==="entity"?v.value.id:((W=v.value)==null?void 0:W.kind)==="attribute"?v.value.entityId:null}),j=t.ref(null),ne=t.ref(null),de=t.ref(null),pe=t.ref(null),he=OC({state:o,opMode:S,editable:C,opConflict:de,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function fe(){i.onChange(()=>{_.value=i.canUndo,E.value=i.canRedo,N.value=i.isDirty,p.value++})}fe(),he.setupOpAdapter(i,n.meta);const ye=t.computed(()=>Vs(o.logical,o.layout)),_e=t.computed(()=>({reservedWords:h.value,selectableDataTypes:f.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:k.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Re=()=>Cr(o.logical,T.value),ce=n.validationDebounceMs??250;let le,ae=()=>{};if(ce>0){const V=t.shallowRef(Qi(Re(),_e.value));let W;ae=()=>{W!==void 0&&(clearTimeout(W),W=void 0),V.value=Qi(Re(),_e.value)},t.watch([p,_e,T],()=>{W!==void 0&&clearTimeout(W),W=setTimeout(ae,ce)},{flush:"sync"}),le=t.computed(()=>V.value)}else le=t.computed(()=>Qi(Re(),_e.value));const se=t.computed(()=>{const V=new Map;for(const W of le.value){if(!W.targetRef)continue;const Ce=V.get(W.targetRef);Ce?Ce.push(W):V.set(W.targetRef,[W])}return V}),ue=1500,U=new Map,F=V=>{const W=Date.now();W-(U.get(V)??0)<ue||(U.set(V,W),A(V))},H=V=>{if(!pe.value){if(!C.value){F(m("em.notice.readOnly"));return}try{i.execute(V)}catch(W){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${V.label}):`,W),C.value=!1,pe.value={label:V.label}}}},Z=V=>o.layout.entityLayouts.some(W=>W.entityRef===V&&!!W.locked),X=V=>o.layout.groupLayouts.some(W=>W.groupRef===V&&!!W.locked),Ne=V=>{const W=o.logical.associations.find(Ce=>Ce.modelId===V);return!!W&&(Z(W.end1.entityRef)||Z(W.end2.entityRef))},me=V=>Z(V)?(F(m("em.notice.entityLocked")),!0):!1,Se=V=>X(V)?(F(m("em.notice.groupLocked")),!0):!1,ve=V=>Ne(V)?(F(m("em.notice.assocLocked")),!0):!1,G=VC({state:o,clipboard:ne,selection:v,inspectedEntityId:z,editable:C,run:H}),q=PC({state:o,selection:v,focusRequest:j,run:H,gateEntityLocked:me,isEntityLockedFn:Z,isGroupLockedFn:X}),Y=BC({state:o,editable:C,run:H,gateEntityLocked:me,isEntityLockedFn:Z,isAssocLockedFn:Ne}),xe=AC({state:o,editable:C,run:H,gateEntityLocked:me,embeddableCatalog:a,t:m,emitGateNotice:F,selection:v}),Be=DC({state:o,editable:C,run:H,selection:v,gateEntityLocked:me,gateGroupLocked:Se,isGroupLockedFn:X}),Ve=LC({editable:C,run:H}),Le=RC({state:o,editable:C,run:H,gateEntityLocked:me,gateAssocLocked:ve});return{state:o,resolved:ye,issues:le,issuesByRef:se,flagEntitiesWithoutRelations:k,canUndo:_,canRedo:E,dirty:N,revision:p,notice:b,editable:C,schemaVersion:$,opWriteEnabled:L,opMode:S,opConflict:de,commandFailure:pe,historyTransport:he.historyTransport,historyAvailable:he.historyAvailable,restoreTransport:he.restoreTransport,restoreAvailable:he.restoreAvailable,restoreToSeq:he.restoreToSeq,reloadRequest:he.reloadRequest,displayMode:M,routingMode:B,showGrid:g,showMinimap:I,selection:v,selectedAttr:O,selectedAttrIds:x,inspectedEntityId:z,focusRequest:j,clipboard:ne,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:T,uiLocale:u,t:m,selectableDataTypes:f,setEditable(V){C.value=V&&S.value},setEmbeddableCatalog(V){a.value=V},setGroupCodeCatalog(V){r.value=V},setPredefinedCustomTypeCatalog(V){l.value=V},setSuperClassCatalog(V){s.value=V},selectAttribute:q.selectAttribute,moveAttributeFocus:q.moveAttributeFocus,nudgeSelectedAttributes:q.nudgeSelectedAttributes,nudgeNodes:q.nudgeNodes,requestFocus:q.requestFocus,deleteSelection(){if(!C.value)return!1;const V=v.value;if(!V)return!1;if(V.kind==="attribute"){if(me(V.entityId))return!1;const W=V.ids;if(!W.length)return!1;W.length===1?xe.removeAttribute(V.entityId,W[0]):xe.removeAttributes(V.entityId,W)}else if(V.kind==="entity"){if(me(V.id))return!1;Y.removeEntity(V.id)}else if(V.kind==="note")Ve.removeNote(V.id);else if(V.kind==="group"){if(Se(V.id))return!1;Be.removeGroup(V.id)}else Le.removeAssociation(V.id);return v.value=null,!0},undo:()=>{C.value&&i.undo()},redo:()=>{C.value&&i.redo()},markSaved:()=>{C.value&&(he.flush(),i.markSavePoint())},loadDiagram(V,W){he.teardownOpAdapter(),o.logical=V.logical,o.layout=V.layout,i=new rl(o),fe(),$.value=(W==null?void 0:W.schemaVersion)??1,L.value=(W==null?void 0:W.opWriteEnabled)??!1,T.value=(W==null?void 0:W.referenceOnly)??!1,C.value=!($.value>=2&&L.value===!1),de.value=null,pe.value=null,v.value=null,_.value=i.canUndo,E.value=i.canRedo,N.value=i.isDirty,he.setupOpAdapter(i,W),ae()},flush:he.flush,whenOpsSettled:he.whenOpsSettled,addEntity:Y.addEntity,renameEntity:Y.renameEntity,updateEntity:Y.updateEntity,moveEntity:Y.moveEntity,resizeEntity:Y.resizeEntity,removeEntity:Y.removeEntity,setEntitySwatch:Y.setEntitySwatch,setEntityCollapsed:Y.setEntityCollapsed,setEntityLocked:Y.setEntityLocked,isEntityLocked:Y.isEntityLocked,isAssociationLocked:Y.isAssociationLocked,collapseAll:Y.collapseAll,expandAll:Y.expandAll,setAttributeSwatch:xe.setAttributeSwatch,dragGroup:Be.dragGroup,resizeGroup:Be.resizeGroup,setGroupSwatch:Be.setGroupSwatch,setGroupLocked:Be.setGroupLocked,isGroupLocked:Be.isGroupLocked,updateGroup:Be.updateGroup,createGroup:Be.createGroup,addEmptyGroup:Be.addEmptyGroup,removeGroup:Be.removeGroup,dropEntity:Be.dropEntity,ungroupEntity:Be.ungroupEntity,dropNote:Be.dropNote,addPredefinedEmbed:xe.addPredefinedEmbed,addAttribute:xe.addAttribute,addDivider:xe.addDivider,updateAttribute:xe.updateAttribute,setAttributeGroupCode:xe.setAttributeGroupCode,setEmbedColumns:xe.setEmbedColumns,removeAttribute:xe.removeAttribute,removeAttributes:xe.removeAttributes,setAttributeSwatches:xe.setAttributeSwatches,reorderAttributes:xe.reorderAttributes,addIndex(V,W){me(V)||H(Nd(V,W))},updateIndex(V,W,Ce){me(V)||H(ma(V,W,Ce))},removeIndex(V,W){me(V)||H(wd(V,W))},addOperation(V,W={}){if(!C.value||me(V))return null;const Ce=o.logical.entities.find(He=>He.modelId===V),ze=Ce!=null&&Ce.operations?Rt(Ce.operations):0,Ie=W.modelId??De(),J={modelId:Ie,name:W.name??`method${ze}`,visibility:W.visibility??"PACKAGE",order:ze,...W};return H(yd(V,J)),Ie},updateOperation(V,W,Ce){me(V)||H(gd(V,W,Ce))},removeOperation(V,W){me(V)||H(bd(V,W))},reorderOperations(V,W,Ce){!W.length||me(V)||H(_d(V,W,Ce))},setOperationSwatch(V,W,Ce){H(kd(V,W,Ce))},addAssociation:Le.addAssociation,addEmbedAssociation:Le.addEmbedAssociation,setEmbedCardinality:Le.setEmbedCardinality,removeAssociation:Le.removeAssociation,setAssociationIdentifying:Le.setAssociationIdentifying,updateAssociationEnd:Le.updateAssociationEnd,hasQuickFix(V){if(!C.value)return!1;const W=jr(V,o.logical);return W?W.kind==="setEndCascades"?!Ne(W.assocRef):!Z(W.entityRef):!1},applyQuickFix(V){if(!C.value)return!1;const W=jr(V,o.logical);if(!W)return!1;if(W.kind==="setIndexColumns")return me(W.entityRef)?!1:(H(ma(W.entityRef,W.indexRef,{columns:W.columns})),!0);if(ve(W.assocRef))return!1;const Ce=o.logical.associations.find(ze=>ze.modelId===W.assocRef);return Ce?(H(Tt(W.assocRef,W.which,{jpa:{...Ce[W.which].jpa,cascadeTypes:W.cascades}})),!0):!1},moveWaypoint(V,W,Ce){H(Id(V,W,Ce))},addWaypoint(V,W,Ce){H(Sd(V,W,Ce))},removeWaypoint(V,W){H(vd(V,W))},clearWaypoints(V){H(xd(V))},addNote:Ve.addNote,removeNote:Ve.removeNote,moveNote:Ve.moveNote,resizeNote:Ve.resizeNote,setNoteMemo:Ve.setNoteMemo,setNoteSwatch:Ve.setNoteSwatch,addNoteConnection:Ve.addNoteConnection,removeNoteConnection:Ve.removeNoteConnection,moveNoteConnectionWaypoint:Ve.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:Ve.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:Ve.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:Ve.clearNoteConnectionWaypoints,autoLayout(){const V=Bs(o.logical,o.layout);V.length&&H(Qe("자동 배치",V.map(W=>vo(W.id,W.location))))},copy:G.copy,paste:G.paste,importEntities:G.importEntities}}const Qa=Symbol("groupHover"),Pf=Symbol("groupDrag"),Po=Symbol("relationHighlight"),zf=Symbol("diffOverlay"),Ff=Symbol("nodeInternals"),Uf=Symbol("columnResolution");function FC(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function Hf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!FC(e[o],n[o]))return!1;return!0}function UC(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!Hf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function HC(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function jC(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!HC(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!UC(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Hf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function KC(){let e;return(n,o)=>e=GC(n,o,e)}function GC(e,n,o){const i=e.entities,a=new Map;let r=null;const l=()=>r??(r=new Map(i.map(s=>[s.modelId,s])));for(const s of i){const c=new Map,d=new Map,u=new Map;let m=null;const h=()=>m??(m=fo(vn(s,i)));for(const E of s.attributes){if(zi(E)){const w=E.dbAttrs[0];if(!(w!=null&&w.physicalName&&(w!=null&&w.dataType))){const A=Fi(E,s,i,e.associations);A&&c.set(E.modelId,{...E,dbAttrs:[{...w,physicalName:(w==null?void 0:w.physicalName)||A.physicalName,dataType:(w==null?void 0:w.dataType)||A.dataType,length:(w==null?void 0:w.length)??A.length,scale:(w==null?void 0:w.scale)??A.scale},...E.dbAttrs.slice(1)]})}}if(E.identifier&&E.attrType==="RELATION_OWN"){const w=ko(e,s.modelId,E.modelId);if(w&&Gr(E,w)){const A=c.get(E.modelId)??E,$=E.derivedIdFieldName||Yr({...E,derivedIdFieldName:void 0},w,l());$&&c.set(E.modelId,{...A,derivedIdFieldName:$})}}const N=Mr(E,e.associations);if(N&&u.set(E.modelId,N),!E.attrType.startsWith("EMBED")||E.dbAttrs.length===0)continue;if(E.attrType!=="EMBED_PREDEF"){const w=h();d.set(E.modelId,E.dbAttrs.map((A,$)=>{const L=Pn(A,w);return L?{...A,physicalName:L.physicalName}:on(E,A,$,s,e)}));continue}const p=n==null?void 0:n.find(w=>w.type===E.type);if(!p)continue;const b=h();d.set(E.modelId,E.dbAttrs.map((w,A)=>{const $=p.fields[A],L=Pn(w,b);return L?{...w,physicalName:L.physicalName,logicalName:w.logicalName??($==null?void 0:$.logicalName),dataType:w.dataType||($==null?void 0:$.dataType)||""}:$?{...w,physicalName:w.physicalName||$.physicalName,logicalName:w.logicalName??$.logicalName,dataType:w.dataType||$.dataType,length:w.length??$.length}:w}))}const f=new Map,y=new Map;for(const E of s.attributes){const N=d.get(E.modelId);if(N)for(let p=0;p<N.length;p++){const b=`${E.attrType}\0${E.type??""}\0${p}`,w={attrId:E.modelId,slot:p,name:N[p].physicalName??""},A=y.get(b);A?A.push(w):y.set(b,[w])}}for(const E of y.values()){if(E.length<2)continue;const N=new Map;for(const p of E)N.set(p.name,(N.get(p.name)??0)+1);for(const p of E){if((N.get(p.name)??0)<2)continue;const b=f.get(p.attrId);b?b.add(p.slot):f.set(p.attrId,new Set([p.slot]))}}const k={effectiveAttrs:c,embedCols:d,collectionTypes:u,redundantSlots:f},_=o==null?void 0:o.get(s.modelId);a.set(s.modelId,_&&jC(k,_)?_:k)}return a}const jf=Symbol("embedSlotCollapse"),Kf=(e,n)=>`${e}:${n}`,Gf="all:",Yf="one:",qf=e=>`${Gf}${e}`,Wf=(e,n)=>`${Yf}${e}:${n}`,YC=e=>!e.startsWith(Gf)&&!e.startsWith(Yf),qC=["title"],WC={key:0,class:"em-sel","aria-hidden":"true"},JC=["title","aria-expanded","disabled"],XC={class:"em-entity__stereotype"},ZC={key:1,class:"em-entity__name"},QC=["title","aria-expanded"],ex={"aria-hidden":"true"},tx=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],nx=["onPointerdown"],ox={key:1,class:"em-entity__divider-label"},ix=["title"],ax={class:"em-key-slot"},rx={class:"em-key-slot"},lx=["title","aria-expanded","onClick"],sx=["title","onClick"],cx=["title","aria-expanded","onClick"],dx={key:2,class:"em-entity__type"},ux=["onClick"],mx={class:"em-entity__attrname"},fx={class:"em-entity__type"},px={key:1,class:"em-entity__embed-summary"},hx=["title"],yx=["data-op"],gx=["onPointerdown"],bx={class:"em-entity__op-vis","aria-hidden":"true"},_x=["title"],kx={key:4,class:"em-entity__footer"},Jf=We(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(ro,null),i=(R,P)=>o?o.t(R,P):Dt("ko",R,P),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=ee.useModal();function l(){o&&Ja(r,o,n.id)}const s=t.inject(Qa,null),c=t.inject(Po,null),d=t.inject(zf,null),u=t.computed(()=>{var R;return((R=d==null?void 0:d.marks.value)==null?void 0:R.get(n.id))??null}),m=t.inject(Uf,null),h=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(jf,void 0),y=t.inject(Ff,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const k=t.computed(()=>!!o&&o.editable.value);function _(){s&&(s.value=n.data.groupRef??null)}function E(){c==null||c.setEntityHover(n.id)}function N(){c==null||c.setEntityHover(null)}const p=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),b=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!p.value),w=t.computed(()=>{var R;return((R=o==null?void 0:o.selection.value)==null?void 0:R.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!w.value),$=t.computed(()=>{var R;return o&&((R=o.selectedAttr.value)==null?void 0:R.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),L=t.computed(()=>$.value.size>0);function T(R,P){const te=P.shiftKey?"range":P.metaKey||P.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,R.modelId,te)}const S=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!w.value),C=t.computed(()=>n.data.entity),M=t.computed(()=>Hh(C.value,o==null?void 0:o.referenceOnlyDocument.value)),B=t.computed(()=>[...C.value.attributes].sort((R,P)=>R.order-P.order)),g=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),I=t.computed(()=>n.data.collapsed??!1),v=t.computed(()=>n.data.locked??!1),O=t.computed(()=>k.value&&!v.value);function x(){k.value&&(o==null||o.setEntityCollapsed(n.id,!I.value))}const z=t.computed(()=>g.value==="PHYSICAL"||g.value==="LOGICAL_PHYSICAL"),j=t.computed(()=>{const R=g.value==="PHYSICAL"||g.value==="LOGICAL_PHYSICAL",P={};for(const te of B.value){const Ee=te.attrType.startsWith("RELATION")&&te.dbAttrs.length>0;P[te.modelId]={pk:te.identifier,fk:Ee&&R,required:te.notNull&&!te.identifier}}return P});function ne(R){if(!R)return"";const P=[];return R.pk&&R.fk?P.push(i("em.node.keyPfk")):R.pk?P.push(i("em.node.keyPk")):R.fk&&P.push(i("em.node.keyFk")),R.required&&P.push(i("em.node.required")),P.join(" · ")}const de=t.computed(()=>{const R=ns(bt(n.data.style)),P={};return R&&(P["--em-header-bg"]=R.bar,P["--em-header-fg"]=R.barOn),P});function pe(R){var P,te;return(te=ns(bt((P=n.data.attributeStyles)==null?void 0:P[R.modelId])))==null?void 0:te.text}const he=t.computed(()=>[...C.value.operations??[]].sort((R,P)=>R.order-P.order)),fe=t.computed(()=>g.value==="CLASS"&&he.value.length>0),ye={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function _e(R){return R?ye[R]:"~"}function Re(R){var P,te;return(te=ns(bt((P=n.data.operationStyles)==null?void 0:P[R.modelId])))==null?void 0:te.text}function ce(R,P,te){switch(g.value){case"CLASS":return[{text:R}];case"PHYSICAL":return[{text:te||R}];case"LOGICAL":return[P?{text:P}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const Ee=P?{text:P}:{text:i("em.node.logicalMissing"),missing:!0};return te?[Ee,{text:` · ${te}`}]:[Ee]}}}function le(R){var P;return((P=h.value)==null?void 0:P.effectiveAttrs.get(R.modelId))??R}function ae(R){var te,Ee,ie;if(ue(R))return[{text:R.name}];const P=le(R);return ce(se(R),(Ee=(te=P.dbAttrs[0])==null?void 0:te.logicalName)==null?void 0:Ee[a.value],((ie=P.dbAttrs[0])==null?void 0:ie.physicalName)??"")}function se(R){return le(R).derivedIdFieldName||R.name}function ue(R){return R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0}function U(R){return R.attrType==="DIVIDER"}function F(R){var P;return((P=h.value)==null?void 0:P.embedCols.get(R.modelId))??R.dbAttrs}function H(R){var P;return(P=h.value)==null?void 0:P.redundantSlots.get(R.modelId)}const Z=t.computed(()=>(f==null?void 0:f.isCollapsed(qf(n.id)))??!1),X=t.computed(()=>Z.value&&z.value?B.value.reduce((R,P)=>ue(P)?R+F(P).length:R,0):0),Ne=t.computed(()=>B.value.some(R=>ue(R)));function me(R){const P=H(R);return!P||P.size===0?!1:f?f.isCollapsed(Kf(n.id,R.modelId)):!1}function Se(R){var P;return me(R)?((P=H(R))==null?void 0:P.size)??0:0}function ve(R){return f?f.isCollapsed(Wf(n.id,R.modelId)):!1}function G(R){var P;return!z.value||Z.value?null:ve(R)?"attr":(((P=H(R))==null?void 0:P.size)??0)>0?"slot":null}function q(R){return!Z.value&&ue(R)}function Y(R){return ve(R)?F(R).length:0}function xe(R){if(Z.value||ve(R))return[];const P=F(R);if(!me(R))return P;const te=H(R);return P.filter((Ee,ie)=>!te.has(ie))}function Be(R){f==null||f.toggle(Kf(n.id,R.modelId))}function Ve(R){f==null||f.toggle(Wf(n.id,R.modelId))}function Le(){f==null||f.toggle(qf(n.id))}function oe(R){var P;return ce(R.physicalName,(P=R.logicalName)==null?void 0:P[a.value],R.physicalName)}function we(R){var te;const P=(te=h.value)==null?void 0:te.collectionTypes.get(R.modelId);return Vr(g.value,le(R),P)}const Fe=t.computed(()=>{const R={};for(const P of B.value)R[P.modelId]=we(P);return R}),K=t.computed(()=>{var R,P,te;return ce(C.value.name,(P=(R=C.value.table)==null?void 0:R.logicalName)==null?void 0:P[a.value],((te=C.value.table)==null?void 0:te.physicalName)??"")}),V=t.ref(!1),W=t.ref(""),Ce=t.ref(null);async function ze(){var R,P;O.value&&(W.value=C.value.name,V.value=!0,await t.nextTick(),(R=Ce.value)==null||R.focus(),(P=Ce.value)==null||P.select())}function Ie(){if(!V.value)return;V.value=!1;const R=W.value.trim();R&&R!==C.value.name&&(o==null||o.renameEntity(n.id,R))}function J(){o==null||o.addAttribute(n.id)}function He(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:ot,findNode:bn}=qe(),Ue=t.ref(null),Ge=t.computed(()=>{const R=Ue.value??n.data.size;return R?{width:`${R.width}px`,minHeight:`${R.height}px`}:void 0});let Q=null;function kt(R){var Ee,ie,re;if(!O.value)return;R.stopPropagation();const P=(Ee=bn(n.id))==null?void 0:Ee.dimensions,te=ot({x:R.clientX,y:R.clientY});Q={fx:te.x,fy:te.y,w:(P==null?void 0:P.width)??((ie=n.data.size)==null?void 0:ie.width)??200,h:(P==null?void 0:P.height)??((re=n.data.size)==null?void 0:re.height)??120},R.target.setPointerCapture(R.pointerId)}function _n(R){if(!Q)return;const P=ot({x:R.clientX,y:R.clientY});Ue.value={width:Math.max(40,Q.w+(P.x-Q.fx)),height:Math.max(40,Q.h+(P.y-Q.fy))}}function kn(R){var P,te,Ee;if(Q&&Ue.value&&o){const ie=(P=bn(n.id))==null?void 0:P.dimensions;o.resizeEntity(n.id,{width:Math.round((ie==null?void 0:ie.width)??Ue.value.width),height:Math.round((ie==null?void 0:ie.height)??Ue.value.height)})}Q=null,Ue.value=null,(Ee=(te=R.target).releasePointerCapture)==null||Ee.call(te,R.pointerId)}const St=t.ref(null),ge=t.ref(null);function at(R,P){if(!O.value)return;P.stopPropagation(),P.preventDefault();const te=$.value,Ee=te.has(R.modelId)?new Set(te):new Set([R.modelId]);ge.value={ids:Ee,dropIndex:-1,lineY:0},P.target.setPointerCapture(P.pointerId)}function en(R){if(!ge.value||!St.value)return;const P=Array.from(St.value.querySelectorAll(".em-entity__row"));if(!P.length)return;let te=P.length;for(let re=0;re<P.length;re++){const Te=P[re].getBoundingClientRect();if(R.clientY<Te.top+Te.height/2){te=re;break}}const Ee=P[P.length-1],ie=te<P.length?P[te].offsetTop:Ee.offsetTop+Ee.offsetHeight;ge.value={...ge.value,dropIndex:te,lineY:ie}}function zt(){const R=ge.value;if(ge.value=null,!R||R.dropIndex<0)return;const P=B.value,te=P.filter(Oe=>R.ids.has(Oe.modelId)).map(Oe=>Oe.modelId),Ee=P.filter((Oe,je)=>R.ids.has(Oe.modelId)&&je<R.dropIndex).length,ie=R.dropIndex-Ee,re=P.filter(Oe=>!R.ids.has(Oe.modelId)).map(Oe=>Oe.modelId);[...re.slice(0,ie),...te,...re.slice(ie)].join(",")!==P.map(Oe=>Oe.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,te,ie))}function tn(){ge.value=null}const Ft=t.ref(null),ke=t.ref(null);function lt(R,P){O.value&&(P.stopPropagation(),P.preventDefault(),ke.value={id:R.modelId,dropIndex:-1,lineY:0},P.target.setPointerCapture(P.pointerId))}function En(R){if(!ke.value||!Ft.value)return;const P=Array.from(Ft.value.querySelectorAll(".em-entity__op-row"));if(!P.length)return;let te=P.length;for(let re=0;re<P.length;re++){const Te=P[re].getBoundingClientRect();if(R.clientY<Te.top+Te.height/2){te=re;break}}const Ee=P[P.length-1],ie=te<P.length?P[te].offsetTop:Ee.offsetTop+Ee.offsetHeight;ke.value={...ke.value,dropIndex:te,lineY:ie}}function Nn(){const R=ke.value;if(ke.value=null,!R||R.dropIndex<0)return;const te=he.value.findIndex(ie=>ie.modelId===R.id);if(te<0)return;const Ee=R.dropIndex-(te<R.dropIndex?1:0);Ee!==te&&(o==null||o.reorderOperations(n.id,[R.id],Ee))}function D(){ke.value=null}return(R,P)=>{var te,Ee;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":p.value,"is-related":b.value,"is-dimmed":S.value,"is-selected":w.value,"is-multi-selected":A.value,"has-focused-attr":L.value,"is-locked":v.value,"is-reference-only":M.value,"is-diff-added":((te=u.value)==null?void 0:te.verb)==="added","is-diff-modified":((Ee=u.value)==null?void 0:Ee.verb)==="modified"}]),tabindex:"-1",title:M.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(Ge.value),onPointerdown:_,onMouseenter:E,onMouseleave:N,onDblclick:l},[w.value?(t.openBlock(),t.createElementBlock("div",WC,[...P[11]||(P[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(de.value),onDblclick:t.withModifiers(ze,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(I.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!I.value,disabled:!k.value,onClick:t.withModifiers(x,["stop"]),onPointerdown:P[0]||(P[0]=t.withModifiers(()=>{},["stop"])),onDblclick:P[1]||(P[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(I.value?"▸":"▾"),41,JC),t.createElementVNode("span",XC,"«"+t.toDisplayString(t.unref(Yo)(C.value.stereotype))+"»",1),V.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ce,"onUpdate:modelValue":P[2]||(P[2]=ie=>W.value=ie),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Ie,["enter"]),P[3]||(P[3]=t.withKeys(ie=>V.value=!1,["esc"]))],onBlur:Ie,onPointerdown:P[4]||(P[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,W.value]]):(t.openBlock(),t.createElementBlock("span",ZC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(K.value,(ie,re)=>(t.openBlock(),t.createElementBlock("span",{key:re,class:t.normalizeClass({"em-entity__missing":ie.missing})},t.toDisplayString(ie.text),3))),128))])),!I.value&&z.value&&Ne.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:Z.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!Z.value,onClick:t.withModifiers(Le,["stop"]),onPointerdown:P[5]||(P[5]=t.withModifiers(()=>{},["stop"])),onDblclick:P[6]||(P[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode($e,{name:"table",size:11}),t.createElementVNode("span",ex,t.toDisplayString(Z.value?"▸":"▾"),1)],40,QC)):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock($e,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),I.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:St,class:"em-entity__attrs"},[ge.value&&ge.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ge.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.value,ie=>{var re,Te,Oe,je,st,tt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ie.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":$.value.has(ie.modelId),"is-dragging":(re=ge.value)==null?void 0:re.ids.has(ie.modelId),"is-embed":ue(ie),"is-divider":U(ie),"has-embed-badge":!!G(ie),nodrag:U(ie)&&O.value,"is-diff-changed":!!((Te=u.value)!=null&&Te.changedAttributeIds.has(ie.modelId))}]),"data-attr":ie.modelId,onClick:t.withModifiers(Ke=>T(ie,Ke),["stop"]),onPointerdown:Ke=>U(ie)?at(ie,Ke):void 0,onPointermove:Ke=>U(ie)?en(Ke):void 0,onPointerup:Ke=>U(ie)?zt():void 0,onPointercancel:Ke=>U(ie)?tn():void 0},[O.value&&!U(ie)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ke=>at(ie,Ke),onPointermove:en,onPointerup:zt,onPointercancel:tn,onClick:P[7]||(P[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,nx)):t.createCommentVNode("",!0),U(ie)?(t.openBlock(),t.createElementBlock("span",ox,t.toDisplayString(ie.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(to),{id:`l:${ie.modelId}`,type:"target",position:t.unref(Me).Left,class:"em-handle",title:O.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:ne(j.value[ie.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",ax,[(Oe=j.value[ie.modelId])!=null&&Oe.pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:12,class:"em-key is-pk"})):(je=j.value[ie.modelId])!=null&&je.required?(t.openBlock(),t.createBlock($e,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",rx,[z.value&&q(ie)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:ve(ie)?i("em.node.embedAttrShow",{count:Y(ie)}):i("em.node.embedAttrHide"),"aria-expanded":!ve(ie),onClick:t.withModifiers(Ke=>Ve(ie),["stop"]),onPointerdown:P[8]||(P[8]=t.withModifiers(()=>{},["stop"])),onDblclick:P[9]||(P[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(ve(ie)?"▸":"▾"),41,lx)):ue(ie)?(t.openBlock(),t.createBlock($e,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(st=j.value[ie.modelId])!=null&&st.fk?(t.openBlock(),t.createBlock($e,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,ix),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:pe(ie)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ae(ie),(Ke,Xe)=>(t.openBlock(),t.createElementBlock("span",{key:Xe,class:t.normalizeClass({"em-entity__missing":Ke.missing})},t.toDisplayString(Ke.text),3))),128))],4),G(ie)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:Y(ie)}),onClick:t.withModifiers(Ke=>Ve(ie),["stop"])},"+"+t.toDisplayString(Y(ie)),9,sx)):G(ie)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:me(ie)?i("em.node.embedRepeatedShow",{count:((tt=H(ie))==null?void 0:tt.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!me(ie),onClick:t.withModifiers(Ke=>Be(ie),["stop"])},t.toDisplayString(me(ie)?`+${Se(ie)}`:"−"),9,cx)):t.createCommentVNode("",!0),Fe.value[ie.modelId]?(t.openBlock(),t.createElementBlock("span",dx,t.toDisplayString(Fe.value[ie.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(to),{id:`r:${ie.modelId}`,type:"source",position:t.unref(Me).Right,class:"em-handle",title:O.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,tx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ue(ie)&&z.value?xe(ie):[],Ke=>(t.openBlock(),t.createElementBlock("li",{key:`${ie.modelId}:${Ke.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":$.value.has(ie.modelId)}]),onClick:t.withModifiers(Xe=>T(ie,Xe),["stop"])},[P[12]||(P[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",mx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe(Ke),(Xe,Ye)=>(t.openBlock(),t.createElementBlock("span",{key:Ye,class:t.normalizeClass({"em-entity__missing":Xe.missing})},t.toDisplayString(Xe.text),3))),128))]),t.createElementVNode("span",fx,t.toDisplayString(Ke.dataType),1)],10,ux))),128))],64)}),128)),X.value?(t.openBlock(),t.createElementBlock("li",px,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(Le,["stop"])},[t.createVNode($e,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:X.value})),1)],8,hx)])):t.createCommentVNode("",!0)],512)),!I.value&&fe.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ft,class:"em-entity__ops"},[ke.value&&ke.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ke.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he.value,ie=>{var re,Te;return t.openBlock(),t.createElementBlock("li",{key:ie.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((re=ke.value)==null?void 0:re.id)===ie.modelId,"is-diff-changed":!!((Te=u.value)!=null&&Te.changedOperationIds.has(ie.modelId))}]),"data-op":ie.modelId},[O.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Oe=>lt(ie,Oe),onPointermove:En,onPointerup:Nn,onPointercancel:D,onClick:P[10]||(P[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,gx)):t.createCommentVNode("",!0),t.createElementVNode("span",bx,t.toDisplayString(_e(ie.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:Re(ie)})},t.toDisplayString(ie.name)+"()",5)],10,yx)}),128))],512)):he.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:he.value.length})},[t.createVNode($e,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:he.value.length})),1)],8,_x)):t.createCommentVNode("",!0),O.value?(t.openBlock(),t.createElementBlock("footer",kx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:J},t.toDisplayString(i("em.node.addAttr")),1),P[13]||(P[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:He},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),O.value&&!V.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:kt,onPointermove:_n,onPointerup:kn},null,32)):t.createCommentVNode("",!0)],46,qC)}}}),[["__scopeId","data-v-c2868bd8"]]),Ex={key:0,class:"em-sel","aria-hidden":"true"},Nx={class:"em-group__label"},wx={class:"em-group__name"},Ix={key:0,class:"em-group__pkg"},vx={key:1,class:"em-group__flag"},Xf=We(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>bt(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(ro,null),s=(C,M)=>l?l.t(C,M):Dt("ko",C,M),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var C;return!!n.id&&((C=l==null?void 0:l.selection.value)==null?void 0:C.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Qa,null),h=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Po,null);function y(){n.id&&(f==null||f.setGroupHover(n.id))}function k(){f==null||f.setGroupHover(null)}const _=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),E=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:N,findNode:p}=qe();let b=null,w=null;function A(C){var g;if(!n.id||!c.value)return;C.stopPropagation();const M=((g=p(n.id))==null?void 0:g.dimensions)??{width:400,height:300},B=N({x:C.clientX,y:C.clientY});b={fx:B.x,fy:B.y,w:M.width,h:M.height},C.target.setPointerCapture(C.pointerId)}function $(C){if(!b||!n.id)return;const M=N({x:C.clientX,y:C.clientY});w={width:Math.max(160,b.w+(M.x-b.fx)),height:Math.max(120,b.h+(M.y-b.fy))};const B=p(n.id);B&&(B.style={width:`${w.width}px`,height:`${w.height}px`})}function L(C){var M,B;b&&w&&n.id&&l&&l.resizeGroup(n.id,w),b=null,w=null,(B=(M=C.target).releasePointerCapture)==null||B.call(M,C.pointerId)}const T=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),S=t.computed(()=>{const C=o.value.name;return(C==null?void 0:C[T.value])||(C==null?void 0:C.ko)||(C==null?void 0:C.en)||(C==null?void 0:C.ja)||(C==null?void 0:C.zh)||o.value.packageName||s("em.group.fallback")});return(C,M)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":h.value,"is-hover-origin":_.value,"is-dimmed":E.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:k},[d.value?(t.openBlock(),t.createElementBlock("div",Ex,[...M[0]||(M[0]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",Nx,[t.createElementVNode("span",wx,t.toDisplayString(S.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Ix,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",vx,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock($e,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:$,onPointerup:L},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),Cx={key:0,class:"em-sel","aria-hidden":"true"},xx={key:2,class:"em-note__text"},Zf=We(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(ro,null),i=t.inject(Qa,null),a=t.inject(Po,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>bt(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const h=t.computed(()=>{var g;return((g=a==null?void 0:a.source.value)==null?void 0:g.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!h.value),y=t.computed(()=>{var g;return((g=o==null?void 0:o.selection.value)==null?void 0:g.kind)==="note"&&o.selection.value.id===n.id}),k=t.computed(()=>!!n.selected&&!y.value),_=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),E=[{id:"n-top",pos:Me.Top},{id:"n-right",pos:Me.Right},{id:"n-bottom",pos:Me.Bottom},{id:"n-left",pos:Me.Left}],N=t.ref(!1),p=t.ref(""),b=t.ref(null);async function w(){var g;l.value&&(p.value=r.value.memo,N.value=!0,await t.nextTick(),(g=b.value)==null||g.focus())}function A(){N.value&&(N.value=!1,p.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,p.value)))}const{screenToFlowCoordinate:$,findNode:L}=qe();let T=null,S=null;function C(g){var O;if(!l.value)return;g.stopPropagation();const I=((O=L(n.id))==null?void 0:O.dimensions)??r.value.geo.size,v=$({x:g.clientX,y:g.clientY});T={fx:v.x,fy:v.y,w:I.width,h:I.height},g.target.setPointerCapture(g.pointerId)}function M(g){if(!T)return;const I=$({x:g.clientX,y:g.clientY});S={width:Math.max(140,T.w+(I.x-T.fx)),height:Math.max(60,T.h+(I.y-T.fy))};const v=L(n.id);v&&(v.style={width:`${S.width}px`,height:`${S.height}px`})}function B(g){var I,v;T&&S&&o&&o.resizeNote(n.id,S),T=null,S=null,(v=(I=g.target).releasePointerCapture)==null||v.call(I,g.pointerId)}return(g,I)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":f.value,"is-dimmed":_.value,"is-selected":y.value,"is-multi-selected":k.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:w,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",Cx,[...I[4]||(I[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),N.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:b,"onUpdate:modelValue":I[0]||(I[0]=v=>p.value=v),class:"em-note__edit nodrag",onBlur:A,onKeydown:I[1]||(I[1]=t.withKeys(v=>N.value=!1,["esc"])),onPointerdown:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,p.value]]):(t.openBlock(),t.createElementBlock("div",xx,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(E,v=>t.createVNode(t.unref(to),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:I[3]||(I[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!N.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:C,onPointermove:M,onPointerup:B},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function er(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const zo=.5;function Qf(e,n,o,i,a,r){const l=er(n),s=er(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let h=e;const f=(_,E)=>{(Math.abs(_.x-h.x)>=zo||Math.abs(_.y-h.y)>=zo)&&(m.push({a:h,b:_,seg:E}),h=_)};f(c,0);let y=l.x!==0,k=c;for(let _=1;_<u.length;_++){const E=u[_],N=_<=o.length?_-1:o.length,p=Math.abs(E.x-k.x)<zo,b=Math.abs(E.y-k.y)<zo;p&&b||(p?(f(E,N),y=!1):b?(f(E,N),y=!0):y?(f({x:k.x,y:E.y},N),f(E,N),y=!0):(f({x:E.x,y:k.y},N),f(E,N),y=!1),k=E)}return f(i,o.length),m}function ep(e,n,o,i,a,r=20){const l=Qf(e,n,o,i,a,r);let s=`M ${_t(e.x)},${_t(e.y)}`;for(const c of l)s+=` L ${_t(c.b.x)},${_t(c.b.y)}`;return s}const Sx=14;function tp(e,n,o,i,a,r=20){return Qf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=Sx).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function _t(e){return Math.round(e*100)/100}const Rx=36;function Ax(e,n,o=Rx){const i=Math.max(e.x,n.x)+o;return`M ${_t(e.x)},${_t(e.y)} L ${_t(i)},${_t(e.y)} L ${_t(i)},${_t(n.y)} L ${_t(n.x)},${_t(n.y)}`}function np(e,n,o){const i=[e,...n,o];let a=`M ${_t(i[0].x)},${_t(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${_t(i[r].x)},${_t(i[r].y)}`;return a}function $x(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function op(e,n){const o=$x(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<zo&&Math.abs(l)<zo)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function ip(e,n,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:n},side:i?"right":"left"}}function ap(e,n,o){const i=[e,...n,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const Tx=20,Mx=22,Vx=7,Bx=22,rp=31,lp=7,Dx=20,sp=11,cp=11,Ox=rp+lp;function Lx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Px(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function tr(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function dp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function nr(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function up(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:dp(e,n);return[nr(o,a,r-Math.PI/2),nr(o,a,r+Math.PI/2)]}function mp(e,n,o,i){const a=n*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function fp(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=tr(e,n,Tx),[d,u]=up(e,n,c,Mx);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),Lx(o.multiplicity)){const m=tr(e,n,rp);r.push({cx:m.x,cy:m.y,r:lp})}if(Px(o.multiplicity)){const m=tr(e,n,Vx),[h,f]=up(e,n,m,Bx);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=tr(e,n,Dx),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=dp(e,n),m=nr(d,sp/2,u-Math.PI/2),h=nr(d,sp/2,u+Math.PI/2);l.push({points:[e,m,c,h]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=mp(s,c,cp,!0),u=mp(s,c,cp,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:r,polygons:l}}const pp=200,hp=120,ls=24;function yp(e){var a,r;if(!e)return{x:0,y:0,width:pp,height:hp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||pp,i=((r=e.dimensions)==null?void 0:r.height)||hp;return{x:n.x,y:n.y,width:o,height:i}}function gp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function bp(e){const n=t.computed(()=>yp(e.sourceNode())),o=t.computed(()=>yp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,y;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,h=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(h-m)<ls){const k=(m+h)/2;m=k-ls/2,h=k+ls/2}return{source:{x:u,y:m},target:{x:u,y:h}}}),r=t.computed(()=>e.waypoints()[0]??gp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??gp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ip(n.value,d,r.value.x):op(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ip(o.value,d,l.value.x):op(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const ss=Symbol("waypointController"),zx=["d"],Fx=["d"],Ux=["d"],Hx=["x1","y1","x2","y2"],jx=["cx","cy","r"],Kx=["x","y"],Gx=["x","y"],Yx=["cx","cy","onDblclick"],qx=["x","y","onPointerdown","onDblclick"],_p=We(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=qe(),i=t.inject(ss),a=t.inject(ro,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Pf,null),s=t.inject(Po,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var ae;return((ae=a==null?void 0:a.selection.value)==null?void 0:ae.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const ae=l==null?void 0:l.value;if(!ae||!a)return null;const se=a.resolved.value.entities,ue=F=>{var H;return(H=se.find(Z=>Z.entity.modelId===F))==null?void 0:H.groupRef},U=n.data.association;return ue(U.end1.entityRef)===ae.groupId&&ue(U.end2.entityRef)===ae.groupId?{dx:ae.dx,dy:ae.dy}:null}),h=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),y=t.ref({x:0,y:0}),k=t.computed(()=>{const ae=m.value;return h.value.map((se,ue)=>ue===f.value?y.value:ae?{x:se.x+ae.dx,y:se.y+ae.dy}:se)}),_=t.computed(()=>{var ae;return!!((ae=n.sourceNode.data)!=null&&ae.collapsed)}),E=t.computed(()=>{var ae;return!!((ae=n.targetNode.data)!=null&&ae.collapsed)}),{source:N,target:p,sourceSide:b,targetSide:w,isSelf:A}=bp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>k.value,sourceRowY:()=>n.data.sourceColumnRef&&!_.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!E.value?n.targetY:void 0}),$=Ox+4,L=t.computed(()=>A.value?Ax(N.value,p.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?ep(N.value,b.value,k.value,p.value,w.value,$):np(N.value,k.value,p.value)),T=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?tp(N.value,b.value,k.value,p.value,w.value,$):ap(N.value,k.value,p.value).map((ae,se)=>({point:ae,segIndex:se}))),S=t.computed(()=>A.value||!r.value?[]:k.value),C=Gi;function M(ae,se){f.value=ae,y.value={...h.value[ae]},se.target.setPointerCapture(se.pointerId),se.stopPropagation()}function B(ae){if(f.value<0)return;const se=o({x:ae.clientX,y:ae.clientY});y.value={x:se.x,y:se.y}}function g(ae){var se,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...y.value}),f.value=-1,(ue=(se=ae.target).releasePointerCapture)==null||ue.call(se,ae.pointerId)}function I(ae,se){se.stopPropagation(),i==null||i.removePoint(n.id,ae)}function v(ae,se){if(!i)return;const ue=o({x:se.clientX,y:se.clientY});i.insertPoint(n.id,ae,{x:ue.x,y:ue.y})}const O=t.computed(()=>C(n.data.association.end1.multiplicity)),x=t.computed(()=>C(n.data.association.end2.multiplicity)),z=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),j=t.computed(()=>z.value==="class"),ne=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ae=er(b.value);return{x:N.value.x+ae.x*10,y:N.value.y+ae.y*10}}return k.value[0]??p.value}),de=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const se=er(w.value);return{x:p.value.x+se.x*10,y:p.value.y+se.y*10}}const ae=k.value;return ae[ae.length-1]??N.value}),pe=t.computed(()=>{const ae=n.data.association;return{multiplicity:ae.end1.multiplicity,navigable:ae.end1.navigable,composition:ae.end1.composition,otherNavigable:ae.end2.navigable}}),he=t.computed(()=>{const ae=n.data.association;return{multiplicity:ae.end2.multiplicity,navigable:ae.end2.navigable,composition:ae.end2.composition,otherNavigable:ae.end1.navigable}}),fe=t.computed(()=>fp(N.value,ne.value,pe.value,z.value)),ye=t.computed(()=>fp(p.value,de.value,he.value,z.value)),_e=t.computed(()=>[...fe.value.lines,...ye.value.lines]),Re=t.computed(()=>[...fe.value.circles,...ye.value.circles]),ce=t.computed(()=>[...fe.value.polygons,...ye.value.polygons].map(ae=>`M${ae.points.map(se=>`${se.x},${se.y}`).join(" L")} Z`)),le=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ae,se)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:L.value,fill:"none",class:"em-edge__hit"},null,8,zx),t.createElementVNode("path",{d:L.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,Fx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,(ue,U)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${U}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",le.value])},null,10,Ux))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,(ue,U)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${U}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",le.value])},null,10,Hx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Re.value,(ue,U)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${U}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",le.value])},null,10,jx))),128)),j.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(N).x+8,y:t.unref(N).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(O.value),11,Kx),t.createElementVNode("text",{x:t.unref(p).x-8,y:t.unref(p).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(x.value),11,Gx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(ue,U)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${U}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(F=>v(ue.segIndex,F),["stop"])},null,42,Yx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,(ue,U)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${U}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:F=>M(U,F),onPointermove:B,onPointerup:g,onDblclick:F=>I(U,F)},null,42,qx))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var pn=(e=>(e.Lines="lines",e.Dots="dots",e))(pn||{});const kp=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Ep=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};pn.Lines+"",pn.Dots+"";const Wx={[pn.Dots]:"#81818a",[pn.Lines]:"#eee"},Jx=["id","x","y","width","height","patternTransform"],Xx={key:2,height:"100",width:"100"},Zx=["fill"],Qx=["x","y","fill"],eS={name:"Background",compatConfig:{MODE:3}},tS=t.defineComponent({...eS,props:{id:{},variant:{default:()=>pn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=qe(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,h*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||Wx[e.variant||pn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(pn).Lines?(t.openBlock(),t.createBlock(t.unref(kp),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(pn).Dots?(t.openBlock(),t.createBlock(t.unref(Ep),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",Xx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Zx)])):t.createCommentVNode("",!0)])],8,Jx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Qx),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),nS={name:"ControlButton",compatConfig:{MODE:3}},oS=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},iS={type:"button",class:"vue-flow__controls-button"};function aS(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",iS,[t.renderSlot(e.$slots,"default")])}const lo=oS(nS,[["render",aS]]),rS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},lS=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function sS(e,n){return t.openBlock(),t.createElementBlock("svg",rS,lS)}const cS={render:sS},dS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},uS=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function mS(e,n){return t.openBlock(),t.createElementBlock("svg",dS,uS)}const fS={render:mS},pS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},hS=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function yS(e,n){return t.openBlock(),t.createElementBlock("svg",pS,hS)}const gS={render:yS},bS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},_S=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function kS(e,n){return t.openBlock(),t.createElementBlock("svg",bS,_S)}const ES={render:kS},NS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},wS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function IS(e,n){return t.openBlock(),t.createElementBlock("svg",NS,wS)}const vS={render:IS},CS={name:"Controls",compatConfig:{MODE:3}},xS=t.defineComponent({...CS,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>_m.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=qe(),h=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function k(){l(),n("zoomIn")}function _(){s(),n("zoomOut")}function E(){c(e.fitViewParams),n("fitView")}function N(){r(!h.value),n("interactionChange",!h.value)}return(p,b)=>(t.openBlock(),t.createBlock(t.unref(bf),{class:"vue-flow__controls",position:p.position},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"top"),p.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(p.$slots,"control-zoom-in",{},()=>[t.createVNode(lo,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:k},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(cS))))])]),_:3},8,["disabled"])]),t.renderSlot(p.$slots,"control-zoom-out",{},()=>[t.createVNode(lo,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(fS))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),p.showFitView?t.renderSlot(p.$slots,"control-fit-view",{key:1},()=>[t.createVNode(lo,{class:"vue-flow__controls-fitview",onClick:E},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(gS))))])]),_:3})]):t.createCommentVNode("",!0),p.showInteractive?t.renderSlot(p.$slots,"control-interactive",{key:2},()=>[p.showInteractive?(t.openBlock(),t.createBlock(lo,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:t.withCtx(()=>[h.value?t.renderSlot(p.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(vS))))]):t.createCommentVNode("",!0),h.value?t.createCommentVNode("",!0):t.renderSlot(p.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(ES))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(p.$slots,"default")]),_:3},8,["position"]))}});var SS={value:()=>{}};function cs(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new or(o)}function or(e){this._=e}function RS(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}or.prototype=cs.prototype={constructor:or,on:function(e,n){var o=this._,i=RS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=AS(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Np(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Np(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new or(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function AS(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Np(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=SS,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ds="http://www.w3.org/1999/xhtml";const wp={svg:"http://www.w3.org/2000/svg",xhtml:ds,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ir(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),wp.hasOwnProperty(n)?{space:wp[n],local:e}:e}function $S(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ds&&n.documentElement.namespaceURI===ds?n.createElement(e):n.createElementNS(o,e)}}function TS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ip(e){var n=ir(e);return(n.local?TS:$S)(n)}function MS(){}function us(e){return e==null?MS:function(){return this.querySelector(e)}}function VS(e){typeof e!="function"&&(e=us(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new xt(i,this._parents)}function BS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function DS(){return[]}function vp(e){return e==null?DS:function(){return this.querySelectorAll(e)}}function OS(e){return function(){return BS(e.apply(this,arguments))}}function LS(e){typeof e=="function"?e=OS(e):e=vp(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new xt(i,a)}function Cp(e){return function(){return this.matches(e)}}function xp(e){return function(n){return n.matches(e)}}var PS=Array.prototype.find;function zS(e){return function(){return PS.call(this.children,e)}}function FS(){return this.firstElementChild}function US(e){return this.select(e==null?FS:zS(typeof e=="function"?e:xp(e)))}var HS=Array.prototype.filter;function jS(){return Array.from(this.children)}function KS(e){return function(){return HS.call(this.children,e)}}function GS(e){return this.selectAll(e==null?jS:KS(typeof e=="function"?e:xp(e)))}function YS(e){typeof e!="function"&&(e=Cp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new xt(i,this._parents)}function Sp(e){return new Array(e.length)}function qS(){return new xt(this._enter||this._groups.map(Sp),this._parents)}function ar(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ar.prototype={constructor:ar,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function WS(e){return function(){return e}}function JS(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new ar(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function XS(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(h[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ar(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function ZS(e){return e.__data__}function QS(e,n){if(!arguments.length)return Array.from(this,ZS);var o=n?XS:JS,i=this._parents,a=this._groups;typeof e!="function"&&(e=WS(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,f=eR(e.call(u,u&&u.__data__,d,i)),y=f.length,k=s[d]=new Array(y),_=l[d]=new Array(y),E=c[d]=new Array(h);o(u,m,k,_,E,f,n);for(var N=0,p=0,b,w;N<y;++N)if(b=k[N]){for(N>=p&&(p=N+1);!(w=_[p])&&++p<y;);b._next=w||null}}return l=new xt(l,i),l._enter=s,l._exit=c,l}function eR(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function tR(){return new xt(this._exit||this._groups.map(Sp),this._parents)}function nR(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function oR(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),f,y=0;y<m;++y)(f=d[y]||u[y])&&(h[y]=f);for(;c<a;++c)s[c]=o[c];return new xt(s,this._parents)}function iR(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function aR(e){e||(e=rR);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new xt(a,this._parents).order()}function rR(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function lR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sR(){return Array.from(this)}function cR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function dR(){let e=0;for(const n of this)++e;return e}function uR(){return!this.node()}function mR(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function fR(e){return function(){this.removeAttribute(e)}}function pR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hR(e,n){return function(){this.setAttribute(e,n)}}function yR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function gR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function bR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function _R(e,n){var o=ir(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?pR:fR:typeof n=="function"?o.local?bR:gR:o.local?yR:hR)(o,n))}function Rp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kR(e){return function(){this.style.removeProperty(e)}}function ER(e,n,o){return function(){this.style.setProperty(e,n,o)}}function NR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function wR(e,n,o){return arguments.length>1?this.each((n==null?kR:typeof n=="function"?NR:ER)(e,n,o??"")):Fo(this.node(),e)}function Fo(e,n){return e.style.getPropertyValue(n)||Rp(e).getComputedStyle(e,null).getPropertyValue(n)}function IR(e){return function(){delete this[e]}}function vR(e,n){return function(){this[e]=n}}function CR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function xR(e,n){return arguments.length>1?this.each((n==null?IR:typeof n=="function"?CR:vR)(e,n)):this.node()[e]}function Ap(e){return e.trim().split(/^|\s+/)}function ms(e){return e.classList||new $p(e)}function $p(e){this._node=e,this._names=Ap(e.getAttribute("class")||"")}$p.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Tp(e,n){for(var o=ms(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Mp(e,n){for(var o=ms(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function SR(e){return function(){Tp(this,e)}}function RR(e){return function(){Mp(this,e)}}function AR(e,n){return function(){(n.apply(this,arguments)?Tp:Mp)(this,e)}}function $R(e,n){var o=Ap(e+"");if(arguments.length<2){for(var i=ms(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?AR:n?SR:RR)(o,n))}function TR(){this.textContent=""}function MR(e){return function(){this.textContent=e}}function VR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function BR(e){return arguments.length?this.each(e==null?TR:(typeof e=="function"?VR:MR)(e)):this.node().textContent}function DR(){this.innerHTML=""}function OR(e){return function(){this.innerHTML=e}}function LR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function PR(e){return arguments.length?this.each(e==null?DR:(typeof e=="function"?LR:OR)(e)):this.node().innerHTML}function zR(){this.nextSibling&&this.parentNode.appendChild(this)}function FR(){return this.each(zR)}function UR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function HR(){return this.each(UR)}function jR(e){var n=typeof e=="function"?e:Ip(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function KR(){return null}function GR(e,n){var o=typeof e=="function"?e:Ip(e),i=n==null?KR:typeof n=="function"?n:us(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function YR(){var e=this.parentNode;e&&e.removeChild(this)}function qR(){return this.each(YR)}function WR(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function JR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function XR(e){return this.select(e?JR:WR)}function ZR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function QR(e){return function(n){e.call(this,n,this.__data__)}}function eA(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function tA(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function nA(e,n,o){return function(){var i=this.__on,a,r=QR(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function oA(e,n,o){var i=eA(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?nA:tA,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Vp(e,n,o){var i=Rp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function iA(e,n){return function(){return Vp(this,e,n)}}function aA(e,n){return function(){return Vp(this,e,n.apply(this,arguments))}}function rA(e,n){return this.each((typeof n=="function"?aA:iA)(e,n))}function*lA(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Bp=[null];function xt(e,n){this._groups=e,this._parents=n}function Ci(){return new xt([[document.documentElement]],Bp)}function sA(){return this}xt.prototype=Ci.prototype={constructor:xt,select:VS,selectAll:LS,selectChild:US,selectChildren:GS,filter:YS,data:QS,enter:qS,exit:tR,join:nR,merge:oR,selection:sA,order:iR,sort:aR,call:lR,nodes:sR,node:cR,size:dR,empty:uR,each:mR,attr:_R,style:wR,property:xR,classed:$R,text:BR,html:PR,raise:FR,lower:HR,append:jR,insert:GR,remove:qR,clone:XR,datum:ZR,on:oA,dispatch:rA,[Symbol.iterator]:lA};function Vn(e){return typeof e=="string"?new xt([[document.querySelector(e)]],[document.documentElement]):new xt([[e]],Bp)}function cA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Bn(e,n){if(e=cA(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const fs={capture:!0,passive:!1};function ps(e){e.preventDefault(),e.stopImmediatePropagation()}function dA(e){var n=e.document.documentElement,o=Vn(e).on("dragstart.drag",ps,fs);"onselectstart"in n?o.on("selectstart.drag",ps,fs):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function uA(e,n){var o=e.document.documentElement,i=Vn(e).on("dragstart.drag",null);n&&(i.on("click.drag",ps,fs),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function hs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Dp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function xi(){}var Si=.7,rr=1/Si,Uo="\\s*([+-]?\\d+)\\s*",Ri="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mA=/^#([0-9a-f]{3,8})$/,fA=new RegExp(`^rgb\\(${Uo},${Uo},${Uo}\\)$`),pA=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),hA=new RegExp(`^rgba\\(${Uo},${Uo},${Uo},${Ri}\\)$`),yA=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${Ri}\\)$`),gA=new RegExp(`^hsl\\(${Ri},${Zt},${Zt}\\)$`),bA=new RegExp(`^hsla\\(${Ri},${Zt},${Zt},${Ri}\\)$`),Op={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};hs(xi,Ai,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Lp,formatHex:Lp,formatHex8:_A,formatHsl:kA,formatRgb:Pp,toString:Pp});function Lp(){return this.rgb().formatHex()}function _A(){return this.rgb().formatHex8()}function kA(){return jp(this).formatHsl()}function Pp(){return this.rgb().formatRgb()}function Ai(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=mA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?zp(n):o===3?new wt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?lr(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?lr(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=fA.exec(e))?new wt(n[1],n[2],n[3],1):(n=pA.exec(e))?new wt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=hA.exec(e))?lr(n[1],n[2],n[3],n[4]):(n=yA.exec(e))?lr(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=gA.exec(e))?Hp(n[1],n[2]/100,n[3]/100,1):(n=bA.exec(e))?Hp(n[1],n[2]/100,n[3]/100,n[4]):Op.hasOwnProperty(e)?zp(Op[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function zp(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function lr(e,n,o,i){return i<=0&&(e=n=o=NaN),new wt(e,n,o,i)}function EA(e){return e instanceof xi||(e=Ai(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function ys(e,n,o,i){return arguments.length===1?EA(e):new wt(e,n,o,i??1)}function wt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}hs(wt,ys,Dp(xi,{brighter(e){return e=e==null?rr:Math.pow(rr,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Si:Math.pow(Si,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(so(this.r),so(this.g),so(this.b),sr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fp,formatHex:Fp,formatHex8:NA,formatRgb:Up,toString:Up}));function Fp(){return`#${co(this.r)}${co(this.g)}${co(this.b)}`}function NA(){return`#${co(this.r)}${co(this.g)}${co(this.b)}${co((isNaN(this.opacity)?1:this.opacity)*255)}`}function Up(){const e=sr(this.opacity);return`${e===1?"rgb(":"rgba("}${so(this.r)}, ${so(this.g)}, ${so(this.b)}${e===1?")":`, ${e})`}`}function sr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function so(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function co(e){return e=so(e),(e<16?"0":"")+e.toString(16)}function Hp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Lt(e,n,o,i)}function jp(e){if(e instanceof Lt)return new Lt(e.h,e.s,e.l,e.opacity);if(e instanceof xi||(e=Ai(e)),!e)return new Lt;if(e instanceof Lt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Lt(l,s,c,e.opacity)}function wA(e,n,o,i){return arguments.length===1?jp(e):new Lt(e,n,o,i??1)}function Lt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}hs(Lt,wA,Dp(xi,{brighter(e){return e=e==null?rr:Math.pow(rr,e),new Lt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Si:Math.pow(Si,e),new Lt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new wt(gs(e>=240?e-240:e+120,a,i),gs(e,a,i),gs(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Lt(Kp(this.h),cr(this.s),cr(this.l),sr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=sr(this.opacity);return`${e===1?"hsl(":"hsla("}${Kp(this.h)}, ${cr(this.s)*100}%, ${cr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Kp(e){return e=(e||0)%360,e<0?e+360:e}function cr(e){return Math.max(0,Math.min(1,e||0))}function gs(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Gp=e=>()=>e;function IA(e,n){return function(o){return e+o*n}}function vA(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function CA(e){return(e=+e)==1?Yp:function(n,o){return o-n?vA(n,o,e):Gp(isNaN(n)?o:n)}}function Yp(e,n){var o=n-e;return o?IA(e,o):Gp(isNaN(e)?n:e)}const qp=(function e(n){var o=CA(n);function i(a,r){var l=o((a=ys(a)).r,(r=ys(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Yp(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Dn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var bs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_s=new RegExp(bs.source,"g");function xA(e){return function(){return e}}function SA(e){return function(n){return e(n)+""}}function RA(e,n){var o=bs.lastIndex=_s.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=bs.exec(e))&&(a=_s.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Dn(i,a)})),o=_s.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?SA(c[0].x):xA(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var Wp=180/Math.PI,ks={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Jp(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Wp,skewX:Math.atan(c)*Wp,scaleX:l,scaleY:s}}var dr;function AA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?ks:Jp(n.a,n.b,n.c,n.d,n.e,n.f)}function $A(e){return e==null||(dr||(dr=document.createElementNS("http://www.w3.org/2000/svg","g")),dr.setAttribute("transform",e),!(e=dr.transform.baseVal.consolidate()))?ks:(e=e.matrix,Jp(e.a,e.b,e.c,e.d,e.e,e.f))}function Xp(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,f,y){if(d!==m||u!==h){var k=f.push("translate(",null,n,null,o);y.push({i:k-4,x:Dn(d,m)},{i:k-2,x:Dn(u,h)})}else(m||h)&&f.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Dn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Dn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,f,y){if(d!==m||u!==h){var k=f.push(a(f)+"scale(",null,",",null,")");y.push({i:k-4,x:Dn(d,m)},{i:k-2,x:Dn(u,h)})}else(m!==1||h!==1)&&f.push(a(f)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(f){for(var y=-1,k=h.length,_;++y<k;)m[(_=h[y]).i]=_.x(f);return m.join("")}}}var TA=Xp(AA,"px, ","px)","deg)"),MA=Xp($A,", ",")",")"),VA=1e-12;function Zp(e){return((e=Math.exp(e))+1/e)/2}function BA(e){return((e=Math.exp(e))-1/e)/2}function DA(e){return((e=Math.exp(2*e))-1)/(e+1)}const OA=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],f=u-s,y=m-c,k=f*f+y*y,_,E;if(k<VA)E=Math.log(h/d)/n,_=function($){return[s+$*f,c+$*y,d*Math.exp(n*$*E)]};else{var N=Math.sqrt(k),p=(h*h-d*d+i*k)/(2*d*o*N),b=(h*h-d*d-i*k)/(2*h*o*N),w=Math.log(Math.sqrt(p*p+1)-p),A=Math.log(Math.sqrt(b*b+1)-b);E=(A-w)/n,_=function($){var L=$*E,T=Zp(w),S=d/(o*N)*(T*DA(n*L+w)-BA(w));return[s+S*f,c+S*y,d*T/Zp(n*L+w)]}}return _.duration=E*1e3*n/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Ho=0,$i=0,Ti=0,Qp=1e3,ur,Mi,mr=0,uo=0,fr=0,Vi=typeof performance=="object"&&performance.now?performance:Date,eh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Es(){return uo||(eh(LA),uo=Vi.now()+fr)}function LA(){uo=0}function pr(){this._call=this._time=this._next=null}pr.prototype=th.prototype={constructor:pr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Es():+o)+(n==null?0:+n),!this._next&&Mi!==this&&(Mi?Mi._next=this:ur=this,Mi=this),this._call=e,this._time=o,Ns()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ns())}};function th(e,n,o){var i=new pr;return i.restart(e,n,o),i}function PA(){Es(),++Ho;for(var e=ur,n;e;)(n=uo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Ho}function nh(){uo=(mr=Vi.now())+fr,Ho=$i=0;try{PA()}finally{Ho=0,FA(),uo=0}}function zA(){var e=Vi.now(),n=e-mr;n>Qp&&(fr-=n,mr=e)}function FA(){for(var e,n=ur,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:ur=o);Mi=e,Ns(i)}function Ns(e){if(!Ho){$i&&($i=clearTimeout($i));var n=e-uo;n>24?(e<1/0&&($i=setTimeout(nh,e-Vi.now()-fr)),Ti&&(Ti=clearInterval(Ti))):(Ti||(mr=Vi.now(),Ti=setInterval(zA,Qp)),Ho=1,eh(nh))}}function oh(e,n,o){var i=new pr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var UA=cs("start","end","cancel","interrupt"),HA=[],ih=0,ah=1,ws=2,hr=3,rh=4,Is=5,yr=6;function gr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;jA(e,o,{name:n,index:i,group:a,on:UA,tween:HA,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:ih})}function vs(e,n){var o=Pt(e,n);if(o.state>ih)throw new Error("too late; already scheduled");return o}function Qt(e,n){var o=Pt(e,n);if(o.state>hr)throw new Error("too late; already running");return o}function Pt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function jA(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=th(r,0,o.time);function r(d){o.state=ah,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,f;if(o.state!==ah)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===hr)return oh(l);f.state===rh?(f.state=yr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=yr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(oh(function(){o.state===hr&&(o.state=rh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ws,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ws){for(o.state=hr,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Is,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Is&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=yr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function br(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>ws&&i.state<Is,i.state=yr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function KA(e){return this.each(function(){br(this,e)})}function GA(e,n){var o,i;return function(){var a=Qt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function YA(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Qt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function qA(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Pt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?GA:YA)(o,e,n))}function Cs(e,n,o){var i=e._id;return e.each(function(){var a=Qt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Pt(a,i).value[n]}}function lh(e,n){var o;return(typeof n=="number"?Dn:n instanceof Ai?qp:(o=Ai(n))?(n=o,qp):RA)(e,n)}function WA(e){return function(){this.removeAttribute(e)}}function JA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function XA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function ZA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function QA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function e$(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function t$(e,n){var o=ir(e),i=o==="transform"?MA:lh;return this.attrTween(e,typeof n=="function"?(o.local?e$:QA)(o,i,Cs(this,"attr."+e,n)):n==null?(o.local?JA:WA)(o):(o.local?ZA:XA)(o,i,n))}function n$(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function o$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function i$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&o$(e,r)),o}return a._value=n,a}function a$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&n$(e,r)),o}return a._value=n,a}function r$(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=ir(e);return this.tween(o,(i.local?i$:a$)(i,n))}function l$(e,n){return function(){vs(this,e).delay=+n.apply(this,arguments)}}function s$(e,n){return n=+n,function(){vs(this,e).delay=n}}function c$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?l$:s$)(n,e)):Pt(this.node(),n).delay}function d$(e,n){return function(){Qt(this,e).duration=+n.apply(this,arguments)}}function u$(e,n){return n=+n,function(){Qt(this,e).duration=n}}function m$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?d$:u$)(n,e)):Pt(this.node(),n).duration}function f$(e,n){if(typeof n!="function")throw new Error;return function(){Qt(this,e).ease=n}}function p$(e){var n=this._id;return arguments.length?this.each(f$(n,e)):Pt(this.node(),n).ease}function h$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Qt(this,e).ease=o}}function y$(e){if(typeof e!="function")throw new Error;return this.each(h$(this._id,e))}function g$(e){typeof e!="function"&&(e=Cp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new hn(i,this._parents,this._name,this._id)}function b$(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,f=0;f<u;++f)(h=c[f]||d[f])&&(m[f]=h);for(;s<i;++s)l[s]=n[s];return new hn(l,this._parents,this._name,this._id)}function _$(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function k$(e,n,o){var i,a,r=_$(n)?vs:Qt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function E$(e,n){var o=this._id;return arguments.length<2?Pt(this.node(),o).on.on(e):this.each(k$(o,e,n))}function N$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function w$(){return this.on("end.remove",N$(this._id))}function I$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=us(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,gr(d[h],n,o,h,d,Pt(u,o)));return new hn(r,this._parents,n,o)}function v$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=vp(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),f,y=Pt(u,o),k=0,_=h.length;k<_;++k)(f=h[k])&&gr(f,n,o,k,h,y);r.push(h),l.push(u)}return new hn(r,l,n,o)}var C$=Ci.prototype.constructor;function x$(){return new C$(this._groups,this._parents)}function S$(e,n){var o,i,a;return function(){var r=Fo(this,e),l=(this.style.removeProperty(e),Fo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function sh(e){return function(){this.style.removeProperty(e)}}function R$(e,n,o){var i,a=o+"",r;return function(){var l=Fo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function A$(e,n,o){var i,a,r;return function(){var l=Fo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Fo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function $$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Qt(this,e),d=c.on,u=c.value[r]==null?s||(s=sh(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function T$(e,n,o){var i=(e+="")=="transform"?TA:lh;return n==null?this.styleTween(e,S$(e,i)).on("end.style."+e,sh(e)):typeof n=="function"?this.styleTween(e,A$(e,i,Cs(this,"style."+e,n))).each($$(this._id,e)):this.styleTween(e,R$(e,i,n),o).on("end.style."+e,null)}function M$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function V$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&M$(e,l,o)),i}return r._value=n,r}function B$(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,V$(e,n,o??""))}function D$(e){return function(){this.textContent=e}}function O$(e){return function(){var n=e(this);this.textContent=n??""}}function L$(e){return this.tween("text",typeof e=="function"?O$(Cs(this,"text",e)):D$(e==null?"":e+""))}function P$(e){return function(n){this.textContent=e.call(this,n)}}function z$(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&P$(a)),n}return i._value=e,i}function F$(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,z$(e))}function U$(){for(var e=this._name,n=this._id,o=ch(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Pt(c,n);gr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new hn(i,this._parents,e,o)}function H$(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Qt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var j$=0;function hn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function ch(){return++j$}var yn=Ci.prototype;hn.prototype={constructor:hn,select:I$,selectAll:v$,selectChild:yn.selectChild,selectChildren:yn.selectChildren,filter:g$,merge:b$,selection:x$,transition:U$,call:yn.call,nodes:yn.nodes,node:yn.node,size:yn.size,empty:yn.empty,each:yn.each,on:E$,attr:t$,attrTween:r$,style:T$,styleTween:B$,text:L$,textTween:F$,remove:w$,tween:qA,delay:c$,duration:m$,ease:p$,easeVarying:y$,end:H$,[Symbol.iterator]:yn[Symbol.iterator]};function K$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var G$={time:null,delay:0,duration:250,ease:K$};function Y$(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function q$(e){var n,o;e instanceof hn?(n=e._id,e=e._name):(n=ch(),(o=G$).time=Es(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&gr(c,e,n,d,l,o||Y$(c,n));return new hn(i,this._parents,e,n)}Ci.prototype.interrupt=KA,Ci.prototype.transition=q$;const _r=e=>()=>e;function W$(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function gn(e,n,o){this.k=e,this.x=n,this.y=o}gn.prototype={constructor:gn,scale:function(e){return e===1?this:new gn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new gn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var xs=new gn(1,0,0);gn.prototype;function Ss(e){e.stopImmediatePropagation()}function Bi(e){e.preventDefault(),e.stopImmediatePropagation()}function J$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function X$(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function dh(){return this.__zoom||xs}function Z$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Q$(){return navigator.maxTouchPoints||"ontouchstart"in this}function eT(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function tT(){var e=J$,n=X$,o=eT,i=Z$,a=Q$,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=OA,d=cs("start","zoom","end"),u,m,h,f=500,y=150,k=0,_=10;function E(g){g.property("__zoom",dh).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(g,I,v,O){var x=g.selection?g.selection():g;x.property("__zoom",dh),g!==x?w(g,I,v,O):x.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},E.scaleBy=function(g,I,v,O){E.scaleTo(g,function(){var x=this.__zoom.k,z=typeof I=="function"?I.apply(this,arguments):I;return x*z},v,O)},E.scaleTo=function(g,I,v,O){E.transform(g,function(){var x=n.apply(this,arguments),z=this.__zoom,j=v==null?b(x):typeof v=="function"?v.apply(this,arguments):v,ne=z.invert(j),de=typeof I=="function"?I.apply(this,arguments):I;return o(p(N(z,de),j,ne),x,l)},v,O)},E.translateBy=function(g,I,v,O){E.transform(g,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,O)},E.translateTo=function(g,I,v,O,x){E.transform(g,function(){var z=n.apply(this,arguments),j=this.__zoom,ne=O==null?b(z):typeof O=="function"?O.apply(this,arguments):O;return o(xs.translate(ne[0],ne[1]).scale(j.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),z,l)},O,x)};function N(g,I){return I=Math.max(r[0],Math.min(r[1],I)),I===g.k?g:new gn(I,g.x,g.y)}function p(g,I,v){var O=I[0]-v[0]*g.k,x=I[1]-v[1]*g.k;return O===g.x&&x===g.y?g:new gn(g.k,O,x)}function b(g){return[(+g[0][0]+ +g[1][0])/2,(+g[0][1]+ +g[1][1])/2]}function w(g,I,v,O){g.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var x=this,z=arguments,j=A(x,z).event(O),ne=n.apply(x,z),de=v==null?b(ne):typeof v=="function"?v.apply(x,z):v,pe=Math.max(ne[1][0]-ne[0][0],ne[1][1]-ne[0][1]),he=x.__zoom,fe=typeof I=="function"?I.apply(x,z):I,ye=c(he.invert(de).concat(pe/he.k),fe.invert(de).concat(pe/fe.k));return function(_e){if(_e===1)_e=fe;else{var Re=ye(_e),ce=pe/Re[2];_e=new gn(ce,de[0]-Re[0]*ce,de[1]-Re[1]*ce)}j.zoom(null,_e)}})}function A(g,I,v){return!v&&g.__zooming||new $(g,I)}function $(g,I){this.that=g,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(g,I),this.taps=0}$.prototype={event:function(g){return g&&(this.sourceEvent=g),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(g,I){return this.mouse&&g!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&g!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&g!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(g){var I=Vn(this.that).datum();d.call(g,this.that,new W$(g,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),I)}};function L(g,...I){if(!e.apply(this,arguments))return;var v=A(this,I).event(g),O=this.__zoom,x=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),z=Bn(g);if(v.wheel)(v.mouse[0][0]!==z[0]||v.mouse[0][1]!==z[1])&&(v.mouse[1]=O.invert(v.mouse[0]=z)),clearTimeout(v.wheel);else{if(O.k===x)return;v.mouse=[z,O.invert(z)],br(this),v.start()}Bi(g),v.wheel=setTimeout(j,y),v.zoom("mouse",o(p(N(O,x),v.mouse[0],v.mouse[1]),v.extent,l));function j(){v.wheel=null,v.end()}}function T(g,...I){if(h||!e.apply(this,arguments))return;var v=g.currentTarget,O=A(this,I,!0).event(g),x=Vn(g.view).on("mousemove.zoom",de,!0).on("mouseup.zoom",pe,!0),z=Bn(g,v),j=g.clientX,ne=g.clientY;dA(g.view),Ss(g),O.mouse=[z,this.__zoom.invert(z)],br(this),O.start();function de(he){if(Bi(he),!O.moved){var fe=he.clientX-j,ye=he.clientY-ne;O.moved=fe*fe+ye*ye>k}O.event(he).zoom("mouse",o(p(O.that.__zoom,O.mouse[0]=Bn(he,v),O.mouse[1]),O.extent,l))}function pe(he){x.on("mousemove.zoom mouseup.zoom",null),uA(he.view,O.moved),Bi(he),O.event(he).end()}}function S(g,...I){if(e.apply(this,arguments)){var v=this.__zoom,O=Bn(g.changedTouches?g.changedTouches[0]:g,this),x=v.invert(O),z=v.k*(g.shiftKey?.5:2),j=o(p(N(v,z),O,x),n.apply(this,I),l);Bi(g),s>0?Vn(this).transition().duration(s).call(w,j,O,g):Vn(this).call(E.transform,j,O,g)}}function C(g,...I){if(e.apply(this,arguments)){var v=g.touches,O=v.length,x=A(this,I,g.changedTouches.length===O).event(g),z,j,ne,de;for(Ss(g),j=0;j<O;++j)ne=v[j],de=Bn(ne,this),de=[de,this.__zoom.invert(de),ne.identifier],x.touch0?!x.touch1&&x.touch0[2]!==de[2]&&(x.touch1=de,x.taps=0):(x.touch0=de,z=!0,x.taps=1+!!u);u&&(u=clearTimeout(u)),z&&(x.taps<2&&(m=de[0],u=setTimeout(function(){u=null},f)),br(this),x.start())}}function M(g,...I){if(this.__zooming){var v=A(this,I).event(g),O=g.changedTouches,x=O.length,z,j,ne,de;for(Bi(g),z=0;z<x;++z)j=O[z],ne=Bn(j,this),v.touch0&&v.touch0[2]===j.identifier?v.touch0[0]=ne:v.touch1&&v.touch1[2]===j.identifier&&(v.touch1[0]=ne);if(j=v.that.__zoom,v.touch1){var pe=v.touch0[0],he=v.touch0[1],fe=v.touch1[0],ye=v.touch1[1],_e=(_e=fe[0]-pe[0])*_e+(_e=fe[1]-pe[1])*_e,Re=(Re=ye[0]-he[0])*Re+(Re=ye[1]-he[1])*Re;j=N(j,Math.sqrt(_e/Re)),ne=[(pe[0]+fe[0])/2,(pe[1]+fe[1])/2],de=[(he[0]+ye[0])/2,(he[1]+ye[1])/2]}else if(v.touch0)ne=v.touch0[0],de=v.touch0[1];else return;v.zoom("touch",o(p(j,ne,de),v.extent,l))}}function B(g,...I){if(this.__zooming){var v=A(this,I).event(g),O=g.changedTouches,x=O.length,z,j;for(Ss(g),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),z=0;z<x;++z)j=O[z],v.touch0&&v.touch0[2]===j.identifier?delete v.touch0:v.touch1&&v.touch1[2]===j.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(j=Bn(j,this),Math.hypot(m[0]-j[0],m[1]-j[1])<_)){var ne=Vn(this).on("dblclick.zoom");ne&&ne.apply(this,arguments)}}}return E.wheelDelta=function(g){return arguments.length?(i=typeof g=="function"?g:_r(+g),E):i},E.filter=function(g){return arguments.length?(e=typeof g=="function"?g:_r(!!g),E):e},E.touchable=function(g){return arguments.length?(a=typeof g=="function"?g:_r(!!g),E):a},E.extent=function(g){return arguments.length?(n=typeof g=="function"?g:_r([[+g[0][0],+g[0][1]],[+g[1][0],+g[1][1]]]),E):n},E.scaleExtent=function(g){return arguments.length?(r[0]=+g[0],r[1]=+g[1],E):[r[0],r[1]]},E.translateExtent=function(g){return arguments.length?(l[0][0]=+g[0][0],l[1][0]=+g[1][0],l[0][1]=+g[0][1],l[1][1]=+g[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(g){return arguments.length?(o=g,E):o},E.duration=function(g){return arguments.length?(s=+g,E):s},E.interpolate=function(g){return arguments.length?(c=g,E):c},E.on=function(){var g=d.on.apply(d,arguments);return g===d?E:g},E.clickDistance=function(g){return arguments.length?(k=(g=+g)*g,E):Math.sqrt(k)},E.tapDistance=function(g){return arguments.length?(_=+g,E):_},E}const uh=Symbol("MiniMapSlots"),nT=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],oT={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},iT=t.defineComponent({...oT,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:n}){const o=e,i=t.inject(uh),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,h)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,nT))],64)):t.createCommentVNode("",!0)}}),aT=["width","height","viewBox","aria-labelledby"],rT=["id"],lT=["d","fill","stroke","stroke-width"],sT={name:"MiniMap",compatConfig:{MODE:3}},cT=t.defineComponent({...sT,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:h,d3Zoom:f,getNodesInitialized:y}=qe(),k=t.ref();t.provide(uh,o);const _=t.toRef(()=>{var x;return e.width??((x=i.style)==null?void 0:x.width)??a}),E=t.toRef(()=>{var x;return e.height??((x=i.style)==null?void 0:x.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",p=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),b=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),w=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=t.computed(()=>Ul(y.value.filter(x=>!x.hidden))),$=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),L=t.computed(()=>y.value&&y.value.length?S0(A.value,$.value):$.value),T=t.computed(()=>{const x=L.value.width/_.value,z=L.value.height/E.value;return Math.max(x,z)}),S=t.computed(()=>{const x=T.value*_.value,z=T.value*E.value,j=e.offsetScale*T.value;return{offset:j,x:L.value.x-(x-L.value.width)/2-j,y:L.value.y-(z-L.value.height)/2-j,width:x+j*2,height:z+j*2}}),C=t.computed(()=>!S.value.x||!S.value.y?"":`
|
|
53
53
|
M${S.value.x-S.value.offset},${S.value.y-S.value.offset}
|
|
54
54
|
h${S.value.width+S.value.offset*2}
|
|
55
55
|
v${S.value.height+S.value.offset*2}
|
|
@@ -62,5 +62,5 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
|
|
|
62
62
|
h${-($.value.width-2*e.maskBorderRadius)}
|
|
63
63
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
64
64
|
v${-($.value.height-2*e.maskBorderRadius)}
|
|
65
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(M=>{if(g.value){const z=$n(g.value),j=ye=>{if(ye.sourceEvent.type!=="wheel"||!h.value||!f.value)return;const ge=ye.sourceEvent.ctrlKey&&Ei()?10:1,me=-ye.sourceEvent.deltaY*(ye.sourceEvent.deltaMode===1?.05:ye.sourceEvent.deltaMode?1:.002)*e.zoomStep,se=c.value.zoom*2**(me*ge);f.value.scaleTo(h.value,se)},ie=ye=>{if(ye.sourceEvent.type!=="mousemove"||!h.value||!f.value)return;const ge=V.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),me={x:c.value.x-ye.sourceEvent.movementX*ge,y:c.value.y-ye.sourceEvent.movementY*ge},se=[[0,0],[u.value.width,u.value.height]],ke=Is.translate(me.x,me.y).scale(c.value.zoom),Se=f.value.constrain()(ke,se,d.value);f.value.transform(h.value,Se)},pe=Z$().wheelDelta(ye=>zl(ye)*(e.zoomStep/10)).on("zoom",e.pannable?ie:()=>{}).on("zoom.wheel",e.zoomable?j:()=>{});z.call(pe),M(()=>{z.on("zoom",null)})}},{flush:"post"});function T(M){const[z,j]=Tn(M);n("click",{event:M,position:{x:z,y:j}})}function D(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeClick(j),n("nodeClick",j)}function b(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeDoubleClick(j),n("nodeDblclick",j)}function w(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeMouseEnter(j),n("nodeMouseenter",j)}function v(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeMouseMove(j),n("nodeMousemove",j)}function O(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeMouseLeave(j),n("nodeMouseleave",j)}return(M,z)=>(t.openBlock(),t.createBlock(t.unref(pf),{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:g,width:_.value,height:E.value,viewBox:[S.value.x,S.value.y,S.value.width,S.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:T},[M.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(M.ariaLabel),9,oT)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),j=>(t.openBlock(),t.createBlock(tT,{id:j.id,key:j.id,f:"",position:j.computedPosition,dimensions:j.dimensions,selected:j.selected,dragging:j.dragging,style:t.normalizeStyle(j.style),class:t.normalizeClass(I.value(j)),color:p.value(j),"border-radius":M.nodeBorderRadius,"stroke-color":k.value(j),"stroke-width":M.nodeStrokeWidth,"shape-rendering":t.unref(N),type:j.type,hidden:j.hidden,onClick:ie=>D(ie,j),onDblclick:ie=>b(ie,j),onMouseenter:ie=>w(ie,j),onMousemove:ie=>v(ie,j),onMouseleave:ie=>O(ie,j)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:x.value,fill:M.maskColor,stroke:M.maskStrokeColor,"stroke-width":M.maskStrokeWidth,"fill-rule":"evenodd"},null,8,iT)],8,nT))]),_:1},8,["position","class"]))}}),lT=["d"],sT=["cx","cy","onDblclick"],cT=["x","y","onPointerdown","onDblclick"],dT=Ke(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(as),a=t.inject(oo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Bo,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((L,V)=>V===d.value?u.value:L)),{source:h,target:f,sourceSide:y,targetSide:g}=pp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),_=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Jf(h.value,y.value,m.value,f.value,g.value):Zf(h.value,m.value,f.value)),E=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Xf(h.value,y.value,m.value,f.value,g.value):tp(h.value,m.value,f.value).map((L,V)=>({point:L,segIndex:V})):[]),N=t.computed(()=>r.value?m.value:[]);function p(L,V){d.value=L,u.value={...c.value[L]},V.target.setPointerCapture(V.pointerId),V.stopPropagation()}function k(L){if(d.value<0)return;const V=o({x:L.clientX,y:L.clientY});u.value={x:V.x,y:V.y}}function I(L){var V,S;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(S=(V=L.target).releasePointerCapture)==null||S.call(V,L.pointerId)}function A(L,V){V.stopPropagation(),i==null||i.removePoint(n.id,L)}function $(L,V){if(!i)return;const S=o({x:V.clientX,y:V.clientY});i.insertPoint(n.id,L,{x:S.x,y:S.y})}return(L,V)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:_.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,lT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(S,x)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${x}`,cx:S.point.x,cy:S.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(T=>$(S.segIndex,T),["stop"])},null,42,sT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,(S,x)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${x}`,x:S.x-5,y:S.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:T=>p(x,T),onPointermove:k,onPointerup:I,onDblclick:T=>A(x,T)},null,42,cT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),uT=["data-theme"],mT={key:0,class:"em-ctx__sep",role:"separator"},fT=["aria-label"],pT={class:"em-ctx__swatches-label","aria-hidden":"true"},hT={class:"em-ctx__chips",role:"none"},yT=["aria-checked","aria-label","title","onClick"],gT=["aria-checked","aria-label","title","onClick"],bT=["disabled","onClick"],_T={class:"em-ctx__icon"},kT={class:"em-ctx__caption"},ET=Ke(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(p,k)=>Dt(o.locale??"ko",p,k),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(p,k){var $,L;r.value=k,l.value=($=p.target)!=null&&$.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=p.clientX,c.y=p.clientY,a.value=!0,window.addEventListener("keydown",_),window.addEventListener("resize",h),await t.nextTick();const I=s.value;if(!I)return;const A=I.getBoundingClientRect();c.x+A.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-A.width)),c.y+A.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-A.height)),(L=f()[0])==null||L.focus()}function h(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",_),window.removeEventListener("resize",h);const p=d;d=null,p!=null&&p.isConnected&&p.focus()}function f(){const p=s.value;if(!p)return[];const k=[];for(const I of Array.from(p.children))if(I.classList.contains("em-ctx__item"))I.disabled||k.push(I);else if(I.classList.contains("em-ctx__swatches")){const A=Array.from(I.querySelectorAll(".em-ctx__chip"));A.length&&k.push(A.find($=>$===document.activeElement)??A[0])}return k}function y(p){var $;const k=f();if(!k.length)return;const I=k.indexOf(document.activeElement),A=I<0?p>0?0:k.length-1:(I+p+k.length)%k.length;($=k[A])==null||$.focus()}function g(p){var $,L;const k=($=document.activeElement)==null?void 0:$.closest(".em-ctx__swatches");if(!k)return!1;const I=Array.from(k.querySelectorAll(".em-ctx__chip")),A=I.indexOf(document.activeElement);return A<0?!1:((L=I[(A+p+I.length)%I.length])==null||L.focus(),!0)}function _(p){var k,I;switch(p.key){case"Escape":p.stopPropagation(),h();return;case"ArrowDown":p.preventDefault(),y(1);return;case"ArrowUp":p.preventDefault(),y(-1);return;case"ArrowRight":g(1)&&p.preventDefault();return;case"ArrowLeft":g(-1)&&p.preventDefault();return;case"Home":p.preventDefault(),(k=f()[0])==null||k.focus();return;case"End":{p.preventDefault();const A=f();(I=A[A.length-1])==null||I.focus();return}case"Tab":p.preventDefault(),y(p.shiftKey?-1:1)}}function E(p){p.disabled||(p.handler(),h())}function N(p,k){p.onPick(k),h()}return t.onBeforeUnmount(h),n({open:m,close:h}),(p,k)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:h,onContextmenu:t.withModifiers(h,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:k[0]||(k[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(I,A)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:A},[I.type==="separator"?(t.openBlock(),t.createElementBlock("div",mT)):I.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":I.caption},[t.createElementVNode("span",pT,t.toDisplayString(I.caption),1),t.createElementVNode("div",hT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":I.current===null}]),role:"menuitemradio","aria-checked":I.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:$=>N(I,null)},null,10,yT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":I.current===$}]),style:t.normalizeStyle({background:t.unref(Mo)($)}),role:"menuitemradio","aria-checked":I.current===$,"aria-label":i(t.unref(to)($)),title:i(t.unref(to)($)),onClick:L=>N(I,$)},null,14,gT))),128))])],8,fT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":I.danger,"is-disabled":I.disabled}]),disabled:I.disabled,role:"menuitem",onClick:$=>E(I)},[t.createElementVNode("span",_T,[I.icon?(t.openBlock(),t.createBlock(Ae,{key:0,name:I.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",kT,t.toDisplayString(I.caption),1)],10,bT))],64))),128))],36)],8,uT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function sh(e,n){return n?`${e}:${n}`:e}function ch(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(sh(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 NT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=sh(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 dh(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(ch(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=ch(e.storageKey,s)),t.watch(o,s=>NT(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 Cs=[".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 zo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function wT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function IT(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 g=n(y.left,y.top+y.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,h=0;const f=()=>{const y=d.trim();if(y){const g=n(m,(u+h)/2);c.push({...i,x:g.x,y:g.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(f(),u=g.top,m=g.left,h=g.bottom,d=s[y]):(d+=s[y],h=Math.max(h,g.bottom))}return f(),c}function _r(e,n){const o=[];for(const i of e.querySelectorAll("*"))wT(i)&&(i.closest(Cs)||zo(i)&&o.push(...IT(i,n)));return o}function Vi(e){return Math.round(e*100)/100}function vT(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Cs)||!zo(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="${Vi(r.x)}" y="${Vi(r.y)}" width="${Vi(l.x-r.x)}" height="${Vi(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 CT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!zo(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=>Vi(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 uh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Cs)||!zo(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 Bi(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 xs(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||!zo(y))continue;const g=y.firstElementChild;if(g)if(f.type==="group"){const _=Bi(g,o);xs(s,_),i.push({..._,texts:[]});const E=g.querySelector(".em-group__label");E&&i.push({...Bi(E,o),stroke:"none",texts:[]}),i.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:_r(g,o)})}else if(f.type==="note"){const _={...Bi(g,o),texts:_r(g,o),lines:uh(g,g,o)};xs(s,_),r.push(_)}else{const _=Bi(g,o);xs(s,_);const E=_.radius??{tl:0,tr:0};a.push({..._,stroke:"none",texts:[]});const N=g.querySelector(".em-entity__header");if(N){const p=Bi(N,o);a.push({x:_.x,y:_.y,w:_.w,h:p.y+p.h-_.y,fill:p.fill,stroke:"none",radius:{tl:E.tl,tr:E.tr,br:0,bl:0},texts:[]})}a.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:_r(g,o),lines:uh(g,g,o),icons:vT(g,o)}),a.push({..._,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const y=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!zo(y))continue;const g=y.getAttribute("d");if(!g)continue;const _=getComputedStyle(y),E=_.strokeDasharray,N=CT(f);l.push({d:g,stroke:_.stroke,strokeWidth:parseFloat(_.strokeWidth)||1.5,strokeDasharray:E&&E!=="none"?E:void 0,labels:_r(f,o),markers:N.length?N:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Ss(e){return hc(xT(e))}function mh(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 fh(e,n="diagram.svg"){const o=Ss(e);mh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function ST(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 ph(e,n="diagram.png",o=2){const i=Ss(e),{w:a,h:r}=ST(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,h)=>{s.onload=()=>m(),s.onerror=()=>h(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");mh(u,n)}finally{URL.revokeObjectURL(l)}}const RT={class:"em-shortcuts"},AT={class:"em-shortcuts__list"},$T={class:"em-shortcuts__title"},TT={class:"em-shortcuts__keys"},MT={class:"em-shortcuts__kbd"},VT={key:0,class:"em-shortcuts__plus"},BT={class:"em-shortcuts__desc"},DT={class:"em-shortcuts__actions"},hh=Ke(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(s,c)=>Dt(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",RT,[t.createElementVNode("div",AT,[(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",$T,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",TT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,h)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+h},[t.createElementVNode("kbd",MT,t.toDisplayString(m),1),h<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",VT,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",BT,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",DT,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function Fo(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function OT(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 LT=["aria-label"],PT=["aria-activedescendant","aria-label","placeholder"],zT={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},FT=["aria-label"],UT={class:"em-cmdk__section","aria-hidden":"true"},HT=["id","aria-selected","onMouseenter","onClick"],jT={class:"em-cmdk__label"},KT={key:0,class:"em-cmdk__tag"},GT={key:1,class:"em-cmdk__sub"},YT=["aria-label"],qT={class:"em-cmdk__section","aria-hidden":"true"},WT=["id","aria-selected","aria-disabled","onMouseenter","onClick"],JT={class:"em-cmdk__label"},XT={key:1,class:"em-cmdk__empty"},ZT=Ke(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const I=c.value,A=a.state.logical.entities.map(L=>{var V,S,x,T,D,b;return{type:"goto",kind:"entity",id:L.modelId,label:((S=(V=L.table)==null?void 0:V.logicalName)==null?void 0:S[I])||L.name,sub:(x=L.table)==null?void 0:x.physicalName,match:Fo(L.name,(D=(T=L.table)==null?void 0:T.logicalName)==null?void 0:D[I],(b=L.table)==null?void 0:b.physicalName)??""}}),$=a.state.logical.groups.map(L=>{var V,S,x,T;return{type:"goto",kind:"group",id:L.modelId,label:((V=L.name)==null?void 0:V[I])||((S=L.name)==null?void 0:S.ko)||L.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:Fo((x=L.name)==null?void 0:x[I],(T=L.name)==null?void 0:T.ko,L.packageName)??""}});return[...A,...$]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const I=[];a.editable.value&&(I.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),I.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),I.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),I.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),I.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),I.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),I.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),I.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const A of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])I.push({type:"action",id:`dm-${A}`,label:a.t(u[A]),run:()=>a.displayMode.value=A});return I});function h(I,A){return I.label.toLowerCase().includes(A)}const f=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?d.value.filter(A=>A.match.includes(I)):d.value}),y=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?m.value.filter(A=>h(A,I)):m.value}),g=t.computed(()=>[...f.value,...y.value]);t.watch([f,y],()=>{l.value=0});function _(I){return g.value.indexOf(I)}const E=I=>`em-cmdk-opt-${I}`,N=t.computed(()=>g.value[l.value]?E(l.value):void 0);t.watch(l,async()=>{var A;await t.nextTick();const I=N.value;I&&((A=document.getElementById(I))==null||A.scrollIntoView({block:"nearest"}))});function p(I){if(I.type==="goto")a.selection.value={kind:I.kind,id:I.id},a.requestFocus(I.id);else{if(I.disabled)return;I.run()}i("close")}function k(I){if(I.key==="Escape"){i("close"),I.preventDefault();return}if(I.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),I.preventDefault();return}if(I.key==="ArrowUp"){l.value=Math.max(l.value-1,0),I.preventDefault();return}if(I.key==="Enter"){const A=g.value[l.value];A&&p(A),I.preventDefault();return}I.key==="Tab"&&I.preventDefault()}return t.nextTick(()=>{var I;return(I=s.value)==null?void 0:I.focus()}),(I,A)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:A[1]||(A[1]=t.withModifiers($=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":A[0]||(A[0]=$=>r.value=$),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":N.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:k},null,40,PT),[[t.vModelText,r.value]]),t.createElementVNode("div",zT,[g.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",UT,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,$=>(t.openBlock(),t.createElementBlock("button",{id:E(_($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":_($)===l.value}]),role:"option","aria-selected":_($)===l.value,onMouseenter:L=>l.value=_($),onClick:L=>p($)},[t.createElementVNode("span",jT,t.toDisplayString($.label),1),$.tag?(t.openBlock(),t.createElementBlock("span",KT,t.toDisplayString($.tag),1)):$.sub?(t.openBlock(),t.createElementBlock("span",GT,t.toDisplayString($.sub),1)):t.createCommentVNode("",!0)],42,HT))),128))],8,FT)):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",qT,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,$=>(t.openBlock(),t.createElementBlock("button",{id:E(_($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":_($)===l.value,"is-disabled":$.disabled}]),role:"option","aria-selected":_($)===l.value,"aria-disabled":$.disabled||void 0,onMouseenter:L=>l.value=_($),onClick:L=>p($)},[t.createElementVNode("span",JT,t.toDisplayString($.label),1)],42,WT))),128))],8,YT)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",XT,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,LT)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function QT(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const eM={key:0,class:"em-canvas__empty","aria-hidden":"true"},tM={class:"em-canvas__empty-title"},nM=["innerHTML"],oM=["innerHTML"],iM=["innerHTML"],aM={key:1,class:"em-canvas__empty-title"},rM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},lM={class:"em-conflict-banner__body"},sM={class:"em-conflict-banner__title"},cM={class:"em-conflict-banner__detail"},dM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Rs="nc:",yh=Ke(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(C){l.value=C,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,C=>{C&&c(C.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const C=QT(i.opConflict.value);return C?{title:i.t(C.titleKey),detail:i.t(C.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),h={x:0,y:0};function f(C){h.x=C.clientX,h.y=C.clientY}const y=t.ref(null);t.provide(Za,y);const g=t.ref(null);t.provide(Bf,g);const _=t.ref(null),E=t.computed(()=>{const C=_.value,R=new Set;if(!C)return R;if(C.kind==="entity")R.add(C.id);else if(C.kind==="group"){const W=i.resolved.value.groups.find(re=>re.group.modelId===C.id);for(const re of(W==null?void 0:W.group.memberEntityRefs)??[])R.add(re)}return R}),N=t.computed(()=>{const C=_.value,R=new Set(E.value),W=new Set,re=new Set;if(!C)return{related:R,edges:W,notes:re};if(C.kind==="note"){re.add(C.id);for(const Ce of i.resolved.value.noteConnections)Ce.noteRef===C.id&&R.add(Ce.targetRef);return{related:R,edges:W,notes:re}}const ne=E.value;if(!ne.size)return{related:R,edges:W,notes:re};for(const Ce of i.resolved.value.associations){const{end1:de,end2:xe}=Ce.association;(ne.has(de.entityRef)||ne.has(xe.entityRef))&&(W.add(Ce.association.modelId),R.add(de.entityRef),R.add(xe.entityRef))}for(const Ce of i.resolved.value.noteConnections)R.has(Ce.targetRef)&&re.add(Ce.noteRef);return{related:R,edges:W,notes:re}});t.provide(Bo,{source:_,active:t.computed(()=>_.value!==null),primaryEntityIds:E,relatedEntityIds:t.computed(()=>N.value.related),relatedEdgeIds:t.computed(()=>N.value.edges),relatedNoteIds:t.computed(()=>N.value.notes),hoverGroupId:t.computed(()=>{var C;return((C=_.value)==null?void 0:C.kind)==="group"?_.value.id:null}),setEntityHover:C=>{g.value||m.value||(_.value=C?{kind:"entity",id:C}:null)},setGroupHover:C=>{g.value||m.value||(_.value=C?{kind:"group",id:C}:null)},setNoteHover:C=>{g.value||m.value||(_.value=C?{kind:"note",id:C}:null)}}),t.provide(oo,i);const p=UC(),k=t.computed(()=>p(i.state.logical,i.embeddableCatalog.value));t.provide(Lf,k);const I=dh({expandableKeys:()=>[],defaultCollapsed:jC,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(zf,{isCollapsed:I.isCollapsed,toggle:I.toggle}),t.provide(Df,{marks:t.toRef(o,"diffMarks")});function A(C,R){return`${Rs}${C}:${R}`}function $(C){if(!C.startsWith(Rs))return null;const[R,W]=C.slice(Rs.length).split(":");return R&&W?{noteRef:R,targetRef:W}:null}t.provide(as,{points:C=>{var W,re;const R=$(C);return R?((W=i.resolved.value.noteConnections.find(ne=>ne.noteRef===R.noteRef&&ne.targetRef===R.targetRef))==null?void 0:W.waypoints)??[]:((re=i.resolved.value.associations.find(ne=>ne.association.modelId===C))==null?void 0:re.waypoints)??[]},movePoint:(C,R,W)=>{const re=$(C);re?i.moveNoteConnectionWaypoint(re.noteRef,re.targetRef,R,W):i.moveWaypoint(C,R,W)},insertPoint:(C,R,W)=>{const re=$(C);re?i.addNoteConnectionWaypoint(re.noteRef,re.targetRef,R,W):i.addWaypoint(C,R,W)},removePoint:(C,R)=>{const W=$(C);W?i.removeNoteConnectionWaypoint(W.noteRef,W.targetRef,R):i.removeWaypoint(C,R)}});const L=je(),{nodes:V,edges:S,findNode:x,findEdge:T,addNodes:D,addEdges:b,removeNodes:w,removeEdges:v,fitView:O,setCenter:M,getViewport:z,screenToFlowCoordinate:j,getSelectedNodes:ie,updateNodeInternals:pe}=L,ye=t.ref(!1);async function ge(C){ye.value=!0,await t.nextTick(),await new Promise(R=>requestAnimationFrame(()=>R(null)));try{return await C()}finally{ye.value=!1}}async function me(){try{await ge(()=>fh(L))}catch(C){console.error("[entity-modeler] SVG export failed",C),c(i.t("em.canvas.exportFailed"))}}async function se(){try{await ge(()=>ph(L))}catch(C){console.error("[entity-modeler] PNG export failed",C),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:me,exportPng:se,fitView:O});const ke=t.computed(()=>i.resolved.value.entities.length===0);function Se(){const C=z(),{width:R,height:W}=L.dimensions.value;return{x:(R/2-C.x)/C.zoom,y:(W/2-C.y)/C.zoom}}function ce(){const C=Se();i.addEntity("NewEntity",{x:C.x,y:C.y})}function fe(){const C=Se();i.addNote("메모",{x:C.x,y:C.y})}function oe(C){for(const R of i.resolved.value.groups){const{location:W,size:re}=R.geo;if(C.x>=W.x&&C.x<=W.x+re.width&&C.y>=W.y&&C.y<=W.y+re.height)return R.group.modelId}return null}function le(C,R){return C.x===R.x&&C.y===R.y}function ue(C,R){return(C==null?void 0:C.width)===(R==null?void 0:R.width)&&(C==null?void 0:C.height)===(R==null?void 0:R.height)}function F(C,R){return C.entity===R.entity&&C.displayMode===R.displayMode&&C.collapsed===R.collapsed&&C.locked===R.locked&&C.groupRef===R.groupRef&&ue(C.size,R.size)&&C.style===R.style&&C.attributeStyles===R.attributeStyles&&C.operationStyles===R.operationStyles}function P(C,R){const W=Object.keys(C);if(W.length!==Object.keys(R).length)return!1;for(const re of W)if(re==="geo"){const ne=C.geo,Ce=R.geo;if(!le(ne.location,Ce.location)||!ue(ne.size,Ce.size))return!1}else if(C[re]!==R[re])return!1;return!0}function U(){const C=i.resolved.value,R=new Map(C.groups.map(de=>[de.group.modelId,de.geo])),W=new Set(C.groups.map(de=>de.group.modelId)),re=new Set([...W,...C.entities.map(de=>de.entity.modelId),...C.notes.map(de=>de.note.modelId)]);for(const de of[...V.value])re.has(de.id)||w([de.id]);for(const de of C.groups){const xe=de.group.modelId,Fe={width:`${de.geo.size.width}px`,height:`${de.geo.size.height}px`},He={group:de.group,style:de.style,locked:de.locked},rt=de.locked?!1:void 0,ze=x(xe);if(ze){le(ze.position,de.geo.location)||(ze.position={...de.geo.location});const ot=ze.data;(ot.group!==He.group||ot.style!==He.style||ot.locked!==He.locked)&&(ze.data=He);const tt=ze.style;((tt==null?void 0:tt.width)!==Fe.width||(tt==null?void 0:tt.height)!==Fe.height)&&(ze.style=Fe),ze.draggable!==rt&&(ze.draggable=rt)}else D([{id:xe,type:"group",position:{...de.geo.location},draggable:rt,style:Fe,data:He}])}for(const de of C.entities){const xe=de.entity.modelId,Fe=de.groupRef&&W.has(de.groupRef)?de.groupRef:void 0,He={entity:de.entity,displayMode:i.displayMode.value,collapsed:de.collapsed,locked:de.locked,groupRef:Fe,size:de.geo.size,style:de.style,attributeStyles:de.attributeStyles,operationStyles:de.operationStyles},rt=de.locked?!1:void 0,ze=de.locked?!1:void 0,ot=Fe?R.get(Fe):void 0,tt=ot?{x:de.geo.location.x-ot.location.x,y:de.geo.location.y-ot.location.y}:{...de.geo.location},Ge=x(xe);Ge?(le(Ge.position,tt)||(Ge.position=tt),F(Ge.data,He)||(Ge.data=He),Ge.parentNode!==Fe&&(Ge.parentNode=Fe),Ge.draggable!==rt&&(Ge.draggable=rt),Ge.connectable!==ze&&(Ge.connectable=ze)):D([{id:xe,type:"entity",position:tt,parentNode:Fe,draggable:rt,connectable:ze,data:He}])}for(const de of C.notes){const xe=de.note,Fe=xe.modelId,He=de.groupRef&&W.has(de.groupRef)?de.groupRef:void 0,rt={note:xe,groupRef:He},ze={width:`${xe.geo.size.width}px`,height:`${xe.geo.size.height}px`},ot=He?R.get(He):void 0,tt=ot?{x:xe.geo.location.x-ot.location.x,y:xe.geo.location.y-ot.location.y}:{...xe.geo.location},Ge=x(Fe);if(Ge){le(Ge.position,tt)||(Ge.position=tt);const so=Ge.data;(so.groupRef!==He||!P(so.note,xe))&&(Ge.data=rt);const kn=Ge.style;((kn==null?void 0:kn.width)!==ze.width||(kn==null?void 0:kn.height)!==ze.height)&&(Ge.style=ze),Ge.parentNode!==He&&(Ge.parentNode=He)}else D([{id:Fe,type:"note",position:tt,parentNode:He,style:ze,data:rt}])}const ne=new Map(C.associations.map(de=>[de.association.modelId,de])),Ce=new Set(C.noteConnections.map(de=>A(de.noteRef,de.targetRef)));for(const de of[...S.value])!ne.has(de.id)&&!Ce.has(de.id)&&v([de.id]);for(const[de,xe]of ne){const Fe={id:de,type:"association",source:xe.association.end1.entityRef,target:xe.association.end2.entityRef,sourceHandle:xe.sourceColumnRef?`r:${xe.sourceColumnRef}`:void 0,targetHandle:xe.targetColumnRef?`l:${xe.targetColumnRef}`:void 0,data:{association:xe.association,sourceColumnRef:xe.sourceColumnRef,targetColumnRef:xe.targetColumnRef}},He=T(de);if(He){const rt=He.data;(rt.association!==Fe.data.association||rt.sourceColumnRef!==Fe.data.sourceColumnRef||rt.targetColumnRef!==Fe.data.targetColumnRef)&&(He.data=Fe.data),He.sourceHandle!==Fe.sourceHandle&&(He.sourceHandle=Fe.sourceHandle),He.targetHandle!==Fe.targetHandle&&(He.targetHandle=Fe.targetHandle)}else b([Fe])}for(const de of C.noteConnections){const xe=A(de.noteRef,de.targetRef),Fe={noteRef:de.noteRef,targetRef:de.targetRef};T(xe)||b([{id:xe,type:"note-connection",source:de.noteRef,target:de.targetRef,data:Fe}])}}const Q=new Set;let X=!1,_e=!1;const he=new Map;function we(C){const R=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(C)}"]`);if(!R)return null;let W=`${R.offsetHeight}`;for(const re of R.querySelectorAll(".em-entity__row"))W+=`|${re.dataset.attr}:${re.offsetTop}`;return W}function Ie(){_e=!1;const C=X;X=!1;const R=[...Q];if(Q.clear(),C){pe();for(const re of V.value){const ne=we(re.id);ne!==null&&he.set(re.id,ne)}return}const W=[];for(const re of R){const ne=we(re);if(ne===null){he.delete(re);continue}he.get(re)!==ne&&(he.set(re,ne),W.push(re))}W.length&&pe(W)}function q(C){if(C)for(const R of C)Q.add(R);else X=!0;_e||(_e=!0,t.nextTick(()=>requestAnimationFrame(Ie)))}t.provide(Of,{mark:C=>q([C])});function K(){const C=ie.value.map(W=>W.id);if(C.length)return C;const R=i.selection.value;return R&&(R.kind==="entity"||R.kind==="note"||R.kind==="group")?[R.id]:[]}function J(){return ie.value.filter(C=>C.type==="entity").map(C=>C.id)}function ve(){return ie.value.filter(C=>C.type==="group").map(C=>C.id)}function Te(C){var R;return[...((R=i.state.logical.groups.find(W=>W.modelId===C))==null?void 0:R.memberEntityRefs)??[]]}function G(){const C=ve().flatMap(Te);return[...new Set([...J(),...C])]}function te(){return ve().length>0||J().length>1}function Y(){te()?i.copy(G()):i.copy()}async function ae(C){if(!C.length)return;await t.nextTick();const R=ie.value;R.length&&L.removeSelectedNodes(R);const W=C.map(re=>x(re)).filter(re=>!!re);W.length&&L.addSelectedNodes(W)}function Be(C){if(te()&&J().includes(C)){const R=G();return{caption:i.t("em.ctx.copyN",{n:R.length}),icon:"copy",handler:()=>i.copy(R)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:C},i.copy()}}}function Ve(C){var ne;const R=C.target;if(R&&(R.tagName==="INPUT"||R.tagName==="TEXTAREA"||R.isContentEditable))return;if(C.key==="?"){a.openModal({component:hh,bind:{locale:i.uiLocale.value}}),C.preventDefault();return}if((C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="k"){r.value=!0,C.preventDefault();return}if(!i.editable.value){(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="c"&&(Y(),C.preventDefault());return}if(C.key==="Delete"||C.key==="Backspace"){i.deleteSelection()&&C.preventDefault();return}if(C.key==="ArrowUp"||C.key==="ArrowDown"||C.key==="ArrowLeft"||C.key==="ArrowRight"){if(((ne=i.selection.value)==null?void 0:ne.kind)==="attribute"){if(C.key==="ArrowUp"||C.key==="ArrowDown"){const Fe=C.key==="ArrowDown"?1:-1;(C.altKey?i.nudgeSelectedAttributes(Fe):i.moveAttributeFocus(Fe))&&C.preventDefault()}return}const Ce=C.shiftKey?10:1,de=C.key==="ArrowLeft"?-Ce:C.key==="ArrowRight"?Ce:0,xe=C.key==="ArrowUp"?-Ce:C.key==="ArrowDown"?Ce:0;i.nudgeNodes(K(),de,xe)&&C.preventDefault();return}if(!(C.metaKey||C.ctrlKey))return;const re=C.key.toLowerCase();re==="c"?(Y(),C.preventDefault()):re==="v"?(ae(i.paste()),C.preventDefault()):re==="z"&&(C.shiftKey?i.redo():i.undo(),C.preventDefault())}t.onMounted(async()=>{U(),await t.nextTick(),O(),q(),window.addEventListener("keydown",Ve),window.addEventListener("pointerup",H),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ve),window.removeEventListener("pointerup",H),window.removeEventListener("pointermove",f)});function H(){y.value=null}function B(){m.value=!0,_.value=null}function Pe(){var re;m.value=!1;const C=(re=document.elementFromPoint(h.x,h.y))==null?void 0:re.closest(".vue-flow__node"),R=C==null?void 0:C.dataset.id;if(!R){_.value=null;return}const W=C.classList.contains("vue-flow__node-group")?"group":C.classList.contains("vue-flow__node-note")?"note":"entity";_.value={kind:W,id:R}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],U),t.watch(()=>i.resolved.value,C=>{const R=_.value;if(!R)return;(R.kind==="entity"?C.entities.some(re=>re.entity.modelId===R.id):R.kind==="group"?C.groups.some(re=>re.group.modelId===R.id):C.notes.some(re=>re.note.modelId===R.id))||(_.value=null)});function Ze(C){const R=C.computedPosition??C.position,W=C.dimensions??{width:0,height:0};return{x:R.x+W.width/2,y:R.y+W.height/2}}function Ue(C){const R=C.node;if(R){if(_.value=null,R.type==="group"){const W=i.resolved.value.groups.find(re=>re.group.modelId===R.id);g.value=W?{groupId:R.id,dx:R.position.x-W.geo.location.x,dy:R.position.y-W.geo.location.y}:null,y.value=null;return}if(R.type!=="entity"&&R.type!=="note"){y.value=null;return}y.value=oe(Ze(R))}}function Le(C){var re;y.value=null,g.value=null;const R=(re=C.nodes)!=null&&re.length?C.nodes:[C.node],W=R.filter(ne=>(ne==null?void 0:ne.type)==="group");if(W.length){for(const ne of W){if(!ne)continue;const Ce=i.resolved.value.entities.filter(de=>de.groupRef===ne.id).map(de=>{const xe=x(de.entity.modelId),Fe=(xe==null?void 0:xe.computedPosition)??(xe==null?void 0:xe.position)??{x:0,y:0};return{id:de.entity.modelId,location:{x:Fe.x,y:Fe.y}}});i.dragGroup(ne.id,{x:ne.position.x,y:ne.position.y},Ce)}return}for(const ne of R){if(!ne||ne.type==="group")continue;const Ce=ne.computedPosition??ne.position,de=ne.dimensions??{width:0,height:0},xe={x:Ce.x+de.width/2,y:Ce.y+de.height/2};ne.type==="note"?i.dropNote(ne.id,{x:Ce.x,y:Ce.y},oe(xe)):i.dropEntity(ne.id,{x:Ce.x,y:Ce.y},oe(xe))}}function De(C){var Fe,He,rt,ze,ot;if(!i.editable.value||!C.source||!C.target)return;const R=((Fe=x(C.source))==null?void 0:Fe.type)==="note",W=((He=x(C.target))==null?void 0:He.type)==="note";if(R||W){if(R&&W)return;const tt=R?C.source:C.target,Ge=R?C.target:C.source;((rt=x(Ge))==null?void 0:rt.type)==="entity"&&i.addNoteConnection(tt,Ge);return}const re=tt=>{var Ge;return(Ge=i.state.logical.entities.find(so=>so.modelId===tt))==null?void 0:Ge.stereotype},ne=re(C.source)==="JPA_EMBEDDABLE",Ce=re(C.target)==="JPA_EMBEDDABLE";if(ne||Ce){if(ne&&Ce)return;const tt=ne?C.source:C.target,Ge=ne?C.target:C.source;i.addEmbedAssociation(Ge,tt);return}const de=(ze=C.sourceHandle)!=null&&ze.startsWith("r:")?C.sourceHandle.slice(2):void 0,xe=(ot=C.targetHandle)!=null&&ot.startsWith("l:")?C.targetHandle.slice(2):void 0;i.addAssociation(C.source,C.target,de,xe)}const Z=t.ref(null);function dt(C,R){var re;const W=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=W==null?void 0:W.attributeStyles)==null?void 0:re[R])}function bn(C,R){var re;const W=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=W==null?void 0:W.operationStyles)==null?void 0:re[R])}function Et(C){var R;return _t((R=i.state.layout.groupLayouts.find(W=>W.groupRef===C))==null?void 0:R.style)}function _n(C){var R;return _t((R=i.state.layout.notes.find(W=>W.modelId===C))==null?void 0:R.style)}function Ee(C){var ne,Ce;if(C.preventDefault(),!i.editable.value)return;const R=()=>j({x:C.clientX,y:C.clientY}),W=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const de=R();i.addEntity("NewEntity",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const de=R();i.addNote("메모",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const de=R();i.addEmptyGroup({x:de.x,y:de.y})}}],re=(ne=i.clipboard.value)==null?void 0:ne.kind;(re==="entity"||re==="entities")&&W.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>ae(i.paste())}),i.resolved.value.entities.length>0&&W.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()}),(Ce=Z.value)==null||Ce.open(C,W)}function at({event:C,node:R}){var Fe,He,rt,ze,ot,tt,Ge,so,kn,Eh,Nh,wh,Ih,vh,Ch,xh,Sh,Rh,Ah;const W=C;if(W.preventDefault(),!i.editable.value){if(R.type==="group"||R.type==="note")return;const Ye=(He=(Fe=W.target)==null?void 0:Fe.closest("[data-attr]"))==null?void 0:He.dataset.attr;if(Ye){const lt=i.selection.value;(lt==null?void 0:lt.kind)==="attribute"&<.entityId===R.id&<.ids.includes(Ye)||i.selectAttribute(R.id,Ye);const En=((rt=i.selection.value)==null?void 0:rt.kind)==="attribute"&&i.selection.value.entityId===R.id?[...i.selection.value.ids]:[Ye];(ze=Z.value)==null||ze.open(W,[{caption:En.length>1?i.t("em.ctx.copyN",{n:En.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(ot=Z.value)==null||ot.open(W,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Wa(a,i,R.id)},Be(R.id)]);return}if(R.type==="group"){const Ye=i.isGroupLocked(R.id),lt=[];Ye||lt.push({type:"swatches",caption:i.t("em.common.color"),current:Et(R.id),onPick:En=>i.setGroupSwatch(R.id,En)},{type:"separator"});const ht=te()&&ve().includes(R.id)?G():Te(R.id);ht.length&<.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(ht)}),lt.push({caption:Ye?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Ye?"unlock":"lock",handler:()=>i.setGroupLocked(R.id,!Ye)}),Ye||lt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(R.id)}),(tt=Z.value)==null||tt.open(W,lt);return}if(R.type==="note"){(Ge=Z.value)==null||Ge.open(W,[{type:"swatches",caption:i.t("em.common.color"),current:_n(R.id),onPick:Ye=>i.setNoteSwatch(R.id,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(R.id)}]);return}const re=(kn=(so=W.target)==null?void 0:so.closest("[data-attr]"))==null?void 0:kn.dataset.attr;if(re){const Ye=i.selection.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ye.entityId===R.id&&Ye.ids.includes(re)||i.selectAttribute(R.id,re);const ht=((Eh=i.selection.value)==null?void 0:Eh.kind)==="attribute"&&i.selection.value.entityId===R.id?[...i.selection.value.ids]:[re];if(i.isEntityLocked(R.id)){(Nh=Z.value)==null||Nh.open(W,[{caption:ht.length>1?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const En=ht.length>1,As=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(R.id)},{type:"swatches",caption:En?i.t("em.ctx.colorN",{n:ht.length}):i.t("em.common.color"),current:En?null:dt(R.id,re),onPick:hD=>i.setAttributeSwatches(R.id,ht,hD)},{type:"separator"},{caption:En?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Di=i.clipboard.value;(Di==null?void 0:Di.kind)==="attribute"&&As.push({caption:Di.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Di.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:R.id},i.paste()}}),As.push({type:"separator"},{caption:En?i.t("em.ctx.deleteAttrN",{n:ht.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(R.id,ht)}),(wh=Z.value)==null||wh.open(W,As);return}const ne=(vh=(Ih=W.target)==null?void 0:Ih.closest("[data-op]"))==null?void 0:vh.dataset.op;if(ne){if(i.isEntityLocked(R.id))return;(Ch=Z.value)==null||Ch.open(W,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(R.id)},{type:"swatches",caption:i.t("em.common.color"),current:bn(R.id,ne),onPick:Ye=>i.setOperationSwatch(R.id,ne,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(R.id,ne)}]);return}const Ce=i.resolved.value.entities.find(Ye=>Ye.entity.modelId===R.id),de=!!(Ce!=null&&Ce.locked),xe=[{caption:de?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Wa(a,i,R.id)}];if(!de){xe.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(R.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(R.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const lt=ie.value.filter(ht=>ht.type==="entity").map(ht=>ht.id);i.createGroup(lt.includes(R.id)&<.length?lt:[R.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(R.id,R.id)});const Ye=i.embeddableCatalog.value;if(Ye.length){xe.push({type:"separator"});for(const lt of Ye){const ht=((xh=lt.label)==null?void 0:xh[i.userLanguage.value])??((Sh=lt.label)==null?void 0:Sh.ko)??((Rh=lt.label)==null?void 0:Rh.en)??lt.type;xe.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:ht}),icon:"link",handler:()=>i.addPredefinedEmbed(R.id,lt.type)})}}}if(xe.push({type:"separator"}),xe.push({caption:Ce!=null&&Ce.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Ce!=null&&Ce.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(R.id,!(Ce!=null&&Ce.collapsed))}),Ce!=null&&Ce.groupRef&&!de&&xe.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(R.id)}),xe.push({caption:de?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:de?"unlock":"lock",handler:()=>i.setEntityLocked(R.id,!de)}),xe.push(Be(R.id)),!de){const Ye=i.clipboard.value;(Ye==null?void 0:Ye.kind)==="attribute"&&xe.push({caption:Ye.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Ye.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:R.id},i.paste()}}),xe.push({type:"separator"}),xe.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(R.id)})}(Ah=Z.value)==null||Ah.open(W,xe)}function zt({event:C,edge:R}){var Ce,de;const W=C;if(W.preventDefault(),!i.editable.value)return;const re=$(R.id);if(re){(Ce=Z.value)==null||Ce.open(W,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(re.noteRef,re.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(re.noteRef,re.targetRef)}]);return}const ne=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(R.id)}];i.isAssociationLocked(R.id)||ne.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(R.id)}),(de=Z.value)==null||de.open(W,ne)}function ut(C){return C==="group"?"group":C==="note"?"note":"entity"}function en({node:C}){if(ie.value.length>1){i.selection.value=null;return}i.selection.value={kind:ut(C.type),id:C.id}}function tn({nodes:C}){C.length>1&&(i.selection.value=null)}function Ne({edge:C}){const R=$(C.id);i.selection.value=R?{kind:"note",id:R.noteRef}:{kind:"association",id:C.id}}function et(C){const R=i.selection.value;return!!R&&R.kind!=="attribute"&&R.id===C.id}function Ft(C){var R,W;return et(C)?C.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":C.type==="note"?"var(--em-note-soft)":C.type==="group"?yf(_t((R=C.data)==null?void 0:R.style),!0)??"var(--em-mm-group)":yf(_t((W=C.data)==null?void 0:W.style))??"var(--em-mm-entity)"}function pt(C){return et(C)?"var(--em-selection)":C.type==="note"?"var(--em-note-accent)":C.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function nt(C,R){M(C,R,{zoom:z().zoom,duration:350})}t.watch(()=>i.focusRequest.value,C=>{if(!C)return;const R=x(C.id);if(!R)return;const W=R.computedPosition??R.position,re=R.dimensions??{width:0,height:0};nt(W.x+re.width/2,W.y+re.height/2)});function Uo({position:C}){nt(C.x,C.y)}function Ho({node:C}){i.selection.value={kind:ut(C.type),id:C.id};const R=C.computedPosition??C.position,W=C.dimensions??{width:0,height:0};nt(R.x+W.width/2,R.y+W.height/2)}function jo({node:C}){O({nodes:[C.id],duration:350,maxZoom:1.2,padding:.6})}return(C,R)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(_w),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ye.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(un).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:B,onMoveEnd:Pe,onConnect:De,onConnectStart:R[1]||(R[1]=W=>u.value=!0),onConnectEnd:R[2]||(R[2]=W=>u.value=!1),onNodeDrag:Ue,onNodeDragStop:Le,onNodeClick:en,onEdgeClick:Ne,onSelectionChange:tn,onPaneClick:R[3]||(R[3]=W=>t.unref(i).selection.value=null),onPaneContextMenu:Ee,onNodeContextMenu:at,onEdgeContextMenu:zt},{"node-group":t.withCtx(W=>[t.createVNode(Yf,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),"node-entity":t.withCtx(W=>[t.createVNode(Gf,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),"node-note":t.withCtx(W=>[t.createVNode(qf,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),"edge-association":t.withCtx(W=>[t.createVNode(hp,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),"edge-note-connection":t.withCtx(W=>[t.createVNode(dT,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(Zx),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(IS),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(io),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:ce},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(io),{title:t.unref(i).t("em.ctx.addNote"),onClick:fe},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(io),{title:t.unref(i).t("em.palette.autoLayout"),onClick:R[0]||(R[0]=W=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(rT),{key:1,pannable:"",width:224,height:160,"node-color":Ft,"node-stroke-color":pt,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:Uo,onNodeClick:Ho,onNodeDblclick:jo})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ke.value?(t.openBlock(),t.createElementBlock("div",eM,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",tM,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,nM),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,oM),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,iM)],64)):(t.openBlock(),t.createElementBlock("p",aM,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(ZT,{key:1,controller:t.unref(i),onClose:R[4]||(R[4]=W=>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(Ae,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",lM,[t.createElementVNode("strong",sM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",cM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(ET,{ref_key:"menuRef",ref:Z,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",dM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),uM={class:"em-explorer em-scroll-overlay"},mM={class:"em-explorer__search"},fM=["placeholder","aria-label"],pM=["aria-label","title"],hM={key:0,class:"em-explorer__empty"},yM=["aria-label"],gM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],bM=["onClick"],_M=["title"],kM={class:"em-key-slot"},EM={class:"em-key-slot"},NM={class:"em-explorer__label"},wM={key:2,class:"em-explorer__sr"},gh=Ke(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.computed(()=>{var ke,Se;const D=i.resolved.value,b=i.displayMode.value,w=i.userLanguage.value,v=ce=>{var fe,oe,le;return zi(b,ce.name,(oe=(fe=ce.table)==null?void 0:fe.logicalName)==null?void 0:oe[w],(le=ce.table)==null?void 0:le.physicalName,i.t("em.node.logicalMissing"))},O=b==="PHYSICAL"||b==="LOGICAL_PHYSICAL",M=ce=>{const fe=ce.attrType.startsWith("RELATION")&&ce.dbAttrs.length>0;return{icon:ce.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:ce.identifier,fk:fe&&O}}},z=ce=>ce.attrType.startsWith("EMBED")&&ce.dbAttrs.length>0,j=b==="PHYSICAL"||b==="LOGICAL_PHYSICAL",ie=ce=>{if(ce.attrType!=="EMBED_PREDEF")return ce.dbAttrs;const fe=i.embeddableCatalog.value.find(oe=>oe.type===ce.type);return fe?ce.dbAttrs.map((oe,le)=>{const ue=fe.fields[le];return ue?{...oe,physicalName:oe.physicalName||ue.physicalName,logicalName:oe.logicalName??ue.logicalName,dataType:oe.dataType||ue.dataType,length:oe.length??ue.length}:oe}):ce.dbAttrs},pe=(ce,fe)=>{var F,P,U,Q,X,_e,he,we,Ie;const oe={entityId:fe,attrId:ce.modelId};if(z(ce)){const q=Mr(b,ce);return{key:`attr:${ce.modelId}`,label:ce.name+(q?` : ${q}`:""),icon:"table",attrRef:oe,focusId:fe,matchText:Fo(ce.name,(P=(F=ce.dbAttrs[0])==null?void 0:F.logicalName)==null?void 0:P[w],(U=ce.dbAttrs[0])==null?void 0:U.physicalName),children:j?ie(ce).map(K=>{var J,ve;return{key:`attr:${ce.modelId}:col:${K.modelId}`,label:zi(b,K.physicalName,(J=K.logicalName)==null?void 0:J[w],K.physicalName,i.t("em.node.logicalMissing"))+(K.dataType?` : ${K.dataType}`:""),icon:"field",attrRef:oe,focusId:fe,matchText:Fo(K.physicalName,(ve=K.logicalName)==null?void 0:ve[w]),children:[]}}):[]}}const le=Tr(ce,i.state.logical.associations),ue=Mr(b,ce,le);return{key:`attr:${ce.modelId}`,label:zi(b,ce.name,(X=(Q=ce.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:X[w],(_e=ce.dbAttrs[0])==null?void 0:_e.physicalName,i.t("em.node.logicalMissing"))+(ue?` : ${ue}`:""),...M(ce),attrRef:oe,focusId:fe,matchText:Fo(ce.name,(we=(he=ce.dbAttrs[0])==null?void 0:he.logicalName)==null?void 0:we[w],(Ie=ce.dbAttrs[0])==null?void 0:Ie.physicalName),children:[]}},ye=ce=>{var le,ue,F;const fe=ce.entity,oe=[...fe.attributes].sort((P,U)=>P.order-U.order);return{key:`entity:${fe.modelId}`,label:v(fe),icon:"table",selectKind:"entity",selectId:fe.modelId,focusId:fe.modelId,matchText:Fo(fe.name,(ue=(le=fe.table)==null?void 0:le.logicalName)==null?void 0:ue[w],(F=fe.table)==null?void 0:F.physicalName),children:oe.map(P=>pe(P,fe.modelId))}},ge=new Map,me=[];for(const ce of D.entities)if(ce.groupRef){const fe=ge.get(ce.groupRef)??[];fe.push(ce),ge.set(ce.groupRef,fe)}else me.push(ce);const se=[];for(const ce of D.groups){const fe=ce.group;se.push({key:`group:${fe.modelId}`,label:((ke=fe.name)==null?void 0:ke[w])||((Se=fe.name)==null?void 0:Se.ko)||fe.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:fe.modelId,children:(ge.get(fe.modelId)??[]).map(ye)})}for(const ce of me)se.push(ye(ce));if(D.associations.length){const ce=new Map(D.entities.map(fe=>[fe.entity.modelId,v(fe.entity)]));se.push({key:"section:associations",label:i.t("em.explorer.associations",{n:D.associations.length}),icon:"arrow-lr",children:D.associations.map(fe=>{const oe=fe.association,le=ce.get(oe.end1.entityRef)??oe.end1.entityRef,ue=ce.get(oe.end2.entityRef)??oe.end2.entityRef;return{key:`assoc:${oe.modelId}`,label:`${le} — ${ue}`,icon:"arrow-lr",selectKind:"association",selectId:oe.modelId,children:[]}})})}return D.notes.length&&se.push({key:"section:notes",label:i.t("em.explorer.notes",{n:D.notes.length}),icon:"note",children:D.notes.map(({note:ce})=>{var fe;return{key:`note:${ce.modelId}`,label:((fe=ce.memo.split(`
|
|
66
|
-
`)[0])==null?void 0:fe.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:ce.modelId,focusId:ce.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:se}});function l(D){return D?D.pk&&D.fk?i.t("em.node.keyPfk"):D.pk?i.t("em.node.keyPk"):D.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const D=[],b=w=>{if(w.children.length){w.key!=="root"&&D.push(w.key);for(const v of w.children)b(v)}};return b(r.value),D}),c=D=>D.startsWith("entity:")||D==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:h}=dh({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),y=t.ref(null),g=t.computed(()=>f.value.trim().length>0),_=t.computed(()=>{const D=[];if(g.value){const w=OT(r.value,f.value.trim().toLowerCase()),v=(O,M,z,j,ie)=>{if(!w.has(O.key))return;D.push({node:O,depth:M,parentKey:z,posinset:j,setsize:ie});const pe=O.children.filter(ye=>w.has(ye.key));pe.forEach((ye,ge)=>v(ye,M+1,O.key,ge+1,pe.length))};return v(r.value,0,null,1,1),D}const b=(w,v,O,M,z)=>{D.push({node:w,depth:v,parentKey:O,posinset:M,setsize:z}),d(w.key)||w.children.forEach((j,ie)=>b(j,v+1,w.key,ie+1,w.children.length))};return b(r.value,0,null,1,1),D}),E=t.ref(null),N=t.ref(null),p=t.computed(()=>{var b;const D=_.value;return N.value&&D.some(w=>w.node.key===N.value)?N.value:((b=D[0])==null?void 0:b.node.key)??null}),k=D=>!g.value&&d(D);async function I(D){var b,w;D&&(N.value=D,await t.nextTick(),(w=(b=E.value)==null?void 0:b.querySelector(`[data-key="${D}"]`))==null||w.focus())}function A(D,b){var O,M,z,j,ie;const w=_.value,v=w.findIndex(pe=>pe.node.key===b.node.key);switch(D.key){case"ArrowDown":D.preventDefault(),I((O=w[v+1])==null?void 0:O.node.key);return;case"ArrowUp":D.preventDefault(),I((M=w[v-1])==null?void 0:M.node.key);return;case"Home":D.preventDefault(),I((z=w[0])==null?void 0:z.node.key);return;case"End":D.preventDefault(),I((j=w[w.length-1])==null?void 0:j.node.key);return;case"ArrowRight":if(D.preventDefault(),!b.node.children.length)return;k(b.node.key)?u(b.node.key):I((ie=w[v+1])==null?void 0:ie.node.key);return;case"ArrowLeft":D.preventDefault(),b.node.children.length&&!k(b.node.key)?u(b.node.key):I(b.parentKey);return;case"Enter":case" ":D.preventDefault(),x(b.node,D);return;case"F2":D.preventDefault(),T(b.node)}}const $=t.computed(()=>g.value&&_.value.length<=1);function L(D){var v;if(D.key!=="/"||D.metaKey||D.ctrlKey||D.altKey||D.shiftKey)return;const b=D.target,w=b==null?void 0:b.tagName;w==="INPUT"||w==="TEXTAREA"||w==="SELECT"||b!=null&&b.isContentEditable||(D.preventDefault(),(v=y.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",L)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",L)),n({toggleAll:m,allExpanded:h,hasExpandable:t.computed(()=>s.value.length>0)});function V(D){const b=i.selection.value;return D.attrRef?(b==null?void 0:b.kind)==="attribute"&&b.entityId===D.attrRef.entityId&&b.ids.includes(D.attrRef.attrId):!!b&&b.kind!=="attribute"&&!!D.selectId&&D.selectKind===b.kind&&D.selectId===b.id}function S(D){const b=i.selection.value;return D.selectKind==="entity"&&(b==null?void 0:b.kind)==="attribute"&&b.entityId===D.selectId}function x(D,b){if(D.attrRef){const w=b.shiftKey?"range":b.metaKey||b.ctrlKey?"toggle":"replace";i.selectAttribute(D.attrRef.entityId,D.attrRef.attrId,w)}else D.selectKind&&D.selectId&&(i.selection.value={kind:D.selectKind,id:D.selectId});D.focusId&&i.requestFocus(D.focusId)}function T(D){D.selectKind==="entity"&&D.selectId&&Wa(a,i,D.selectId)}return(D,b)=>(t.openBlock(),t.createElementBlock("section",uM,[t.createElementVNode("div",mM,[t.createVNode(Ae,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":b[0]||(b[0]=w=>f.value=w),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:b[1]||(b[1]=t.withKeys(w=>f.value="",["esc"]))},null,40,fM),[[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:b[2]||(b[2]=w=>f.value="")},[t.createVNode(Ae,{name:"x",size:13})],8,pM)):t.createCommentVNode("",!0)]),$.value?(t.openBlock(),t.createElementBlock("p",hM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:E,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,w=>(t.openBlock(),t.createElementBlock("div",{key:w.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":V(w.node),"is-focus-parent":S(w.node),"is-selectable":!!w.node.selectKind||!!w.node.attrRef||!!w.node.focusId}]),"data-key":w.node.key,role:"treeitem","aria-level":w.depth+1,"aria-posinset":w.posinset,"aria-setsize":w.setsize,"aria-expanded":w.node.children.length?!k(w.node.key):void 0,"aria-selected":V(w.node),tabindex:w.node.key===p.value?0:-1,style:t.normalizeStyle({paddingLeft:4+w.depth*14+"px"}),onClick:v=>x(w.node,v),onDblclick:v=>T(w.node),onFocus:v=>N.value=w.node.key,onKeydown:v=>A(v,w)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!w.node.children.length,"is-open":!k(w.node.key)}]),onClick:t.withModifiers(v=>w.node.children.length&&t.unref(u)(w.node.key),["stop"])},[w.node.children.length?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,bM),w.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(w.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",kM,[w.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-pk"})):w.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",EM,[w.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,_M)):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",NM,t.toDisplayString(w.node.label),1),l(w.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",wM,t.toDisplayString(l(w.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,gM))),128))],8,yM)]))}}),[["__scopeId","data-v-e5303c65"]]),IM={class:"em-text-export"},vM=["id","aria-selected","tabindex","onClick"],CM=["aria-labelledby"],xM={class:"em-text-export__actions"},SM=Ke(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(m,h)=>Dt(n.locale??"ko",m,h),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var h,f;a.value=m,await t.nextTick(),(f=(h=l.value)==null?void 0:h.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const h=n.formats.length;h&&s((a.value+m+h)%h)}async function d(){try{await navigator.clipboard.writeText(r().content),ee.showNotification(i("em.export.copied"),"info")}catch{ee.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),h=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(h);try{const y=document.createElement("a");y.href=f,y.download=m.filename,document.body.appendChild(y),y.click(),y.remove()}finally{URL.revokeObjectURL(f)}}return(m,h)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",IM,[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:g=>a.value=y,onKeydown:[h[0]||(h[0]=t.withKeys(t.withModifiers(g=>c(-1),["prevent"]),["left"])),h[1]||(h[1]=t.withKeys(t.withModifiers(g=>c(1),["prevent"]),["right"])),h[2]||(h[2]=t.withKeys(t.withModifiers(g=>s(0),["prevent"]),["home"])),h[3]||(h[3]=t.withKeys(t.withModifiers(g=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,vM))),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,CM),t.createElementVNode("div",xM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:h[4]||(h[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),RM={class:"em-text-import"},AM=["aria-label"],$M=["aria-checked","tabindex","onClick"],TM=["placeholder"],MM={class:"em-text-import__status"},VM={class:"em-text-import__ok"},BM={key:0,class:"em-text-import__warn"},DM={key:1,class:"em-text-import__err"},OM={key:2,class:"em-text-import__err"},LM={key:3,class:"em-text-import__err"},PM={class:"em-text-import__actions"},zM=Ke(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(g,_)=>Dt(n.locale??"ko",g,_),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(g){var E,N;const _=l[(g+l.length)%l.length];_&&(r.value=_.key,await t.nextTick(),(N=(E=s.value)==null?void 0:E.querySelectorAll('[role="radio"]')[l.indexOf(_)])==null||N.focus())}function d(g){c(l.findIndex(_=>_.key===r.value)+g)}function u(g){return g?g.startsWith("{")?"json":/\berdiagram\b/i.test(g)?"mermaid":/\bcreate\s+table\b/i.test(g)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),h=t.computed(()=>{const g=a.value.trim();if(!g)return{status:"empty"};const _=m.value;if(!_)return{status:"unknown"};try{let E,N=[];return _==="json"?E=fc(g):_==="mermaid"?E=ac(g):(E=cc(g),N=Vr(g).warnings),E.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:E,warnings:N}}catch(E){return{status:"error",message:E instanceof Error?E.message:String(E)}}}),f=t.computed(()=>h.value.status==="ok");function y(){const g=h.value;g.status!=="ok"||!g.source||(n.onImport(g.source),o.close())}return(g,_)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",RM,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,E=>t.createElementVNode("button",{key:E.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":E.key===r.value}]),"aria-checked":E.key===r.value,tabindex:E.key===r.value?0:-1,onClick:N=>r.value=E.key,onKeydown:[_[0]||(_[0]=t.withKeys(t.withModifiers(N=>d(-1),["prevent"]),["left"])),_[1]||(_[1]=t.withKeys(t.withModifiers(N=>d(1),["prevent"]),["right"])),_[2]||(_[2]=t.withKeys(t.withModifiers(N=>c(0),["prevent"]),["home"])),_[3]||(_[3]=t.withKeys(t.withModifiers(N=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(E.labelKey)),43,$M)),64))],8,AM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":_[4]||(_[4]=E=>a.value=E),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,TM),[[t.vModelText,a.value]]),t.createElementVNode("div",MM,[h.value.status==="ok"&&h.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",VM,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:h.value.source.logical.entities.length,relations:h.value.source.logical.associations.length})),1),h.value.warnings&&h.value.warnings.length?(t.openBlock(),t.createElementBlock("span",BM," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:h.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):h.value.status==="error"?(t.openBlock(),t.createElementBlock("span",DM,t.toDisplayString(i("em.import.error",{message:h.value.message??""})),1)):h.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",OM,t.toDisplayString(i("em.import.unknownFormat")),1)):h.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",LM,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",PM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:y},null,8,["caption","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:_[5]||(_[5]=E=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),FM={class:"em-toolbar"},UM=["title"],HM={class:"em-toolbar__mode"},bh=Ke(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=ee.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set: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(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=vr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:SM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Ks(y,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Cr(y,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Cr(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:dc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:mc(y,i.state.layout),filename:"diagram.json"}]}})}function h(){r.openModal({component:zM,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(g=>g.modelId))}}})}function f(){r.openModal({component:hh,bind:{locale:i.uiLocale.value}})}return(y,g)=>(t.openBlock(),t.createElementBlock("div",FM,[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,UM)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:g[0]||(g[0]=_=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:g[1]||(g[1]=_=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",HM,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(ee.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=_=>s.value=_),items:l,"value-provider":_=>_.v,"label-provider":_=>t.unref(i).t(_.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=_=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=_=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(Ae,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:h},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=_=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=_=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"camera",size:16})]),_:1},8,["tooltip"]),g[11]||(g[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=_=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),g[8]||(g[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),jM=["title"],KM=["title"],GM=["disabled","aria-pressed"],YM=["disabled","aria-pressed"],qM=Ke(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>Dt(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode(Ae,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,jM)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode(Ae,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,GM),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode(Ae,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,YM)],10,KM))}}),[["__scopeId","data-v-2b5162b7"]]),WM=["disabled"],JM={class:"em-panel__sub"},XM={class:"em-nav"},ZM={key:0,class:"em-nav__divider","aria-hidden":"true"},QM={key:1},e2=["onClick","onKeydown"],t2={class:"em-nav__name"},n2=["title"],o2={key:0,class:"em-panel__note"},i2=["data-attr-block"],a2={class:"em-attr__row"},r2=["title"],l2={key:0,class:"em-attr__row"},s2={key:1,class:"em-attr__navhint"},c2={key:0,class:"em-attr__navhint"},d2={class:"em-attr__row"},u2={class:"em-attr__row"},m2=["title"],f2={class:"em-attr__flags"},p2={class:"em-attr__pii"},h2={class:"em-attr__pii"},y2={key:1,class:"em-attr__pii"},g2={key:2,class:"em-attr__pii em-attr__codetop"},b2={class:"em-multilang"},_2={key:3,class:"em-embed-cols"},k2={class:"em-embed-col__label"},E2={class:"em-attr__row"},N2=["title"],w2=["title"],I2=["title"],v2={class:"em-attr__row"},C2={key:0,class:"em-embed-upd"},x2={key:1,class:"em-attr__navhint"},S2={class:"em-embed-upd"},R2={class:"em-embed-upd"},A2={class:"em-swatch__row em-attr__swatch"},$2=["title","onClick"],T2=["title","onClick"],M2={key:0,class:"em-attr__swatch-hint"},V2=Ke(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:h,setTransient:f,dbLocked:y,fkDerived:g,fkOriginPhysical:_,typeValueOf:E,typeLabelOf:N,setAttrType:p,setAttrCustomType:k,setDb:I,scaleApplicable:A,scaleHint:$,setDbLogical:L,setAttrDescription:V,attrPiiValue:S,setAttrPii:x,predefinedCustomTypeCatalog:T,embeddableCatalog:D,predefinedLabel:b,groupCodeCatalog:w,attrGroupCodes:v,attrCodeItems:O,codeValueOf:M,codeLabelOf:z,setAttrGroupCode:j,setAttrCode:ie,setAttrDefaultValue:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:F,insertableItems:P,insertableLabel:U,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:q,isShared:K,sharedPhysical:J}=kf(o,()=>n.entityId),ve=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Le=>Le.entityRef===i.value.modelId)??null:null),Te=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes.filter(De=>De.attrType!=="DIVIDER"))??[]}),G=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes)??[]}),te=t.computed(()=>Te.value.filter(Le=>r.value.has(Le.modelId)));function Y(Le){return{pk:Le.identifier,fk:Le.attrType.startsWith("RELATION")&&Le.dbAttrs.length>0,required:Le.notNull&&!Le.identifier}}function ae(Le){const De=Y(Le),Z=[De.pk&&"PK",De.fk&&"FK",De.required&&"NOT NULL"].filter(Boolean);return Z.length?Z.join(" · "):void 0}function Be(Le,De){i.value&&o.selectAttribute(i.value.modelId,Le.modelId,De.shiftKey?"range":De.metaKey||De.ctrlKey?"toggle":"replace")}function Ve(Le){var De,Z;return _t((Z=(De=ve.value)==null?void 0:De.attributeStyles)==null?void 0:Z[Le.modelId])}function H(Le){return r.value.size>1&&r.value.has(Le.modelId)}function B(Le,De){if(!i.value)return;const Z=H(Le)?o.selectedAttrIds.value:[Le.modelId];o.setAttributeSwatches(i.value.modelId,Z,De)}const Pe=t.ref(void 0);function Ze(Le){if(!Le||!i.value)return;const De=o.addPredefinedEmbed(i.value.modelId,Le);De&&o.selectAttribute(i.value.modelId,De),Pe.value=void 0}function Ue(){if(!i.value)return;const Le=o.addAttribute(i.value.modelId);Le&&o.selectAttribute(i.value.modelId,Le)}return(Le,De)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",JM,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value.length}))+" ",1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ue},null,8,["caption"]),t.unref(D).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":Pe.value,items:t.unref(D),"value-provider":Z=>Z.type,"label-provider":t.unref(b),"onUpdate:modelValue":Ze},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",XM,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(G.value,Z=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[Z.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",ZM,[...De[0]||(De[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",QM,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Z.modelId)}]),role:"button",tabindex:"0",onClick:dt=>Be(Z,dt),onKeydown:[t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["space"])]},[t.createElementVNode("span",t2,t.toDisplayString(Z.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:ae(Z)},[Y(Z).pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):Y(Z).required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),Y(Z).fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,n2)],42,e2)]))],64))),128))]),Te.value.length&&!te.value.length?(t.openBlock(),t.createElementBlock("p",o2,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.value,Z=>{var dt,bn,Et,_n,Ee,at,zt,ut,en,tn;return t.openBlock(),t.createElementBlock("div",{key:Z.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(Z.modelId)}]),"data-attr-block":Z.modelId},[t.createElementVNode("div",a2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-name-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":Z.name,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{name:Ne})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-type-${Z.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Z.attrType.startsWith("EMBED")||!!Z.groupCode||Z.attrType==="RELATION_REF"||t.unref(g)(Z),items:t.unref(oc)(Z.type,t.unref(T)),"value-provider":t.unref(E),"label-provider":t.unref(N),"model-value":Z.type,"onUpdate:modelValue":Ne=>t.unref(p)(Z,Ne)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(u)(Z)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ne=>t.unref(o).removeAttribute(t.unref(i).modelId,Z.modelId)},null,8,["onClick"])],8,r2)]),Z.type===t.unref(an)&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("div",l2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-customtype-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Z.customType??"","onUpdate:modelValue":Ne=>t.unref(k)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",s2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ye)(Z)?(t.openBlock(),t.createElementBlock("div",_2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.dbAttrs,(Ne,et)=>{var Ft,pt,nt,Uo,Ho,jo,C,R;return t.openBlock(),t.createElementBlock("div",{key:Ne.modelId,class:"em-embed-col"},[t.createElementVNode("span",k2,t.toDisplayString(((Ft=t.unref(se)(Z,et))==null?void 0:Ft.name)??((pt=t.unref(se)(Z,et))==null?void 0:pt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:et+1})),1),t.createElementVNode("div",E2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`embed-col-${Ne.modelId}`,width:"100%",disabled:t.unref(K)(Ne),placeholder:((nt=t.unref(se)(Z,et))==null?void 0:nt.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(K)(Ne)?t.unref(J)(Ne):Ne.physicalName,"onUpdate:modelValue":W=>t.unref(ge)(Z,et,{physicalName:W})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSTextInput),{name:`embed-dtype-${Ne.modelId}`,width:"84px",disabled:"","model-value":t.unref(ke)(Z,et)},null,8,["name","model-value"])],8,N2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-len-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(Se)(Z,et)},null,8,["name","model-value"])],8,w2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-scale-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ce)(Z,et)},null,8,["name","model-value"])],8,I2)]),t.createVNode(no,{controller:t.unref(o),"ref-id":Ne.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",v2,[t.createVNode(mn,{class:"grow",name:`embed-logical-${Ne.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Ho=(Uo=t.unref(se)(Z,et))==null?void 0:Uo.logicalName)==null?void 0:Ho[t.unref(o).userLanguage.value])??((C=(jo=t.unref(se)(Z,et))==null?void 0:jo.logicalName)==null?void 0:C.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ne.logicalName,"onUpdate:modelValue":W=>t.unref(me)(Z,et,W)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(R=t.unref(se)(Z,et))!=null&&R.shareable?(t.openBlock(),t.createElementBlock("label",C2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"110px","model-value":t.unref(Ie)(Ne),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":W=>W&&t.unref(q)(Z,et,W)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(K)(Ne)?(t.openBlock(),t.createElementBlock("p",x2,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",S2,[De[3]||(De[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(K)(Ne),"model-value":t.unref(K)(Ne)?"false":t.unref(Q)(Ne),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(U),"onUpdate:modelValue":W=>W&&t.unref(X)(Z,et,W)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",R2,[De[4]||(De[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(K)(Ne),"model-value":t.unref(K)(Ne)?"false":t.unref(le)(Ne),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":W=>W&&t.unref(ue)(Z,et,W)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("p",c2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",d2,[t.createVNode(mn,{class:"grow",name:`attr-logical-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(dt=Z.dbAttrs[0])==null?void 0:dt.logicalName,"onUpdate:modelValue":Ne=>t.unref(L)(Z,Ne)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",u2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(_)(Z)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(y)(Z),"model-value":((bn=Z.dbAttrs[0])==null?void 0:bn.physicalName)??"","onUpdate:modelValue":Ne=>t.unref(I)(Z,{physicalName:Ne})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-dtype-${Z.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(y)(Z)||t.unref(g)(Z),items:t.unref(ec)(((Et=Z.dbAttrs[0])==null?void 0:Et.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Rr),"model-value":((_n=Z.dbAttrs[0])==null?void 0:_n.dataType)??"","onUpdate:modelValue":Ne=>Ne&&t.unref(I)(Z,{dataType:Ne})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-len-${Z.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(y)(Z)||t.unref(g)(Z),"model-value":(Ee=Z.dbAttrs[0])==null?void 0:Ee.length,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{length:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref($)(Z)},[t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-scale-${Z.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(y)(Z)||t.unref(g)(Z)||!t.unref(A)(Z),"model-value":(at=Z.dbAttrs[0])==null?void 0:at.scale,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{scale:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,m2)]),t.createVNode(no,{controller:t.unref(o),"ref-id":(zt=Z.dbAttrs[0])==null?void 0:zt.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",f2,[t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:t.unref(a)||t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(h)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(d)(Z,{notNull:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-uq-${Z.modelId}`,label:"Unique","model-value":!!((ut=Z.dbAttrs[0])!=null&&ut.unique),disabled:t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{unique:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-ai-${Z.modelId}`,label:"Auto Increment","model-value":!!((en=Z.dbAttrs[0])!=null&&en.autoIncrement),disabled:t.unref(y)(Z)||t.unref(g)(Z)||!Z.identifier,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{autoIncrement:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-tr-${Z.modelId}`,label:"@Transient","model-value":!!Z.transient,disabled:Z.identifier||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(f)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(m)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Z.modelId}`,label:"mutable","model-value":!!Z.naturalIdMutable,disabled:t.unref(y)(Z)||!Z.naturalId,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{naturalIdMutable:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-mv-${Z.modelId}`,label:"Multi-Value (Set)","model-value":!!((tn=Z.dbAttrs[0])!=null&&tn.multiValue),disabled:t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{multiValue:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",p2,[De[1]||(De[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(y)(Z),"model-value":t.unref(Q)(Z.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(U),"onUpdate:modelValue":Ne=>Ne&&t.unref(_e)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",h2,[De[2]||(De[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(y)(Z),"model-value":t.unref(le)(Z.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ne=>Ne&&t.unref(F)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",y2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":t.unref(S)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ne=>Ne&&t.unref(x)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(w).length&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("label",g2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(vf,{"model-value":Z.groupCode,items:t.unref(w),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ne=>t.unref(j)(Z,Ne)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(w).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(v)(Z).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"100%","model-value":Z.defaultValue??"none",items:t.unref(O)(Z),"value-provider":t.unref(M),"label-provider":t.unref(z),"onUpdate:modelValue":Ne=>Ne&&t.unref(ie)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`attr-default-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Z.defaultValue??"","onUpdate:modelValue":Ne=>t.unref(pe)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",b2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`attr-desc-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Z.description,"onUpdate:modelValue":Ne=>t.unref(V)(Z,Ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",A2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ve(Z)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:Ne=>B(Z,null)},"∅",10,$2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),Ne=>(t.openBlock(),t.createElementBlock("button",{key:Ne,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ve(Z)===Ne}]),style:t.normalizeStyle({background:t.unref(Mo)(Ne)}),title:t.unref(o).t(t.unref(to)(Ne)),onClick:et=>B(Z,Ne)},null,14,T2))),128)),H(Z)?(t.openBlock(),t.createElementBlock("span",M2,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,i2)}),128))],8,WM)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-2c47fef2"]]),B2=["disabled"],D2={class:"em-panel__sub-label"},O2={class:"em-attr__row"},L2={class:"em-field em-idx-params"},P2=["value","placeholder","onChange"],z2=Ke(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(I=>I.modelId===o.entityId)??null),l=t.computed(()=>r.value?Ko(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var I;return Vn(((I=r.value)==null?void 0:I.attributes)??[])}),c=I=>s.value.canon(I),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>{var I;return[...(((I=r.value)==null?void 0:I.attributes)??[]).filter(A=>A.dbAttrs.length>0).map(A=>({value:A.modelId,label:Sf(A,d.value)})),...l.value.map(A=>({value:A.modelId,label:a.t("em.index.inherited",{field:A.field})}))]});function m(I,A){var S;const $=new Set(I.columns.filter((x,T)=>T!==A).map(x=>c(x.columnRef))),L=u.value.filter(x=>!$.has(c(x.value))),V=(S=I.columns[A])==null?void 0:S.columnRef;return V&&!L.some(x=>x.value===V)&&L.push({value:V,label:h(V)}),L}function h(I){return Rf(I,d.value)}function f(I){const A=new Set(I.columns.map($=>c($.columnRef)));return u.value.filter($=>!A.has(c($.value)))}function y(){var A;if(!r.value)return;const I=u.value[0];a.addIndex(r.value.modelId,{modelId:Me(),name:`idx_${(((A=r.value.indexes)==null?void 0:A.length)??0)+1}`,unique:!1,columns:I?[{columnRef:I.value,descending:!1}]:[]})}function g(I,A){r.value&&a.updateIndex(r.value.modelId,I,A)}function _(I){const A=f(I)[0];A&&g(I.modelId,{columns:[...I.columns,{columnRef:A.value,descending:!1}]})}function E(I,A,$){g(I.modelId,{columns:I.columns.map((L,V)=>V===A?{...L,columnRef:$}:L)})}function N(I,A,$){g(I.modelId,{columns:I.columns.map((L,V)=>V===A?{...L,descending:$}:L)})}function p(I,A){g(I.modelId,{columns:I.columns.filter(($,L)=>L!==A)})}function k(I,A){g(I.modelId,{parameters:A.trim()===""?void 0:A})}return(I,A)=>{var $;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:A[0]||(A[0]=L=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",D2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:(($=r.value.indexes)==null?void 0:$.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(y,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],L=>(t.openBlock(),t.createElementBlock("div",{key:L.modelId,class:"em-attr"},[t.createElementVNode("div",O2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`idx-name-${L.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":L.name,"onUpdate:modelValue":V=>g(L.modelId,{name:V})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-uq-${L.modelId}`,class:"em-check",label:"UQ","model-value":L.unique,"onUpdate:modelValue":V=>g(L.modelId,{unique:V})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:V=>t.unref(a).removeIndex(r.value.modelId,L.modelId)},null,8,["onClick"])]),t.createVNode(no,{controller:t.unref(a),"ref-id":L.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(L.columns,(V,S)=>(t.openBlock(),t.createElementBlock("div",{key:S,class:"em-attr__row"},[t.createVNode(t.unref(ee.BSSelect),{class:"grow","model-value":V.columnRef,items:m(L,S),"value-provider":x=>x.value,"label-provider":x=>x.label,"onUpdate:modelValue":x=>x&&E(L,S,x)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-${L.modelId}-desc-${S}`,class:"em-check",label:"DESC","model-value":V.descending,"onUpdate:modelValue":x=>N(L,S,x)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:"−",onClick:x=>p(L,S)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(L).length,onClick:V=>_(L)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",L2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:L.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:V=>k(L,V.target.value)},null,40,P2)])]))),128)):t.createCommentVNode("",!0)],8,B2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),F2=["disabled"],U2={class:"em-panel__sub-label"},H2={class:"em-attr__row"},j2={class:"em-attr__row"},K2={class:"em-multilang"},G2={class:"em-attr__pii"},Y2={class:"em-swatch__row em-attr__swatch"},q2=["title","onClick"],W2=["title","onClick"],J2=Ke(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=ee.useModal(),l=t.computed(()=>a.state.logical.entities.find(p=>p.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(p=>p.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(p){return p==="none"?a.t("em.common.noneParen"):p}const m=p=>p;function h(p,k){l.value&&a.updateOperation(l.value.modelId,p.modelId,k)}function f(p,k){h(p,{description:Object.keys(k).length?k:void 0})}function y(p){return p.personalInfoAttributeType??"none"}function g(p,k){h(p,{personalInfoAttributeType:k==="none"?void 0:k})}function _(p){var k,I;return _t((I=(k=s.value)==null?void 0:k.operationStyles)==null?void 0:I[p.modelId])}function E(p,k){l.value&&a.setOperationSwatch(l.value.modelId,p.modelId,k)}function N(p){r.openModal({component:Af,bind:{operationName:p.name,sourceCode:p.sourceCode??"",locale:a.uiLocale.value,onSave:k=>h(p,{sourceCode:k})}})}return(p,k)=>{var I;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:k[1]||(k[1]=A=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",U2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((I=l.value.operations)==null?void 0:I.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:k[0]||(k[0]=t.withModifiers(A=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],A=>(t.openBlock(),t.createElementBlock("div",{key:A.modelId,class:"em-attr"},[t.createElementVNode("div",H2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":$=>h(A,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":$=>$&&h(A,{visibility:$})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>t.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),t.createElementVNode("div",j2,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:$=>N(A)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",K2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`op-desc-${A.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":$=>f(A,$)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",G2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":y(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":$=>$&&g(A,$)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",Y2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(A)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:$=>E(A,null)},"∅",10,q2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":_(A)===$}]),style:t.normalizeStyle({background:t.unref(Mo)($)}),title:t.unref(a).t(t.unref(to)($)),onClick:L=>E(A,$)},null,14,W2))),128))])]))),128)):t.createCommentVNode("",!0)],8,F2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),X2=["title"],Z2={class:"em-panel__head"},Q2={class:"em-panel__head-row"},eV=["title"],tV={class:"em-panel__context"},nV={key:0,class:"em-panel__lock"},oV=["disabled"],iV={key:0,class:"em-panel__note"},aV={key:1,class:"em-panel__note"},rV={key:2,class:"em-jpa"},lV={class:"em-field"},sV={class:"em-field"},cV={class:"em-field"},dV={key:0,class:"em-field"},uV={class:"em-panel__note"},mV={class:"em-panel__sub"},fV={class:"em-field"},pV={class:"em-field"},hV={class:"em-jpa"},yV={key:0,class:"em-panel__note"},gV={key:1,class:"em-panel__note"},bV={class:"em-jpa"},_V={class:"em-field"},kV={key:0,class:"em-panel__note"},EV={class:"em-field"},NV={class:"em-multilang"},wV={class:"em-field"},IV=["value"],vV={class:"em-field"},CV={class:"em-swatch"},xV={class:"em-swatch__row"},SV=["title"],RV=["title","onClick"],AV={class:"em-panel__note"},$V={class:"em-field"},TV=["value"],MV={class:"em-swatch"},VV={class:"em-swatch__row"},BV=["title"],DV=["title","onClick"],_h=Ke(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var q;return(q=r.value)==null?void 0:q.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const q=c.value;return q?l.state.logical.entities.find(K=>K.modelId===q)??null:null}),u=t.computed(()=>{const q=s.value;if((q==null?void 0:q.kind)==="association")return l.isAssociationLocked(q.id);const K=c.value;return!!K&&l.isEntityLocked(K)}),m=t.computed(()=>{var q;return((q=l.selectedAttr.value)==null?void 0:q.attrId)??null}),h=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),y=t.ref({});t.watch(f,()=>{y.value={}});function g(q){return y.value[q]??f.value}function _(q){y.value={...y.value,[q]:!g(q)}}const E=t.computed(()=>{var J;const q=d.value;if(!q)return l.t("em.entity.fallback");const K=(J=q.table)==null?void 0:J.physicalName;return K?`${q.name} (${K})`:q.name}),N=t.computed(()=>{const q=s.value;return(q==null?void 0:q.kind)==="association"?l.state.logical.associations.find(K=>K.modelId===q.id)??null:null}),p=t.computed(()=>{const q=s.value;return(q==null?void 0:q.kind)==="group"?l.state.logical.groups.find(K=>K.modelId===q.id)??null:null}),k=t.computed(()=>{const q=s.value;return(q==null?void 0:q.kind)==="note"?l.state.layout.notes.find(K=>K.modelId===q.id)??null:null}),I=t.computed(()=>{var K,J;const q=(K=p.value)==null?void 0:K.name;return(q==null?void 0:q[l.userLanguage.value])||(q==null?void 0:q.ko)||(q==null?void 0:q.en)||(q==null?void 0:q.ja)||(q==null?void 0:q.zh)||((J=p.value)==null?void 0:J.packageName)||l.t("em.group.fallback")}),A=t.computed(()=>{if(d.value){const q=h.value.size;if(q>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:q});if(m.value){const K=d.value.attributes.find(J=>J.modelId===m.value);return(K==null?void 0:K.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(K==null?void 0:K.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(N.value){const q=K=>{var J;return((J=l.state.logical.entities.find(ve=>ve.modelId===K))==null?void 0:J.name)??K};return l.t("em.inspector.ctxAssoc",{a:q(N.value.end1.entityRef),b:q(N.value.end2.entityRef)})}return p.value?l.t("em.inspector.ctxGroup",{name:I.value}):k.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),$=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],L=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],V={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},S=q=>{const K=V[q];return K?l.t(K):q},x=q=>{var K;return((K=l.state.logical.entities.find(J=>J.modelId===q))==null?void 0:K.name)??q},T=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],D=["LIST","SET"],b=["inherit","LAZY","EAGER"],w=q=>q;function v(q){return q==="inherit"?l.t("em.common.inherit"):q}const O=t.computed(()=>!!N.value&&N.value.end1.entityRef===N.value.end2.entityRef);function M(q,K){N.value&&l.updateAssociationEnd(N.value.modelId,q,K)}function z(q){return oe.value?q:q==="end1"?"end2":"end1"}function j(q){var Te;const K=(Te=N.value)==null?void 0:Te[q];if(!(K!=null&&K.attributeRef))return;const J=l.state.logical.entities.find(G=>G.modelId===K.entityRef),ve=J==null?void 0:J.attributes.find(G=>G.modelId===K.attributeRef);return ve&&(ve.attrType==="RELATION_OWN"||ve.attrType==="RELATION_REF")?ve.name:void 0}function ie(q,K){var ve;const J=(ve=N.value)==null?void 0:ve[q];J!=null&&J.attributeRef&&l.updateAttribute(J.entityRef,J.attributeRef,{name:K})}function pe(q){var G;const K=j(q);if(K!==void 0)return K;const J=(G=N.value)==null?void 0:G[q];if(J!=null&&J.navFieldNameHint)return J.navFieldNameHint;const ve=q==="end1"?"end2":"end1",Te=l.state.logical.entities.find(te=>{var Y;return te.modelId===((Y=N.value)==null?void 0:Y[ve].entityRef)});return Te?Ki(Te.name,Hi(N.value[ve].multiplicity)):""}function ye(q){return!!oe.value||j(q)!==void 0}function ge(q){N.value&&!O.value&&l.setAssociationIdentifying(N.value.modelId,q)}function me(q){var K,J,ve;return!!((ve=(J=(K=N.value)==null?void 0:K[q].jpa)==null?void 0:J.cascadeTypes)!=null&&ve.includes("ALL"))}function se(q,K,J){var G,te;const ve=(G=N.value)==null?void 0:G[q];if(K==="ALL"&&J){M(q,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:["ALL"]}});return}const Te=new Set(((te=ve==null?void 0:ve.jpa)==null?void 0:te.cascadeTypes)??[]);J?Te.add(K):Te.delete(K),M(q,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:[...Te]}})}function ke(q,K){var ve;const J=(ve=N.value)==null?void 0:ve[q];M(q,{jpa:{...J==null?void 0:J.jpa,...K}})}function Se(q){var K,J;return((J=(K=N.value)==null?void 0:K[q].jpa)==null?void 0:J.fetchType)??"inherit"}function ce(q,K){ke(q,{fetchType:K==="inherit"?void 0:K})}function fe(q){var J;const K=(J=N.value)==null?void 0:J[q==="end1"?"end2":"end1"];return(K==null?void 0:K.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(K==null?void 0:K.multiplicity)==="ONE_OR_MORE_INSTANCES"}const oe=t.computed(()=>{const q=N.value;if(!q)return null;for(const K of l.state.logical.entities){const J=K.attributes.find(te=>{var Y;return((Y=te.embedded)==null?void 0:Y.associationRef)===q.modelId&&te.attrType==="EMBED_OWN"});if(!J)continue;const ve=q.end2.entityRef===J.embedded.embeddableRef?"end2":"end1",Te=q[ve].multiplicity,G=q[ve].jpa;return{which:ve,cardinality:Te,isCollection:Te==="ZERO_OR_MORE_INSTANCES"||Te==="ONE_OR_MORE_INSTANCES",collectionType:(G==null?void 0:G.collectionType)??"LIST",collectionTable:(G==null?void 0:G.collectionTable)??"",orderColumn:(G==null?void 0:G.orderColumn)??""}}return null});function le(q){N.value&&l.setEmbedCardinality(N.value.modelId,q)}function ue(q){const K=oe.value;K&&ke(K.which,q==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function F(q){const K=oe.value;K&&ke(K.which,{collectionTable:q.trim()||void 0})}function P(q){const K=oe.value;K&&ke(K.which,{orderColumn:q.trim()||void 0})}function U(q){p.value&&l.updateGroup(p.value.modelId,q)}function Q(q,K){var J;U({name:{...(J=p.value)==null?void 0:J.name,[q]:K}})}const X=t.computed(()=>{var q;return p.value?_t((q=l.state.layout.groupLayouts.find(K=>K.groupRef===p.value.modelId))==null?void 0:q.style):null});function _e(q){p.value&&l.setGroupSwatch(p.value.modelId,q)}function he(q){k.value&&l.setNoteMemo(k.value.modelId,q)}const we=t.computed(()=>{var q;return _t((q=k.value)==null?void 0:q.style)});function Ie(q){k.value&&l.setNoteSwatch(k.value.modelId,q)}return(q,K)=>(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:K[0]||(K[0]=(...J)=>e.startResize&&e.startResize(...J))},null,42,X2),t.createElementVNode("header",Z2,[t.createElementVNode("div",Q2,[K[14]||(K[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:K[1]||(K[1]=J=>a("collapse"))},[t.createVNode(Ae,{name:"panel-right-close",size:16})],8,eV)]),t.createElementVNode("p",tV,t.toDisplayString(A.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",nV,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:K[2]||(K[2]=J=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(bf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("basics"),title:E.value,onToggle:K[3]||(K[3]=J=>_("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(V2,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(z2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("index"),onToggle:K[4]||(K[4]=J=>_("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(J2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("ops"),onToggle:K[5]||(K[5]=J=>_("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!N.value.identifying,disabled:O.value||!!oe.value,"onUpdate:modelValue":ge},null,8,["label","model-value","disabled"]),O.value?(t.openBlock(),t.createElementBlock("p",iV,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):oe.value?(t.openBlock(),t.createElementBlock("p",aV,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("fieldset",rV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",lV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.cardinality,items:L,"value-provider":w,"label-provider":S,"onUpdate:modelValue":K[6]||(K[6]=J=>J&&le(J))},null,8,["model-value"])]),oe.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",sV,[K[15]||(K[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.collectionType,items:D,"value-provider":w,"label-provider":w,"onUpdate:modelValue":K[7]||(K[7]=J=>J&&ue(J))},null,8,["model-value"])]),t.createElementVNode("label",cV,[K[16]||(K[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":oe.value.collectionTable,"onUpdate:modelValue":F},null,8,["placeholder","model-value"])]),oe.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",dV,[K[17]||(K[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":oe.value.orderColumn,"onUpdate:modelValue":P},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",uV,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],J=>{var ve,Te,G;return t.withDirectives(t.createElementVNode("div",{key:J,class:"em-end"},[t.createElementVNode("h4",mV,t.toDisplayString(J)+" → "+t.toDisplayString(x(N.value[J].entityRef)),1),oe.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",fV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":N.value[J].multiplicity,items:$,"value-provider":w,"label-provider":t.unref(ji),"onUpdate:modelValue":te=>M(J,{multiplicity:te})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(J)}-navigable`,class:"em-check",label:"navigable",title:z(J)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:z(J)==="end2","model-value":z(J)==="end2"?!0:N.value[z(J)].navigable,"onUpdate:modelValue":te=>M(z(J),{navigable:te})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",pV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(ee.BSTextInput),{name:`${z(J)}-navname`,width:"100%",disabled:!ye(z(J)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":pe(z(J)),"onUpdate:modelValue":te=>ie(z(J),te)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(J)}-composition`,class:"em-check",label:"composition","model-value":N.value[z(J)].composition,"onUpdate:modelValue":te=>M(z(J),{composition:te})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",hV,[K[18]||(K[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(T,te=>{var Y,ae;return t.createVNode(t.unref(ee.BSCheckbox),{key:te,name:`${z(J)}-cascade-${te}`,class:"em-check",label:te,"model-value":!!((ae=(Y=N.value[z(J)].jpa)==null?void 0:Y.cascadeTypes)!=null&&ae.includes(te)),disabled:!ye(z(J))||te!=="ALL"&&me(z(J)),"onUpdate:modelValue":Be=>se(z(J),te,Be)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ye(z(J))?me(z(J))?(t.openBlock(),t.createElementBlock("p",gV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",yV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",bV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",_V,[K[19]||(K[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(ee.BSSelect),{disabled:!ye(z(J)),"model-value":Se(z(J)),items:b,"value-provider":w,"label-provider":v,"onUpdate:modelValue":te=>te&&ce(z(J),te)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(J)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((ve=N.value[z(J)].jpa)!=null&&ve.orphanRemoval),disabled:!ye(z(J))||fe(J),"onUpdate:modelValue":te=>ke(z(J),{orphanRemoval:te})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),fe(J)&&((Te=N.value[z(J)].jpa)!=null&&Te.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",kV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",EV,[K[20]||(K[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:`${z(J)}-orderby`,width:"100%",disabled:!ye(z(J)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((G=N.value[z(J)].jpa)==null?void 0:G.orderBy)??"","onUpdate:modelValue":te=>ke(z(J),{orderBy:te.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!oe.value||J===oe.value.which]])}),64))],64)):t.createCommentVNode("",!0),p.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",NV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,J=>{var ve;return t.openBlock(),t.createElementBlock("label",{key:J,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(J),1),t.createVNode(t.unref(ee.BSTextInput),{name:`grp-name-${J}`,width:"100%","model-value":((ve=p.value.name)==null?void 0:ve[J])??"","onUpdate:modelValue":Te=>Q(J,Te)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",wV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:p.value.description??"",rows:"3",onChange:K[8]||(K[8]=J=>U({description:J.target.value}))},null,40,IV)]),t.createElementVNode("label",vV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"grp-package",width:"100%","model-value":p.value.packageName??"","onUpdate:modelValue":K[9]||(K[9]=J=>U({packageName:J}))},null,8,["model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":p.value.excludeDDLGeneration,"onUpdate:modelValue":K[10]||(K[10]=J=>U({excludeDDLGeneration:J}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",CV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",xV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":X.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:K[11]||(K[11]=J=>_e(null))},"∅",10,SV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":X.value===J}]),style:t.normalizeStyle({background:t.unref(Mo)(J)}),title:t.unref(l).t(t.unref(to)(J)),onClick:ve=>_e(J)},null,14,RV))),128))])]),t.createElementVNode("p",AV,t.toDisplayString(t.unref(l).t("em.group.members",{n:p.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",$V,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:k.value.memo,rows:"6",onChange:K[12]||(K[12]=J=>he(J.target.value))},null,40,TV)]),t.createElementVNode("fieldset",MV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",VV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":we.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:K[13]||(K[13]=J=>Ie(null))},"∅",10,BV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":we.value===J}]),style:t.normalizeStyle({background:t.unref(Mo)(J)}),title:t.unref(l).t(t.unref(to)(J)),onClick:ve=>Ie(J)},null,14,DV))),128))])])],64)):t.createCommentVNode("",!0)],8,oV)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),OV=["title"],LV={class:"em-validation__title"},PV=["title","onClick"],zV={key:0,class:"em-validation__body"},FV={class:"em-validation__opt"},UV={key:0,class:"em-validation__empty"},HV={key:1,class:"em-validation__empty"},jV={key:2,class:"em-validation__list"},KV=["onClick"],GV={class:"em-validation__item-msg"},YV={key:0,class:"em-validation__item-entity"},qV=["title","onClick"],WV=["title"],JV=Ke(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const g=new Map;for(const _ of o.state.logical.entities)g.set(_.modelId,_.name);return g});function r(g){const _=Mw(g);if(!_)return null;const E=a.value.get(_);return E===void 0?null:E.trim()===""?o.t("em.validation.nameless"):E}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const g={error:0,warning:0,info:0};for(const _ of i.value)g[_.severity]++;return g}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,_)=>l[g.severity].order-l[_.severity].order)),u=t.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:gf(o.t,g),category:$w(o.t,g.ruleId)}))),m=t.ref(!1);function h(g){c.value[g]=!c.value[g]}function f(g){if(!m.value){m.value=!0;return}h(g)}function y(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,_)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:_[1]||(_[1]=E=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Ae,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",LV,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,OV),t.createElementVNode("div",{class:"em-validation__counts",onClick:_[0]||(_[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],E=>t.createElementVNode("button",{key:E,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${E}`,{"is-off":!c.value[E]}]]),title:m.value?t.unref(o).t(c.value[E]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[E].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:N=>f(E)},[t.createVNode(Ae,{name:l[E].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[E]),1)],10,PV)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",zV,[t.createElementVNode("label",FV,[t.createVNode(t.unref(ee.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":_[2]||(_[2]=E=>t.unref(o).flagEntitiesWithoutRelations.value=E)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",UV,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",HV,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",jV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:E,entityName:N,message:p,category:k},I)=>(t.openBlock(),t.createElementBlock("li",{key:`${E.ruleId}:${E.targetRef??"model"}:${I}`,class:t.normalizeClass(["em-validation__item",[`is-${E.severity}`,{"is-clickable":!!E.targetRef}]]),onClick:A=>y(E)},[t.createVNode(Ae,{name:l[E.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",GV,[N?(t.openBlock(),t.createElementBlock("span",YV,t.toDisplayString(N),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(p),1)]),t.unref(o).hasQuickFix(E)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers(A=>t.unref(o).applyQuickFix(E),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,qV)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:E.ruleId},t.toDisplayString(k),9,WV)],10,KV))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),XV={class:"em-history"},ZV={class:"em-history__head"},QV={class:"em-history__title"},eB={class:"em-history__head-actions"},tB=["title","disabled"],nB=["title"],oB={class:"em-history__filters"},iB={class:"em-history__filter"},aB={class:"em-history__filters em-history__filters--period"},rB={class:"em-history__filter-label"},lB=["title","aria-label","max"],sB=["title","aria-label","min"],cB=["title"],dB={key:0,class:"em-history__diffbar"},uB={class:"em-history__diffbar-range"},mB={class:"em-history__diffbar-count"},fB={class:"em-history__body"},pB={key:0,class:"em-history__empty"},hB={key:1,class:"em-history__diff-list"},yB=["onClick"],gB={class:"em-history__action-head"},bB={class:"em-history__action-name"},_B={key:0,class:"em-history__fields"},kB={class:"em-history__fname"},EB={key:0,class:"em-history__old"},NB={class:"em-history__val"},wB={key:1,class:"em-history__empty"},IB={key:2,class:"em-history__empty is-error"},vB={key:3,class:"em-history__empty"},CB={key:4,class:"em-history__list"},xB=["onClick"],SB={class:"em-history__summary"},RB={class:"em-history__seq"},AB={class:"em-history__gmeta"},$B={class:"em-history__who"},TB={key:0,class:"em-history__time"},MB={key:1,class:"em-history__restored-from"},VB=["onClick"],BB={key:0,class:"em-history__detail"},DB={class:"em-history__action-head"},OB={class:"em-history__action-name"},LB={key:0,class:"em-history__fields"},PB={class:"em-history__fname"},zB={key:0,class:"em-history__old"},FB={class:"em-history__val"},UB={class:"em-history__preview"},HB=["disabled"],jB={key:0,class:"em-history__diff-list is-preview"},KB={class:"em-history__action-head"},GB={class:"em-history__action-name"},YB={key:0,class:"em-history__fields"},qB={class:"em-history__fname"},WB={key:0,class:"em-history__old"},JB={class:"em-history__val"},XB={class:"em-history__confirm-row"},ZB={class:"em-history__confirm-msg"},QB=["disabled","onClick"],eD=["disabled"],tD=["onClick"],kr=50,nD=Ke(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((Y,ae)=>ae.seq>Y?ae.seq:Y,-1/0));async function u(Y){if(a.historyTransport){l.value=!0,s.value=null;try{const ae=!(Y!=null&&Y.full)&&r.value.length>0&&Number.isFinite(d.value),Be=await a.historyTransport(ae?d.value:void 0);if(!ae)r.value=Be;else if(Be.length){const Ve=new Set(r.value.map(B=>B.seq)),H=Be.filter(B=>!Ve.has(B.seq));H.length&&(r.value=[...r.value,...H])}c.value=!0}catch(ae){s.value=ae instanceof Error?ae.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const h=t.ref(null),f=t.ref(null);t.watch(()=>o.open,Y=>{Y?m():(h.value=null,f.value=null)},{immediate:!0});let y=null;t.watch(()=>a.revision.value,()=>{o.open&&(y&&clearTimeout(y),y=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const g=t.computed(()=>new Map(a.state.logical.entities.map(Y=>[Y.modelId,Y]))),_=t.computed(()=>new Map(a.state.logical.associations.map(Y=>[Y.modelId,Y]))),E=t.computed(()=>{const Y=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(ae=>{var Be,Ve;return[ae.modelId,ae.packageName||((Be=ae.name)==null?void 0:Be[Y])||((Ve=ae.name)==null?void 0:Ve.ko)||ae.modelId]}))});function N(Y){var H,B,Pe,Ze,Ue,Le,De;const ae=_.value.get(Y);if(!ae)return a.t("em.history.assocFallback");if((H=ae.description)!=null&&H.trim())return ae.description.trim();const Be=(Ze=(Pe=g.value.get((B=ae.end1)==null?void 0:B.entityRef))==null?void 0:Pe.name)==null?void 0:Ze.trim(),Ve=(De=(Le=g.value.get((Ue=ae.end2)==null?void 0:Ue.entityRef))==null?void 0:Le.name)==null?void 0:De.trim();return Be&&Ve?`${Be}→${Ve}`:a.t("em.history.assocFallback")}function p(Y){var ae,Be,Ve,H;if(Y.kind==="entity")return((Be=(ae=g.value.get(Y.ref))==null?void 0:ae.name)==null?void 0:Be.trim())||a.t("em.attr.nameless");if(Y.kind==="attribute"||Y.kind==="operation"||Y.kind==="index"){const B=Y.entityRef?g.value.get(Y.entityRef):void 0,Ze=((Y.kind==="attribute"?B==null?void 0:B.attributes:Y.kind==="operation"?B==null?void 0:B.operations:B==null?void 0:B.indexes)??[]).find(Le=>Le.modelId===Y.ref),Ue=(Ve=B==null?void 0:B.name)==null?void 0:Ve.trim();return`${Ue?Ue+".":""}${((H=Ze==null?void 0:Ze.name)==null?void 0:H.trim())||Y.ref}`}return Y.kind==="association"?N(Y.ref):Y.kind==="associationEnd"?`${N(Y.ref)}(${Y.end})`:Y.kind==="group"?a.t("em.history.groupSubject",{name:E.value.get(Y.ref)??Y.ref}):Y.ref}const k={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},I={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},A=t.ref("all"),$=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],L=t.computed({get:()=>A.value,set:Y=>{Y&&(A.value=Y)}}),V=t.computed(()=>tl(r.value)),S=t.computed(()=>V.value.length?V.value[0].seq:null),x=t.computed(()=>A.value==="all"?V.value:V.value.filter(Y=>(Y.kind??"edit")===A.value)),T=t.ref(kr),D=t.ref(""),b=t.ref(""),w=t.computed(()=>!!D.value||!!b.value);function v(){D.value="",b.value=""}const O=t.computed(()=>{const Y=D.value?new Date(`${D.value}T00:00:00`).getTime():null,ae=b.value?new Date(`${b.value}T23:59:59.999`).getTime():null;return Y==null&&ae==null?x.value:x.value.filter(Be=>{if(Be.ts==null)return!1;const Ve=new Date(Be.ts).getTime();return!(isNaN(Ve)||Y!=null&&Ve<Y||ae!=null&&Ve>ae)})}),M=t.computed(()=>O.value.slice(0,T.value)),z=t.computed(()=>Math.max(0,O.value.length-T.value));function j(){T.value+=kr}t.watch([A,D,b],()=>{T.value=kr}),t.watch(()=>o.open,Y=>{Y&&(T.value=kr,v())});function ie(Y){return Y===void 0?"—":Y===null?a.t("em.history.emptyValue"):typeof Y=="object"?JSON.stringify(Y):String(Y)}function pe(Y){const ae=p(Y.subject);if(Y.verb==="add")return a.t("em.history.summaryAdd",{name:ae});if(Y.verb==="remove")return a.t("em.history.summaryRemove",{name:ae});if(Y.fields.length===1){const Be=Y.fields[0];return`${ae}.${Be.field} ${Be.oldValue!==void 0?ie(Be.oldValue)+"→":""}${ie(Be.value)}`}return a.t("em.history.summaryFields",{name:ae,n:Y.fields.length})}function ye(Y){return Y.actions.length===0?a.t("em.history.noChange"):Y.actions.length===1?pe(Y.actions[0]):a.t("em.history.summaryMore",{summary:pe(Y.actions[0]),n:Y.actions.length-1})}const ge=t.ref(new Set);function me(Y){const ae=new Set(ge.value);ae.has(Y)?ae.delete(Y):ae.add(Y),ge.value=ae}function se(Y){if(Y==null)return"";const ae=new Date(Y);return isNaN(ae.getTime())?String(Y):ae.toLocaleString()}function ke(Y){const ae=Y.author,Be=Y.origin;return ae&&Be?`${ae}(${Be})`:ae||(Be?`(${Be})`:"—")}const Se=t.computed(()=>h.value==null?null:nl(r.value,{fromSeq:h.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Se.value?qc(Se.value):null,Y=>i("diffChange",Y));function ce(Y){h.value=Y,f.value=null,K.value=null}function fe(){h.value=null,f.value=null}const oe=t.computed(()=>V.value.map(Y=>Y.seq)),le=t.computed(()=>S.value??1/0),ue=t.computed(()=>f.value??le.value),F=t.computed(()=>f.value??le.value),P=t.computed(()=>oe.value.filter(Y=>Y<ue.value).map(Y=>({v:Y}))),U=t.computed(()=>oe.value.filter(Y=>h.value!=null&&Y>h.value).map(Y=>({v:Y})));function Q(Y){Y!=null&&(h.value=Y,f.value!=null&&f.value<=Y&&(f.value=null))}function X(Y){Y!=null&&(f.value=Y>=le.value?null:Y)}function _e(Y){return Y>=le.value?a.t("em.history.diff.current"):`#${Y}`}function he(Y){return Y.kind==="entity"?g.value.has(Y.ref)?Y.ref:null:(Y.kind==="attribute"||Y.kind==="operation"||Y.kind==="index")&&Y.entityRef?g.value.has(Y.entityRef)?Y.entityRef:null:Y.kind==="group"&&E.value.has(Y.ref)?Y.ref:null}function we(Y){const ae=he(Y);ae&&a.requestFocus(ae)}const Ie={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},q={added:"add",modified:"update",removed:"remove"},K=t.ref(null),J=t.ref(!1),ve=t.computed(()=>K.value==null?null:nl(r.value,{fromSeq:K.value})),Te=t.ref(!1);function G(Y){K.value=Y,Te.value=!1}async function te(Y){J.value=!0;try{const ae=await a.restoreToSeq(Y);ae.ok?(h.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:ae.reason??a.t("em.history.unknown")})}finally{J.value=!1,K.value=null}}return(Y,ae)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Be,Ve;return[t.withDirectives(t.createElementVNode("section",XV,[t.createElementVNode("header",ZV,[t.createElementVNode("div",QV,[t.createVNode(Ae,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",eB,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:ae[0]||(ae[0]=H=>u({full:!0}))},[t.createVNode(Ae,{name:"redo",size:15})],8,tB),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:ae[1]||(ae[1]=H=>i("close"))},[t.createVNode(Ae,{name:"panel-close",size:15})],8,nB)])]),t.createElementVNode("div",oB,[t.createElementVNode("label",iB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(ee.BSSelect),{modelValue:L.value,"onUpdate:modelValue":ae[2]||(ae[2]=H=>L.value=H),items:$,"value-provider":H=>H.v,"label-provider":H=>t.unref(a).t(H.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",aB,[t.createElementVNode("span",rB,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:b.value||void 0,"onUpdate:modelValue":ae[3]||(ae[3]=H=>D.value=H)},null,8,lB),[[t.vModelText,D.value]]),ae[9]||(ae[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:D.value||void 0,"onUpdate:modelValue":ae[4]||(ae[4]=H=>b.value=H)},null,8,sB),[[t.vModelText,b.value]]),w.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:v},[t.createVNode(Ae,{name:"x",size:12})],8,cB)):t.createCommentVNode("",!0)]),h.value!=null?(t.openBlock(),t.createElementBlock("div",dB,[t.createElementVNode("div",uB,[t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":h.value??void 0,items:P.value,"value-provider":H=>H.v,"label-provider":H=>`#${H.v}`,"onUpdate:modelValue":ae[5]||(ae[5]=H=>Q(H??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ae,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":F.value,items:U.value,"value-provider":H=>H.v,"label-provider":H=>_e(H.v),"onUpdate:modelValue":ae[6]||(ae[6]=H=>X(H??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",mB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Be=Se.value)==null?void 0:Be.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:fe},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",fB,[h.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ve=Se.value)!=null&&Ve.entries.length?(t.openBlock(),t.createElementBlock("ul",hB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value.entries,(H,B)=>(t.openBlock(),t.createElementBlock("li",{key:B,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!he(H.subject)}]),onClick:Pe=>we(H.subject)},[t.createElementVNode("div",gB,[t.createVNode(Ae,{name:k[H.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",bB,t.toDisplayString(p(H.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${q[H.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[H.verb])),3)]),H.fields.length?(t.openBlock(),t.createElementBlock("ul",_B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.fields,(Pe,Ze)=>(t.openBlock(),t.createElementBlock("li",{key:Ze,class:"em-history__field"},[t.createElementVNode("span",kB,t.toDisplayString(Pe.field),1),Pe.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",EB,t.toDisplayString(ie(Pe.oldValue)),1)):t.createCommentVNode("",!0),Pe.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",NB,t.toDisplayString(ie(Pe.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,yB))),128))])):(t.openBlock(),t.createElementBlock("p",pB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",wB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",IB,t.toDisplayString(s.value),1)):O.value.length===0?(t.openBlock(),t.createElementBlock("p",vB,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",CB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.value,H=>{var B,Pe,Ze;return t.openBlock(),t.createElementBlock("li",{key:H.seq,class:t.normalizeClass(["em-history__group",[`is-${H.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Ue=>me(H.seq)},[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":ge.value.has(H.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${H.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(H.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",SB,t.toDisplayString(ye(H)),1),t.createElementVNode("span",RB,"#"+t.toDisplayString(H.seq),1)],8,xB),t.createElementVNode("div",AB,[t.createElementVNode("span",$B,t.toDisplayString(ke(H)),1),H.ts?(t.openBlock(),t.createElementBlock("span",TB,t.toDisplayString(se(H.ts)),1)):t.createCommentVNode("",!0),H.kind==="restore"&&H.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",MB,"← #"+t.toDisplayString(H.restoredFromSeq),1)):t.createCommentVNode("",!0),H.seq!==S.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Ue=>ce(H.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,VB)):t.createCommentVNode("",!0)]),ge.value.has(H.seq)?(t.openBlock(),t.createElementBlock("div",BB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.actions,(Ue,Le)=>(t.openBlock(),t.createElementBlock("div",{key:Le,class:"em-history__action"},[t.createElementVNode("div",DB,[t.createVNode(Ae,{name:k[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",OB,t.toDisplayString(p(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Ue.verb}`])},t.toDisplayString(t.unref(a).t(I[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",PB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",zB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",FB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&H.seq!==S.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":K.value===H.seq}])},[K.value===H.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",UB,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((B=ve.value)!=null&&B.entries.length),onClick:ae[7]||(ae[7]=Ue=>Te.value=!Te.value)},[t.createVNode(Ae,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Te.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Pe=ve.value)!=null&&Pe.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:ve.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,HB),Te.value&&((Ze=ve.value)!=null&&Ze.entries.length)?(t.openBlock(),t.createElementBlock("ul",jB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value.entries,(Ue,Le)=>(t.openBlock(),t.createElementBlock("li",{key:Le,class:"em-history__diff-entry"},[t.createElementVNode("div",KB,[t.createVNode(Ae,{name:k[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",GB,t.toDisplayString(p(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${q[Ue.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",YB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",qB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",WB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",JB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",XB,[t.createElementVNode("span",ZB,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:J.value,onClick:Ue=>te(H.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,QB),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:J.value,onClick:ae[8]||(ae[8]=Ue=>K.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,eD)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Ue=>G(H.seq)},[t.createVNode(Ae,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,tD))],2)):t.createCommentVNode("",!0)],2)}),128))])),h.value==null&&z.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:j},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:z.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function oD(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 kh(e){const n=t.ref(oD(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 iD={class:"em-modeler"},aD={class:"em-modeler__body"},rD={class:"em-drawer__inner"},lD={class:"em-drawer__head"},sD={class:"em-drawer__actions"},cD=["title"],dD=["title"],uD=["title"],mD=["title"],fD=["title"],pD=Ke(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(k){t.nextTick(()=>{const I=k();I&&("focusCollapse"in I?I.focusCollapse():I.focus())})}function c(k){n.value=k,s(()=>k?i.value:a.value)}function d(k){o.value=k,s(()=>k?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:h,dragging:f,startResize:y}=kh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:g,dragging:_,startResize:E}=kh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),N=t.ref(null),p=t.ref(null);return(k,I)=>{var A,$,L;return t.openBlock(),t.createElementBlock("div",iD,[t.createVNode(bh,{controller:e.controller,"history-open":u.value,onExportSvg:I[0]||(I[0]=V=>{var S;return(S=N.value)==null?void 0:S.exportSvg()}),onExportPng:I[1]||(I[1]=V=>{var S;return(S=N.value)==null?void 0:S.exportPng()}),onToggleHistory:I[2]||(I[2]=V=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",aD,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(h)+"px"})},[t.createElementVNode("div",rD,[t.createElementVNode("header",lD,[I[11]||(I[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",sD,[(A=p.value)!=null&&A.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t(($=p.value)!=null&&$.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:I[3]||(I[3]=V=>{var S;return(S=p.value)==null?void 0:S.toggleAll()})},[t.createVNode(Ae,{name:(L=p.value)!=null&&L.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,cD)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:I[4]||(I[4]=V=>c(!1))},[t.createVNode(Ae,{name:"panel-close",size:16})],8,dD)])]),t.createVNode(gh,{ref_key:"explorer",ref:p,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:I[5]||(I[5]=(...V)=>t.unref(y)&&t.unref(y)(...V))},null,42,uD),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:I[6]||(I[6]=V=>c(!0))},[t.createVNode(Ae,{name:"panel-open",size:18})],8,mD),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(h)-6+"px"})},[t.createVNode(yh,{ref_key:"canvas",ref:N,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(_h,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(g),resizing:t.unref(_),"start-resize":t.unref(E),onCollapse:I[7]||(I[7]=V=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:I[8]||(I[8]=V=>d(!0))},[t.createVNode(Ae,{name:"panel-right-open",size:18})],8,fD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(nD,{controller:e.controller,open:u.value,onClose:I[9]||(I[9]=V=>u.value=!1),onDiffChange:I[10]||(I[10]=V=>m.value=V)},null,8,["controller","open"])]),t.createVNode(JV,{controller:e.controller,"panel-width":t.unref(g),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=zb,be.AssociationEdge=hp,be.CUSTOM_TYPE_VALUE=an,be.CommandStack=ol,be.DEFAULT_JAVA_TYPE=$r,be.DIAGRAM_JSON_FORMAT=Dr,be.DIAGRAM_JSON_VERSION=Or,be.DiagramCanvas=yh,be.DiagramExplorer=gh,be.EDITOR=oo,be.EditModeToggle=qM,be.EditorToolbar=bh,be.EntityModeler=pD,be.EntityNode=Gf,be.GROUP_CODE_ENUM_VALUE=On,be.GroupNode=Yf,be.INHERITED_REF_PREFIX=Oi,be.InvalidDiagramJsonError=Pn,be.JAVA_TYPES=Wo,be.NoteNode=qf,be.OpSyncAdapter=Pd,be.PHYSICAL_NAME_MAX_LENGTH=Xo,be.PropertyPanel=_h,be.RevCache=Ld,be.SELECTABLE_JAVA_TYPES=nc,be.SYMBOLIC_OP_KINDS=zd,be.SYMBOLIC_OP_SCHEMA=au,be.UI_LOCALES=lI,be.applyDocumentReferenceOnly=vr,be.buildAgentBatch=Fb,be.buildDiagramSvg=Ss,be.buildDiffMarks=qc,be.collectSharedColumns=Nn,be.commands=Yg,be.computeAutoLayout=Ts,be.createEditorController=OC,be.dedupeModelIds=Eg,be.defaultMermaidDialect=Uh,be.defaultSqlDialect=ky,be.diagramToJson=mc,be.displayLabel=zi,be.emptyState=Vf,be.entityModelToDdl=dc,be.entityModelToMermaid=Cr,be.entityModelToText=Ks,be.exportDiagramPng=ph,be.exportDiagramSvg=fh,be.fromPersisted=hu,be.isGeneratable=xc,be.isInheritedColumnRef=Bn,be.javaTypeLabel=fo,be.makeInheritedColumnRef=Bs,be.mergeDiagram=Uc,be.mermaidErToImportSource=ac,be.migrateLegacyMoney=kg,be.multiplicityLabel=ji,be.newId=Me,be.packEntityBoxes=Er,be.parseDiagramJson=fc,be.parseInheritedColumnRef=Nr,be.parseMermaidEr=ic,be.parseSqlDdl=Vr,be.planHealBackfillOps=E_,be.projectActionLog=tl,be.projectEntityAudit=Gc,be.projectFieldAudit=wn,be.projectInheritedColumns=Ko,be.projectSeqDiff=nl,be.renderDiagramSvg=hc,be.resolveColumnPhysicalName=Yo,be.resolveDiagram=$s,be.resolveEffectiveColumn=on,be.resolveQuickFix=Hr,be.resolveSharedColumn=Dn,be.resolveSymbolicOps=Eb,be.restoreDeepEqual=zn,be.scaffoldEntityJava=Yy,be.sharedColumnScopeEntities=wr,be.sqlDdlToImportSource=cc,be.stereotypeLabel=Go,be.synthesizeRestoreOps=Mg,be.toPersisted=b_,be.toPersistedV2=__,be.translate=Dt,be.uiMessagesEn=Ef,be.uiMessagesJa=Nf,be.uiMessagesKo=wf,be.validateModel=Zi,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|
|
65
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(x=>{if(k.value){const z=Vn(k.value),j=pe=>{if(pe.sourceEvent.type!=="wheel"||!h.value||!f.value)return;const he=pe.sourceEvent.ctrlKey&&wi()?10:1,fe=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*e.zoomStep,ye=c.value.zoom*2**(fe*he);f.value.scaleTo(h.value,ye)},ne=pe=>{if(pe.sourceEvent.type!=="mousemove"||!h.value||!f.value)return;const he=T.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),fe={x:c.value.x-pe.sourceEvent.movementX*he,y:c.value.y-pe.sourceEvent.movementY*he},ye=[[0,0],[u.value.width,u.value.height]],_e=xs.translate(fe.x,fe.y).scale(c.value.zoom),Re=f.value.constrain()(_e,ye,d.value);f.value.transform(h.value,Re)},de=tT().wheelDelta(pe=>Hl(pe)*(e.zoomStep/10)).on("zoom",e.pannable?ne:()=>{}).on("zoom.wheel",e.zoomable?j:()=>{});z.call(de),x(()=>{z.on("zoom",null)})}},{flush:"post"});function M(x){const[z,j]=Bn(x);n("click",{event:x,position:{x:z,y:j}})}function B(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeClick(j),n("nodeClick",j)}function g(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeDoubleClick(j),n("nodeDblclick",j)}function I(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeMouseEnter(j),n("nodeMouseenter",j)}function v(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeMouseMove(j),n("nodeMousemove",j)}function O(x,z){const j={event:x,node:z,connectedEdges:eo([z],s.value)};m.miniMapNodeMouseLeave(j),n("nodeMouseleave",j)}return(x,z)=>(t.openBlock(),t.createBlock(t.unref(bf),{position:x.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:x.pannable,zoomable:x.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:k,width:_.value,height:E.value,viewBox:[S.value.x,S.value.y,S.value.width,S.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:M},[x.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(x.ariaLabel),9,rT)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),j=>(t.openBlock(),t.createBlock(iT,{id:j.id,key:j.id,f:"",position:j.computedPosition,dimensions:j.dimensions,selected:j.selected,dragging:j.dragging,style:t.normalizeStyle(j.style),class:t.normalizeClass(w.value(j)),color:p.value(j),"border-radius":x.nodeBorderRadius,"stroke-color":b.value(j),"stroke-width":x.nodeStrokeWidth,"shape-rendering":t.unref(N),type:j.type,hidden:j.hidden,onClick:ne=>B(ne,j),onDblclick:ne=>g(ne,j),onMouseenter:ne=>I(ne,j),onMousemove:ne=>v(ne,j),onMouseleave:ne=>O(ne,j)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:C.value,fill:x.maskColor,stroke:x.maskStrokeColor,"stroke-width":x.maskStrokeWidth,"fill-rule":"evenodd"},null,8,lT)],8,aT))]),_:1},8,["position","class"]))}}),dT=["d"],uT=["cx","cy","onDblclick"],mT=["x","y","onPointerdown","onDblclick"],fT=We(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=qe(),i=t.inject(ss),a=t.inject(ro,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Po,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((L,T)=>T===d.value?u.value:L)),{source:h,target:f,sourceSide:y,targetSide:k}=bp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),_=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?ep(h.value,y.value,m.value,f.value,k.value):np(h.value,m.value,f.value)),E=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?tp(h.value,y.value,m.value,f.value,k.value):ap(h.value,m.value,f.value).map((L,T)=>({point:L,segIndex:T})):[]),N=t.computed(()=>r.value?m.value:[]);function p(L,T){d.value=L,u.value={...c.value[L]},T.target.setPointerCapture(T.pointerId),T.stopPropagation()}function b(L){if(d.value<0)return;const T=o({x:L.clientX,y:L.clientY});u.value={x:T.x,y:T.y}}function w(L){var T,S;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(S=(T=L.target).releasePointerCapture)==null||S.call(T,L.pointerId)}function A(L,T){T.stopPropagation(),i==null||i.removePoint(n.id,L)}function $(L,T){if(!i)return;const S=o({x:T.clientX,y:T.clientY});i.insertPoint(n.id,L,{x:S.x,y:S.y})}return(L,T)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:_.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,dT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(S,C)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${C}`,cx:S.point.x,cy:S.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(M=>$(S.segIndex,M),["stop"])},null,42,uT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,(S,C)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${C}`,x:S.x-5,y:S.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:M=>p(C,M),onPointermove:b,onPointerup:w,onDblclick:M=>A(C,M)},null,42,mT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),pT=["data-theme"],hT={key:0,class:"em-ctx__sep",role:"separator"},yT=["aria-label"],gT={class:"em-ctx__swatches-label","aria-hidden":"true"},bT={class:"em-ctx__chips",role:"none"},_T=["aria-checked","aria-label","title","onClick"],kT=["aria-checked","aria-label","title","onClick"],ET=["disabled","onClick"],NT={class:"em-ctx__icon"},wT={class:"em-ctx__caption"},IT=We(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(p,b)=>Dt(o.locale??"ko",p,b),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(p,b){var $,L;r.value=b,l.value=($=p.target)!=null&&$.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=p.clientX,c.y=p.clientY,a.value=!0,window.addEventListener("keydown",_),window.addEventListener("resize",h),await t.nextTick();const w=s.value;if(!w)return;const A=w.getBoundingClientRect();c.x+A.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-A.width)),c.y+A.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-A.height)),(L=f()[0])==null||L.focus()}function h(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",_),window.removeEventListener("resize",h);const p=d;d=null,p!=null&&p.isConnected&&p.focus()}function f(){const p=s.value;if(!p)return[];const b=[];for(const w of Array.from(p.children))if(w.classList.contains("em-ctx__item"))w.disabled||b.push(w);else if(w.classList.contains("em-ctx__swatches")){const A=Array.from(w.querySelectorAll(".em-ctx__chip"));A.length&&b.push(A.find($=>$===document.activeElement)??A[0])}return b}function y(p){var $;const b=f();if(!b.length)return;const w=b.indexOf(document.activeElement),A=w<0?p>0?0:b.length-1:(w+p+b.length)%b.length;($=b[A])==null||$.focus()}function k(p){var $,L;const b=($=document.activeElement)==null?void 0:$.closest(".em-ctx__swatches");if(!b)return!1;const w=Array.from(b.querySelectorAll(".em-ctx__chip")),A=w.indexOf(document.activeElement);return A<0?!1:((L=w[(A+p+w.length)%w.length])==null||L.focus(),!0)}function _(p){var b,w;switch(p.key){case"Escape":p.stopPropagation(),h();return;case"ArrowDown":p.preventDefault(),y(1);return;case"ArrowUp":p.preventDefault(),y(-1);return;case"ArrowRight":k(1)&&p.preventDefault();return;case"ArrowLeft":k(-1)&&p.preventDefault();return;case"Home":p.preventDefault(),(b=f()[0])==null||b.focus();return;case"End":{p.preventDefault();const A=f();(w=A[A.length-1])==null||w.focus();return}case"Tab":p.preventDefault(),y(p.shiftKey?-1:1)}}function E(p){p.disabled||(p.handler(),h())}function N(p,b){p.onPick(b),h()}return t.onBeforeUnmount(h),n({open:m,close:h}),(p,b)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:h,onContextmenu:t.withModifiers(h,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:b[0]||(b[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(w,A)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:A},[w.type==="separator"?(t.openBlock(),t.createElementBlock("div",hT)):w.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":w.caption},[t.createElementVNode("span",gT,t.toDisplayString(w.caption),1),t.createElementVNode("div",bT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":w.current===null}]),role:"menuitemradio","aria-checked":w.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:$=>N(w,null)},null,10,_T),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":w.current===$}]),style:t.normalizeStyle({background:t.unref(Oo)($)}),role:"menuitemradio","aria-checked":w.current===$,"aria-label":i(t.unref(io)($)),title:i(t.unref(io)($)),onClick:L=>N(w,$)},null,14,kT))),128))])],8,yT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":w.danger,"is-disabled":w.disabled}]),disabled:w.disabled,role:"menuitem",onClick:$=>E(w)},[t.createElementVNode("span",NT,[w.icon?(t.openBlock(),t.createBlock($e,{key:0,name:w.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",wT,t.toDisplayString(w.caption),1)],10,ET))],64))),128))],36)],8,pT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function mh(e,n){return n?`${e}:${n}`:e}function fh(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(mh(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function vT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=mh(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function ph(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(fh(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=fh(e.storageKey,s)),t.watch(o,s=>vT(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const Rs=[".em-entity__grip",".em-entity__add",".em-entity__footer",".em-sel",".em-handle",".em-note-handle",".vue-flow__handle",".em-group__resize",".em-note__resize",".em-edge__waypoint",".em-edge__mid",".em-note-edge__waypoint",".em-note-edge__mid"].join(",");function jo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function CT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function xT(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const k=n(y.left,y.top+y.height/2);return[{...i,x:k.x,y:k.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,h=0;const f=()=>{const y=d.trim();if(y){const k=n(m,(u+h)/2);c.push({...i,x:k.x,y:k.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const k=a.getBoundingClientRect();u===null||Math.abs(k.top-u)>1?(f(),u=k.top,m=k.left,h=k.bottom,d=s[y]):(d+=s[y],h=Math.max(h,k.bottom))}return f(),c}function kr(e,n){const o=[];for(const i of e.querySelectorAll("*"))CT(i)&&(i.closest(Rs)||jo(i)&&o.push(...xT(i,n)));return o}function Di(e){return Math.round(e*100)/100}function ST(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Rs)||!jo(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=n(a.left,a.top),l=n(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${Di(r.x)}" y="${Di(r.y)}" width="${Di(l.x-r.x)}" height="${Di(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function RT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!jo(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Di(parseFloat(o.getAttribute(d)??"0"));s==="line"?n.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?n.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&n.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return n}function hh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Rs)||!jo(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:r.borderTopColor,strokeWidth:l})}return i}function Oi(e,n){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=n(o.left,o.top),r=n(o.right,o.bottom),l=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function As(e,n){e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x+n.w),e.maxY=Math.max(e.maxY,n.y+n.h)}function AT(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,y)=>e.screenToFlowCoordinate({x:f,y}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const y=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!y||!jo(y))continue;const k=y.firstElementChild;if(k)if(f.type==="group"){const _=Oi(k,o);As(s,_),i.push({..._,texts:[]});const E=k.querySelector(".em-group__label");E&&i.push({...Oi(E,o),stroke:"none",texts:[]}),i.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:kr(k,o)})}else if(f.type==="note"){const _={...Oi(k,o),texts:kr(k,o),lines:hh(k,k,o)};As(s,_),r.push(_)}else{const _=Oi(k,o);As(s,_);const E=_.radius??{tl:0,tr:0};a.push({..._,stroke:"none",texts:[]});const N=k.querySelector(".em-entity__header");if(N){const p=Oi(N,o);a.push({x:_.x,y:_.y,w:_.w,h:p.y+p.h-_.y,fill:p.fill,stroke:"none",radius:{tl:E.tl,tr:E.tr,br:0,bl:0},texts:[]})}a.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:kr(k,o),lines:hh(k,k,o),icons:ST(k,o)}),a.push({..._,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const y=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!jo(y))continue;const k=y.getAttribute("d");if(!k)continue;const _=getComputedStyle(y),E=_.strokeDasharray,N=RT(f);l.push({d:k,stroke:_.stroke,strokeWidth:parseFloat(_.strokeWidth)||1.5,strokeDasharray:E&&E!=="none"?E:void 0,labels:kr(f,o),markers:N.length?N:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function $s(e){return bc(AT(e))}function yh(e,n){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function gh(e,n="diagram.svg"){const o=$s(e);yh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function $T(e){var i,a;const n=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:n>0?n:1,h:o>0?o:1}}async function bh(e,n="diagram.png",o=2){const i=$s(e),{w:a,h:r}=$T(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,h)=>{s.onload=()=>m(),s.onerror=()=>h(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");yh(u,n)}finally{URL.revokeObjectURL(l)}}const TT={class:"em-shortcuts"},MT={class:"em-shortcuts__list"},VT={class:"em-shortcuts__title"},BT={class:"em-shortcuts__keys"},DT={class:"em-shortcuts__kbd"},OT={key:0,class:"em-shortcuts__plus"},LT={class:"em-shortcuts__desc"},PT={class:"em-shortcuts__actions"},_h=We(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(s,c)=>Dt(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",TT,[t.createElementVNode("div",MT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,d=>(t.openBlock(),t.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[t.createElementVNode("h4",VT,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",BT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,h)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+h},[t.createElementVNode("kbd",DT,t.toDisplayString(m),1),h<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",OT,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",LT,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",PT,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function Ko(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function zT(e,n){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(n);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const FT=["aria-label"],UT=["aria-activedescendant","aria-label","placeholder"],HT={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},jT=["aria-label"],KT={class:"em-cmdk__section","aria-hidden":"true"},GT=["id","aria-selected","onMouseenter","onClick"],YT={class:"em-cmdk__label"},qT={key:0,class:"em-cmdk__tag"},WT={key:1,class:"em-cmdk__sub"},JT=["aria-label"],XT={class:"em-cmdk__section","aria-hidden":"true"},ZT=["id","aria-selected","aria-disabled","onMouseenter","onClick"],QT={class:"em-cmdk__label"},eM={key:1,class:"em-cmdk__empty"},tM=We(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const w=c.value,A=a.state.logical.entities.map(L=>{var T,S,C,M,B,g;return{type:"goto",kind:"entity",id:L.modelId,label:((S=(T=L.table)==null?void 0:T.logicalName)==null?void 0:S[w])||L.name,sub:(C=L.table)==null?void 0:C.physicalName,match:Ko(L.name,(B=(M=L.table)==null?void 0:M.logicalName)==null?void 0:B[w],(g=L.table)==null?void 0:g.physicalName)??""}}),$=a.state.logical.groups.map(L=>{var T,S,C,M;return{type:"goto",kind:"group",id:L.modelId,label:((T=L.name)==null?void 0:T[w])||((S=L.name)==null?void 0:S.ko)||L.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:Ko((C=L.name)==null?void 0:C[w],(M=L.name)==null?void 0:M.ko,L.packageName)??""}});return[...A,...$]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const w=[];a.editable.value&&(w.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),w.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),w.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),w.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),w.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),w.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),w.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),w.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const A of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])w.push({type:"action",id:`dm-${A}`,label:a.t(u[A]),run:()=>a.displayMode.value=A});return w});function h(w,A){return w.label.toLowerCase().includes(A)}const f=t.computed(()=>{const w=r.value.trim().toLowerCase();return w?d.value.filter(A=>A.match.includes(w)):d.value}),y=t.computed(()=>{const w=r.value.trim().toLowerCase();return w?m.value.filter(A=>h(A,w)):m.value}),k=t.computed(()=>[...f.value,...y.value]);t.watch([f,y],()=>{l.value=0});function _(w){return k.value.indexOf(w)}const E=w=>`em-cmdk-opt-${w}`,N=t.computed(()=>k.value[l.value]?E(l.value):void 0);t.watch(l,async()=>{var A;await t.nextTick();const w=N.value;w&&((A=document.getElementById(w))==null||A.scrollIntoView({block:"nearest"}))});function p(w){if(w.type==="goto")a.selection.value={kind:w.kind,id:w.id},a.requestFocus(w.id);else{if(w.disabled)return;w.run()}i("close")}function b(w){if(w.key==="Escape"){i("close"),w.preventDefault();return}if(w.key==="ArrowDown"){l.value=Math.min(l.value+1,k.value.length-1),w.preventDefault();return}if(w.key==="ArrowUp"){l.value=Math.max(l.value-1,0),w.preventDefault();return}if(w.key==="Enter"){const A=k.value[l.value];A&&p(A),w.preventDefault();return}w.key==="Tab"&&w.preventDefault()}return t.nextTick(()=>{var w;return(w=s.value)==null?void 0:w.focus()}),(w,A)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:A[1]||(A[1]=t.withModifiers($=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":A[0]||(A[0]=$=>r.value=$),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":N.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:b},null,40,UT),[[t.vModelText,r.value]]),t.createElementVNode("div",HT,[k.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",KT,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,$=>(t.openBlock(),t.createElementBlock("button",{id:E(_($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":_($)===l.value}]),role:"option","aria-selected":_($)===l.value,onMouseenter:L=>l.value=_($),onClick:L=>p($)},[t.createElementVNode("span",YT,t.toDisplayString($.label),1),$.tag?(t.openBlock(),t.createElementBlock("span",qT,t.toDisplayString($.tag),1)):$.sub?(t.openBlock(),t.createElementBlock("span",WT,t.toDisplayString($.sub),1)):t.createCommentVNode("",!0)],42,GT))),128))],8,jT)):t.createCommentVNode("",!0),y.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",XT,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,$=>(t.openBlock(),t.createElementBlock("button",{id:E(_($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":_($)===l.value,"is-disabled":$.disabled}]),role:"option","aria-selected":_($)===l.value,"aria-disabled":$.disabled||void 0,onMouseenter:L=>l.value=_($),onClick:L=>p($)},[t.createElementVNode("span",QT,t.toDisplayString($.label),1)],42,ZT))),128))],8,JT)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",eM,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,FT)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function nM(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const oM={key:0,class:"em-canvas__empty","aria-hidden":"true"},iM={class:"em-canvas__empty-title"},aM=["innerHTML"],rM=["innerHTML"],lM=["innerHTML"],sM={key:1,class:"em-canvas__empty-title"},cM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},dM={class:"em-conflict-banner__body"},uM={class:"em-conflict-banner__title"},mM={class:"em-conflict-banner__detail"},fM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Ts="nc:",kh=We(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(D){l.value=D,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,D=>{D&&c(D.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const D=nM(i.opConflict.value);return D?{title:i.t(D.titleKey),detail:i.t(D.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),h={x:0,y:0};function f(D){h.x=D.clientX,h.y=D.clientY}const y=t.ref(null);t.provide(Qa,y);const k=t.ref(null);t.provide(Pf,k);const _=t.ref(null),E=t.computed(()=>{const D=_.value,R=new Set;if(!D)return R;if(D.kind==="entity")R.add(D.id);else if(D.kind==="group"){const P=i.resolved.value.groups.find(te=>te.group.modelId===D.id);for(const te of(P==null?void 0:P.group.memberEntityRefs)??[])R.add(te)}return R}),N=t.computed(()=>{const D=_.value,R=new Set(E.value),P=new Set,te=new Set;if(!D)return{related:R,edges:P,notes:te};if(D.kind==="note"){te.add(D.id);for(const ie of i.resolved.value.noteConnections)ie.noteRef===D.id&&R.add(ie.targetRef);return{related:R,edges:P,notes:te}}const Ee=E.value;if(!Ee.size)return{related:R,edges:P,notes:te};for(const ie of i.resolved.value.associations){const{end1:re,end2:Te}=ie.association;(Ee.has(re.entityRef)||Ee.has(Te.entityRef))&&(P.add(ie.association.modelId),R.add(re.entityRef),R.add(Te.entityRef))}for(const ie of i.resolved.value.noteConnections)R.has(ie.targetRef)&&te.add(ie.noteRef);return{related:R,edges:P,notes:te}});t.provide(Po,{source:_,active:t.computed(()=>_.value!==null),primaryEntityIds:E,relatedEntityIds:t.computed(()=>N.value.related),relatedEdgeIds:t.computed(()=>N.value.edges),relatedNoteIds:t.computed(()=>N.value.notes),hoverGroupId:t.computed(()=>{var D;return((D=_.value)==null?void 0:D.kind)==="group"?_.value.id:null}),setEntityHover:D=>{k.value||m.value||(_.value=D?{kind:"entity",id:D}:null)},setGroupHover:D=>{k.value||m.value||(_.value=D?{kind:"group",id:D}:null)},setNoteHover:D=>{k.value||m.value||(_.value=D?{kind:"note",id:D}:null)}}),t.provide(ro,i);const p=KC(),b=t.computed(()=>p(i.state.logical,i.embeddableCatalog.value));t.provide(Uf,b);const w=ph({expandableKeys:()=>[],defaultCollapsed:YC,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(jf,{isCollapsed:w.isCollapsed,toggle:w.toggle}),t.provide(zf,{marks:t.toRef(o,"diffMarks")});function A(D,R){return`${Ts}${D}:${R}`}function $(D){if(!D.startsWith(Ts))return null;const[R,P]=D.slice(Ts.length).split(":");return R&&P?{noteRef:R,targetRef:P}:null}t.provide(ss,{points:D=>{var P,te;const R=$(D);return R?((P=i.resolved.value.noteConnections.find(Ee=>Ee.noteRef===R.noteRef&&Ee.targetRef===R.targetRef))==null?void 0:P.waypoints)??[]:((te=i.resolved.value.associations.find(Ee=>Ee.association.modelId===D))==null?void 0:te.waypoints)??[]},movePoint:(D,R,P)=>{const te=$(D);te?i.moveNoteConnectionWaypoint(te.noteRef,te.targetRef,R,P):i.moveWaypoint(D,R,P)},insertPoint:(D,R,P)=>{const te=$(D);te?i.addNoteConnectionWaypoint(te.noteRef,te.targetRef,R,P):i.addWaypoint(D,R,P)},removePoint:(D,R)=>{const P=$(D);P?i.removeNoteConnectionWaypoint(P.noteRef,P.targetRef,R):i.removeWaypoint(D,R)}});const L=qe(),{nodes:T,edges:S,findNode:C,findEdge:M,addNodes:B,addEdges:g,removeNodes:I,removeEdges:v,fitView:O,setCenter:x,getViewport:z,screenToFlowCoordinate:j,getSelectedNodes:ne,updateNodeInternals:de}=L,pe=t.ref(!1);async function he(D){pe.value=!0,await t.nextTick(),await new Promise(R=>requestAnimationFrame(()=>R(null)));try{return await D()}finally{pe.value=!1}}async function fe(){try{await he(()=>gh(L))}catch(D){console.error("[entity-modeler] SVG export failed",D),c(i.t("em.canvas.exportFailed"))}}async function ye(){try{await he(()=>bh(L))}catch(D){console.error("[entity-modeler] PNG export failed",D),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:fe,exportPng:ye,fitView:O});const _e=t.computed(()=>i.resolved.value.entities.length===0);function Re(){const D=z(),{width:R,height:P}=L.dimensions.value;return{x:(R/2-D.x)/D.zoom,y:(P/2-D.y)/D.zoom}}function ce(){const D=Re();i.addEntity("NewEntity",{x:D.x,y:D.y})}function le(){const D=Re();i.addNote("메모",{x:D.x,y:D.y})}function ae(D){for(const R of i.resolved.value.groups){const{location:P,size:te}=R.geo;if(D.x>=P.x&&D.x<=P.x+te.width&&D.y>=P.y&&D.y<=P.y+te.height)return R.group.modelId}return null}function se(D,R){return D.x===R.x&&D.y===R.y}function ue(D,R){return(D==null?void 0:D.width)===(R==null?void 0:R.width)&&(D==null?void 0:D.height)===(R==null?void 0:R.height)}function U(D,R){return D.entity===R.entity&&D.displayMode===R.displayMode&&D.collapsed===R.collapsed&&D.locked===R.locked&&D.groupRef===R.groupRef&&ue(D.size,R.size)&&D.style===R.style&&D.attributeStyles===R.attributeStyles&&D.operationStyles===R.operationStyles}function F(D,R){const P=Object.keys(D);if(P.length!==Object.keys(R).length)return!1;for(const te of P)if(te==="geo"){const Ee=D.geo,ie=R.geo;if(!se(Ee.location,ie.location)||!ue(Ee.size,ie.size))return!1}else if(D[te]!==R[te])return!1;return!0}function H(){const D=i.resolved.value,R=new Map(D.groups.map(re=>[re.group.modelId,re.geo])),P=new Set(D.groups.map(re=>re.group.modelId)),te=new Set([...P,...D.entities.map(re=>re.entity.modelId),...D.notes.map(re=>re.note.modelId)]);for(const re of[...T.value])te.has(re.id)||I([re.id]);for(const re of D.groups){const Te=re.group.modelId,Oe={width:`${re.geo.size.width}px`,height:`${re.geo.size.height}px`},je={group:re.group,style:re.style,locked:re.locked},st=re.locked?!1:void 0,tt=C(Te);if(tt){se(tt.position,re.geo.location)||(tt.position={...re.geo.location});const Ke=tt.data;(Ke.group!==je.group||Ke.style!==je.style||Ke.locked!==je.locked)&&(tt.data=je);const Xe=tt.style;((Xe==null?void 0:Xe.width)!==Oe.width||(Xe==null?void 0:Xe.height)!==Oe.height)&&(tt.style=Oe),tt.draggable!==st&&(tt.draggable=st)}else B([{id:Te,type:"group",position:{...re.geo.location},draggable:st,style:Oe,data:je}])}for(const re of D.entities){const Te=re.entity.modelId,Oe=re.groupRef&&P.has(re.groupRef)?re.groupRef:void 0,je={entity:re.entity,displayMode:i.displayMode.value,collapsed:re.collapsed,locked:re.locked,groupRef:Oe,size:re.geo.size,style:re.style,attributeStyles:re.attributeStyles,operationStyles:re.operationStyles},st=re.locked?!1:void 0,tt=re.locked?!1:void 0,Ke=Oe?R.get(Oe):void 0,Xe=Ke?{x:re.geo.location.x-Ke.location.x,y:re.geo.location.y-Ke.location.y}:{...re.geo.location},Ye=C(Te);Ye?(se(Ye.position,Xe)||(Ye.position=Xe),U(Ye.data,je)||(Ye.data=je),Ye.parentNode!==Oe&&(Ye.parentNode=Oe),Ye.draggable!==st&&(Ye.draggable=st),Ye.connectable!==tt&&(Ye.connectable=tt)):B([{id:Te,type:"entity",position:Xe,parentNode:Oe,draggable:st,connectable:tt,data:je}])}for(const re of D.notes){const Te=re.note,Oe=Te.modelId,je=re.groupRef&&P.has(re.groupRef)?re.groupRef:void 0,st={note:Te,groupRef:je},tt={width:`${Te.geo.size.width}px`,height:`${Te.geo.size.height}px`},Ke=je?R.get(je):void 0,Xe=Ke?{x:Te.geo.location.x-Ke.location.x,y:Te.geo.location.y-Ke.location.y}:{...Te.geo.location},Ye=C(Oe);if(Ye){se(Ye.position,Xe)||(Ye.position=Xe);const mo=Ye.data;(mo.groupRef!==je||!F(mo.note,Te))&&(Ye.data=st);const wn=Ye.style;((wn==null?void 0:wn.width)!==tt.width||(wn==null?void 0:wn.height)!==tt.height)&&(Ye.style=tt),Ye.parentNode!==je&&(Ye.parentNode=je)}else B([{id:Oe,type:"note",position:Xe,parentNode:je,style:tt,data:st}])}const Ee=new Map(D.associations.map(re=>[re.association.modelId,re])),ie=new Set(D.noteConnections.map(re=>A(re.noteRef,re.targetRef)));for(const re of[...S.value])!Ee.has(re.id)&&!ie.has(re.id)&&v([re.id]);for(const[re,Te]of Ee){const Oe={id:re,type:"association",source:Te.association.end1.entityRef,target:Te.association.end2.entityRef,sourceHandle:Te.sourceColumnRef?`r:${Te.sourceColumnRef}`:void 0,targetHandle:Te.targetColumnRef?`l:${Te.targetColumnRef}`:void 0,data:{association:Te.association,sourceColumnRef:Te.sourceColumnRef,targetColumnRef:Te.targetColumnRef}},je=M(re);if(je){const st=je.data;(st.association!==Oe.data.association||st.sourceColumnRef!==Oe.data.sourceColumnRef||st.targetColumnRef!==Oe.data.targetColumnRef)&&(je.data=Oe.data),je.sourceHandle!==Oe.sourceHandle&&(je.sourceHandle=Oe.sourceHandle),je.targetHandle!==Oe.targetHandle&&(je.targetHandle=Oe.targetHandle)}else g([Oe])}for(const re of D.noteConnections){const Te=A(re.noteRef,re.targetRef),Oe={noteRef:re.noteRef,targetRef:re.targetRef};M(Te)||g([{id:Te,type:"note-connection",source:re.noteRef,target:re.targetRef,data:Oe}])}}const Z=new Set;let X=!1,Ne=!1;const me=new Map;function Se(D){const R=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(D)}"]`);if(!R)return null;let P=`${R.offsetHeight}`;for(const te of R.querySelectorAll(".em-entity__row"))P+=`|${te.dataset.attr}:${te.offsetTop}`;return P}function ve(){Ne=!1;const D=X;X=!1;const R=[...Z];if(Z.clear(),D){de();for(const te of T.value){const Ee=Se(te.id);Ee!==null&&me.set(te.id,Ee)}return}const P=[];for(const te of R){const Ee=Se(te);if(Ee===null){me.delete(te);continue}me.get(te)!==Ee&&(me.set(te,Ee),P.push(te))}P.length&&de(P)}function G(D){if(D)for(const R of D)Z.add(R);else X=!0;Ne||(Ne=!0,t.nextTick(()=>requestAnimationFrame(ve)))}t.provide(Ff,{mark:D=>G([D])});function q(){const D=ne.value.map(P=>P.id);if(D.length)return D;const R=i.selection.value;return R&&(R.kind==="entity"||R.kind==="note"||R.kind==="group")?[R.id]:[]}function Y(){return ne.value.filter(D=>D.type==="entity").map(D=>D.id)}function xe(){return ne.value.filter(D=>D.type==="group").map(D=>D.id)}function Be(D){var R;return[...((R=i.state.logical.groups.find(P=>P.modelId===D))==null?void 0:R.memberEntityRefs)??[]]}function Ve(){const D=xe().flatMap(Be);return[...new Set([...Y(),...D])]}function Le(){return xe().length>0||Y().length>1}function oe(){Le()?i.copy(Ve()):i.copy()}async function we(D){if(!D.length)return;await t.nextTick();const R=ne.value;R.length&&L.removeSelectedNodes(R);const P=D.map(te=>C(te)).filter(te=>!!te);P.length&&L.addSelectedNodes(P)}function Fe(D){if(Le()&&Y().includes(D)){const R=Ve();return{caption:i.t("em.ctx.copyN",{n:R.length}),icon:"copy",handler:()=>i.copy(R)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D},i.copy()}}}function K(D){var Ee;const R=D.target;if(R&&(R.tagName==="INPUT"||R.tagName==="TEXTAREA"||R.isContentEditable))return;if(D.key==="?"){a.openModal({component:_h,bind:{locale:i.uiLocale.value}}),D.preventDefault();return}if((D.metaKey||D.ctrlKey)&&D.key.toLowerCase()==="k"){r.value=!0,D.preventDefault();return}if(!i.editable.value){(D.metaKey||D.ctrlKey)&&D.key.toLowerCase()==="c"&&(oe(),D.preventDefault());return}if(D.key==="Delete"||D.key==="Backspace"){i.deleteSelection()&&D.preventDefault();return}if(D.key==="ArrowUp"||D.key==="ArrowDown"||D.key==="ArrowLeft"||D.key==="ArrowRight"){if(((Ee=i.selection.value)==null?void 0:Ee.kind)==="attribute"){if(D.key==="ArrowUp"||D.key==="ArrowDown"){const Oe=D.key==="ArrowDown"?1:-1;(D.altKey?i.nudgeSelectedAttributes(Oe):i.moveAttributeFocus(Oe))&&D.preventDefault()}return}const ie=D.shiftKey?10:1,re=D.key==="ArrowLeft"?-ie:D.key==="ArrowRight"?ie:0,Te=D.key==="ArrowUp"?-ie:D.key==="ArrowDown"?ie:0;i.nudgeNodes(q(),re,Te)&&D.preventDefault();return}if(!(D.metaKey||D.ctrlKey))return;const te=D.key.toLowerCase();te==="c"?(oe(),D.preventDefault()):te==="v"?(we(i.paste()),D.preventDefault()):te==="z"&&(D.shiftKey?i.redo():i.undo(),D.preventDefault())}t.onMounted(async()=>{H(),await t.nextTick(),O(),G(),window.addEventListener("keydown",K),window.addEventListener("pointerup",V),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",K),window.removeEventListener("pointerup",V),window.removeEventListener("pointermove",f)});function V(){y.value=null}function W(){m.value=!0,_.value=null}function Ce(){var te;m.value=!1;const D=(te=document.elementFromPoint(h.x,h.y))==null?void 0:te.closest(".vue-flow__node"),R=D==null?void 0:D.dataset.id;if(!R){_.value=null;return}const P=D.classList.contains("vue-flow__node-group")?"group":D.classList.contains("vue-flow__node-note")?"note":"entity";_.value={kind:P,id:R}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],H),t.watch(()=>i.resolved.value,D=>{const R=_.value;if(!R)return;(R.kind==="entity"?D.entities.some(te=>te.entity.modelId===R.id):R.kind==="group"?D.groups.some(te=>te.group.modelId===R.id):D.notes.some(te=>te.note.modelId===R.id))||(_.value=null)});function ze(D){const R=D.computedPosition??D.position,P=D.dimensions??{width:0,height:0};return{x:R.x+P.width/2,y:R.y+P.height/2}}function Ie(D){const R=D.node;if(R){if(_.value=null,R.type==="group"){const P=i.resolved.value.groups.find(te=>te.group.modelId===R.id);k.value=P?{groupId:R.id,dx:R.position.x-P.geo.location.x,dy:R.position.y-P.geo.location.y}:null,y.value=null;return}if(R.type!=="entity"&&R.type!=="note"){y.value=null;return}y.value=ae(ze(R))}}function J(D){var te;y.value=null,k.value=null;const R=(te=D.nodes)!=null&&te.length?D.nodes:[D.node],P=R.filter(Ee=>(Ee==null?void 0:Ee.type)==="group");if(P.length){for(const Ee of P){if(!Ee)continue;const ie=i.resolved.value.entities.filter(re=>re.groupRef===Ee.id).map(re=>{const Te=C(re.entity.modelId),Oe=(Te==null?void 0:Te.computedPosition)??(Te==null?void 0:Te.position)??{x:0,y:0};return{id:re.entity.modelId,location:{x:Oe.x,y:Oe.y}}});i.dragGroup(Ee.id,{x:Ee.position.x,y:Ee.position.y},ie)}return}for(const Ee of R){if(!Ee||Ee.type==="group")continue;const ie=Ee.computedPosition??Ee.position,re=Ee.dimensions??{width:0,height:0},Te={x:ie.x+re.width/2,y:ie.y+re.height/2};Ee.type==="note"?i.dropNote(Ee.id,{x:ie.x,y:ie.y},ae(Te)):i.dropEntity(Ee.id,{x:ie.x,y:ie.y},ae(Te))}}function He(D){var Oe,je,st,tt,Ke;if(!i.editable.value||!D.source||!D.target)return;const R=((Oe=C(D.source))==null?void 0:Oe.type)==="note",P=((je=C(D.target))==null?void 0:je.type)==="note";if(R||P){if(R&&P)return;const Xe=R?D.source:D.target,Ye=R?D.target:D.source;((st=C(Ye))==null?void 0:st.type)==="entity"&&i.addNoteConnection(Xe,Ye);return}const te=Xe=>{var Ye;return(Ye=i.state.logical.entities.find(mo=>mo.modelId===Xe))==null?void 0:Ye.stereotype},Ee=te(D.source)==="JPA_EMBEDDABLE",ie=te(D.target)==="JPA_EMBEDDABLE";if(Ee||ie){if(Ee&&ie)return;const Xe=Ee?D.source:D.target,Ye=Ee?D.target:D.source;i.addEmbedAssociation(Ye,Xe);return}const re=(tt=D.sourceHandle)!=null&&tt.startsWith("r:")?D.sourceHandle.slice(2):void 0,Te=(Ke=D.targetHandle)!=null&&Ke.startsWith("l:")?D.targetHandle.slice(2):void 0;i.addAssociation(D.source,D.target,re,Te)}const ot=t.ref(null);function bn(D,R){var te;const P=i.state.layout.entityLayouts.find(Ee=>Ee.entityRef===D);return bt((te=P==null?void 0:P.attributeStyles)==null?void 0:te[R])}function Ue(D,R){var te;const P=i.state.layout.entityLayouts.find(Ee=>Ee.entityRef===D);return bt((te=P==null?void 0:P.operationStyles)==null?void 0:te[R])}function Ge(D){var R;return bt((R=i.state.layout.groupLayouts.find(P=>P.groupRef===D))==null?void 0:R.style)}function Q(D){var R;return bt((R=i.state.layout.notes.find(P=>P.modelId===D))==null?void 0:R.style)}function kt(D){var Ee,ie;if(D.preventDefault(),!i.editable.value)return;const R=()=>j({x:D.clientX,y:D.clientY}),P=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const re=R();i.addEntity("NewEntity",{x:re.x,y:re.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const re=R();i.addNote("메모",{x:re.x,y:re.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const re=R();i.addEmptyGroup({x:re.x,y:re.y})}}],te=(Ee=i.clipboard.value)==null?void 0:Ee.kind;(te==="entity"||te==="entities")&&P.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>we(i.paste())}),i.resolved.value.entities.length>0&&P.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(ie=ot.value)==null||ie.open(D,P)}function _n({event:D,node:R}){var Oe,je,st,tt,Ke,Xe,Ye,mo,wn,vh,Ch,xh,Sh,Rh,Ah,$h,Th,Mh,Vh;const P=D;if(P.preventDefault(),!i.editable.value){if(R.type==="group"||R.type==="note")return;const Je=(je=(Oe=P.target)==null?void 0:Oe.closest("[data-attr]"))==null?void 0:je.dataset.attr;if(Je){const ct=i.selection.value;(ct==null?void 0:ct.kind)==="attribute"&&ct.entityId===R.id&&ct.ids.includes(Je)||i.selectAttribute(R.id,Je);const In=((st=i.selection.value)==null?void 0:st.kind)==="attribute"&&i.selection.value.entityId===R.id?[...i.selection.value.ids]:[Je];(tt=ot.value)==null||tt.open(P,[{caption:In.length>1?i.t("em.ctx.copyN",{n:In.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(Ke=ot.value)==null||Ke.open(P,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Ja(a,i,R.id)},Fe(R.id)]);return}if(R.type==="group"){const Je=i.isGroupLocked(R.id),ct=[];Je||ct.push({type:"swatches",caption:i.t("em.common.color"),current:Ge(R.id),onPick:In=>i.setGroupSwatch(R.id,In)},{type:"separator"});const pt=Le()&&xe().includes(R.id)?Ve():Be(R.id);pt.length&&ct.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(pt)}),ct.push({caption:Je?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Je?"unlock":"lock",handler:()=>i.setGroupLocked(R.id,!Je)}),Je||ct.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(R.id)}),(Xe=ot.value)==null||Xe.open(P,ct);return}if(R.type==="note"){(Ye=ot.value)==null||Ye.open(P,[{type:"swatches",caption:i.t("em.common.color"),current:Q(R.id),onPick:Je=>i.setNoteSwatch(R.id,Je)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(R.id)}]);return}const te=(wn=(mo=P.target)==null?void 0:mo.closest("[data-attr]"))==null?void 0:wn.dataset.attr;if(te){const Je=i.selection.value;(Je==null?void 0:Je.kind)==="attribute"&&Je.entityId===R.id&&Je.ids.includes(te)||i.selectAttribute(R.id,te);const pt=((vh=i.selection.value)==null?void 0:vh.kind)==="attribute"&&i.selection.value.entityId===R.id?[...i.selection.value.ids]:[te];if(i.isEntityLocked(R.id)){(Ch=ot.value)==null||Ch.open(P,[{caption:pt.length>1?i.t("em.ctx.copyN",{n:pt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const In=pt.length>1,Ms=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(R.id)},{type:"swatches",caption:In?i.t("em.ctx.colorN",{n:pt.length}):i.t("em.common.color"),current:In?null:bn(R.id,te),onPick:bD=>i.setAttributeSwatches(R.id,pt,bD)},{type:"separator"},{caption:In?i.t("em.ctx.copyN",{n:pt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Li=i.clipboard.value;(Li==null?void 0:Li.kind)==="attribute"&&Ms.push({caption:Li.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Li.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:R.id},i.paste()}}),Ms.push({type:"separator"},{caption:In?i.t("em.ctx.deleteAttrN",{n:pt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(R.id,pt)}),(xh=ot.value)==null||xh.open(P,Ms);return}const Ee=(Rh=(Sh=P.target)==null?void 0:Sh.closest("[data-op]"))==null?void 0:Rh.dataset.op;if(Ee){if(i.isEntityLocked(R.id))return;(Ah=ot.value)==null||Ah.open(P,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(R.id)},{type:"swatches",caption:i.t("em.common.color"),current:Ue(R.id,Ee),onPick:Je=>i.setOperationSwatch(R.id,Ee,Je)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(R.id,Ee)}]);return}const ie=i.resolved.value.entities.find(Je=>Je.entity.modelId===R.id),re=!!(ie!=null&&ie.locked),Te=[{caption:re?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Ja(a,i,R.id)}];if(!re){Te.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(R.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(R.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const ct=ne.value.filter(pt=>pt.type==="entity").map(pt=>pt.id);i.createGroup(ct.includes(R.id)&&ct.length?ct:[R.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(R.id,R.id)});const Je=i.embeddableCatalog.value;if(Je.length){Te.push({type:"separator"});for(const ct of Je){const pt=(($h=ct.label)==null?void 0:$h[i.userLanguage.value])??((Th=ct.label)==null?void 0:Th.ko)??((Mh=ct.label)==null?void 0:Mh.en)??ct.type;Te.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:pt}),icon:"link",handler:()=>i.addPredefinedEmbed(R.id,ct.type)})}}}if(Te.push({type:"separator"}),Te.push({caption:ie!=null&&ie.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:ie!=null&&ie.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(R.id,!(ie!=null&&ie.collapsed))}),ie!=null&&ie.groupRef&&!re&&Te.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(R.id)}),Te.push({caption:re?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:re?"unlock":"lock",handler:()=>i.setEntityLocked(R.id,!re)}),Te.push(Fe(R.id)),!re){const Je=i.clipboard.value;(Je==null?void 0:Je.kind)==="attribute"&&Te.push({caption:Je.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Je.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:R.id},i.paste()}}),Te.push({type:"separator"}),Te.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(R.id)})}(Vh=ot.value)==null||Vh.open(P,Te)}function kn({event:D,edge:R}){var ie,re;const P=D;if(P.preventDefault(),!i.editable.value)return;const te=$(R.id);if(te){(ie=ot.value)==null||ie.open(P,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(te.noteRef,te.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(te.noteRef,te.targetRef)}]);return}const Ee=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(R.id)}];i.isAssociationLocked(R.id)||Ee.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(R.id)}),(re=ot.value)==null||re.open(P,Ee)}function St(D){return D==="group"?"group":D==="note"?"note":"entity"}function ge({node:D}){if(ne.value.length>1){i.selection.value=null;return}i.selection.value={kind:St(D.type),id:D.id}}function at({nodes:D}){D.length>1&&(i.selection.value=null)}function en({edge:D}){const R=$(D.id);i.selection.value=R?{kind:"note",id:R.noteRef}:{kind:"association",id:D.id}}function zt(D){const R=i.selection.value;return!!R&&R.kind!=="attribute"&&R.id===D.id}function tn(D){var R,P;return zt(D)?D.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":D.type==="note"?"var(--em-note-soft)":D.type==="group"?kf(bt((R=D.data)==null?void 0:R.style),!0)??"var(--em-mm-group)":kf(bt((P=D.data)==null?void 0:P.style))??"var(--em-mm-entity)"}function Ft(D){return zt(D)?"var(--em-selection)":D.type==="note"?"var(--em-note-accent)":D.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ke(D,R){x(D,R,{zoom:z().zoom,duration:350})}t.watch(()=>i.focusRequest.value,D=>{if(!D)return;const R=C(D.id);if(!R)return;const P=R.computedPosition??R.position,te=R.dimensions??{width:0,height:0};ke(P.x+te.width/2,P.y+te.height/2)});function lt({position:D}){ke(D.x,D.y)}function En({node:D}){i.selection.value={kind:St(D.type),id:D.id};const R=D.computedPosition??D.position,P=D.dimensions??{width:0,height:0};ke(R.x+P.width/2,R.y+P.height/2)}function Nn({node:D}){O({nodes:[D.id],duration:350,maxZoom:1.2,padding:.6})}return(D,R)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(Ew),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!pe.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(un).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:W,onMoveEnd:Ce,onConnect:He,onConnectStart:R[1]||(R[1]=P=>u.value=!0),onConnectEnd:R[2]||(R[2]=P=>u.value=!1),onNodeDrag:Ie,onNodeDragStop:J,onNodeClick:ge,onEdgeClick:en,onSelectionChange:at,onPaneClick:R[3]||(R[3]=P=>t.unref(i).selection.value=null),onPaneContextMenu:kt,onNodeContextMenu:_n,onEdgeContextMenu:kn},{"node-group":t.withCtx(P=>[t.createVNode(Xf,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),"node-entity":t.withCtx(P=>[t.createVNode(Jf,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),"node-note":t.withCtx(P=>[t.createVNode(Zf,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),"edge-association":t.withCtx(P=>[t.createVNode(_p,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),"edge-note-connection":t.withCtx(P=>[t.createVNode(fT,t.normalizeProps(t.guardReactiveProps(P)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(tS),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(xS),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(lo),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:ce},{default:t.withCtx(()=>[t.createVNode($e,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(lo),{title:t.unref(i).t("em.ctx.addNote"),onClick:le},{default:t.withCtx(()=>[t.createVNode($e,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(lo),{title:t.unref(i).t("em.palette.autoLayout"),onClick:R[0]||(R[0]=P=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode($e,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(cT),{key:1,pannable:"",width:224,height:160,"node-color":tn,"node-stroke-color":Ft,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:lt,onNodeClick:En,onNodeDblclick:Nn})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),_e.value?(t.openBlock(),t.createElementBlock("div",oM,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",iM,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,aM),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,rM),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,lM)],64)):(t.openBlock(),t.createElementBlock("p",sM,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(tM,{key:1,controller:t.unref(i),onClose:R[4]||(R[4]=P=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",cM,[t.createVNode($e,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",dM,[t.createElementVNode("strong",uM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",mM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(IT,{ref_key:"menuRef",ref:ot,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",fM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),pM={class:"em-explorer em-scroll-overlay"},hM={class:"em-explorer__search"},yM=["placeholder","aria-label"],gM=["aria-label","title"],bM={key:0,class:"em-explorer__empty"},_M=["aria-label"],kM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],EM=["onClick"],NM=["title"],wM={class:"em-key-slot"},IM={class:"em-key-slot"},vM={class:"em-explorer__label"},CM={key:2,class:"em-explorer__sr"},Eh=We(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.computed(()=>{var _e,Re;const B=i.resolved.value,g=i.displayMode.value,I=i.userLanguage.value,v=ce=>{var le,ae,se;return Ui(g,ce.name,(ae=(le=ce.table)==null?void 0:le.logicalName)==null?void 0:ae[I],(se=ce.table)==null?void 0:se.physicalName,i.t("em.node.logicalMissing"))},O=g==="PHYSICAL"||g==="LOGICAL_PHYSICAL",x=ce=>{const le=ce.attrType.startsWith("RELATION")&&ce.dbAttrs.length>0;return{icon:ce.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:ce.identifier,fk:le&&O}}},z=ce=>ce.attrType.startsWith("EMBED")&&ce.dbAttrs.length>0,j=g==="PHYSICAL"||g==="LOGICAL_PHYSICAL",ne=ce=>{if(ce.attrType!=="EMBED_PREDEF")return ce.dbAttrs;const le=i.embeddableCatalog.value.find(ae=>ae.type===ce.type);return le?ce.dbAttrs.map((ae,se)=>{const ue=le.fields[se];return ue?{...ae,physicalName:ae.physicalName||ue.physicalName,logicalName:ae.logicalName??ue.logicalName,dataType:ae.dataType||ue.dataType,length:ae.length??ue.length}:ae}):ce.dbAttrs},de=(ce,le)=>{var U,F,H,Z,X,Ne,me,Se,ve;const ae={entityId:le,attrId:ce.modelId};if(z(ce)){const G=Vr(g,ce);return{key:`attr:${ce.modelId}`,label:ce.name+(G?` : ${G}`:""),icon:"table",attrRef:ae,focusId:le,matchText:Ko(ce.name,(F=(U=ce.dbAttrs[0])==null?void 0:U.logicalName)==null?void 0:F[I],(H=ce.dbAttrs[0])==null?void 0:H.physicalName),children:j?ne(ce).map(q=>{var Y,xe;return{key:`attr:${ce.modelId}:col:${q.modelId}`,label:Ui(g,q.physicalName,(Y=q.logicalName)==null?void 0:Y[I],q.physicalName,i.t("em.node.logicalMissing"))+(q.dataType?` : ${q.dataType}`:""),icon:"field",attrRef:ae,focusId:le,matchText:Ko(q.physicalName,(xe=q.logicalName)==null?void 0:xe[I]),children:[]}}):[]}}const se=Mr(ce,i.state.logical.associations),ue=Vr(g,ce,se);return{key:`attr:${ce.modelId}`,label:Ui(g,ce.name,(X=(Z=ce.dbAttrs[0])==null?void 0:Z.logicalName)==null?void 0:X[I],(Ne=ce.dbAttrs[0])==null?void 0:Ne.physicalName,i.t("em.node.logicalMissing"))+(ue?` : ${ue}`:""),...x(ce),attrRef:ae,focusId:le,matchText:Ko(ce.name,(Se=(me=ce.dbAttrs[0])==null?void 0:me.logicalName)==null?void 0:Se[I],(ve=ce.dbAttrs[0])==null?void 0:ve.physicalName),children:[]}},pe=ce=>{var se,ue,U;const le=ce.entity,ae=[...le.attributes].sort((F,H)=>F.order-H.order);return{key:`entity:${le.modelId}`,label:v(le),icon:"table",selectKind:"entity",selectId:le.modelId,focusId:le.modelId,matchText:Ko(le.name,(ue=(se=le.table)==null?void 0:se.logicalName)==null?void 0:ue[I],(U=le.table)==null?void 0:U.physicalName),children:ae.map(F=>de(F,le.modelId))}},he=new Map,fe=[];for(const ce of B.entities)if(ce.groupRef){const le=he.get(ce.groupRef)??[];le.push(ce),he.set(ce.groupRef,le)}else fe.push(ce);const ye=[];for(const ce of B.groups){const le=ce.group;ye.push({key:`group:${le.modelId}`,label:((_e=le.name)==null?void 0:_e[I])||((Re=le.name)==null?void 0:Re.ko)||le.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:le.modelId,children:(he.get(le.modelId)??[]).map(pe)})}for(const ce of fe)ye.push(pe(ce));if(B.associations.length){const ce=new Map(B.entities.map(le=>[le.entity.modelId,v(le.entity)]));ye.push({key:"section:associations",label:i.t("em.explorer.associations",{n:B.associations.length}),icon:"arrow-lr",children:B.associations.map(le=>{const ae=le.association,se=ce.get(ae.end1.entityRef)??ae.end1.entityRef,ue=ce.get(ae.end2.entityRef)??ae.end2.entityRef;return{key:`assoc:${ae.modelId}`,label:`${se} — ${ue}`,icon:"arrow-lr",selectKind:"association",selectId:ae.modelId,children:[]}})})}return B.notes.length&&ye.push({key:"section:notes",label:i.t("em.explorer.notes",{n:B.notes.length}),icon:"note",children:B.notes.map(({note:ce})=>{var le;return{key:`note:${ce.modelId}`,label:((le=ce.memo.split(`
|
|
66
|
+
`)[0])==null?void 0:le.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:ce.modelId,focusId:ce.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:ye}});function l(B){return B?B.pk&&B.fk?i.t("em.node.keyPfk"):B.pk?i.t("em.node.keyPk"):B.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const B=[],g=I=>{if(I.children.length){I.key!=="root"&&B.push(I.key);for(const v of I.children)g(v)}};return g(r.value),B}),c=B=>B.startsWith("entity:")||B==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:h}=ph({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),y=t.ref(null),k=t.computed(()=>f.value.trim().length>0),_=t.computed(()=>{const B=[];if(k.value){const I=zT(r.value,f.value.trim().toLowerCase()),v=(O,x,z,j,ne)=>{if(!I.has(O.key))return;B.push({node:O,depth:x,parentKey:z,posinset:j,setsize:ne});const de=O.children.filter(pe=>I.has(pe.key));de.forEach((pe,he)=>v(pe,x+1,O.key,he+1,de.length))};return v(r.value,0,null,1,1),B}const g=(I,v,O,x,z)=>{B.push({node:I,depth:v,parentKey:O,posinset:x,setsize:z}),d(I.key)||I.children.forEach((j,ne)=>g(j,v+1,I.key,ne+1,I.children.length))};return g(r.value,0,null,1,1),B}),E=t.ref(null),N=t.ref(null),p=t.computed(()=>{var g;const B=_.value;return N.value&&B.some(I=>I.node.key===N.value)?N.value:((g=B[0])==null?void 0:g.node.key)??null}),b=B=>!k.value&&d(B);async function w(B){var g,I;B&&(N.value=B,await t.nextTick(),(I=(g=E.value)==null?void 0:g.querySelector(`[data-key="${B}"]`))==null||I.focus())}function A(B,g){var O,x,z,j,ne;const I=_.value,v=I.findIndex(de=>de.node.key===g.node.key);switch(B.key){case"ArrowDown":B.preventDefault(),w((O=I[v+1])==null?void 0:O.node.key);return;case"ArrowUp":B.preventDefault(),w((x=I[v-1])==null?void 0:x.node.key);return;case"Home":B.preventDefault(),w((z=I[0])==null?void 0:z.node.key);return;case"End":B.preventDefault(),w((j=I[I.length-1])==null?void 0:j.node.key);return;case"ArrowRight":if(B.preventDefault(),!g.node.children.length)return;b(g.node.key)?u(g.node.key):w((ne=I[v+1])==null?void 0:ne.node.key);return;case"ArrowLeft":B.preventDefault(),g.node.children.length&&!b(g.node.key)?u(g.node.key):w(g.parentKey);return;case"Enter":case" ":B.preventDefault(),C(g.node,B);return;case"F2":B.preventDefault(),M(g.node)}}const $=t.computed(()=>k.value&&_.value.length<=1);function L(B){var v;if(B.key!=="/"||B.metaKey||B.ctrlKey||B.altKey||B.shiftKey)return;const g=B.target,I=g==null?void 0:g.tagName;I==="INPUT"||I==="TEXTAREA"||I==="SELECT"||g!=null&&g.isContentEditable||(B.preventDefault(),(v=y.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",L)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",L)),n({toggleAll:m,allExpanded:h,hasExpandable:t.computed(()=>s.value.length>0)});function T(B){const g=i.selection.value;return B.attrRef?(g==null?void 0:g.kind)==="attribute"&&g.entityId===B.attrRef.entityId&&g.ids.includes(B.attrRef.attrId):!!g&&g.kind!=="attribute"&&!!B.selectId&&B.selectKind===g.kind&&B.selectId===g.id}function S(B){const g=i.selection.value;return B.selectKind==="entity"&&(g==null?void 0:g.kind)==="attribute"&&g.entityId===B.selectId}function C(B,g){if(B.attrRef){const I=g.shiftKey?"range":g.metaKey||g.ctrlKey?"toggle":"replace";i.selectAttribute(B.attrRef.entityId,B.attrRef.attrId,I)}else B.selectKind&&B.selectId&&(i.selection.value={kind:B.selectKind,id:B.selectId});B.focusId&&i.requestFocus(B.focusId)}function M(B){B.selectKind==="entity"&&B.selectId&&Ja(a,i,B.selectId)}return(B,g)=>(t.openBlock(),t.createElementBlock("section",pM,[t.createElementVNode("div",hM,[t.createVNode($e,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":g[0]||(g[0]=I=>f.value=I),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:g[1]||(g[1]=t.withKeys(I=>f.value="",["esc"]))},null,40,yM),[[t.vModelText,f.value]]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:g[2]||(g[2]=I=>f.value="")},[t.createVNode($e,{name:"x",size:13})],8,gM)):t.createCommentVNode("",!0)]),$.value?(t.openBlock(),t.createElementBlock("p",bM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:E,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,I=>(t.openBlock(),t.createElementBlock("div",{key:I.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":T(I.node),"is-focus-parent":S(I.node),"is-selectable":!!I.node.selectKind||!!I.node.attrRef||!!I.node.focusId}]),"data-key":I.node.key,role:"treeitem","aria-level":I.depth+1,"aria-posinset":I.posinset,"aria-setsize":I.setsize,"aria-expanded":I.node.children.length?!b(I.node.key):void 0,"aria-selected":T(I.node),tabindex:I.node.key===p.value?0:-1,style:t.normalizeStyle({paddingLeft:4+I.depth*14+"px"}),onClick:v=>C(I.node,v),onDblclick:v=>M(I.node),onFocus:v=>N.value=I.node.key,onKeydown:v=>A(v,I)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!I.node.children.length,"is-open":!b(I.node.key)}]),onClick:t.withModifiers(v=>I.node.children.length&&t.unref(u)(I.node.key),["stop"])},[I.node.children.length?(t.openBlock(),t.createBlock($e,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,EM),I.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(I.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",wM,[I.node.keyMarks.pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:14,class:"em-key is-pk"})):I.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock($e,{key:1,class:"em-explorer__icon",name:I.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",IM,[I.node.keyMarks.fk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,NM)):(t.openBlock(),t.createBlock($e,{key:1,class:"em-explorer__icon",name:I.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",vM,t.toDisplayString(I.node.label),1),l(I.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",CM,t.toDisplayString(l(I.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,kM))),128))],8,_M)]))}}),[["__scopeId","data-v-e5303c65"]]),xM={class:"em-text-export"},SM=["id","aria-selected","tabindex","onClick"],RM=["aria-labelledby"],AM={class:"em-text-export__actions"},$M=We(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(m,h)=>Dt(n.locale??"ko",m,h),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var h,f;a.value=m,await t.nextTick(),(f=(h=l.value)==null?void 0:h.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const h=n.formats.length;h&&s((a.value+m+h)%h)}async function d(){try{await navigator.clipboard.writeText(r().content),ee.showNotification(i("em.export.copied"),"info")}catch{ee.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),h=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(h);try{const y=document.createElement("a");y.href=f,y.download=m.filename,document.body.appendChild(y),y.click(),y.remove()}finally{URL.revokeObjectURL(f)}}return(m,h)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",xM,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,y)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${y}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":y===a.value}]),"aria-selected":y===a.value,"aria-controls":"em-text-export-panel",tabindex:y===a.value?0:-1,onClick:k=>a.value=y,onKeydown:[h[0]||(h[0]=t.withKeys(t.withModifiers(k=>c(-1),["prevent"]),["left"])),h[1]||(h[1]=t.withKeys(t.withModifiers(k=>c(1),["prevent"]),["right"])),h[2]||(h[2]=t.withKeys(t.withModifiers(k=>s(0),["prevent"]),["home"])),h[3]||(h[3]=t.withKeys(t.withModifiers(k=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,SM))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,RM),t.createElementVNode("div",AM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:h[4]||(h[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),TM={class:"em-text-import"},MM=["aria-label"],VM=["aria-checked","tabindex","onClick"],BM=["placeholder"],DM={class:"em-text-import__status"},OM={class:"em-text-import__ok"},LM={key:0,class:"em-text-import__warn"},PM={key:1,class:"em-text-import__err"},zM={key:2,class:"em-text-import__err"},FM={key:3,class:"em-text-import__err"},UM={class:"em-text-import__actions"},HM=We(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(k,_)=>Dt(n.locale??"ko",k,_),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(k){var E,N;const _=l[(k+l.length)%l.length];_&&(r.value=_.key,await t.nextTick(),(N=(E=s.value)==null?void 0:E.querySelectorAll('[role="radio"]')[l.indexOf(_)])==null||N.focus())}function d(k){c(l.findIndex(_=>_.key===r.value)+k)}function u(k){return k?k.startsWith("{")?"json":/\berdiagram\b/i.test(k)?"mermaid":/\bcreate\s+table\b/i.test(k)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),h=t.computed(()=>{const k=a.value.trim();if(!k)return{status:"empty"};const _=m.value;if(!_)return{status:"unknown"};try{let E,N=[];return _==="json"?E=yc(k):_==="mermaid"?E=sc(k):(E=mc(k),N=Br(k).warnings),E.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:E,warnings:N}}catch(E){return{status:"error",message:E instanceof Error?E.message:String(E)}}}),f=t.computed(()=>h.value.status==="ok");function y(){const k=h.value;k.status!=="ok"||!k.source||(n.onImport(k.source),o.close())}return(k,_)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",TM,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,E=>t.createElementVNode("button",{key:E.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":E.key===r.value}]),"aria-checked":E.key===r.value,tabindex:E.key===r.value?0:-1,onClick:N=>r.value=E.key,onKeydown:[_[0]||(_[0]=t.withKeys(t.withModifiers(N=>d(-1),["prevent"]),["left"])),_[1]||(_[1]=t.withKeys(t.withModifiers(N=>d(1),["prevent"]),["right"])),_[2]||(_[2]=t.withKeys(t.withModifiers(N=>c(0),["prevent"]),["home"])),_[3]||(_[3]=t.withKeys(t.withModifiers(N=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(E.labelKey)),43,VM)),64))],8,MM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":_[4]||(_[4]=E=>a.value=E),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,BM),[[t.vModelText,a.value]]),t.createElementVNode("div",DM,[h.value.status==="ok"&&h.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",OM,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:h.value.source.logical.entities.length,relations:h.value.source.logical.associations.length})),1),h.value.warnings&&h.value.warnings.length?(t.openBlock(),t.createElementBlock("span",LM," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:h.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):h.value.status==="error"?(t.openBlock(),t.createElementBlock("span",PM,t.toDisplayString(i("em.import.error",{message:h.value.message??""})),1)):h.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",zM,t.toDisplayString(i("em.import.unknownFormat")),1)):h.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",FM,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",UM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:y},null,8,["caption","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:_[5]||(_[5]=E=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),jM={class:"em-toolbar"},KM=["title"],GM={class:"em-toolbar__mode"},Nh=We(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=ee.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:y=>i.displayMode.value=y});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const y=i.resolved.value.entities;return y.length>0&&y.every(k=>k.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=Cr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:$M,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:qs(y,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:xr(y,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:xr(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:fc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:hc(y,i.state.layout),filename:"diagram.json"}]}})}function h(){r.openModal({component:HM,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(k=>k.modelId))}}})}function f(){r.openModal({component:_h,bind:{locale:i.uiLocale.value}})}return(y,k)=>(t.openBlock(),t.createElementBlock("div",jM,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,KM)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:k[0]||(k[0]=_=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode($e,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:k[1]||(k[1]=_=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode($e,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),k[9]||(k[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",GM,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(ee.BSSelect),{modelValue:s.value,"onUpdate:modelValue":k[2]||(k[2]=_=>s.value=_),items:l,"value-provider":_=>_.v,"label-provider":_=>t.unref(i).t(_.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode($e,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:k[3]||(k[3]=_=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode($e,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:k[4]||(k[4]=_=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode($e,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode($e,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),k[10]||(k[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:h},{left:t.withCtx(()=>[t.createVNode($e,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode($e,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:k[5]||(k[5]=_=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode($e,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:k[6]||(k[6]=_=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode($e,{name:"camera",size:16})]),_:1},8,["tooltip"]),k[11]||(k[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:k[7]||(k[7]=_=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode($e,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),k[8]||(k[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode($e,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),YM=["title"],qM=["title"],WM=["disabled","aria-pressed"],JM=["disabled","aria-pressed"],XM=We(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>Dt(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode($e,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,YM)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode($e,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,WM),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode($e,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,JM)],10,qM))}}),[["__scopeId","data-v-2b5162b7"]]),ZM=["disabled"],QM={class:"em-panel__sub"},e2={class:"em-nav"},t2={key:0,class:"em-nav__divider","aria-hidden":"true"},n2={key:1},o2=["onClick","onKeydown"],i2={class:"em-nav__name"},a2=["title"],r2={key:0,class:"em-panel__note"},l2=["data-attr-block"],s2={class:"em-attr__row"},c2=["title"],d2={key:0,class:"em-attr__row"},u2={key:1,class:"em-attr__navhint"},m2={key:0,class:"em-attr__navhint"},f2={class:"em-attr__row"},p2={class:"em-attr__row"},h2=["title"],y2={class:"em-attr__flags"},g2={class:"em-attr__pii"},b2={class:"em-attr__pii"},_2={key:1,class:"em-attr__pii"},k2={key:2,class:"em-attr__pii em-attr__codetop"},E2={class:"em-multilang"},N2={key:3,class:"em-embed-cols"},w2={class:"em-embed-col__label"},I2={class:"em-attr__row"},v2=["title"],C2=["title"],x2=["title"],S2={class:"em-attr__row"},R2={key:0,class:"em-embed-upd"},A2={key:1,class:"em-attr__navhint"},$2={class:"em-embed-upd"},T2={class:"em-embed-upd"},M2={class:"em-swatch__row em-attr__swatch"},V2=["title","onClick"],B2=["title","onClick"],D2={key:0,class:"em-attr__swatch-hint"},O2=We(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:h,setRowName:f,isManagedFk:y,setNaturalId:k,setIdentifier:_,setTransient:E,dbLocked:N,fkDerived:p,fkOriginPhysical:b,typeValueOf:w,typeLabelOf:A,setAttrType:$,setAttrCustomType:L,setDb:T,scaleApplicable:S,scaleHint:C,setDbLogical:M,setAttrDescription:B,attrPiiValue:g,setAttrPii:I,predefinedCustomTypeCatalog:v,embeddableCatalog:O,predefinedLabel:x,groupCodeCatalog:z,attrGroupCodes:j,attrCodeItems:ne,codeValueOf:de,codeLabelOf:pe,setAttrGroupCode:he,setAttrCode:fe,setAttrDefaultValue:ye,isEmbedExpanded:_e,setDbAt:Re,setDbLogicalAt:ce,embedColMeta:le,fixedDataType:ae,fixedLength:se,fixedScale:ue,updatableItems:U,updatableLabel:F,updatableValue:H,setUpdatableAt:Z,setUpdatable:X,insertableItems:Ne,insertableLabel:me,insertableValue:Se,setInsertableAt:ve,setInsertable:G,sharedItems:q,sharedLabel:Y,sharedValue:xe,setSharedAt:Be,isShared:Ve,sharedPhysical:Le}=If(o,()=>n.entityId),oe=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Ue=>Ue.entityRef===i.value.modelId)??null:null),we=t.computed(()=>{var Ue;return((Ue=i.value)==null?void 0:Ue.attributes.filter(Ge=>Ge.attrType!=="DIVIDER"))??[]}),Fe=t.computed(()=>{var Ue;return((Ue=i.value)==null?void 0:Ue.attributes)??[]}),K=t.computed(()=>we.value.filter(Ue=>r.value.has(Ue.modelId)));function V(Ue){return{pk:Ue.identifier,fk:Ue.attrType.startsWith("RELATION")&&Ue.dbAttrs.length>0,required:Ue.notNull&&!Ue.identifier}}function W(Ue){const Ge=V(Ue),Q=[Ge.pk&&"PK",Ge.fk&&"FK",Ge.required&&"NOT NULL"].filter(Boolean);return Q.length?Q.join(" · "):void 0}function Ce(Ue,Ge){i.value&&o.selectAttribute(i.value.modelId,Ue.modelId,Ge.shiftKey?"range":Ge.metaKey||Ge.ctrlKey?"toggle":"replace")}function ze(Ue){var Ge,Q;return bt((Q=(Ge=oe.value)==null?void 0:Ge.attributeStyles)==null?void 0:Q[Ue.modelId])}function Ie(Ue){return r.value.size>1&&r.value.has(Ue.modelId)}function J(Ue,Ge){if(!i.value)return;const Q=Ie(Ue)?o.selectedAttrIds.value:[Ue.modelId];o.setAttributeSwatches(i.value.modelId,Q,Ge)}const He=t.ref(void 0);function ot(Ue){if(!Ue||!i.value)return;const Ge=o.addPredefinedEmbed(i.value.modelId,Ue);Ge&&o.selectAttribute(i.value.modelId,Ge),He.value=void 0}function bn(){if(!i.value)return;const Ue=o.addAttribute(i.value.modelId);Ue&&o.selectAttribute(i.value.modelId,Ue)}return(Ue,Ge)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",QM,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:we.value.length}))+" ",1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:bn},null,8,["caption"]),t.unref(O).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":He.value,items:t.unref(O),"value-provider":Q=>Q.type,"label-provider":t.unref(x),"onUpdate:modelValue":ot},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",e2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Fe.value,Q=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Q.modelId},[Q.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",t2,[...Ge[0]||(Ge[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",n2,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Q.modelId)}]),role:"button",tabindex:"0",onClick:kt=>Ce(Q,kt),onKeydown:[t.withKeys(t.withModifiers(kt=>Ce(Q,kt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(kt=>Ce(Q,kt),["prevent"]),["space"])]},[t.createElementVNode("span",i2,t.toDisplayString(Q.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:W(Q)},[V(Q).pk?(t.openBlock(),t.createBlock($e,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):V(Q).required?(t.openBlock(),t.createBlock($e,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),V(Q).fk?(t.openBlock(),t.createBlock($e,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,a2)],42,o2)]))],64))),128))]),we.value.length&&!K.value.length?(t.openBlock(),t.createElementBlock("p",r2,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(K.value,Q=>{var kt,_n,kn,St,ge,at,en,zt,tn,Ft;return t.openBlock(),t.createElementBlock("div",{key:Q.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(Q.modelId)}]),"data-attr-block":Q.modelId},[t.createElementVNode("div",s2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-name-${Q.modelId}`,width:"100%",title:t.unref(u)(Q)?t.unref(o).t("em.attr.derivedIdNote"):void 0,placeholder:t.unref(h)(Q),"model-value":t.unref(m)(Q),"onUpdate:modelValue":ke=>t.unref(f)(Q,ke)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-type-${Q.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Q.attrType.startsWith("EMBED")||!!Q.groupCode||Q.attrType==="RELATION_REF"||t.unref(p)(Q),items:t.unref(rc)(Q.type,t.unref(v)),"value-provider":t.unref(w),"label-provider":t.unref(A),"model-value":Q.type,"onUpdate:modelValue":ke=>t.unref($)(Q,ke)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(y)(Q)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ke=>t.unref(o).removeAttribute(t.unref(i).modelId,Q.modelId)},null,8,["onClick"])],8,c2)]),Q.type===t.unref(an)&&!t.unref(p)(Q)?(t.openBlock(),t.createElementBlock("div",d2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-customtype-${Q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Q.customType??"","onUpdate:modelValue":ke=>t.unref(L)(Q,ke)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),Q.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",u2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(_e)(Q)?(t.openBlock(),t.createElementBlock("div",N2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.dbAttrs,(ke,lt)=>{var En,Nn,D,R,P,te,Ee,ie;return t.openBlock(),t.createElementBlock("div",{key:ke.modelId,class:"em-embed-col"},[t.createElementVNode("span",w2,t.toDisplayString(((En=t.unref(le)(Q,lt))==null?void 0:En.name)??((Nn=t.unref(le)(Q,lt))==null?void 0:Nn.physicalName)??t.unref(o).t("em.attr.colFallback",{n:lt+1})),1),t.createElementVNode("div",I2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`embed-col-${ke.modelId}`,width:"100%",disabled:t.unref(Ve)(ke),placeholder:((D=t.unref(le)(Q,lt))==null?void 0:D.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Ve)(ke)?t.unref(Le)(ke):ke.physicalName,"onUpdate:modelValue":re=>t.unref(Re)(Q,lt,{physicalName:re})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSTextInput),{name:`embed-dtype-${ke.modelId}`,width:"84px",disabled:"","model-value":t.unref(ae)(Q,lt)},null,8,["name","model-value"])],8,v2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-len-${ke.modelId}`,width:"48px",disabled:"","model-value":t.unref(se)(Q,lt)},null,8,["name","model-value"])],8,C2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-scale-${ke.modelId}`,width:"48px",disabled:"","model-value":t.unref(ue)(Q,lt)},null,8,["name","model-value"])],8,x2)]),t.createVNode(ao,{controller:t.unref(o),"ref-id":ke.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",S2,[t.createVNode(mn,{class:"grow",name:`embed-logical-${ke.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((P=(R=t.unref(le)(Q,lt))==null?void 0:R.logicalName)==null?void 0:P[t.unref(o).userLanguage.value])??((Ee=(te=t.unref(le)(Q,lt))==null?void 0:te.logicalName)==null?void 0:Ee.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ke.logicalName,"onUpdate:modelValue":re=>t.unref(ce)(Q,lt,re)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(ie=t.unref(le)(Q,lt))!=null&&ie.shareable?(t.openBlock(),t.createElementBlock("label",R2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"110px","model-value":t.unref(xe)(ke),items:t.unref(q)(),"value-provider":t.unref(c),"label-provider":t.unref(Y),"onUpdate:modelValue":re=>re&&t.unref(Be)(Q,lt,re)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(Ve)(ke)?(t.openBlock(),t.createElementBlock("p",A2,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",$2,[Ge[3]||(Ge[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(Ve)(ke),"model-value":t.unref(Ve)(ke)?"false":t.unref(Se)(ke),items:t.unref(Ne),"value-provider":t.unref(c),"label-provider":t.unref(me),"onUpdate:modelValue":re=>re&&t.unref(ve)(Q,lt,re)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",T2,[Ge[4]||(Ge[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(Ve)(ke),"model-value":t.unref(Ve)(ke)?"false":t.unref(H)(ke),items:t.unref(U),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":re=>re&&t.unref(Z)(Q,lt,re)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.unref(p)(Q)?(t.openBlock(),t.createElementBlock("p",m2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",f2,[t.createVNode(mn,{class:"grow",name:`attr-logical-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(kt=Q.dbAttrs[0])==null?void 0:kt.logicalName,"onUpdate:modelValue":ke=>t.unref(M)(Q,ke)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",p2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-col-${Q.modelId}`,width:"100%",placeholder:t.unref(b)(Q)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(N)(Q),"model-value":((_n=Q.dbAttrs[0])==null?void 0:_n.physicalName)??"","onUpdate:modelValue":ke=>t.unref(T)(Q,{physicalName:ke})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-dtype-${Q.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(N)(Q)||t.unref(p)(Q),items:t.unref(oc)(((kn=Q.dbAttrs[0])==null?void 0:kn.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Ar),"model-value":((St=Q.dbAttrs[0])==null?void 0:St.dataType)??"","onUpdate:modelValue":ke=>ke&&t.unref(T)(Q,{dataType:ke})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-len-${Q.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(N)(Q)||t.unref(p)(Q),"model-value":(ge=Q.dbAttrs[0])==null?void 0:ge.length,"onUpdate:modelValue":ke=>t.unref(T)(Q,{length:ke||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(C)(Q)},[t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-scale-${Q.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(N)(Q)||t.unref(p)(Q)||!t.unref(S)(Q),"model-value":(at=Q.dbAttrs[0])==null?void 0:at.scale,"onUpdate:modelValue":ke=>t.unref(T)(Q,{scale:ke||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,h2)]),t.createVNode(ao,{controller:t.unref(o),"ref-id":(en=Q.dbAttrs[0])==null?void 0:en.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",y2,[t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-pk-${Q.modelId}`,label:"Primary Key","model-value":Q.identifier,disabled:t.unref(a)||t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(_)(Q,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nn-${Q.modelId}`,label:"Not Null","model-value":Q.notNull,disabled:t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(d)(Q,{notNull:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-uq-${Q.modelId}`,label:"Unique","model-value":!!((zt=Q.dbAttrs[0])!=null&&zt.unique),disabled:t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(T)(Q,{unique:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-ai-${Q.modelId}`,label:"Auto Increment","model-value":!!((tn=Q.dbAttrs[0])!=null&&tn.autoIncrement),disabled:t.unref(N)(Q)||t.unref(p)(Q)||!Q.identifier,"onUpdate:modelValue":ke=>t.unref(T)(Q,{autoIncrement:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-tr-${Q.modelId}`,label:"@Transient","model-value":!!Q.transient,disabled:Q.identifier||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(E)(Q,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nid-${Q.modelId}`,label:"@NaturalId","model-value":!!Q.naturalId,disabled:Q.identifier||t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(k)(Q,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Q.modelId}`,label:"mutable","model-value":!!Q.naturalIdMutable,disabled:t.unref(N)(Q)||!Q.naturalId,"onUpdate:modelValue":ke=>t.unref(d)(Q,{naturalIdMutable:ke||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-mv-${Q.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ft=Q.dbAttrs[0])!=null&&Ft.multiValue),disabled:t.unref(N)(Q)||t.unref(p)(Q),"onUpdate:modelValue":ke=>t.unref(T)(Q,{multiValue:ke||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",g2,[Ge[1]||(Ge[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(N)(Q),"model-value":t.unref(Se)(Q.dbAttrs[0]),items:t.unref(Ne),"value-provider":t.unref(c),"label-provider":t.unref(me),"onUpdate:modelValue":ke=>ke&&t.unref(G)(Q,ke)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",b2,[Ge[2]||(Ge[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(N)(Q),"model-value":t.unref(H)(Q.dbAttrs[0]),items:t.unref(U),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":ke=>ke&&t.unref(X)(Q,ke)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(p)(Q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",_2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":t.unref(g)(Q),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":ke=>ke&&t.unref(I)(Q,ke)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(z).length&&!t.unref(p)(Q)?(t.openBlock(),t.createElementBlock("label",k2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Rf,{"model-value":Q.groupCode,items:t.unref(z),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ke=>t.unref(he)(Q,ke)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(p)(Q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(z).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(j)(Q).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"100%","model-value":Q.defaultValue??"none",items:t.unref(ne)(Q),"value-provider":t.unref(de),"label-provider":t.unref(pe),"onUpdate:modelValue":ke=>ke&&t.unref(fe)(Q,ke)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`attr-default-${Q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Q.defaultValue??"","onUpdate:modelValue":ke=>t.unref(ye)(Q,ke)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",E2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`attr-desc-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Q.description,"onUpdate:modelValue":ke=>t.unref(B)(Q,ke)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",M2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ze(Q)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:ke=>J(Q,null)},"∅",10,V2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),ke=>(t.openBlock(),t.createElementBlock("button",{key:ke,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ze(Q)===ke}]),style:t.normalizeStyle({background:t.unref(Oo)(ke)}),title:t.unref(o).t(t.unref(io)(ke)),onClick:lt=>J(Q,ke)},null,14,B2))),128)),Ie(Q)?(t.openBlock(),t.createElementBlock("span",D2,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,l2)}),128))],8,ZM)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-6cf88fea"]]),L2=["disabled"],P2={class:"em-panel__sub-label"},z2={class:"em-attr__row"},F2={class:"em-field em-idx-params"},U2=["value","placeholder","onChange"],H2=We(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(w=>w.modelId===o.entityId)??null),l=t.computed(()=>r.value?Go(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var w;return On(((w=r.value)==null?void 0:w.attributes)??[])}),c=w=>s.value.canon(w),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>{var w;return[...(((w=r.value)==null?void 0:w.attributes)??[]).filter(A=>A.dbAttrs.length>0).map(A=>({value:A.modelId,label:Tf(A,d.value)})),...l.value.map(A=>({value:A.modelId,label:a.t("em.index.inherited",{field:A.field})}))]});function m(w,A){var S;const $=new Set(w.columns.filter((C,M)=>M!==A).map(C=>c(C.columnRef))),L=u.value.filter(C=>!$.has(c(C.value))),T=(S=w.columns[A])==null?void 0:S.columnRef;return T&&!L.some(C=>C.value===T)&&L.push({value:T,label:h(T)}),L}function h(w){return Mf(w,d.value)}function f(w){const A=new Set(w.columns.map($=>c($.columnRef)));return u.value.filter($=>!A.has(c($.value)))}function y(){var A;if(!r.value)return;const w=u.value[0];a.addIndex(r.value.modelId,{modelId:De(),name:`idx_${(((A=r.value.indexes)==null?void 0:A.length)??0)+1}`,unique:!1,columns:w?[{columnRef:w.value,descending:!1}]:[]})}function k(w,A){r.value&&a.updateIndex(r.value.modelId,w,A)}function _(w){const A=f(w)[0];A&&k(w.modelId,{columns:[...w.columns,{columnRef:A.value,descending:!1}]})}function E(w,A,$){k(w.modelId,{columns:w.columns.map((L,T)=>T===A?{...L,columnRef:$}:L)})}function N(w,A,$){k(w.modelId,{columns:w.columns.map((L,T)=>T===A?{...L,descending:$}:L)})}function p(w,A){k(w.modelId,{columns:w.columns.filter(($,L)=>L!==A)})}function b(w,A){k(w.modelId,{parameters:A.trim()===""?void 0:A})}return(w,A)=>{var $;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:A[0]||(A[0]=L=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",P2,[e.collapsible?(t.openBlock(),t.createBlock($e,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:(($=r.value.indexes)==null?void 0:$.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(y,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],L=>(t.openBlock(),t.createElementBlock("div",{key:L.modelId,class:"em-attr"},[t.createElementVNode("div",z2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`idx-name-${L.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":L.name,"onUpdate:modelValue":T=>k(L.modelId,{name:T})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-uq-${L.modelId}`,class:"em-check",label:"UQ","model-value":L.unique,"onUpdate:modelValue":T=>k(L.modelId,{unique:T})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:T=>t.unref(a).removeIndex(r.value.modelId,L.modelId)},null,8,["onClick"])]),t.createVNode(ao,{controller:t.unref(a),"ref-id":L.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(L.columns,(T,S)=>(t.openBlock(),t.createElementBlock("div",{key:S,class:"em-attr__row"},[t.createVNode(t.unref(ee.BSSelect),{class:"grow","model-value":T.columnRef,items:m(L,S),"value-provider":C=>C.value,"label-provider":C=>C.label,"onUpdate:modelValue":C=>C&&E(L,S,C)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-${L.modelId}-desc-${S}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":C=>N(L,S,C)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:"−",onClick:C=>p(L,S)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(L).length,onClick:T=>_(L)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",F2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:L.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:T=>b(L,T.target.value)},null,40,U2)])]))),128)):t.createCommentVNode("",!0)],8,L2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),j2=["disabled"],K2={class:"em-panel__sub-label"},G2={class:"em-attr__row"},Y2={class:"em-attr__row"},q2={class:"em-multilang"},W2={class:"em-attr__pii"},J2={class:"em-swatch__row em-attr__swatch"},X2=["title","onClick"],Z2=["title","onClick"],Q2=We(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=ee.useModal(),l=t.computed(()=>a.state.logical.entities.find(p=>p.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(p=>p.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(p){return p==="none"?a.t("em.common.noneParen"):p}const m=p=>p;function h(p,b){l.value&&a.updateOperation(l.value.modelId,p.modelId,b)}function f(p,b){h(p,{description:Object.keys(b).length?b:void 0})}function y(p){return p.personalInfoAttributeType??"none"}function k(p,b){h(p,{personalInfoAttributeType:b==="none"?void 0:b})}function _(p){var b,w;return bt((w=(b=s.value)==null?void 0:b.operationStyles)==null?void 0:w[p.modelId])}function E(p,b){l.value&&a.setOperationSwatch(l.value.modelId,p.modelId,b)}function N(p){r.openModal({component:Vf,bind:{operationName:p.name,sourceCode:p.sourceCode??"",locale:a.uiLocale.value,onSave:b=>h(p,{sourceCode:b})}})}return(p,b)=>{var w;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:b[1]||(b[1]=A=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",K2,[e.collapsible?(t.openBlock(),t.createBlock($e,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((w=l.value.operations)==null?void 0:w.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:b[0]||(b[0]=t.withModifiers(A=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],A=>(t.openBlock(),t.createElementBlock("div",{key:A.modelId,class:"em-attr"},[t.createElementVNode("div",G2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":$=>h(A,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":$=>$&&h(A,{visibility:$})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>t.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),t.createElementVNode("div",Y2,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:$=>N(A)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",q2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`op-desc-${A.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":$=>f(A,$)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",W2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":y(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":$=>$&&k(A,$)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",J2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(A)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:$=>E(A,null)},"∅",10,X2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":_(A)===$}]),style:t.normalizeStyle({background:t.unref(Oo)($)}),title:t.unref(a).t(t.unref(io)($)),onClick:L=>E(A,$)},null,14,Z2))),128))])]))),128)):t.createCommentVNode("",!0)],8,j2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),eV=["title"],tV={class:"em-panel__head"},nV={class:"em-panel__head-row"},oV=["title"],iV={class:"em-panel__context"},aV={key:0,class:"em-panel__lock"},rV=["disabled"],lV={key:0,class:"em-panel__note"},sV={key:1,class:"em-panel__note"},cV={key:2,class:"em-jpa"},dV={class:"em-field"},uV={class:"em-field"},mV={class:"em-field"},fV={key:0,class:"em-field"},pV={class:"em-panel__note"},hV={class:"em-panel__sub"},yV={class:"em-field"},gV={class:"em-field"},bV={class:"em-jpa"},_V={key:0,class:"em-panel__note"},kV={key:1,class:"em-panel__note"},EV={class:"em-jpa"},NV={class:"em-field"},wV={key:0,class:"em-panel__note"},IV={class:"em-field"},vV={class:"em-multilang"},CV={class:"em-field"},xV=["value"],SV={class:"em-field"},RV={class:"em-swatch"},AV={class:"em-swatch__row"},$V=["title"],TV=["title","onClick"],MV={class:"em-panel__note"},VV={class:"em-field"},BV=["value"],DV={class:"em-swatch"},OV={class:"em-swatch__row"},LV=["title"],PV=["title","onClick"],wh=We(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var G;return(G=r.value)==null?void 0:G.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const G=c.value;return G?l.state.logical.entities.find(q=>q.modelId===G)??null:null}),u=t.computed(()=>{const G=s.value;if((G==null?void 0:G.kind)==="association")return l.isAssociationLocked(G.id);const q=c.value;return!!q&&l.isEntityLocked(q)}),m=t.computed(()=>{var G;return((G=l.selectedAttr.value)==null?void 0:G.attrId)??null}),h=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),y=t.ref({});t.watch(f,()=>{y.value={}});function k(G){return y.value[G]??f.value}function _(G){y.value={...y.value,[G]:!k(G)}}const E=t.computed(()=>{var Y;const G=d.value;if(!G)return l.t("em.entity.fallback");const q=(Y=G.table)==null?void 0:Y.physicalName;return q?`${G.name} (${q})`:G.name}),N=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="association"?l.state.logical.associations.find(q=>q.modelId===G.id)??null:null}),p=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="group"?l.state.logical.groups.find(q=>q.modelId===G.id)??null:null}),b=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="note"?l.state.layout.notes.find(q=>q.modelId===G.id)??null:null}),w=t.computed(()=>{var q,Y;const G=(q=p.value)==null?void 0:q.name;return(G==null?void 0:G[l.userLanguage.value])||(G==null?void 0:G.ko)||(G==null?void 0:G.en)||(G==null?void 0:G.ja)||(G==null?void 0:G.zh)||((Y=p.value)==null?void 0:Y.packageName)||l.t("em.group.fallback")}),A=t.computed(()=>{if(d.value){const G=h.value.size;if(G>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:G});if(m.value){const q=d.value.attributes.find(Y=>Y.modelId===m.value);return(q==null?void 0:q.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(q==null?void 0:q.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(N.value){const G=q=>{var Y;return((Y=l.state.logical.entities.find(xe=>xe.modelId===q))==null?void 0:Y.name)??q};return l.t("em.inspector.ctxAssoc",{a:G(N.value.end1.entityRef),b:G(N.value.end2.entityRef)})}return p.value?l.t("em.inspector.ctxGroup",{name:w.value}):b.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),$=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],L=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],T={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},S=G=>{const q=T[G];return q?l.t(q):G},C=G=>{var q;return((q=l.state.logical.entities.find(Y=>Y.modelId===G))==null?void 0:q.name)??G},M=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],B=["LIST","SET"],g=["inherit","LAZY","EAGER"],I=G=>G;function v(G){return G==="inherit"?l.t("em.common.inherit"):G}const O=t.computed(()=>!!N.value&&N.value.end1.entityRef===N.value.end2.entityRef);function x(G,q){N.value&&l.updateAssociationEnd(N.value.modelId,G,q)}function z(G){return ae.value?G:G==="end1"?"end2":"end1"}function j(G){var Be;const q=(Be=N.value)==null?void 0:Be[G];if(!(q!=null&&q.attributeRef))return;const Y=l.state.logical.entities.find(Ve=>Ve.modelId===q.entityRef),xe=Y==null?void 0:Y.attributes.find(Ve=>Ve.modelId===q.attributeRef);return xe&&(xe.attrType==="RELATION_OWN"||xe.attrType==="RELATION_REF")?xe.name:void 0}function ne(G,q){var xe;const Y=(xe=N.value)==null?void 0:xe[G];Y!=null&&Y.attributeRef&&l.updateAttribute(Y.entityRef,Y.attributeRef,{name:q})}function de(G){var Ve;const q=j(G);if(q!==void 0)return q;const Y=(Ve=N.value)==null?void 0:Ve[G];if(Y!=null&&Y.navFieldNameHint)return Y.navFieldNameHint;const xe=G==="end1"?"end2":"end1",Be=l.state.logical.entities.find(Le=>{var oe;return Le.modelId===((oe=N.value)==null?void 0:oe[xe].entityRef)});return Be?Yi(Be.name,Ki(N.value[xe].multiplicity)):""}function pe(G){return!!ae.value||j(G)!==void 0}function he(G){N.value&&!O.value&&l.setAssociationIdentifying(N.value.modelId,G)}function fe(G){var q,Y,xe;return!!((xe=(Y=(q=N.value)==null?void 0:q[G].jpa)==null?void 0:Y.cascadeTypes)!=null&&xe.includes("ALL"))}function ye(G,q,Y){var Ve,Le;const xe=(Ve=N.value)==null?void 0:Ve[G];if(q==="ALL"&&Y){x(G,{jpa:{...xe==null?void 0:xe.jpa,cascadeTypes:["ALL"]}});return}const Be=new Set(((Le=xe==null?void 0:xe.jpa)==null?void 0:Le.cascadeTypes)??[]);Y?Be.add(q):Be.delete(q),x(G,{jpa:{...xe==null?void 0:xe.jpa,cascadeTypes:[...Be]}})}function _e(G,q){var xe;const Y=(xe=N.value)==null?void 0:xe[G];x(G,{jpa:{...Y==null?void 0:Y.jpa,...q}})}function Re(G){var q,Y;return((Y=(q=N.value)==null?void 0:q[G].jpa)==null?void 0:Y.fetchType)??"inherit"}function ce(G,q){_e(G,{fetchType:q==="inherit"?void 0:q})}function le(G){var Y;const q=(Y=N.value)==null?void 0:Y[G==="end1"?"end2":"end1"];return(q==null?void 0:q.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(q==null?void 0:q.multiplicity)==="ONE_OR_MORE_INSTANCES"}const ae=t.computed(()=>{const G=N.value;if(!G)return null;for(const q of l.state.logical.entities){const Y=q.attributes.find(Le=>{var oe;return((oe=Le.embedded)==null?void 0:oe.associationRef)===G.modelId&&Le.attrType==="EMBED_OWN"});if(!Y)continue;const xe=G.end2.entityRef===Y.embedded.embeddableRef?"end2":"end1",Be=G[xe].multiplicity,Ve=G[xe].jpa;return{which:xe,cardinality:Be,isCollection:Be==="ZERO_OR_MORE_INSTANCES"||Be==="ONE_OR_MORE_INSTANCES",collectionType:(Ve==null?void 0:Ve.collectionType)??"LIST",collectionTable:(Ve==null?void 0:Ve.collectionTable)??"",orderColumn:(Ve==null?void 0:Ve.orderColumn)??""}}return null});function se(G){N.value&&l.setEmbedCardinality(N.value.modelId,G)}function ue(G){const q=ae.value;q&&_e(q.which,G==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function U(G){const q=ae.value;q&&_e(q.which,{collectionTable:G.trim()||void 0})}function F(G){const q=ae.value;q&&_e(q.which,{orderColumn:G.trim()||void 0})}function H(G){p.value&&l.updateGroup(p.value.modelId,G)}function Z(G,q){var Y;H({name:{...(Y=p.value)==null?void 0:Y.name,[G]:q}})}const X=t.computed(()=>{var G;return p.value?bt((G=l.state.layout.groupLayouts.find(q=>q.groupRef===p.value.modelId))==null?void 0:G.style):null});function Ne(G){p.value&&l.setGroupSwatch(p.value.modelId,G)}function me(G){b.value&&l.setNoteMemo(b.value.modelId,G)}const Se=t.computed(()=>{var G;return bt((G=b.value)==null?void 0:G.style)});function ve(G){b.value&&l.setNoteSwatch(b.value.modelId,G)}return(G,q)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:q[0]||(q[0]=(...Y)=>e.startResize&&e.startResize(...Y))},null,42,eV),t.createElementVNode("header",tV,[t.createElementVNode("div",nV,[q[14]||(q[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:q[1]||(q[1]=Y=>a("collapse"))},[t.createVNode($e,{name:"panel-right-close",size:16})],8,oV)]),t.createElementVNode("p",iV,t.toDisplayString(A.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",aV,[t.createVNode($e,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:q[2]||(q[2]=Y=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(Nf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:k("basics"),title:E.value,onToggle:q[3]||(q[3]=Y=>_("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(O2,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(H2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:k("index"),onToggle:q[4]||(q[4]=Y=>_("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(Q2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:k("ops"),onToggle:q[5]||(q[5]=Y=>_("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!N.value.identifying,disabled:O.value||!!ae.value,"onUpdate:modelValue":he},null,8,["label","model-value","disabled"]),O.value?(t.openBlock(),t.createElementBlock("p",lV,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):ae.value?(t.openBlock(),t.createElementBlock("p",sV,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),ae.value?(t.openBlock(),t.createElementBlock("fieldset",cV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",dV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":ae.value.cardinality,items:L,"value-provider":I,"label-provider":S,"onUpdate:modelValue":q[6]||(q[6]=Y=>Y&&se(Y))},null,8,["model-value"])]),ae.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",uV,[q[15]||(q[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(ee.BSSelect),{"model-value":ae.value.collectionType,items:B,"value-provider":I,"label-provider":I,"onUpdate:modelValue":q[7]||(q[7]=Y=>Y&&ue(Y))},null,8,["model-value"])]),t.createElementVNode("label",mV,[q[16]||(q[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":ae.value.collectionTable,"onUpdate:modelValue":U},null,8,["placeholder","model-value"])]),ae.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",fV,[q[17]||(q[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":ae.value.orderColumn,"onUpdate:modelValue":F},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",pV,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],Y=>{var xe,Be,Ve;return t.withDirectives(t.createElementVNode("div",{key:Y,class:"em-end"},[t.createElementVNode("h4",hV,t.toDisplayString(Y)+" → "+t.toDisplayString(C(N.value[Y].entityRef)),1),ae.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",yV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":N.value[Y].multiplicity,items:$,"value-provider":I,"label-provider":t.unref(Gi),"onUpdate:modelValue":Le=>x(Y,{multiplicity:Le})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(Y)}-navigable`,class:"em-check",label:"navigable",title:z(Y)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:z(Y)==="end2","model-value":z(Y)==="end2"?!0:N.value[z(Y)].navigable,"onUpdate:modelValue":Le=>x(z(Y),{navigable:Le})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",gV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(ee.BSTextInput),{name:`${z(Y)}-navname`,width:"100%",disabled:!pe(z(Y)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":de(z(Y)),"onUpdate:modelValue":Le=>ne(z(Y),Le)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(Y)}-composition`,class:"em-check",label:"composition","model-value":N.value[z(Y)].composition,"onUpdate:modelValue":Le=>x(z(Y),{composition:Le})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",bV,[q[18]||(q[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(M,Le=>{var oe,we;return t.createVNode(t.unref(ee.BSCheckbox),{key:Le,name:`${z(Y)}-cascade-${Le}`,class:"em-check",label:Le,"model-value":!!((we=(oe=N.value[z(Y)].jpa)==null?void 0:oe.cascadeTypes)!=null&&we.includes(Le)),disabled:!pe(z(Y))||Le!=="ALL"&&fe(z(Y)),"onUpdate:modelValue":Fe=>ye(z(Y),Le,Fe)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),pe(z(Y))?fe(z(Y))?(t.openBlock(),t.createElementBlock("p",kV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",_V,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",EV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",NV,[q[19]||(q[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(ee.BSSelect),{disabled:!pe(z(Y)),"model-value":Re(z(Y)),items:g,"value-provider":I,"label-provider":v,"onUpdate:modelValue":Le=>Le&&ce(z(Y),Le)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(Y)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((xe=N.value[z(Y)].jpa)!=null&&xe.orphanRemoval),disabled:!pe(z(Y))||le(Y),"onUpdate:modelValue":Le=>_e(z(Y),{orphanRemoval:Le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),le(Y)&&((Be=N.value[z(Y)].jpa)!=null&&Be.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",wV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",IV,[q[20]||(q[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:`${z(Y)}-orderby`,width:"100%",disabled:!pe(z(Y)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((Ve=N.value[z(Y)].jpa)==null?void 0:Ve.orderBy)??"","onUpdate:modelValue":Le=>_e(z(Y),{orderBy:Le.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!ae.value||Y===ae.value.which]])}),64))],64)):t.createCommentVNode("",!0),p.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",vV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,Y=>{var xe;return t.openBlock(),t.createElementBlock("label",{key:Y,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(Y),1),t.createVNode(t.unref(ee.BSTextInput),{name:`grp-name-${Y}`,width:"100%","model-value":((xe=p.value.name)==null?void 0:xe[Y])??"","onUpdate:modelValue":Be=>Z(Y,Be)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",CV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:p.value.description??"",rows:"3",onChange:q[8]||(q[8]=Y=>H({description:Y.target.value}))},null,40,xV)]),t.createElementVNode("label",SV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"grp-package",width:"100%","model-value":p.value.packageName??"","onUpdate:modelValue":q[9]||(q[9]=Y=>H({packageName:Y}))},null,8,["model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":p.value.excludeDDLGeneration,"onUpdate:modelValue":q[10]||(q[10]=Y=>H({excludeDDLGeneration:Y}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",RV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",AV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":X.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:q[11]||(q[11]=Y=>Ne(null))},"∅",10,$V),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),Y=>(t.openBlock(),t.createElementBlock("button",{key:Y,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":X.value===Y}]),style:t.normalizeStyle({background:t.unref(Oo)(Y)}),title:t.unref(l).t(t.unref(io)(Y)),onClick:xe=>Ne(Y)},null,14,TV))),128))])]),t.createElementVNode("p",MV,t.toDisplayString(t.unref(l).t("em.group.members",{n:p.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",VV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:b.value.memo,rows:"6",onChange:q[12]||(q[12]=Y=>me(Y.target.value))},null,40,BV)]),t.createElementVNode("fieldset",DV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",OV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Se.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:q[13]||(q[13]=Y=>ve(null))},"∅",10,LV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(oo),Y=>(t.openBlock(),t.createElementBlock("button",{key:Y,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Se.value===Y}]),style:t.normalizeStyle({background:t.unref(Oo)(Y)}),title:t.unref(l).t(t.unref(io)(Y)),onClick:xe=>ve(Y)},null,14,PV))),128))])])],64)):t.createCommentVNode("",!0)],8,rV)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),zV=["title"],FV={class:"em-validation__title"},UV=["title","onClick"],HV={key:0,class:"em-validation__body"},jV={class:"em-validation__opt"},KV={key:0,class:"em-validation__empty"},GV={key:1,class:"em-validation__empty"},YV={key:2,class:"em-validation__list"},qV=["onClick"],WV={class:"em-validation__item-msg"},JV={key:0,class:"em-validation__item-entity"},XV=["title","onClick"],ZV=["title"],QV=We(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const k=new Map;for(const _ of o.state.logical.entities)k.set(_.modelId,_.name);return k});function r(k){const _=Bw(k);if(!_)return null;const E=a.value.get(_);return E===void 0?null:E.trim()===""?o.t("em.validation.nameless"):E}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const k={error:0,warning:0,info:0};for(const _ of i.value)k[_.severity]++;return k}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(k=>c.value[k.severity]).slice().sort((k,_)=>l[k.severity].order-l[_.severity].order)),u=t.computed(()=>d.value.map(k=>({issue:k,entityName:r(k),message:Ef(o.t,k),category:Mw(o.t,k.ruleId)}))),m=t.ref(!1);function h(k){c.value[k]=!c.value[k]}function f(k){if(!m.value){m.value=!0;return}h(k)}function y(k){k.targetRef&&o.requestFocus(k.targetRef)}return(k,_)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:_[1]||(_[1]=E=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode($e,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",FV,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,zV),t.createElementVNode("div",{class:"em-validation__counts",onClick:_[0]||(_[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],E=>t.createElementVNode("button",{key:E,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${E}`,{"is-off":!c.value[E]}]]),title:m.value?t.unref(o).t(c.value[E]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[E].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:N=>f(E)},[t.createVNode($e,{name:l[E].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[E]),1)],10,UV)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",HV,[t.createElementVNode("label",jV,[t.createVNode(t.unref(ee.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":_[2]||(_[2]=E=>t.unref(o).flagEntitiesWithoutRelations.value=E)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",KV,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",GV,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",YV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:E,entityName:N,message:p,category:b},w)=>(t.openBlock(),t.createElementBlock("li",{key:`${E.ruleId}:${E.targetRef??"model"}:${w}`,class:t.normalizeClass(["em-validation__item",[`is-${E.severity}`,{"is-clickable":!!E.targetRef}]]),onClick:A=>y(E)},[t.createVNode($e,{name:l[E.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",WV,[N?(t.openBlock(),t.createElementBlock("span",JV,t.toDisplayString(N),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(p),1)]),t.unref(o).hasQuickFix(E)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers(A=>t.unref(o).applyQuickFix(E),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,XV)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:E.ruleId},t.toDisplayString(b),9,ZV)],10,qV))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),eB={class:"em-history"},tB={class:"em-history__head"},nB={class:"em-history__title"},oB={class:"em-history__head-actions"},iB=["title","disabled"],aB=["title"],rB={class:"em-history__filters"},lB={class:"em-history__filter"},sB={class:"em-history__filters em-history__filters--period"},cB={class:"em-history__filter-label"},dB=["title","aria-label","max"],uB=["title","aria-label","min"],mB=["title"],fB={key:0,class:"em-history__diffbar"},pB={class:"em-history__diffbar-range"},hB={class:"em-history__diffbar-count"},yB={class:"em-history__body"},gB={key:0,class:"em-history__empty"},bB={key:1,class:"em-history__diff-list"},_B=["onClick"],kB={class:"em-history__action-head"},EB={class:"em-history__action-name"},NB={key:0,class:"em-history__fields"},wB={class:"em-history__fname"},IB={key:0,class:"em-history__old"},vB={class:"em-history__val"},CB={key:1,class:"em-history__empty"},xB={key:2,class:"em-history__empty is-error"},SB={key:3,class:"em-history__empty"},RB={key:4,class:"em-history__list"},AB=["onClick"],$B={class:"em-history__summary"},TB={class:"em-history__seq"},MB={class:"em-history__gmeta"},VB={class:"em-history__who"},BB={key:0,class:"em-history__time"},DB={key:1,class:"em-history__restored-from"},OB=["onClick"],LB={key:0,class:"em-history__detail"},PB={class:"em-history__action-head"},zB={class:"em-history__action-name"},FB={key:0,class:"em-history__fields"},UB={class:"em-history__fname"},HB={key:0,class:"em-history__old"},jB={class:"em-history__val"},KB={class:"em-history__preview"},GB=["disabled"],YB={key:0,class:"em-history__diff-list is-preview"},qB={class:"em-history__action-head"},WB={class:"em-history__action-name"},JB={key:0,class:"em-history__fields"},XB={class:"em-history__fname"},ZB={key:0,class:"em-history__old"},QB={class:"em-history__val"},eD={class:"em-history__confirm-row"},tD={class:"em-history__confirm-msg"},nD=["disabled","onClick"],oD=["disabled"],iD=["onClick"],Er=50,aD=We(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((oe,we)=>we.seq>oe?we.seq:oe,-1/0));async function u(oe){if(a.historyTransport){l.value=!0,s.value=null;try{const we=!(oe!=null&&oe.full)&&r.value.length>0&&Number.isFinite(d.value),Fe=await a.historyTransport(we?d.value:void 0);if(!we)r.value=Fe;else if(Fe.length){const K=new Set(r.value.map(W=>W.seq)),V=Fe.filter(W=>!K.has(W.seq));V.length&&(r.value=[...r.value,...V])}c.value=!0}catch(we){s.value=we instanceof Error?we.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const h=t.ref(null),f=t.ref(null);t.watch(()=>o.open,oe=>{oe?m():(h.value=null,f.value=null)},{immediate:!0});let y=null;t.watch(()=>a.revision.value,()=>{o.open&&(y&&clearTimeout(y),y=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const k=t.computed(()=>new Map(a.state.logical.entities.map(oe=>[oe.modelId,oe]))),_=t.computed(()=>new Map(a.state.logical.associations.map(oe=>[oe.modelId,oe]))),E=t.computed(()=>{const oe=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(we=>{var Fe,K;return[we.modelId,we.packageName||((Fe=we.name)==null?void 0:Fe[oe])||((K=we.name)==null?void 0:K.ko)||we.modelId]}))});function N(oe){var V,W,Ce,ze,Ie,J,He;const we=_.value.get(oe);if(!we)return a.t("em.history.assocFallback");if((V=we.description)!=null&&V.trim())return we.description.trim();const Fe=(ze=(Ce=k.value.get((W=we.end1)==null?void 0:W.entityRef))==null?void 0:Ce.name)==null?void 0:ze.trim(),K=(He=(J=k.value.get((Ie=we.end2)==null?void 0:Ie.entityRef))==null?void 0:J.name)==null?void 0:He.trim();return Fe&&K?`${Fe}→${K}`:a.t("em.history.assocFallback")}function p(oe){var we,Fe,K,V;if(oe.kind==="entity")return((Fe=(we=k.value.get(oe.ref))==null?void 0:we.name)==null?void 0:Fe.trim())||a.t("em.attr.nameless");if(oe.kind==="attribute"||oe.kind==="operation"||oe.kind==="index"){const W=oe.entityRef?k.value.get(oe.entityRef):void 0,ze=((oe.kind==="attribute"?W==null?void 0:W.attributes:oe.kind==="operation"?W==null?void 0:W.operations:W==null?void 0:W.indexes)??[]).find(J=>J.modelId===oe.ref),Ie=(K=W==null?void 0:W.name)==null?void 0:K.trim();return`${Ie?Ie+".":""}${((V=ze==null?void 0:ze.name)==null?void 0:V.trim())||oe.ref}`}return oe.kind==="association"?N(oe.ref):oe.kind==="associationEnd"?`${N(oe.ref)}(${oe.end})`:oe.kind==="group"?a.t("em.history.groupSubject",{name:E.value.get(oe.ref)??oe.ref}):oe.ref}const b={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},w={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},A=t.ref("all"),$=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],L=t.computed({get:()=>A.value,set:oe=>{oe&&(A.value=oe)}}),T=t.computed(()=>il(r.value)),S=t.computed(()=>T.value.length?T.value[0].seq:null),C=t.computed(()=>A.value==="all"?T.value:T.value.filter(oe=>(oe.kind??"edit")===A.value)),M=t.ref(Er),B=t.ref(""),g=t.ref(""),I=t.computed(()=>!!B.value||!!g.value);function v(){B.value="",g.value=""}const O=t.computed(()=>{const oe=B.value?new Date(`${B.value}T00:00:00`).getTime():null,we=g.value?new Date(`${g.value}T23:59:59.999`).getTime():null;return oe==null&&we==null?C.value:C.value.filter(Fe=>{if(Fe.ts==null)return!1;const K=new Date(Fe.ts).getTime();return!(isNaN(K)||oe!=null&&K<oe||we!=null&&K>we)})}),x=t.computed(()=>O.value.slice(0,M.value)),z=t.computed(()=>Math.max(0,O.value.length-M.value));function j(){M.value+=Er}t.watch([A,B,g],()=>{M.value=Er}),t.watch(()=>o.open,oe=>{oe&&(M.value=Er,v())});function ne(oe){return oe===void 0?"—":oe===null?a.t("em.history.emptyValue"):typeof oe=="object"?JSON.stringify(oe):String(oe)}function de(oe){const we=p(oe.subject);if(oe.verb==="add")return a.t("em.history.summaryAdd",{name:we});if(oe.verb==="remove")return a.t("em.history.summaryRemove",{name:we});if(oe.fields.length===1){const Fe=oe.fields[0];return`${we}.${Fe.field} ${Fe.oldValue!==void 0?ne(Fe.oldValue)+"→":""}${ne(Fe.value)}`}return a.t("em.history.summaryFields",{name:we,n:oe.fields.length})}function pe(oe){return oe.actions.length===0?a.t("em.history.noChange"):oe.actions.length===1?de(oe.actions[0]):a.t("em.history.summaryMore",{summary:de(oe.actions[0]),n:oe.actions.length-1})}const he=t.ref(new Set);function fe(oe){const we=new Set(he.value);we.has(oe)?we.delete(oe):we.add(oe),he.value=we}function ye(oe){if(oe==null)return"";const we=new Date(oe);return isNaN(we.getTime())?String(oe):we.toLocaleString()}function _e(oe){const we=oe.author,Fe=oe.origin;return we&&Fe?`${we}(${Fe})`:we||(Fe?`(${Fe})`:"—")}const Re=t.computed(()=>h.value==null?null:al(r.value,{fromSeq:h.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Re.value?Zc(Re.value):null,oe=>i("diffChange",oe));function ce(oe){h.value=oe,f.value=null,q.value=null}function le(){h.value=null,f.value=null}const ae=t.computed(()=>T.value.map(oe=>oe.seq)),se=t.computed(()=>S.value??1/0),ue=t.computed(()=>f.value??se.value),U=t.computed(()=>f.value??se.value),F=t.computed(()=>ae.value.filter(oe=>oe<ue.value).map(oe=>({v:oe}))),H=t.computed(()=>ae.value.filter(oe=>h.value!=null&&oe>h.value).map(oe=>({v:oe})));function Z(oe){oe!=null&&(h.value=oe,f.value!=null&&f.value<=oe&&(f.value=null))}function X(oe){oe!=null&&(f.value=oe>=se.value?null:oe)}function Ne(oe){return oe>=se.value?a.t("em.history.diff.current"):`#${oe}`}function me(oe){return oe.kind==="entity"?k.value.has(oe.ref)?oe.ref:null:(oe.kind==="attribute"||oe.kind==="operation"||oe.kind==="index")&&oe.entityRef?k.value.has(oe.entityRef)?oe.entityRef:null:oe.kind==="group"&&E.value.has(oe.ref)?oe.ref:null}function Se(oe){const we=me(oe);we&&a.requestFocus(we)}const ve={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},G={added:"add",modified:"update",removed:"remove"},q=t.ref(null),Y=t.ref(!1),xe=t.computed(()=>q.value==null?null:al(r.value,{fromSeq:q.value})),Be=t.ref(!1);function Ve(oe){q.value=oe,Be.value=!1}async function Le(oe){Y.value=!0;try{const we=await a.restoreToSeq(oe);we.ok?(h.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:we.reason??a.t("em.history.unknown")})}finally{Y.value=!1,q.value=null}}return(oe,we)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Fe,K;return[t.withDirectives(t.createElementVNode("section",eB,[t.createElementVNode("header",tB,[t.createElementVNode("div",nB,[t.createVNode($e,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",oB,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:we[0]||(we[0]=V=>u({full:!0}))},[t.createVNode($e,{name:"redo",size:15})],8,iB),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:we[1]||(we[1]=V=>i("close"))},[t.createVNode($e,{name:"panel-close",size:15})],8,aB)])]),t.createElementVNode("div",rB,[t.createElementVNode("label",lB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(ee.BSSelect),{modelValue:L.value,"onUpdate:modelValue":we[2]||(we[2]=V=>L.value=V),items:$,"value-provider":V=>V.v,"label-provider":V=>t.unref(a).t(V.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",sB,[t.createElementVNode("span",cB,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:g.value||void 0,"onUpdate:modelValue":we[3]||(we[3]=V=>B.value=V)},null,8,dB),[[t.vModelText,B.value]]),we[9]||(we[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:B.value||void 0,"onUpdate:modelValue":we[4]||(we[4]=V=>g.value=V)},null,8,uB),[[t.vModelText,g.value]]),I.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:v},[t.createVNode($e,{name:"x",size:12})],8,mB)):t.createCommentVNode("",!0)]),h.value!=null?(t.openBlock(),t.createElementBlock("div",fB,[t.createElementVNode("div",pB,[t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":h.value??void 0,items:F.value,"value-provider":V=>V.v,"label-provider":V=>`#${V.v}`,"onUpdate:modelValue":we[5]||(we[5]=V=>Z(V??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode($e,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":U.value,items:H.value,"value-provider":V=>V.v,"label-provider":V=>Ne(V.v),"onUpdate:modelValue":we[6]||(we[6]=V=>X(V??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",hB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Fe=Re.value)==null?void 0:Fe.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:le},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",yB,[h.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(K=Re.value)!=null&&K.entries.length?(t.openBlock(),t.createElementBlock("ul",bB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Re.value.entries,(V,W)=>(t.openBlock(),t.createElementBlock("li",{key:W,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!me(V.subject)}]),onClick:Ce=>Se(V.subject)},[t.createElementVNode("div",kB,[t.createVNode($e,{name:b[V.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",EB,t.toDisplayString(p(V.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${G[V.verb]}`])},t.toDisplayString(t.unref(a).t(ve[V.verb])),3)]),V.fields.length?(t.openBlock(),t.createElementBlock("ul",NB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.fields,(Ce,ze)=>(t.openBlock(),t.createElementBlock("li",{key:ze,class:"em-history__field"},[t.createElementVNode("span",wB,t.toDisplayString(Ce.field),1),Ce.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",IB,t.toDisplayString(ne(Ce.oldValue)),1)):t.createCommentVNode("",!0),Ce.oldValue!==void 0?(t.openBlock(),t.createBlock($e,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",vB,t.toDisplayString(ne(Ce.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,_B))),128))])):(t.openBlock(),t.createElementBlock("p",gB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",CB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",xB,t.toDisplayString(s.value),1)):O.value.length===0?(t.openBlock(),t.createElementBlock("p",SB,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",RB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,V=>{var W,Ce,ze;return t.openBlock(),t.createElementBlock("li",{key:V.seq,class:t.normalizeClass(["em-history__group",[`is-${V.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Ie=>fe(V.seq)},[t.createVNode($e,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":he.value.has(V.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${V.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(V.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",$B,t.toDisplayString(pe(V)),1),t.createElementVNode("span",TB,"#"+t.toDisplayString(V.seq),1)],8,AB),t.createElementVNode("div",MB,[t.createElementVNode("span",VB,t.toDisplayString(_e(V)),1),V.ts?(t.openBlock(),t.createElementBlock("span",BB,t.toDisplayString(ye(V.ts)),1)):t.createCommentVNode("",!0),V.kind==="restore"&&V.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",DB,"← #"+t.toDisplayString(V.restoredFromSeq),1)):t.createCommentVNode("",!0),V.seq!==S.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Ie=>ce(V.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,OB)):t.createCommentVNode("",!0)]),he.value.has(V.seq)?(t.openBlock(),t.createElementBlock("div",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.actions,(Ie,J)=>(t.openBlock(),t.createElementBlock("div",{key:J,class:"em-history__action"},[t.createElementVNode("div",PB,[t.createVNode($e,{name:b[Ie.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",zB,t.toDisplayString(p(Ie.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Ie.verb}`])},t.toDisplayString(t.unref(a).t(w[Ie.verb])),3)]),Ie.fields.length?(t.openBlock(),t.createElementBlock("ul",FB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.fields,(He,ot)=>(t.openBlock(),t.createElementBlock("li",{key:ot,class:"em-history__field"},[t.createElementVNode("span",UB,t.toDisplayString(He.field),1),He.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",HB,t.toDisplayString(ne(He.oldValue)),1)):t.createCommentVNode("",!0),He.oldValue!==void 0?(t.openBlock(),t.createBlock($e,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",jB,t.toDisplayString(ne(He.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&V.seq!==S.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":q.value===V.seq}])},[q.value===V.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",KB,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((W=xe.value)!=null&&W.entries.length),onClick:we[7]||(we[7]=Ie=>Be.value=!Be.value)},[t.createVNode($e,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Be.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Ce=xe.value)!=null&&Ce.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:xe.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,GB),Be.value&&((ze=xe.value)!=null&&ze.entries.length)?(t.openBlock(),t.createElementBlock("ul",YB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(xe.value.entries,(Ie,J)=>(t.openBlock(),t.createElementBlock("li",{key:J,class:"em-history__diff-entry"},[t.createElementVNode("div",qB,[t.createVNode($e,{name:b[Ie.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",WB,t.toDisplayString(p(Ie.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${G[Ie.verb]}`])},t.toDisplayString(t.unref(a).t(ve[Ie.verb])),3)]),Ie.fields.length?(t.openBlock(),t.createElementBlock("ul",JB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.fields,(He,ot)=>(t.openBlock(),t.createElementBlock("li",{key:ot,class:"em-history__field"},[t.createElementVNode("span",XB,t.toDisplayString(He.field),1),He.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",ZB,t.toDisplayString(ne(He.oldValue)),1)):t.createCommentVNode("",!0),He.oldValue!==void 0?(t.openBlock(),t.createBlock($e,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",QB,t.toDisplayString(ne(He.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",eD,[t.createElementVNode("span",tD,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:Y.value,onClick:Ie=>Le(V.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,nD),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:Y.value,onClick:we[8]||(we[8]=Ie=>q.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,oD)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Ie=>Ve(V.seq)},[t.createVNode($e,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,iD))],2)):t.createCommentVNode("",!0)],2)}),128))])),h.value==null&&z.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:j},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:z.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function rD(e,n){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=n?i:null}function Ih(e){const n=t.ref(rD(e.storageKey,e.min)??e.initial),o=t.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=n.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),n.value=m},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const lD={class:"em-modeler"},sD={class:"em-modeler__body"},cD={class:"em-drawer__inner"},dD={class:"em-drawer__head"},uD={class:"em-drawer__actions"},mD=["title"],fD=["title"],pD=["title"],hD=["title"],yD=["title"],gD=We(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(b){t.nextTick(()=>{const w=b();w&&("focusCollapse"in w?w.focusCollapse():w.focus())})}function c(b){n.value=b,s(()=>b?i.value:a.value)}function d(b){o.value=b,s(()=>b?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:h,dragging:f,startResize:y}=Ih({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:k,dragging:_,startResize:E}=Ih({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),N=t.ref(null),p=t.ref(null);return(b,w)=>{var A,$,L;return t.openBlock(),t.createElementBlock("div",lD,[t.createVNode(Nh,{controller:e.controller,"history-open":u.value,onExportSvg:w[0]||(w[0]=T=>{var S;return(S=N.value)==null?void 0:S.exportSvg()}),onExportPng:w[1]||(w[1]=T=>{var S;return(S=N.value)==null?void 0:S.exportPng()}),onToggleHistory:w[2]||(w[2]=T=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",sD,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(h)+"px"})},[t.createElementVNode("div",cD,[t.createElementVNode("header",dD,[w[11]||(w[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",uD,[(A=p.value)!=null&&A.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t(($=p.value)!=null&&$.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:w[3]||(w[3]=T=>{var S;return(S=p.value)==null?void 0:S.toggleAll()})},[t.createVNode($e,{name:(L=p.value)!=null&&L.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,mD)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:w[4]||(w[4]=T=>c(!1))},[t.createVNode($e,{name:"panel-close",size:16})],8,fD)])]),t.createVNode(Eh,{ref_key:"explorer",ref:p,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:w[5]||(w[5]=(...T)=>t.unref(y)&&t.unref(y)(...T))},null,42,pD),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:w[6]||(w[6]=T=>c(!0))},[t.createVNode($e,{name:"panel-open",size:18})],8,hD),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(h)-6+"px"})},[t.createVNode(kh,{ref_key:"canvas",ref:N,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(wh,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(k),resizing:t.unref(_),"start-resize":t.unref(E),onCollapse:w[7]||(w[7]=T=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:w[8]||(w[8]=T=>d(!0))},[t.createVNode($e,{name:"panel-right-open",size:18})],8,yD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(aD,{controller:e.controller,open:u.value,onClose:w[9]||(w[9]=T=>u.value=!1),onDiffChange:w[10]||(w[10]=T=>m.value=T)},null,8,["controller","open"])]),t.createVNode(QV,{controller:e.controller,"panel-width":t.unref(k),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=Ub,be.AssociationEdge=_p,be.CUSTOM_TYPE_VALUE=an,be.CommandStack=rl,be.DEFAULT_JAVA_TYPE=Tr,be.DIAGRAM_JSON_FORMAT=Or,be.DIAGRAM_JSON_VERSION=Lr,be.DiagramCanvas=kh,be.DiagramExplorer=Eh,be.EDITOR=ro,be.EditModeToggle=XM,be.EditorToolbar=Nh,be.EntityModeler=gD,be.EntityNode=Jf,be.GROUP_CODE_ENUM_VALUE=zn,be.GroupNode=Xf,be.INHERITED_REF_PREFIX=Pi,be.InvalidDiagramJsonError=Un,be.JAVA_TYPES=Jo,be.NoteNode=Zf,be.OpSyncAdapter=Hd,be.PHYSICAL_NAME_MAX_LENGTH=Zo,be.PropertyPanel=wh,be.RevCache=Ud,be.SELECTABLE_JAVA_TYPES=ac,be.SYMBOLIC_OP_KINDS=jd,be.SYMBOLIC_OP_SCHEMA=cu,be.UI_LOCALES=cI,be.applyDocumentReferenceOnly=Cr,be.buildAgentBatch=Hb,be.buildDiagramSvg=$s,be.buildDiffMarks=Zc,be.collectSharedColumns=vn,be.commands=Wg,be.computeAutoLayout=Bs,be.createEditorController=zC,be.dedupeModelIds=wg,be.defaultMermaidDialect=Gh,be.defaultSqlDialect=Iy,be.diagramToJson=hc,be.displayLabel=Ui,be.emptyState=Lf,be.entityModelToDdl=fc,be.entityModelToMermaid=xr,be.entityModelToText=qs,be.exportDiagramPng=bh,be.exportDiagramSvg=gh,be.fromPersisted=_u,be.isGeneratable=Ac,be.isInheritedColumnRef=Ln,be.javaTypeLabel=yo,be.makeInheritedColumnRef=Ls,be.mergeDiagram=Gc,be.mermaidErToImportSource=sc,be.migrateLegacyMoney=Ng,be.multiplicityLabel=Gi,be.newId=De,be.packEntityBoxes=Nr,be.parseDiagramJson=yc,be.parseInheritedColumnRef=wr,be.parseMermaidEr=lc,be.parseSqlDdl=Br,be.planHealBackfillOps=w_,be.projectActionLog=il,be.projectEntityAudit=Jc,be.projectFieldAudit=Cn,be.projectInheritedColumns=Go,be.projectSeqDiff=al,be.renderDiagramSvg=bc,be.resolveColumnPhysicalName=qo,be.resolveDiagram=Vs,be.resolveEffectiveColumn=on,be.resolveQuickFix=jr,be.resolveSharedColumn=Pn,be.resolveSymbolicOps=wb,be.restoreDeepEqual=Hn,be.scaffoldEntityJava=Xy,be.sharedColumnScopeEntities=Ir,be.sqlDdlToImportSource=mc,be.stereotypeLabel=Yo,be.synthesizeRestoreOps=Bg,be.toPersisted=k_,be.toPersistedV2=E_,be.translate=Dt,be.uiMessagesEn=vf,be.uiMessagesJa=Cf,be.uiMessagesKo=xf,be.validateModel=Qi,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|