@g1cloud/entity-modeler-next 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entity-modeler.js +39 -38
- package/dist/entity-modeler.umd.cjs +16 -16
- package/dist/index.d.ts +1 -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 dD=Object.defineProperty;var uD=(be,t,ee)=>t in be?dD(be,t,{enumerable:!0,configurable:!0,writable:!0,value:ee}):be[t]=ee;var Xe=(be,t,ee)=>uD(be,typeof t!="symbol"?t+"":t,ee);const xh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Ch(e,n){const o=e%n.perRow,i=Math.floor(e/n.perRow);return{location:{x:n.startX+o*n.columnGap,y:n.startY+i*n.rowGap},size:{...n.defaultSize}}}function Ss(e,n,o={}){const i={...xh,...o},a=new Map(e.entities.map(k=>[k.modelId,k])),r=new Map(n.entityLayouts.map(k=>[k.entityRef,k])),l=new Map(n.associationLayouts.map(k=>[k.associationRef,k])),s=new Map;for(const k of e.groups)for(const N of k.memberEntityRefs)s.set(N,k.modelId);const c=new Map;for(const k of n.groupLayouts)for(const N of k.memberNoteRefs??[])c.set(N,k.groupRef);let d=0;const u=e.entities.map(k=>{const N=s.get(k.modelId),b=r.get(k.modelId);if(b){const E={location:{x:b.geo.location.x,y:b.geo.location.y},size:{width:b.geo.size.width,height:b.geo.size.height}};return{entity:k,geo:E,collapsed:b.collapsed??!1,locked:b.locked??!1,groupRef:N,style:b.style,attributeStyles:b.attributeStyles,operationStyles:b.operationStyles}}const _=Ch(d++,i);return{entity:k,geo:_,collapsed:!1,locked:!1,groupRef:N}}),m=new Map(n.groupLayouts.map(k=>[k.groupRef,k])),p=e.groups.map(k=>{const N=m.get(k.modelId),b=N?{location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:k,geo:b,style:N==null?void 0:N.style,locked:(N==null?void 0:N.locked)??!1}}),f=e.associations.map(k=>{const N=l.get(k.modelId);return{association:k,waypoints:(N==null?void 0:N.waypoints)??[],sourceColumnRef:N==null?void 0:N.sourceColumnRef,targetColumnRef:N==null?void 0:N.targetColumnRef}}),h=n.notes.map(k=>({note:{...k,geo:{location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}}},groupRef:c.get(k.modelId)})),g=[];for(const k of n.notes)for(const N of k.connections??[])a.has(N.targetRef)&&g.push({noteRef:k.modelId,targetRef:N.targetRef,waypoints:N.waypoints.map(b=>({x:b.x,y:b.y}))});return{entities:u,associations:f,groups:p,notes:h,noteConnections:g}}const Sh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Rs(e,n,o={}){const i={...Sh,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),p=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const h=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,k)=>{const N=k%h,b=Math.floor(k/h);r.push({id:g,location:{x:p.x+i.pad+N*i.cellWidth,y:p.y+i.pad+i.headerHeight+b*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const p=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+f*i.cellHeight}})}),r}const As={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Rh(e,n={}){const o={...As,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function kr(e,n={}){const o={...As,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Rh(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Tn(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function $s(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const Di="inherited:";function Ts(e,n){return`${Di}${e}:${n}`}function Mn(e){return e.startsWith(Di)}function Er(e){if(!Mn(e))return null;const n=e.slice(Di.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function jo(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Ts(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}const Ah={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function Ko(e){return Ah[e]??e}function Oi(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Li(e,n,o,i,a=0){var u;if(!Oi(e))return;const r=i.find(m=>m.end1.attributeRef===e.modelId||m.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(m=>m.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(u=e.derivedFrom)==null?void 0:u.sourceAttributeRef;if(c){const m=s==null?void 0:s.attributes.find(p=>p.modelId===c);if(m)return m.dbAttrs[a];for(const p of o){const f=p.attributes.find(h=>h.modelId===c);if(f)return f.dbAttrs[a]}}return s?s.attributes.filter(m=>m.identifier&&(m.attrType==="NORMAL"||m.attrType==="RELATION_OWN")).sort((m,p)=>m.order-p.order).flatMap(m=>m.dbAttrs)[a]:void 0}const Ms=e=>e==null||e.trim()==="";function Vs(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=i.entities.find(u=>u.modelId===d))==null?void 0:c.attributes.flatMap(u=>u.dbAttrs)[n]}if(e.attrType.startsWith("RELATION"))return Li(e,o,i.entities,i.associations,n)}function Vn(e,n,o,i,a,r){const l=Vs(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:$h(n.logicalName)?n.logicalName:l.logicalName}:n}function $h(e){return e!=null&&Object.values(e).some(n=>!Ms(n))}function Go(e,n,o,i,a,r){var l;return Ms(n.physicalName)?((l=Vs(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Bs(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let p=0;p<m.dbAttrs.length;p++){if(u===n)return m.name||void 0;u++}}}function Nr(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function kn(e,n){return Nr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function so(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Bn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function Pi(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const Ds="(미지정)",Th="(이름 없음)",zi=e=>e==null||String(e).trim()==="",Fi=e=>zi(e)?Th:String(e),Os=e=>zi(e)?Ds:String(e);function Ls(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}return Ds}function Ps(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=zi(n)?Os(e.physicalName):String(n),a=zi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function zs(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function Fs(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${Fi(c.name)}${d} «${Ko(c.stereotype)}»${u?` [${u}]`:""}`);const m=so(kn(c,e.entities)),p=k=>{var N;return k.sharedColumnRef?(N=Bn(k,m))==null?void 0:N.physicalName:void 0},f=[...c.attributes].sort((k,N)=>k.order-N.order);for(const k of f){if(k.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${k.name?` ${k.name} ${"─".repeat(8)}`:""}`);continue}const N=k.dbAttrs.map((T,L)=>Vn(k,T,L,c,e,n)),b=[k.identifier?"PK":"",k.notNull?"NOT NULL":""].filter(Boolean),_=` - ${Fi(k.name)}: ${Os(k.type)}`,E=T=>T.length?` {${T.join(", ")}}`:"";if(N.length>1){a.push(`${_}${E(b)}`),N.forEach((T,L)=>{const x=Bs(k,L,e,n);a.push(` · ${x?`${x} → `:""}${Ps(T,p(T))}${E(zs(T))}`)});continue}const I=N[0],A=I?` → ${Ps(I,p(I))}`:"";a.push(`${_}${A}${E([...b,...I?zs(I):[]])}`)}const h=Tn(c.attributes);for(const k of c.indexes??[]){const N=k.columns.map(b=>{var _,E;return`${((_=h.attributeOf(b.columnRef))==null?void 0:_.name)??((E=Er(b.columnRef))==null?void 0:E.field)??b.columnRef}${b.descending?" DESC":""}`}).join(", ");a.push(` index ${Fi(k.name)}${k.unique?" UNIQUE":""}: ${N}`)}const g=[...c.operations??[]].sort((k,N)=>k.order-N.order);for(const k of g){const N=k.visibility?` {${k.visibility}}`:"",b=(s=k.description)!=null&&s.ko?` — ${k.description.ko}`:"";a.push(` method ${Fi(k.name)}()${N}${b}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Ls(c.end1.multiplicity)} —— ${Ls(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
-
`).trim()}const Mh=e=>e&&e[0].toLowerCase()+e.slice(1);function Ui(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function
|
|
3
|
-
`)}function Uh(e){return e&&e!=="UNDEFINED"?Ko(e):null}function Hh(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function jh(e){const n=Gs(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=Uh(i.stereotype);l&&r.push(` <<${l}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)r.push(` +${Hh(c.type)} ${Yo(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${Yo(c.name,"op")}()`);r.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...r),o.push(" }"))}for(const i of e.associations){const a=n.get(i.end1.entityRef),r=n.get(i.end2.entityRef);if(!a||!r)continue;const l=Kh(i),s=
|
|
4
|
-
`)}function Kh(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Me(){return crypto.randomUUID()}const Js=["BIT","TINYINT","SMALLINT","INTEGER","BIGINT","FLOAT","REAL","DOUBLE","NUMERIC","DECIMAL","CHAR","VARCHAR","LONGVARCHAR","DATE","TIME","TIMESTAMP","BINARY","VARBINARY","LONGVARBINARY","NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","BLOB","CLOB","REF","DATALINK","BOOLEAN","ROWID","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","REF_CURSOR","TIME_WITH_TIMEZONE","TIMESTAMP_WITH_TIMEZONE","SERIAL","BIG_SERIAL","JSONB"],Gh=new Set(["NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","REF","DATALINK","ROWID","REF_CURSOR","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","TIME_WITH_TIMEZONE","BIT","TINYINT","FLOAT"]),Yh=Js.filter(e=>!Gh.has(e)),qh={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function
|
|
5
|
-
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:Me(),name:d,stereotype:"JPA_ENTITY",table:{physicalName:d},attributes:[]};return o.push(m),i.set(d,m),m};let s=null;for(const d of n){const u=d.trim();if(!u||u==="erDiagram"||u.startsWith("%%"))continue;if(s){if(u==="}"){s=null;continue}const f=ry(u,s.attributes.length);f&&(s.attributes.push(f.attr),f.foreignKey&&r.add(f.attr.modelId));continue}const m=u.match(/^(\S+)\s*\{$/);if(m){s=l(m[1]);continue}const p=u.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(p&&/--|\.\./.test(p[2])){const[f,h]=p[2].split(/--|\.\./);let g=(p[4]??"").trim();const k=g.match(/^"([^"]*)"$/);k&&(g=k[1]),a.push({left:p[1],right:p[3],cardL:f??"",cardR:h??"",label:g});continue}/^\S+$/.test(u)&&l(u)}const c=a.map(d=>{const u=l(d.left),m=l(d.right);return{modelId:Me(),description:d.label||void 0,end1:{entityRef:u.modelId,multiplicity:oy[d.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:iy[d.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return ay(o,c,r),{modelId:Me(),entities:o,associations:c,groups:[]}}function nc(e){const n=tc(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=kr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Me(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const oc={smallint:{dataType:"SMALLINT"},int2:{dataType:"SMALLINT"},integer:{dataType:"INTEGER"},int:{dataType:"INTEGER"},int4:{dataType:"INTEGER"},bigint:{dataType:"BIGINT"},int8:{dataType:"BIGINT"},smallserial:{dataType:"SMALLINT",autoIncrement:!0},serial:{dataType:"INTEGER",autoIncrement:!0},serial4:{dataType:"INTEGER",autoIncrement:!0},bigserial:{dataType:"BIGINT",autoIncrement:!0},serial8:{dataType:"BIGINT",autoIncrement:!0},real:{dataType:"REAL"},float4:{dataType:"REAL"},"double precision":{dataType:"DOUBLE"},float8:{dataType:"DOUBLE"},numeric:{dataType:"NUMERIC"},decimal:{dataType:"DECIMAL"},boolean:{dataType:"BOOLEAN"},bool:{dataType:"BOOLEAN"},char:{dataType:"CHAR"},character:{dataType:"CHAR"},varchar:{dataType:"VARCHAR"},"character varying":{dataType:"VARCHAR"},text:{dataType:"LONGVARCHAR"},bytea:{dataType:"VARBINARY"},date:{dataType:"DATE"},time:{dataType:"TIME"},"time with time zone":{dataType:"TIME_WITH_TIMEZONE"},timestamp:{dataType:"TIMESTAMP"},"timestamp with time zone":{dataType:"TIMESTAMP_WITH_TIMEZONE"},jsonb:{dataType:"JSONB"},json:{dataType:"JSONB"},xml:{dataType:"SQLXML"}},ly=Object.keys(oc).sort((e,n)=>n.length-e.length),ic=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,fo=`${ic}(?:\\.${ic})*`,sy=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${fo})\s*\(([\s\S]*)\)\s*$`,"i"),cy=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${fo})\s*\(([^)]*)\)`,"i"),dy=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${fo})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${fo})\s*\(([^)]*)\)`,"i"),uy=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${fo})\s+ON\s+(${fo})\s*\(([^)]*)\)`,"i");function vt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function On(e){const n=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(n.push(i),i=""):i+=a;return i.trim()&&n.push(i),n.map(a=>a.trim()).filter(Boolean)}function my(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=vt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const k of ly)if(a.startsWith(k)){const N=oc[k];r=N.dataType,l=!!N.autoIncrement;let b=i.slice(k.length);const _=b.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);_&&(s=Number(_[1]),_[2]!=null&&(c=Number(_[2])),b=b.slice(_[0].length)),d=b,u=!0;break}if(!u){const k=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);k&&(r=k[1].toUpperCase(),k[2]!=null&&(s=Number(k[2])),k[3]!=null&&(c=Number(k[3])),d=k[4]??"")}const m=d.toUpperCase(),p=/\bPRIMARY\s+KEY\b/.test(m),f=p||/\bNOT\s+NULL\b/.test(m),h=/\bUNIQUE\b/.test(m),g={modelId:Me(),physicalName:o,dataType:r};return s!=null&&(g.length=s),c!=null&&(g.scale=c),h&&(g.unique=!0),l&&(g.autoIncrement=!0),{primaryKey:p,attr:{modelId:Me(),name:o,type:Zs(r)??"",attrType:"NORMAL",identifier:p,notNull:f,order:0,dbAttrs:[g]}}}function fy(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function ac(e){const n=e.match(/\(([^)]*)\)/);return n?On(n[1]).map(vt):[]}function
|
|
6
|
-
`)}function ky(e,n){const o=hy(e),i=new Map,a=new Map;for(const d of e.entities)for(const u of Ki(d)){i.set(u.modelId,d);const m=[];u.dbAttrs.forEach((p,f)=>{const h=Vn(u,p,f,d,e,n);sc(h)&&(m[f]=h.physicalName)}),a.set(u.modelId,m)}const r=[],l=[],s=[];for(const d of o){const u=
|
|
1
|
+
(function(be,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,ee){"use strict";var dD=Object.defineProperty;var uD=(be,t,ee)=>t in be?dD(be,t,{enumerable:!0,configurable:!0,writable:!0,value:ee}):be[t]=ee;var Xe=(be,t,ee)=>uD(be,typeof t!="symbol"?t+"":t,ee);const xh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Ch(e,n){const o=e%n.perRow,i=Math.floor(e/n.perRow);return{location:{x:n.startX+o*n.columnGap,y:n.startY+i*n.rowGap},size:{...n.defaultSize}}}function Rs(e,n,o={}){const i={...xh,...o},a=new Map(e.entities.map(k=>[k.modelId,k])),r=new Map(n.entityLayouts.map(k=>[k.entityRef,k])),l=new Map(n.associationLayouts.map(k=>[k.associationRef,k])),s=new Map;for(const k of e.groups)for(const N of k.memberEntityRefs)s.set(N,k.modelId);const c=new Map;for(const k of n.groupLayouts)for(const N of k.memberNoteRefs??[])c.set(N,k.groupRef);let d=0;const u=e.entities.map(k=>{const N=s.get(k.modelId),b=r.get(k.modelId);if(b){const E={location:{x:b.geo.location.x,y:b.geo.location.y},size:{width:b.geo.size.width,height:b.geo.size.height}};return{entity:k,geo:E,collapsed:b.collapsed??!1,locked:b.locked??!1,groupRef:N,style:b.style,attributeStyles:b.attributeStyles,operationStyles:b.operationStyles}}const _=Ch(d++,i);return{entity:k,geo:_,collapsed:!1,locked:!1,groupRef:N}}),m=new Map(n.groupLayouts.map(k=>[k.groupRef,k])),p=e.groups.map(k=>{const N=m.get(k.modelId),b=N?{location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:k,geo:b,style:N==null?void 0:N.style,locked:(N==null?void 0:N.locked)??!1}}),f=e.associations.map(k=>{const N=l.get(k.modelId);return{association:k,waypoints:(N==null?void 0:N.waypoints)??[],sourceColumnRef:N==null?void 0:N.sourceColumnRef,targetColumnRef:N==null?void 0:N.targetColumnRef}}),h=n.notes.map(k=>({note:{...k,geo:{location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}}},groupRef:c.get(k.modelId)})),g=[];for(const k of n.notes)for(const N of k.connections??[])a.has(N.targetRef)&&g.push({noteRef:k.modelId,targetRef:N.targetRef,waypoints:N.waypoints.map(b=>({x:b.x,y:b.y}))});return{entities:u,associations:f,groups:p,notes:h,noteConnections:g}}const Sh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function As(e,n,o={}){const i={...Sh,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),p=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const h=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,k)=>{const N=k%h,b=Math.floor(k/h);r.push({id:g,location:{x:p.x+i.pad+N*i.cellWidth,y:p.y+i.pad+i.headerHeight+b*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const p=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+f*i.cellHeight}})}),r}const $s={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Rh(e,n={}){const o={...$s,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function kr(e,n={}){const o={...$s,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Rh(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Tn(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function Ts(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const Di="inherited:";function Ms(e,n){return`${Di}${e}:${n}`}function Mn(e){return e.startsWith(Di)}function Er(e){if(!Mn(e))return null;const n=e.slice(Di.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function jo(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Ms(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}const Ah={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function Ko(e){return Ah[e]??e}function Oi(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Li(e,n,o,i,a=0){var u;if(!Oi(e))return;const r=i.find(m=>m.end1.attributeRef===e.modelId||m.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(m=>m.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(u=e.derivedFrom)==null?void 0:u.sourceAttributeRef;if(c){const m=s==null?void 0:s.attributes.find(p=>p.modelId===c);if(m)return m.dbAttrs[a];for(const p of o){const f=p.attributes.find(h=>h.modelId===c);if(f)return f.dbAttrs[a]}}return s?s.attributes.filter(m=>m.identifier&&(m.attrType==="NORMAL"||m.attrType==="RELATION_OWN")).sort((m,p)=>m.order-p.order).flatMap(m=>m.dbAttrs)[a]:void 0}const Vs=e=>e==null||e.trim()==="";function Bs(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=i.entities.find(u=>u.modelId===d))==null?void 0:c.attributes.flatMap(u=>u.dbAttrs)[n]}if(e.attrType.startsWith("RELATION"))return Li(e,o,i.entities,i.associations,n)}function Vn(e,n,o,i,a,r){const l=Bs(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:$h(n.logicalName)?n.logicalName:l.logicalName}:n}function $h(e){return e!=null&&Object.values(e).some(n=>!Vs(n))}function Go(e,n,o,i,a,r){var l;return Vs(n.physicalName)?((l=Bs(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Ds(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let p=0;p<m.dbAttrs.length;p++){if(u===n)return m.name||void 0;u++}}}function Nr(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function kn(e,n){return Nr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function so(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Bn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function Pi(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const Os="(미지정)",Th="(이름 없음)",zi=e=>e==null||String(e).trim()==="",Fi=e=>zi(e)?Th:String(e),Ls=e=>zi(e)?Os:String(e);function Ps(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 Os}function zs(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=zi(n)?Ls(e.physicalName):String(n),a=zi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function Fs(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function Us(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${Fi(c.name)}${d} «${Ko(c.stereotype)}»${u?` [${u}]`:""}`);const m=so(kn(c,e.entities)),p=k=>{var N;return k.sharedColumnRef?(N=Bn(k,m))==null?void 0:N.physicalName:void 0},f=[...c.attributes].sort((k,N)=>k.order-N.order);for(const k of f){if(k.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${k.name?` ${k.name} ${"─".repeat(8)}`:""}`);continue}const N=k.dbAttrs.map((T,L)=>Vn(k,T,L,c,e,n)),b=[k.identifier?"PK":"",k.notNull?"NOT NULL":""].filter(Boolean),_=` - ${Fi(k.name)}: ${Ls(k.type)}`,E=T=>T.length?` {${T.join(", ")}}`:"";if(N.length>1){a.push(`${_}${E(b)}`),N.forEach((T,L)=>{const x=Ds(k,L,e,n);a.push(` · ${x?`${x} → `:""}${zs(T,p(T))}${E(Fs(T))}`)});continue}const I=N[0],A=I?` → ${zs(I,p(I))}`:"";a.push(`${_}${A}${E([...b,...I?Fs(I):[]])}`)}const h=Tn(c.attributes);for(const k of c.indexes??[]){const N=k.columns.map(b=>{var _,E;return`${((_=h.attributeOf(b.columnRef))==null?void 0:_.name)??((E=Er(b.columnRef))==null?void 0:E.field)??b.columnRef}${b.descending?" DESC":""}`}).join(", ");a.push(` index ${Fi(k.name)}${k.unique?" UNIQUE":""}: ${N}`)}const g=[...c.operations??[]].sort((k,N)=>k.order-N.order);for(const k of g){const N=k.visibility?` {${k.visibility}}`:"",b=(s=k.description)!=null&&s.ko?` — ${k.description.ko}`:"";a.push(` method ${Fi(k.name)}()${N}${b}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Ps(c.end1.multiplicity)} —— ${Ps(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
+
`).trim()}function co(e){return e.referenceOnly===!0}function wr(e){const n=new Set;for(const o of e.entities)co(o)&&n.add(o.modelId);return n}function Hs(e){return e.entities.filter(n=>!co(n))}function js(e,n=wr(e)){return n.size===0?e.associations:e.associations.filter(o=>!n.has(o.end1.entityRef)&&!n.has(o.end2.entityRef))}function Ir(e,n){return n?{...e,entities:e.entities.map(o=>o.referenceOnly?o:{...o,referenceOnly:!0})}:e}function Mh(e,n){return co(e)||n===!0}const Vh=e=>e&&e[0].toLowerCase()+e.slice(1);function Ui(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Ks(e){return e!=="EXACTLY_ONE_INSTANCE"&&e!=="ONE_OR_MORE_INSTANCES"}function Hi(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function Bh(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function ji(e,n){const o=Vh(e);return n?Bh(o):o}function uo(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function Dh(e){return e==="CLASS"?"class":"er"}function vr(e,n,o){const i=Oh(e);return n==="class"?jh(i):Fh(i,o)}function Oh(e){const n=wr(e);return n.size===0?e:{...e,entities:Hs(e),associations:js(e,n)}}function Yo(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function xr(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Gs(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=Yo(n(a),`Entity_${r+1}`);let s=l,c=2;for(;o.has(s);)s=`${l}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function Lh(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const Ys=Hi;function Cr(e){return e!=null&&qs[e]!=null}const qs={NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"};function Ws(e,n){const o={NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"},i=Cr(e)?e:"ZERO_OR_MORE_INSTANCES";return(n==="left"?qs:o)[i]}function Ph(e,n,o,i){if(e.dbAttrs.length===0)return[];const a=[];return e.dbAttrs.forEach((r,l)=>{var p;const s=Vn(e,r,l,n,o,i);if(s.sharedColumnRef!=null)return;const c=l===0?e.name:Ds(e,l,o,i),d=Yo(s.dataType||e.type,"unknown"),u=Yo(s.physicalName||c,"col"),m=s.length?`(${s.length}${s.scale!=null?`,${s.scale}`:""})`:"";a.push(zh(d,u,e,s.unique===!0,m,(p=s.logicalName)==null?void 0:p.ko))}),a}function zh(e,n,o,i,a,r){const l=[o.identifier?"PK":"",Lh(o)?"FK":"",i?"UK":""].filter(Boolean).join(", "),s=xr([r,a].filter(Boolean).join(" ")),c=[` ${e} ${n}`];return l&&c.push(l),c.join(" ")+(s?` "${s}"`:"")}function Fh(e,n){const o=Gs(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),i=["erDiagram"];for(const r of e.entities){const l=o.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){i.push(` ${l}`);continue}i.push(` ${l} {`);for(const c of s)for(const d of Ph(c,r,e,n))i.push(d);i.push(" }")}const a=[];for(const r of e.associations){const l=o.get(r.end1.entityRef),s=o.get(r.end2.entityRef);if(!l||!s)continue;const c=`${Ws(r.end1.multiplicity,"left")}--${Ws(r.end2.multiplicity,"right")}`,d=xr(r.description);i.push(` ${l} ${c} ${s} : "${d}"`),(!Cr(r.end1.multiplicity)||!Cr(r.end2.multiplicity))&&a.push(`${l} -- ${s}`)}if(a.length>0){i.push(`%% ⚠ 다중성 미지정 ${a.length}건 — 0..*(가장 약한 주장)로 표기함. 모델을 정정할 지점:`);for(const r of a)i.push(`%% ${r}`)}return i.join(`
|
|
3
|
+
`)}function Uh(e){return e&&e!=="UNDEFINED"?Ko(e):null}function Hh(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function jh(e){const n=Gs(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=Uh(i.stereotype);l&&r.push(` <<${l}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)r.push(` +${Hh(c.type)} ${Yo(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${Yo(c.name,"op")}()`);r.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...r),o.push(" }"))}for(const i of e.associations){const a=n.get(i.end1.entityRef),r=n.get(i.end2.entityRef);if(!a||!r)continue;const l=Kh(i),s=xr(i.description),c=` ${a} "${Ys(i.end1.multiplicity)}" ${l} "${Ys(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function Kh(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Me(){return crypto.randomUUID()}const Js=["BIT","TINYINT","SMALLINT","INTEGER","BIGINT","FLOAT","REAL","DOUBLE","NUMERIC","DECIMAL","CHAR","VARCHAR","LONGVARCHAR","DATE","TIME","TIMESTAMP","BINARY","VARBINARY","LONGVARBINARY","NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","BLOB","CLOB","REF","DATALINK","BOOLEAN","ROWID","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","REF_CURSOR","TIME_WITH_TIMEZONE","TIMESTAMP_WITH_TIMEZONE","SERIAL","BIG_SERIAL","JSONB"],Gh=new Set(["NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","REF","DATALINK","ROWID","REF_CURSOR","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","TIME_WITH_TIMEZONE","BIT","TINYINT","FLOAT"]),Yh=Js.filter(e=>!Gh.has(e)),qh={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Sr(e){return qh[e]??e}const Wh=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Rr=new Set(["NUMERIC","DECIMAL"]);function Xs(e,n=Yh){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const tn="CustomType",Dn="GroupCodeEnum",Ar="String",qo=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Dn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:tn,label:"CustomType"}],Jh=new Map(qo.map(e=>[e.value,e.label]));function mo(e){return Jh.get(e)??e}const Xh={TINYINT:"Short",SMALLINT:"Short",INTEGER:"Integer",BIGINT:"Long",SERIAL:"Integer",BIG_SERIAL:"Long",FLOAT:"Double",REAL:"Double",DOUBLE:"Double",NUMERIC:"BigDecimal",DECIMAL:"BigDecimal",CHAR:"String",VARCHAR:"String",LONGVARCHAR:"String",NCHAR:"String",NVARCHAR:"String",LONGNVARCHAR:"String",CLOB:"String",NCLOB:"String",BIT:"Boolean",BOOLEAN:"Boolean",DATE:"LocalDate",TIMESTAMP:"LocalDateTime",TIMESTAMP_WITH_TIMEZONE:"OffsetDateTime",BINARY:"ByteArray",VARBINARY:"ByteArray",LONGVARBINARY:"ByteArray",BLOB:"ByteArray"};function Zs(e){if(e)return Xh[e.toUpperCase()]}const Zh={String:new Set(["VARCHAR","CHAR","LONGVARCHAR","CLOB","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","JSONB"]),CharacterArray:new Set(["CHAR","VARCHAR","LONGVARCHAR","CLOB"]),Integer:new Set(["INTEGER","SERIAL","SMALLINT","NUMERIC","DECIMAL"]),Long:new Set(["BIGINT","BIG_SERIAL","NUMERIC","DECIMAL"]),Short:new Set(["SMALLINT","TINYINT","NUMERIC","DECIMAL"]),Double:new Set(["DOUBLE","FLOAT","REAL","NUMERIC","DECIMAL"]),BigDecimal:new Set(["NUMERIC","DECIMAL"]),BigInteger:new Set(["NUMERIC","DECIMAL","BIGINT"]),Boolean:new Set(["BOOLEAN","BIT","CHAR","VARCHAR"]),Date:new Set(["DATE","TIME","TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),LocalDate:new Set(["DATE"]),LocalDateTime:new Set(["TIMESTAMP"]),Instant:new Set(["TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),ZonedDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),OffsetDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),ByteArray:new Set(["BINARY","VARBINARY","LONGVARBINARY","BLOB"]),Currency:new Set(["VARCHAR","CHAR"]),[Dn]:new Set(["VARCHAR","CHAR"])},Qh=new Map(qo.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function ey(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!Js.includes(i))return;const a=Qh.get(o)??o,r=Zh[a];if(r)return r.has(i)}const ty=new Set([Dn,"CustomMoneyType"]),Qs=qo.filter(e=>!ty.has(e.value)).map(e=>e.value===tn?{...e,label:"CustomType (사용자정의)"}:e);function ec(e,n=[]){const o=n.map(a=>{var l,s;const r=((l=a.label)==null?void 0:l.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:r?`${a.type} (${r})`:a.type}}),i=[...Qs,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:mo(e)},...i]:i}function ny(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function $r(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 Tr(e,n,o){var i;return n.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&n.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${mo(n.type)}>`:ny(n)?mo(n.type):e==="CLASS"?n.type===tn&&n.customType||mo(n.type):Sr(((i=n.dbAttrs[0])==null?void 0:i.dataType)??"")}const oy={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},iy={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function ay(e,n,o){var a,r;if(!o.size)return;const i=new Map(e.map(l=>[l.modelId,l]));for(const l of e){const s=l.attributes.filter(d=>o.has(d.modelId));if(!s.length)continue;const c=n.filter(d=>d.end2.entityRef===l.modelId).map(d=>({assoc:d,parent:i.get(d.end1.entityRef)})).filter(d=>d.parent!=null);if(c.length)for(const d of s){const u=(a=d.dbAttrs[0])==null?void 0:a.physicalName,m=(f,h)=>f.attributes.find(g=>{var k;return g.identifier&&(h==null||((k=g.dbAttrs[0])==null?void 0:k.physicalName)===h)});let p=c.length===1?c[0]:void 0;if(!p){const f=c.filter(h=>m(h.parent,u)!=null);f.length===1&&(p=f[0])}p&&(d.attrType="RELATION_OWN",d.derivedFrom={associationRef:p.assoc.modelId,sourceAttributeRef:((r=m(p.parent,u)??m(p.parent))==null?void 0:r.modelId)??""},p.assoc.end2.attributeRef||(p.assoc.end2.attributeRef=d.modelId))}}}function ry(e,n){let o=e,i;const a=o.match(/"([^"]*)"\s*$/);a&&(i=a[1],o=o.slice(0,a.index).trim());const r=o.split(/\s+/).filter(Boolean);if(r.length<2)return null;const l=r[0],s=r[1],c=new Set(r.slice(2).join(" ").split(",").map(h=>h.trim()).filter(Boolean));let d,u,m;if(i!=null){const h=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(h){d=Number(h[1]),h[2]!=null&&(u=Number(h[2]));const g=i.slice(0,h.index).trim();g&&(m=g)}else i.trim()&&(m=i.trim())}const p={modelId:Me(),physicalName:s,dataType:l};return d!=null&&(p.length=d),u!=null&&(p.scale=u),c.has("UK")&&(p.unique=!0),m&&(p.logicalName={ko:m}),{attr:{modelId:Me(),name:s,type:Zs(l)??"",attrType:"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[p]},foreignKey:c.has("FK")}}function tc(e){const n=e.split(`
|
|
5
|
+
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:Me(),name:d,stereotype:"JPA_ENTITY",table:{physicalName:d},attributes:[]};return o.push(m),i.set(d,m),m};let s=null;for(const d of n){const u=d.trim();if(!u||u==="erDiagram"||u.startsWith("%%"))continue;if(s){if(u==="}"){s=null;continue}const f=ry(u,s.attributes.length);f&&(s.attributes.push(f.attr),f.foreignKey&&r.add(f.attr.modelId));continue}const m=u.match(/^(\S+)\s*\{$/);if(m){s=l(m[1]);continue}const p=u.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(p&&/--|\.\./.test(p[2])){const[f,h]=p[2].split(/--|\.\./);let g=(p[4]??"").trim();const k=g.match(/^"([^"]*)"$/);k&&(g=k[1]),a.push({left:p[1],right:p[3],cardL:f??"",cardR:h??"",label:g});continue}/^\S+$/.test(u)&&l(u)}const c=a.map(d=>{const u=l(d.left),m=l(d.right);return{modelId:Me(),description:d.label||void 0,end1:{entityRef:u.modelId,multiplicity:oy[d.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:iy[d.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return ay(o,c,r),{modelId:Me(),entities:o,associations:c,groups:[]}}function nc(e){const n=tc(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=kr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Me(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const oc={smallint:{dataType:"SMALLINT"},int2:{dataType:"SMALLINT"},integer:{dataType:"INTEGER"},int:{dataType:"INTEGER"},int4:{dataType:"INTEGER"},bigint:{dataType:"BIGINT"},int8:{dataType:"BIGINT"},smallserial:{dataType:"SMALLINT",autoIncrement:!0},serial:{dataType:"INTEGER",autoIncrement:!0},serial4:{dataType:"INTEGER",autoIncrement:!0},bigserial:{dataType:"BIGINT",autoIncrement:!0},serial8:{dataType:"BIGINT",autoIncrement:!0},real:{dataType:"REAL"},float4:{dataType:"REAL"},"double precision":{dataType:"DOUBLE"},float8:{dataType:"DOUBLE"},numeric:{dataType:"NUMERIC"},decimal:{dataType:"DECIMAL"},boolean:{dataType:"BOOLEAN"},bool:{dataType:"BOOLEAN"},char:{dataType:"CHAR"},character:{dataType:"CHAR"},varchar:{dataType:"VARCHAR"},"character varying":{dataType:"VARCHAR"},text:{dataType:"LONGVARCHAR"},bytea:{dataType:"VARBINARY"},date:{dataType:"DATE"},time:{dataType:"TIME"},"time with time zone":{dataType:"TIME_WITH_TIMEZONE"},timestamp:{dataType:"TIMESTAMP"},"timestamp with time zone":{dataType:"TIMESTAMP_WITH_TIMEZONE"},jsonb:{dataType:"JSONB"},json:{dataType:"JSONB"},xml:{dataType:"SQLXML"}},ly=Object.keys(oc).sort((e,n)=>n.length-e.length),ic=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,fo=`${ic}(?:\\.${ic})*`,sy=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${fo})\s*\(([\s\S]*)\)\s*$`,"i"),cy=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${fo})\s*\(([^)]*)\)`,"i"),dy=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${fo})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${fo})\s*\(([^)]*)\)`,"i"),uy=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${fo})\s+ON\s+(${fo})\s*\(([^)]*)\)`,"i");function vt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function On(e){const n=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(n.push(i),i=""):i+=a;return i.trim()&&n.push(i),n.map(a=>a.trim()).filter(Boolean)}function my(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=vt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const k of ly)if(a.startsWith(k)){const N=oc[k];r=N.dataType,l=!!N.autoIncrement;let b=i.slice(k.length);const _=b.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);_&&(s=Number(_[1]),_[2]!=null&&(c=Number(_[2])),b=b.slice(_[0].length)),d=b,u=!0;break}if(!u){const k=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);k&&(r=k[1].toUpperCase(),k[2]!=null&&(s=Number(k[2])),k[3]!=null&&(c=Number(k[3])),d=k[4]??"")}const m=d.toUpperCase(),p=/\bPRIMARY\s+KEY\b/.test(m),f=p||/\bNOT\s+NULL\b/.test(m),h=/\bUNIQUE\b/.test(m),g={modelId:Me(),physicalName:o,dataType:r};return s!=null&&(g.length=s),c!=null&&(g.scale=c),h&&(g.unique=!0),l&&(g.autoIncrement=!0),{primaryKey:p,attr:{modelId:Me(),name:o,type:Zs(r)??"",attrType:"NORMAL",identifier:p,notNull:f,order:0,dbAttrs:[g]}}}function fy(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function ac(e){const n=e.match(/\(([^)]*)\)/);return n?On(n[1]).map(vt):[]}function Mr(e){var d;const n=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(u=>u.trim()).filter(Boolean);for(const u of c){const m=u.match(sy);if(!m)continue;const p=vt(m[1]),f=m[2],h={modelId:Me(),name:p,stereotype:"JPA_ENTITY",table:{physicalName:p},attributes:[]},g=new Map,k=[];let N=0;for(const b of On(f)){if(fy(b)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(b))k.push(...ac(b));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(b))for(const I of ac(b)){const A=g.get(I.toLowerCase());A!=null&&A.dbAttrs[0]&&(A.dbAttrs[0].unique=!0)}const E=b.match(cy);E&&l.push({childTable:p,childCols:On(E[1]).map(vt),parentTable:vt(E[2]),parentCols:On(E[3]).map(vt)});continue}const _=my(b);if(!_){n.push(`컬럼 정의 해석 실패: ${b.slice(0,40)}`);continue}_.attr.order=N++,_.attr.type||n.push(`자바 타입 미해소(수동 지정 필요): ${p}.${_.attr.name} — ${(d=_.attr.dbAttrs[0])==null?void 0:d.dataType}`),h.attributes.push(_.attr),g.set(_.attr.name.toLowerCase(),_.attr)}for(const b of k){const _=g.get(b.toLowerCase());_&&(_.identifier=!0,_.notNull=!0)}o.push(h),i.set(p.toLowerCase(),h);for(const[b,_]of g)a.set(`${p.toLowerCase()}.${b}`,_)}for(const u of c){const m=u.match(dy);m&&l.push({childTable:vt(m[1]),childCols:On(m[2]).map(vt),parentTable:vt(m[3]),parentCols:On(m[4]).map(vt)})}for(const u of l){const m=i.get(u.childTable.toLowerCase()),p=i.get(u.parentTable.toLowerCase());if(!m||!p){n.push(`FK 대상 테이블 없음: ${u.childTable}→${u.parentTable}`);continue}const f=a.get(`${u.childTable.toLowerCase()}.${(u.childCols[0]??"").toLowerCase()}`),h={modelId:Me(),end1:{entityRef:p.modelId,multiplicity:f!=null&&f.notNull?"EXACTLY_ONE_INSTANCE":"NO_INSTANCE_OR_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};u.childCols.forEach((g,k)=>{const N=a.get(`${u.childTable.toLowerCase()}.${g.toLowerCase()}`),b=a.get(`${u.parentTable.toLowerCase()}.${(u.parentCols[k]??"").toLowerCase()}`);N&&(N.attrType="RELATION_OWN",N.derivedFrom={associationRef:h.modelId,sourceAttributeRef:(b==null?void 0:b.modelId)??""},k===0&&(h.end2.attributeRef=N.modelId))}),r.push(h)}for(const u of c){const m=u.match(uy);if(!m)continue;const p=vt(m[3]),f=i.get(p.toLowerCase());if(!f){n.push(`인덱스 대상 테이블 없음: ${p}`);continue}const g=On(m[4]).map(N=>vt(N.replace(/\s+(ASC|DESC)$/i,""))).map(N=>{var b,_;return(_=(b=a.get(`${p.toLowerCase()}.${N.toLowerCase()}`))==null?void 0:b.dbAttrs[0])==null?void 0:_.modelId}).filter(N=>!!N).map(N=>({columnRef:N,descending:!1}));if(!g.length)continue;const k={modelId:Me(),name:vt(m[2]),unique:!!m[1],columns:g};f.indexes=[...f.indexes??[],k]}return{logical:{modelId:Me(),entities:o,associations:r,groups:[]},warnings:n}}function rc(e){const{logical:n}=Mr(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=kr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Me(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}function py(){return"postgres"}function lc(e,n="postgres",o){return ky(e,o)}const po=e=>e==null||e.trim()==="";function Ki(e){return[...e.attributes].filter(n=>n.attrType!=="DIVIDER"&&!n.transient).sort((n,o)=>n.order-o.order)}function hy(e){const n=new Set;for(const o of e.groups)if(o.excludeDDLGeneration)for(const i of o.memberEntityRefs)n.add(i);return e.entities.filter(o=>o.stereotype!=="JPA_EMBEDDABLE"&&!n.has(o.modelId)&&!co(o))}function Vr(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name}const yy={SMALLINT:"smallint",TINYINT:"smallint",INTEGER:"integer",BIGINT:"bigint",SERIAL:"serial",BIG_SERIAL:"bigserial",REAL:"real",FLOAT:"double precision",DOUBLE:"double precision",BOOLEAN:"boolean",BIT:"boolean",LONGVARCHAR:"text",LONGNVARCHAR:"text",CLOB:"text",NCLOB:"text",BINARY:"bytea",VARBINARY:"bytea",LONGVARBINARY:"bytea",BLOB:"bytea",DATE:"date",TIME:"time",TIME_WITH_TIMEZONE:"time with time zone",TIMESTAMP:"timestamp",TIMESTAMP_WITH_TIMEZONE:"timestamp with time zone",JSONB:"jsonb",JAVA_OBJECT:"jsonb",SQLXML:"xml"};function gy(e){const n=e.dataType;if(e.autoIncrement){if(n==="BIGINT")return"bigserial";if(n==="SMALLINT")return"smallserial";if(n==="INTEGER")return"serial"}return n==="NUMERIC"||n==="DECIMAL"?e.length==null?"numeric":e.scale!=null?`numeric(${e.length}, ${e.scale})`:`numeric(${e.length})`:n==="CHAR"||n==="NCHAR"?e.length!=null?`char(${e.length})`:"char":n==="VARCHAR"||n==="NVARCHAR"?e.length!=null?`varchar(${e.length})`:"varchar":yy[n]??n.toLowerCase()}function by(e,n,o){const i=[];for(const a of Ki(e))a.dbAttrs.forEach((r,l)=>{const s=Vn(a,r,l,e,n,o);sc(s)&&i.push({attr:a,col:s,name:s.physicalName})});return i}function sc(e){return e.sharedColumnRef==null&&!po(e.physicalName)&&!po(e.dataType)}function _y(e){return[` -- ⚠ 컬럼명 충돌로 ${e.length}개 컬럼 생략 (CHK-NAME-2 — 같은 물리명을 둘 이상이 사용):`,...e.map(({attr:o,name:i})=>` -- ${o.name||"(이름 없음)"} → ${i}`)].join(`
|
|
6
|
+
`)}function ky(e,n){const o=hy(e),i=new Map,a=new Map;for(const d of e.entities)for(const u of Ki(d)){i.set(u.modelId,d);const m=[];u.dbAttrs.forEach((p,f)=>{const h=Vn(u,p,f,d,e,n);sc(h)&&(m[f]=h.physicalName)}),a.set(u.modelId,m)}const r=[],l=[],s=[];for(const d of o){const u=Vr(d),m=by(d,e,n);if(m.length===0)continue;const p=new Map,f=new Map;for(const{attr:T,col:L,name:x}of m){const R=T.dbAttrs.findIndex(B=>B.modelId===L.modelId),$=p.get(T.modelId)??[];$[R<0?$.length:R]=x,p.set(T.modelId,$),f.set(L.modelId,x)}const h=new Set,g=[],k=[];for(const{attr:T,col:L,name:x}of m){if(h.has(x)){g.push({attr:T,col:L,name:x});continue}h.add(x);const R=[` ${x} ${gy(L)}`];T.notNull&&!T.identifier&&R.push("NOT NULL"),L.unique&&R.push("UNIQUE"),k.push(R.join(" "))}const N=Ki(d).filter(T=>T.identifier).flatMap(T=>p.get(T.modelId)??[]).filter(T=>!po(T));N.length&&k.push(` PRIMARY KEY (${N.join(", ")})`);const b=k.join(`,
|
|
7
7
|
`)+(g.length?`
|
|
8
8
|
${_y(g)}`:"");r.push(`CREATE TABLE ${u} (
|
|
9
9
|
${b}
|
|
10
|
-
);`);const _=new Map,E=[];for(const T of Ki(d)){const L=T.derivedFrom;if(!L)continue;const x=i.get(L.sourceAttributeRef);if(!x)continue;if(
|
|
10
|
+
);`);const _=new Map,E=[];for(const T of Ki(d)){const L=T.derivedFrom;if(!L)continue;const x=i.get(L.sourceAttributeRef);if(!x)continue;if(co(x)){E.push(`${T.name||T.modelId} → ${Vr(x)}`);continue}const R=p.get(T.modelId)??[],$=a.get(L.sourceAttributeRef)??[],B=[];for(let y=0;y<Math.max(R.length,$.length);y++){const w=R[y],v=$[y];po(w)||po(v)||B.push([w,v])}if(!B.length)continue;const O=_.get(L.associationRef)??{childCols:[],parentTable:Vr(x),parentCols:[]};for(const[y,w]of B)O.childCols.push(y),O.parentCols.push(w);_.set(L.associationRef,O)}E.length&&l.push(`-- ⚠ ${u}: 참고 전용 부모를 참조하는 FK ${E.length}개 생략 — ${E.join(", ")}`);let I=0;for(const T of _.values()){const L=`fk_${u}_${T.parentTable}${_.size>1?`_${++I}`:""}`;l.push(`ALTER TABLE ${u} ADD CONSTRAINT ${L} FOREIGN KEY (${T.childCols.join(", ")}) REFERENCES ${T.parentTable} (${T.parentCols.join(", ")});`)}const A=Tn(d.attributes);for(const T of d.indexes??[]){const L=[],x=[],R=[],$=new Set;for(const O of T.columns){const y=f.get(A.canon(O.columnRef));if(po(y)){Mn(O.columnRef)||x.push(Ts(A,O.columnRef));continue}if($.has(y)){R.push(y);continue}$.add(y),L.push(y)}if(x.length&&s.push(`-- ⚠ ${u} 인덱스 ${T.name||"(이름 없음)"}: 컬럼 참조 미해소 ${x.length}개 생략 — ${x.join(", ")}`),R.length&&s.push(`-- ⚠ ${u} 인덱스 ${T.name||"(이름 없음)"}: 중복 컬럼 ${R.length}개 생략 (CHK-DSN-7) — ${R.join(", ")}`),!L.length)continue;const B=T.name||`ix_${u}_${L.join("_")}`;s.push(`CREATE ${T.unique?"UNIQUE ":""}INDEX ${B} ON ${u} (${L.join(", ")});`)}}return[r.join(`
|
|
11
11
|
|
|
12
12
|
`),l.join(`
|
|
13
13
|
`),s.join(`
|
|
14
14
|
`)].filter(d=>d.length).join(`
|
|
15
15
|
|
|
16
|
-
`)}const Vr="entity-modeler-diagram",Br=1;class Ln extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function cc(e,n){return JSON.stringify({format:Vr,version:Br,logical:e,layout:n},null,2)}const Gi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ho=e=>Array.isArray(e)?e:[];function dc(e){let n;try{n=JSON.parse(e)}catch{throw new Ln("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Gi(n))throw new Ln("최상위가 객체가 아닙니다.");if(n.format!==Vr)throw new Ln(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Br)throw new Ln(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Gi(o)||!Array.isArray(o.entities))throw new Ln("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Gi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Ln("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:ho(o.associations),groups:ho(o.groups)},a=Gi(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:ho(a.entityLayouts),associationLayouts:ho(a.associationLayouts),groupLayouts:ho(a.groupLayouts),notes:ho(a.notes)};return{logical:i,layout:r}}const Ey=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function xt(e){return e.replace(Ey,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Oe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function uc(e){return`<text ${[`x="${Oe(e.x)}"`,`y="${Oe(e.y)}"`,`fill="${xt(e.fill)}"`,`font-size="${Oe(e.fontSize)}"`,e.fontFamily?`font-family="${xt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${xt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${xt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${xt(e.text)}</text>`}function Ny(e){return`<line x1="${Oe(e.x1)}" y1="${Oe(e.y)}" x2="${Oe(e.x2)}" y2="${Oe(e.y)}" stroke="${xt(e.stroke)}" stroke-width="${Oe(e.strokeWidth??1)}" />`}function wy(e){return e==null?{tl:0,tr:0,br:0,bl:0}:typeof e=="number"?{tl:e,tr:e,br:e,bl:e}:e}function Iy(e,n,o,i,a){return[`M${Oe(e+a.tl)},${Oe(n)}`,`L${Oe(e+o-a.tr)},${Oe(n)}`,a.tr?`Q${Oe(e+o)},${Oe(n)} ${Oe(e+o)},${Oe(n+a.tr)}`:"",`L${Oe(e+o)},${Oe(n+i-a.br)}`,a.br?`Q${Oe(e+o)},${Oe(n+i)} ${Oe(e+o-a.br)},${Oe(n+i)}`:"",`L${Oe(e+a.bl)},${Oe(n+i)}`,a.bl?`Q${Oe(e)},${Oe(n+i)} ${Oe(e)},${Oe(n+i-a.bl)}`:"",`L${Oe(e)},${Oe(n+a.tl)}`,a.tl?`Q${Oe(e)},${Oe(n)} ${Oe(e+a.tl)},${Oe(n)}`:"","Z"].filter(Boolean).join(" ")}function Dr(e){const n=wy(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${xt(e.fill)}"`,`stroke="${xt(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${xt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Oe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Iy(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Oe(e.x)}" y="${Oe(e.y)}" width="${Oe(e.w)}" height="${Oe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Ny(l));for(const l of e.texts)r.push(uc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function vy(e){const o=[`<path ${[`d="${xt(e.d)}"`,'fill="none"',`stroke="${xt(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${xt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(uc(i));return`<g>${o.join("")}</g>`}function mc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Oe(n)}" y="${Oe(o)}" width="${Oe(i)}" height="${Oe(a)}" fill="${xt(e.background)}" />`);for(const l of e.groups)r.push(Dr(l));for(const l of e.edges)r.push(vy(l));for(const l of e.entities)r.push(Dr(l));for(const l of e.notes)r.push(Dr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Oe(n)} ${Oe(o)} ${Oe(i)} ${Oe(a)}" width="${Oe(i)}" height="${Oe(a)}">`+r.join("")+"</svg>"}function Yi(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function xy(e,n,o){const i=Yi(e,o),a=Yi(n,o);return i.kind===a.kind&&i.value!==a.value}const Or=()=>crypto.randomUUID(),fc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Cy=e=>e&&e[0].toLowerCase()+e.slice(1),Sy=e=>e&&e[0].toUpperCase()+e.slice(1),pc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Ry(e,n){return Cy(e??"")+Sy(n??"")}function Ay(e,n){const o=co(e.name,n);return o===e.name?e:{...e,name:o,dbAttrs:e.dbAttrs.map(i=>({...i,physicalName:pc(o)}))}}function hc(e,n){const o=e.entities.find(s=>s.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!Us(n.end1.multiplicity);return o.attributes.filter(s=>s.identifier&&(s.attrType==="NORMAL"||s.attrType==="RELATION_OWN")).sort((s,c)=>s.order-c.order).map(s=>{const c=Ry(o.name,s.name);return{associationRef:n.modelId,sourceAttributeRef:s.modelId,name:c,type:s.type,identifier:a,notNull:r,dbAttrs:s.dbAttrs.map(d=>({physicalName:pc(c),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const qi=(e,n)=>`${e}::${n}`,Wi=e=>e??void 0;function $y(e,n,o){const i={};return e.type!==n.type&&(i.type=n.type),e.identifier!==n.identifier&&(i.identifier=n.identifier),e.notNull!==n.notNull&&(i.notNull=n.notNull),(e.dbAttrs.length!==n.dbAttrs.length||n.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||Wi(s.length)!==Wi(r.length)||Wi(s.scale)!==Wi(r.scale)}))&&(i.dbAttrs=n.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function Ty(e,n,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:n,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function Wo(e,n,o=Or){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(f=>hc(e,f)),s=new Map(l.map(f=>[qi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[qi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=qi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let p=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of l){const h=qi(f.associationRef,f.sourceAttributeRef),g=d.get(h);if(g){const k=$y(g,f,o);k&&i.update.push({attributeId:g.modelId,patch:k})}else{const k=Ay(f,m);m.add(k.name),i.add.push(Ty(k,p++,o))}}return i}function yc(e,n){if(n.remove.length){const o=new Set(n.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of n.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}n.add.length&&e.attributes.push(...n.add)}function My(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function gc(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function bc(e,n,o=Or){const i=new Map,a=My(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(p=>p.end1.entityRef===d).map(p=>p.end2.entityRef));for(const p of m){const f=Wo(a,p,o);if(fc(f))continue;const h=i.get(p);i.set(p,h?gc(h,f):f);const g=a.entities.find(k=>k.modelId===p);g&&yc(g,f),r.has(p)||(r.add(p),c.push(p))}}return i}function _c(e,n,o=Or){const i=[],a=Wo(e,n,o);let r=e;fc(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return yc(s,a),s})});for(const[l,s]of bc(r,n,o))i.push({entityId:l,plan:s});return i}function Ji(e,n,o){var l;const i=e.entities.find(s=>s.modelId===n),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!Oi(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const Jo=63;function Lr(e){if(!e)return null;const n=e.length;return n>Jo?n:null}function Pr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function bt(e){return!e||e.trim()===""}function yo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Vy(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const p=o.get(m.end1.entityRef)??[];p.push(m.end2.entityRef),o.set(m.end1.entityRef,p)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const p of o.get(m)??[]){const f=l.get(p)??i;if(f===i)u(p);else if(f===a){const h=s.slice(s.indexOf(p)),g=[...h].sort().join(" ");d.has(g)||(d.add(g),c.push(h))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function kc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function By(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function Ec(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Dy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=bt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Oy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Dy(a,o))).size===1}function Nc(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function zr(e,n){const o=new Map;for(const i of e){const a=n(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=n(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function Xi(e,n){var m,p,f,h,g,k,N,b,_;const o=[],i=new Map(e.entities.map(E=>[E.modelId,E])),a=new Map(e.associations.map(E=>[E.modelId,E])),r=wr(e),l=r.size===0?e.entities:Hs(e),s=js(e,r);for(const E of Nc(l,I=>I.name))for(const I of E){const A=E.filter(x=>x!==I),T=kc(I)&&A.some(kc),L=A.some(x=>!xy(I,x,e));!T&&!L||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:I.modelId,params:{name:I.name,reason:T?"entity":"package"}})}for(const E of Nc(By(l),Ec))if(new Set(E.map(I=>I.name)).size!==1&&!Oy(E,e))for(const I of E)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:I.modelId,params:{name:Ec(I)}});const c=l.flatMap(E=>(E.indexes??[]).map(I=>({e:E,ix:I})));for(const E of zr(c,I=>I.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:E.ix.modelId,contextRef:E.e.modelId,params:{name:E.ix.name}});for(const E of l){const I=E.attributes.filter(y=>y.attrType!=="DIVIDER");if(bt(E.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:E.modelId}),E.stereotype==="JPA_ENTITY"&&!E.abstractClass&&(I.some(y=>y.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:E.modelId}),bt((m=E.table)==null?void 0:m.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:E.modelId})),E.stereotype==="JPA_EMBEDDABLE")for(const y of I.filter(w=>w.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.identifier&&w.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I)if(!y.identifier)for(const w of y.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:w.autoIncrement?{name:y.name}:{name:y.name,seq:w.sequenceName??""}});const A=I.filter(y=>y.identifier&&!y.transient);if(A.reduce((y,w)=>y+w.dbAttrs.length,0)>=2)for(const y of A)for(const w of y.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&w.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&w.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&!w.notNull&&!w.identifier&&!w.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});!E.abstractClass&&I.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:E.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&I.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:E.modelId,params:{count:I.length,threshold:n.largeEntityThreshold}});for(const y of zr(I,w=>w.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I)if(bt(y.name)){const w=y.attrType.startsWith("RELATION")||y.attrType.startsWith("EMBED");o.push({ruleId:w?"CHK-NAME-7":"CHK-NAME-4",severity:w?"error":"info",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,...w?{params:{attrType:y.attrType}}:{}})}const T=I.flatMap(y=>y.dbAttrs.map((w,v)=>({attr:y,index:v,col:w,name:Go(y,w,v,E,e,n)})).filter(w=>w.col.sharedColumnRef==null));for(const y of zr(T,w=>w.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of T){if(!bt(y.name)||y.attr.transient||bt(y.attr.name)&&(y.attr.attrType.startsWith("RELATION")||y.attr.attrType.startsWith("EMBED"))||y.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const w=Li(y.attr,E,e.entities,e.associations,y.index);bt(w==null?void 0:w.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.attr.name}})}for(const y of T){const w=y.col,v=Lr(w.physicalName);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{max:Jo,len:v}}),n!=null&&n.reservedWords&&!bt(w.physicalName)&&n.reservedWords.has(w.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{name:w.physicalName}}),n!=null&&n.selectableDataTypes&&!bt(w.dataType)&&!n.selectableDataTypes.has(w.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{dataType:w.dataType}});const M=y.attr.transient||w.multiValue||y.attr.attrType.startsWith("EMBED")||y.attr.attrType.startsWith("RELATION")?void 0:ey(y.attr.type,w.dataType);M===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{type:y.attr.type,dataType:Pr(w)}}),M!==!1&&!bt(w.dataType)&&Wh.has(w.dataType)&&!w.length&&(Vn(y.attr,w,y.index,E,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{dataType:w.dataType}}))}for(const y of T)bt(y.col.dataType)&&(y.attr.transient||y.attr.attrType.startsWith("EMBED")||y.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.attr.name}}));if((p=n==null?void 0:n.embeddableCatalog)!=null&&p.length){const y=so(kn(E,e.entities));for(const w of I){if(w.attrType!=="EMBED_PREDEF")continue;const v=n.embeddableCatalog.find(M=>M.type===w.type);v&&w.dbAttrs.forEach((M,D)=>{if(M.sharedColumnRef==null)return;const U=v.fields[D],W=y.get(M.sharedColumnRef);if(!U||!W)return;(W.dataType!==U.dataType||(W.length??null)!==(U.length??null)||(W.scale??null)!==(U.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:M.modelId,contextRef:E.modelId,params:{targetType:Pr(W),metaName:U.name,metaType:Pr(U)}})})}}for(const y of I){const w=y.dbAttrs[0];if(!(w!=null&&w.multiValue))continue;y.type===Dn&&w.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{type:y.type||"",dataType:w.dataType||""}})}for(const y of I){if(y.attrType!=="EMBED_OWN"||!y.embedded)continue;const w=i.get(y.embedded.embeddableRef);if(!w)continue;const v=a.get(y.embedded.associationRef),M=v==null?void 0:v.end1.entityRef===y.embedded.embeddableRef?v.end1:v.end2;if(M&&yo(M.multiplicity))continue;const D=w.attributes.flatMap(U=>U.dbAttrs).length;y.dbAttrs.length!==D&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name,embeddable:w.name,slots:y.dbAttrs.length,declared:D}})}const L=(f=E.table)==null?void 0:f.physicalName,x=Lr(L);x!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:E.modelId,params:{max:Jo,len:x}}),n!=null&&n.reservedWords&&!bt(L)&&n.reservedWords.has(L.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:E.modelId,params:{name:L}});const R=new Set;for(const y of E.attributes){R.add(y.modelId);for(const w of y.dbAttrs)R.add(w.modelId)}const $=new Set(jo(E,(n==null?void 0:n.superClassCatalog)??[]).map(y=>y.modelId)),B=(((h=n==null?void 0:n.superClassCatalog)==null?void 0:h.length)??0)>0,O=Tn(E.attributes);for(const y of E.indexes??[]){const w=Lr(y.name);w!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{max:Jo,len:w}}),n!=null&&n.reservedWords&&!bt(y.name)&&n.reservedWords.has(y.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const v of y.columns){const M=v.columnRef;if(R.has(M)||$.has(M))continue;const D=Mn(M);D&&!B||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:D?{name:y.name,field:((g=Er(M))==null?void 0:g.field)??M}:{name:y.name}})}y.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}}),new Set(y.columns.map(v=>O.canon(v.columnRef))).size!==y.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}})}}const d=new Map;for(const E of e.entities)for(const I of E.attributes)I.attrType==="EMBED_OWN"&&I.embedded&&d.set(I.embedded.associationRef,I);for(const E of s){if(yo(E.end1.multiplicity)&&yo(E.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:E.modelId}),d.has(E.modelId)&&E.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:E.modelId}),!d.has(E.modelId)){const I=!!E.end2.attributeRef&&(((N=(k=E.end2.jpa)==null?void 0:k.cascadeTypes)==null?void 0:N.length)??0)>0,A=!!E.end1.attributeRef&&E.end1.navigable&&(((_=(b=E.end1.jpa)==null?void 0:b.cascadeTypes)==null?void 0:_.length)??0)>0;I&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:E.modelId})}if(!d.has(E.modelId)&&E.end1.navigable&&E.end1.attributeRef){const I=i.get(E.end1.entityRef),A=I==null?void 0:I.attributes.some(x=>x.modelId===E.end1.attributeRef),T=i.get(E.end2.entityRef),L=hc(e,E).length>0;A&&T&&L&&(E.end2.attributeRef&&T.attributes.some(R=>R.modelId===E.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:E.modelId,params:{child:T.name}}))}for(const I of["end1","end2"]){const A=E[I].jpa;if(!A)continue;const T=A.cascadeTypes??[],L=T.includes("ALL"),x=T.includes("REMOVE");L&&T.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.orphanRemoval&&(x||L)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:E.modelId,params:{which:I,cascade:L?"ALL":"REMOVE"}}),yo(E[I].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.orphanRemoval&&yo(E[I==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:E.modelId,params:{which:I}}),!yo(E[I].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}})}}const u=new Map(e.entities.map(E=>[E.modelId,E.name||E.modelId]));for(const E of Vy(l,s)){const I=[...E,E[0]].map(A=>u.get(A)??A).join(" → ");for(const A of E)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:I}})}if(n!=null&&n.flagEntitiesWithoutRelations){const E=new Set;for(const A of e.associations)E.add(A.end1.entityRef),E.add(A.end2.entityRef);const I=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const T of A.attributes)T.embedded&&(E.add(A.modelId),E.add(T.embedded.embeddableRef));if(!bt(A.superClass)){E.add(A.modelId);const T=I.get(A.superClass);T&&E.add(T)}}for(const A of l)E.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function Fr(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return Ly(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}function Ly(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=Tn(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const go="javax.persistence",Je={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},Py={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function wc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Ut(o)?null:o??Py[n]}const Zi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function zy(e){if(!e)return;if(Zi[e])return{simpleName:e,fqn:Zi[e]};const n=Object.entries(Zi).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function Ic(e){return!(Ut(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Fy(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(uo(l)||o.skipUngeneratable!==!1&&!Ic(l)||a.push(Ky(l,e,o)))}return a}class vc{constructor(){Xe(this,"imports",new Set);Xe(this,"body",[]);Xe(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${go}.${n}`)}line(n=""){this.body.push(n)}fillIn(n){this.fillIns.push(n)}render(n){const o=[`package ${n};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
16
|
+
`)}const Br="entity-modeler-diagram",Dr=1;class Ln extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function cc(e,n){return JSON.stringify({format:Br,version:Dr,logical:e,layout:n},null,2)}const Gi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ho=e=>Array.isArray(e)?e:[];function dc(e){let n;try{n=JSON.parse(e)}catch{throw new Ln("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Gi(n))throw new Ln("최상위가 객체가 아닙니다.");if(n.format!==Br)throw new Ln(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Dr)throw new Ln(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Gi(o)||!Array.isArray(o.entities))throw new Ln("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Gi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Ln("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:ho(o.associations),groups:ho(o.groups)},a=Gi(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:ho(a.entityLayouts),associationLayouts:ho(a.associationLayouts),groupLayouts:ho(a.groupLayouts),notes:ho(a.notes)};return{logical:i,layout:r}}const Ey=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function xt(e){return e.replace(Ey,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Oe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function uc(e){return`<text ${[`x="${Oe(e.x)}"`,`y="${Oe(e.y)}"`,`fill="${xt(e.fill)}"`,`font-size="${Oe(e.fontSize)}"`,e.fontFamily?`font-family="${xt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${xt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${xt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${xt(e.text)}</text>`}function Ny(e){return`<line x1="${Oe(e.x1)}" y1="${Oe(e.y)}" x2="${Oe(e.x2)}" y2="${Oe(e.y)}" stroke="${xt(e.stroke)}" stroke-width="${Oe(e.strokeWidth??1)}" />`}function wy(e){return e==null?{tl:0,tr:0,br:0,bl:0}:typeof e=="number"?{tl:e,tr:e,br:e,bl:e}:e}function Iy(e,n,o,i,a){return[`M${Oe(e+a.tl)},${Oe(n)}`,`L${Oe(e+o-a.tr)},${Oe(n)}`,a.tr?`Q${Oe(e+o)},${Oe(n)} ${Oe(e+o)},${Oe(n+a.tr)}`:"",`L${Oe(e+o)},${Oe(n+i-a.br)}`,a.br?`Q${Oe(e+o)},${Oe(n+i)} ${Oe(e+o-a.br)},${Oe(n+i)}`:"",`L${Oe(e+a.bl)},${Oe(n+i)}`,a.bl?`Q${Oe(e)},${Oe(n+i)} ${Oe(e)},${Oe(n+i-a.bl)}`:"",`L${Oe(e)},${Oe(n+a.tl)}`,a.tl?`Q${Oe(e)},${Oe(n)} ${Oe(e+a.tl)},${Oe(n)}`:"","Z"].filter(Boolean).join(" ")}function Or(e){const n=wy(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${xt(e.fill)}"`,`stroke="${xt(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${xt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Oe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Iy(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Oe(e.x)}" y="${Oe(e.y)}" width="${Oe(e.w)}" height="${Oe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Ny(l));for(const l of e.texts)r.push(uc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function vy(e){const o=[`<path ${[`d="${xt(e.d)}"`,'fill="none"',`stroke="${xt(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${xt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(uc(i));return`<g>${o.join("")}</g>`}function mc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Oe(n)}" y="${Oe(o)}" width="${Oe(i)}" height="${Oe(a)}" fill="${xt(e.background)}" />`);for(const l of e.groups)r.push(Or(l));for(const l of e.edges)r.push(vy(l));for(const l of e.entities)r.push(Or(l));for(const l of e.notes)r.push(Or(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Oe(n)} ${Oe(o)} ${Oe(i)} ${Oe(a)}" width="${Oe(i)}" height="${Oe(a)}">`+r.join("")+"</svg>"}function Yi(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function xy(e,n,o){const i=Yi(e,o),a=Yi(n,o);return i.kind===a.kind&&i.value!==a.value}const Lr=()=>crypto.randomUUID(),fc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Cy=e=>e&&e[0].toLowerCase()+e.slice(1),Sy=e=>e&&e[0].toUpperCase()+e.slice(1),pc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Ry(e,n){return Cy(e??"")+Sy(n??"")}function Ay(e,n){const o=uo(e.name,n);return o===e.name?e:{...e,name:o,dbAttrs:e.dbAttrs.map(i=>({...i,physicalName:pc(o)}))}}function hc(e,n){const o=e.entities.find(s=>s.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!Ks(n.end1.multiplicity);return o.attributes.filter(s=>s.identifier&&(s.attrType==="NORMAL"||s.attrType==="RELATION_OWN")).sort((s,c)=>s.order-c.order).map(s=>{const c=Ry(o.name,s.name);return{associationRef:n.modelId,sourceAttributeRef:s.modelId,name:c,type:s.type,identifier:a,notNull:r,dbAttrs:s.dbAttrs.map(d=>({physicalName:pc(c),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const qi=(e,n)=>`${e}::${n}`,Wi=e=>e??void 0;function $y(e,n,o){const i={};return e.type!==n.type&&(i.type=n.type),e.identifier!==n.identifier&&(i.identifier=n.identifier),e.notNull!==n.notNull&&(i.notNull=n.notNull),(e.dbAttrs.length!==n.dbAttrs.length||n.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||Wi(s.length)!==Wi(r.length)||Wi(s.scale)!==Wi(r.scale)}))&&(i.dbAttrs=n.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function Ty(e,n,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:n,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function Wo(e,n,o=Lr){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(f=>hc(e,f)),s=new Map(l.map(f=>[qi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[qi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=qi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let p=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of l){const h=qi(f.associationRef,f.sourceAttributeRef),g=d.get(h);if(g){const k=$y(g,f,o);k&&i.update.push({attributeId:g.modelId,patch:k})}else{const k=Ay(f,m);m.add(k.name),i.add.push(Ty(k,p++,o))}}return i}function yc(e,n){if(n.remove.length){const o=new Set(n.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of n.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}n.add.length&&e.attributes.push(...n.add)}function My(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function gc(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function bc(e,n,o=Lr){const i=new Map,a=My(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(p=>p.end1.entityRef===d).map(p=>p.end2.entityRef));for(const p of m){const f=Wo(a,p,o);if(fc(f))continue;const h=i.get(p);i.set(p,h?gc(h,f):f);const g=a.entities.find(k=>k.modelId===p);g&&yc(g,f),r.has(p)||(r.add(p),c.push(p))}}return i}function _c(e,n,o=Lr){const i=[],a=Wo(e,n,o);let r=e;fc(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return yc(s,a),s})});for(const[l,s]of bc(r,n,o))i.push({entityId:l,plan:s});return i}function Ji(e,n,o){var l;const i=e.entities.find(s=>s.modelId===n),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!Oi(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const Jo=63;function Pr(e){if(!e)return null;const n=e.length;return n>Jo?n:null}function zr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function bt(e){return!e||e.trim()===""}function yo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Vy(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const p=o.get(m.end1.entityRef)??[];p.push(m.end2.entityRef),o.set(m.end1.entityRef,p)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const p of o.get(m)??[]){const f=l.get(p)??i;if(f===i)u(p);else if(f===a){const h=s.slice(s.indexOf(p)),g=[...h].sort().join(" ");d.has(g)||(d.add(g),c.push(h))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function kc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function By(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function Ec(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Dy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=bt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Oy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Dy(a,o))).size===1}function Nc(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function Fr(e,n){const o=new Map;for(const i of e){const a=n(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=n(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function Xi(e,n){var m,p,f,h,g,k,N,b,_;const o=[],i=new Map(e.entities.map(E=>[E.modelId,E])),a=new Map(e.associations.map(E=>[E.modelId,E])),r=wr(e),l=r.size===0?e.entities:Hs(e),s=js(e,r);for(const E of Nc(l,I=>I.name))for(const I of E){const A=E.filter(x=>x!==I),T=kc(I)&&A.some(kc),L=A.some(x=>!xy(I,x,e));!T&&!L||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:I.modelId,params:{name:I.name,reason:T?"entity":"package"}})}for(const E of Nc(By(l),Ec))if(new Set(E.map(I=>I.name)).size!==1&&!Oy(E,e))for(const I of E)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:I.modelId,params:{name:Ec(I)}});const c=l.flatMap(E=>(E.indexes??[]).map(I=>({e:E,ix:I})));for(const E of Fr(c,I=>I.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:E.ix.modelId,contextRef:E.e.modelId,params:{name:E.ix.name}});for(const E of l){const I=E.attributes.filter(y=>y.attrType!=="DIVIDER");if(bt(E.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:E.modelId}),E.stereotype==="JPA_ENTITY"&&!E.abstractClass&&(I.some(y=>y.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:E.modelId}),bt((m=E.table)==null?void 0:m.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:E.modelId})),E.stereotype==="JPA_EMBEDDABLE")for(const y of I.filter(w=>w.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.identifier&&w.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I)if(!y.identifier)for(const w of y.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:w.autoIncrement?{name:y.name}:{name:y.name,seq:w.sequenceName??""}});const A=I.filter(y=>y.identifier&&!y.transient);if(A.reduce((y,w)=>y+w.dbAttrs.length,0)>=2)for(const y of A)for(const w of y.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&w.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&w.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I.filter(w=>w.naturalId&&!w.notNull&&!w.identifier&&!w.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});!E.abstractClass&&I.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:E.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&I.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:E.modelId,params:{count:I.length,threshold:n.largeEntityThreshold}});for(const y of Fr(I,w=>w.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of I)if(bt(y.name)){const w=y.attrType.startsWith("RELATION")||y.attrType.startsWith("EMBED");o.push({ruleId:w?"CHK-NAME-7":"CHK-NAME-4",severity:w?"error":"info",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,...w?{params:{attrType:y.attrType}}:{}})}const T=I.flatMap(y=>y.dbAttrs.map((w,v)=>({attr:y,index:v,col:w,name:Go(y,w,v,E,e,n)})).filter(w=>w.col.sharedColumnRef==null));for(const y of Fr(T,w=>w.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.name}});for(const y of T){if(!bt(y.name)||y.attr.transient||bt(y.attr.name)&&(y.attr.attrType.startsWith("RELATION")||y.attr.attrType.startsWith("EMBED"))||y.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const w=Li(y.attr,E,e.entities,e.associations,y.index);bt(w==null?void 0:w.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.attr.name}})}for(const y of T){const w=y.col,v=Pr(w.physicalName);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{max:Jo,len:v}}),n!=null&&n.reservedWords&&!bt(w.physicalName)&&n.reservedWords.has(w.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{name:w.physicalName}}),n!=null&&n.selectableDataTypes&&!bt(w.dataType)&&!n.selectableDataTypes.has(w.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{dataType:w.dataType}});const M=y.attr.transient||w.multiValue||y.attr.attrType.startsWith("EMBED")||y.attr.attrType.startsWith("RELATION")?void 0:ey(y.attr.type,w.dataType);M===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{type:y.attr.type,dataType:zr(w)}}),M!==!1&&!bt(w.dataType)&&Wh.has(w.dataType)&&!w.length&&(Vn(y.attr,w,y.index,E,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{dataType:w.dataType}}))}for(const y of T)bt(y.col.dataType)&&(y.attr.transient||y.attr.attrType.startsWith("EMBED")||y.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:y.col.modelId,contextRef:E.modelId,params:{name:y.attr.name}}));if((p=n==null?void 0:n.embeddableCatalog)!=null&&p.length){const y=so(kn(E,e.entities));for(const w of I){if(w.attrType!=="EMBED_PREDEF")continue;const v=n.embeddableCatalog.find(M=>M.type===w.type);v&&w.dbAttrs.forEach((M,D)=>{if(M.sharedColumnRef==null)return;const U=v.fields[D],W=y.get(M.sharedColumnRef);if(!U||!W)return;(W.dataType!==U.dataType||(W.length??null)!==(U.length??null)||(W.scale??null)!==(U.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:M.modelId,contextRef:E.modelId,params:{targetType:zr(W),metaName:U.name,metaType:zr(U)}})})}}for(const y of I){const w=y.dbAttrs[0];if(!(w!=null&&w.multiValue))continue;y.type===Dn&&w.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:E.modelId,params:{type:y.type||"",dataType:w.dataType||""}})}for(const y of I){if(y.attrType!=="EMBED_OWN"||!y.embedded)continue;const w=i.get(y.embedded.embeddableRef);if(!w)continue;const v=a.get(y.embedded.associationRef),M=v==null?void 0:v.end1.entityRef===y.embedded.embeddableRef?v.end1:v.end2;if(M&&yo(M.multiplicity))continue;const D=w.attributes.flatMap(U=>U.dbAttrs).length;y.dbAttrs.length!==D&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name,embeddable:w.name,slots:y.dbAttrs.length,declared:D}})}const L=(f=E.table)==null?void 0:f.physicalName,x=Pr(L);x!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:E.modelId,params:{max:Jo,len:x}}),n!=null&&n.reservedWords&&!bt(L)&&n.reservedWords.has(L.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:E.modelId,params:{name:L}});const R=new Set;for(const y of E.attributes){R.add(y.modelId);for(const w of y.dbAttrs)R.add(w.modelId)}const $=new Set(jo(E,(n==null?void 0:n.superClassCatalog)??[]).map(y=>y.modelId)),B=(((h=n==null?void 0:n.superClassCatalog)==null?void 0:h.length)??0)>0,O=Tn(E.attributes);for(const y of E.indexes??[]){const w=Pr(y.name);w!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{max:Jo,len:w}}),n!=null&&n.reservedWords&&!bt(y.name)&&n.reservedWords.has(y.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}});for(const v of y.columns){const M=v.columnRef;if(R.has(M)||$.has(M))continue;const D=Mn(M);D&&!B||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:D?{name:y.name,field:((g=Er(M))==null?void 0:g.field)??M}:{name:y.name}})}y.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}}),new Set(y.columns.map(v=>O.canon(v.columnRef))).size!==y.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:y.modelId,contextRef:E.modelId,params:{name:y.name}})}}const d=new Map;for(const E of e.entities)for(const I of E.attributes)I.attrType==="EMBED_OWN"&&I.embedded&&d.set(I.embedded.associationRef,I);for(const E of s){if(yo(E.end1.multiplicity)&&yo(E.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:E.modelId}),d.has(E.modelId)&&E.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:E.modelId}),!d.has(E.modelId)){const I=!!E.end2.attributeRef&&(((N=(k=E.end2.jpa)==null?void 0:k.cascadeTypes)==null?void 0:N.length)??0)>0,A=!!E.end1.attributeRef&&E.end1.navigable&&(((_=(b=E.end1.jpa)==null?void 0:b.cascadeTypes)==null?void 0:_.length)??0)>0;I&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:E.modelId})}if(!d.has(E.modelId)&&E.end1.navigable&&E.end1.attributeRef){const I=i.get(E.end1.entityRef),A=I==null?void 0:I.attributes.some(x=>x.modelId===E.end1.attributeRef),T=i.get(E.end2.entityRef),L=hc(e,E).length>0;A&&T&&L&&(E.end2.attributeRef&&T.attributes.some(R=>R.modelId===E.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:E.modelId,params:{child:T.name}}))}for(const I of["end1","end2"]){const A=E[I].jpa;if(!A)continue;const T=A.cascadeTypes??[],L=T.includes("ALL"),x=T.includes("REMOVE");L&&T.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.orphanRemoval&&(x||L)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:E.modelId,params:{which:I,cascade:L?"ALL":"REMOVE"}}),yo(E[I].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.orphanRemoval&&yo(E[I==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:E.modelId,params:{which:I}}),!yo(E[I].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:I}})}}const u=new Map(e.entities.map(E=>[E.modelId,E.name||E.modelId]));for(const E of Vy(l,s)){const I=[...E,E[0]].map(A=>u.get(A)??A).join(" → ");for(const A of E)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:I}})}if(n!=null&&n.flagEntitiesWithoutRelations){const E=new Set;for(const A of e.associations)E.add(A.end1.entityRef),E.add(A.end2.entityRef);const I=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const T of A.attributes)T.embedded&&(E.add(A.modelId),E.add(T.embedded.embeddableRef));if(!bt(A.superClass)){E.add(A.modelId);const T=I.get(A.superClass);T&&E.add(T)}}for(const A of l)E.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function Ur(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return Ly(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}function Ly(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=Tn(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const go="javax.persistence",Je={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},Py={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function wc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Ut(o)?null:o??Py[n]}const Zi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function zy(e){if(!e)return;if(Zi[e])return{simpleName:e,fqn:Zi[e]};const n=Object.entries(Zi).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function Ic(e){return!(Ut(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Fy(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(co(l)||o.skipUngeneratable!==!1&&!Ic(l)||a.push(Ky(l,e,o)))}return a}class vc{constructor(){Xe(this,"imports",new Set);Xe(this,"body",[]);Xe(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${go}.${n}`)}line(n=""){this.body.push(n)}fillIn(n){this.fillIns.push(n)}render(n){const o=[`package ${n};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
17
17
|
`)+`
|
|
18
|
-
`}}function xc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Uy(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function bo(e,n){n&&(e.import(Je.lombokGetter),e.line(" @Getter"))}const Hy=["ko","en","ja","zh"];function
|
|
18
|
+
`}}function xc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Uy(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function bo(e,n){n&&(e.import(Je.lombokGetter),e.line(" @Getter"))}const Hy=["ko","en","ja","zh"];function Hr(e,n){if(!e)return[];const o=Hy.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${n} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${n}/**`,`${n} * <ul>`,...o,`${n} * </ul>`,`${n} */`]}function Qi(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...qo,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Dn){if(i){const c=[`${go}.Enumerated`,`${go}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${go}.Enumerated`,`${go}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===tn){const c=zy(n),d=c?`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${n??"(미지정)"}`;return{...a,type:n||"Object",fillIns:[d]}}if(e==="CustomMoneyType"){const c=wc(o,"money");return{type:"Money",primitive:!1,imports:c?[Je.money,`${go}.Convert`]:[Je.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=Zi[e];if(s)return{type:e,primitive:!1,imports:[s,Je.jdbcTypeCode,Je.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const c=l.label,d=[],u=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),u.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:l.boxed!=null,imports:d,fieldAnnotations:[],fillIns:u}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function Cc(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function jr(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return Qi(e.type,e.customType,o,e.groupCode).type;const a=n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return Qi(e.type,e.customType,o).type;const r=Cc(a);return r.length>=2?`${a.name}PK`:r.length===1?jr(r[0],n,o,new Set([...i,a.modelId])):Qi(e.type,e.customType,o).type}function jy(e,n,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!n)return!1;const i=!Gr(n.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function Ky(e,n,o){var x,R,$,B,O,y;if(e.stereotype==="JPA_EMBEDDABLE")return Gy(e,n,o);const i=new vc,a=e.name;let r=Xo(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ea}')`),r=ea);const l=new Map(n.entities.map(w=>[w.modelId,w])),s=r,c=ag(e,o,i),d=new Map;for(const w of n.associations)w.end2.attributeRef&&d.set(w.end2.attributeRef,{assoc:w,role:"owner"}),w.end1.attributeRef&&w.end1.navigable&&d.set(w.end1.attributeRef,{assoc:w,role:"inverse"});const u=Cc(e),m=new Set(u.filter(w=>w.attrType==="NORMAL").flatMap(w=>w.dbAttrs.map(v=>v.physicalName)).filter(Boolean)),p=new Set;for(const w of u)jy(w,(x=d.get(w.modelId))==null?void 0:x.assoc,m)&&p.add(w.modelId);const f=u.filter(w=>!p.has(w.modelId)),h=f.length>=2,g=f.length===1,k=`${a}PK`,N=w=>p.has(w.modelId)?"mapsId":w.identifier?"id":"none",b=o.lombok!==!1;i.jpa("Entity"),i.import(Je.jsonIdentityInfo),i.import(Je.jsogGenerator);const _=["@Entity"];_.push(Zy(e,n,o,i)),_.push('@SuppressWarnings("serial")'),_.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),h&&(i.jpa("IdClass"),i.import(`${r}.${a}.${k}`),_.push(`@IdClass(${a}.${k}.class)`)),(R=e.jpaAttrs)!=null&&R.useDynamicInsert&&(_.push("@DynamicInsert"),i.import(Je.dynamicInsert)),($=e.jpaAttrs)!=null&&$.useDynamicUpdate&&(_.push("@DynamicUpdate"),i.import(Je.dynamicUpdate)),(B=e.jpaAttrs)!=null&&B.useCacheable&&(_.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(Yy),_.push("@PersonalInfo")),b&&(i.import(Je.lombokNoArgs),i.import(Je.lombokAccessLevel),_.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const w of Hr((O=e.table)==null?void 0:O.logicalName,""))i.line(w);for(const w of _)i.line(w);const E=e.abstractClass?"abstract ":"";i.line(`public ${E}class ${a}${c}${Ac(e,i)} {`);const I=e.attributes.filter(w=>w.attrType!=="DIVIDER").sort((w,v)=>w.order-v.order),A=(y=e.jpaAttrs)!=null&&y.useVersion?u.length?u[u.length-1].modelId:null:void 0,T=[];for(const w of I){if(w.attrType.startsWith("EMBED"))T.push(...Vc(w,e,n,o,i));else if(w.attrType==="RELATION_OWN"){const v=d.get(w.modelId);if(v){const M=ng(w,v.assoc,s,l,N(w),b,n,o,i);M&&T.push(M)}else eg(w,e,new Set(d.keys()))||i.fillIn(`${e.name}.${w.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`)}else if(w.attrType==="RELATION_REF"){const v=d.get(w.modelId),M=v?og(w,v.assoc,s,l,b,n,o,i):null;M&&T.push(M)}else T.push(Tc(w,a,o,i));w.modelId===A&&Sc(i,T,b)}A===null&&Sc(i,T,b),b||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Rc(T,i,b),$c(e,i),h&&(i.import(Je.jsonBackReference),i.import(Je.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${k} getPK() {`),i.line(` return (${k}) HibernateBeanUtil.getPK(this);`),i.line(" }"),rg(k,f.map(w=>({type:jr(w,n,o),name:w.name})),b,i)),i.line("}");let L;return h?L=lg(a,k,r):g&&(L=sg(a,r,jr(f[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:L}}function Sc(e,n,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||n.push({type:"int",name:"dataVersion",category:0})}function Rc(e,n,o){const i=e.map((a,r)=>({g:a,i:r})).sort((a,r)=>a.g.category-r.g.category||a.i-r.i);for(const{g:a}of i){if(o&&!a.collection)continue;n.line(""),n.line(` public ${a.type} get${xc(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(n.import("java.util.Collections"),n.line(` return Collections.${r}(this.${a.name});`)):n.line(` return ${a.name};`),n.line(" }")}}function Gy(e,n,o){var d;const i=new vc,a=e.name;let r=Xo(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ea}')`),r=ea),i.jpa("Embeddable"),i.import(Je.jsonIdentityInfo),i.import(Je.jsogGenerator),i.import(Je.serializable);for(const u of Hr((d=e.table)==null?void 0:d.logicalName,""))i.line(u);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)");const l=e.abstractClass?"abstract ":"";i.line(`public ${l}class ${a}${Ac(e,i,["Serializable"])} {`);const s=e.attributes.filter(u=>u.attrType!=="DIVIDER").sort((u,m)=>u.order-m.order),c=[];for(const u of s){if(u.attrType.startsWith("EMBED")){c.push(...Vc(u,e,n,o,i));continue}c.push(Tc(u,a,o,i))}return Rc(c,i,o.lombok!==!1),$c(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Ac(e,n,o=[]){const i=(e.declarationOfInterfaces??[]).map(s=>s.trim()).filter(Boolean),a=new Set(i.filter(s=>!s.includes("."))),r=[...i].sort().map(s=>{if(!s.includes("."))return s;const c=s.slice(s.lastIndexOf(".")+1);return a.has(c)?s:(n.import(s),c)}),l=[...o,...r];return l.length?` implements ${l.join(", ")}`:""}const Yy="net.g1project.bluecomm.annotation.PersonalInfo",qy="net.g1project.bluecomm.annotation.PersonalInfoAttribute",Wy="net.g1project.bluecomm.model.PersonalInfoAttributeType";function $c(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Ut(i.name)||Ut(a))continue;const r=a.replace(/\r\n/g,`
|
|
19
19
|
`).split(`
|
|
20
|
-
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(qy),n.import(Wy),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function Tc(e,n,o,i){const a=e.dbAttrs[0],r=e.name||Uy(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${n}.${r}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const l=Qi(e.type,e.customType,o,e.groupCode);for(const u of l.imports)i.import(u);for(const u of l.fillIns)i.fillIn(`${n}.${r}: ${u}`);const s=(a==null?void 0:a.multiValue)===!0,c=s?`Set<${l.type}>`:l.type;s&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${n}.${r}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const u of
|
|
20
|
+
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(qy),n.import(Wy),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function Tc(e,n,o,i){const a=e.dbAttrs[0],r=e.name||Uy(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${n}.${r}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const l=Qi(e.type,e.customType,o,e.groupCode);for(const u of l.imports)i.import(u);for(const u of l.fillIns)i.fillIn(`${n}.${r}: ${u}`);const s=(a==null?void 0:a.multiValue)===!0,c=s?`Set<${l.type}>`:l.type;s&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${n}.${r}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const u of Hr(a==null?void 0:a.logicalName," "))i.line(u);e.identifier&&(i.jpa("Id"),i.line(" @Id"),a!=null&&a.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(Je.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${ig(e,a,i)}`);for(const u of l.fieldAnnotations)i.line(` ${u}`);const d=!s&&(a==null?void 0:a.dataType)==="VARCHAR"?e.type==="PrimitiveBoolean"?"booleanYnPrimitive":e.type==="Boolean"?"booleanYnBoxed":null:null;if(d){const u=wc(o,d);u?(i.jpa("Convert"),i.line(` @Convert(converter = ${u}.class)`)):i.fillIn(`${n}.${r}: Y/N 문자 플래그 컨버터 비활성(converterCatalog) — boolean × VARCHAR 매핑 @Convert 손채움 필요`)}return s?(i.line(` // TODO [손채움]: ${r} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),bo(i,o.lombok!==!1),i.line(` private ${c} ${r} = new LinkedHashSet<>();`)):(bo(i,o.lombok!==!1),i.line(` private ${c} ${r};`)),{type:c,name:r,category:0}}function Mc(e,n,o){var r,l;if(e.attrType==="EMBED_PREDEF"){const s=(r=o.embeddableCatalog)==null?void 0:r.find(c=>c.type===e.type);return e.dbAttrs.map((c,d)=>{var u,m;return{fieldName:((u=s==null?void 0:s.fields[d])==null?void 0:u.name)??"",defaultPhysical:((m=s==null?void 0:s.fields[d])==null?void 0:m.physicalName)??""}})}const i=(l=e.embedded)!=null&&l.embeddableRef?n.entities.find(s=>s.modelId===e.embedded.embeddableRef):void 0,a=[];if(i)for(const s of i.attributes.filter(c=>c.attrType!=="DIVIDER"))for(const c of s.dbAttrs)c.physicalName&&a.push({fieldName:s.name,defaultPhysical:c.physicalName});return a}function Jy(e,n,o,i,a){const r=so(kn(n,o.entities)),l=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],u=Bn(s,r);if(!d||!d.fieldName){(u||s.physicalName&&s.physicalName!==(d==null?void 0:d.defaultPhysical))&&a.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${c}] @AttributeOverride 필드명 미해소(카탈로그/임베더블 확인)`);return}if(u){l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${u.physicalName}", insertable = false, updatable = false))`);return}const m=s.physicalName||d.defaultPhysical;m&&m!==d.defaultPhysical&&l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${m}"))`)}),l}function Ut(e){return!e||e.trim()===""}function Vc(e,n,o,i,a){var m,p,f,h;const r=n.name,l=Xo(n,o,i);if(Ut(e.name))return a.fillIn(`${r} 임베드: 속성명(필드명) 미지정 — @Embedded/@ElementCollection 방출 불가, 속성명을 채워야 함`),[];let s=e.type;if(e.attrType==="EMBED_OWN"){const g=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(k=>k.modelId===e.embedded.embeddableRef):void 0;if(g){s=g.name;const k=Xo(g,o,i);k&&k!==l&&a.import(`${k}.${g.name}`)}}if(Ut(s))return a.fillIn(`${r}.${e.name}: 임베드 대상 타입 미해소 — @Embedded/@ElementCollection 방출 불가`),[];if(e.type==="Money")return[Xy(e,n,o,i,a)];const c=Mc(e,o,i),d=Jy(e,n,o,c,a),u=$r(e,o.associations);if(a.line(""),u){const g=o.associations.find(I=>{var A;return I.modelId===((A=e.embedded)==null?void 0:A.associationRef)}),k=g?g.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?g.end2:g.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const N=(f=k==null?void 0:k.jpa)==null?void 0:f.collectionTable;N?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${N}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),Kr(d,a);const b=u==="SET";!b&&((h=k==null?void 0:k.jpa)!=null&&h.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${k.jpa.orderColumn}")`)),a.import(b?"java.util.Set":"java.util.List"),a.import(b?"java.util.LinkedHashSet":"java.util.ArrayList");const _=b?`Set<${s}>`:`List<${s}>`,E=b?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${_} ${e.name} = ${E};`),[{type:_,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),Kr(d,a),bo(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function Xy(e,n,o,i,a){a.jpa("Embedded"),a.import(Je.compositeType),a.import(Je.money),a.import(Je.moneyUserType);const r=Mc(e,o,i),l=so(kn(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var k,N;const u=((k=r[d])==null?void 0:k.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),m=Bn(c,l),p=((N=r[d])==null?void 0:N.defaultPhysical)||"",f=c.physicalName||"",h=c.insertable===!1||c.updatable===!1;if(!m&&!h&&(!f||f===p))return[];const g=[`name = "${m?m.physicalName:f||p}"`];return e.notNull&&g.push("nullable = false"),m?g.push("insertable = false","updatable = false"):(c.insertable===!1&&g.push("insertable = false"),c.updatable===!1&&g.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${g.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),Kr(s,a),bo(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function Kr(e,n){e.length!==0&&(n.jpa("AttributeOverride"),n.jpa("AttributeOverrides"),n.jpa("Column"),n.line(" @AttributeOverrides({"),e.forEach((o,i)=>n.line(` ${o}${i<e.length-1?",":""}`)),n.line(" })"))}function Zy(e,n,o,i){var m;i.jpa("Table");const a=((m=e.table)==null?void 0:m.physicalName)??"",r=e.indexes??[];if(r.length===0)return`@Table(name = "${a}")`;const l={embeddableCatalog:o.embeddableCatalog},s=new Map;for(const p of e.attributes)p.dbAttrs.forEach((f,h)=>s.set(f.modelId,Go(p,f,h,e,n,l)));for(const p of jo(e,o.superClassCatalog??[]))s.set(p.modelId,p.physicalName);const c=Tn(e.attributes),d=[];for(const p of r){const f=[];for(const g of p.columns){const k=s.get(c.canon(g.columnRef));if(!k){i.fillIn(`${e.name}.@Index(${p.name}): 컬럼 참조 미해소(${Ts(c,g.columnRef)}) — 카탈로그 확인`);continue}f.includes(k)||f.push(k)}if(!f.length)continue;const h=p.unique?", unique = true":"";d.push(`@Index(name = "${p.name}", columnList = "${f.join(", ")}"${h})`)}if(d.length===0)return`@Table(name = "${a}")`;if(i.jpa("Index"),d.length===1)return`@Table(name = "${a}", indexes = { ${d[0]} })`;const u=d.map(p=>` ${p}`).join(`,
|
|
21
21
|
`);return`@Table(name = "${a}", indexes = {
|
|
22
22
|
${u}
|
|
23
|
-
})`}function
|
|
23
|
+
})`}function Gr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Qy(e,n,o,i=0){var r,l;const a=o.get(n.end1.entityRef);if(e.derivedFrom){const s=a==null?void 0:a.attributes.find(c=>c.modelId===e.derivedFrom.sourceAttributeRef);if(s!=null&&s.dbAttrs[i])return s.dbAttrs[i].physicalName;if(s&&i>0)return(r=Bc(a)[i])==null?void 0:r.physicalName}return(l=Bc(a)[i])==null?void 0:l.physicalName}function eg(e,n,o){var a;const i=(a=e.derivedFrom)==null?void 0:a.associationRef;return i?n.attributes.some(r=>{var l;return r.modelId!==e.modelId&&r.attrType==="RELATION_OWN"&&((l=r.derivedFrom)==null?void 0:l.associationRef)===i&&o.has(r.modelId)}):!1}function Bc(e){return((e==null?void 0:e.attributes)??[]).filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).slice().sort((n,o)=>n.order-o.order).flatMap(n=>n.dbAttrs)}function tg(e,n,o,i){const a=n.modelId,r=o.attributes.filter(c=>{var d;return c.attrType==="RELATION_OWN"&&((d=c.derivedFrom)==null?void 0:d.associationRef)===a});if(r.length<=1)return[e];const l=i.get(n.end1.entityRef),s=c=>{const d=l==null?void 0:l.attributes.find(u=>{var m;return u.modelId===((m=c.derivedFrom)==null?void 0:m.sourceAttributeRef)});return d?d.order:Number.MAX_SAFE_INTEGER};return r.slice().sort((c,d)=>s(c)-s(d)||c.order-d.order)}function Dc(e,n,o,i,a){if(!e)return;const r=Xo(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function ng(e,n,o,i,a,r,l,s,c){var N;const d=i.get(n.end1.entityRef),u=(d==null?void 0:d.name)??n.end1.entityRef;if(Ut(e.name)||Ut(u))return c.fillIn(`${u||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @ManyToOne/@OneToOne 방출 불가`),null;const m=Gr(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),Dc(d,o,l,s,c);const p=n.end2.jpa,f=[];e.notNull&&f.push("optional = false"),p!=null&&p.fetchType&&(c.jpa("FetchType"),f.push(`fetch = FetchType.${p.fetchType}`)),(N=p==null?void 0:p.cascadeTypes)!=null&&N.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${p.cascadeTypes.map(b=>`CascadeType.${b}`).join(", ")} }`)),c.jpa("JoinColumn");const h=i.get(n.end2.entityRef),g=h?tg(e,n,h,i):[e],k=[];for(const b of g){const _=Math.max(1,b.dbAttrs.length);for(let E=0;E<_;E++){const I=b.dbAttrs[E],A=Qy(b,n,i,E),T=(I==null?void 0:I.physicalName)||A||"",L=[];T?L.push(`name = "${T}"`):c.fillIn(`${(h==null?void 0:h.name)??""}.${b.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),A&&L.push(`referencedColumnName = "${A}"`),b.notNull&&L.push("nullable = false"),(I==null?void 0:I.insertable)===!1&&L.push("insertable = false"),(I==null?void 0:I.updatable)===!1&&L.push("updatable = false"),k.push(`@JoinColumn(${L.join(", ")})`)}}return c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${f.length?`(${f.join(", ")})`:""}`),k.length===1?c.line(` ${k[0]}`):(c.jpa("JoinColumns"),c.line(` @JoinColumns({${k[0]},`),k.slice(1).forEach((b,_)=>{const E=_===k.length-2;c.line(` ${b}${E?"})":","}`)})),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),bo(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function og(e,n,o,i,a,r,l,s){const c=i.get(n.end2.entityRef),d=(c==null?void 0:c.name)??n.end2.entityRef;if(Ut(e.name)||Ut(d))return s.fillIn(`${d||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @OneToMany/@OneToOne 방출 불가`),null;const u=c==null?void 0:c.attributes.find(I=>I.modelId===n.end2.attributeRef),m=(u==null?void 0:u.name)??"";if(!m)return s.fillIn(`${e.name}: 반대편(${d})에 대응 관계 속성이 없어 @OneToMany/@OneToOne(mappedBy) 방출 불가 — 자식에 FK 속성을 만들거나 관계를 단방향으로 정리 필요(CHK-JPA-19)`),null;Dc(c,o,r,l,s);const p=Gr(n.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),bo(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const f=n.end1.jpa,h=n.end1.composition||n.end2.composition;let g=(f==null?void 0:f.cascadeTypes)??[],k=f==null?void 0:f.orphanRemoval;h&&g.length===0&&(g=["ALL"],k==null&&(k=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const N=[`mappedBy = "${m}"`];g.length&&(s.jpa("CascadeType"),N.push(`cascade = { ${g.map(I=>`CascadeType.${I}`).join(", ")} }`)),k&&N.push("orphanRemoval = true"),f!=null&&f.fetchType&&(s.jpa("FetchType"),N.push(`fetch = FetchType.${f.fetchType}`)),s.line(` @OneToMany(${N.join(", ")})`),f!=null&&f.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${f.orderBy}")`));const b=(f==null?void 0:f.collectionType)==="SET";s.import(b?"java.util.Set":"java.util.List"),s.import(b?"java.util.LinkedHashSet":"java.util.ArrayList");const _=b?`Set<${d}>`:`List<${d}>`,E=b?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${_} ${e.name} = ${E};`),{type:_,name:e.name,category:1,collection:!0}}function ig(e,n,o){o.jpa("Column");const i=[`name = "${(n==null?void 0:n.physicalName)??""}"`];if(e.notNull&&i.push("nullable = false"),n){const a=Rr.has(n.dataType);n.length!=null&&i.push(a?`precision = ${n.length}`:`length = ${n.length}`),n.scale!=null&&i.push(`scale = ${n.scale}`),n.insertable===!1&&i.push("insertable = false"),n.updatable===!1&&i.push("updatable = false"),n.unique&&i.push("unique = true")}return`@Column(${i.join(", ")})`}function ag(e,n,o){var l;const i=n.superClassCatalog??[],a=e.superClass||((l=i.find(s=>s.default))==null?void 0:l.name);if(!a||a==="Object")return"";const r=i.find(s=>s.name===a);return r!=null&&r.packageName?o.import(`${r.packageName}.${r.name}`):o.fillIn(`${e.name}: superClass '${a}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${a}`}function rg(e,n,o,i){i.import(Je.serializable),i.import(Je.objects),i.import(Je.jsonUtils),o&&i.import(Je.lombokGetter),i.line(""),i.line(` public static class ${e} implements Serializable {`);for(const a of n)i.line(""),o&&i.line(" @Getter"),i.line(` private ${a.type} ${a.name};`);i.line(""),i.line(` protected ${e}() {`),i.line(" }"),i.line(""),i.line(` public ${e}(${n.map(a=>`${a.type} ${a.name}`).join(", ")}) {`);for(const a of n)i.line(` this.${a.name} = ${a.name};`);if(i.line(" }"),!o)for(const a of n)i.line(""),i.line(` public ${a.type} get${xc(a.name)}() {`),i.line(` return ${a.name};`),i.line(" }");i.line(""),i.line(" @Override"),i.line(" public int hashCode() {"),i.line(` return Objects.hash(${n.map(a=>a.name).join(", ")});`),i.line(" }"),i.line(""),i.line(" @Override"),i.line(" public boolean equals(Object obj) {"),i.line(" if (this == obj) {"),i.line(" return true;"),i.line(" }"),i.line(" if (obj == null) {"),i.line(" return false;"),i.line(" }"),i.line(" if (getClass() != obj.getClass()) {"),i.line(" return false;"),i.line(" }"),i.line(` ${e} other = (${e}) obj;`),i.line(` return ${n.map(a=>`Objects.equals(this.${a.name}, other.${a.name})`).join(" && ")};`),i.line(" }"),i.line(""),i.line(` public static ${e} getPK(String stringId) {`),i.line(` return JSONUtils.readValue(stringId, ${e}.class);`),i.line(" }"),i.line(" }")}function lg(e,n,o){const i=[`${o}.${e}`,`${o}.${e}.${n}`,Je.jpaRepository,Je.querydslExecutor].sort(),a=[`package ${o};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${n}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
24
24
|
`)+`
|
|
25
25
|
`}}function sg(e,n,o){const i=[`${n}.${e}`,Je.jpaRepository,Je.querydslExecutor].sort(),a=[`package ${n};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
26
26
|
`)+`
|
|
27
|
-
`}}const ea="com.example",cg="command.domain";function Xo(e,n,o={}){const i=Yi(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??cg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const dg="CustomMoneyType",ug="Money";function mg(e){return!(e.type!==dg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function fg(e){const n=e.dbAttrs[0]??{modelId:Me(),physicalName:"",dataType:""},o={modelId:Me(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:ug,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function pg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>mg(l)?(a=!0,n=!0,fg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function hg(e,n){const o=new Map,i=[],a=new Map;for(const h of e.entities){const g=new Map,k=new Map,N=new Map,b=(_,E,I)=>{if(!_)return;o.get(_)||o.set(_,[{entityId:E,assignedId:_}]),i.push({id:_,entityId:E,sink:I}),I(_)};for(const _ of h.attributes){b(_.modelId,h.modelId,E=>g.set(_,E));for(const E of _.dbAttrs)b(E.modelId,h.modelId,I=>k.set(E,I))}for(const _ of h.indexes??[])b(_.modelId,h.modelId,E=>N.set(_,E));a.set(h,{attrs:g,cols:k,idx:N})}const r=new Set(o.keys()),l=new Map;for(const h of i){const g=(l.get(h.id)??0)+1;if(l.set(h.id,g),g===1)continue;const k=yg(h.id,g-1,r);r.add(k),o.get(h.id).push({entityId:h.entityId,assignedId:k}),h.sink(k)}const s=[...o.values()].reduce((h,g)=>h+Math.max(0,g.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(h,g)=>{var N;if(!g||!h)return g;const k=o.get(g);return!k||k.length<2?g:((N=k.find(b=>b.entityId===h))==null?void 0:N.assignedId)??g},d=new Map(e.associations.map(h=>[h.modelId,h])),u=(h,g)=>{const k=d.get(h);if(k)return k.end1.entityRef===g?k.end2.entityRef:k.end1.entityRef},m=e.entities.map(h=>{var _;const g=a.get(h),k=h.attributes.map(E=>{const I=g.attrs.get(E),A=E.dbAttrs.map(x=>{const R=g.cols.get(x);return R===x.modelId?x:{...x,modelId:R}});let T=E.derivedFrom;if(T){const x=u(T.associationRef,h.modelId),R=c(x,T.sourceAttributeRef);R!==T.sourceAttributeRef&&(T={...T,sourceAttributeRef:R})}return I!==E.modelId||T!==E.derivedFrom||A.some((x,R)=>x!==E.dbAttrs[R])?{...E,modelId:I,dbAttrs:A,derivedFrom:T}:E}),N=(_=h.indexes)==null?void 0:_.map(E=>{const I=g.idx.get(E),A=E.columns.map(L=>{const x=c(h.modelId,L.columnRef);return x===L.columnRef?L:{...L,columnRef:x}});return I!==E.modelId||A.some((L,x)=>L!==E.columns[x])?{...E,modelId:I,columns:A}:E});return k.some((E,I)=>E!==h.attributes[I])||N&&h.indexes&&N.some((E,I)=>E!==h.indexes[I])?{...h,attributes:k,...N?{indexes:N}:{}}:h}),p=e.associations.map(h=>{const g=c(h.end1.entityRef,h.end1.attributeRef),k=c(h.end2.entityRef,h.end2.attributeRef);return g===h.end1.attributeRef&&k===h.end2.attributeRef?h:{...h,end1:g===h.end1.attributeRef?h.end1:{...h.end1,attributeRef:g},end2:k===h.end2.attributeRef?h.end2:{...h.end2,attributeRef:k}}}),f=n.associationLayouts.map(h=>{const g=d.get(h.associationRef);if(!g)return h;const k=c(g.end1.entityRef,h.sourceColumnRef),N=c(g.end2.entityRef,h.targetColumnRef);return k===h.sourceColumnRef&&N===h.targetColumnRef?h:{...h,sourceColumnRef:k,targetColumnRef:N}});return{logical:{...e,entities:m,associations:p},layout:f.some((h,g)=>h!==n.associationLayouts[g])?{...n,associationLayouts:f}:n,reissued:s}}function yg(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function Rt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Gr(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function Oc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Lc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Oc);if(!i.length)continue;const a=o.filter(s=>!Oc(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),n.attributes=l}}function _o(e){return JSON.parse(JSON.stringify(e))}function Pc(e,n,o){var L;const i=o.idFactory??Me,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const x=new Set(n);for(const R of r.associations){const $=x.has(R.end1.entityRef),B=x.has(R.end2.entityRef);$!==B&&s.add($?R.end2.entityRef:R.end1.entityRef)}}const c=r.entities.filter(x=>s.has(x.modelId)),d=new Set(c.map(x=>x.modelId)),u=r.associations.filter(x=>d.has(x.end1.entityRef)&&d.has(x.end2.entityRef)),m=new Set(u.map(x=>x.modelId)),p=new Map,f=x=>{let R=p.get(x);return R||(R=i(),p.set(x,R)),R};for(const x of c){f(x.modelId);for(const R of x.attributes){f(R.modelId);for(const $ of R.dbAttrs)f($.modelId)}for(const R of x.indexes??[])f(R.modelId);for(const R of x.operations??[])f(R.modelId)}for(const x of u)f(x.modelId);const h=x=>p.get(x),g=c.map(x=>{const R=_o(x);R.modelId=h(x.modelId),R.attributes=R.attributes.map($=>gg($,h,m,d));for(const $ of R.indexes??[])$.modelId=h($.modelId),$.columns=$.columns.map(B=>Mn(B.columnRef)?B:{...B,columnRef:h(B.columnRef)}).filter(B=>B.columnRef!==void 0);for(const $ of R.operations??[])$.modelId=h($.modelId);return R});Lc(g);const k=u.map(x=>{const R=_o(x);return R.modelId=h(x.modelId),R.end1=zc(R.end1,h),R.end2=zc(R.end2,h),R}),N=[];for(const x of r.groups){const R=x.memberEntityRefs.filter(B=>d.has(B));if(R.length===0)continue;const $=_o(x);$.modelId=f(x.modelId),$.memberEntityRefs=R.map(B=>h(B)),N.push($)}const b=o.collisionSuffix??"_imported",_=new Set(o.existing.entities.map(x=>x.name)),E=new Set(o.existing.entities.map(x=>{var R;return(R=x.table)==null?void 0:R.physicalName}).filter(x=>!!x));for(const x of g)_.has(x.name)&&(x.name=`${x.name}${b}`),(L=x.table)!=null&&L.physicalName&&E.has(x.table.physicalName)&&(x.table.physicalName=`${x.table.physicalName}${b}`);const I=[];for(const x of l.entityLayouts){const R=h(x.entityRef);if(!R)continue;const $=_o(x);$.entityRef=R,$.geo={...$.geo,location:Yr($.geo.location,a)},$.attributeStyles&&($.attributeStyles=ta($.attributeStyles,h)),$.operationStyles&&($.operationStyles=ta($.operationStyles,h)),I.push($)}const A=[];for(const x of l.associationLayouts){const R=h(x.associationRef);if(!R)continue;const $=_o(x);$.associationRef=R,$.sourceColumnRef=x.sourceColumnRef?h(x.sourceColumnRef):void 0,$.targetColumnRef=x.targetColumnRef?h(x.targetColumnRef):void 0,$.waypoints=$.waypoints.map(B=>Yr(B,a)),A.push($)}const T=[];for(const x of l.groupLayouts){const R=h(x.groupRef);if(!R)continue;const $=_o(x);$.groupRef=R,$.geo={...$.geo,location:Yr($.geo.location,a)},delete $.memberNoteRefs,T.push($)}return{logical:{entities:g,associations:k,groups:N},layout:{entityLayouts:I,associationLayouts:A,groupLayouts:T},idMap:p}}function Yr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function gg(e,n,o,i){e.modelId=n(e.modelId);for(const a of e.dbAttrs)if(a.modelId=n(a.modelId),a.sharedColumnRef!==void 0){const r=n(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:n(e.derivedFrom.associationRef),sourceAttributeRef:n(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:n(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:n(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function zc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function ta(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function qr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function Pn(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>Pn(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!Pn(e[i],n[i]))return!1;return!0}return!1}function zn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||Pn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Fn(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function bg(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const _g=new Set(["attributes","operations","indexes","rev"]),kg=new Set(["end1","end2","rev"]),Eg=new Set(["memberEntityRefs","rev"]),Fc=new Set(["modelId"]),Ng=new Set(["modelId","columns"]),wg=new Set([]);function Ig(e,n,o,i){const a=Fn(n.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=zn(s,c,Fc);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Fn(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=zn(s,c,Fc);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Fn(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!Pn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=zn(s,c,Ng);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function vg(e,n,o){const i=Fn(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:qr(l)});for(const{cur:l,tgt:s}of i.common){const c=zn(l,s,_g);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Ig(l.modelId,l,s,o)}const a=Fn(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:qr(l)});for(const{cur:l,tgt:s}of a.common){const c=zn(l,s,kg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=zn(l[d]??{},s[d]??{},wg);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=Fn(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:qr(l)});for(const{cur:l,tgt:s}of r.common){const c=zn(l,s,Eg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=bg(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function na(e,n,o,i,a,r,l){const s=Fn(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)Pn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function xg(e,n,o){na(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),na(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),na(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),na(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Cg(e,n){const o=[];return vg(e.logical,n.logical,o),xg(e.layout,n.layout,o),o}function Sg(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const Rg={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class Ag{constructor(n){Xe(this,"out",[]);Xe(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...Zo(n),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(n,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...Zo(n),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...Zo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...Zo(n),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(n,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...Zo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Zo(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Ht(e,n,o,i){if(o==null||typeof o!="object")return;const a=Rg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Un(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Wr(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function En(e,n){var r,l,s,c,d,u,m,p;const o=Sg(n),i=new Ag(n.field),a=[...e].sort((f,h)=>f.seq-h.seq);for(const f of a)for(const h of f.ops)switch(o){case"entity":if(h.entityRef!==n.entityRef)break;h.kind==="entity.add"?Ht(i,f,h.value,"entity"):h.kind==="entity.update"?Un(i,f,h.patch):h.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Wr((r=h.value)==null?void 0:r.attributes,n.attributeRef);g&&Ht(i,f,g,"attribute")}else h.kind==="attribute.add"&&((l=h.value)==null?void 0:l.modelId)===n.attributeRef?Ht(i,f,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===n.attributeRef?Un(i,f,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===n.attributeRef||h.kind==="entity.remove")&&i.remove(f);break;case"operation":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Wr((s=h.value)==null?void 0:s.operations,n.operationRef);g&&Ht(i,f,g,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===n.operationRef?Ht(i,f,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===n.operationRef?Un(i,f,h.patch):(h.kind==="operation.remove"&&h.operationRef===n.operationRef||h.kind==="entity.remove")&&i.remove(f);break;case"index":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Wr((d=h.value)==null?void 0:d.indexes,n.indexRef);g&&Ht(i,f,g,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===n.indexRef?Ht(i,f,h.value,"index"):h.kind==="index.update"&&h.indexRef===n.indexRef?Un(i,f,h.patch):(h.kind==="index.remove"&&h.indexRef===n.indexRef||h.kind==="entity.remove")&&i.remove(f);break;case"association":if(h.associationRef!==n.associationRef)break;h.kind==="association.add"?Ht(i,f,h.value,"association"):h.kind==="association.update"?Un(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(h.associationRef!==n.associationRef)break;if(h.kind==="association.add"){const g=(m=h.value)==null?void 0:m[n.end];Ht(i,f,g,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===n.end?Un(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"group":if(h.groupRef!==n.groupRef)break;if(h.kind==="group.add"){Ht(i,f,h.value,"group");const g=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(g))for(const k of g)i.member(f,k,!1)}else h.kind==="group.update"?Un(i,f,h.patch):h.kind==="group.remove"?i.remove(f):h.kind==="group.addMember"&&h.entityRef!=null?i.member(f,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(f,h.entityRef,!0);break}return i.result()}const qe={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},$g={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":qe,"entityLayout.remove":qe,"entityLayout.move":qe,"entityLayout.resize":qe,"entityLayout.setCollapsed":qe,"entityLayout.setLocked":qe,"entityLayout.setStyle":qe,"entityLayout.setAttrStyle":qe,"entityLayout.setOpStyle":qe,"groupLayout.add":qe,"groupLayout.remove":qe,"groupLayout.move":qe,"groupLayout.resize":qe,"groupLayout.setLocked":qe,"groupLayout.setStyle":qe,"groupLayout.addNoteMember":qe,"groupLayout.removeNoteMember":qe,"associationLayout.add":qe,"associationLayout.remove":qe,"associationLayout.setWaypoints":qe,"note.add":qe,"note.remove":qe,"note.move":qe,"note.resize":qe,"note.setMemo":qe,"note.setStyle":qe,"noteConnection.add":qe,"noteConnection.remove":qe,"noteConnection.setWaypoints":qe},At=e=>typeof e=="string"?e:void 0,Tg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Uc(e){return At(e.containerRef)??At(e.entityRef)}function Jr(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=At(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function Xr(e){const n=$g[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=At(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Jr(o,"attributes","attribute",a),...Jr(o,"operations","operation",a),...Jr(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Uc(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?Tg(o):At(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=At(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=At(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Mg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=At(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Uc(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=At(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=At(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function Vg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Bg(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of Xr(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function oa(e,n){return e.map(o=>({...o,subject:n}))}function Hc(e,n){const o=e.filter(s=>s.ops.some(c=>Vg(c,n))),{attributes:i,operations:a,indexes:r}=Bg(o,n),l=[...oa(En(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...oa(En(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...oa(En(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...oa(En(o,{entityRef:n,indexRef:s}),{kind:"index",ref:s}));return l.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function Zr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Dg(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of Xr(i))a.existence==="add"&&n.add(Zr(a.subject));return n}function Og(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=Mg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Lg(e){const{entities:n,associations:o,groups:i}=Og(e),a=[];for(const r of n)for(const l of Hc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of En(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of En(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of En(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function Qr(e){const n=Lg(e),o=Dg(e),i=new Map;for(const l of n){const s=Zr(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of n){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=Zr(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}function jc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Pg(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of Xr(r)){if(!l.existence||l.inline)continue;const s=l.subject;zg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const zg=new Set(["attribute","operation","index"]);function el(e,n){const{fromSeq:o}=n,i=Qr(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const p=jc(m.subject);let f=s.get(p);f||(f={subject:m.subject,evs:[]},s.set(p,f)),f.evs.push(m)};for(const m of l)for(const p of m.actions)c({seq:m.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const m of Pg(e,o,r)){const p=s.get(jc(m.subject));p!=null&&p.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,h)=>f.seq-h.seq);const p=m.evs[m.evs.length-1];m.subject.kind==="entity"&&p.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const p=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||p&&f)continue;const h=new Map;let g=null;for(const N of m.evs){N.verb==="add"&&g!==null&&g!=="add"&&h.clear(),g=N.verb;for(const b of N.fields){const _=h.get(b.field);_?_.lastValue=b.value:h.set(b.field,{firstOld:b.oldValue,hasOld:b.oldValue!==void 0,lastValue:b.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const N=[];for(const[b,_]of h)N.push({field:b,value:_.lastValue});d.push({subject:m.subject,verb:"added",fields:N});continue}const k=[];for(const[N,b]of h)b.hasOld&&Pn(b.firstOld,b.lastValue)||k.push({field:N,value:b.lastValue,...b.hasOld?{oldValue:b.firstOld}:{}});k.length!==0&&d.push({subject:m.subject,verb:"modified",fields:k})}return{fromSeq:o,toSeq:r,entries:d}}function Kc(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class tl{constructor(n){Xe(this,"undoStack",[]);Xe(this,"redoStack",[]);Xe(this,"savePoint",null);Xe(this,"listeners",new Set);Xe(this,"commandListeners",new Set);Xe(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function Nt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Gc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function mt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function $t(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function Qe(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function nn(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function ia(e,n,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:n,...o})},invert(i){const a=Gc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=mt(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Yc(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Gc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=mt(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(p=>p.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function qc(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=Qe(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(Qe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(o)}]}}}}function Wc(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=Qe(i,e);o=a.name,a.name=n},invert(i){Qe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function ko(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=mt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Jc(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=mt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Qo(e,n){const o={...(e==null?void 0:e.properties)??{}};return n?o.swatch=n:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function Xc(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=Qo(r.style,n)},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=mt(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function Zc(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Qc(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function nl(e){let n=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){n=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=n[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:n[l]}})}),{forward:i,invert:a}}}}function aa(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=Qo(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function ra(e,n,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:n,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function ed(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(o)}]}}}}function td(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function nd(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function la(e,n){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,n)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}}}}function od(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function id(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function ad(e,n){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Qo(a.style,n)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function rd(e,n){let o;return{label:n?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=n},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function jt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){Qe(o,e).attributes.push(n)},invert(o){const i=Qe(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function on(e,n,o){const i={},a=r=>{const l=Qe(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(i)}]}}}}function ld(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=Qe(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&Qe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function sd(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function ol(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Qe(a,e);i=r.attributes.map(s=>({...s}));const l=Gr([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&Qe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).attributes;return sd("attribute.update","attributeRef",e,r,i??[])}}}function cd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=Qe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=Qe(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function dd(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(i)}]}}}}function ud(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Qe(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=Qe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function md(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Qe(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Gr([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=Qe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).operations??[];return sd("operation.update","operationRef",e,r,i??[])}}}function fd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=Qo(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function sa(e,n){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(n)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:n,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function pd(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function ca(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(o)}]}}}}function Tt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(i)}]}}}}function hd(e,n){return{label:"인덱스 추가",apply(o){const i=Qe(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=Qe(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function da(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(i)}]}}}}function yd(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Qe(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&Qe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Kt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ei=(e,n)=>{var o;return((o=$t(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function gd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=$t(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=$t(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ei(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Kt(e,r)],invert:[Kt(e,l)]}}}}function bd(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=$t(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=$t(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ei(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Kt(e,a)],invert:[Kt(e,r)]}}}}function _d(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=$t(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=$t(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Kt(e,ei(a,e))],invert:[Kt(e,i??[])]}}}}function kd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=$t(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=$t(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Kt(e,ei(o,e))],invert:[Kt(e,n??[])]}}}}function Ed(e,n,o){return{label:"waypoint 추가",apply(i){const a=$t(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=$t(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ei(i,e),r=a.slice();return r.splice(n,1),{forward:[Kt(e,a)],invert:[Kt(e,r)]}}}}function Nd(e){return{label:"노트 추가",apply(n){n.layout.notes.push(e)},invert(n){const o=n.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&n.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function wd(e){let n=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);n={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){n&&o.layout.notes.splice(n.index,0,n.item)},emitOps(){return n?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:n.item}]}:{forward:[],invert:[]}}}}function ti(e,n){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Id(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function vd(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function xd(e,n){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Qo(a.style,n)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Cd(e,n){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(n)&&(l.memberNoteRefs.push(n),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(n);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}:{forward:[],invert:[]}}}}function Sd(e,n){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(n))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,n))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}}}}const Nn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),ua=(e,n,o)=>{var i;return((i=nn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Rd(e,n){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===n)){o=!1;return}r.connections.push({targetRef:n,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===n);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:{targetRef:n,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}]}:{forward:[],invert:[]}}}}function Ad(e,n){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===n))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${n}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:o.item}]}:{forward:[],invert:[]}}}}function $d(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=nn(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=nn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=ua(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Nn(e,n,l)],invert:[Nn(e,n,s)]}}}}function Td(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=nn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=nn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=ua(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Nn(e,n,r)],invert:[Nn(e,n,l)]}}}}function Md(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=nn(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=nn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=ua(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Nn(e,n,r)],invert:[Nn(e,n,l)]}}}}function Vd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=nn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=nn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Nn(e,n,ua(i,e,n))],invert:[Nn(e,n,o??[])]}}}}function We(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const Fg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:sa,addAttribute:jt,addEntity:ia,addEntityToGroup:nd,addGroup:ra,addIndex:hd,addNote:Nd,addNoteConnection:Rd,addNoteConnectionWaypoint:Td,addNoteToGroup:Cd,addOperation:cd,addWaypoint:Ed,clearNoteConnectionWaypoints:Vd,clearWaypoints:kd,composite:We,moveEntity:ko,moveGroup:od,moveNote:ti,moveNoteConnectionWaypoint:$d,moveWaypoint:gd,removeAssociation:pd,removeAttribute:ld,removeEntity:Yc,removeEntityFromGroup:la,removeGroup:td,removeIndex:yd,removeNote:wd,removeNoteConnection:Ad,removeNoteConnectionWaypoint:Md,removeNoteFromGroup:Sd,removeOperation:ud,removeWaypoint:bd,renameEntity:Wc,reorderAttributes:ol,reorderOperations:md,resizeEntity:Jc,resizeGroup:id,resizeNote:Id,setAllEntitiesCollapsed:nl,setAttributeSwatch:aa,setEntityCollapsed:Zc,setEntityLocked:Qc,setEntitySwatch:Xc,setGroupLocked:rd,setGroupSwatch:ad,setNoteMemo:vd,setNoteSwatch:xd,setOperationSwatch:fd,translateWaypoints:_d,updateAssociation:ca,updateAssociationEnd:Tt,updateAttribute:on,updateEntity:qc,updateGroup:ed,updateIndex:da,updateOperation:dd},Symbol.toStringTag,{value:"Module"}));class Bd{constructor(){Xe(this,"revs",new Map);Xe(this,"layoutVersion",0);Xe(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const Ug=[400,1200];function Hg(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function jg(e){const n=Hg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Kg=e=>new Promise(n=>setTimeout(n,e));class Dd{constructor(n){Xe(this,"cache",new Bd);Xe(this,"newClientOpId");Xe(this,"debounceMs");Xe(this,"retryDelaysMs");Xe(this,"emissions",new WeakMap);Xe(this,"open",null);Xe(this,"debounceHandle",null);Xe(this,"queue",[]);Xe(this,"sending",!1);Xe(this,"_frozen",!1);Xe(this,"stack",null);Xe(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Me,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??Ug}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!jg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Kg(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const Od=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Ld=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Pd(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function Gg(e){return e.flatMap(n=>n.dbAttrs).length}function zd(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function Yg(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=Go(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function qg(e,n,o=Me){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Gg(i.attributes);if(a===0)return[];const r=zd(e,n),l=i.attributes.flatMap(c=>c.dbAttrs),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;Yg(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function Fd(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const h=r.get(f);if(!h)return[];l.push(h)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,h)=>f===c[h]))return[];const d=new Map(s.map((f,h)=>[f,h])),u=zd(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const g=c.map(N=>h.dbAttrs[d.get(N)]),k=g.reduce((N,b,_)=>b===h.dbAttrs[_]?N:N+1,0);k&&m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:g,moved:k})}return m}function Wg(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Jg(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Ud(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function yt(e,n){const o=Wg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>Qg(i,e))}}function Xg(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function il(e,n){const o=Xg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function al(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const Zg=new Set(["name","description","packageName","excludeDDLGeneration"]);function Qg(e,n){var a;const o=Yi(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(p=>p.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function Hd(e,n){const o=Jg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function eb(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function tb(e,n){const o=eb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function jd(e,n){const o=e.filter(i=>i.physicalName===n.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function rl(e){return e.by!==void 0&&e.by!=="name"}function nb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function ob(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function ib(e,n){const o=nb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Kd(e,n){const o=ob(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Gd(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Yd(e){return Gd(e)&&e.dataType==null}function qd(e,n,o){const i=Gd(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function Wd(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let p=!1;for(const f of n.fields){const h=u.get(f.name);if(h!=null&&h.sharedColumnPhysicalName){const g={ref:h.sharedColumnPhysicalName,by:"physicalName"},k=jd(kn(i,a),g);if(!k.ok){s.push(k.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:k.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:k.value.modelId});continue}m.push({modelId:c(),physicalName:(h==null?void 0:h.physicalName)??"",dataType:"",...h!=null&&h.length?{length:h.length}:{},...h!=null&&h.scale?{scale:h.scale}:{},...(h==null?void 0:h.insertable)!=null?{insertable:h.insertable}:{},...(h==null?void 0:h.updatable)!=null?{updatable:h.updatable}:{}})}return p?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}const ab=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),rb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),lb=new Set(["description","identifying"]),sb=new Set(["multiplicity","navigable","composition"]),cb=new Set(["name","unique","description","parameters"]),db=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Eo(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const ll=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),ub=new Set([...ll].filter(e=>e!=="sharedColumnRef"));function mb(e,n,o,i){if(i||o.some(l=>!ub.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))ll.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function fb(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,p)=>{const f=n.fields[p],h=f?c.get(f.name):void 0;if(!h){d.push(m);return}if(h.sharedColumnPhysicalName){const k={ref:h.sharedColumnPhysicalName,by:"physicalName"},N=jd(kn(i,a),k);if(!N.ok){s.push(N.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:k}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:k,matches:N.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:N.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...h.physicalName!=null?{physicalName:h.physicalName}:{},...h.length!=null?{length:h.length}:{},...h.scale!=null?{scale:h.scale}:{},...h.insertable!=null?{insertable:h.insertable}:{},...h.updatable!=null?{updatable:h.updatable}:{}})}),u?null:d}function Jd(e,n,o){return{modelId:o(),name:e.name,order:n,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Xd(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=tb(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:n.name,unique:n.unique??!1,columns:l,...n.description?{description:n.description}:{},...n.parameters?{parameters:n.parameters}:{}}}function No(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function pb(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Pd(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function sl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of _c(n,o,i)){for(const u of c.remove)No(e,a,s,u);for(const u of c.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:s,entityRef:s,attributeRef:u.attributeId,patch:u.patch});const d=((l=n.entities.find(u=>u.modelId===s))==null?void 0:l.attributes)??[];for(const u of c.add)e.push({kind:"attribute.add",casUnit:"logical",containerRef:s,entityRef:s,value:{...u,order:r(s,d)}})}}function hb(e,n,o={}){const i=o.mkId??Me,a=o.embeddableCatalog??[],r=b=>a.find(_=>_.type===b),l=[],s=[],c=new Map,d=(b,_)=>{const E=c.get(b)??Rt(_);return c.set(b,E+1),E},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},h=new Set,g=(b,_)=>`${b}\0${_}`,k=new Set;for(const b of n)b.kind==="entity.add"&&(k.add(b.spec.name),b.spec.physicalName&&k.add(b.spec.physicalName));const N=new Set;return n.forEach((b,_)=>{var E,I,A,T,L;switch(b.kind){case"entity.add":{const x=e.entities.filter(v=>v.name===b.spec.name).map(v=>v.modelId);if(x.length||N.has(b.spec.name)){s.push({code:"entity-name-conflict",opIndex:_,handle:{ref:b.spec.name},matches:x});break}N.add(b.spec.name);const R=i(),$={modelId:R,name:b.spec.name,stereotype:b.spec.stereotype??"JPA_ENTITY",attributes:[],...b.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...b.spec.physicalName?{table:{physicalName:b.spec.physicalName}}:{}},B={ref:b.spec.name};let O=!1;for(const[v,M]of(b.spec.attributes??[]).entries()){if(M.type==="GroupCodeEnum"&&!M.groupCode){s.push({code:"groupcode-required",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0;continue}if(!r(M.type)&&!((E=M.embeddableOverrides)!=null&&E.length)&&Yd(M)){s.push({code:"datatype-required",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0;continue}const D=r(M.type);if(D){const U=Wd(M,D,v,$,e.entities,_,B,s,i);U?$.attributes.push(U):O=!0}else(I=M.embeddableOverrides)!=null&&I.length?(s.push({code:"embeddable-type-unresolved",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0):$.attributes.push(qd(M,v,i))}const y=(b.spec.operations??[]).map((v,M)=>Jd(v,M,i));y.length&&($.operations=y);const w=[];for(const v of b.spec.indexes??[]){const M=Xd($,v,_,B,s,i);M?w.push(M):O=!0}if(w.length&&($.indexes=w),O)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:R,value:$});break}case"entity.update":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Eo(b.patch,rb,["jpaAttrs.","table."]);if(R.length){s.push({code:"entity-patch-unknown-key",opIndex:_,entity:b.entity,keys:R});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:b.patch});break}case"entity.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=x.value.modelId,$=e.associations.filter(w=>w.end1.entityRef===R||w.end2.entityRef===R),B=new Set($.map(w=>w.modelId));for(const w of $)m.has(w.modelId)||(m.add(w.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:w.modelId}));for(const w of e.entities)if(w.modelId!==R)for(const v of w.attributes)v.embedded&&B.has(v.embedded.associationRef)&&No(l,f,w.modelId,v.modelId);for(const w of $){if(w.end1.entityRef===R||!w.end1.attributeRef)continue;const v=e.entities.find(D=>D.modelId===w.end1.entityRef),M=v==null?void 0:v.attributes.find(D=>D.modelId===w.end1.attributeRef&&D.attrType==="RELATION_REF");M&&No(l,f,v.modelId,M.modelId)}const O={...e,entities:e.entities.filter(w=>w.modelId!==R),associations:e.associations.filter(w=>!B.has(w.modelId))},y=new Set($.filter(w=>w.end1.entityRef===R&&w.end2.entityRef!==R).map(w=>w.end2.entityRef));for(const w of y)sl(l,O,w,i,f,d);for(const w of e.groups)w.memberEntityRefs.includes(R)&&(h.has(g(w.modelId,R))||(h.add(g(w.modelId,R)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:w.modelId,groupRef:w.modelId,entityRef:R})));p.add(R),l.push({kind:"entity.remove",casUnit:"logical",entityRef:R});break}case"attribute.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(b.spec.type==="GroupCodeEnum"&&!b.spec.groupCode){s.push({code:"groupcode-required",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}if(!r(b.spec.type)&&!((A=b.spec.embeddableOverrides)!=null&&A.length)&&Yd(b.spec)){s.push({code:"datatype-required",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}const R=d(x.value.modelId,x.value.attributes),$=r(b.spec.type);let B;if($)B=Wd(b.spec,$,R,x.value,e.entities,_,b.entity,s,i);else if((T=b.spec.embeddableOverrides)!=null&&T.length){s.push({code:"embeddable-type-unresolved",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}else B=qd(b.spec,R,i);if(!B)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:B});break}case"attribute.update":case"attribute.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Hd(x.value,b.attribute);if(!R.ok){s.push(R.reason==="not-found"?{code:"attribute-not-found",opIndex:_,entity:b.entity,handle:b.attribute}:{code:"attribute-ambiguous",opIndex:_,entity:b.entity,handle:b.attribute,matches:R.matches});break}if(b.kind==="attribute.update"){const $=[],B=[];let O=!1;for(const M of Object.keys(b.patch)){if(M.includes(".")){M.startsWith("dbAttrs.")?O=!0:B.push(M);continue}ll.has(M)?$.push(M):ab.has(M)||B.push(M)}if(B.length){s.push({code:"attribute-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.attribute,keys:B});break}if("attrType"in b.patch){const M=String(b.patch.attrType),D=Ld.includes(M)?M!==R.value.attrType?"transition":void 0:"unknown-value";if(D){s.push({code:"attribute-attrtype-unsupported",opIndex:_,entity:b.entity,handle:b.attribute,reason:D,current:R.value.attrType,requested:M});break}}const y="type"in b.patch?b.patch.type:R.value.type,w="groupCode"in b.patch?b.patch.groupCode:R.value.groupCode;if(y==="GroupCodeEnum"&&!w){s.push({code:"groupcode-required",opIndex:_,entity:b.entity,handle:b.attribute});break}let v=b.patch;if($.length){const M=mb(R.value,b.patch,$,O);if(!M){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:_,entity:b.entity,handle:b.attribute,keys:$});break}v=M}if((L=b.embeddableOverrides)!=null&&L.length){const M=r(R.value.type);if(!M||R.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:_,entity:b.entity,handle:b.attribute});break}const D=fb(R.value,M,b.embeddableOverrides,x.value,e.entities,_,b.entity,s);if(!D)break;v={...v,dbAttrs:D}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:R.value.modelId,patch:v})}else{const $=Ji(e,x.value.modelId,R.value.modelId);if($){const B=O=>{var y;return((y=e.entities.find(w=>w.modelId===O))==null?void 0:y.name)??O};s.push({code:"attribute-fk-managed",opIndex:_,entity:b.entity,handle:b.attribute,association:{from:B($.end1.entityRef),to:B($.end2.entityRef)}});break}No(l,f,x.value.modelId,R.value.modelId)}break}case"association.add":{const x=yt(e,b.spec.from),R=yt(e,b.spec.to);if(x.ok||s.push(gt(x.reason,_,b.spec.from,x.matches,k)),R.ok||s.push(gt(R.reason,_,b.spec.to,R.matches,k)),!x.ok||!R.ok)break;if(b.spec.identifying&&x.value.modelId===R.value.modelId){s.push({code:"self-identifying",opIndex:_,handle:{from:b.spec.from,to:b.spec.to}});break}const $=i(),B={modelId:$,...b.spec.identifying!=null?{identifying:b.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:b.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:R.value.modelId,multiplicity:b.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:b.spec.composition??!1}},O={...e,associations:[...e.associations,B]},y=Wo(O,R.value.modelId,i);y.add[0]&&(B.end2.attributeRef=y.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:$,value:B});for(const w of y.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:{...w,order:d(R.value.modelId,R.value.attributes)}});break}case"association.remove":{const x=yt(e,b.association.from),R=yt(e,b.association.to);if(x.ok||s.push(gt(x.reason,_,b.association.from,x.matches,k)),R.ok||s.push(gt(R.reason,_,b.association.to,R.matches,k)),!x.ok||!R.ok)break;const $=Ud(e,x.value.modelId,R.value.modelId);if($.length!==1){s.push($.length===0?{code:"association-not-found",opIndex:_,handle:b.association}:{code:"association-ambiguous",opIndex:_,handle:b.association,matches:$.map(w=>w.modelId)});break}const B=$[0];m.has(B.modelId)||(m.add(B.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:B.modelId}));const O=e.entities.find(w=>w.attributes.some(v=>{var M;return((M=v.embedded)==null?void 0:M.associationRef)===B.modelId}));if(O){const w=O.attributes.find(v=>{var M;return((M=v.embedded)==null?void 0:M.associationRef)===B.modelId});No(l,f,O.modelId,w.modelId);break}if(B.end1.attributeRef){const w=e.entities.find(M=>M.modelId===B.end1.entityRef),v=w==null?void 0:w.attributes.find(M=>M.modelId===B.end1.attributeRef&&M.attrType==="RELATION_REF");v&&No(l,f,w.modelId,v.modelId)}const y={...e,associations:e.associations.filter(w=>w.modelId!==B.modelId)};sl(l,y,B.end2.entityRef,i,f,d);break}case"association.update":{const x=Zd(e,b.association,_,s,k);if(!x)break;const R=b.patch.identifying,$=typeof R=="boolean"?R:void 0;if($===!0&&x.end1.entityRef===x.end2.entityRef){s.push({code:"self-identifying",opIndex:_,handle:b.association});break}const B=Eo(b.patch,lb);if(B.length){s.push({code:"association-patch-unknown-key",opIndex:_,handle:b.association,keys:B});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:b.patch}),$!==void 0&&$!==(x.identifying??!1)){const O={...e,associations:e.associations.map(y=>y.modelId===x.modelId?{...y,identifying:$}:y)};sl(l,O,x.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const x=Zd(e,b.association,_,s,k);if(!x)break;const R=b.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(b.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:_,handle:b.association});break}const $=Eo(b.patch,sb,["jpa."]);if($.length){s.push({code:"association-end-patch-unknown-key",opIndex:_,handle:b.association,keys:$});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:R,patch:b.patch});break}case"index.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Xd(x.value,b.spec,_,b.entity,s,i);if(!R)break;l.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.modelId,value:R});break}case"index.update":case"index.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(rl(b.index)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:b.index,target:"index"});break}const R=ib(x.value,b.index);if(!R.ok){s.push(R.reason==="not-found"?{code:"index-not-found",opIndex:_,entity:b.entity,handle:b.index}:{code:"index-ambiguous",opIndex:_,entity:b.entity,handle:b.index,matches:R.matches});break}if(b.kind==="index.update"){if("columns"in b.patch){s.push({code:"index-columns-patch-unsupported",opIndex:_,entity:b.entity,handle:b.index});break}const $=Eo(b.patch,cb);if($.length){s.push({code:"index-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.index,keys:$});break}l.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId,patch:b.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId});break}case"operation.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=u.get(x.value.modelId)??(x.value.operations?Rt(x.value.operations):0);u.set(x.value.modelId,R+1);const $=Jd(b.spec,R,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:$.modelId,value:$});break}case"operation.update":case"operation.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(rl(b.operation)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:b.operation,target:"operation"});break}const R=Kd(x.value,b.operation);if(!R.ok){s.push(R.reason==="not-found"?{code:"operation-not-found",opIndex:_,entity:b.entity,handle:b.operation}:{code:"operation-ambiguous",opIndex:_,entity:b.entity,handle:b.operation,matches:R.matches});break}if(b.kind==="operation.update"){const $=Eo(b.patch,db);if($.length){s.push({code:"operation-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.operation,keys:$});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId,patch:b.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=b.kind==="attribute.reorder",R=yt(e,b.entity);if(!R.ok){s.push(gt(R.reason,_,b.entity,R.matches,k));break}const $=x?b.order:b.operations,B=[],O=new Set;let y=!1;for(const D of $){if(!x&&rl(D)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:D,target:"operation"}),y=!0;continue}const U=x?Hd(R.value,D):Kd(R.value,D);if(!U.ok){s.push(U.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:_,entity:b.entity,handle:D}:{code:"reorder-handle-ambiguous",opIndex:_,entity:b.entity,handle:D,matches:U.matches}),y=!0;continue}if(O.has(U.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:_,entity:b.entity,handle:D}),y=!0;continue}O.add(U.value.modelId),B.push(U.value)}if(y)break;const v=[...x?R.value.attributes:R.value.operations??[]].sort((D,U)=>D.order-U.order).filter(D=>!O.has(D.modelId)),M=[...B,...v];if(M.forEach((D,U)=>{D.order!==U&&l.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:D.modelId,patch:{order:U}}:{kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:D.modelId,patch:{order:U}})}),x)for(const D of Fd(e,R.value.modelId,M.map(U=>U.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:D.entityId,entityRef:D.entityId,attributeRef:D.attributeId,patch:{dbAttrs:D.dbAttrs}});break}case"group.add":{const x=[];let R=!1;for(const O of b.spec.members){const y=yt(e,O);if(!y.ok){s.push(gt(y.reason,_,O,y.matches,k)),R=!0;continue}x.push(y.value.modelId)}if(R)break;const $=i(),B={modelId:$,excludeDDLGeneration:b.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...b.spec.name?{name:b.spec.name}:{},...b.spec.packageName?{packageName:b.spec.packageName}:{},...b.spec.description?{description:b.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:$,value:B});break}case"group.update":{const x=il(e,b.group);if(!x.ok){s.push(al(x,_,b.group));break}const R=Eo(b.patch,Zg);if(R.length){s.push({code:"group-patch-unknown-key",opIndex:_,handle:b.group,keys:R});break}l.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:b.patch});break}case"group.remove":{const x=il(e,b.group);if(!x.ok){s.push(al(x,_,b.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=il(e,b.group);if(!x.ok){s.push(al(x,_,b.group));break}const R=yt(e,b.entity);if(!R.ok){s.push(gt(R.reason,_,b.entity,R.matches,k));break}const $=x.value.memberEntityRefs.includes(R.value.modelId);if(b.kind==="group.addMember"?$:!$)break;if(b.kind==="group.removeMember"){if(h.has(g(x.value.modelId,R.value.modelId)))break;h.add(g(x.value.modelId,R.value.modelId))}l.push({kind:b.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:R.value.modelId});break}}}),s.length||pb(l,e,f,p),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function gt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function Zd(e,n,o,i,a){const r=yt(e,n.from),l=yt(e,n.to);if(r.ok||i.push(gt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(gt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Ud(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:n}:{code:"association-ambiguous",opIndex:o,handle:n,matches:s.map(c=>c.modelId)}),null):s[0]}const Qd={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},yb={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},gb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},bb={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},wn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},_b={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...wn,description:"속성 설명(다국어)."},columnLogicalName:{...wn,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},kb={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},eu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Eb={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...eu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...eu,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},Nb={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Qd,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},wb={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...wn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Ib={type:"object",properties:{name:{...wn,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},vb={type:"object",description:"기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부).",properties:{name:{type:"string"},type:{type:"string"},customType:{type:"string"},attrType:{type:"string",enum:[...Ld],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},description:{...wn,description:"속성 설명(다국어)."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...wn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},xb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Cb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Sb={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...wn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Rb={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경.'},Ab={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function it(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const $b={"entity.add":it("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":it("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":it("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":it("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":it("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":it("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":it("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":it("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":it("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":it("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":it("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":it("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":it("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":it("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":it("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":it("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":it("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":it("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":it("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":it("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":it("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":it("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":it("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},Tb={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},Mb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...wn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},tu={anyOf:Od.map(e=>$b[e])},Vb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Qd,nameHandle:yb,groupHandle:Tb,assocHandle:gb,entitySpec:bb,attrSpec:_b,embeddableOverrides:kb,assocSpec:Eb,indexSpec:Nb,operationSpec:wb,groupSpec:Ib,entityUpdatePatch:Rb,attrUpdatePatch:vb,assocUpdatePatch:xb,assocEndUpdatePatch:Ab,indexUpdatePatch:Cb,operationUpdatePatch:Sb,groupUpdatePatch:Mb,symbolicOp:tu}};function Bb(e,n,o,i={}){const a=i.mkClientOpId??Me,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const nu={location:{x:0,y:0},size:{width:220,height:140}};function ou(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Db=/^[-=_*~\s]{3,}$/;function Ob(e){return e.attrType&&e.attrType!=="NORMAL"||!Db.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Lb(e){return e.type===tn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Pb(e,n){if(e.attrType==="DIVIDER"||Ob(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=Lb(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(ou)}}function zb(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Fb(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(n=>({columnRef:n.targetColumn.refId,descending:n.descending}))}}function Ub(e){var n,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(Pb),operations:(n=e.operations)==null?void 0:n.map(zb),indexes:(o=e.indexes)==null?void 0:o.map(Fb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Hb(e){const n={};for(const i of e.attributes)i.style&&(n[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...nu},style:e.style,attributeStyles:Object.keys(n).length?n:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function iu(e){return e.jpaAttribute?{fetchType:e.jpaAttribute.fetchType,cascadeTypes:e.jpaAttribute.cascadeTypes,orphanRemoval:e.jpaAttribute.orphanRemoval,orderBy:e.jpaAttribute.orderBy,collectionType:e.jpaAttribute.collectionType,collectionTable:e.jpaAttribute.collectionTable,orderColumn:e.jpaAttribute.orderColumn}:void 0}function cl(e){var n;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(n=e.attribute)==null?void 0:n.modelId,jpa:iu(e)}}function jb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>dl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Kb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:jb(e),end1:cl(e.end1),end2:cl(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:n,layout:o}}function dl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function au(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function ru(e){var o;const n=e.attribute;return(n==null?void 0:n.attrType)==="EMBED_OWN"&&(((o=n.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function lu(e,n){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:n,dbAttrs:(e.dbAttrs??[]).map(ou)}}function Gb(e,n,o){var E,I;const i=dl(e.end1.attribute),a=dl(e.end2.attribute);if(i===a)return Kb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(I=(E=s.dbAttrs)==null?void 0:E[0])==null?void 0:I.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((A,T)=>Math.max(A,T.order),-1)+1:s.order??0,p={...lu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const f=n.get(r.endModel.refId),h=l.attribute;let g;if(h&&f&&r.navigable){const A=Ui(l.multiplicity);g={modelId:h.modelId??crypto.randomUUID(),name:co(h.name??ji((u==null?void 0:u.name)??l.endModel.refId,A),new Set(f.attributes.map(T=>T.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((T,L)=>Math.max(T,L.order),-1)+1,dbAttrs:[]},f.attributes.push(g)}const k=(A,T)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:T?g==null?void 0:g.modelId:p.modelId,jpa:iu(A)}),N=r.endModel.refId===l.endModel.refId,b={modelId:e.modelId,description:e.description,identifying:!N&&p.identifier===!0?!0:void 0,end1:k(e.end1,i),end2:k(e.end2,a)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:b,layout:_}}function Yb(e,n){const o=e.targetModelId?n.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function qb(e,n,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((g,k)=>Math.max(g,k.order),-1)+1:l.order??0,d={...lu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Yb(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...cl(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function Wb(e,n){var i,a,r,l;const o=[];for(const s of n){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function su(e,n={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=Wb(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+n.x,y:a.location.y+n.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function cu(e,n,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(n.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function Jb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(p=>p.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(p=>p.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=Ui(i.end2.multiplicity),u=ji(r.name,d),m=co(u,new Set(a.attributes.map(p=>p.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((p,f)=>Math.max(p,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function Xb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function du(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if((l==null?void 0:l.stereotype)==="JPA_EMBEDDABLE")continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Us(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function uu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?Zb(n):Qb(n)}function Zb(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:p,...f}=m;return p!=null&&(o[m.modelId]=p),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);Jb(a,r),Xb(a,r),du(a,r);const{version:s,...c}=e.layout;cu(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Qb(e){var N,b;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(_,E)=>{o.push(Ub(_));const I=Hb(_);I.geo={location:{x:I.geo.location.x+E.x,y:I.geo.location.y+E.y},size:I.geo.size},i.push(I);for(const A of _.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const _ of e.entities??[])d(_,u);const m=[];for(const _ of e.groups??[]){const E=_.entities??[];l.push({modelId:_.modelId,name:_.name,description:_.description,packageName:_.packageName,excludeDDLGeneration:_.excludeDDLGeneration??!1,memberEntityRefs:E.map(A=>A.modelId)});const I=((N=_.geo)==null?void 0:N.location)??u;if(_.geo){const A=(_.notes??[]).map(T=>T.modelId);s.push({groupRef:_.modelId,geo:_.geo,style:_.style,locked:_.locked,memberNoteRefs:A.length?A:void 0})}for(const A of E)d(A,I);for(const A of _.notes??[])m.push(su(A,I))}const p=new Map(o.map(_=>[_.modelId,_])),f=new Map,h=new Map;for(const _ of o)for(const E of _.attributes)for(const I of E.dbAttrs)f.set(I.modelId,E.modelId),h.set(I.modelId,I);for(const _ of c)for(const E of[_.end1,_.end2]){const I=E.attribute;if(I&&(((b=I.dbAttrs)==null?void 0:b.length)??0)>0)for(const A of I.dbAttrs)A.modelId&&f.set(A.modelId,I.modelId)}for(const _ of c){const E=au(_.end1.attribute),I=au(_.end2.attribute),A=ru(_.end1)||ru(_.end2),{assoc:T,layout:L}=E!==I||A?qb(_,p,h):Gb(_,p,f);a.push(T),r.push(L)}cu(o,a,r),Lc(o),du(o,a);const g={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(_=>su(_)),...m]}},k={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:k}}function mu(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function e_(e,n){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(mu),style:n}}function t_(e,n){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:n}}function n_(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(n=>({targetColumn:{refId:n.columnRef},descending:n.descending}))}}function In(e,n){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:n??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function o_(e,n){const o=n==null?void 0:n.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...mu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function i_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function fu(e,n){const o=l=>{if(!l.attributeRef)return;const s=n.logical.entities.find(c=>c.modelId===l.entityRef);return s==null?void 0:s.attributes.find(c=>c.modelId===l.attributeRef)},i=o(e.end1),a=o(e.end2),r=l=>(l==null?void 0:l.attrType)==="RELATION_OWN"?l:void 0;return(i==null?void 0:i.attrType)==="RELATION_REF"?{navEnd:e.end1,fkEnd:e.end2,navAttr:i,fk:r(a)}:(a==null?void 0:a.attrType)==="RELATION_REF"?{navEnd:e.end2,fkEnd:e.end1,navAttr:a,fk:r(i)}:null}function a_(e){const n=new Set;for(const o of e.logical.associations){const i=fu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function r_(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function l_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function s_(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:l_(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function c_(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var h;return((h=f.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,p)=>s_(m,l[p]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:In(e.end1,c?s:u),end2:In(e.end2,c?u:s)}}function d_(e,n,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:In(e.end1,e.end1.legacyEmbedRaw),end2:In(e.end2,e.end2.legacyEmbedRaw)};const a=c_(e,n,i);if(a)return a;const r=fu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?o_(r.fk,l):void 0,c=i_(r.navAttr);return{...i,end1:In(e.end1,r.navEnd===e.end1?s:c),end2:In(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:In(e.end1),end2:In(e.end2)}}function pu(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(p=>p.entityRef===e.modelId),l=n.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>n.layout.associationLayouts.find(f=>f.associationRef===p),c=(r==null?void 0:r.geo)??{...nu},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(p=>!o.has(p.modelId)&&!i.has(p.modelId)).map(p=>{var f;return e_(p,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var f;return t_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>d_(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(n_),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function u_(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>hu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>pu(c,n,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function hu(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function m_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=a_(e),r=r_(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:n.id,diagramVersion:n.diagramVersion,version:n.version,size:n.size??e.layout.canvasSize,packageName:n.packageName??e.logical.packageName,entities:i.map(s=>pu(s,e,a,r)),groups:e.logical.groups.map(s=>u_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>hu(s))}}function f_(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,referenceOnly:n.referenceOnly,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const p_=["notNull"];function h_(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=uu(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(p=>[p.modelId,p]))]));for(const m of i.logical.entities){const p=c.get(m.modelId);if(p)for(const f of m.attributes){const h=p.get(f.modelId);if(!h){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const g={};for(const k of p_)f[k]===!0!=(h[k]===!0)&&(g[k]=f[k],s.attributeFieldsByName[k]=(s.attributeFieldsByName[k]??0)+1);Object.keys(g).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:g}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const p=d.get(m.modelId);p&&(m.end1.attributeRef&&m.end1.attributeRef!==p.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&p.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function ni(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function an(e){return typeof e=="function"?e():t.unref(e)}const y_=typeof window<"u"&&typeof document<"u",g_=e=>typeof e<"u",b_=Object.prototype.toString,__=e=>b_.call(e)==="[object Object]",k_=()=>{};function E_(e,n){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>n.apply(this,i),{fn:n,thisArg:this,args:i})).then(a).catch(r)})}return o}const yu=e=>e();function N_(e=yu){const n=t.ref(!0);function o(){n.value=!1}function i(){n.value=!0}const a=(...r)=>{n.value&&e(...r)};return{isActive:t.readonly(n),pause:o,resume:i,eventFilter:a}}function gu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function w_(e,n,o={}){const{eventFilter:i=yu,...a}=o;return t.watch(e,E_(i,n),a)}function wo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=N_(i);return{stop:w_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function I_(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=an(n.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function ul(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:h,throwOnTimeout:g}={}){let k=null;const b=[new Promise(_=>{k=t.watch(e,E=>{m(E)!==n&&(k==null||k(),_(E))},{flush:p,deep:f,immediate:!0})})];return h!=null&&b.push(gu(h,g).then(()=>an(e)).finally(()=>k==null?void 0:k())),Promise.race(b)}function i(m,p){if(!t.isRef(m))return o(E=>E===m,p);const{flush:f="sync",deep:h=!1,timeout:g,throwOnTimeout:k}=p??{};let N=null;const _=[new Promise(E=>{N=t.watch([e,m],([I,A])=>{n!==(I===A)&&(N==null||N(),E(I))},{flush:f,deep:h,immediate:!0})})];return g!=null&&_.push(gu(g,k).then(()=>an(e)).finally(()=>(N==null||N(),an(e)))),Promise.race(_)}function a(m){return o(p=>!!p,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,p){return o(f=>{const h=Array.from(f);return h.includes(m)||h.includes(an(m))},p)}function d(m){return u(1,m)}function u(m=1,p){let f=-1;return o(()=>(f+=1,f>=m),p)}return Array.isArray(an(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return ul(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return ul(e,!n)}}}function ml(e){return ul(e)}function v_(e){var n;const o=an(e);return(n=o==null?void 0:o.$el)!=null?n:o}const bu=y_?window:void 0;function _u(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=bu):[n,o,i,a]=e,!n)return k_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,p,f)=>(u.addEventListener(m,p,f),()=>u.removeEventListener(m,p,f)),c=t.watch(()=>[v_(n),an(a)],([u,m])=>{if(l(),!u)return;const p=__(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(h=>s(u,f,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ni(d),d}function x_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function ku(...e){let n,o,i={};e.length===3?(n=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],i=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:a=bu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=x_(n);return _u(a,r,u=>{u.repeat&&an(s)||c(u)&&o(u)},l)}function C_(e){return JSON.parse(JSON.stringify(e))}function fl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:p}=i,f=t.getCurrentInstance(),h=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=d;n||(n="modelValue"),g=g||`update:${n.toString()}`;const k=_=>s?typeof s=="function"?s(_):C_(_):_,N=()=>g_(e[n])?k(e[n]):m,b=_=>{p?p(_)&&h(g,_):h(g,_)};if(c){const _=N(),E=t.ref(_);let I=!1;return t.watch(()=>e[n],A=>{I||(I=!0,E.value=k(A),t.nextTick(()=>I=!1))}),t.watch(E,A=>{!I&&(A!==e[n]||u)&&b(A)},{deep:u}),E}else return t.computed({get(){return N()},set(_){b(_)}})}var S_={value:()=>{}};function ma(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new fa(o)}function fa(e){this._=e}function R_(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}fa.prototype=ma.prototype={constructor:fa,on:function(e,n){var o=this._,i=R_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=A_(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Eu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Eu(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new fa(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function A_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Eu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=S_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var pl="http://www.w3.org/1999/xhtml";const Nu={svg:"http://www.w3.org/2000/svg",xhtml:pl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Nu.hasOwnProperty(n)?{space:Nu[n],local:e}:e}function $_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===pl&&n.documentElement.namespaceURI===pl?n.createElement(e):n.createElementNS(o,e)}}function T_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wu(e){var n=pa(e);return(n.local?T_:$_)(n)}function M_(){}function hl(e){return e==null?M_:function(){return this.querySelector(e)}}function V_(e){typeof e!="function"&&(e=hl(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Ct(i,this._parents)}function B_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function D_(){return[]}function Iu(e){return e==null?D_:function(){return this.querySelectorAll(e)}}function O_(e){return function(){return B_(e.apply(this,arguments))}}function L_(e){typeof e=="function"?e=O_(e):e=Iu(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Ct(i,a)}function vu(e){return function(){return this.matches(e)}}function xu(e){return function(n){return n.matches(e)}}var P_=Array.prototype.find;function z_(e){return function(){return P_.call(this.children,e)}}function F_(){return this.firstElementChild}function U_(e){return this.select(e==null?F_:z_(typeof e=="function"?e:xu(e)))}var H_=Array.prototype.filter;function j_(){return Array.from(this.children)}function K_(e){return function(){return H_.call(this.children,e)}}function G_(e){return this.selectAll(e==null?j_:K_(typeof e=="function"?e:xu(e)))}function Y_(e){typeof e!="function"&&(e=vu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Ct(i,this._parents)}function Cu(e){return new Array(e.length)}function q_(){return new Ct(this._enter||this._groups.map(Cu),this._parents)}function ha(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ha.prototype={constructor:ha,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function W_(e){return function(){return e}}function J_(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new ha(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function X_(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ha(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function Z_(e){return e.__data__}function Q_(e,n){if(!arguments.length)return Array.from(this,Z_);var o=n?X_:J_,i=this._parents,a=this._groups;typeof e!="function"&&(e=W_(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=ek(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),k=l[d]=new Array(h),N=c[d]=new Array(p);o(u,m,g,k,N,f,n);for(var b=0,_=0,E,I;b<h;++b)if(E=g[b]){for(b>=_&&(_=b+1);!(I=k[_])&&++_<h;);E._next=I||null}}return l=new Ct(l,i),l._enter=s,l._exit=c,l}function ek(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function tk(){return new Ct(this._exit||this._groups.map(Cu),this._parents)}function nk(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function ok(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Ct(s,this._parents)}function ik(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function ak(e){e||(e=rk);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Ct(a,this._parents).order()}function rk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function lk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sk(){return Array.from(this)}function ck(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function dk(){let e=0;for(const n of this)++e;return e}function uk(){return!this.node()}function mk(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function fk(e){return function(){this.removeAttribute(e)}}function pk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hk(e,n){return function(){this.setAttribute(e,n)}}function yk(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function gk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function bk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function _k(e,n){var o=pa(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?pk:fk:typeof n=="function"?o.local?bk:gk:o.local?yk:hk)(o,n))}function Su(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kk(e){return function(){this.style.removeProperty(e)}}function Ek(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Nk(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function wk(e,n,o){return arguments.length>1?this.each((n==null?kk:typeof n=="function"?Nk:Ek)(e,n,o??"")):Io(this.node(),e)}function Io(e,n){return e.style.getPropertyValue(n)||Su(e).getComputedStyle(e,null).getPropertyValue(n)}function Ik(e){return function(){delete this[e]}}function vk(e,n){return function(){this[e]=n}}function xk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ck(e,n){return arguments.length>1?this.each((n==null?Ik:typeof n=="function"?xk:vk)(e,n)):this.node()[e]}function Ru(e){return e.trim().split(/^|\s+/)}function yl(e){return e.classList||new Au(e)}function Au(e){this._node=e,this._names=Ru(e.getAttribute("class")||"")}Au.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function $u(e,n){for(var o=yl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Tu(e,n){for(var o=yl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Sk(e){return function(){$u(this,e)}}function Rk(e){return function(){Tu(this,e)}}function Ak(e,n){return function(){(n.apply(this,arguments)?$u:Tu)(this,e)}}function $k(e,n){var o=Ru(e+"");if(arguments.length<2){for(var i=yl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Ak:n?Sk:Rk)(o,n))}function Tk(){this.textContent=""}function Mk(e){return function(){this.textContent=e}}function Vk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Bk(e){return arguments.length?this.each(e==null?Tk:(typeof e=="function"?Vk:Mk)(e)):this.node().textContent}function Dk(){this.innerHTML=""}function Ok(e){return function(){this.innerHTML=e}}function Lk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Pk(e){return arguments.length?this.each(e==null?Dk:(typeof e=="function"?Lk:Ok)(e)):this.node().innerHTML}function zk(){this.nextSibling&&this.parentNode.appendChild(this)}function Fk(){return this.each(zk)}function Uk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Hk(){return this.each(Uk)}function jk(e){var n=typeof e=="function"?e:wu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Kk(){return null}function Gk(e,n){var o=typeof e=="function"?e:wu(e),i=n==null?Kk:typeof n=="function"?n:hl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Yk(){var e=this.parentNode;e&&e.removeChild(this)}function qk(){return this.each(Yk)}function Wk(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Jk(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Xk(e){return this.select(e?Jk:Wk)}function Zk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Qk(e){return function(n){e.call(this,n,this.__data__)}}function eE(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function tE(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function nE(e,n,o){return function(){var i=this.__on,a,r=Qk(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function oE(e,n,o){var i=eE(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?nE:tE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Mu(e,n,o){var i=Su(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function iE(e,n){return function(){return Mu(this,e,n)}}function aE(e,n){return function(){return Mu(this,e,n.apply(this,arguments))}}function rE(e,n){return this.each((typeof n=="function"?aE:iE)(e,n))}function*lE(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Vu=[null];function Ct(e,n){this._groups=e,this._parents=n}function oi(){return new Ct([[document.documentElement]],Vu)}function sE(){return this}Ct.prototype=oi.prototype={constructor:Ct,select:V_,selectAll:L_,selectChild:U_,selectChildren:G_,filter:Y_,data:Q_,enter:q_,exit:tk,join:nk,merge:ok,selection:sE,order:ik,sort:ak,call:lk,nodes:sk,node:ck,size:dk,empty:uk,each:mk,attr:_k,style:wk,property:Ck,classed:$k,text:Bk,html:Pk,raise:Fk,lower:Hk,append:jk,insert:Gk,remove:qk,clone:Xk,datum:Zk,on:oE,dispatch:rE,[Symbol.iterator]:lE};function Mt(e){return typeof e=="string"?new Ct([[document.querySelector(e)]],[document.documentElement]):new Ct([[e]],Vu)}function cE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Gt(e,n){if(e=cE(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const dE={passive:!1},ii={capture:!0,passive:!1};function gl(e){e.stopImmediatePropagation()}function vo(e){e.preventDefault(),e.stopImmediatePropagation()}function Bu(e){var n=e.document.documentElement,o=Mt(e).on("dragstart.drag",vo,ii);"onselectstart"in n?o.on("selectstart.drag",vo,ii):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Du(e,n){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);n&&(i.on("click.drag",vo,ii),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const ya=e=>()=>e;function bl(e,{sourceEvent:n,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}bl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function uE(e){return!e.ctrlKey&&!e.button}function mE(){return this.parentNode}function fE(e,n){return n??{x:e.x,y:e.y}}function pE(){return navigator.maxTouchPoints||"ontouchstart"in this}function hE(){var e=uE,n=mE,o=fE,i=pE,a={},r=ma("start","drag","end"),l=0,s,c,d,u,m=0;function p(E){E.on("mousedown.drag",f).filter(i).on("touchstart.drag",k).on("touchmove.drag",N,dE).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(E,I){if(!(u||!e.call(this,E,I))){var A=_(this,n.call(this,E,I),E,I,"mouse");A&&(Mt(E.view).on("mousemove.drag",h,ii).on("mouseup.drag",g,ii),Bu(E.view),gl(E),d=!1,s=E.clientX,c=E.clientY,A("start",E))}}function h(E){if(vo(E),!d){var I=E.clientX-s,A=E.clientY-c;d=I*I+A*A>m}a.mouse("drag",E)}function g(E){Mt(E.view).on("mousemove.drag mouseup.drag",null),Du(E.view,d),vo(E),a.mouse("end",E)}function k(E,I){if(e.call(this,E,I)){var A=E.changedTouches,T=n.call(this,E,I),L=A.length,x,R;for(x=0;x<L;++x)(R=_(this,T,E,I,A[x].identifier,A[x]))&&(gl(E),R("start",E,A[x]))}}function N(E){var I=E.changedTouches,A=I.length,T,L;for(T=0;T<A;++T)(L=a[I[T].identifier])&&(vo(E),L("drag",E,I[T]))}function b(E){var I=E.changedTouches,A=I.length,T,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),T=0;T<A;++T)(L=a[I[T].identifier])&&(gl(E),L("end",E,I[T]))}function _(E,I,A,T,L,x){var R=r.copy(),$=Gt(x||A,I),B,O,y;if((y=o.call(E,new bl("beforestart",{sourceEvent:A,target:p,identifier:L,active:l,x:$[0],y:$[1],dx:0,dy:0,dispatch:R}),T))!=null)return B=y.x-$[0]||0,O=y.y-$[1]||0,function w(v,M,D){var U=$,W;switch(v){case"start":a[L]=w,W=l++;break;case"end":delete a[L],--l;case"drag":$=Gt(D||M,I),W=l;break}R.call(v,E,new bl(v,{sourceEvent:M,subject:y,target:p,identifier:L,active:W,x:$[0]+B,y:$[1]+O,dx:$[0]-U[0],dy:$[1]-U[1],dispatch:R}),T)}}return p.filter=function(E){return arguments.length?(e=typeof E=="function"?E:ya(!!E),p):e},p.container=function(E){return arguments.length?(n=typeof E=="function"?E:ya(E),p):n},p.subject=function(E){return arguments.length?(o=typeof E=="function"?E:ya(E),p):o},p.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:ya(!!E),p):i},p.on=function(){var E=r.on.apply(r,arguments);return E===r?p:E},p.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,p):Math.sqrt(m)},p}function _l(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Ou(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ai(){}var ri=.7,ga=1/ri,xo="\\s*([+-]?\\d+)\\s*",li="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yE=/^#([0-9a-f]{3,8})$/,gE=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),bE=new RegExp(`^rgb\\(${Yt},${Yt},${Yt}\\)$`),_E=new RegExp(`^rgba\\(${xo},${xo},${xo},${li}\\)$`),kE=new RegExp(`^rgba\\(${Yt},${Yt},${Yt},${li}\\)$`),EE=new RegExp(`^hsl\\(${li},${Yt},${Yt}\\)$`),NE=new RegExp(`^hsla\\(${li},${Yt},${Yt},${li}\\)$`),Lu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};_l(ai,Hn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Pu,formatHex:Pu,formatHex8:wE,formatHsl:IE,formatRgb:zu,toString:zu});function Pu(){return this.rgb().formatHex()}function wE(){return this.rgb().formatHex8()}function IE(){return Ku(this).formatHsl()}function zu(){return this.rgb().formatRgb()}function Hn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=yE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Fu(n):o===3?new wt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ba(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ba(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=gE.exec(e))?new wt(n[1],n[2],n[3],1):(n=bE.exec(e))?new wt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=_E.exec(e))?ba(n[1],n[2],n[3],n[4]):(n=kE.exec(e))?ba(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=EE.exec(e))?ju(n[1],n[2]/100,n[3]/100,1):(n=NE.exec(e))?ju(n[1],n[2]/100,n[3]/100,n[4]):Lu.hasOwnProperty(e)?Fu(Lu[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function Fu(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function ba(e,n,o,i){return i<=0&&(e=n=o=NaN),new wt(e,n,o,i)}function vE(e){return e instanceof ai||(e=Hn(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function kl(e,n,o,i){return arguments.length===1?vE(e):new wt(e,n,o,i??1)}function wt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}_l(wt,kl,Ou(ai,{brighter(e){return e=e==null?ga:Math.pow(ga,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ri:Math.pow(ri,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(jn(this.r),jn(this.g),jn(this.b),_a(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Uu,formatHex:Uu,formatHex8:xE,formatRgb:Hu,toString:Hu}));function Uu(){return`#${Kn(this.r)}${Kn(this.g)}${Kn(this.b)}`}function xE(){return`#${Kn(this.r)}${Kn(this.g)}${Kn(this.b)}${Kn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hu(){const e=_a(this.opacity);return`${e===1?"rgb(":"rgba("}${jn(this.r)}, ${jn(this.g)}, ${jn(this.b)}${e===1?")":`, ${e})`}`}function _a(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function jn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Kn(e){return e=jn(e),(e<16?"0":"")+e.toString(16)}function ju(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Vt(e,n,o,i)}function Ku(e){if(e instanceof Vt)return new Vt(e.h,e.s,e.l,e.opacity);if(e instanceof ai||(e=Hn(e)),!e)return new Vt;if(e instanceof Vt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Vt(l,s,c,e.opacity)}function CE(e,n,o,i){return arguments.length===1?Ku(e):new Vt(e,n,o,i??1)}function Vt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}_l(Vt,CE,Ou(ai,{brighter(e){return e=e==null?ga:Math.pow(ga,e),new Vt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ri:Math.pow(ri,e),new Vt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new wt(El(e>=240?e-240:e+120,a,i),El(e,a,i),El(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Vt(Gu(this.h),ka(this.s),ka(this.l),_a(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=_a(this.opacity);return`${e===1?"hsl(":"hsla("}${Gu(this.h)}, ${ka(this.s)*100}%, ${ka(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Gu(e){return e=(e||0)%360,e<0?e+360:e}function ka(e){return Math.max(0,Math.min(1,e||0))}function El(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Nl=e=>()=>e;function SE(e,n){return function(o){return e+o*n}}function RE(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function AE(e){return(e=+e)==1?Yu:function(n,o){return o-n?RE(n,o,e):Nl(isNaN(n)?o:n)}}function Yu(e,n){var o=n-e;return o?SE(e,o):Nl(isNaN(e)?n:e)}const Ea=(function e(n){var o=AE(n);function i(a,r){var l=o((a=kl(a)).r,(r=kl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Yu(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function $E(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,i=n.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+n[a]*r;return i}}function TE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ME(e,n){var o=n?n.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=si(e[l],n[l]);for(;l<o;++l)r[l]=n[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function VE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function qt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function BE(e,n){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in e?o[a]=si(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var wl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Il=new RegExp(wl.source,"g");function DE(e){return function(){return e}}function OE(e){return function(n){return e(n)+""}}function qu(e,n){var o=wl.lastIndex=Il.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=wl.exec(e))&&(a=Il.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:qt(i,a)})),o=Il.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?OE(c[0].x):DE(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function si(e,n){var o=typeof n,i;return n==null||o==="boolean"?Nl(n):(o==="number"?qt:o==="string"?(i=Hn(n))?(n=i,Ea):qu:n instanceof Hn?Ea:n instanceof Date?VE:TE(n)?$E:Array.isArray(n)?ME:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?BE:qt)(e,n)}var Wu=180/Math.PI,vl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ju(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Wu,skewX:Math.atan(c)*Wu,scaleX:l,scaleY:s}}var Na;function LE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?vl:Ju(n.a,n.b,n.c,n.d,n.e,n.f)}function PE(e){return e==null||(Na||(Na=document.createElementNS("http://www.w3.org/2000/svg","g")),Na.setAttribute("transform",e),!(e=Na.transform.baseVal.consolidate()))?vl:(e=e.matrix,Ju(e.a,e.b,e.c,e.d,e.e,e.f))}function Xu(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:qt(d,m)},{i:g-2,x:qt(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:qt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:qt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:qt(d,m)},{i:g-2,x:qt(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,k;++h<g;)m[(k=p[h]).i]=k.x(f);return m.join("")}}}var zE=Xu(LE,"px, ","px)","deg)"),FE=Xu(PE,", ",")",")"),UE=1e-12;function Zu(e){return((e=Math.exp(e))+1/e)/2}function HE(e){return((e=Math.exp(e))-1/e)/2}function jE(e){return((e=Math.exp(2*e))-1)/(e+1)}const wa=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,k,N;if(g<UE)N=Math.log(p/d)/n,k=function(T){return[s+T*f,c+T*h,d*Math.exp(n*T*N)]};else{var b=Math.sqrt(g),_=(p*p-d*d+i*g)/(2*d*o*b),E=(p*p-d*d-i*g)/(2*p*o*b),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(E*E+1)-E);N=(A-I)/n,k=function(T){var L=T*N,x=Zu(I),R=d/(o*b)*(x*jE(n*L+I)-HE(I));return[s+R*f,c+R*h,d*x/Zu(n*L+I)]}}return k.duration=N*1e3*n/Math.SQRT2,k}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Co=0,ci=0,di=0,Qu=1e3,Ia,ui,va=0,Gn=0,xa=0,mi=typeof performance=="object"&&performance.now?performance:Date,em=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xl(){return Gn||(em(KE),Gn=mi.now()+xa)}function KE(){Gn=0}function Ca(){this._call=this._time=this._next=null}Ca.prototype=tm.prototype={constructor:Ca,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?xl():+o)+(n==null?0:+n),!this._next&&ui!==this&&(ui?ui._next=this:Ia=this,ui=this),this._call=e,this._time=o,Cl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cl())}};function tm(e,n,o){var i=new Ca;return i.restart(e,n,o),i}function GE(){xl(),++Co;for(var e=Ia,n;e;)(n=Gn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Co}function nm(){Gn=(va=mi.now())+xa,Co=ci=0;try{GE()}finally{Co=0,qE(),Gn=0}}function YE(){var e=mi.now(),n=e-va;n>Qu&&(xa-=n,va=e)}function qE(){for(var e,n=Ia,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ia=o);ui=e,Cl(i)}function Cl(e){if(!Co){ci&&(ci=clearTimeout(ci));var n=e-Gn;n>24?(e<1/0&&(ci=setTimeout(nm,e-mi.now()-xa)),di&&(di=clearInterval(di))):(di||(va=mi.now(),di=setInterval(YE,Qu)),Co=1,em(nm))}}function om(e,n,o){var i=new Ca;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var WE=ma("start","end","cancel","interrupt"),JE=[],im=0,am=1,Sl=2,Sa=3,rm=4,Rl=5,Ra=6;function Aa(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;XE(e,o,{name:n,index:i,group:a,on:WE,tween:JE,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:im})}function Al(e,n){var o=Bt(e,n);if(o.state>im)throw new Error("too late; already scheduled");return o}function Wt(e,n){var o=Bt(e,n);if(o.state>Sa)throw new Error("too late; already running");return o}function Bt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function XE(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=tm(r,0,o.time);function r(d){o.state=am,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==am)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Sa)return om(l);f.state===rm?(f.state=Ra,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Ra,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(om(function(){o.state===Sa&&(o.state=rm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Sl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Sl){for(o.state=Sa,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Rl,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===Rl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ra,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function $a(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>Sl&&i.state<Rl,i.state=Ra,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function ZE(e){return this.each(function(){$a(this,e)})}function QE(e,n){var o,i;return function(){var a=Wt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function e1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Wt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function t1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Bt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?QE:e1)(o,e,n))}function $l(e,n,o){var i=e._id;return e.each(function(){var a=Wt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Bt(a,i).value[n]}}function lm(e,n){var o;return(typeof n=="number"?qt:n instanceof Hn?Ea:(o=Hn(n))?(n=o,Ea):qu)(e,n)}function n1(e){return function(){this.removeAttribute(e)}}function o1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function i1(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function a1(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function r1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function l1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function s1(e,n){var o=pa(e),i=o==="transform"?FE:lm;return this.attrTween(e,typeof n=="function"?(o.local?l1:r1)(o,i,$l(this,"attr."+e,n)):n==null?(o.local?o1:n1)(o):(o.local?a1:i1)(o,i,n))}function c1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function d1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function u1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&d1(e,r)),o}return a._value=n,a}function m1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&c1(e,r)),o}return a._value=n,a}function f1(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=pa(e);return this.tween(o,(i.local?u1:m1)(i,n))}function p1(e,n){return function(){Al(this,e).delay=+n.apply(this,arguments)}}function h1(e,n){return n=+n,function(){Al(this,e).delay=n}}function y1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?p1:h1)(n,e)):Bt(this.node(),n).delay}function g1(e,n){return function(){Wt(this,e).duration=+n.apply(this,arguments)}}function b1(e,n){return n=+n,function(){Wt(this,e).duration=n}}function _1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?g1:b1)(n,e)):Bt(this.node(),n).duration}function k1(e,n){if(typeof n!="function")throw new Error;return function(){Wt(this,e).ease=n}}function E1(e){var n=this._id;return arguments.length?this.each(k1(n,e)):Bt(this.node(),n).ease}function N1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Wt(this,e).ease=o}}function w1(e){if(typeof e!="function")throw new Error;return this.each(N1(this._id,e))}function I1(e){typeof e!="function"&&(e=vu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new rn(i,this._parents,this._name,this._id)}function v1(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new rn(l,this._parents,this._name,this._id)}function x1(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function C1(e,n,o){var i,a,r=x1(n)?Al:Wt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function S1(e,n){var o=this._id;return arguments.length<2?Bt(this.node(),o).on.on(e):this.each(C1(o,e,n))}function R1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function A1(){return this.on("end.remove",R1(this._id))}function $1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=hl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Aa(d[p],n,o,p,d,Bt(u,o)));return new rn(r,this._parents,n,o)}function T1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Iu(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=Bt(u,o),g=0,k=p.length;g<k;++g)(f=p[g])&&Aa(f,n,o,g,p,h);r.push(p),l.push(u)}return new rn(r,l,n,o)}var M1=oi.prototype.constructor;function V1(){return new M1(this._groups,this._parents)}function B1(e,n){var o,i,a;return function(){var r=Io(this,e),l=(this.style.removeProperty(e),Io(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function sm(e){return function(){this.style.removeProperty(e)}}function D1(e,n,o){var i,a=o+"",r;return function(){var l=Io(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function O1(e,n,o){var i,a,r;return function(){var l=Io(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Io(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function L1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Wt(this,e),d=c.on,u=c.value[r]==null?s||(s=sm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function P1(e,n,o){var i=(e+="")=="transform"?zE:lm;return n==null?this.styleTween(e,B1(e,i)).on("end.style."+e,sm(e)):typeof n=="function"?this.styleTween(e,O1(e,i,$l(this,"style."+e,n))).each(L1(this._id,e)):this.styleTween(e,D1(e,i,n),o).on("end.style."+e,null)}function z1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function F1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&z1(e,l,o)),i}return r._value=n,r}function U1(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,F1(e,n,o??""))}function H1(e){return function(){this.textContent=e}}function j1(e){return function(){var n=e(this);this.textContent=n??""}}function K1(e){return this.tween("text",typeof e=="function"?j1($l(this,"text",e)):H1(e==null?"":e+""))}function G1(e){return function(n){this.textContent=e.call(this,n)}}function Y1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&G1(a)),n}return i._value=e,i}function q1(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,Y1(e))}function W1(){for(var e=this._name,n=this._id,o=cm(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Bt(c,n);Aa(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new rn(i,this._parents,e,o)}function J1(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Wt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var X1=0;function rn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function cm(){return++X1}var ln=oi.prototype;rn.prototype={constructor:rn,select:$1,selectAll:T1,selectChild:ln.selectChild,selectChildren:ln.selectChildren,filter:I1,merge:v1,selection:V1,transition:W1,call:ln.call,nodes:ln.nodes,node:ln.node,size:ln.size,empty:ln.empty,each:ln.each,on:S1,attr:s1,attrTween:f1,style:P1,styleTween:U1,text:K1,textTween:q1,remove:A1,tween:t1,delay:y1,duration:_1,ease:E1,easeVarying:w1,end:J1,[Symbol.iterator]:ln[Symbol.iterator]};function Z1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Q1={time:null,delay:0,duration:250,ease:Z1};function e0(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function t0(e){var n,o;e instanceof rn?(n=e._id,e=e._name):(n=cm(),(o=Q1).time=xl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Aa(c,e,n,d,l,o||e0(c,n));return new rn(i,this._parents,e,n)}oi.prototype.interrupt=ZE,oi.prototype.transition=t0;const Ta=e=>()=>e;function n0(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function sn(e,n,o){this.k=e,this.x=n,this.y=o}sn.prototype={constructor:sn,scale:function(e){return e===1?this:new sn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new sn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var So=new sn(1,0,0);sn.prototype;function Tl(e){e.stopImmediatePropagation()}function fi(e){e.preventDefault(),e.stopImmediatePropagation()}function o0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function i0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function dm(){return this.__zoom||So}function a0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function r0(){return navigator.maxTouchPoints||"ontouchstart"in this}function l0(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function s0(){var e=o0,n=i0,o=l0,i=a0,a=r0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=wa,d=ma("start","zoom","end"),u,m,p,f=500,h=150,g=0,k=10;function N(y){y.property("__zoom",dm).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(y,w,v,M){var D=y.selection?y.selection():y;D.property("__zoom",dm),y!==D?I(y,w,v,M):D.interrupt().each(function(){A(this,arguments).event(M).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},N.scaleBy=function(y,w,v,M){N.scaleTo(y,function(){var D=this.__zoom.k,U=typeof w=="function"?w.apply(this,arguments):w;return D*U},v,M)},N.scaleTo=function(y,w,v,M){N.transform(y,function(){var D=n.apply(this,arguments),U=this.__zoom,W=v==null?E(D):typeof v=="function"?v.apply(this,arguments):v,ie=U.invert(W),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(b(U,pe),W,ie),D,l)},v,M)},N.translateBy=function(y,w,v,M){N.transform(y,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,M)},N.translateTo=function(y,w,v,M,D){N.transform(y,function(){var U=n.apply(this,arguments),W=this.__zoom,ie=M==null?E(U):typeof M=="function"?M.apply(this,arguments):M;return o(So.translate(ie[0],ie[1]).scale(W.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),U,l)},M,D)};function b(y,w){return w=Math.max(r[0],Math.min(r[1],w)),w===y.k?y:new sn(w,y.x,y.y)}function _(y,w,v){var M=w[0]-v[0]*y.k,D=w[1]-v[1]*y.k;return M===y.x&&D===y.y?y:new sn(y.k,M,D)}function E(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function I(y,w,v,M){y.on("start.zoom",function(){A(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,U=arguments,W=A(D,U).event(M),ie=n.apply(D,U),pe=v==null?E(ie):typeof v=="function"?v.apply(D,U):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=D.__zoom,me=typeof w=="function"?w.apply(D,U):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new sn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}W.zoom(null,ke)}})}function A(y,w,v){return!v&&y.__zooming||new T(y,w)}function T(y,w){this.that=y,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(y,w),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,w){return this.mouse&&y!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var w=Mt(this.that).datum();d.call(y,this.that,new n0(y,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:d}),w)}};function L(y,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(y),M=this.__zoom,D=Math.max(r[0],Math.min(r[1],M.k*Math.pow(2,i.apply(this,arguments)))),U=Gt(y);if(v.wheel)(v.mouse[0][0]!==U[0]||v.mouse[0][1]!==U[1])&&(v.mouse[1]=M.invert(v.mouse[0]=U)),clearTimeout(v.wheel);else{if(M.k===D)return;v.mouse=[U,M.invert(U)],$a(this),v.start()}fi(y),v.wheel=setTimeout(W,h),v.zoom("mouse",o(_(b(M,D),v.mouse[0],v.mouse[1]),v.extent,l));function W(){v.wheel=null,v.end()}}function x(y,...w){if(p||!e.apply(this,arguments))return;var v=y.currentTarget,M=A(this,w,!0).event(y),D=Mt(y.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),U=Gt(y,v),W=y.clientX,ie=y.clientY;Bu(y.view),Tl(y),M.mouse=[U,this.__zoom.invert(U)],$a(this),M.start();function pe(ge){if(fi(ge),!M.moved){var me=ge.clientX-W,se=ge.clientY-ie;M.moved=me*me+se*se>g}M.event(ge).zoom("mouse",o(_(M.that.__zoom,M.mouse[0]=Gt(ge,v),M.mouse[1]),M.extent,l))}function ye(ge){D.on("mousemove.zoom mouseup.zoom",null),Du(ge.view,M.moved),fi(ge),M.event(ge).end()}}function R(y,...w){if(e.apply(this,arguments)){var v=this.__zoom,M=Gt(y.changedTouches?y.changedTouches[0]:y,this),D=v.invert(M),U=v.k*(y.shiftKey?.5:2),W=o(_(b(v,U),M,D),n.apply(this,w),l);fi(y),s>0?Mt(this).transition().duration(s).call(I,W,M,y):Mt(this).call(N.transform,W,M,y)}}function $(y,...w){if(e.apply(this,arguments)){var v=y.touches,M=v.length,D=A(this,w,y.changedTouches.length===M).event(y),U,W,ie,pe;for(Tl(y),W=0;W<M;++W)ie=v[W],pe=Gt(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],D.touch0?!D.touch1&&D.touch0[2]!==pe[2]&&(D.touch1=pe,D.taps=0):(D.touch0=pe,U=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),U&&(D.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),$a(this),D.start())}}function B(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W,ie,pe;for(fi(y),U=0;U<D;++U)W=M[U],ie=Gt(W,this),v.touch0&&v.touch0[2]===W.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===W.identifier&&(v.touch1[0]=ie);if(W=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;W=b(W,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(_(W,ie,pe),v.extent,l))}}function O(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W;for(Tl(y),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),U=0;U<D;++U)W=M[U],v.touch0&&v.touch0[2]===W.identifier?delete v.touch0:v.touch1&&v.touch1[2]===W.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(W=Gt(W,this),Math.hypot(m[0]-W[0],m[1]-W[1])<k)){var ie=Mt(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return N.wheelDelta=function(y){return arguments.length?(i=typeof y=="function"?y:Ta(+y),N):i},N.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ta(!!y),N):e},N.touchable=function(y){return arguments.length?(a=typeof y=="function"?y:Ta(!!y),N):a},N.extent=function(y){return arguments.length?(n=typeof y=="function"?y:Ta([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),N):n},N.scaleExtent=function(y){return arguments.length?(r[0]=+y[0],r[1]=+y[1],N):[r[0],r[1]]},N.translateExtent=function(y){return arguments.length?(l[0][0]=+y[0][0],l[1][0]=+y[1][0],l[0][1]=+y[0][1],l[1][1]=+y[1][1],N):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},N.constrain=function(y){return arguments.length?(o=y,N):o},N.duration=function(y){return arguments.length?(s=+y,N):s},N.interpolate=function(y){return arguments.length?(c=y,N):c},N.on=function(){var y=d.on.apply(d,arguments);return y===d?N:y},N.clickDistance=function(y){return arguments.length?(g=(y=+y)*y,N):Math.sqrt(g)},N.tapDistance=function(y){return arguments.length?(k=+y,N):k},N}var $e=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))($e||{}),Ml=(e=>(e.Partial="partial",e.Full="full",e))(Ml||{}),Yn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Yn||{}),cn=(e=>(e.Strict="strict",e.Loose="loose",e))(cn||{}),Vl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Vl||{}),pi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(pi||{}),um=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(um||{});const c0=["INPUT","SELECT","TEXTAREA"],d0=typeof document<"u"?document:null;function Bl(e){var n,o;const i=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return c0.includes(i==null?void 0:i.nodeName)||a||!!r}function u0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function mm(e,n,o,i){const a=n.replace("+",`
|
|
27
|
+
`}}const ea="com.example",cg="command.domain";function Xo(e,n,o={}){const i=Yi(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??cg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const dg="CustomMoneyType",ug="Money";function mg(e){return!(e.type!==dg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function fg(e){const n=e.dbAttrs[0]??{modelId:Me(),physicalName:"",dataType:""},o={modelId:Me(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:ug,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function pg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>mg(l)?(a=!0,n=!0,fg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function hg(e,n){const o=new Map,i=[],a=new Map;for(const h of e.entities){const g=new Map,k=new Map,N=new Map,b=(_,E,I)=>{if(!_)return;o.get(_)||o.set(_,[{entityId:E,assignedId:_}]),i.push({id:_,entityId:E,sink:I}),I(_)};for(const _ of h.attributes){b(_.modelId,h.modelId,E=>g.set(_,E));for(const E of _.dbAttrs)b(E.modelId,h.modelId,I=>k.set(E,I))}for(const _ of h.indexes??[])b(_.modelId,h.modelId,E=>N.set(_,E));a.set(h,{attrs:g,cols:k,idx:N})}const r=new Set(o.keys()),l=new Map;for(const h of i){const g=(l.get(h.id)??0)+1;if(l.set(h.id,g),g===1)continue;const k=yg(h.id,g-1,r);r.add(k),o.get(h.id).push({entityId:h.entityId,assignedId:k}),h.sink(k)}const s=[...o.values()].reduce((h,g)=>h+Math.max(0,g.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(h,g)=>{var N;if(!g||!h)return g;const k=o.get(g);return!k||k.length<2?g:((N=k.find(b=>b.entityId===h))==null?void 0:N.assignedId)??g},d=new Map(e.associations.map(h=>[h.modelId,h])),u=(h,g)=>{const k=d.get(h);if(k)return k.end1.entityRef===g?k.end2.entityRef:k.end1.entityRef},m=e.entities.map(h=>{var _;const g=a.get(h),k=h.attributes.map(E=>{const I=g.attrs.get(E),A=E.dbAttrs.map(x=>{const R=g.cols.get(x);return R===x.modelId?x:{...x,modelId:R}});let T=E.derivedFrom;if(T){const x=u(T.associationRef,h.modelId),R=c(x,T.sourceAttributeRef);R!==T.sourceAttributeRef&&(T={...T,sourceAttributeRef:R})}return I!==E.modelId||T!==E.derivedFrom||A.some((x,R)=>x!==E.dbAttrs[R])?{...E,modelId:I,dbAttrs:A,derivedFrom:T}:E}),N=(_=h.indexes)==null?void 0:_.map(E=>{const I=g.idx.get(E),A=E.columns.map(L=>{const x=c(h.modelId,L.columnRef);return x===L.columnRef?L:{...L,columnRef:x}});return I!==E.modelId||A.some((L,x)=>L!==E.columns[x])?{...E,modelId:I,columns:A}:E});return k.some((E,I)=>E!==h.attributes[I])||N&&h.indexes&&N.some((E,I)=>E!==h.indexes[I])?{...h,attributes:k,...N?{indexes:N}:{}}:h}),p=e.associations.map(h=>{const g=c(h.end1.entityRef,h.end1.attributeRef),k=c(h.end2.entityRef,h.end2.attributeRef);return g===h.end1.attributeRef&&k===h.end2.attributeRef?h:{...h,end1:g===h.end1.attributeRef?h.end1:{...h.end1,attributeRef:g},end2:k===h.end2.attributeRef?h.end2:{...h.end2,attributeRef:k}}}),f=n.associationLayouts.map(h=>{const g=d.get(h.associationRef);if(!g)return h;const k=c(g.end1.entityRef,h.sourceColumnRef),N=c(g.end2.entityRef,h.targetColumnRef);return k===h.sourceColumnRef&&N===h.targetColumnRef?h:{...h,sourceColumnRef:k,targetColumnRef:N}});return{logical:{...e,entities:m,associations:p},layout:f.some((h,g)=>h!==n.associationLayouts[g])?{...n,associationLayouts:f}:n,reissued:s}}function yg(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function Rt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Yr(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function Oc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Lc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Oc);if(!i.length)continue;const a=o.filter(s=>!Oc(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),n.attributes=l}}function _o(e){return JSON.parse(JSON.stringify(e))}function Pc(e,n,o){var L;const i=o.idFactory??Me,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const x=new Set(n);for(const R of r.associations){const $=x.has(R.end1.entityRef),B=x.has(R.end2.entityRef);$!==B&&s.add($?R.end2.entityRef:R.end1.entityRef)}}const c=r.entities.filter(x=>s.has(x.modelId)),d=new Set(c.map(x=>x.modelId)),u=r.associations.filter(x=>d.has(x.end1.entityRef)&&d.has(x.end2.entityRef)),m=new Set(u.map(x=>x.modelId)),p=new Map,f=x=>{let R=p.get(x);return R||(R=i(),p.set(x,R)),R};for(const x of c){f(x.modelId);for(const R of x.attributes){f(R.modelId);for(const $ of R.dbAttrs)f($.modelId)}for(const R of x.indexes??[])f(R.modelId);for(const R of x.operations??[])f(R.modelId)}for(const x of u)f(x.modelId);const h=x=>p.get(x),g=c.map(x=>{const R=_o(x);R.modelId=h(x.modelId),R.attributes=R.attributes.map($=>gg($,h,m,d));for(const $ of R.indexes??[])$.modelId=h($.modelId),$.columns=$.columns.map(B=>Mn(B.columnRef)?B:{...B,columnRef:h(B.columnRef)}).filter(B=>B.columnRef!==void 0);for(const $ of R.operations??[])$.modelId=h($.modelId);return R});Lc(g);const k=u.map(x=>{const R=_o(x);return R.modelId=h(x.modelId),R.end1=zc(R.end1,h),R.end2=zc(R.end2,h),R}),N=[];for(const x of r.groups){const R=x.memberEntityRefs.filter(B=>d.has(B));if(R.length===0)continue;const $=_o(x);$.modelId=f(x.modelId),$.memberEntityRefs=R.map(B=>h(B)),N.push($)}const b=o.collisionSuffix??"_imported",_=new Set(o.existing.entities.map(x=>x.name)),E=new Set(o.existing.entities.map(x=>{var R;return(R=x.table)==null?void 0:R.physicalName}).filter(x=>!!x));for(const x of g)_.has(x.name)&&(x.name=`${x.name}${b}`),(L=x.table)!=null&&L.physicalName&&E.has(x.table.physicalName)&&(x.table.physicalName=`${x.table.physicalName}${b}`);const I=[];for(const x of l.entityLayouts){const R=h(x.entityRef);if(!R)continue;const $=_o(x);$.entityRef=R,$.geo={...$.geo,location:qr($.geo.location,a)},$.attributeStyles&&($.attributeStyles=ta($.attributeStyles,h)),$.operationStyles&&($.operationStyles=ta($.operationStyles,h)),I.push($)}const A=[];for(const x of l.associationLayouts){const R=h(x.associationRef);if(!R)continue;const $=_o(x);$.associationRef=R,$.sourceColumnRef=x.sourceColumnRef?h(x.sourceColumnRef):void 0,$.targetColumnRef=x.targetColumnRef?h(x.targetColumnRef):void 0,$.waypoints=$.waypoints.map(B=>qr(B,a)),A.push($)}const T=[];for(const x of l.groupLayouts){const R=h(x.groupRef);if(!R)continue;const $=_o(x);$.groupRef=R,$.geo={...$.geo,location:qr($.geo.location,a)},delete $.memberNoteRefs,T.push($)}return{logical:{entities:g,associations:k,groups:N},layout:{entityLayouts:I,associationLayouts:A,groupLayouts:T},idMap:p}}function qr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function gg(e,n,o,i){e.modelId=n(e.modelId);for(const a of e.dbAttrs)if(a.modelId=n(a.modelId),a.sharedColumnRef!==void 0){const r=n(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:n(e.derivedFrom.associationRef),sourceAttributeRef:n(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:n(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:n(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function zc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function ta(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Wr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function Pn(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>Pn(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!Pn(e[i],n[i]))return!1;return!0}return!1}function zn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||Pn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Fn(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function bg(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const _g=new Set(["attributes","operations","indexes","rev"]),kg=new Set(["end1","end2","rev"]),Eg=new Set(["memberEntityRefs","rev"]),Fc=new Set(["modelId"]),Ng=new Set(["modelId","columns"]),wg=new Set([]);function Ig(e,n,o,i){const a=Fn(n.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=zn(s,c,Fc);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Fn(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=zn(s,c,Fc);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Fn(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!Pn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=zn(s,c,Ng);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function vg(e,n,o){const i=Fn(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:Wr(l)});for(const{cur:l,tgt:s}of i.common){const c=zn(l,s,_g);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Ig(l.modelId,l,s,o)}const a=Fn(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:Wr(l)});for(const{cur:l,tgt:s}of a.common){const c=zn(l,s,kg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=zn(l[d]??{},s[d]??{},wg);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=Fn(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:Wr(l)});for(const{cur:l,tgt:s}of r.common){const c=zn(l,s,Eg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=bg(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function na(e,n,o,i,a,r,l){const s=Fn(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)Pn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function xg(e,n,o){na(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),na(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),na(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),na(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Cg(e,n){const o=[];return vg(e.logical,n.logical,o),xg(e.layout,n.layout,o),o}function Sg(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const Rg={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class Ag{constructor(n){Xe(this,"out",[]);Xe(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...Zo(n),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(n,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...Zo(n),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...Zo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...Zo(n),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(n,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...Zo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Zo(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Ht(e,n,o,i){if(o==null||typeof o!="object")return;const a=Rg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Un(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Jr(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function En(e,n){var r,l,s,c,d,u,m,p;const o=Sg(n),i=new Ag(n.field),a=[...e].sort((f,h)=>f.seq-h.seq);for(const f of a)for(const h of f.ops)switch(o){case"entity":if(h.entityRef!==n.entityRef)break;h.kind==="entity.add"?Ht(i,f,h.value,"entity"):h.kind==="entity.update"?Un(i,f,h.patch):h.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Jr((r=h.value)==null?void 0:r.attributes,n.attributeRef);g&&Ht(i,f,g,"attribute")}else h.kind==="attribute.add"&&((l=h.value)==null?void 0:l.modelId)===n.attributeRef?Ht(i,f,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===n.attributeRef?Un(i,f,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===n.attributeRef||h.kind==="entity.remove")&&i.remove(f);break;case"operation":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Jr((s=h.value)==null?void 0:s.operations,n.operationRef);g&&Ht(i,f,g,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===n.operationRef?Ht(i,f,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===n.operationRef?Un(i,f,h.patch):(h.kind==="operation.remove"&&h.operationRef===n.operationRef||h.kind==="entity.remove")&&i.remove(f);break;case"index":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Jr((d=h.value)==null?void 0:d.indexes,n.indexRef);g&&Ht(i,f,g,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===n.indexRef?Ht(i,f,h.value,"index"):h.kind==="index.update"&&h.indexRef===n.indexRef?Un(i,f,h.patch):(h.kind==="index.remove"&&h.indexRef===n.indexRef||h.kind==="entity.remove")&&i.remove(f);break;case"association":if(h.associationRef!==n.associationRef)break;h.kind==="association.add"?Ht(i,f,h.value,"association"):h.kind==="association.update"?Un(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(h.associationRef!==n.associationRef)break;if(h.kind==="association.add"){const g=(m=h.value)==null?void 0:m[n.end];Ht(i,f,g,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===n.end?Un(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"group":if(h.groupRef!==n.groupRef)break;if(h.kind==="group.add"){Ht(i,f,h.value,"group");const g=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(g))for(const k of g)i.member(f,k,!1)}else h.kind==="group.update"?Un(i,f,h.patch):h.kind==="group.remove"?i.remove(f):h.kind==="group.addMember"&&h.entityRef!=null?i.member(f,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(f,h.entityRef,!0);break}return i.result()}const qe={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},$g={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":qe,"entityLayout.remove":qe,"entityLayout.move":qe,"entityLayout.resize":qe,"entityLayout.setCollapsed":qe,"entityLayout.setLocked":qe,"entityLayout.setStyle":qe,"entityLayout.setAttrStyle":qe,"entityLayout.setOpStyle":qe,"groupLayout.add":qe,"groupLayout.remove":qe,"groupLayout.move":qe,"groupLayout.resize":qe,"groupLayout.setLocked":qe,"groupLayout.setStyle":qe,"groupLayout.addNoteMember":qe,"groupLayout.removeNoteMember":qe,"associationLayout.add":qe,"associationLayout.remove":qe,"associationLayout.setWaypoints":qe,"note.add":qe,"note.remove":qe,"note.move":qe,"note.resize":qe,"note.setMemo":qe,"note.setStyle":qe,"noteConnection.add":qe,"noteConnection.remove":qe,"noteConnection.setWaypoints":qe},At=e=>typeof e=="string"?e:void 0,Tg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Uc(e){return At(e.containerRef)??At(e.entityRef)}function Xr(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 Zr(e){const n=$g[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=At(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Xr(o,"attributes","attribute",a),...Xr(o,"operations","operation",a),...Xr(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Uc(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?Tg(o):At(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=At(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=At(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Mg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=At(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Uc(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=At(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=At(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function Vg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Bg(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of Zr(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function oa(e,n){return e.map(o=>({...o,subject:n}))}function Hc(e,n){const o=e.filter(s=>s.ops.some(c=>Vg(c,n))),{attributes:i,operations:a,indexes:r}=Bg(o,n),l=[...oa(En(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...oa(En(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...oa(En(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...oa(En(o,{entityRef:n,indexRef:s}),{kind:"index",ref:s}));return l.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function Qr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Dg(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of Zr(i))a.existence==="add"&&n.add(Qr(a.subject));return n}function Og(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=Mg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Lg(e){const{entities:n,associations:o,groups:i}=Og(e),a=[];for(const r of n)for(const l of Hc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of En(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of En(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of En(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function el(e){const n=Lg(e),o=Dg(e),i=new Map;for(const l of n){const s=Qr(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=Qr(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}function jc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Pg(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of Zr(r)){if(!l.existence||l.inline)continue;const s=l.subject;zg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const zg=new Set(["attribute","operation","index"]);function tl(e,n){const{fromSeq:o}=n,i=el(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const p=jc(m.subject);let f=s.get(p);f||(f={subject:m.subject,evs:[]},s.set(p,f)),f.evs.push(m)};for(const m of l)for(const p of m.actions)c({seq:m.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const m of Pg(e,o,r)){const p=s.get(jc(m.subject));p!=null&&p.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,h)=>f.seq-h.seq);const p=m.evs[m.evs.length-1];m.subject.kind==="entity"&&p.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const p=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||p&&f)continue;const h=new Map;let g=null;for(const N of m.evs){N.verb==="add"&&g!==null&&g!=="add"&&h.clear(),g=N.verb;for(const b of N.fields){const _=h.get(b.field);_?_.lastValue=b.value:h.set(b.field,{firstOld:b.oldValue,hasOld:b.oldValue!==void 0,lastValue:b.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const N=[];for(const[b,_]of h)N.push({field:b,value:_.lastValue});d.push({subject:m.subject,verb:"added",fields:N});continue}const k=[];for(const[N,b]of h)b.hasOld&&Pn(b.firstOld,b.lastValue)||k.push({field:N,value:b.lastValue,...b.hasOld?{oldValue:b.firstOld}:{}});k.length!==0&&d.push({subject:m.subject,verb:"modified",fields:k})}return{fromSeq:o,toSeq:r,entries:d}}function Kc(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class nl{constructor(n){Xe(this,"undoStack",[]);Xe(this,"redoStack",[]);Xe(this,"savePoint",null);Xe(this,"listeners",new Set);Xe(this,"commandListeners",new Set);Xe(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function Nt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Gc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function mt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function $t(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function Qe(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function nn(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function ia(e,n,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:n,...o})},invert(i){const a=Gc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=mt(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Yc(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Gc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=mt(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(p=>p.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function qc(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=Qe(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(Qe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(o)}]}}}}function Wc(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=Qe(i,e);o=a.name,a.name=n},invert(i){Qe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function ko(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=mt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Jc(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=mt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Qo(e,n){const o={...(e==null?void 0:e.properties)??{}};return n?o.swatch=n:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function Xc(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=Qo(r.style,n)},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=mt(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function Zc(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Qc(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function ol(e){let n=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){n=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=n[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:n[l]}})}),{forward:i,invert:a}}}}function aa(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=Qo(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function ra(e,n,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:n,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function ed(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(o)}]}}}}function td(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function nd(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function la(e,n){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,n)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}}}}function od(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function id(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function ad(e,n){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Qo(a.style,n)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function rd(e,n){let o;return{label:n?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=n},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function jt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){Qe(o,e).attributes.push(n)},invert(o){const i=Qe(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function on(e,n,o){const i={},a=r=>{const l=Qe(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(i)}]}}}}function ld(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=Qe(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&Qe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function sd(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function il(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Qe(a,e);i=r.attributes.map(s=>({...s}));const l=Yr([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&Qe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).attributes;return sd("attribute.update","attributeRef",e,r,i??[])}}}function cd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=Qe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=Qe(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function dd(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(i)}]}}}}function ud(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Qe(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=Qe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function md(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Qe(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Yr([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=Qe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).operations??[];return sd("operation.update","operationRef",e,r,i??[])}}}function fd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=Qo(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=mt(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function sa(e,n){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(n)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:n,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function pd(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function ca(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(o)}]}}}}function Tt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(i)}]}}}}function hd(e,n){return{label:"인덱스 추가",apply(o){const i=Qe(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=Qe(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function da(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(i)}]}}}}function yd(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Qe(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&Qe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Kt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ei=(e,n)=>{var o;return((o=$t(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function gd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=$t(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=$t(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ei(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Kt(e,r)],invert:[Kt(e,l)]}}}}function bd(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=$t(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=$t(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ei(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Kt(e,a)],invert:[Kt(e,r)]}}}}function _d(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=$t(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=$t(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Kt(e,ei(a,e))],invert:[Kt(e,i??[])]}}}}function kd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=$t(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=$t(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Kt(e,ei(o,e))],invert:[Kt(e,n??[])]}}}}function Ed(e,n,o){return{label:"waypoint 추가",apply(i){const a=$t(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=$t(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ei(i,e),r=a.slice();return r.splice(n,1),{forward:[Kt(e,a)],invert:[Kt(e,r)]}}}}function Nd(e){return{label:"노트 추가",apply(n){n.layout.notes.push(e)},invert(n){const o=n.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&n.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function wd(e){let n=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);n={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){n&&o.layout.notes.splice(n.index,0,n.item)},emitOps(){return n?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:n.item}]}:{forward:[],invert:[]}}}}function ti(e,n){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Id(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function vd(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function xd(e,n){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Qo(a.style,n)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Cd(e,n){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(n)&&(l.memberNoteRefs.push(n),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(n);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}:{forward:[],invert:[]}}}}function Sd(e,n){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(n))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,n))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}}}}const Nn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),ua=(e,n,o)=>{var i;return((i=nn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Rd(e,n){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===n)){o=!1;return}r.connections.push({targetRef:n,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===n);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:{targetRef:n,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}]}:{forward:[],invert:[]}}}}function Ad(e,n){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===n))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${n}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:o.item}]}:{forward:[],invert:[]}}}}function $d(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=nn(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=nn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=ua(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Nn(e,n,l)],invert:[Nn(e,n,s)]}}}}function Td(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=nn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=nn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=ua(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Nn(e,n,r)],invert:[Nn(e,n,l)]}}}}function Md(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=nn(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=nn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=ua(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Nn(e,n,r)],invert:[Nn(e,n,l)]}}}}function Vd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=nn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=nn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Nn(e,n,ua(i,e,n))],invert:[Nn(e,n,o??[])]}}}}function We(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const Fg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:sa,addAttribute:jt,addEntity:ia,addEntityToGroup:nd,addGroup:ra,addIndex:hd,addNote:Nd,addNoteConnection:Rd,addNoteConnectionWaypoint:Td,addNoteToGroup:Cd,addOperation:cd,addWaypoint:Ed,clearNoteConnectionWaypoints:Vd,clearWaypoints:kd,composite:We,moveEntity:ko,moveGroup:od,moveNote:ti,moveNoteConnectionWaypoint:$d,moveWaypoint:gd,removeAssociation:pd,removeAttribute:ld,removeEntity:Yc,removeEntityFromGroup:la,removeGroup:td,removeIndex:yd,removeNote:wd,removeNoteConnection:Ad,removeNoteConnectionWaypoint:Md,removeNoteFromGroup:Sd,removeOperation:ud,removeWaypoint:bd,renameEntity:Wc,reorderAttributes:il,reorderOperations:md,resizeEntity:Jc,resizeGroup:id,resizeNote:Id,setAllEntitiesCollapsed:ol,setAttributeSwatch:aa,setEntityCollapsed:Zc,setEntityLocked:Qc,setEntitySwatch:Xc,setGroupLocked:rd,setGroupSwatch:ad,setNoteMemo:vd,setNoteSwatch:xd,setOperationSwatch:fd,translateWaypoints:_d,updateAssociation:ca,updateAssociationEnd:Tt,updateAttribute:on,updateEntity:qc,updateGroup:ed,updateIndex:da,updateOperation:dd},Symbol.toStringTag,{value:"Module"}));class Bd{constructor(){Xe(this,"revs",new Map);Xe(this,"layoutVersion",0);Xe(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const Ug=[400,1200];function Hg(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function jg(e){const n=Hg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Kg=e=>new Promise(n=>setTimeout(n,e));class Dd{constructor(n){Xe(this,"cache",new Bd);Xe(this,"newClientOpId");Xe(this,"debounceMs");Xe(this,"retryDelaysMs");Xe(this,"emissions",new WeakMap);Xe(this,"open",null);Xe(this,"debounceHandle",null);Xe(this,"queue",[]);Xe(this,"sending",!1);Xe(this,"_frozen",!1);Xe(this,"stack",null);Xe(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Me,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??Ug}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!jg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Kg(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const Od=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Ld=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Pd(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function Gg(e){return e.flatMap(n=>n.dbAttrs).length}function zd(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function Yg(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=Go(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function qg(e,n,o=Me){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Gg(i.attributes);if(a===0)return[];const r=zd(e,n),l=i.attributes.flatMap(c=>c.dbAttrs),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;Yg(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function Fd(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const h=r.get(f);if(!h)return[];l.push(h)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,h)=>f===c[h]))return[];const d=new Map(s.map((f,h)=>[f,h])),u=zd(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const g=c.map(N=>h.dbAttrs[d.get(N)]),k=g.reduce((N,b,_)=>b===h.dbAttrs[_]?N:N+1,0);k&&m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:g,moved:k})}return m}function Wg(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Jg(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Ud(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function yt(e,n){const o=Wg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>Qg(i,e))}}function Xg(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function al(e,n){const o=Xg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function rl(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const Zg=new Set(["name","description","packageName","excludeDDLGeneration"]);function Qg(e,n){var a;const o=Yi(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(p=>p.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function Hd(e,n){const o=Jg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function eb(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function tb(e,n){const o=eb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function jd(e,n){const o=e.filter(i=>i.physicalName===n.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function ll(e){return e.by!==void 0&&e.by!=="name"}function nb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function ob(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function ib(e,n){const o=nb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Kd(e,n){const o=ob(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Gd(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Yd(e){return Gd(e)&&e.dataType==null}function qd(e,n,o){const i=Gd(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function Wd(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let p=!1;for(const f of n.fields){const h=u.get(f.name);if(h!=null&&h.sharedColumnPhysicalName){const g={ref:h.sharedColumnPhysicalName,by:"physicalName"},k=jd(kn(i,a),g);if(!k.ok){s.push(k.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:k.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:k.value.modelId});continue}m.push({modelId:c(),physicalName:(h==null?void 0:h.physicalName)??"",dataType:"",...h!=null&&h.length?{length:h.length}:{},...h!=null&&h.scale?{scale:h.scale}:{},...(h==null?void 0:h.insertable)!=null?{insertable:h.insertable}:{},...(h==null?void 0:h.updatable)!=null?{updatable:h.updatable}:{}})}return p?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}const ab=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),rb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),lb=new Set(["description","identifying"]),sb=new Set(["multiplicity","navigable","composition"]),cb=new Set(["name","unique","description","parameters"]),db=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Eo(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const sl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),ub=new Set([...sl].filter(e=>e!=="sharedColumnRef"));function mb(e,n,o,i){if(i||o.some(l=>!ub.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))sl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function fb(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,p)=>{const f=n.fields[p],h=f?c.get(f.name):void 0;if(!h){d.push(m);return}if(h.sharedColumnPhysicalName){const k={ref:h.sharedColumnPhysicalName,by:"physicalName"},N=jd(kn(i,a),k);if(!N.ok){s.push(N.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:k}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:k,matches:N.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:N.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...h.physicalName!=null?{physicalName:h.physicalName}:{},...h.length!=null?{length:h.length}:{},...h.scale!=null?{scale:h.scale}:{},...h.insertable!=null?{insertable:h.insertable}:{},...h.updatable!=null?{updatable:h.updatable}:{}})}),u?null:d}function Jd(e,n,o){return{modelId:o(),name:e.name,order:n,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Xd(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=tb(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:n.name,unique:n.unique??!1,columns:l,...n.description?{description:n.description}:{},...n.parameters?{parameters:n.parameters}:{}}}function No(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function pb(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Pd(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function cl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of _c(n,o,i)){for(const u of c.remove)No(e,a,s,u);for(const u of c.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:s,entityRef:s,attributeRef:u.attributeId,patch:u.patch});const d=((l=n.entities.find(u=>u.modelId===s))==null?void 0:l.attributes)??[];for(const u of c.add)e.push({kind:"attribute.add",casUnit:"logical",containerRef:s,entityRef:s,value:{...u,order:r(s,d)}})}}function hb(e,n,o={}){const i=o.mkId??Me,a=o.embeddableCatalog??[],r=b=>a.find(_=>_.type===b),l=[],s=[],c=new Map,d=(b,_)=>{const E=c.get(b)??Rt(_);return c.set(b,E+1),E},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},h=new Set,g=(b,_)=>`${b}\0${_}`,k=new Set;for(const b of n)b.kind==="entity.add"&&(k.add(b.spec.name),b.spec.physicalName&&k.add(b.spec.physicalName));const N=new Set;return n.forEach((b,_)=>{var E,I,A,T,L;switch(b.kind){case"entity.add":{const x=e.entities.filter(v=>v.name===b.spec.name).map(v=>v.modelId);if(x.length||N.has(b.spec.name)){s.push({code:"entity-name-conflict",opIndex:_,handle:{ref:b.spec.name},matches:x});break}N.add(b.spec.name);const R=i(),$={modelId:R,name:b.spec.name,stereotype:b.spec.stereotype??"JPA_ENTITY",attributes:[],...b.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...b.spec.physicalName?{table:{physicalName:b.spec.physicalName}}:{}},B={ref:b.spec.name};let O=!1;for(const[v,M]of(b.spec.attributes??[]).entries()){if(M.type==="GroupCodeEnum"&&!M.groupCode){s.push({code:"groupcode-required",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0;continue}if(!r(M.type)&&!((E=M.embeddableOverrides)!=null&&E.length)&&Yd(M)){s.push({code:"datatype-required",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0;continue}const D=r(M.type);if(D){const U=Wd(M,D,v,$,e.entities,_,B,s,i);U?$.attributes.push(U):O=!0}else(I=M.embeddableOverrides)!=null&&I.length?(s.push({code:"embeddable-type-unresolved",opIndex:_,entity:B,handle:{ref:M.name}}),O=!0):$.attributes.push(qd(M,v,i))}const y=(b.spec.operations??[]).map((v,M)=>Jd(v,M,i));y.length&&($.operations=y);const w=[];for(const v of b.spec.indexes??[]){const M=Xd($,v,_,B,s,i);M?w.push(M):O=!0}if(w.length&&($.indexes=w),O)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:R,value:$});break}case"entity.update":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Eo(b.patch,rb,["jpaAttrs.","table."]);if(R.length){s.push({code:"entity-patch-unknown-key",opIndex:_,entity:b.entity,keys:R});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:b.patch});break}case"entity.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=x.value.modelId,$=e.associations.filter(w=>w.end1.entityRef===R||w.end2.entityRef===R),B=new Set($.map(w=>w.modelId));for(const w of $)m.has(w.modelId)||(m.add(w.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:w.modelId}));for(const w of e.entities)if(w.modelId!==R)for(const v of w.attributes)v.embedded&&B.has(v.embedded.associationRef)&&No(l,f,w.modelId,v.modelId);for(const w of $){if(w.end1.entityRef===R||!w.end1.attributeRef)continue;const v=e.entities.find(D=>D.modelId===w.end1.entityRef),M=v==null?void 0:v.attributes.find(D=>D.modelId===w.end1.attributeRef&&D.attrType==="RELATION_REF");M&&No(l,f,v.modelId,M.modelId)}const O={...e,entities:e.entities.filter(w=>w.modelId!==R),associations:e.associations.filter(w=>!B.has(w.modelId))},y=new Set($.filter(w=>w.end1.entityRef===R&&w.end2.entityRef!==R).map(w=>w.end2.entityRef));for(const w of y)cl(l,O,w,i,f,d);for(const w of e.groups)w.memberEntityRefs.includes(R)&&(h.has(g(w.modelId,R))||(h.add(g(w.modelId,R)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:w.modelId,groupRef:w.modelId,entityRef:R})));p.add(R),l.push({kind:"entity.remove",casUnit:"logical",entityRef:R});break}case"attribute.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(b.spec.type==="GroupCodeEnum"&&!b.spec.groupCode){s.push({code:"groupcode-required",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}if(!r(b.spec.type)&&!((A=b.spec.embeddableOverrides)!=null&&A.length)&&Yd(b.spec)){s.push({code:"datatype-required",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}const R=d(x.value.modelId,x.value.attributes),$=r(b.spec.type);let B;if($)B=Wd(b.spec,$,R,x.value,e.entities,_,b.entity,s,i);else if((T=b.spec.embeddableOverrides)!=null&&T.length){s.push({code:"embeddable-type-unresolved",opIndex:_,entity:b.entity,handle:{ref:b.spec.name}});break}else B=qd(b.spec,R,i);if(!B)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:B});break}case"attribute.update":case"attribute.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Hd(x.value,b.attribute);if(!R.ok){s.push(R.reason==="not-found"?{code:"attribute-not-found",opIndex:_,entity:b.entity,handle:b.attribute}:{code:"attribute-ambiguous",opIndex:_,entity:b.entity,handle:b.attribute,matches:R.matches});break}if(b.kind==="attribute.update"){const $=[],B=[];let O=!1;for(const M of Object.keys(b.patch)){if(M.includes(".")){M.startsWith("dbAttrs.")?O=!0:B.push(M);continue}sl.has(M)?$.push(M):ab.has(M)||B.push(M)}if(B.length){s.push({code:"attribute-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.attribute,keys:B});break}if("attrType"in b.patch){const M=String(b.patch.attrType),D=Ld.includes(M)?M!==R.value.attrType?"transition":void 0:"unknown-value";if(D){s.push({code:"attribute-attrtype-unsupported",opIndex:_,entity:b.entity,handle:b.attribute,reason:D,current:R.value.attrType,requested:M});break}}const y="type"in b.patch?b.patch.type:R.value.type,w="groupCode"in b.patch?b.patch.groupCode:R.value.groupCode;if(y==="GroupCodeEnum"&&!w){s.push({code:"groupcode-required",opIndex:_,entity:b.entity,handle:b.attribute});break}let v=b.patch;if($.length){const M=mb(R.value,b.patch,$,O);if(!M){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:_,entity:b.entity,handle:b.attribute,keys:$});break}v=M}if((L=b.embeddableOverrides)!=null&&L.length){const M=r(R.value.type);if(!M||R.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:_,entity:b.entity,handle:b.attribute});break}const D=fb(R.value,M,b.embeddableOverrides,x.value,e.entities,_,b.entity,s);if(!D)break;v={...v,dbAttrs:D}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:R.value.modelId,patch:v})}else{const $=Ji(e,x.value.modelId,R.value.modelId);if($){const B=O=>{var y;return((y=e.entities.find(w=>w.modelId===O))==null?void 0:y.name)??O};s.push({code:"attribute-fk-managed",opIndex:_,entity:b.entity,handle:b.attribute,association:{from:B($.end1.entityRef),to:B($.end2.entityRef)}});break}No(l,f,x.value.modelId,R.value.modelId)}break}case"association.add":{const x=yt(e,b.spec.from),R=yt(e,b.spec.to);if(x.ok||s.push(gt(x.reason,_,b.spec.from,x.matches,k)),R.ok||s.push(gt(R.reason,_,b.spec.to,R.matches,k)),!x.ok||!R.ok)break;if(b.spec.identifying&&x.value.modelId===R.value.modelId){s.push({code:"self-identifying",opIndex:_,handle:{from:b.spec.from,to:b.spec.to}});break}const $=i(),B={modelId:$,...b.spec.identifying!=null?{identifying:b.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:b.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:R.value.modelId,multiplicity:b.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:b.spec.composition??!1}},O={...e,associations:[...e.associations,B]},y=Wo(O,R.value.modelId,i);y.add[0]&&(B.end2.attributeRef=y.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:$,value:B});for(const w of y.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:{...w,order:d(R.value.modelId,R.value.attributes)}});break}case"association.remove":{const x=yt(e,b.association.from),R=yt(e,b.association.to);if(x.ok||s.push(gt(x.reason,_,b.association.from,x.matches,k)),R.ok||s.push(gt(R.reason,_,b.association.to,R.matches,k)),!x.ok||!R.ok)break;const $=Ud(e,x.value.modelId,R.value.modelId);if($.length!==1){s.push($.length===0?{code:"association-not-found",opIndex:_,handle:b.association}:{code:"association-ambiguous",opIndex:_,handle:b.association,matches:$.map(w=>w.modelId)});break}const B=$[0];m.has(B.modelId)||(m.add(B.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:B.modelId}));const O=e.entities.find(w=>w.attributes.some(v=>{var M;return((M=v.embedded)==null?void 0:M.associationRef)===B.modelId}));if(O){const w=O.attributes.find(v=>{var M;return((M=v.embedded)==null?void 0:M.associationRef)===B.modelId});No(l,f,O.modelId,w.modelId);break}if(B.end1.attributeRef){const w=e.entities.find(M=>M.modelId===B.end1.entityRef),v=w==null?void 0:w.attributes.find(M=>M.modelId===B.end1.attributeRef&&M.attrType==="RELATION_REF");v&&No(l,f,w.modelId,v.modelId)}const y={...e,associations:e.associations.filter(w=>w.modelId!==B.modelId)};cl(l,y,B.end2.entityRef,i,f,d);break}case"association.update":{const x=Zd(e,b.association,_,s,k);if(!x)break;const R=b.patch.identifying,$=typeof R=="boolean"?R:void 0;if($===!0&&x.end1.entityRef===x.end2.entityRef){s.push({code:"self-identifying",opIndex:_,handle:b.association});break}const B=Eo(b.patch,lb);if(B.length){s.push({code:"association-patch-unknown-key",opIndex:_,handle:b.association,keys:B});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:b.patch}),$!==void 0&&$!==(x.identifying??!1)){const O={...e,associations:e.associations.map(y=>y.modelId===x.modelId?{...y,identifying:$}:y)};cl(l,O,x.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const x=Zd(e,b.association,_,s,k);if(!x)break;const R=b.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(b.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:_,handle:b.association});break}const $=Eo(b.patch,sb,["jpa."]);if($.length){s.push({code:"association-end-patch-unknown-key",opIndex:_,handle:b.association,keys:$});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:R,patch:b.patch});break}case"index.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=Xd(x.value,b.spec,_,b.entity,s,i);if(!R)break;l.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.modelId,value:R});break}case"index.update":case"index.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(ll(b.index)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:b.index,target:"index"});break}const R=ib(x.value,b.index);if(!R.ok){s.push(R.reason==="not-found"?{code:"index-not-found",opIndex:_,entity:b.entity,handle:b.index}:{code:"index-ambiguous",opIndex:_,entity:b.entity,handle:b.index,matches:R.matches});break}if(b.kind==="index.update"){if("columns"in b.patch){s.push({code:"index-columns-patch-unsupported",opIndex:_,entity:b.entity,handle:b.index});break}const $=Eo(b.patch,cb);if($.length){s.push({code:"index-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.index,keys:$});break}l.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId,patch:b.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId});break}case"operation.add":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}const R=u.get(x.value.modelId)??(x.value.operations?Rt(x.value.operations):0);u.set(x.value.modelId,R+1);const $=Jd(b.spec,R,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:$.modelId,value:$});break}case"operation.update":case"operation.remove":{const x=yt(e,b.entity);if(!x.ok){s.push(gt(x.reason,_,b.entity,x.matches,k));break}if(ll(b.operation)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:b.operation,target:"operation"});break}const R=Kd(x.value,b.operation);if(!R.ok){s.push(R.reason==="not-found"?{code:"operation-not-found",opIndex:_,entity:b.entity,handle:b.operation}:{code:"operation-ambiguous",opIndex:_,entity:b.entity,handle:b.operation,matches:R.matches});break}if(b.kind==="operation.update"){const $=Eo(b.patch,db);if($.length){s.push({code:"operation-patch-unknown-key",opIndex:_,entity:b.entity,handle:b.operation,keys:$});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId,patch:b.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=b.kind==="attribute.reorder",R=yt(e,b.entity);if(!R.ok){s.push(gt(R.reason,_,b.entity,R.matches,k));break}const $=x?b.order:b.operations,B=[],O=new Set;let y=!1;for(const D of $){if(!x&&ll(D)){s.push({code:"handle-by-unsupported",opIndex:_,entity:b.entity,handle:D,target:"operation"}),y=!0;continue}const U=x?Hd(R.value,D):Kd(R.value,D);if(!U.ok){s.push(U.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:_,entity:b.entity,handle:D}:{code:"reorder-handle-ambiguous",opIndex:_,entity:b.entity,handle:D,matches:U.matches}),y=!0;continue}if(O.has(U.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:_,entity:b.entity,handle:D}),y=!0;continue}O.add(U.value.modelId),B.push(U.value)}if(y)break;const v=[...x?R.value.attributes:R.value.operations??[]].sort((D,U)=>D.order-U.order).filter(D=>!O.has(D.modelId)),M=[...B,...v];if(M.forEach((D,U)=>{D.order!==U&&l.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:D.modelId,patch:{order:U}}:{kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:D.modelId,patch:{order:U}})}),x)for(const D of Fd(e,R.value.modelId,M.map(U=>U.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:D.entityId,entityRef:D.entityId,attributeRef:D.attributeId,patch:{dbAttrs:D.dbAttrs}});break}case"group.add":{const x=[];let R=!1;for(const O of b.spec.members){const y=yt(e,O);if(!y.ok){s.push(gt(y.reason,_,O,y.matches,k)),R=!0;continue}x.push(y.value.modelId)}if(R)break;const $=i(),B={modelId:$,excludeDDLGeneration:b.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...b.spec.name?{name:b.spec.name}:{},...b.spec.packageName?{packageName:b.spec.packageName}:{},...b.spec.description?{description:b.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:$,value:B});break}case"group.update":{const x=al(e,b.group);if(!x.ok){s.push(rl(x,_,b.group));break}const R=Eo(b.patch,Zg);if(R.length){s.push({code:"group-patch-unknown-key",opIndex:_,handle:b.group,keys:R});break}l.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:b.patch});break}case"group.remove":{const x=al(e,b.group);if(!x.ok){s.push(rl(x,_,b.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=al(e,b.group);if(!x.ok){s.push(rl(x,_,b.group));break}const R=yt(e,b.entity);if(!R.ok){s.push(gt(R.reason,_,b.entity,R.matches,k));break}const $=x.value.memberEntityRefs.includes(R.value.modelId);if(b.kind==="group.addMember"?$:!$)break;if(b.kind==="group.removeMember"){if(h.has(g(x.value.modelId,R.value.modelId)))break;h.add(g(x.value.modelId,R.value.modelId))}l.push({kind:b.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:R.value.modelId});break}}}),s.length||pb(l,e,f,p),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function gt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function Zd(e,n,o,i,a){const r=yt(e,n.from),l=yt(e,n.to);if(r.ok||i.push(gt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(gt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Ud(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:n}:{code:"association-ambiguous",opIndex:o,handle:n,matches:s.map(c=>c.modelId)}),null):s[0]}const Qd={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},yb={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},gb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},bb={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},wn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},_b={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...wn,description:"속성 설명(다국어)."},columnLogicalName:{...wn,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},kb={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},eu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Eb={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...eu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...eu,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},Nb={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Qd,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},wb={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...wn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Ib={type:"object",properties:{name:{...wn,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},vb={type:"object",description:"기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부).",properties:{name:{type:"string"},type:{type:"string"},customType:{type:"string"},attrType:{type:"string",enum:[...Ld],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},description:{...wn,description:"속성 설명(다국어)."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...wn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},xb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Cb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Sb={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...wn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Rb={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경.'},Ab={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function it(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const $b={"entity.add":it("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":it("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":it("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":it("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":it("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":it("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":it("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":it("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":it("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":it("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":it("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":it("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":it("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":it("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":it("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":it("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":it("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":it("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":it("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":it("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":it("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":it("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":it("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},Tb={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},Mb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...wn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},tu={anyOf:Od.map(e=>$b[e])},Vb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Qd,nameHandle:yb,groupHandle:Tb,assocHandle:gb,entitySpec:bb,attrSpec:_b,embeddableOverrides:kb,assocSpec:Eb,indexSpec:Nb,operationSpec:wb,groupSpec:Ib,entityUpdatePatch:Rb,attrUpdatePatch:vb,assocUpdatePatch:xb,assocEndUpdatePatch:Ab,indexUpdatePatch:Cb,operationUpdatePatch:Sb,groupUpdatePatch:Mb,symbolicOp:tu}};function Bb(e,n,o,i={}){const a=i.mkClientOpId??Me,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const nu={location:{x:0,y:0},size:{width:220,height:140}};function ou(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Db=/^[-=_*~\s]{3,}$/;function Ob(e){return e.attrType&&e.attrType!=="NORMAL"||!Db.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Lb(e){return e.type===tn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Pb(e,n){if(e.attrType==="DIVIDER"||Ob(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=Lb(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(ou)}}function zb(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Fb(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(n=>({columnRef:n.targetColumn.refId,descending:n.descending}))}}function Ub(e){var n,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(Pb),operations:(n=e.operations)==null?void 0:n.map(zb),indexes:(o=e.indexes)==null?void 0:o.map(Fb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Hb(e){const n={};for(const i of e.attributes)i.style&&(n[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...nu},style:e.style,attributeStyles:Object.keys(n).length?n:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function iu(e){return e.jpaAttribute?{fetchType:e.jpaAttribute.fetchType,cascadeTypes:e.jpaAttribute.cascadeTypes,orphanRemoval:e.jpaAttribute.orphanRemoval,orderBy:e.jpaAttribute.orderBy,collectionType:e.jpaAttribute.collectionType,collectionTable:e.jpaAttribute.collectionTable,orderColumn:e.jpaAttribute.orderColumn}:void 0}function dl(e){var n;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(n=e.attribute)==null?void 0:n.modelId,jpa:iu(e)}}function jb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>ul(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Kb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:jb(e),end1:dl(e.end1),end2:dl(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 ul(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function au(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function ru(e){var o;const n=e.attribute;return(n==null?void 0:n.attrType)==="EMBED_OWN"&&(((o=n.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function lu(e,n){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:n,dbAttrs:(e.dbAttrs??[]).map(ou)}}function Gb(e,n,o){var E,I;const i=ul(e.end1.attribute),a=ul(e.end2.attribute);if(i===a)return Kb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(I=(E=s.dbAttrs)==null?void 0:E[0])==null?void 0:I.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((A,T)=>Math.max(A,T.order),-1)+1:s.order??0,p={...lu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const f=n.get(r.endModel.refId),h=l.attribute;let g;if(h&&f&&r.navigable){const A=Ui(l.multiplicity);g={modelId:h.modelId??crypto.randomUUID(),name:uo(h.name??ji((u==null?void 0:u.name)??l.endModel.refId,A),new Set(f.attributes.map(T=>T.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((T,L)=>Math.max(T,L.order),-1)+1,dbAttrs:[]},f.attributes.push(g)}const k=(A,T)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:T?g==null?void 0:g.modelId:p.modelId,jpa:iu(A)}),N=r.endModel.refId===l.endModel.refId,b={modelId:e.modelId,description:e.description,identifying:!N&&p.identifier===!0?!0:void 0,end1:k(e.end1,i),end2:k(e.end2,a)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:b,layout:_}}function Yb(e,n){const o=e.targetModelId?n.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function qb(e,n,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((g,k)=>Math.max(g,k.order),-1)+1:l.order??0,d={...lu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Yb(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...dl(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function Wb(e,n){var i,a,r,l;const o=[];for(const s of n){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function su(e,n={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=Wb(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+n.x,y:a.location.y+n.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function cu(e,n,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(n.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function Jb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(p=>p.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(p=>p.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=Ui(i.end2.multiplicity),u=ji(r.name,d),m=uo(u,new Set(a.attributes.map(p=>p.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((p,f)=>Math.max(p,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function Xb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function du(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if((l==null?void 0:l.stereotype)==="JPA_EMBEDDABLE")continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Ks(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function uu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?Zb(n):Qb(n)}function Zb(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:p,...f}=m;return p!=null&&(o[m.modelId]=p),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);Jb(a,r),Xb(a,r),du(a,r);const{version:s,...c}=e.layout;cu(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Qb(e){var N,b;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(_,E)=>{o.push(Ub(_));const I=Hb(_);I.geo={location:{x:I.geo.location.x+E.x,y:I.geo.location.y+E.y},size:I.geo.size},i.push(I);for(const A of _.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const _ of e.entities??[])d(_,u);const m=[];for(const _ of e.groups??[]){const E=_.entities??[];l.push({modelId:_.modelId,name:_.name,description:_.description,packageName:_.packageName,excludeDDLGeneration:_.excludeDDLGeneration??!1,memberEntityRefs:E.map(A=>A.modelId)});const I=((N=_.geo)==null?void 0:N.location)??u;if(_.geo){const A=(_.notes??[]).map(T=>T.modelId);s.push({groupRef:_.modelId,geo:_.geo,style:_.style,locked:_.locked,memberNoteRefs:A.length?A:void 0})}for(const A of E)d(A,I);for(const A of _.notes??[])m.push(su(A,I))}const p=new Map(o.map(_=>[_.modelId,_])),f=new Map,h=new Map;for(const _ of o)for(const E of _.attributes)for(const I of E.dbAttrs)f.set(I.modelId,E.modelId),h.set(I.modelId,I);for(const _ of c)for(const E of[_.end1,_.end2]){const I=E.attribute;if(I&&(((b=I.dbAttrs)==null?void 0:b.length)??0)>0)for(const A of I.dbAttrs)A.modelId&&f.set(A.modelId,I.modelId)}for(const _ of c){const E=au(_.end1.attribute),I=au(_.end2.attribute),A=ru(_.end1)||ru(_.end2),{assoc:T,layout:L}=E!==I||A?qb(_,p,h):Gb(_,p,f);a.push(T),r.push(L)}cu(o,a,r),Lc(o),du(o,a);const g={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(_=>su(_)),...m]}},k={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:k}}function mu(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function e_(e,n){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(mu),style:n}}function t_(e,n){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:n}}function n_(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(n=>({targetColumn:{refId:n.columnRef},descending:n.descending}))}}function In(e,n){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:n??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function o_(e,n){const o=n==null?void 0:n.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...mu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function i_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function fu(e,n){const o=l=>{if(!l.attributeRef)return;const s=n.logical.entities.find(c=>c.modelId===l.entityRef);return s==null?void 0:s.attributes.find(c=>c.modelId===l.attributeRef)},i=o(e.end1),a=o(e.end2),r=l=>(l==null?void 0:l.attrType)==="RELATION_OWN"?l:void 0;return(i==null?void 0:i.attrType)==="RELATION_REF"?{navEnd:e.end1,fkEnd:e.end2,navAttr:i,fk:r(a)}:(a==null?void 0:a.attrType)==="RELATION_REF"?{navEnd:e.end2,fkEnd:e.end1,navAttr:a,fk:r(i)}:null}function a_(e){const n=new Set;for(const o of e.logical.associations){const i=fu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function r_(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function l_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function s_(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:l_(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function c_(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var h;return((h=f.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,p)=>s_(m,l[p]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:In(e.end1,c?s:u),end2:In(e.end2,c?u:s)}}function d_(e,n,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:In(e.end1,e.end1.legacyEmbedRaw),end2:In(e.end2,e.end2.legacyEmbedRaw)};const a=c_(e,n,i);if(a)return a;const r=fu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?o_(r.fk,l):void 0,c=i_(r.navAttr);return{...i,end1:In(e.end1,r.navEnd===e.end1?s:c),end2:In(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:In(e.end1),end2:In(e.end2)}}function pu(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(p=>p.entityRef===e.modelId),l=n.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>n.layout.associationLayouts.find(f=>f.associationRef===p),c=(r==null?void 0:r.geo)??{...nu},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(p=>!o.has(p.modelId)&&!i.has(p.modelId)).map(p=>{var f;return e_(p,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var f;return t_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>d_(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(n_),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function u_(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>hu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>pu(c,n,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function hu(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function m_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=a_(e),r=r_(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:n.id,diagramVersion:n.diagramVersion,version:n.version,size:n.size??e.layout.canvasSize,packageName:n.packageName??e.logical.packageName,entities:i.map(s=>pu(s,e,a,r)),groups:e.logical.groups.map(s=>u_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>hu(s))}}function f_(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,referenceOnly:n.referenceOnly,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const p_=["notNull"];function h_(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=uu(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(p=>[p.modelId,p]))]));for(const m of i.logical.entities){const p=c.get(m.modelId);if(p)for(const f of m.attributes){const h=p.get(f.modelId);if(!h){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const g={};for(const k of p_)f[k]===!0!=(h[k]===!0)&&(g[k]=f[k],s.attributeFieldsByName[k]=(s.attributeFieldsByName[k]??0)+1);Object.keys(g).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:g}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const p=d.get(m.modelId);p&&(m.end1.attributeRef&&m.end1.attributeRef!==p.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&p.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function ni(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function an(e){return typeof e=="function"?e():t.unref(e)}const y_=typeof window<"u"&&typeof document<"u",g_=e=>typeof e<"u",b_=Object.prototype.toString,__=e=>b_.call(e)==="[object Object]",k_=()=>{};function E_(e,n){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>n.apply(this,i),{fn:n,thisArg:this,args:i})).then(a).catch(r)})}return o}const yu=e=>e();function N_(e=yu){const n=t.ref(!0);function o(){n.value=!1}function i(){n.value=!0}const a=(...r)=>{n.value&&e(...r)};return{isActive:t.readonly(n),pause:o,resume:i,eventFilter:a}}function gu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function w_(e,n,o={}){const{eventFilter:i=yu,...a}=o;return t.watch(e,E_(i,n),a)}function wo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=N_(i);return{stop:w_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function I_(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=an(n.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function ml(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:h,throwOnTimeout:g}={}){let k=null;const b=[new Promise(_=>{k=t.watch(e,E=>{m(E)!==n&&(k==null||k(),_(E))},{flush:p,deep:f,immediate:!0})})];return h!=null&&b.push(gu(h,g).then(()=>an(e)).finally(()=>k==null?void 0:k())),Promise.race(b)}function i(m,p){if(!t.isRef(m))return o(E=>E===m,p);const{flush:f="sync",deep:h=!1,timeout:g,throwOnTimeout:k}=p??{};let N=null;const _=[new Promise(E=>{N=t.watch([e,m],([I,A])=>{n!==(I===A)&&(N==null||N(),E(I))},{flush:f,deep:h,immediate:!0})})];return g!=null&&_.push(gu(g,k).then(()=>an(e)).finally(()=>(N==null||N(),an(e)))),Promise.race(_)}function a(m){return o(p=>!!p,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,p){return o(f=>{const h=Array.from(f);return h.includes(m)||h.includes(an(m))},p)}function d(m){return u(1,m)}function u(m=1,p){let f=-1;return o(()=>(f+=1,f>=m),p)}return Array.isArray(an(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return ml(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return ml(e,!n)}}}function fl(e){return ml(e)}function v_(e){var n;const o=an(e);return(n=o==null?void 0:o.$el)!=null?n:o}const bu=y_?window:void 0;function _u(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=bu):[n,o,i,a]=e,!n)return k_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,p,f)=>(u.addEventListener(m,p,f),()=>u.removeEventListener(m,p,f)),c=t.watch(()=>[v_(n),an(a)],([u,m])=>{if(l(),!u)return;const p=__(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(h=>s(u,f,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ni(d),d}function x_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function ku(...e){let n,o,i={};e.length===3?(n=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],i=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:a=bu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=x_(n);return _u(a,r,u=>{u.repeat&&an(s)||c(u)&&o(u)},l)}function C_(e){return JSON.parse(JSON.stringify(e))}function pl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:p}=i,f=t.getCurrentInstance(),h=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=d;n||(n="modelValue"),g=g||`update:${n.toString()}`;const k=_=>s?typeof s=="function"?s(_):C_(_):_,N=()=>g_(e[n])?k(e[n]):m,b=_=>{p?p(_)&&h(g,_):h(g,_)};if(c){const _=N(),E=t.ref(_);let I=!1;return t.watch(()=>e[n],A=>{I||(I=!0,E.value=k(A),t.nextTick(()=>I=!1))}),t.watch(E,A=>{!I&&(A!==e[n]||u)&&b(A)},{deep:u}),E}else return t.computed({get(){return N()},set(_){b(_)}})}var S_={value:()=>{}};function ma(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new fa(o)}function fa(e){this._=e}function R_(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}fa.prototype=ma.prototype={constructor:fa,on:function(e,n){var o=this._,i=R_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=A_(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Eu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Eu(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new fa(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function A_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Eu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=S_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var hl="http://www.w3.org/1999/xhtml";const Nu={svg:"http://www.w3.org/2000/svg",xhtml:hl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Nu.hasOwnProperty(n)?{space:Nu[n],local:e}:e}function $_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===hl&&n.documentElement.namespaceURI===hl?n.createElement(e):n.createElementNS(o,e)}}function T_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wu(e){var n=pa(e);return(n.local?T_:$_)(n)}function M_(){}function yl(e){return e==null?M_:function(){return this.querySelector(e)}}function V_(e){typeof e!="function"&&(e=yl(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Ct(i,this._parents)}function B_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function D_(){return[]}function Iu(e){return e==null?D_:function(){return this.querySelectorAll(e)}}function O_(e){return function(){return B_(e.apply(this,arguments))}}function L_(e){typeof e=="function"?e=O_(e):e=Iu(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Ct(i,a)}function vu(e){return function(){return this.matches(e)}}function xu(e){return function(n){return n.matches(e)}}var P_=Array.prototype.find;function z_(e){return function(){return P_.call(this.children,e)}}function F_(){return this.firstElementChild}function U_(e){return this.select(e==null?F_:z_(typeof e=="function"?e:xu(e)))}var H_=Array.prototype.filter;function j_(){return Array.from(this.children)}function K_(e){return function(){return H_.call(this.children,e)}}function G_(e){return this.selectAll(e==null?j_:K_(typeof e=="function"?e:xu(e)))}function Y_(e){typeof e!="function"&&(e=vu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Ct(i,this._parents)}function Cu(e){return new Array(e.length)}function q_(){return new Ct(this._enter||this._groups.map(Cu),this._parents)}function ha(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ha.prototype={constructor:ha,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function W_(e){return function(){return e}}function J_(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new ha(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function X_(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ha(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function Z_(e){return e.__data__}function Q_(e,n){if(!arguments.length)return Array.from(this,Z_);var o=n?X_:J_,i=this._parents,a=this._groups;typeof e!="function"&&(e=W_(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=ek(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),k=l[d]=new Array(h),N=c[d]=new Array(p);o(u,m,g,k,N,f,n);for(var b=0,_=0,E,I;b<h;++b)if(E=g[b]){for(b>=_&&(_=b+1);!(I=k[_])&&++_<h;);E._next=I||null}}return l=new Ct(l,i),l._enter=s,l._exit=c,l}function ek(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function tk(){return new Ct(this._exit||this._groups.map(Cu),this._parents)}function nk(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function ok(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Ct(s,this._parents)}function ik(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function ak(e){e||(e=rk);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Ct(a,this._parents).order()}function rk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function lk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sk(){return Array.from(this)}function ck(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function dk(){let e=0;for(const n of this)++e;return e}function uk(){return!this.node()}function mk(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function fk(e){return function(){this.removeAttribute(e)}}function pk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hk(e,n){return function(){this.setAttribute(e,n)}}function yk(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function gk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function bk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function _k(e,n){var o=pa(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?pk:fk:typeof n=="function"?o.local?bk:gk:o.local?yk:hk)(o,n))}function Su(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kk(e){return function(){this.style.removeProperty(e)}}function Ek(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Nk(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function wk(e,n,o){return arguments.length>1?this.each((n==null?kk:typeof n=="function"?Nk:Ek)(e,n,o??"")):Io(this.node(),e)}function Io(e,n){return e.style.getPropertyValue(n)||Su(e).getComputedStyle(e,null).getPropertyValue(n)}function Ik(e){return function(){delete this[e]}}function vk(e,n){return function(){this[e]=n}}function xk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ck(e,n){return arguments.length>1?this.each((n==null?Ik:typeof n=="function"?xk:vk)(e,n)):this.node()[e]}function Ru(e){return e.trim().split(/^|\s+/)}function gl(e){return e.classList||new Au(e)}function Au(e){this._node=e,this._names=Ru(e.getAttribute("class")||"")}Au.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function $u(e,n){for(var o=gl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Tu(e,n){for(var o=gl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Sk(e){return function(){$u(this,e)}}function Rk(e){return function(){Tu(this,e)}}function Ak(e,n){return function(){(n.apply(this,arguments)?$u:Tu)(this,e)}}function $k(e,n){var o=Ru(e+"");if(arguments.length<2){for(var i=gl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Ak:n?Sk:Rk)(o,n))}function Tk(){this.textContent=""}function Mk(e){return function(){this.textContent=e}}function Vk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Bk(e){return arguments.length?this.each(e==null?Tk:(typeof e=="function"?Vk:Mk)(e)):this.node().textContent}function Dk(){this.innerHTML=""}function Ok(e){return function(){this.innerHTML=e}}function Lk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Pk(e){return arguments.length?this.each(e==null?Dk:(typeof e=="function"?Lk:Ok)(e)):this.node().innerHTML}function zk(){this.nextSibling&&this.parentNode.appendChild(this)}function Fk(){return this.each(zk)}function Uk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Hk(){return this.each(Uk)}function jk(e){var n=typeof e=="function"?e:wu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Kk(){return null}function Gk(e,n){var o=typeof e=="function"?e:wu(e),i=n==null?Kk:typeof n=="function"?n:yl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Yk(){var e=this.parentNode;e&&e.removeChild(this)}function qk(){return this.each(Yk)}function Wk(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Jk(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Xk(e){return this.select(e?Jk:Wk)}function Zk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Qk(e){return function(n){e.call(this,n,this.__data__)}}function eE(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function tE(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function nE(e,n,o){return function(){var i=this.__on,a,r=Qk(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function oE(e,n,o){var i=eE(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?nE:tE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Mu(e,n,o){var i=Su(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function iE(e,n){return function(){return Mu(this,e,n)}}function aE(e,n){return function(){return Mu(this,e,n.apply(this,arguments))}}function rE(e,n){return this.each((typeof n=="function"?aE:iE)(e,n))}function*lE(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Vu=[null];function Ct(e,n){this._groups=e,this._parents=n}function oi(){return new Ct([[document.documentElement]],Vu)}function sE(){return this}Ct.prototype=oi.prototype={constructor:Ct,select:V_,selectAll:L_,selectChild:U_,selectChildren:G_,filter:Y_,data:Q_,enter:q_,exit:tk,join:nk,merge:ok,selection:sE,order:ik,sort:ak,call:lk,nodes:sk,node:ck,size:dk,empty:uk,each:mk,attr:_k,style:wk,property:Ck,classed:$k,text:Bk,html:Pk,raise:Fk,lower:Hk,append:jk,insert:Gk,remove:qk,clone:Xk,datum:Zk,on:oE,dispatch:rE,[Symbol.iterator]:lE};function Mt(e){return typeof e=="string"?new Ct([[document.querySelector(e)]],[document.documentElement]):new Ct([[e]],Vu)}function cE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Gt(e,n){if(e=cE(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const dE={passive:!1},ii={capture:!0,passive:!1};function bl(e){e.stopImmediatePropagation()}function vo(e){e.preventDefault(),e.stopImmediatePropagation()}function Bu(e){var n=e.document.documentElement,o=Mt(e).on("dragstart.drag",vo,ii);"onselectstart"in n?o.on("selectstart.drag",vo,ii):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Du(e,n){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);n&&(i.on("click.drag",vo,ii),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const ya=e=>()=>e;function _l(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}})}_l.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function uE(e){return!e.ctrlKey&&!e.button}function mE(){return this.parentNode}function fE(e,n){return n??{x:e.x,y:e.y}}function pE(){return navigator.maxTouchPoints||"ontouchstart"in this}function hE(){var e=uE,n=mE,o=fE,i=pE,a={},r=ma("start","drag","end"),l=0,s,c,d,u,m=0;function p(E){E.on("mousedown.drag",f).filter(i).on("touchstart.drag",k).on("touchmove.drag",N,dE).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(E,I){if(!(u||!e.call(this,E,I))){var A=_(this,n.call(this,E,I),E,I,"mouse");A&&(Mt(E.view).on("mousemove.drag",h,ii).on("mouseup.drag",g,ii),Bu(E.view),bl(E),d=!1,s=E.clientX,c=E.clientY,A("start",E))}}function h(E){if(vo(E),!d){var I=E.clientX-s,A=E.clientY-c;d=I*I+A*A>m}a.mouse("drag",E)}function g(E){Mt(E.view).on("mousemove.drag mouseup.drag",null),Du(E.view,d),vo(E),a.mouse("end",E)}function k(E,I){if(e.call(this,E,I)){var A=E.changedTouches,T=n.call(this,E,I),L=A.length,x,R;for(x=0;x<L;++x)(R=_(this,T,E,I,A[x].identifier,A[x]))&&(bl(E),R("start",E,A[x]))}}function N(E){var I=E.changedTouches,A=I.length,T,L;for(T=0;T<A;++T)(L=a[I[T].identifier])&&(vo(E),L("drag",E,I[T]))}function b(E){var I=E.changedTouches,A=I.length,T,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),T=0;T<A;++T)(L=a[I[T].identifier])&&(bl(E),L("end",E,I[T]))}function _(E,I,A,T,L,x){var R=r.copy(),$=Gt(x||A,I),B,O,y;if((y=o.call(E,new _l("beforestart",{sourceEvent:A,target:p,identifier:L,active:l,x:$[0],y:$[1],dx:0,dy:0,dispatch:R}),T))!=null)return B=y.x-$[0]||0,O=y.y-$[1]||0,function w(v,M,D){var U=$,W;switch(v){case"start":a[L]=w,W=l++;break;case"end":delete a[L],--l;case"drag":$=Gt(D||M,I),W=l;break}R.call(v,E,new _l(v,{sourceEvent:M,subject:y,target:p,identifier:L,active:W,x:$[0]+B,y:$[1]+O,dx:$[0]-U[0],dy:$[1]-U[1],dispatch:R}),T)}}return p.filter=function(E){return arguments.length?(e=typeof E=="function"?E:ya(!!E),p):e},p.container=function(E){return arguments.length?(n=typeof E=="function"?E:ya(E),p):n},p.subject=function(E){return arguments.length?(o=typeof E=="function"?E:ya(E),p):o},p.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:ya(!!E),p):i},p.on=function(){var E=r.on.apply(r,arguments);return E===r?p:E},p.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,p):Math.sqrt(m)},p}function kl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Ou(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ai(){}var ri=.7,ga=1/ri,xo="\\s*([+-]?\\d+)\\s*",li="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yE=/^#([0-9a-f]{3,8})$/,gE=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),bE=new RegExp(`^rgb\\(${Yt},${Yt},${Yt}\\)$`),_E=new RegExp(`^rgba\\(${xo},${xo},${xo},${li}\\)$`),kE=new RegExp(`^rgba\\(${Yt},${Yt},${Yt},${li}\\)$`),EE=new RegExp(`^hsl\\(${li},${Yt},${Yt}\\)$`),NE=new RegExp(`^hsla\\(${li},${Yt},${Yt},${li}\\)$`),Lu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};kl(ai,Hn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Pu,formatHex:Pu,formatHex8:wE,formatHsl:IE,formatRgb:zu,toString:zu});function Pu(){return this.rgb().formatHex()}function wE(){return this.rgb().formatHex8()}function IE(){return Ku(this).formatHsl()}function zu(){return this.rgb().formatRgb()}function Hn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=yE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Fu(n):o===3?new wt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ba(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ba(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=gE.exec(e))?new wt(n[1],n[2],n[3],1):(n=bE.exec(e))?new wt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=_E.exec(e))?ba(n[1],n[2],n[3],n[4]):(n=kE.exec(e))?ba(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=EE.exec(e))?ju(n[1],n[2]/100,n[3]/100,1):(n=NE.exec(e))?ju(n[1],n[2]/100,n[3]/100,n[4]):Lu.hasOwnProperty(e)?Fu(Lu[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function Fu(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function ba(e,n,o,i){return i<=0&&(e=n=o=NaN),new wt(e,n,o,i)}function vE(e){return e instanceof ai||(e=Hn(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function El(e,n,o,i){return arguments.length===1?vE(e):new wt(e,n,o,i??1)}function wt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}kl(wt,El,Ou(ai,{brighter(e){return e=e==null?ga:Math.pow(ga,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ri:Math.pow(ri,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(jn(this.r),jn(this.g),jn(this.b),_a(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Uu,formatHex:Uu,formatHex8:xE,formatRgb:Hu,toString:Hu}));function Uu(){return`#${Kn(this.r)}${Kn(this.g)}${Kn(this.b)}`}function xE(){return`#${Kn(this.r)}${Kn(this.g)}${Kn(this.b)}${Kn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hu(){const e=_a(this.opacity);return`${e===1?"rgb(":"rgba("}${jn(this.r)}, ${jn(this.g)}, ${jn(this.b)}${e===1?")":`, ${e})`}`}function _a(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function jn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Kn(e){return e=jn(e),(e<16?"0":"")+e.toString(16)}function ju(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Vt(e,n,o,i)}function Ku(e){if(e instanceof Vt)return new Vt(e.h,e.s,e.l,e.opacity);if(e instanceof ai||(e=Hn(e)),!e)return new Vt;if(e instanceof Vt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Vt(l,s,c,e.opacity)}function CE(e,n,o,i){return arguments.length===1?Ku(e):new Vt(e,n,o,i??1)}function Vt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}kl(Vt,CE,Ou(ai,{brighter(e){return e=e==null?ga:Math.pow(ga,e),new Vt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ri:Math.pow(ri,e),new Vt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new wt(Nl(e>=240?e-240:e+120,a,i),Nl(e,a,i),Nl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Vt(Gu(this.h),ka(this.s),ka(this.l),_a(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=_a(this.opacity);return`${e===1?"hsl(":"hsla("}${Gu(this.h)}, ${ka(this.s)*100}%, ${ka(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Gu(e){return e=(e||0)%360,e<0?e+360:e}function ka(e){return Math.max(0,Math.min(1,e||0))}function Nl(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 wl=e=>()=>e;function SE(e,n){return function(o){return e+o*n}}function RE(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function AE(e){return(e=+e)==1?Yu:function(n,o){return o-n?RE(n,o,e):wl(isNaN(n)?o:n)}}function Yu(e,n){var o=n-e;return o?SE(e,o):wl(isNaN(e)?n:e)}const Ea=(function e(n){var o=AE(n);function i(a,r){var l=o((a=El(a)).r,(r=El(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Yu(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function $E(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,i=n.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+n[a]*r;return i}}function TE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ME(e,n){var o=n?n.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=si(e[l],n[l]);for(;l<o;++l)r[l]=n[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function VE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function qt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function BE(e,n){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in e?o[a]=si(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Il=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vl=new RegExp(Il.source,"g");function DE(e){return function(){return e}}function OE(e){return function(n){return e(n)+""}}function qu(e,n){var o=Il.lastIndex=vl.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Il.exec(e))&&(a=vl.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:qt(i,a)})),o=vl.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?OE(c[0].x):DE(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function si(e,n){var o=typeof n,i;return n==null||o==="boolean"?wl(n):(o==="number"?qt:o==="string"?(i=Hn(n))?(n=i,Ea):qu:n instanceof Hn?Ea:n instanceof Date?VE:TE(n)?$E:Array.isArray(n)?ME:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?BE:qt)(e,n)}var Wu=180/Math.PI,xl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ju(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Wu,skewX:Math.atan(c)*Wu,scaleX:l,scaleY:s}}var Na;function LE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?xl:Ju(n.a,n.b,n.c,n.d,n.e,n.f)}function PE(e){return e==null||(Na||(Na=document.createElementNS("http://www.w3.org/2000/svg","g")),Na.setAttribute("transform",e),!(e=Na.transform.baseVal.consolidate()))?xl:(e=e.matrix,Ju(e.a,e.b,e.c,e.d,e.e,e.f))}function Xu(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:qt(d,m)},{i:g-2,x:qt(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:qt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:qt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:qt(d,m)},{i:g-2,x:qt(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,k;++h<g;)m[(k=p[h]).i]=k.x(f);return m.join("")}}}var zE=Xu(LE,"px, ","px)","deg)"),FE=Xu(PE,", ",")",")"),UE=1e-12;function Zu(e){return((e=Math.exp(e))+1/e)/2}function HE(e){return((e=Math.exp(e))-1/e)/2}function jE(e){return((e=Math.exp(2*e))-1)/(e+1)}const wa=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,k,N;if(g<UE)N=Math.log(p/d)/n,k=function(T){return[s+T*f,c+T*h,d*Math.exp(n*T*N)]};else{var b=Math.sqrt(g),_=(p*p-d*d+i*g)/(2*d*o*b),E=(p*p-d*d-i*g)/(2*p*o*b),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(E*E+1)-E);N=(A-I)/n,k=function(T){var L=T*N,x=Zu(I),R=d/(o*b)*(x*jE(n*L+I)-HE(I));return[s+R*f,c+R*h,d*x/Zu(n*L+I)]}}return k.duration=N*1e3*n/Math.SQRT2,k}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Co=0,ci=0,di=0,Qu=1e3,Ia,ui,va=0,Gn=0,xa=0,mi=typeof performance=="object"&&performance.now?performance:Date,em=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cl(){return Gn||(em(KE),Gn=mi.now()+xa)}function KE(){Gn=0}function Ca(){this._call=this._time=this._next=null}Ca.prototype=tm.prototype={constructor:Ca,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Cl():+o)+(n==null?0:+n),!this._next&&ui!==this&&(ui?ui._next=this:Ia=this,ui=this),this._call=e,this._time=o,Sl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Sl())}};function tm(e,n,o){var i=new Ca;return i.restart(e,n,o),i}function GE(){Cl(),++Co;for(var e=Ia,n;e;)(n=Gn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Co}function nm(){Gn=(va=mi.now())+xa,Co=ci=0;try{GE()}finally{Co=0,qE(),Gn=0}}function YE(){var e=mi.now(),n=e-va;n>Qu&&(xa-=n,va=e)}function qE(){for(var e,n=Ia,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ia=o);ui=e,Sl(i)}function Sl(e){if(!Co){ci&&(ci=clearTimeout(ci));var n=e-Gn;n>24?(e<1/0&&(ci=setTimeout(nm,e-mi.now()-xa)),di&&(di=clearInterval(di))):(di||(va=mi.now(),di=setInterval(YE,Qu)),Co=1,em(nm))}}function om(e,n,o){var i=new Ca;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var WE=ma("start","end","cancel","interrupt"),JE=[],im=0,am=1,Rl=2,Sa=3,rm=4,Al=5,Ra=6;function Aa(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;XE(e,o,{name:n,index:i,group:a,on:WE,tween:JE,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:im})}function $l(e,n){var o=Bt(e,n);if(o.state>im)throw new Error("too late; already scheduled");return o}function Wt(e,n){var o=Bt(e,n);if(o.state>Sa)throw new Error("too late; already running");return o}function Bt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function XE(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=tm(r,0,o.time);function r(d){o.state=am,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==am)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Sa)return om(l);f.state===rm?(f.state=Ra,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Ra,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(om(function(){o.state===Sa&&(o.state=rm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Rl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Rl){for(o.state=Sa,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Al,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===Al&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ra,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function $a(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>Rl&&i.state<Al,i.state=Ra,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function ZE(e){return this.each(function(){$a(this,e)})}function QE(e,n){var o,i;return function(){var a=Wt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function e1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Wt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function t1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Bt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?QE:e1)(o,e,n))}function Tl(e,n,o){var i=e._id;return e.each(function(){var a=Wt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Bt(a,i).value[n]}}function lm(e,n){var o;return(typeof n=="number"?qt:n instanceof Hn?Ea:(o=Hn(n))?(n=o,Ea):qu)(e,n)}function n1(e){return function(){this.removeAttribute(e)}}function o1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function i1(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function a1(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function r1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function l1(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function s1(e,n){var o=pa(e),i=o==="transform"?FE:lm;return this.attrTween(e,typeof n=="function"?(o.local?l1:r1)(o,i,Tl(this,"attr."+e,n)):n==null?(o.local?o1:n1)(o):(o.local?a1:i1)(o,i,n))}function c1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function d1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function u1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&d1(e,r)),o}return a._value=n,a}function m1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&c1(e,r)),o}return a._value=n,a}function f1(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=pa(e);return this.tween(o,(i.local?u1:m1)(i,n))}function p1(e,n){return function(){$l(this,e).delay=+n.apply(this,arguments)}}function h1(e,n){return n=+n,function(){$l(this,e).delay=n}}function y1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?p1:h1)(n,e)):Bt(this.node(),n).delay}function g1(e,n){return function(){Wt(this,e).duration=+n.apply(this,arguments)}}function b1(e,n){return n=+n,function(){Wt(this,e).duration=n}}function _1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?g1:b1)(n,e)):Bt(this.node(),n).duration}function k1(e,n){if(typeof n!="function")throw new Error;return function(){Wt(this,e).ease=n}}function E1(e){var n=this._id;return arguments.length?this.each(k1(n,e)):Bt(this.node(),n).ease}function N1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Wt(this,e).ease=o}}function w1(e){if(typeof e!="function")throw new Error;return this.each(N1(this._id,e))}function I1(e){typeof e!="function"&&(e=vu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new rn(i,this._parents,this._name,this._id)}function v1(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new rn(l,this._parents,this._name,this._id)}function x1(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function C1(e,n,o){var i,a,r=x1(n)?$l:Wt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function S1(e,n){var o=this._id;return arguments.length<2?Bt(this.node(),o).on.on(e):this.each(C1(o,e,n))}function R1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function A1(){return this.on("end.remove",R1(this._id))}function $1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=yl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Aa(d[p],n,o,p,d,Bt(u,o)));return new rn(r,this._parents,n,o)}function T1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Iu(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=Bt(u,o),g=0,k=p.length;g<k;++g)(f=p[g])&&Aa(f,n,o,g,p,h);r.push(p),l.push(u)}return new rn(r,l,n,o)}var M1=oi.prototype.constructor;function V1(){return new M1(this._groups,this._parents)}function B1(e,n){var o,i,a;return function(){var r=Io(this,e),l=(this.style.removeProperty(e),Io(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function sm(e){return function(){this.style.removeProperty(e)}}function D1(e,n,o){var i,a=o+"",r;return function(){var l=Io(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function O1(e,n,o){var i,a,r;return function(){var l=Io(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Io(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function L1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Wt(this,e),d=c.on,u=c.value[r]==null?s||(s=sm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function P1(e,n,o){var i=(e+="")=="transform"?zE:lm;return n==null?this.styleTween(e,B1(e,i)).on("end.style."+e,sm(e)):typeof n=="function"?this.styleTween(e,O1(e,i,Tl(this,"style."+e,n))).each(L1(this._id,e)):this.styleTween(e,D1(e,i,n),o).on("end.style."+e,null)}function z1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function F1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&z1(e,l,o)),i}return r._value=n,r}function U1(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,F1(e,n,o??""))}function H1(e){return function(){this.textContent=e}}function j1(e){return function(){var n=e(this);this.textContent=n??""}}function K1(e){return this.tween("text",typeof e=="function"?j1(Tl(this,"text",e)):H1(e==null?"":e+""))}function G1(e){return function(n){this.textContent=e.call(this,n)}}function Y1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&G1(a)),n}return i._value=e,i}function q1(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,Y1(e))}function W1(){for(var e=this._name,n=this._id,o=cm(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Bt(c,n);Aa(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new rn(i,this._parents,e,o)}function J1(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Wt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var X1=0;function rn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function cm(){return++X1}var ln=oi.prototype;rn.prototype={constructor:rn,select:$1,selectAll:T1,selectChild:ln.selectChild,selectChildren:ln.selectChildren,filter:I1,merge:v1,selection:V1,transition:W1,call:ln.call,nodes:ln.nodes,node:ln.node,size:ln.size,empty:ln.empty,each:ln.each,on:S1,attr:s1,attrTween:f1,style:P1,styleTween:U1,text:K1,textTween:q1,remove:A1,tween:t1,delay:y1,duration:_1,ease:E1,easeVarying:w1,end:J1,[Symbol.iterator]:ln[Symbol.iterator]};function Z1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Q1={time:null,delay:0,duration:250,ease:Z1};function e0(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function t0(e){var n,o;e instanceof rn?(n=e._id,e=e._name):(n=cm(),(o=Q1).time=Cl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Aa(c,e,n,d,l,o||e0(c,n));return new rn(i,this._parents,e,n)}oi.prototype.interrupt=ZE,oi.prototype.transition=t0;const Ta=e=>()=>e;function n0(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function sn(e,n,o){this.k=e,this.x=n,this.y=o}sn.prototype={constructor:sn,scale:function(e){return e===1?this:new sn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new sn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var So=new sn(1,0,0);sn.prototype;function Ml(e){e.stopImmediatePropagation()}function fi(e){e.preventDefault(),e.stopImmediatePropagation()}function o0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function i0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function dm(){return this.__zoom||So}function a0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function r0(){return navigator.maxTouchPoints||"ontouchstart"in this}function l0(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function s0(){var e=o0,n=i0,o=l0,i=a0,a=r0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=wa,d=ma("start","zoom","end"),u,m,p,f=500,h=150,g=0,k=10;function N(y){y.property("__zoom",dm).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(y,w,v,M){var D=y.selection?y.selection():y;D.property("__zoom",dm),y!==D?I(y,w,v,M):D.interrupt().each(function(){A(this,arguments).event(M).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},N.scaleBy=function(y,w,v,M){N.scaleTo(y,function(){var D=this.__zoom.k,U=typeof w=="function"?w.apply(this,arguments):w;return D*U},v,M)},N.scaleTo=function(y,w,v,M){N.transform(y,function(){var D=n.apply(this,arguments),U=this.__zoom,W=v==null?E(D):typeof v=="function"?v.apply(this,arguments):v,ie=U.invert(W),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(b(U,pe),W,ie),D,l)},v,M)},N.translateBy=function(y,w,v,M){N.transform(y,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,M)},N.translateTo=function(y,w,v,M,D){N.transform(y,function(){var U=n.apply(this,arguments),W=this.__zoom,ie=M==null?E(U):typeof M=="function"?M.apply(this,arguments):M;return o(So.translate(ie[0],ie[1]).scale(W.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),U,l)},M,D)};function b(y,w){return w=Math.max(r[0],Math.min(r[1],w)),w===y.k?y:new sn(w,y.x,y.y)}function _(y,w,v){var M=w[0]-v[0]*y.k,D=w[1]-v[1]*y.k;return M===y.x&&D===y.y?y:new sn(y.k,M,D)}function E(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function I(y,w,v,M){y.on("start.zoom",function(){A(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,U=arguments,W=A(D,U).event(M),ie=n.apply(D,U),pe=v==null?E(ie):typeof v=="function"?v.apply(D,U):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=D.__zoom,me=typeof w=="function"?w.apply(D,U):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new sn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}W.zoom(null,ke)}})}function A(y,w,v){return!v&&y.__zooming||new T(y,w)}function T(y,w){this.that=y,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(y,w),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,w){return this.mouse&&y!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var w=Mt(this.that).datum();d.call(y,this.that,new n0(y,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:d}),w)}};function L(y,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(y),M=this.__zoom,D=Math.max(r[0],Math.min(r[1],M.k*Math.pow(2,i.apply(this,arguments)))),U=Gt(y);if(v.wheel)(v.mouse[0][0]!==U[0]||v.mouse[0][1]!==U[1])&&(v.mouse[1]=M.invert(v.mouse[0]=U)),clearTimeout(v.wheel);else{if(M.k===D)return;v.mouse=[U,M.invert(U)],$a(this),v.start()}fi(y),v.wheel=setTimeout(W,h),v.zoom("mouse",o(_(b(M,D),v.mouse[0],v.mouse[1]),v.extent,l));function W(){v.wheel=null,v.end()}}function x(y,...w){if(p||!e.apply(this,arguments))return;var v=y.currentTarget,M=A(this,w,!0).event(y),D=Mt(y.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),U=Gt(y,v),W=y.clientX,ie=y.clientY;Bu(y.view),Ml(y),M.mouse=[U,this.__zoom.invert(U)],$a(this),M.start();function pe(ge){if(fi(ge),!M.moved){var me=ge.clientX-W,se=ge.clientY-ie;M.moved=me*me+se*se>g}M.event(ge).zoom("mouse",o(_(M.that.__zoom,M.mouse[0]=Gt(ge,v),M.mouse[1]),M.extent,l))}function ye(ge){D.on("mousemove.zoom mouseup.zoom",null),Du(ge.view,M.moved),fi(ge),M.event(ge).end()}}function R(y,...w){if(e.apply(this,arguments)){var v=this.__zoom,M=Gt(y.changedTouches?y.changedTouches[0]:y,this),D=v.invert(M),U=v.k*(y.shiftKey?.5:2),W=o(_(b(v,U),M,D),n.apply(this,w),l);fi(y),s>0?Mt(this).transition().duration(s).call(I,W,M,y):Mt(this).call(N.transform,W,M,y)}}function $(y,...w){if(e.apply(this,arguments)){var v=y.touches,M=v.length,D=A(this,w,y.changedTouches.length===M).event(y),U,W,ie,pe;for(Ml(y),W=0;W<M;++W)ie=v[W],pe=Gt(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],D.touch0?!D.touch1&&D.touch0[2]!==pe[2]&&(D.touch1=pe,D.taps=0):(D.touch0=pe,U=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),U&&(D.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),$a(this),D.start())}}function B(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W,ie,pe;for(fi(y),U=0;U<D;++U)W=M[U],ie=Gt(W,this),v.touch0&&v.touch0[2]===W.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===W.identifier&&(v.touch1[0]=ie);if(W=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;W=b(W,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(_(W,ie,pe),v.extent,l))}}function O(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W;for(Ml(y),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),U=0;U<D;++U)W=M[U],v.touch0&&v.touch0[2]===W.identifier?delete v.touch0:v.touch1&&v.touch1[2]===W.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(W=Gt(W,this),Math.hypot(m[0]-W[0],m[1]-W[1])<k)){var ie=Mt(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return N.wheelDelta=function(y){return arguments.length?(i=typeof y=="function"?y:Ta(+y),N):i},N.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ta(!!y),N):e},N.touchable=function(y){return arguments.length?(a=typeof y=="function"?y:Ta(!!y),N):a},N.extent=function(y){return arguments.length?(n=typeof y=="function"?y:Ta([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),N):n},N.scaleExtent=function(y){return arguments.length?(r[0]=+y[0],r[1]=+y[1],N):[r[0],r[1]]},N.translateExtent=function(y){return arguments.length?(l[0][0]=+y[0][0],l[1][0]=+y[1][0],l[0][1]=+y[0][1],l[1][1]=+y[1][1],N):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},N.constrain=function(y){return arguments.length?(o=y,N):o},N.duration=function(y){return arguments.length?(s=+y,N):s},N.interpolate=function(y){return arguments.length?(c=y,N):c},N.on=function(){var y=d.on.apply(d,arguments);return y===d?N:y},N.clickDistance=function(y){return arguments.length?(g=(y=+y)*y,N):Math.sqrt(g)},N.tapDistance=function(y){return arguments.length?(k=+y,N):k},N}var $e=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))($e||{}),Vl=(e=>(e.Partial="partial",e.Full="full",e))(Vl||{}),Yn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Yn||{}),cn=(e=>(e.Strict="strict",e.Loose="loose",e))(cn||{}),Bl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Bl||{}),pi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(pi||{}),um=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(um||{});const c0=["INPUT","SELECT","TEXTAREA"],d0=typeof document<"u"?document:null;function Dl(e){var n,o;const i=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return c0.includes(i==null?void 0:i.nodeName)||a||!!r}function u0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function mm(e,n,o,i){const a=n.replace("+",`
|
|
28
28
|
`).replace(`
|
|
29
29
|
|
|
30
30
|
`,`
|
|
31
31
|
+`).split(`
|
|
32
|
-
`).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===n.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function m0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=f0(o.code,e);return Array.isArray(e)?e.some(a=>mm(o[i],a,n,o.type==="keyup")):mm(o[i],e,n,o.type==="keyup")}}function f0(e,n){return n.includes(e)?"code":"key"}function hi(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??d0),i=t.shallowRef(t.toValue(e)===!0);let a=!1;const r=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),_u(["blur","contextmenu"],s),ku((...d)=>l(...d),d=>{var u,m;const p=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,f=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=u0(d),(!a||a&&!p)&&Bl(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,k=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!f&&(a||!k)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),ku((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Bl(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=t.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?m0(d,r):d}return i}const fm="vue-flow__node-desc",pm="vue-flow__edge-desc",p0="vue-flow__aria-live",hm=["Enter"," ","Escape"],Ro={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ma(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Va(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*i)}function Ba(e){return{width:e.offsetWidth,height:e.offsetHeight}}function qn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function ym(e,n){return{x:qn(e.x,n[0][0],n[1][0]),y:qn(e.y,n[0][1],n[1][1])}}function gm(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function vn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Wn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!vn(e)}function yi(e){return Wn(e)&&"computedPosition"in e}function Da(e){return!Number.isNaN(e)&&Number.isFinite(e)}function h0(e){return Da(e.width)&&Da(e.height)&&Da(e.x)&&Da(e.y)}function y0(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function bm(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function _m(e,n,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return n.filter(s=>r.has(s.id))}function g0(...e){if(e.length===3){const[r,l,s]=e;return _m(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>vn(r)&&r.source===i).map(r=>o.find(l=>Wn(l)&&l.id===r.target))}function b0(...e){if(e.length===3){const[r,l,s]=e;return _m(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>vn(r)&&r.target===i).map(r=>o.find(l=>Wn(l)&&l.id===r.source))}function km({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function _0(e,n){return n.some(o=>vn(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function gi({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function bi({x:e,y:n},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(n-i)/a};return r?La(s,l):s}function Em(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function Oa({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function Nm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function k0(e,n){return Nm(Em(Oa(e),Oa(n)))}function Dl(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];n=Em(n,Oa({...i.computedPosition,...i.dimensions}))}return Nm(n)}function wm(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...bi(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,p=c.height??s.height??null;if(a&&!d||u)continue;const f=Va(r,Ma(s)),h=m===null||p===null,g=i&&f>0,k=(m??0)*(p??0);(h||g||f>=k||s.dragging)&&l.push(s)}return l}function Jn(e,n){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return n.filter(i=>o.has(i.source)||o.has(i.target))}function Ao(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(n*o*.01)}return Ei(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function E0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=Ao(e,o),a=Ao(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Ao(e.top??e.y??0,o),a=Ao(e.bottom??e.y??0,o),r=Ao(e.left??e.x??0,n),l=Ao(e.right??e.x??0,n);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function N0(e,n,o,i,a,r){const{x:l,y:s}=gi(e,{x:n,y:o,zoom:i}),{x:c,y:d}=gi({x:e.x+e.width,y:e.y+e.height},{x:n,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function Im(e,n,o,i,a,r=.1){const l=E0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=qn(d,i,a),m=e.x+e.width/2,p=e.y+e.height/2,f=n/2-m*u,h=o/2-p*u,g=N0(e,f,h,u,n,o),k={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:f-k.left+k.right,y:h-k.top+k.bottom,zoom:u}}function w0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function vm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:vm(o,n):!1}function _i(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Ol(e){const n=e.ctrlKey&&ki()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function xm(e,n,o){return e<n?qn(Math.abs(e-n),1,n)/n:e>o?-qn(Math.abs(e-o),1,n)/n:0}function Cm(e,n,o=15,i=40){const a=xm(e.x,i,n.width-i)*o,r=xm(e.y,i,n.height-i)*o;return[a,r]}function Ll(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,i=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof n.style=="function"?a={...n.style(n)}:n.style&&(a={...n.style}),a.width=a.width??`${n.dimensions.width}px`,a.height=a.height??`${n.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(n.position.x=n.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(n.position.y=n.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}n.dimensions.width=Number(a.width.toString().replace("px","")),n.dimensions.height=Number(a.height.toString().replace("px","")),typeof n.style=="function"?n.style=r=>{const l=n.style;return{...l(r),...a}}:n.style={...n.style,...a}}}}function Sm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(yi(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&yi(c)&&Ll(l,c)}break;case"dimensions":if(yi(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&yi(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Ll(l,c):t.nextTick(()=>{Ll(l,c)}))}break}return n}function xn(e,n){return{id:e,type:"select",selected:n}}function Rm(e){return{item:e,type:"add"}}function Am(e){return{id:e,type:"remove"}}function $m(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Cn(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(xn(r.id,l)))}return i}const Tm=()=>{};function Re(e){const n=new Set;let o=Tm,i=()=>!1;const a=()=>n.size>0||i(),r=p=>{o=p},l=()=>{o=Tm},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{n.delete(p)};return{on:p=>{n.add(p);const f=()=>d(p);return ni(f),{off:f}},off:d,trigger:p=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(h=>h(p)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Mm(e,n,o){let i=e;do{if(i&&i.matches(n))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function I0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!vm(c,e))&&(c.draggable||n&&typeof c.draggable>"u")&&e.get(s)&&l.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((r=c.computedPosition)==null?void 0:r.y)||0},from:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(l.values())}function Pl({id:e,dragItems:n,findNode:o}){const i=[];for(const a of n){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function Vm(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function v0(e,n,o){const[i,a,r,l]=typeof e!="string"?Vm(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function x0(e,n,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const r=v0(a,e,i);r&&(a=r)}else n(new ft(st.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Vm(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function C0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function zl(e,n,o,i,a){const r=C0(e.dimensions,x0(e,o,i,a)),l=ym(n,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function $o(e,n,o=$e.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??$0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case $e.Top:return{x:a+l/2,y:r};case $e.Right:return{x:a+l,y:r+s/2};case $e.Bottom:return{x:a+l/2,y:r+s};case $e.Left:return{x:a,y:r+s/2}}}function Bm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function S0({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+a),y2:Math.max(e.y+i,n.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=Oa({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),p=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*p)>0}function R0(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var st=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(st||{});const Dm={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
32
|
+
`).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===n.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function m0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=f0(o.code,e);return Array.isArray(e)?e.some(a=>mm(o[i],a,n,o.type==="keyup")):mm(o[i],e,n,o.type==="keyup")}}function f0(e,n){return n.includes(e)?"code":"key"}function hi(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??d0),i=t.shallowRef(t.toValue(e)===!0);let a=!1;const r=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),_u(["blur","contextmenu"],s),ku((...d)=>l(...d),d=>{var u,m;const p=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,f=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=u0(d),(!a||a&&!p)&&Dl(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,k=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!f&&(a||!k)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),ku((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Dl(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=t.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?m0(d,r):d}return i}const fm="vue-flow__node-desc",pm="vue-flow__edge-desc",p0="vue-flow__aria-live",hm=["Enter"," ","Escape"],Ro={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ma(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Va(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*i)}function Ba(e){return{width:e.offsetWidth,height:e.offsetHeight}}function qn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function ym(e,n){return{x:qn(e.x,n[0][0],n[1][0]),y:qn(e.y,n[0][1],n[1][1])}}function gm(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function vn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Wn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!vn(e)}function yi(e){return Wn(e)&&"computedPosition"in e}function Da(e){return!Number.isNaN(e)&&Number.isFinite(e)}function h0(e){return Da(e.width)&&Da(e.height)&&Da(e.x)&&Da(e.y)}function y0(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function bm(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function _m(e,n,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return n.filter(s=>r.has(s.id))}function g0(...e){if(e.length===3){const[r,l,s]=e;return _m(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>vn(r)&&r.source===i).map(r=>o.find(l=>Wn(l)&&l.id===r.target))}function b0(...e){if(e.length===3){const[r,l,s]=e;return _m(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>vn(r)&&r.target===i).map(r=>o.find(l=>Wn(l)&&l.id===r.source))}function km({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function _0(e,n){return n.some(o=>vn(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function gi({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function bi({x:e,y:n},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(n-i)/a};return r?La(s,l):s}function Em(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function Oa({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function Nm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function k0(e,n){return Nm(Em(Oa(e),Oa(n)))}function Ol(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];n=Em(n,Oa({...i.computedPosition,...i.dimensions}))}return Nm(n)}function wm(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...bi(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,p=c.height??s.height??null;if(a&&!d||u)continue;const f=Va(r,Ma(s)),h=m===null||p===null,g=i&&f>0,k=(m??0)*(p??0);(h||g||f>=k||s.dragging)&&l.push(s)}return l}function Jn(e,n){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return n.filter(i=>o.has(i.source)||o.has(i.target))}function Ao(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(n*o*.01)}return Ei(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function E0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=Ao(e,o),a=Ao(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Ao(e.top??e.y??0,o),a=Ao(e.bottom??e.y??0,o),r=Ao(e.left??e.x??0,n),l=Ao(e.right??e.x??0,n);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function N0(e,n,o,i,a,r){const{x:l,y:s}=gi(e,{x:n,y:o,zoom:i}),{x:c,y:d}=gi({x:e.x+e.width,y:e.y+e.height},{x:n,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function Im(e,n,o,i,a,r=.1){const l=E0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=qn(d,i,a),m=e.x+e.width/2,p=e.y+e.height/2,f=n/2-m*u,h=o/2-p*u,g=N0(e,f,h,u,n,o),k={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:f-k.left+k.right,y:h-k.top+k.bottom,zoom:u}}function w0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function vm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:vm(o,n):!1}function _i(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Ll(e){const n=e.ctrlKey&&ki()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function xm(e,n,o){return e<n?qn(Math.abs(e-n),1,n)/n:e>o?-qn(Math.abs(e-o),1,n)/n:0}function Cm(e,n,o=15,i=40){const a=xm(e.x,i,n.width-i)*o,r=xm(e.y,i,n.height-i)*o;return[a,r]}function Pl(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,i=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof n.style=="function"?a={...n.style(n)}:n.style&&(a={...n.style}),a.width=a.width??`${n.dimensions.width}px`,a.height=a.height??`${n.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(n.position.x=n.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(n.position.y=n.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}n.dimensions.width=Number(a.width.toString().replace("px","")),n.dimensions.height=Number(a.height.toString().replace("px","")),typeof n.style=="function"?n.style=r=>{const l=n.style;return{...l(r),...a}}:n.style={...n.style,...a}}}}function Sm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(yi(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&yi(c)&&Pl(l,c)}break;case"dimensions":if(yi(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&yi(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Pl(l,c):t.nextTick(()=>{Pl(l,c)}))}break}return n}function xn(e,n){return{id:e,type:"select",selected:n}}function Rm(e){return{item:e,type:"add"}}function Am(e){return{id:e,type:"remove"}}function $m(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Cn(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(xn(r.id,l)))}return i}const Tm=()=>{};function Re(e){const n=new Set;let o=Tm,i=()=>!1;const a=()=>n.size>0||i(),r=p=>{o=p},l=()=>{o=Tm},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{n.delete(p)};return{on:p=>{n.add(p);const f=()=>d(p);return ni(f),{off:f}},off:d,trigger:p=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(h=>h(p)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Mm(e,n,o){let i=e;do{if(i&&i.matches(n))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function I0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!vm(c,e))&&(c.draggable||n&&typeof c.draggable>"u")&&e.get(s)&&l.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((r=c.computedPosition)==null?void 0:r.y)||0},from:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(l.values())}function zl({id:e,dragItems:n,findNode:o}){const i=[];for(const a of n){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function Vm(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function v0(e,n,o){const[i,a,r,l]=typeof e!="string"?Vm(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function x0(e,n,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const r=v0(a,e,i);r&&(a=r)}else n(new ft(st.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Vm(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function C0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Fl(e,n,o,i,a){const r=C0(e.dimensions,x0(e,o,i,a)),l=ym(n,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function $o(e,n,o=$e.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??$0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case $e.Top:return{x:a+l/2,y:r};case $e.Right:return{x:a+l,y:r+s/2};case $e.Bottom:return{x:a+l/2,y:r+s};case $e.Left:return{x:a,y:r+s/2}}}function Bm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function S0({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+a),y2:Math.max(e.y+i,n.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=Oa({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),p=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*p)>0}function R0(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var st=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(st||{});const Dm={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
33
33
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
34
34
|
Node: ${e}`,NODE_MISSING_PARENT:(e,n)=>`Node is missing a parent
|
|
35
35
|
Node: ${e}
|
|
@@ -49,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=Dm[n])==null?void 0:i.call(Dm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Fl(e){return"clientX"in e}function A0(e){return"sourceEvent"in e}function Jt(e,n){const o=Fl(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}}const ki=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function $0(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function La(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const T0=()=>!0;function Ul(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function M0(e,n,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of n.values())Va(a,Ma(r))>0&&i.push(r);return i}const V0=250;function B0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=M0(e,o,n+V0);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:p,y:f}=$o(d,m,m.position,!0),h=Math.sqrt((p-e.x)**2+(f-e.y)**2);h>n||(h<s?(l=[{...m,x:p,y:f}],s=h):h===s&&l.push({...m,x:p,y:f}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function Om(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=T0},u,m,p,f){const h=r==="target",g=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:k,y:N}=Jt(e),b=l.elementFromPoint(k,N),_=b!=null&&b.classList.contains(`${s}-flow__handle`)?b:g,E={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const I=Lm(void 0,_),A=_.getAttribute("data-nodeid"),T=_.getAttribute("data-handleid"),L=_.classList.contains("connectable"),x=_.classList.contains("connectableend");if(!A||!I)return E;const R={source:h?A:i,sourceHandle:h?T:a,target:h?i:A,targetHandle:h?a:T};E.connection=R;const B=L&&x&&(o===cn.Strict?h&&I==="source"||!h&&I==="target":A!==i||T!==a);E.isValid=B&&d(R,{nodes:m,edges:u,sourceNode:p(R.source),targetNode:p(R.target)}),E.toHandle=Pm(A,I,T,f,o,!0)}return E}function Lm(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function D0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function O0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Pm(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===cn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...$o(d,m,m.position,!0)}:m}const Hl={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},L0=["production","prod"];function Ei(e,...n){zm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function zm(){return!L0.includes(process.env.NODE_ENV||"")}function Fm(e,n,o,i,a){const r=n.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Ba(l)}}):null}function jl(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ct(e){return typeof t.unref(e)<"u"}function P0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ft(st.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return vn(e)?a=e:a={...e,id:km(e)},a=bm(a,void 0,i),_0(a,n)?!1:a}function z0(e,n,o,i,a){if(!n.source||!n.target)return a(new ft(st.EDGE_INVALID,e.id)),!1;if(!o)return a(new ft(st.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?km(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Um(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Wn(l)){o(new ft(st.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=y0(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new ft(st.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Hm(e,n,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,n)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,n)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,n))}}function Kl(e,n,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;Hm("source",c,u,e,a,l),Hm("target",c,d,e,r,s)}}function jm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Gl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=vn(d)?d:P0(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new ft(st.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ft(st.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new ft(st.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new ft(st.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...bm(u,f,r),sourceNode:m,targetNode:p})}return c}const Km=Symbol("vueFlow"),Gm=Symbol("nodeId"),Ym=Symbol("nodeRef"),F0=Symbol("edgeId"),U0=Symbol("edgeRef"),Pa=Symbol("slots");function qm(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:p,findNode:f,multiSelectionActive:h,nodesSelectionActive:g,selectNodesOnDrag:k,removeSelectedElements:N,addSelectedNodes:b,updateNodePositions:_,emits:E}=je(),{onStart:I,onDrag:A,onStop:T,onClick:L,el:x,disabled:R,id:$,selectable:B,dragHandle:O}=e,y=t.shallowRef(!1);let w=[],v,M=null,D={x:void 0,y:void 0},U={x:0,y:0},W=null,ie=!1,pe=!1,ye=0,ge=!1;const me=K0(),se=({x:le,y:ue})=>{D={x:le,y:ue};let z=!1;if(w=w.map(P=>{const F={x:le-P.distance.x,y:ue-P.distance.y},{computedPosition:Q}=zl(P,o.value?La(F,i.value):F,E.error,l.value,P.parentNode?f(P.parentNode):void 0);return z=z||P.position.x!==Q.x||P.position.y!==Q.y,P.position=Q,P}),pe=pe||z,!!z&&(_(w,!0,!0),y.value=!0,W)){const[P,F]=Pl({id:$,dragItems:w,findNode:f});A({event:W,node:P,nodes:F})}},ke=()=>{if(!M)return;const[le,ue]=Cm(U,M,u.value);if(le!==0||ue!==0){const z={x:(D.x??0)-le/c.value.zoom,y:(D.y??0)-ue/c.value.zoom};p({x:le,y:ue})&&se(z)}ye=requestAnimationFrame(ke)},Se=(le,ue)=>{ie=!0;const z=f($);!k.value&&!h.value&&z&&(z.selected||N()),z&&t.toValue(B)&&k.value&&jl(z,h.value,b,N,g,!1,ue);const P=me(le.sourceEvent);if(D=P,w=I0(r.value,m.value,P,$),w.length){const[F,Q]=Pl({id:$,dragItems:w,findNode:f});I({event:le.sourceEvent,node:F,nodes:Q})}},ce=(le,ue)=>{var z;le.sourceEvent.type==="touchmove"&&le.sourceEvent.touches.length>1||(pe=!1,s.value===0&&Se(le,ue),D=me(le.sourceEvent),M=((z=n.value)==null?void 0:z.getBoundingClientRect())||null,U=Jt(le.sourceEvent,M))},fe=(le,ue)=>{const z=me(le.sourceEvent);if(!ge&&ie&&d.value&&(ge=!0,ke()),!ie){const P=z.xSnapped-(D.x??0),F=z.ySnapped-(D.y??0);Math.sqrt(P*P+F*F)>s.value&&Se(le,ue)}(D.x!==z.xSnapped||D.y!==z.ySnapped)&&w.length&&ie&&(W=le.sourceEvent,U=Jt(le.sourceEvent,M),se(z))},oe=le=>{let ue=!1;if(!ie&&!y.value&&!h.value){const z=le.sourceEvent,P=me(z),F=P.xSnapped-(D.x??0),Q=P.ySnapped-(D.y??0),X=Math.sqrt(F*F+Q*Q);X!==0&&X<=s.value&&(L==null||L(z),ue=!0)}if(w.length&&!ue){pe&&(_(w,!1,!1),pe=!1);const[z,P]=Pl({id:$,dragItems:w,findNode:f});T({event:le.sourceEvent,node:z,nodes:P})}w=[],y.value=!1,ge=!1,ie=!1,D={x:void 0,y:void 0},cancelAnimationFrame(ye)};return t.watch([()=>t.toValue(R),x],([le,ue],z,P)=>{if(ue){const F=Mt(ue);le||(v=hE().on("start",Q=>ce(Q,ue)).on("drag",Q=>fe(Q,ue)).on("end",Q=>oe(Q)).filter(Q=>{const X=Q.target,_e=t.toValue(O);return!Q.button&&(!a.value||!Mm(X,`.${a.value}`,ue)&&(!_e||Mm(X,_e,ue)))}),F.call(v)),P(()=>{F.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),y}function H0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),updateStart:Re(),update:Re(),updateEnd:Re()}}function j0(e,n){const o=H0();return o.doubleClick.on(i=>{var a,r;n.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;n.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;n.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;n.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function K0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=je();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=A0(a)?a.sourceEvent:a,{x:c,y:d}=Jt(s,l),u=bi({x:c,y:d},e.value),{x:m,y:p}=o.value?La(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function za(){return!0}function Wm({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:p,nodesConnectable:f,autoPanOnConnect:h,autoPanSpeed:g,findNode:k,panBy:N,startConnection:b,updateConnection:_,endConnection:E,emits:I,viewport:A,edges:T,nodes:L,isValidConnection:x,nodeLookup:R}=je();let $=null,B=!1,O=null;function y(v){var M;const D=t.toValue(o)==="target",U=Fl(v),W=gm(v.target),ie=v.currentTarget;if(ie&&(U&&v.button===0||!U)){let pe=function(Ie){z=Jt(Ie,oe),se=B0(bi(z,A.value,!1,[1,1]),u.value,R.value,Q),P||(F(),P=!0);const Y=Om(Ie,{handle:se,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:D?"target":"source",isValidConnection:me,doc:W,lib:"vue",flowId:s,nodeLookup:R.value},T.value,L.value,k,R.value);O=Y.handleDomNode,$=Y.connection,B=O0(!!se,Y.isValid);const j={...we,isValid:B,to:Y.toHandle&&B?gi({x:Y.toHandle.x,y:Y.toHandle.y},A.value):z,toHandle:Y.toHandle,toPosition:B&&Y.toHandle?Y.toHandle.position:Hl[Q.position],toNode:Y.toHandle?R.value.get(Y.toHandle.nodeId):null};if(B&&se&&(we!=null&&we.toHandle)&&j.toHandle&&we.toHandle.type===j.toHandle.type&&we.toHandle.nodeId===j.toHandle.nodeId&&we.toHandle.id===j.toHandle.id&&we.to.x===j.to.x&&we.to.y===j.to.y)return;const J=se??Y.toHandle;if(_(J&&B?gi({x:J.x,y:J.y},A.value):z,J,D0(!!J,B)),we=j,!se&&!B&&!O)return Ul(ue);$&&$.source!==$.target&&O&&(Ul(ue),ue=O,O.classList.add("connecting","vue-flow__handle-connecting"),O.classList.toggle("valid",!!B),O.classList.toggle("vue-flow__handle-valid",!!B))},ye=function(Ie){"touches"in Ie&&Ie.touches.length>0||((se||O)&&$&&B&&(r?r(Ie,$):I.connect($)),I.connectEnd(Ie),a&&(l==null||l(Ie)),Ul(ue),cancelAnimationFrame(ke),E(Ie),P=!1,B=!1,$=null,O=null,W.removeEventListener("mousemove",pe),W.removeEventListener("mouseup",ye),W.removeEventListener("touchmove",pe),W.removeEventListener("touchend",ye))};const ge=k(t.toValue(n));let me=t.toValue(i)||x.value||za;!me&&ge&&(me=(D?ge.isValidSourcePos:ge.isValidTargetPos)||za);let se,ke=0;const{x:Se,y:ce}=Jt(v),fe=Lm(t.toValue(a),ie),oe=(M=c.value)==null?void 0:M.getBoundingClientRect();if(!oe||!fe)return;const le=Pm(t.toValue(n),fe,t.toValue(e),R.value,d.value);if(!le)return;let ue,z=Jt(v,oe),P=!1;const F=()=>{if(!h.value)return;const[Ie,Y]=Cm(z,oe,g.value);N({x:Ie,y:Y}),ke=requestAnimationFrame(F)},Q={...le,nodeId:t.toValue(n),type:fe,position:le.position},X=R.value.get(t.toValue(n)),he={inProgress:!0,isValid:null,from:$o(X,Q,$e.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:X,to:z,toHandle:null,toPosition:Hl[Q.position],toNode:null};b({nodeId:t.toValue(n),id:t.toValue(e),type:fe,position:(ie==null?void 0:ie.getAttribute("data-handlepos"))||$e.Top,...z},{x:Se-oe.left,y:ce-oe.top}),I.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:fe});let we=he;W.addEventListener("mousemove",pe),W.addEventListener("mouseup",ye),W.addEventListener("touchmove",pe),W.addEventListener("touchend",ye)}}function w(v){var M,D;if(!m.value)return;const U=t.toValue(o)==="target";if(!p.value){I.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),b({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:$e.Top,...Jt(v)},void 0,!0);return}let W=t.toValue(i)||x.value||za;const ie=k(t.toValue(n));if(!W&&ie&&(W=(U?ie.isValidSourcePos:ie.isValidTargetPos)||za),ie&&(typeof ie.connectable>"u"?f.value:ie.connectable)===!1)return;const pe=gm(v.target),ye=Om(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:$e.Top,...Jt(v)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:W,doc:pe,lib:"vue",flowId:s,nodeLookup:R.value},T.value,L.value,k,R.value),ge=((M=ye.connection)==null?void 0:M.source)===((D=ye.connection)==null?void 0:D.target);ye.isValid&&ye.connection&&!ge&&I.connect(ye.connection),I.clickConnectEnd(v),E(v,!0)}return{handlePointerDown:y,handleClick:w}}function G0(){return t.inject(Gm,"")}function Jm(e){const n=e??G0()??"",o=t.inject(Ym,t.ref(null)),{findNode:i,edges:a,emits:r}=je(),l=i(n);return l||r.error(new ft(st.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Jn([l],a.value))}}function Y0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),dragStart:Re(),drag:Re(),dragStop:Re()}}function q0(e,n){const o=Y0();return o.doubleClick.on(i=>{var a,r;n.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;n.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;n.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;n.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function Xm(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=je();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,p=d?4:1,f=c.x*u*p,h=c.y*m*p,g=[];for(const k of e.value)if(k.draggable||l&&typeof k.draggable>"u"){const N={x:k.computedPosition.x+f,y:k.computedPosition.y+h},{position:b}=zl(k,N,s.error,n.value,k.parentNode?i(k.parentNode):void 0);g.push({id:k.id,position:b,from:k.position,distance:{x:c.x,y:c.y},dimensions:k.dimensions})}o(g,!0,!1)}}const Fa=.1,W0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Sn(){return Ei("Viewport not initialized yet."),Promise.resolve(!1)}const J0={zoomIn:Sn,zoomOut:Sn,zoomTo:Sn,fitView:Sn,setCenter:Sn,fitBounds:Sn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Sn,setTransform:Sn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function X0(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?si:wa).scaleBy(Yl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=ym({x:-i,y:-a},e.translateExtent),m=So.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?si:wa).transform(Yl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>n(1.2,a),zoomOut:a=>n(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?si:wa).scaleTo(Yl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(a={padding:Fa,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Dl(s),{x:d,y:u,zoom:m}=Im(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Fa);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:Fa})=>{const{x:l,y:s,zoom:c}=Im(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Fa);return o(l,s,c,r)},project:a=>bi(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return bi(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return gi(s,e.viewport)}return{x:0,y:0}}}:J0)}function Yl(e,n=0,o=W0,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function Z0(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,k,N=!!(o.nodes.value.length||o.edges.value.length);g=wo([e.modelValue,()=>{var b,_;return(_=(b=e.modelValue)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setElements(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([b,_])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...b,..._],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},r=()=>{i.run(()=>{let g,k,N=!!o.nodes.value.length;g=wo([e.nodes,()=>{var b,_;return(_=(b=e.nodes)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setNodes(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.nodes,()=>o.nodes.value.length],([b])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...b],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},l=()=>{i.run(()=>{let g,k,N=!!o.edges.value.length;g=wo([e.edges,()=>{var b,_;return(_=(b=e.edges)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setEdges(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.edges,()=>o.edges.value.length],([b])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...b],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ct(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ct(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ct(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ct(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ct(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const g=async k=>{let N=k;typeof n.autoConnect=="function"&&(N=await n.autoConnect(k)),N!==!1&&o.addEdges([N])};t.watch(()=>n.autoConnect,()=>{ct(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(k,N,b)=>{k?o.onConnect(g):o.hooks.value.connect.off(g),b(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},f=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const k of Object.keys(n)){const N=k;if(!g.includes(N)){const b=t.toRef(()=>n[N]),_=o[N];t.isRef(_)&&i.run(()=>{t.watch(b,E=>{ct(E)&&(_.value=E)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function Q0(){return{edgesChange:Re(),nodesChange:Re(),nodeDoubleClick:Re(),nodeClick:Re(),nodeMouseEnter:Re(),nodeMouseMove:Re(),nodeMouseLeave:Re(),nodeContextMenu:Re(),nodeDragStart:Re(),nodeDrag:Re(),nodeDragStop:Re(),nodesInitialized:Re(),miniMapNodeClick:Re(),miniMapNodeDoubleClick:Re(),miniMapNodeMouseEnter:Re(),miniMapNodeMouseMove:Re(),miniMapNodeMouseLeave:Re(),connect:Re(),connectStart:Re(),connectEnd:Re(),clickConnectStart:Re(),clickConnectEnd:Re(),paneReady:Re(),init:Re(),move:Re(),moveStart:Re(),moveEnd:Re(),selectionDragStart:Re(),selectionDrag:Re(),selectionDragStop:Re(),selectionContextMenu:Re(),selectionStart:Re(),selectionEnd:Re(),viewportChangeStart:Re(),viewportChange:Re(),viewportChangeEnd:Re(),paneScroll:Re(),paneClick:Re(),paneContextMenu:Re(),paneMouseEnter:Re(),paneMouseMove:Re(),paneMouseLeave:Re(),edgeContextMenu:Re(),edgeMouseEnter:Re(),edgeMouseMove:Re(),edgeMouseLeave:Re(),edgeDoubleClick:Re(),edgeClick:Re(),edgeUpdateStart:Re(),edgeUpdate:Re(),edgeUpdateEnd:Re(),updateNodeInternals:Re(),error:Re(e=>Ei(e.message))}}function eN(e,n){const o=t.getCurrentInstance();t.onBeforeMount(()=>{for(const[a,r]of Object.entries(n.value)){const l=s=>{e(a,s)};r.setEmitter(l),ni(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),ni(r.removeHasEmitListeners)}});function i(a){var r;const l=tN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function tN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Zm(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Ml.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:pi.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Yn.Bezier,style:{}},connectionMode:cn.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:ki()?"Meta":"Control",zoomActivationKeyCode:ki()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Q0(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const nN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function oN(e,n,o){const i=X0(e),a=z=>{const P=z??[];e.hooks.updateNodeInternals.trigger(P)},r=z=>b0(z,e.nodes,e.edges),l=z=>g0(z,e.nodes,e.edges),s=z=>Jn(z,e.edges),c=({id:z,type:P,nodeId:F})=>{var Q;const X=z?`-${P}-${z}`:`-${P}`;return Array.from(((Q=e.connectionLookup.get(`${F}${X}`))==null?void 0:Q.values())??[])},d=z=>{if(z)return n.value.get(z)},u=z=>{if(z)return o.value.get(z)},m=(z,P,F)=>{var Q,X;const _e=[];for(const he of z){const we={id:he.id,type:"position",dragging:F,from:he.from};if(P&&(we.position=he.position,he.parentNode)){const Ie=d(he.parentNode);we.position={x:we.position.x-(((Q=Ie==null?void 0:Ie.computedPosition)==null?void 0:Q.x)??0),y:we.position.y-(((X=Ie==null?void 0:Ie.computedPosition)==null?void 0:X.y)??0)}}_e.push(we)}_e!=null&&_e.length&&e.hooks.nodesChange.trigger(_e)},p=z=>{if(!e.vueFlowRef)return;const P=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!P)return;const F=window.getComputedStyle(P),{m22:Q}=new window.DOMMatrixReadOnly(F.transform),X=[];for(const _e of z){const he=_e,we=d(he.id);if(we){const Ie=Ba(he.nodeElement);if(!!(Ie.width&&Ie.height&&(we.dimensions.width!==Ie.width||we.dimensions.height!==Ie.height||he.forceUpdate))){const j=he.nodeElement.getBoundingClientRect();we.dimensions=Ie,we.handleBounds.source=Fm("source",he.nodeElement,j,Q,we.id),we.handleBounds.target=Fm("target",he.nodeElement,j,Q,we.id),X.push({id:we.id,type:"dimensions",dimensions:Ie})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),X.length&&e.hooks.nodesChange.trigger(X)},f=(z,P)=>{const F=new Set,Q=new Set;for(const he of z)Wn(he)?F.add(he.id):vn(he)&&Q.add(he.id);const X=Cn(n.value,F,!0),_e=Cn(o.value,Q);if(e.multiSelectionActive){for(const he of F)X.push(xn(he,P));for(const he of Q)_e.push(xn(he,P))}X.length&&e.hooks.nodesChange.trigger(X),_e.length&&e.hooks.edgesChange.trigger(_e)},h=z=>{if(e.multiSelectionActive){const P=z.map(F=>xn(F.id,!0));e.hooks.nodesChange.trigger(P);return}e.hooks.nodesChange.trigger(Cn(n.value,new Set(z.map(P=>P.id)),!0)),e.hooks.edgesChange.trigger(Cn(o.value))},g=z=>{if(e.multiSelectionActive){const P=z.map(F=>xn(F.id,!0));e.hooks.edgesChange.trigger(P);return}e.hooks.edgesChange.trigger(Cn(o.value,new Set(z.map(P=>P.id)))),e.hooks.nodesChange.trigger(Cn(n.value,new Set,!0))},k=z=>{f(z,!0)},N=z=>{const F=(z||e.nodes).map(Q=>(Q.selected=!1,xn(Q.id,!1)));e.hooks.nodesChange.trigger(F)},b=z=>{const F=(z||e.edges).map(Q=>(Q.selected=!1,xn(Q.id,!1)));e.hooks.edgesChange.trigger(F)},_=z=>{if(!z||!z.length)return f([],!1);const P=z.reduce((F,Q)=>{const X=xn(Q.id,!1);return Wn(Q)?F.nodes.push(X):F.edges.push(X),F},{nodes:[],edges:[]});P.nodes.length&&e.hooks.nodesChange.trigger(P.nodes),P.edges.length&&e.hooks.edgesChange.trigger(P.edges)},E=z=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([z,e.maxZoom]),e.minZoom=z},I=z=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([e.minZoom,z]),e.maxZoom=z},A=z=>{var P;(P=e.d3Zoom)==null||P.translateExtent(z),e.translateExtent=z},T=z=>{e.nodeExtent=z,a()},L=z=>{var P;(P=e.d3Zoom)==null||P.clickDistance(z)},x=z=>{e.nodesDraggable=z,e.nodesConnectable=z,e.elementsSelectable=z},R=z=>{const P=z instanceof Function?z(e.nodes):z;!e.initialized&&!P.length||(e.nodes=Um(P,d,e.hooks.error.trigger))},$=z=>{const P=z instanceof Function?z(e.edges):z;if(!e.initialized&&!P.length)return;const F=Gl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Kl(e.connectionLookup,o.value,F),e.edges=F},B=z=>{const P=z instanceof Function?z([...e.nodes,...e.edges]):z;!e.initialized&&!P.length||(R(P.filter(Wn)),$(P.filter(vn)))},O=z=>{let P=z instanceof Function?z(e.nodes):z;P=Array.isArray(P)?P:[P];const F=Um(P,d,e.hooks.error.trigger),Q=[];for(const X of F)Q.push(Rm(X));Q.length&&e.hooks.nodesChange.trigger(Q)},y=z=>{let P=z instanceof Function?z(e.edges):z;P=Array.isArray(P)?P:[P];const F=Gl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const X of F)Q.push(Rm(X));Q.length&&e.hooks.edgesChange.trigger(Q)},w=(z,P=!0,F=!1)=>{const Q=z instanceof Function?z(e.nodes):z,X=Array.isArray(Q)?Q:[Q],_e=[],he=[];function we(Y){const j=s(Y);for(const J of j)(!ct(J.deletable)||J.deletable)&&he.push($m(J.id,J.source,J.target,J.sourceHandle,J.targetHandle))}function Ie(Y){const j=[];for(const J of e.nodes)J.parentNode===Y&&j.push(J);if(j.length){for(const J of j)_e.push(Am(J.id));P&&we(j);for(const J of j)Ie(J.id)}}for(const Y of X){const j=typeof Y=="string"?d(Y):Y;j&&(ct(j.deletable)&&!j.deletable||(_e.push(Am(j.id)),P&&we([j]),F&&Ie(j.id)))}he.length&&e.hooks.edgesChange.trigger(he),_e.length&&e.hooks.nodesChange.trigger(_e)},v=z=>{const P=z instanceof Function?z(e.edges):z,F=Array.isArray(P)?P:[P],Q=[];for(const X of F){const _e=typeof X=="string"?u(X):X;_e&&(ct(_e.deletable)&&!_e.deletable||Q.push($m(typeof X=="string"?X:X.id,_e.source,_e.target,_e.sourceHandle,_e.targetHandle)))}e.hooks.edgesChange.trigger(Q)},M=(z,P,F=!0)=>{const Q=u(z.id);if(!Q)return!1;const X=e.edges.indexOf(Q),_e=z0(z,P,Q,F,e.hooks.error.trigger);if(_e){const[he]=Gl([_e],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((we,Ie)=>Ie===X?he:we),Kl(e.connectionLookup,o.value,[he]),he}return!1},D=(z,P,F={replace:!1})=>{const Q=u(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=F.replace?X:{...Q.data,...X}},U=z=>Sm(z,e.nodes),W=z=>{const P=Sm(z,e.edges);return Kl(e.connectionLookup,o.value,P),P},ie=(z,P,F={replace:!1})=>{const Q=d(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;F.replace?e.nodes.splice(e.nodes.indexOf(Q),1,X):Object.assign(Q,X)},pe=(z,P,F={replace:!1})=>{const Q=d(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=F.replace?X:{...Q.data,...X}},ye=(z,P,F=!1)=>{F?e.connectionClickStartHandle=z:e.connectionStartHandle=z,e.connectionEndHandle=null,e.connectionStatus=null,P&&(e.connectionPosition=P)},ge=(z,P=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=z,e.connectionEndHandle=P,e.connectionStatus=F)},me=(z,P)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,P?e.connectionClickStartHandle=null:e.connectionStartHandle=null},se=z=>{const P=h0(z),F=P?null:yi(z)?z:d(z.id);return!P&&!F?[null,null,P]:[P?z:Ma(F),F,P]},ke=(z,P=!0,F=e.nodes)=>{const[Q,X,_e]=se(z);if(!Q)return[];const he=[];for(const we of F||e.nodes){if(!_e&&(we.id===X.id||!we.computedPosition))continue;const Ie=Ma(we),Y=Va(Ie,Q);(P&&Y>0||Y>=Ie.width*Ie.height||Y>=Number(Q.width)*Number(Q.height))&&he.push(we)}return he},Se=(z,P,F=!0)=>{const[Q]=se(z);if(!Q)return!1;const X=Va(Q,P);return F&&X>0||X>=Number(Q.width)*Number(Q.height)},ce=z=>{const{viewport:P,dimensions:F,d3Zoom:Q,d3Selection:X,translateExtent:_e}=e;if(!Q||!X||!z.x&&!z.y)return!1;const he=So.translate(P.x+z.x,P.y+z.y).scale(P.zoom),we=[[0,0],[F.width,F.height]],Ie=Q.constrain()(he,we,_e),Y=e.viewport.x!==Ie.x||e.viewport.y!==Ie.y||e.viewport.zoom!==Ie.k;return Q.transform(X,Ie),Y},fe=z=>{const P=z instanceof Function?z(e):z,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ct(P.defaultEdgeOptions)&&(e.defaultEdgeOptions=P.defaultEdgeOptions);const Q=P.modelValue||P.nodes||P.edges?[]:void 0;Q&&(P.modelValue&&Q.push(...P.modelValue),P.nodes&&Q.push(...P.nodes),P.edges&&Q.push(...P.edges),B(Q));const X=()=>{ct(P.maxZoom)&&I(P.maxZoom),ct(P.minZoom)&&E(P.minZoom),ct(P.translateExtent)&&A(P.translateExtent)};for(const _e of Object.keys(P)){const he=_e,we=P[he];![...nN,...F].includes(he)&&ct(we)&&(e[he]=we)}ml(()=>e.d3Zoom).not.toBeNull().then(X),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:B,setNodes:R,setEdges:$,addNodes:O,addEdges:y,removeNodes:w,removeEdges:v,findNode:d,findEdge:u,updateEdge:M,updateEdgeData:D,updateNode:ie,updateNodeData:pe,applyEdgeChanges:W,applyNodeChanges:U,addSelectedElements:k,addSelectedNodes:h,addSelectedEdges:g,setMinZoom:E,setMaxZoom:I,setTranslateExtent:A,setNodeExtent:T,setPaneClickDistance:L,removeSelectedElements:_,removeSelectedNodes:N,removeSelectedEdges:b,startConnection:ye,updateConnection:ge,endConnection:me,setInteractive:x,setState:fe,getIntersectingNodes:ke,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Se,panBy:ce,fitView:z=>i.value.fitView(z),zoomIn:z=>i.value.zoomIn(z),zoomOut:z=>i.value.zoomOut(z),zoomTo:(z,P)=>i.value.zoomTo(z,P),setViewport:(z,P)=>i.value.setViewport(z,P),setTransform:(z,P)=>i.value.setTransform(z,P),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(z,P,F)=>i.value.setCenter(z,P,F),fitBounds:(z,P)=>i.value.fitBounds(z,P),project:z=>i.value.project(z),screenToFlowCoordinate:z=>i.value.screenToFlowCoordinate(z),flowToScreenCoordinate:z=>i.value.flowToScreenCoordinate(z),toObject:()=>{const z=[],P=[];for(const F of e.nodes){const{computedPosition:Q,handleBounds:X,selected:_e,dimensions:he,isParent:we,resizing:Ie,dragging:Y,events:j,...J}=F;z.push(J)}for(const F of e.edges){const{selected:Q,sourceNode:X,targetNode:_e,events:he,...we}=F;P.push(we)}return JSON.parse(JSON.stringify({nodes:z,edges:P,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:z=>new Promise(P=>{const{nodes:F,edges:Q,position:X,zoom:_e,viewport:he}=z;F&&R(F),Q&&$(Q);const[we,Ie]=he!=null&&he.x&&(he!=null&&he.y)?[he.x,he.y]:X??[null,null];if(we&&Ie){const Y=(he==null?void 0:he.zoom)||_e||e.viewport.zoom;return ml(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:we,y:Ie,zoom:Y}).then(()=>{P(!0)})})}else P(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const z=Zm();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const P=So.translate(z.defaultViewport.x??0,z.defaultViewport.y??0).scale(qn(z.defaultViewport.zoom??1,z.minZoom,z.maxZoom)),F=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[F.width,F.height]],X=e.d3Zoom.constrain()(P,Q,z.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}fe(z)},$destroy:()=>{}}}const iN=["data-id","data-handleid","data-nodeid","data-handlepos"],aN={name:"Handle",compatConfig:{MODE:3}},Xn=t.defineComponent({...aN,props:{id:{default:null},type:{},position:{default:()=>$e.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:p}=je(),{id:f,node:h,nodeEl:g,connectedEdges:k}=Jm(),N=t.ref(),b=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),E=t.toRef(()=>{var $,B,O,y,w,v;return(($=l.value)==null?void 0:$.nodeId)===f&&((B=l.value)==null?void 0:B.id)===e.id&&((O=l.value)==null?void 0:O.type)===i.value||((y=c.value)==null?void 0:y.nodeId)===f&&((w=c.value)==null?void 0:w.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),I=t.toRef(()=>{var $,B,O;return(($=s.value)==null?void 0:$.nodeId)===f&&((B=s.value)==null?void 0:B.id)===e.id&&((O=s.value)==null?void 0:O.type)===i.value}),{handlePointerDown:A,handleClick:T}=Wm({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),L=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!k.value.some($=>{const B=$[`${i.value}Handle`];return $[i.value]!==f?!1:B?B===e.id:!0}):typeof e.connectable=="number"?k.value.filter($=>{const B=$[`${i.value}Handle`];return $[i.value]!==f?!1:B?B===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,k.value):ct(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var $;if(!h.dimensions.width||!h.dimensions.height)return;const B=($=h.handleBounds[i.value])==null?void 0:$.find(U=>U.id===e.id);if(!d.value||B)return;const O=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!N.value||!O||!e.id)return;const y=g.value.getBoundingClientRect(),w=N.value.getBoundingClientRect(),v=window.getComputedStyle(O),{m22:M}=new window.DOMMatrixReadOnly(v.transform),D={id:e.id,position:e.position,x:(w.left-y.left)/M,y:(w.top-y.top)/M,type:i.value,nodeId:f,...Ba(N.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],D]});function x($){const B=Fl($);L.value&&b.value&&(B&&$.button===0||!B)&&A($)}function R($){!f||!s.value&&!b.value||L.value&&T($)}return n({handleClick:T,handlePointerDown:A,onClick:R,onPointerDown:x}),($,B)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:N,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":$.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${$.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:L.value,connecting:I.value,connectablestart:b.value,connectableend:_.value,connectionindicator:L.value&&(b.value&&!E.value||_.value&&E.value)}]]),onMousedown:x,onTouchstartPassive:x,onClick:R},[t.renderSlot($.$slots,"default",{id:$.id})],42,iN))}}),Ua=function({sourcePosition:e=$e.Bottom,targetPosition:n=$e.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Xn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Xn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Ua.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ua.inheritAttrs=!1,Ua.compatConfig={MODE:3};const rN=Ua,Ha=function({targetPosition:e=$e.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Xn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};Ha.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ha.inheritAttrs=!1,Ha.compatConfig={MODE:3};const lN=Ha,ja=function({sourcePosition:e=$e.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Xn,{type:"source",position:e,connectable:o,isValidConnection:i})]};ja.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ja.inheritAttrs=!1,ja.compatConfig={MODE:3};const sN=ja,cN=["transform"],dN=["width","height","x","y","rx","ry"],uN=["y"],mN={name:"EdgeText",compatConfig:{MODE:3}},fN=t.defineComponent({...mN,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),i=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(a),t.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==n.value.width||r.height!==n.value.height)&&(n.value=r)}return(r,l)=>(t.openBlock(),t.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*r.labelBgPadding[0]}px`,height:`${n.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:t.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,dN)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:r.labelStyle}),[t.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(r.label),1)],64))])],16,uN)],8,cN))}}),pN=["id","d","marker-end","marker-start"],hN=["d","stroke-width"],yN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ka=t.defineComponent({...yN,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),i=t.ref(null),a=t.ref(null),r=t.useAttrs();return n({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,pN),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,hN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(fN,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function Qm({sourceX:e,sourceY:n,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-n)/2,s=i<n?i+l:i-l;return[r,s,a,l]}function ef({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=n*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function Ga(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function tf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case $e.Left:l=n-Ga(n-i,r),s=o;break;case $e.Right:l=n+Ga(i-n,r),s=o;break;case $e.Top:l=n,s=o-Ga(o-a,r);break;case $e.Bottom:l=n,s=o+Ga(a-o,r);break}return[l,s]}function nf(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,curvature:s=.25}=e,[c,d]=tf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=tf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,h,g]=ef({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,p,f,h,g]}function of({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case $e.Left:case $e.Right:r=.5*(n+i),l=o;break;case $e.Top:case $e.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function af(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top}=e,[s,c]=of({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=of({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,h]=ef({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,p,f,h]}const rf={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};function gN({source:e,sourcePosition:n=$e.Bottom,target:o}){return n===$e.Left||n===$e.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function lf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function bN({source:e,sourcePosition:n=$e.Bottom,target:o,targetPosition:i=$e.Top,center:a,offset:r}){const l=rf[n],s=rf[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=gN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,h,g;const k={x:0,y:0},N={x:0,y:0},[b,_,E,I]=Qm({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){h=a.x??b,g=a.y??_;const T=[{x:h,y:c.y},{x:h,y:d.y}],L=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===p?f=m==="x"?T:L:f=m==="x"?L:T}else{const T=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?L:T:f=l.y===p?T:L,n===i){const O=Math.abs(e[m]-o[m]);if(O<=r){const y=Math.min(r-1,r-O);l[m]===p?k[m]=(c[m]>e[m]?-1:1)*y:N[m]=(d[m]>o[m]?-1:1)*y}}if(n!==i){const O=m==="x"?"y":"x",y=l[m]===s[O],w=c[O]>d[O],v=c[O]<d[O];(l[m]===1&&(!y&&w||y&&v)||l[m]!==1&&(!y&&v||y&&w))&&(f=m==="x"?T:L)}const x={x:c.x+k.x,y:c.y+k.y},R={x:d.x+N.x,y:d.y+N.y},$=Math.max(Math.abs(x.x-f[0].x),Math.abs(R.x-f[0].x)),B=Math.max(Math.abs(x.y-f[0].y),Math.abs(R.y-f[0].y));$>=B?(h=(x.x+R.x)/2,g=f[0].y):(h=f[0].x,g=(x.y+R.y)/2)}return[[e,{x:c.x+k.x,y:c.y+k.y},...f,{x:d.x+N.x,y:d.y+N.y},o],h,g,E,I]}function _N(e,n,o,i){const a=Math.min(lf(e,n)/2,lf(n,o)/2,i),{x:r,y:l}=n;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function ql(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,h,g]=bN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((N,b,_)=>{let E;return _>0&&_<m.length-1?E=_N(m[_-1],b,m[_+1],s):E=`${_===0?"M":"L"}${b.x} ${b.y}`,N+=E,N},""),p,f,h,g]}function kN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Qm({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const EN=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=kN(e);return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),sf=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=ql({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),NN=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(sf,{...e,...n,borderRadius:0})}}),wN=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=nf({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),IN=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=af({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),vN={input:sN,default:rN,output:lN},xN={default:wN,straight:EN,step:NN,smoothstep:sf,simplebezier:IN};function CN(e,n,o){const i=t.computed(()=>g=>n.value.get(g)),a=t.computed(()=>g=>o.value.get(g)),r=t.computed(()=>{const g={...xN,...e.edgeTypes},k=Object.keys(g);for(const N of e.edges)N.type&&!k.includes(N.type)&&(g[N.type]=N.type);return g}),l=t.computed(()=>{const g={...vN,...e.nodeTypes},k=Object.keys(g);for(const N of e.nodes)N.type&&!k.includes(N.type)&&(g[N.type]=N.type);return g}),s=t.computed(()=>e.onlyRenderVisibleElements?wm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const k of e.edges){const N=n.value.get(k.source),b=n.value.get(k.target);S0({sourcePos:N.computedPosition||{x:0,y:0},targetPos:b.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:b.dimensions.width,targetHeight:b.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(k)}return g}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const g=[];for(const k of e.nodes)k.selected&&g.push(k);return g}),m=t.computed(()=>{const g=[];for(const k of e.edges)k.selected&&g.push(k);return g}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const g=[];for(const k of e.nodes)k.dimensions.width&&k.dimensions.height&&k.handleBounds!==void 0&&g.push(k);return g}),h=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:h}}class Zn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Zn.instance;return Zn.instance=i??new Zn,o&&(o.config.globalProperties.$vueFlowStorage=Zn.instance),Zn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=Zm(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[h]=f.on}const l={};for(const[p,f]of Object.entries(a.hooks))l[p]=f.trigger;const s=t.computed(()=>{const p=new Map;for(const f of a.nodes)p.set(f.id,f);return p}),c=t.computed(()=>{const p=new Map;for(const f of a.edges)p.set(f.id,f);return p}),d=CN(a,s,c),u=oN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...I_(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function je(e){const n=Zn.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Km,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,p,f)=>{const h=k=>{d.applyNodeChanges(k)},g=k=>{d.applyEdgeChanges(k)};m?(d.onNodesChange(h),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)),f(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),ni(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ei(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Km,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ft(st.USEVUEFLOW_OPTIONS))}return s}function SN(e){const{emits:n,dimensions:o}=je();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Ba(e.value);(s.width===0||s.height===0)&&n.error(new ft(st.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const RN={name:"UserSelection",compatConfig:{MODE:3}},AN=t.defineComponent({...RN,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),$N=["tabIndex"],TN={name:"NodesSelection",compatConfig:{MODE:3}},MN=t.defineComponent({...TN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=je(),s=Xm(),c=t.ref(null),d=qm({el:c,onStart(h){n.selectionDragStart(h),n.nodeDragStart(h)},onDrag(h){n.selectionDrag(h),n.nodeDrag(h)},onStop(h){n.selectionDragStop(h),n.nodeDragStop(h)}});t.onMounted(()=>{var h;r.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=t.computed(()=>Dl(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){n.selectionContextMenu({event:h,nodes:i.value})}function f(h){r.value||Ro[h.key]&&(h.preventDefault(),s({x:Ro[h.key].x,y:Ro[h.key].y},h.shiftKey))}return(h,g)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,$N)],6)):t.createCommentVNode("",!0)}});function VN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const BN={name:"Pane",compatConfig:{MODE:3}},DN=t.defineComponent({...BN,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:p,removeEdges:f,selectionMode:h,deleteKeyCode:g,multiSelectionKeyCode:k,multiSelectionActive:N,edgeLookup:b,nodeLookup:_,connectionLookup:E,defaultEdgeOptions:I,connectionStartHandle:A,panOnDrag:T}=je(),L=t.shallowRef(null),x=t.shallowRef(new Set),R=t.shallowRef(new Set),$=t.shallowRef(null),B=t.toRef(()=>c.value&&(e.isSelecting||r.value)),O=t.toRef(()=>A.value!==null);let y=!1,w=!1;const v=hi(g,{actInsideInputWithModifier:!1}),M=hi(k);t.watch(v,me=>{me&&(p(m.value),f(u.value),d.value=!1)}),t.watch(M,me=>{N.value=me});function D(me,se){return ke=>{ke.target===se&&(me==null||me(ke))}}function U(me){if(y||O.value){y=!1;return}a.paneClick(me),l(),d.value=!1}function W(me){var se;if(Array.isArray(T.value)&&((se=T.value)!=null&&se.includes(2))){me.preventDefault();return}a.paneContextMenu(me)}function ie(me){a.paneScroll(me)}function pe(me){var se,ke,Se;if($.value=((se=n.value)==null?void 0:se.getBoundingClientRect())??null,!c.value||!e.isSelecting||me.button!==0||me.target!==L.value||!$.value)return;(Se=(ke=me.target)==null?void 0:ke.setPointerCapture)==null||Se.call(ke,me.pointerId);const{x:ce,y:fe}=VN(me,$.value);w=!0,y=!1,l(),s.value={width:0,height:0,startX:ce,startY:fe,x:ce,y:fe},a.selectionStart(me)}function ye(me){var se;if(!$.value||!s.value)return;y=!0;const{x:ke,y:Se}=Jt(me,$.value),{startX:ce=0,startY:fe=0}=s.value,oe={startX:ce,startY:fe,x:ke<ce?ke:ce,y:Se<fe?Se:fe,width:Math.abs(ke-ce),height:Math.abs(Se-fe)},le=x.value,ue=R.value;x.value=new Set(wm(o.value,oe,i.value,h.value===Ml.Partial,!0).map(P=>P.id)),R.value=new Set;const z=((se=I.value)==null?void 0:se.selectable)??!0;for(const P of x.value){const F=E.value.get(P);if(F)for(const{edgeId:Q}of F.values()){const X=b.value.get(Q);X&&(X.selectable??z)&&R.value.add(Q)}}if(!jm(le,x.value)){const P=Cn(_.value,x.value,!0);a.nodesChange(P)}if(!jm(ue,R.value)){const P=Cn(b.value,R.value);a.edgesChange(P)}s.value=oe,r.value=!0,d.value=!1}function ge(me){var se;me.button!==0||!w||((se=me.target)==null||se.releasePointerCapture(me.pointerId),!r.value&&s.value&&me.target===L.value&&U(me),r.value=!1,s.value=null,d.value=x.value.size>0,a.selectionEnd(me),e.selectionKeyPressed&&(y=!1),w=!1)}return(me,se)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:L,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:me.isSelecting}]),onClick:se[0]||(se[0]=ke=>B.value?void 0:D(U,L.value)(ke)),onContextmenu:se[1]||(se[1]=ke=>D(W,L.value)(ke)),onWheelPassive:se[2]||(se[2]=ke=>D(ie,L.value)(ke)),onPointerenter:se[3]||(se[3]=ke=>B.value?void 0:t.unref(a).paneMouseEnter(ke)),onPointerdown:se[4]||(se[4]=ke=>B.value?pe(ke):t.unref(a).paneMouseMove(ke)),onPointermove:se[5]||(se[5]=ke=>B.value?ye(ke):t.unref(a).paneMouseMove(ke)),onPointerup:se[6]||(se[6]=ke=>B.value?ge(ke):void 0),onPointerleave:se[7]||(se[7]=ke=>t.unref(a).paneMouseLeave(ke))},[t.renderSlot(me.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(AN,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(MN,{key:1})):t.createCommentVNode("",!0)],34))}}),ON={name:"Transform",compatConfig:{MODE:3}},LN=t.defineComponent({...ON,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=je(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),PN={name:"Viewport",compatConfig:{MODE:3}},zN=t.defineComponent({...PN,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:p,zoomOnPinch:f,zoomOnScroll:h,preventScrolling:g,noWheelClassName:k,noPanClassName:N,emits:b,connectionStartHandle:_,userSelectionActive:E,paneDragging:I,d3Zoom:A,d3Selection:T,d3ZoomHandler:L,viewport:x,viewportRef:R,paneClickDistance:$}=je();SN(R);const B=t.shallowRef(!1),O=t.shallowRef(!1);let y=null,w=!1,v=0,M={x:0,y:0,zoom:0};const D=hi(s),U=hi(l),W=hi(r),ie=t.toRef(()=>(!U.value||U.value&&l.value===!0)&&(D.value||m.value)),pe=t.toRef(()=>D.value||c.value),ye=t.toRef(()=>l.value===!0&&ie.value!==!0),ge=t.toRef(()=>U.value&&l.value!==!0||E.value||ye.value),me=t.toRef(()=>_.value!==null);t.onMounted(()=>{if(!R.value){Ei("Viewport element is missing");return}const fe=R.value,oe=fe.getBoundingClientRect(),le=s0().clickDistance($.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Mt(fe).call(le),z=ue.on("wheel.zoom"),P=So.translate(i.value.x??0,i.value.y??0).scale(qn(i.value.zoom??1,n.value,o.value)),F=[[0,0],[oe.width,oe.height]],Q=le.constrain()(P,F,a.value);le.transform(ue,Q),le.wheelDelta(Ol),A.value=le,T.value=ue,L.value=z,x.value={x:Q.x,y:Q.y,zoom:Q.k},le.on("start",X=>{var _e;if(!X.sourceEvent)return null;v=X.sourceEvent.button,B.value=!0;const he=Se(X.transform);((_e=X.sourceEvent)==null?void 0:_e.type)==="mousedown"&&(I.value=!0),M=he,b.viewportChangeStart(he),b.moveStart({event:X,flowTransform:he})}),le.on("end",X=>{if(!X.sourceEvent)return null;if(B.value=!1,I.value=!1,se(ie.value,v??0)&&!w&&b.paneContextMenu(X.sourceEvent),w=!1,ke(M,X.transform)){const _e=Se(X.transform);M=_e,b.viewportChangeEnd(_e),b.moveEnd({event:X,flowTransform:_e})}}),le.filter(X=>{var _e;const he=W.value||h.value,we=f.value&&X.ctrlKey,Ie=X.button,Y=X.type==="wheel";if(Ie===1&&X.type==="mousedown"&&(ce(X,"vue-flow__node")||ce(X,"vue-flow__edge")))return!0;if(!ie.value&&!he&&!pe.value&&!p.value&&!f.value||E.value||me.value&&!Y||!p.value&&X.type==="dblclick"||ce(X,k.value)&&Y||ce(X,N.value)&&(!Y||pe.value&&Y&&!W.value)||!f.value&&X.ctrlKey&&Y||!he&&!pe.value&&!we&&Y)return!1;if(!f&&X.type==="touchstart"&&((_e=X.touches)==null?void 0:_e.length)>1)return X.preventDefault(),!1;if(!ie.value&&(X.type==="mousedown"||X.type==="touchstart")||ye.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ie===0||Array.isArray(m.value)&&!m.value.includes(Ie)&&(X.type==="mousedown"||X.type==="touchstart"))return!1;const j=Array.isArray(m.value)&&m.value.includes(Ie)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ie||Ie<=1;return(!X.ctrlKey||D.value||Y)&&j}),t.watch([E,ie],()=>{E.value&&!B.value?le.on("zoom",null):E.value||le.on("zoom",X=>{x.value={x:X.transform.x,y:X.transform.y,zoom:X.transform.k};const _e=Se(X.transform);w=se(ie.value,v??0),b.viewportChange(_e),b.move({event:X,flowTransform:_e})})},{immediate:!0}),t.watch([E,pe,d,W,f,g,k],()=>{pe.value&&!W.value&&!E.value?ue.on("wheel.zoom",X=>{if(ce(X,k.value))return!1;const _e=W.value||h.value,he=f.value&&X.ctrlKey;if(!(!g.value||pe.value||_e||he))return!1;X.preventDefault(),X.stopImmediatePropagation();const Ie=ue.property("__zoom").k||1,Y=ki();if(!D.value&&X.ctrlKey&&f.value&&Y){const K=Gt(X),te=Ol(X),G=Ie*2**te;le.scaleTo(ue,G,K,X);return}const j=X.deltaMode===1?20:1;let J=d.value===pi.Vertical?0:X.deltaX*j,ve=d.value===pi.Horizontal?0:X.deltaY*j;!Y&&X.shiftKey&&d.value!==pi.Vertical&&!J&&ve&&(J=ve,ve=0),le.translateBy(ue,-(J/Ie)*u.value,-(ve/Ie)*u.value);const Te=Se(ue.property("__zoom"));y&&clearTimeout(y),O.value?(b.move({event:X,flowTransform:Te}),b.viewportChange(Te),y=setTimeout(()=>{b.moveEnd({event:X,flowTransform:Te}),b.viewportChangeEnd(Te),O.value=!1},150)):(O.value=!0,b.moveStart({event:X,flowTransform:Te}),b.viewportChangeStart(Te))},{passive:!1}):typeof z<"u"&&ue.on("wheel.zoom",function(X,_e){const he=!g.value&&X.type==="wheel"&&!X.ctrlKey,we=W.value||h.value,Ie=f.value&&X.ctrlKey;if(!we&&!c.value&&!Ie&&X.type==="wheel"||he||ce(X,k.value))return null;X.preventDefault(),z.call(this,X,_e)},{passive:!1})},{immediate:!0})});function se(fe,oe){return oe===2&&Array.isArray(fe)&&fe.includes(2)}function ke(fe,oe){return fe.x!==oe.x&&!Number.isNaN(oe.x)||fe.y!==oe.y&&!Number.isNaN(oe.y)||fe.zoom!==oe.k&&!Number.isNaN(oe.k)}function Se(fe){return{x:fe.x,y:fe.y,zoom:fe.k}}function ce(fe,oe){return fe.target.closest(`.${oe}`)}return(fe,oe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:R,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(DN,{"is-selecting":ge.value,"selection-key-pressed":t.unref(U),class:t.normalizeClass({connecting:me.value,dragging:t.unref(I),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(LN,null,{default:t.withCtx(()=>[t.renderSlot(fe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),FN=["id"],UN=["id"],HN=["id"],jN={name:"A11yDescriptions",compatConfig:{MODE:3}},KN=t.defineComponent({...jN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(fm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,FN),t.createElementVNode("div",{id:`${t.unref(pm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,UN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(p0)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(i)),9,HN))],64))}});function GN(){const e=je();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function YN(e,n,o){return o===$e.Left?e-n:o===$e.Right?e+n:e}function qN(e,n,o){return o===$e.Top?e-n:o===$e.Bottom?e+n:e}const Wl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=$e.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:YN(n,e,i),cy:qN(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Wl.props=["radius","centerX","centerY","position","type"],Wl.compatConfig={MODE:3};const cf=Wl,WN=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:p,multiSelectionActive:f,disableKeyboardA11y:h,elementsSelectable:g,edgesUpdatable:k,edgesFocusable:N,hooks:b}=je(),_=t.computed(()=>u(e.id)),{emit:E,on:I}=j0(_.value,r),A=t.inject(Pa),T=t.getCurrentInstance(),L=t.ref(!1),x=t.ref(!1),R=t.ref(""),$=t.ref(null),B=t.ref("source"),O=t.ref(null),y=t.toRef(()=>typeof _.value.selectable>"u"?g.value:_.value.selectable),w=t.toRef(()=>typeof _.value.updatable>"u"?k.value:_.value.updatable),v=t.toRef(()=>typeof _.value.focusable>"u"?N.value:_.value.focusable);t.provide(F0,e.id),t.provide(U0,O);const M=t.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),D=t.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),U=t.computed(()=>{const P=_.value.type||"default",F=A==null?void 0:A[`edge-${P}`];if(F)return F;let Q=_.value.template??c.value[P];if(typeof Q=="string"&&T){const X=Object.keys(T.appContext.components);X&&X.includes(P)&&(Q=t.resolveComponent(P,!1))}return Q&&typeof Q!="string"?Q:(r.error(new ft(st.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:W}=Wm({nodeId:R,handleId:$,type:B,isValidConnection:p,edgeUpdaterType:B,onEdgeUpdate:ye,onEdgeUpdateEnd:ge});return()=>{const P=m(_.value.source),F=m(_.value.target),Q="pathOptions"in _.value?_.value.pathOptions:{};if(!P&&!F)return r.error(new ft(st.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!P)return r.error(new ft(st.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!F)return r.error(new ft(st.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||P.hidden||F.hidden)return null;let X;i.value===cn.Strict?X=P.handleBounds.source:X=[...P.handleBounds.source||[],...P.handleBounds.target||[]];const _e=Bm(X,_.value.sourceHandle);let he;i.value===cn.Strict?he=F.handleBounds.target:he=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const we=Bm(he,_.value.targetHandle),Ie=(_e==null?void 0:_e.position)||$e.Bottom,Y=(we==null?void 0:we.position)||$e.Top,{x:j,y:J}=$o(P,_e,Ie),{x:ve,y:Te}=$o(F,we,Y);return _.value.sourceX=j,_.value.sourceY=J,_.value.targetX=ve,_.value.targetY=Te,t.h("g",{ref:O,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${U.value===!1?"default":_.value.type||"default"}`,s.value,M.value,{updating:L.value,selected:_.value.selected,animated:_.value.animated,inactive:!y.value&&!b.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":v.value?`${pm}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",..._.value.domAttributes,onClick:se,onContextmenu:ke,onDblclick:Se,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onKeyDown:v.value?z:void 0},[x.value?null:t.h(U.value===!1?c.value.default:U.value,{id:e.id,sourceNode:P,targetNode:F,source:_.value.source,target:_.value.target,type:_.value.type,updatable:w.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...I},style:D.value,markerStart:`url('#${_i(_.value.markerStart,n)}')`,markerEnd:`url('#${_i(_.value.markerEnd,n)}')`,sourcePosition:Ie,targetPosition:Y,sourceX:j,sourceY:J,targetX:ve,targetY:Te,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...Q}),[w.value==="source"||w.value===!0?[t.h("g",{onMousedown:le,onMouseenter:ie,onMouseout:pe},t.h(cf,{position:Ie,centerX:j,centerY:J,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:ie,onMouseout:pe},t.h(cf,{position:Y,centerX:ve,centerY:Te,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ie(){L.value=!0}function pe(){L.value=!1}function ye(P,F){E.update({event:P,edge:_.value,connection:F})}function ge(P){E.updateEnd({event:P,edge:_.value}),x.value=!1}function me(P,F){P.button===0&&(x.value=!0,R.value=F?_.value.target:_.value.source,$.value=(F?_.value.targetHandle:_.value.sourceHandle)??null,B.value=F?"target":"source",E.updateStart({event:P,edge:_.value}),W(P))}function se(P){var F;const Q={event:P,edge:_.value};y.value&&(l.value=!1,_.value.selected&&f.value?(d([_.value]),(F=O.value)==null||F.blur()):o([_.value])),E.click(Q)}function ke(P){E.contextMenu({event:P,edge:_.value})}function Se(P){E.doubleClick({event:P,edge:_.value})}function ce(P){E.mouseEnter({event:P,edge:_.value})}function fe(P){E.mouseMove({event:P,edge:_.value})}function oe(P){E.mouseLeave({event:P,edge:_.value})}function le(P){me(P,!0)}function ue(P){me(P,!1)}function z(P){var F;!h.value&&hm.includes(P.key)&&y.value&&(P.key==="Escape"?((F=O.value)==null||F.blur(),d([u(e.id)])):o([u(e.id)]))}}}),JN=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=je(),p=(e=t.inject(Pa))==null?void 0:e["connection-line"],f=t.computed(()=>{var b;return m((b=i.value)==null?void 0:b.nodeId)}),h=t.computed(()=>{var b;return m((b=a.value)==null?void 0:b.nodeId)??null}),g=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),k=t.computed(()=>c.value.markerStart?`url(#${_i(c.value.markerStart,n)})`:""),N=t.computed(()=>c.value.markerEnd?`url(#${_i(c.value.markerEnd,n)})`:"");return()=>{var b,_,E;if(!f.value||!i.value)return null;const I=i.value.id,A=i.value.type,T=f.value.handleBounds;let L=(T==null?void 0:T[A])??[];if(o.value===cn.Loose){const D=(T==null?void 0:T[A==="source"?"target":"source"])??[];L=[...L,...D]}if(!L)return null;const x=(I?L.find(D=>D.id===I):L[0])??null,R=(x==null?void 0:x.position)??$e.Top,{x:$,y:B}=$o(f.value,x,R);let O=null;h.value&&(o.value===cn.Strict?O=((b=h.value.handleBounds[A==="source"?"target":"source"])==null?void 0:b.find(D=>{var U;return D.id===((U=a.value)==null?void 0:U.id)}))||null:O=((_=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:_.find(D=>{var U;return D.id===((U=a.value)==null?void 0:U.id)}))||null);const y=((E=a.value)==null?void 0:E.position)??(R?Hl[R]:null);if(!R||!y)return null;const w=l.value??c.value.type??Yn.Bezier;let v="";const M={sourceX:$,sourceY:B,sourcePosition:R,targetX:g.value.x,targetY:g.value.y,targetPosition:y};return w===Yn.Bezier?[v]=nf(M):w===Yn.Step?[v]=ql({...M,borderRadius:0}):w===Yn.SmoothStep?[v]=ql(M):w===Yn.SimpleBezier?[v]=af(M):v=`M${$},${B} ${g.value.x},${g.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:$,sourceY:B,sourcePosition:R,targetX:g.value.x,targetY:g.value.y,targetPosition:y,sourceNode:f.value,sourceHandle:x,targetNode:h.value,targetHandle:O,markerEnd:N.value,markerStart:k.value,connectionStatus:d.value}):t.h("path",{d:v,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":N.value,"marker-start":k.value})))}}}),XN=["id","markerWidth","markerHeight","markerUnits","orient"],ZN={name:"MarkerType",compatConfig:{MODE:3}},QN=t.defineComponent({...ZN,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(Vl).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref(Vl).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,XN))}}),ew={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},tw={name:"MarkerDefinitions",compatConfig:{MODE:3}},nw=t.defineComponent({...tw,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=je(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=_i(d,n);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.add(u))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const u of[d.markerStart,d.markerEnd])c(u);return s.sort((d,u)=>d.id.localeCompare(u.id))});return(l,s)=>(t.openBlock(),t.createElementBlock("svg",ew,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(QN,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),ow={name:"Edges",compatConfig:{MODE:3}},iw=t.defineComponent({...ow,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(nw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(R0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(WN),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(JN))],64))}}),aw=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:p,elevateNodesOnSelect:f,disableKeyboardA11y:h,ariaLiveMessage:g,snapToGrid:k,snapGrid:N,nodeDragThreshold:b,nodesDraggable:_,elementsSelectable:E,nodesConnectable:I,nodesFocusable:A,hooks:T}=je(),L=t.ref(null);t.provide(Ym,L),t.provide(Gm,e.id);const x=t.inject(Pa),R=t.getCurrentInstance(),$=Xm(),{node:B,parentNode:O}=Jm(e.id),{emit:y,on:w}=q0(B,l),v=t.toRef(()=>typeof B.draggable>"u"?_.value:B.draggable),M=t.toRef(()=>typeof B.selectable>"u"?E.value:B.selectable),D=t.toRef(()=>typeof B.connectable>"u"?I.value:B.connectable),U=t.toRef(()=>typeof B.focusable>"u"?A.value:B.focusable),W=t.computed(()=>M.value||v.value||T.value.nodeClick.hasListeners()||T.value.nodeDoubleClick.hasListeners()||T.value.nodeMouseEnter.hasListeners()||T.value.nodeMouseMove.hasListeners()||T.value.nodeMouseLeave.hasListeners()),ie=t.toRef(()=>!!B.dimensions.width&&!!B.dimensions.height),pe=t.computed(()=>{const F=B.type||"default",Q=x==null?void 0:x[`node-${F}`];if(Q)return Q;let X=B.template||m.value[F];if(typeof X=="string"&&R){const _e=Object.keys(R.appContext.components);_e&&_e.includes(F)&&(X=t.resolveComponent(F,!1))}return X&&typeof X!="string"?X:(l.error(new ft(st.NODE_TYPE_MISSING,X)),!1)}),ye=qm({id:e.id,el:L,disabled:()=>!v.value,selectable:M,dragHandle:()=>B.dragHandle,onStart(F){y.dragStart(F)},onDrag(F){y.drag(F)},onStop(F){y.dragStop(F)},onClick(F){z(F)}}),ge=t.computed(()=>B.class instanceof Function?B.class(B):B.class),me=t.computed(()=>{const F=(B.style instanceof Function?B.style(B):B.style)||{},Q=B.width instanceof Function?B.width(B):B.width,X=B.height instanceof Function?B.height(B):B.height;return!F.width&&Q&&(F.width=typeof Q=="string"?Q:`${Q}px`),!F.height&&X&&(F.height=typeof X=="string"?X:`${X}px`),F}),se=t.toRef(()=>Number(B.zIndex??me.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Se()}),t.onMounted(()=>{t.watch(()=>B.hidden,(F=!1,Q,X)=>{!F&&L.value&&(e.resizeObserver.observe(L.value),X(()=>{L.value&&e.resizeObserver.unobserve(L.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>B.type,()=>B.sourcePosition,()=>B.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])})}),t.watch([()=>B.position.x,()=>B.position.y,()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.z},se,()=>B.selected,()=>B.dimensions.height,()=>B.dimensions.width,()=>{var F;return(F=O.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=O.value)==null?void 0:F.dimensions.width}],([F,Q,X,_e,he,we])=>{const Ie={x:F,y:Q,z:we+(f.value&&B.selected?1e3:0)};typeof X<"u"&&typeof _e<"u"?B.computedPosition=w0({x:X,y:_e,z:he},Ie):B.computedPosition=Ie},{flush:"post",immediate:!0}),t.watch([()=>B.extent,p],([F,Q],[X,_e])=>{(F!==X||Q!==_e)&&ke()}),B.extent==="parent"||typeof B.extent=="object"&&"range"in B.extent&&B.extent.range==="parent"?ml(()=>ie).toBe(!0).then(ke):ke(),()=>B.hidden?null:t.h("div",{ref:L,"data-id":B.id,class:["vue-flow__node",`vue-flow__node-${pe.value===!1?"default":B.type||"default"}`,{[o.value]:v.value,dragging:ye==null?void 0:ye.value,draggable:v.value,selected:B.selected,selectable:M.value,parent:B.isParent},ge.value],style:{visibility:ie.value?"visible":"hidden",zIndex:B.computedPosition.z??se.value,transform:`translate(${B.computedPosition.x}px,${B.computedPosition.y}px)`,pointerEvents:W.value?"all":"none",...me.value},tabIndex:U.value?0:void 0,role:U.value?"group":void 0,"aria-describedby":h.value?void 0:`${fm}-${n}`,"aria-label":B.ariaLabel,"aria-roledescription":"node",...B.domAttributes,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onContextmenu:le,onClick:z,onDblclick:ue,onKeydown:P},[t.h(pe.value===!1?m.value.default:pe.value,{id:B.id,type:B.type,data:B.data,events:{...B.events,...w},selected:B.selected,resizing:B.resizing,dragging:ye.value,connectable:D.value,position:B.computedPosition,dimensions:B.dimensions,isValidTargetPos:B.isValidTargetPos,isValidSourcePos:B.isValidSourcePos,parent:B.parentNode,parentNodeId:B.parentNode,zIndex:B.computedPosition.z??se.value,targetPosition:B.targetPosition,sourcePosition:B.sourcePosition,label:B.label,dragHandle:B.dragHandle,onUpdateNodeInternals:Se})]);function ke(){const F=B.computedPosition,{computedPosition:Q,position:X}=zl(B,k.value?La(F,N.value):F,l.error,p.value,O.value);(B.computedPosition.x!==Q.x||B.computedPosition.y!==Q.y)&&(B.computedPosition={...B.computedPosition,...Q}),(B.position.x!==X.x||B.position.y!==X.y)&&(B.position=X)}function Se(){L.value&&d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])}function ce(F){ye!=null&&ye.value||y.mouseEnter({event:F,node:B})}function fe(F){ye!=null&&ye.value||y.mouseMove({event:F,node:B})}function oe(F){ye!=null&&ye.value||y.mouseLeave({event:F,node:B})}function le(F){return y.contextMenu({event:F,node:B})}function ue(F){return y.doubleClick({event:F,node:B})}function z(F){M.value&&(!i.value||!v.value||b.value>0)&&jl(B,r.value,c,s,a,!1,L.value),y.click({event:F,node:B})}function P(F){if(!(Bl(F)||h.value))if(hm.includes(F.key)&&M.value){const Q=F.key==="Escape";jl(B,r.value,c,s,a,Q,L.value)}else v.value&&B.selected&&Ro[F.key]&&(F.preventDefault(),g.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~B.position.x}, y: ${~~B.position.y}`,$({x:Ro[F.key].x,y:Ro[F.key].y},F.shiftKey))}}});function rw(e={includeHiddenNodes:!1}){const{nodes:n}=je();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const lw={class:"vue-flow__nodes vue-flow__container"},sw={name:"Nodes",compatConfig:{MODE:3}},cw=t.defineComponent({...sw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=je(),a=rw(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",lw,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(aw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=p,f},s,0),128)):t.createCommentVNode("",!0)]))}});function dw(){const{emits:e}=je();t.onMounted(()=>{if(zm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ft(st.MISSING_STYLES))}})}const uw=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),mw={name:"VueFlow",compatConfig:{MODE:3}},fw=t.defineComponent({...mw,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const i=e,a=t.useSlots(),r=fl(i,"modelValue",o),l=fl(i,"nodes",o),s=fl(i,"edges",o),c=je(i),d=Z0({modelValue:r,nodes:l,edges:s},i,c);return eN(o,c.hooks),GN(),dw(),t.provide(Pa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(zN,null,{default:t.withCtx(()=>[t.createVNode(iw),uw,t.createVNode(cw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(KN)],512))}}),pw={name:"Panel",compatConfig:{MODE:3}},df=t.defineComponent({...pw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=je(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),hw=["width","height","innerHTML"],yw=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(t.openBlock(),t.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:n[e.name]??""},null,8,hw))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ae=Ke(yw,[["__scopeId","data-v-05aac699"]]),Qn=["red","amber","green","teal","blue","indigo","violet","pink"],uf={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function gw(e){return typeof e=="string"&&e in uf}const bw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},_w=.15;function kw(e){const n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n)return null;let o=n[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function Ew(e){if(typeof e!="string")return null;const n=kw(e);if(!n||n.s<_w)return null;let o=null,i=1/0;for(const a of Qn){const r=Math.abs(n.h-bw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function _t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(gw(n))return n;const o=e==null?void 0:e.properties;return Ew((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Jl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Nw={red:"var(--em-swatch-red-bar)",amber:"var(--em-swatch-amber-bar)",green:"var(--em-swatch-green-bar)",teal:"var(--em-swatch-teal-bar)",blue:"var(--em-swatch-blue-bar)",indigo:"var(--em-swatch-indigo-bar)",violet:"var(--em-swatch-violet-bar)",pink:"var(--em-swatch-pink-bar)"},ww={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function mf(e,n=!1){return e?n?ww[e]:Nw[e]:null}function eo(e){return uf[e]}function To(e){return`var(--em-swatch-${e}-bar)`}function Iw(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function vw(e,n){const o=Iw(n);return o?e(o):n.split("-")[1]??n}function xw(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function ff(e,n){const o=xw(n);if(n.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=n.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,n.params)}function Cw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Sw={class:"em-inline-issue__msgs"},to=Ke(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode(Ae,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",Sw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(c,d)=>(t.openBlock(),t.createElementBlock("span",{key:d},t.toDisplayString(t.unref(ff)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Rw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Aw={key:0,class:"em-mlang__dot"},$w=["id","role","aria-labelledby"],Tw=["title"],dn=Ke(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const N=o.defaultLang;return N&&o.languages.includes(N)?N:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const N=o.activeLang;return N&&o.languages.includes(N)?N:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(N){var b,_;return!!((_=(b=o.modelValue)==null?void 0:b[N])!=null&&_.trim())}const d=N=>`${o.name}-tab-${N}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(N){var E,I;const b=o.languages,_=b[(N+b.length)%b.length];_&&(l.value=_,await t.nextTick(),(I=(E=m.value)==null?void 0:E.querySelectorAll('[role="tab"]')[b.indexOf(_)])==null||I.focus())}function f(N){p(o.languages.indexOf(s.value)+N)}const h=t.computed(()=>o.languages.filter(N=>{var b,_;return N!==s.value&&!!((_=(b=o.modelValue)==null?void 0:b[N])!=null&&_.trim())})),g=t.computed(()=>{var N;return((N=o.modelValue)==null?void 0:N[s.value])??""});function k(N){const b={...o.modelValue};N.trim()===""?delete b[s.value]:b[s.value]=N,i("update:modelValue",b)}return(N,b)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,_=>(t.openBlock(),t.createElementBlock("span",{id:d(_),key:_,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===_}]),role:"tab","aria-selected":s.value===_,"aria-controls":u.value,tabindex:s.value===_?0:-1,onClick:E=>l.value=_,onKeydown:[t.withKeys(t.withModifiers(E=>l.value=_,["prevent"]),["enter"]),t.withKeys(t.withModifiers(E=>l.value=_,["prevent"]),["space"]),b[0]||(b[0]=t.withKeys(t.withModifiers(E=>f(-1),["prevent"]),["left"])),b[1]||(b[1]=t.withKeys(t.withModifiers(E=>f(1),["prevent"]),["right"])),b[2]||(b[2]=t.withKeys(t.withModifiers(E=>p(0),["prevent"]),["home"])),b[3]||(b[3]=t.withKeys(t.withModifiers(E=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(_),1),c(_)?(t.openBlock(),t.createElementBlock("span",Aw,"•")):t.createCommentVNode("",!0)],42,Rw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(ee.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":k},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":k},null,8,["name","placeholder","model-value"]))],8,$w),r.value&&h.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:h.value.join(", "),"aria-hidden":"true"},"•",8,Tw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Mw=["disabled"],Vw={class:"em-panel__sub-label"},Bw={class:"em-field"},Dw={class:"em-field"},Ow={class:"em-field"},Lw={class:"em-class"},Pw={class:"em-field"},zw={class:"em-field"},Fw={class:"em-field"},Uw={class:"em-field"},Hw={class:"em-multilang"},jw={class:"em-multilang"},Kw={class:"em-jpa"},Gw={class:"em-field"},Yw={class:"em-field"},qw={class:"em-field"},Ww=["title"],Jw={class:"em-swatch"},Xw={class:"em-swatch__row"},Zw=["title"],Qw=["title","onClick"],pf=Ke(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(O=>O.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(O=>O.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var O;return _t(((O=l.value)==null?void 0:O.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],m=O=>O;function p(O){return O==="inherit"?a.t("em.common.inherit"):O}function f(O){r.value&&a.updateEntity(r.value.modelId,O)}function h(O,y,w){var M;const v=((M=r.value)==null?void 0:M.table)??{physicalName:""};f(O==="physicalName"?{table:{...v,physicalName:w}}:{table:{...v,logicalName:{...v.logicalName,[y]:w}}})}function g(O){f({description:Object.keys(O).length?O:void 0})}function k(O,y){var w;f({jpaAttrs:{...(w=r.value)==null?void 0:w.jpaAttrs,[O]:y}})}function N(O,y){k(O,y)}const b=t.computed(()=>{var O,y;return((y=(O=r.value)==null?void 0:O.jpaAttrs)==null?void 0:y.discriminatorType)??"inherit"}),_=t.computed(()=>{var O,y;return!((y=(O=r.value)==null?void 0:O.jpaAttrs)!=null&&y.useDiscriminator)});function E(O){k("discriminatorType",O==="inherit"?void 0:O)}function I(O){f({hasPersonalInfo:O})}function A(O){f({referenceOnly:O?!0:void 0})}function T(O){f({superClass:O.trim()||void 0})}function L(O){f({schema:O.trim()||void 0})}function x(O){f({abstractClass:O})}const R=t.computed(()=>{var O,y;return((y=(O=r.value)==null?void 0:O.declarationOfInterfaces)==null?void 0:y.join(", "))??""});function $(O){const y=O.split(",").map(w=>w.trim()).filter(Boolean);f({declarationOfInterfaces:y.length?y:void 0})}function B(O){r.value&&a.setEntitySwatch(r.value.modelId,O)}return(O,y)=>{var w,v,M;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:y[0]||(y[0]=D=>i("toggle"))},[t.createElementVNode("span",Vw,[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(to,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Bw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":y[1]||(y[1]=D=>f({name:D}))},null,8,["model-value"])]),t.createElementVNode("label",Dw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(Ko),"onUpdate:modelValue":y[2]||(y[2]=D=>f({stereotype:D}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Ow,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":y[3]||(y[3]=D=>f({packageName:D}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Lw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Pw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":y[4]||(y[4]=D=>T(D))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",zw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":R.value,"onUpdate:modelValue":y[5]||(y[5]=D=>$(D))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":y[6]||(y[6]=D=>x(D))},null,8,["label","model-value"])]),t.createElementVNode("label",Fw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-table",width:"100%","model-value":((w=r.value.table)==null?void 0:w.physicalName)??"","onUpdate:modelValue":y[7]||(y[7]=D=>h("physicalName",null,D))},null,8,["model-value"])]),t.createElementVNode("label",Uw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":y[8]||(y[8]=D=>L(D))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",Hw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,D=>{var U,W;return t.openBlock(),t.createElementBlock("label",{key:D,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(D),1),t.createVNode(t.unref(ee.BSTextInput),{name:`ent-logical-${D}`,width:"100%","model-value":((W=(U=r.value.table)==null?void 0:U.logicalName)==null?void 0:W[D])??"","onUpdate:modelValue":ie=>h("logicalName",D,ie)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Kw,[y[13]||(y[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,D=>{var U;return t.createVNode(t.unref(ee.BSCheckbox),{key:D.key,name:`jpa-${D.key}`,class:"em-check",label:D.label,"model-value":!!((U=r.value.jpaAttrs)!=null&&U[D.key]),"onUpdate:modelValue":W=>N(D.key,W)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Gw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:_.value,"model-value":((v=r.value.jpaAttrs)==null?void 0:v.discriminatorColumnName)??"","onUpdate:modelValue":y[9]||(y[9]=D=>k("discriminatorColumnName",D.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",Yw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(ee.BSSelect),{disabled:_.value,"model-value":b.value,items:u,"value-provider":m,"label-provider":p,"onUpdate:modelValue":y[10]||(y[10]=D=>D&&E(D))},null,8,["disabled","model-value"])]),t.createElementVNode("label",qw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(ee.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:_.value,"model-value":(M=r.value.jpaAttrs)==null?void 0:M.discriminatorLength,"onUpdate:modelValue":y[11]||(y[11]=D=>k("discriminatorLength",D||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":I},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":A},null,8,["label","model-value"])],8,Ww),t.createElementVNode("fieldset",Jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",Xw,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:y[12]||(y[12]=D=>B(null))},"∅",10,Zw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),D=>(t.openBlock(),t.createElementBlock("button",{key:D,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===D}]),style:t.normalizeStyle({background:t.unref(To)(D)}),title:t.unref(a).t(t.unref(eo)(D)),onClick:U=>B(D)},null,14,Qw))),128))])])],64)):t.createCommentVNode("",!0)],8,Mw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),eI=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"],hf=["inherit","true","false"],Ya="__OWN__";function yf(e,n){const o=t.computed(()=>e.state.logical.entities.find(K=>K.modelId===n())??null),i=t.computed(()=>{var K;return((K=o.value)==null?void 0:K.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(K){return K==="none"?e.t("em.common.noneParen"):K}const l=K=>K;function s(K,te){o.value&&e.updateAttribute(o.value.modelId,K.modelId,te)}function c(K){return!!o.value&&!!Ji(e.state.logical,o.value.modelId,K.modelId)}function d(K,te){s(K,{naturalId:te||void 0,naturalIdMutable:te?K.naturalIdMutable:void 0})}function u(){return{naturalId:void 0,naturalIdMutable:void 0}}function m(K,te){s(K,{identifier:te,...te?u():{}})}function p(K,te){s(K,{transient:te||void 0,...te?u():{}})}function f(K){return!!K.transient||K.attrType==="RELATION_REF"}function h(K){return Oi(K)}function g(K,te=0){var G;return((G=Li(K,o.value,e.state.logical.entities,e.state.logical.associations,te))==null?void 0:G.physicalName)||void 0}const k=K=>K.value,N=K=>K.label;function b(K,te){if(!te)return;const G=$.value.find(ae=>ae.type===te);if(G){const ae=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};s(K,{type:te,customType:void 0,dbAttrs:[{...ae,dataType:G.dataType,length:G.length,scale:G.scale}]});return}s(K,te===tn?{type:te}:{type:te,customType:void 0})}function _(K,te){s(K,{customType:te.trim()===""?void 0:te})}function E(K,te){if(K.attrType==="RELATION_REF")return;const ae={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...te};te.dataType!==void 0&&!Sr.has(ae.dataType)&&(ae.scale=void 0),s(K,{dbAttrs:[ae]})}function I(K){var te;return Sr.has(((te=K.dbAttrs[0])==null?void 0:te.dataType)??"")}function A(K){return!I(K)&&!h(K)&&!f(K)?e.t("em.attr.scaleTypeHint"):void 0}function T(K,te){E(K,{logicalName:Object.keys(te).length?te:void 0})}function L(K,te){s(K,{description:Object.keys(te).length?te:void 0})}function x(K){return K.personalInfoAttributeType??"none"}function R(K,te){s(K,{personalInfoAttributeType:te==="none"?void 0:te})}const $=t.computed(()=>e.predefinedCustomTypeCatalog.value),B=t.computed(()=>e.embeddableCatalog.value);function O(K){var te,G,ae;return((te=K.label)==null?void 0:te[e.userLanguage.value])??((G=K.label)==null?void 0:G.ko)??((ae=K.label)==null?void 0:ae.en)??K.type}const y=t.computed(()=>e.groupCodeCatalog.value);function w(K){var te;return((te=y.value.find(G=>G.groupCode===K.groupCode))==null?void 0:te.codes)??[]}function v(K){return["none",...w(K)]}function M(K){return K==="none"?"none":K.code}function D(K){var G,ae,Be;if(K==="none")return e.t("em.common.noneParen");const te=((G=K.label)==null?void 0:G[e.userLanguage.value])??((ae=K.label)==null?void 0:ae.ko)??((Be=K.label)==null?void 0:Be.en);return te?`${K.code} (${te})`:K.code}function U(K,te){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,te)}function W(K,te){s(K,{defaultValue:te==="none"?void 0:te})}function ie(K,te){s(K,{defaultValue:te.trim()===""?void 0:te})}function pe(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}function ye(K,te,G){const ae=K.dbAttrs.map((Be,Ve)=>{if(Ve!==te)return Be;const H={...Be,...G};for(const V of Object.keys(G))G[V]===void 0&&delete H[V];return H});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,ae)}function ge(K,te,G){ye(K,te,{logicalName:Object.keys(G).length?G:void 0})}function me(K,te){var Be,Ve,H;if(K.attrType==="EMBED_PREDEF"){const V=(Be=e.embeddableCatalog.value.find(Pe=>Pe.type===K.type))==null?void 0:Be.fields[te];return V?{name:V.name,physicalName:V.physicalName,dataType:V.dataType,length:V.length,scale:V.scale,shareable:V.shareable,logicalName:V.logicalName}:void 0}const G=(Ve=K.embedded)==null?void 0:Ve.embeddableRef;if(!G)return;const ae=(H=e.state.logical.entities.find(V=>V.modelId===G))==null?void 0:H.attributes.flatMap(V=>V.dbAttrs)[te];return ae?{physicalName:ae.physicalName,dataType:ae.dataType,length:ae.length,scale:ae.scale,logicalName:ae.logicalName}:void 0}function se(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.dataType)||((ae=K.dbAttrs[te])==null?void 0:ae.dataType)||""}function ke(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.length)??((ae=K.dbAttrs[te])==null?void 0:ae.length)}function Se(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.scale)??((ae=K.dbAttrs[te])==null?void 0:ae.scale)}const ce=hf;function fe(K){return K==="inherit"?e.t("em.common.inherit"):K}function oe(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function le(K,te,G){ye(K,te,{updatable:G==="inherit"?void 0:G==="true"})}function ue(K,te){E(K,{updatable:te==="inherit"?void 0:te==="true"})}const z=hf;function P(K){return K==="inherit"?e.t("em.common.inherit"):K}function F(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function Q(K,te,G){ye(K,te,{insertable:G==="inherit"?void 0:G==="true"})}function X(K,te){E(K,{insertable:te==="inherit"?void 0:te==="true"})}const _e=t.computed(()=>o.value?Nr(o.value,e.state.logical.entities):[]),he=t.computed(()=>so(_e.value.flatMap(K=>K.attributes.flatMap(te=>te.dbAttrs)))),we=t.computed(()=>_e.value.flatMap(K=>K.attributes.filter(te=>te.attrType==="NORMAL"&&te.dbAttrs.length===1&&te.dbAttrs[0]).map(te=>{var G;return{modelId:te.dbAttrs[0].modelId,physical:te.dbAttrs[0].physicalName||te.name,isCurrency:te.type==="Currency",ownerName:K.modelId===((G=o.value)==null?void 0:G.modelId)?void 0:K.name}})));function Ie(){const K=[...we.value].sort((te,G)=>Number(G.isCurrency)-Number(te.isCurrency));return[Ya,...K.map(te=>te.modelId)]}function Y(K){if(K===Ya)return e.t("em.attr.sharedOwn");const te=we.value.find(ae=>ae.modelId===K);if(!te)return K;const G=te.ownerName?`${te.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:G,physical:te.physical,mode:te.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function j(K){return(K==null?void 0:K.sharedColumnRef)??Ya}function J(K,te,G){ye(K,te,{sharedColumnRef:G===Ya?void 0:G})}function ve(K){return(K==null?void 0:K.sharedColumnRef)!=null}function Te(K){var te;return((te=Bn(K,he.value))==null?void 0:te.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:eI,piiLabel:r,idn:l,setAttr:s,isManagedFk:c,setNaturalId:d,clearNaturalIdPatch:u,setIdentifier:m,setTransient:p,dbLocked:f,fkDerived:h,fkOriginPhysical:g,typeValueOf:k,typeLabelOf:N,setAttrType:b,setAttrCustomType:_,setDb:E,scaleApplicable:I,scaleHint:A,setDbLogical:T,setAttrDescription:L,attrPiiValue:x,setAttrPii:R,predefinedCustomTypeCatalog:$,embeddableCatalog:B,predefinedLabel:O,groupCodeCatalog:y,attrGroupCodes:w,attrCodeItems:v,codeValueOf:M,codeLabelOf:D,setAttrGroupCode:U,setAttrCode:W,setAttrDefaultValue:ie,isEmbedExpanded:pe,setDbAt:ye,setDbLogicalAt:ge,embedColMeta:me,fixedDataType:se,fixedLength:ke,fixedScale:Se,updatableItems:ce,updatableLabel:fe,updatableValue:oe,setUpdatableAt:le,setUpdatable:ue,insertableItems:z,insertableLabel:P,insertableValue:F,setInsertableAt:Q,setInsertable:X,scopeEntities:_e,columnsById:he,sharedCandidates:we,sharedItems:Ie,sharedLabel:Y,sharedValue:j,setSharedAt:J,isShared:ve,sharedPhysical:Te}}const gf={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every embedded column in this entity","em.node.embedAllShow":"Expand all collapsed embedded columns","em.node.embedAllSummary":"{n} embedded column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},bf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティの埋め込み列をすべて折りたたむ","em.node.embedAllShow":"折りたたまれた埋め込み列をすべて展開","em.node.embedAllSummary":"埋め込み列 {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},_f={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 임베드 컬럼 모두 접기","em.node.embedAllShow":"접힌 임베드 컬럼 모두 펼치기","em.node.embedAllSummary":"임베드 컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},tI=["ko","en","ja"],Xl={ko:_f,en:gf,ja:bf};function Dt(e,n,o){let a=(Xl[e]??Xl.ko)[n]??Xl.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const kf=["ko","en","ja","zh"];function nI(e){if(e)for(const n of kf){const o=e[n];if(o)return o}}function Zl(e){const n=nI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function oI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:kf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const iI=["aria-expanded","placeholder"],aI=["aria-selected","onClick","onMouseenter"],rI={key:0,class:"gcc__opt gcc__opt--empty"},Ef=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(x,R)=>Dt(o.locale??"ko",x,R),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),p=t.computed(()=>o.items.find(x=>x.groupCode===o.modelValue)),f=t.computed(()=>p.value?Zl(p.value):"");t.watch(f,x=>{d.value||(c.value=x)},{immediate:!0});const h=t.computed(()=>c.value===f.value?o.items:oI(o.items,c.value));function g(){var R;const x=(R=r.value)==null?void 0:R.getBoundingClientRect();x&&(m.value={left:`${x.left}px`,top:`${x.bottom}px`,width:`${x.width}px`})}function k(){d.value=!0,g(),u.value=Math.max(0,h.value.findIndex(x=>x.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",L)}function N(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",L)}t.onBeforeUnmount(N);function b(){k(),t.nextTick(()=>{var x;return(x=l.value)==null?void 0:x.select()})}function _(){d.value||k(),u.value=0}function E(x){i("update:modelValue",x.groupCode),c.value=Zl(x),N()}function I(){i("update:modelValue",void 0),c.value="",N()}function A(){c.value.trim()===""?I():(c.value=f.value,N())}function T(x){var R;if(x.key==="ArrowDown")d.value||k(),u.value=Math.min(u.value+1,h.value.length-1),x.preventDefault();else if(x.key==="ArrowUp")u.value=Math.max(u.value-1,0),x.preventDefault();else if(x.key==="Enter"){const $=h.value[u.value];$&&E($),x.preventDefault()}else x.key==="Escape"&&(c.value=f.value,N(),(R=l.value)==null||R.blur())}function L(x){var $,B;const R=x.target;!(($=r.value)!=null&&$.contains(R))&&!((B=s.value)!=null&&B.contains(R))&&A()}return(x,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":R[0]||(R[0]=$=>c.value=$),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:b,onInput:_,onKeydown:T},null,40,iI),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:R[1]||(R[1]=t.withModifiers(()=>{},["prevent"])),onClick:I},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,($,B)=>(t.openBlock(),t.createElementBlock("li",{key:$.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":B===u.value,"is-selected":$.groupCode===e.modelValue}]),role:"option","aria-selected":$.groupCode===e.modelValue,onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["prevent"])),onClick:O=>E($),onMouseenter:O=>u.value=B},t.toDisplayString(t.unref(Zl)($)),43,aI))),128)),h.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",rI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),lI=["aria-labelledby"],sI=["aria-checked","tabindex","onClick","onKeydown"],Nf=Ke(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,sI))),128))],8,lI))}}),[["__scopeId","data-v-5c793bbb"]]),cI=["disabled"],dI={class:"em-aw__toolbar"},uI={class:"em-aw__count"},mI={class:"em-aw__scroll"},fI={class:"em-aw__table"},pI={class:"c-name"},hI={class:"c-type"},yI={class:"c-logical"},gI=["id"],bI={class:"c-col"},_I={class:"c-constraints"},kI={class:"c-del"},EI={class:"c-expand"},NI=["title","onClick","onKeydown"],wI=["title"],II={key:1,class:"em-aw__muted"},vI=["title"],xI=["title"],CI=["title"],SI={class:"em-aw__cflags"},RI=["title"],AI={colspan:"8"},$I={class:"em-aw__detail"},TI={class:"em-aw__dgroup"},MI=["title"],VI={class:"em-aw__df"},BI={class:"em-aw__df"},DI={class:"em-aw__dgroup"},OI={key:0,class:"em-aw__dgroup"},LI={class:"em-aw__df"},PI={key:0,class:"em-aw__df"},zI={class:"em-aw__df"},FI={class:"em-aw__dgroup em-aw__ddesc"},UI={class:"c-expand"},HI={class:"em-aw__caret is-static","aria-hidden":"true"},jI={class:"c-del"},KI={class:"c-expand"},GI=["title","onClick","onKeydown"],YI={class:"em-aw__embed-label"},qI=["title"],WI=["title"],JI={class:"em-aw__ro"},XI=["title"],ZI={class:"em-aw__ro"},QI=["title"],ev={class:"em-aw__ro"},tv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},nv={colspan:"8"},ov={class:"em-aw__detail"},iv={class:"em-aw__dgroup"},av={key:0,class:"em-aw__df"},rv={class:"em-aw__df"},lv={class:"em-aw__df"},sv={key:0},cv={colspan:"99",class:"em-aw__empty"},dv=6,uv=5,mv=Ke(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:p,setTransient:f,dbLocked:h,fkDerived:g,fkOriginPhysical:k,typeValueOf:N,typeLabelOf:b,setAttrType:_,setAttrCustomType:E,setDb:I,scaleApplicable:A,scaleHint:T,setDbLogical:L,attrPiiValue:x,setAttrPii:R,predefinedCustomTypeCatalog:$,embeddableCatalog:B,predefinedLabel:O,groupCodeCatalog:y,attrGroupCodes:w,attrCodeItems:v,codeValueOf:M,codeLabelOf:D,setAttrGroupCode:U,setAttrCode:W,setAttrDefaultValue:ie,setAttrDescription:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:z,insertableItems:P,insertableLabel:F,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:Y,isShared:j,sharedPhysical:J}=yf(o,()=>n.entityId),ve=t.computed(()=>{var Ve;return[...((Ve=i.value)==null?void 0:Ve.attributes)??[]].sort((H,V)=>H.order-V.order)}),Te=t.computed(()=>{var Ve;return(((Ve=i.value)==null?void 0:Ve.attributes)??[]).filter(H=>H.attrType!=="DIVIDER").length}),K=t.ref(new Set);function te(Ve){return K.value.has(Ve)}function G(Ve){const H=new Set(K.value);H.has(Ve)?H.delete(Ve):H.add(Ve),K.value=H}const ae=t.ref(o.userLanguage.value);function Be(Ve){!Ve||!i.value||o.addPredefinedEmbed(i.value.modelId,Ve)}return(Ve,H)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",dI,[t.createElementVNode("span",uI,t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:H[0]||(H[0]=V=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:H[1]||(H[1]=V=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(B).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(B),"value-provider":V=>V.type,"label-provider":t.unref(O),"onUpdate:modelValue":Be},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",mI,[t.createElementVNode("table",fI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[H[3]||(H[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",pI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",hI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",yI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,gI),t.createVNode(Nf,{modelValue:ae.value,"onUpdate:modelValue":H[2]||(H[2]=V=>ae.value=V),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",bI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),H[4]||(H[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),H[5]||(H[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",_I,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),H[6]||(H[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value,V=>{var Pe,Ze,Ue,Le,De,Z,dt,yn,Et,gn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:V.modelId},[V.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(V.modelId)}])},[H[7]||(H[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-divlabel-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:dv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",kI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])])],2)):t.unref(ye)(V)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(V.modelId)}])},[t.createElementVNode("td",UI,[t.createElementVNode("span",HI,[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-type-${V.modelId}`,width:"100%",disabled:"","model-value":V.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:uv,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:V.dbAttrs.length})),1),t.createElementVNode("td",jI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.dbAttrs,(Ee,at)=>{var zt,ut,Qt,en,Ne,et,Ft,pt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":te(Ee.modelId)}])},[t.createElementVNode("td",KI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(Ee.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(Ee.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:nt=>G(Ee.modelId),onKeydown:[t.withKeys(t.withModifiers(nt=>G(Ee.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(nt=>G(Ee.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,GI)]),t.createElementVNode("td",YI,"↳ "+t.toDisplayString(((zt=t.unref(se)(V,at))==null?void 0:zt.name)??((ut=t.unref(se)(V,at))==null?void 0:ut.physicalName)??t.unref(o).t("em.attr.colFallback",{n:at+1})),1),H[14]||(H[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(dn,{name:`aw-embed-logical-${Ee.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:((en=(Qt=t.unref(se)(V,at))==null?void 0:Qt.logicalName)==null?void 0:en[ae.value])??((et=(Ne=t.unref(se)(V,at))==null?void 0:Ne.logicalName)==null?void 0:et.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ee.logicalName,"onUpdate:modelValue":nt=>t.unref(me)(V,at,nt)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(j)(Ee)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-embed-col-${Ee.modelId}`,width:"100%",disabled:t.unref(j)(Ee),placeholder:((Ft=t.unref(se)(V,at))==null?void 0:Ft.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(j)(Ee)?t.unref(J)(Ee):Ee.physicalName,"onUpdate:modelValue":nt=>t.unref(ge)(V,at,{physicalName:nt})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(to,{controller:t.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"])],8,qI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",JI,t.toDisplayString(t.unref(ke)(V,at)),1)],8,WI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",ZI,t.toDisplayString(t.unref(Se)(V,at)??""),1)],8,XI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",ev,t.toDisplayString(t.unref(ce)(V,at)!=null?`scale ${t.unref(ce)(V,at)}`:""),1)],8,QI),H[15]||(H[15]=t.createElementVNode("td",null,null,-1))],2),te(Ee.modelId)?(t.openBlock(),t.createElementBlock("tr",tv,[H[18]||(H[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",nv,[t.createElementVNode("div",ov,[t.createElementVNode("fieldset",iv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(pt=t.unref(se)(V,at))!=null&&pt.shareable?(t.openBlock(),t.createElementBlock("label",av,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(Ie)(Ee),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":nt=>nt&&t.unref(Y)(V,at,nt)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",rv,[H[16]||(H[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ee),"model-value":t.unref(j)(Ee)?"false":t.unref(Q)(Ee),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":nt=>nt&&t.unref(X)(V,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",lv,[H[17]||(H[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ee),"model-value":t.unref(j)(Ee)?"false":t.unref(le)(Ee),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":nt=>nt&&t.unref(ue)(V,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(r).has(V.modelId),"em-aw__open":te(V.modelId)})},[t.createElementVNode("td",EI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(V.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(V.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:Ee=>G(V.modelId),onKeydown:[t.withKeys(t.withModifiers(Ee=>G(V.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Ee=>G(V.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,NI)]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-type-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!V.groupCode||V.attrType==="RELATION_REF"||t.unref(g)(V),items:t.unref(ec)(V.type,t.unref($)),"value-provider":t.unref(N),"label-provider":t.unref(b),"model-value":V.type,"onUpdate:modelValue":Ee=>t.unref(_)(V,Ee)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),V.type===t.unref(tn)&&!t.unref(g)(V)?(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:0,name:`aw-customtype-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":V.customType??"","onUpdate:modelValue":Ee=>t.unref(E)(V,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,wI),t.createElementVNode("td",null,[V.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(dn,{key:0,name:`aw-logical-${V.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Pe=V.dbAttrs[0])==null?void 0:Pe.logicalName,"onUpdate:modelValue":Ee=>t.unref(L)(V,Ee)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",II,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-col-${V.modelId}`,width:"100%",placeholder:t.unref(k)(V)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(h)(V),"model-value":((Ze=V.dbAttrs[0])==null?void 0:Ze.physicalName)??"","onUpdate:modelValue":Ee=>t.unref(I)(V,{physicalName:Ee})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(to,{controller:t.unref(o),"ref-id":(Ue=V.dbAttrs[0])==null?void 0:Ue.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-dtype-${V.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(h)(V)||t.unref(g)(V),items:t.unref(Xs)(((Le=V.dbAttrs[0])==null?void 0:Le.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Cr),"model-value":((De=V.dbAttrs[0])==null?void 0:De.dataType)??"","onUpdate:modelValue":Ee=>Ee&&t.unref(I)(V,{dataType:Ee})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,vI),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-len-${V.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(h)(V)||t.unref(g)(V),"model-value":(Z=V.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":Ee=>t.unref(I)(V,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,xI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",SI,[t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-pk-${V.modelId}`,label:"PK","model-value":V.identifier,disabled:t.unref(a)||t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(p)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nn-${V.modelId}`,label:"NN","model-value":V.notNull,disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(d)(V,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-uq-${V.modelId}`,label:"UQ","model-value":!!((dt=V.dbAttrs[0])!=null&&dt.unique),disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(I)(V,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,CI),t.createElementVNode("td",{class:"c-del",title:t.unref(u)(V)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])],8,RI)],2),te(V.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(V.modelId)}])},[H[13]||(H[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",AI,[t.createElementVNode("div",$I,[t.createElementVNode("fieldset",TI,[H[11]||(H[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(T)(V)},[H[8]||(H[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-scale-${V.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(h)(V)||t.unref(g)(V)||!t.unref(A)(V),"model-value":(yn=V.dbAttrs[0])==null?void 0:yn.scale,"onUpdate:modelValue":Ee=>t.unref(I)(V,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,MI),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-ai-${V.modelId}`,label:"Auto Increment","model-value":!!((Et=V.dbAttrs[0])!=null&&Et.autoIncrement),disabled:t.unref(h)(V)||t.unref(g)(V)||!V.identifier,"onUpdate:modelValue":Ee=>t.unref(I)(V,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",VI,[H[9]||(H[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-ins-${V.modelId}`,width:"110px",disabled:t.unref(h)(V),"model-value":t.unref(Q)(V.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ee=>Ee&&t.unref(_e)(V,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",BI,[H[10]||(H[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-upd-${V.modelId}`,width:"110px",disabled:t.unref(h)(V),"model-value":t.unref(le)(V.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ee=>Ee&&t.unref(z)(V,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",DI,[H[12]||(H[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-tr-${V.modelId}`,label:"@Transient","model-value":!!V.transient,disabled:V.identifier||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(f)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nid-${V.modelId}`,label:"@NaturalId","model-value":!!V.naturalId,disabled:V.identifier||t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(m)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${V.modelId}`,label:"mutable","model-value":!!V.naturalIdMutable,disabled:t.unref(h)(V)||!V.naturalId,"onUpdate:modelValue":Ee=>t.unref(d)(V,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-mv-${V.modelId}`,label:"Multi-Value (Set)","model-value":!!((gn=V.dbAttrs[0])!=null&&gn.multiValue),disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(I)(V,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(g)(V)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",OI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",LI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(x)(V),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ee=>Ee&&t.unref(R)(V,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(y).length?(t.openBlock(),t.createElementBlock("label",PI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Ef,{"model-value":V.groupCode,items:t.unref(y),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ee=>t.unref(U)(V,Ee)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",zI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(w)(V).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"150px","model-value":V.defaultValue??"none",items:t.unref(v)(V),"value-provider":t.unref(M),"label-provider":t.unref(D),"onUpdate:modelValue":Ee=>Ee&&t.unref(W)(V,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`aw-default-${V.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":V.defaultValue??"","onUpdate:modelValue":Ee=>t.unref(ie)(V,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",FI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`aw-desc-${V.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":V.description,"onUpdate:modelValue":Ee=>t.unref(pe)(V,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",sv,[t.createElementVNode("td",cv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,cI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-559a29b3"]]);function Ql(e,n){return n&&n!==e?`${e} (${n})`:e}function wf(e,n,o){const i=e.dbAttrs[n];return i?Go(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function If(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):Ql(o,wf(e,0,n))}function vf(e,n){var l;if(Mn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?Ql(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return Ql(i,wf(o,r<0?0:r,n))}const fv=["disabled"],pv={class:"em-idxw__list"},hv={class:"em-idxw__list-head"},yv=["aria-label"],gv=["aria-current","onClick","onKeydown"],bv={class:"em-idxw__item-name"},_v={key:0,class:"em-idxw__badge"},kv={class:"em-idxw__item-cnt"},Ev={key:0,class:"em-idxw__empty"},Nv={key:0,class:"em-idxw__edit"},wv={class:"em-idxw__form"},Iv={class:"em-field em-idxw__name"},vv={class:"em-field"},xv=["value","placeholder"],Cv={class:"em-idxw__transfer"},Sv={class:"em-idxw__pane"},Rv={class:"em-idxw__pane-head"},Av=["aria-label"],$v=["aria-pressed","onClick","onKeydown"],Tv=["title"],Mv={key:0,class:"em-idxw__empty"},Vv={class:"em-idxw__arrows"},Bv={class:"em-idxw__pane"},Dv={class:"em-idxw__pane-head"},Ov={class:"em-idxw__col-name"},Lv=["title"],Pv={class:"em-idxw__col-ops"},zv=["title","disabled","onClick"],Fv=["title","disabled","onClick"],Uv=["title","onClick"],Hv={key:0,class:"em-idxw__empty"},jv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Kv=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(y=>y.modelId===n.entityId)??null),a=t.computed(()=>{var y;return((y=i.value)==null?void 0:y.indexes)??[]}),r=t.computed(()=>{var y;return((y=i.value)==null?void 0:y.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,y=>{var w;y.some(v=>v.modelId===s.value)||(s.value=((w=y[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(y=>y.modelId===s.value)??null),d=t.computed(()=>i.value?jo(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Tn(r.value)),m=y=>u.value.canon(y),p=t.computed(()=>{var y;return new Set((((y=c.value)==null?void 0:y.columns)??[]).map(w=>m(w.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function h(y){return If(y,f.value)}function g(y){return y.physicalName&&y.physicalName!==y.field?`${y.field} (${y.physicalName})`:y.field}function k(y){return vf(y,f.value)}const N=t.computed(()=>[...r.value.filter(y=>y.dbAttrs.length>0&&!p.value.has(m(y.modelId))).map(y=>({ref:y.modelId,label:h(y),inherited:!1})),...d.value.filter(y=>!p.value.has(m(y.modelId))).map(y=>({ref:y.modelId,label:g(y),inherited:!0}))]),b=t.ref(new Set);t.watch(s,()=>b.value=new Set);function _(y){return Mn(y)}function E(y,w){i.value&&o.updateIndex(i.value.modelId,y,w)}function I(){var w;if(!i.value)return;const y=Me();o.addIndex(i.value.modelId,{modelId:y,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=y}function A(y){i.value&&o.removeIndex(i.value.modelId,y)}function T(y){c.value&&E(c.value.modelId,{parameters:y.trim()===""?void 0:y})}function L(y){const w=new Set(b.value);w.has(y)?w.delete(y):w.add(y),b.value=w}function x(){const y=c.value;if(!y||!b.value.size)return;const w=[...b.value].map(v=>({columnRef:v,descending:!1}));E(y.modelId,{columns:[...y.columns,...w]}),b.value=new Set}function R(y){const w=c.value;w&&E(w.modelId,{columns:w.columns.filter((v,M)=>M!==y)})}function $(y,w){const v=c.value;v&&E(v.modelId,{columns:v.columns.map((M,D)=>D===y?{...M,descending:w}:M)})}function B(y,w){const v=c.value;if(!v)return;const M=y+w;if(M<0||M>=v.columns.length)return;const D=[...v.columns];[D[y],D[M]]=[D[M],D[y]],E(v.modelId,{columns:D}),O(M,w)}async function O(y,w){var W,ie;await t.nextTick();const v=(W=l.value)==null?void 0:W.querySelectorAll(".em-idxw__col--idx")[y];if(!v)return;const M=pe=>v.querySelector(`[data-move="${pe}"]`),D=M(w<0?"up":"down"),U=M(w<0?"down":"up");(ie=D&&!D.disabled?D:U)==null||ie.focus()}return(y,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",pv,[t.createElementVNode("div",hv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:I},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":v.modelId===s.value}]),role:"button",tabindex:"0","aria-current":v.modelId===s.value?"true":void 0,onClick:M=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(M=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(M=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",bv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",_v,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",kv,t.toDisplayString(v.columns.length),1)],42,gv))),128))],8,yv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Ev,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Nv,[t.createElementVNode("div",wv,[t.createElementVNode("label",Iv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=v=>E(c.value.modelId,{name:v}))},null,8,["model-value"]),t.createVNode(to,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=v=>E(c.value.modelId,{unique:v}))},null,8,["model-value"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=v=>A(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",vv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=v=>T(v.target.value))},null,40,xv)]),t.createElementVNode("div",Cv,[t.createElementVNode("div",Sv,[t.createElementVNode("div",Rv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:N.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:N.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":b.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":b.value.has(v.ref),onClick:M=>L(v.ref),onKeydown:[t.withKeys(t.withModifiers(M=>L(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(M=>L(v.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(v.label),1),v.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Tv)):t.createCommentVNode("",!0)],42,$v))),128))],8,Av),N.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Mv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",Vv,[t.createVNode(t.unref(ee.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!b.value.size,onClick:x},null,8,["caption","disabled"])]),t.createElementVNode("div",Bv,[t.createElementVNode("div",Dv,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(v,M)=>(t.openBlock(),t.createElementBlock("li",{key:M,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",Ov,[t.createTextVNode(t.toDisplayString(k(v.columnRef)),1),_(v.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Lv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idxw-desc-${M}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":D=>$(M,D)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",Pv,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:M===0,onClick:D=>B(M,-1)},"↑",8,zv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:M===c.value.columns.length-1,onClick:D=>B(M,1)},"↓",8,Fv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:D=>R(M)},"✕",8,Uv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Hv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",jv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,fv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),Gv={class:"em-op-src"},Yv=["placeholder"],qv={class:"em-op-src__actions"},xf=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(l,s)=>Dt(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",Gv,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,Yv),[[t.vModelText,a.value]]),t.createElementVNode("div",qv,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),Wv=["disabled"],Jv={class:"em-ow__toolbar"},Xv={class:"em-ow__count"},Zv={class:"em-ow__scroll"},Qv={class:"em-ow__table"},ex={class:"c-name"},tx={class:"c-desc"},nx=["id"],ox={class:"c-pii"},ix={class:"c-src"},ax={class:"c-del"},rx={key:0},lx={colspan:"6",class:"em-ow__empty"},sx=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModal(),a=t.computed(()=>o.state.logical.entities.find(k=>k.modelId===n.entityId)??null),r=t.computed(()=>{var k;return[...((k=a.value)==null?void 0:k.operations)??[]].sort((N,b)=>N.order-b.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(k){return k==="none"?o.t("em.common.noneParen"):k}const u=k=>k;function m(k,N){a.value&&o.updateOperation(a.value.modelId,k.modelId,N)}function p(k,N){m(k,{description:Object.keys(N).length?N:void 0})}function f(k){return k.personalInfoAttributeType??"none"}function h(k,N){m(k,{personalInfoAttributeType:N==="none"?void 0:N})}function g(k){i.openModal({component:xf,bind:{operationName:k.name,sourceCode:k.sourceCode??"",locale:o.uiLocale.value,onSave:N=>m(k,{sourceCode:N})}})}return(k,N)=>{var b,_;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",Jv,[t.createElementVNode("span",Xv,t.toDisplayString(t.unref(o).t("em.op.section",{n:((b=a.value.operations)==null?void 0:b.length)??0})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:N[0]||(N[0]=E=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",Zv,[t.createElementVNode("table",Qv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",ex,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),N[2]||(N[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",tx,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,nx),t.createVNode(Nf,{modelValue:l.value,"onUpdate:modelValue":N[1]||(N[1]=E=>l.value=E),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",ox,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",ix,t.toDisplayString(t.unref(o).t("em.op.body")),1),N[3]||(N[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,E=>(t.openBlock(),t.createElementBlock("tr",{key:E.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`ow-name-${E.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":E.name,"onUpdate:modelValue":I=>m(E,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":E.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&m(E,{visibility:I})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(dn,{name:`ow-desc-${E.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":E.description,"onUpdate:modelValue":I=>p(E,I)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":f(E),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":I=>I&&h(E,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t(E.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:I=>g(E)},null,8,["caption","onClick"])]),t.createElementVNode("td",ax,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(o).removeOperation(a.value.modelId,E.modelId)},null,8,["onClick"])])]))),128)),(_=a.value.operations)!=null&&_.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",rx,[t.createElementVNode("td",lx,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,Wv)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),cx={class:"em-detail__tabs"},dx=["onClick"],ux={key:0,class:"em-detail__lock"},mx=["disabled"],fx={key:0,class:"em-detail__narrow"},px=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",cx,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:p=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,dx)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",ux,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",fx,[t.createVNode(pf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(mv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(Kv,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(sx,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,mx)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function qa(e,n,o){e.openModal({component:px,bind:{controller:t.markRaw(n),entityId:o}})}function un(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>ld(e,r))}function Ot(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of Pd(l,r))i.push(da(a,s.indexRef,{columns:s.columns}))}return i}function Wa(e,n,o,i){var c;const a=[];a.push(...un(n,o.remove,i));for(const d of o.update)a.push(on(n,d.attributeId,d.patch));for(const d of o.add)a.push(jt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const p=l.filter(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,h)=>f.order-h.order)[0];p&&a.push(Tt(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function Mo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Ni(e,n,o){const i=[];for(const[a,r]of bc(e,n,Me))i.push(...Wa(e,a,r,o));for(const a of qg(e,n,Me))i.push(on(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function hx(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Gr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return Fd(e,n,r).map(l=>on(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function yx(e,n,o){const i=new Set(o.remove);return Mo(e,n,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function Ja(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of _c(e,r,Me)){const c=i.get(l);i.set(l,c?gc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...Wa(e,r,gx(l),o));return a}function gx(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function Cf(e){return e.attributes.flatMap(n=>n.dbAttrs).map(n=>({...n,modelId:Me()}))}function bx(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=Rt(o.attributes),p=new Set(o.attributes.map(h=>h.name));let f="id";for(let h=2;p.has(f);h++)f=`id${h}`;a={modelId:Me(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Me(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(jt(n,a))}const r=[];for(const m of e.entities)for(const p of m.attributes){if(((u=p.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(N=>N.modelId===p.embedded.associationRef);if(!f)continue;const h=f.end1.entityRef===m.modelId,g=h?f.end1:f.end2,k=h?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1},end2:{entityRef:n,multiplicity:k.multiplicity,navigable:k.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const p=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return p.size?{...m,attributes:m.attributes.filter(f=>!p.has(f.modelId))}:m}),associations:e.associations.map(m=>{const p=r.find(f=>f.assocId===m.modelId);return p?{...m,end1:p.end1,end2:p.end2}:m})},s=Wo(l,n,Me);for(const m of r){const p=s.add.find(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...un(m.ownerId,[m.dispId],c)),i.push(ca(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Wa(l,n,s,c));const d=yx(l,n,s);return i.push(...Ni(d,n,c)),i.push(...Ot(e,c)),i}function _x(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(_=>_.modelId===c);if(!d||d.attributes.some(_=>{var E;return((E=_.embedded)==null?void 0:E.associationRef)===r.modelId}))continue;const u=Me(),m=Rt(d.attributes),p=new Set(d.attributes.map(_=>_.name)),f=a(o.name);let h=f;for(let _=2;p.has(h);_++)h=`${f}${_}`;const g=o.attributes.filter(_=>!_.identifier&&!_.derivedFrom).flatMap(_=>_.dbAttrs).map(_=>({..._,modelId:Me()})),k={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(jt(c,k));const N=l?"end2":"end1",b=l?"end1":"end2";i.push(ca(r.modelId,{identifying:!1,[N]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Me()},[b]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Sf(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[od(n,o),...i.map(u=>ko(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(_d(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const p=e.layout.notes.find(f=>f.modelId===m);p&&c.push(ti(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}function kx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Me(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},p={...n.logical,associations:[...n.logical.associations,m]},f=Wo(p,s,Me),h=f.add[0];h&&(m.end2.attributeRef=h.modelId);const g={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(h==null?void 0:h.modelId)??d},k=sa(m,g),N=Wa(p,s,f,[]);return i(N.length?We("관계 추가",[k,...N]):k),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(A=>A.modelId===l),d=n.logical.entities.find(A=>A.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Me(),m=Me(),p=Me(),f=Rt(c.attributes),h=Cf(d),g=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),k=new Set(c.attributes.map(A=>A.name)),N=g(d.name);let b=N;for(let A=2;k.has(b);A++)b=`${N}${A}`;const _={modelId:m,name:b,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:h,embedded:{associationRef:u,embeddableRef:s}},E={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},I={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(We("임베드 추가",[jt(l,_),sa(E,I)])),u},setEmbedCardinality(l,s){var N;if(r(l))return;const c=n.logical.associations.find(b=>b.modelId===l);if(!c)return;let d,u;for(const b of n.logical.entities){const _=b.attributes.find(E=>{var I;return((I=E.embedded)==null?void 0:I.associationRef)===l&&E.attrType==="EMBED_OWN"});if(_){d=b.modelId,u=_;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,p=c.end2.entityRef===m?"end2":"end1",f=c[p];if(f.multiplicity===s)return;const h=b=>b==="ZERO_OR_MORE_INSTANCES"||b==="ONE_OR_MORE_INSTANCES",g=h(f.multiplicity),k=h(s);if(g===k){i(Tt(l,p,{multiplicity:s}));return}if(k)i(We("임베드 컬렉션 전환",[on(d,u.modelId,{dbAttrs:[]}),Tt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((N=f.jpa)==null?void 0:N.collectionType)??"LIST"}})]));else{const b=n.logical.entities.find(_=>_.modelId===m);if(!b)return;i(We("임베드 단일 전환",[on(d,u.modelId,{dbAttrs:Cf(b)}),Tt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=pd(l);if(!s){i(c);return}for(const f of n.logical.entities){const h=f.attributes.find(g=>{var k;return((k=g.embedded)==null?void 0:k.associationRef)===l});if(h){const g=[];i(We("임베드 삭제",[c,...un(f.modelId,[h.modelId],g),...Ot(n.logical,g)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=Ja(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(g=>g.modelId===s.end1.entityRef),h=f==null?void 0:f.attributes.find(g=>g.modelId===s.end1.attributeRef&&g.attrType==="RELATION_REF");h&&p.push(...un(f.modelId,[h.modelId],m))}p.push(...Ot(n.logical,m)),i(p.length?We("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(h=>h.modelId===l),d=ca(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(h=>h.modelId===l?{...h,identifying:s}:h)},p=[],f=Ja(m,[u],p);f.push(...Ot(n.logical,p)),i(f.length?We("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.modelId===d.end2.entityRef),p=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!p){if(c.navigable===!0&&!d.end1.attributeRef){const f=Ui(d.end2.multiplicity),h=d.end1.navFieldNameHint||ji(m.name,f),g=co(h,new Set(u.attributes.map(_=>_.name))),k=Me(),N=Rt(u.attributes),b={modelId:k,name:g,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:N,dbAttrs:[]};i(We("inverse nav 추가",[jt(d.end1.entityRef,b),Tt(l,"end1",{...c,attributeRef:k,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,h=u.attributes.find(b=>b.modelId===f&&b.attrType==="RELATION_REF"),g=Tt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(h==null?void 0:h.name)??d.end1.navFieldNameHint}),k=[],N=h?un(d.end1.entityRef,[f],k):[];i(h?We("inverse nav 제거",[...N,g,...Ot(n.logical,k)]):g);return}}}i(Tt(l,s,c))}}}function Ex(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,p)=>{if(a(u))return;const f=on(u,m,p),h=Mo(n.logical,u,N=>N.map(b=>b.modelId===m?{...b,...p}:b)),g=[],k=Ni(h,u,g);k.push(...Ot(n.logical,g)),i(k.length?We("속성 수정",[f,...k]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(b=>b.type===m),f=n.logical.entities.find(b=>b.modelId===u);if(!p||!f)return null;const h=Rt(f.attributes),g=Me(),k=p.fields.map(()=>({modelId:Me(),physicalName:"",dataType:""})),N={modelId:g,name:p.defaultName,type:p.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:h,dbAttrs:k};return i(jt(u,N)),g},addAttribute(u,m={}){if(!o.value||a(u))return null;const p=n.logical.entities.find(I=>I.modelId===u),f=p?Rt(p.attributes):0,h=m.modelId??Me(),g=m.name??`field${f}`,k={modelId:h,name:g,type:m.type??Rr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Me(),physicalName:g,dataType:"VARCHAR"}],...m},N=jt(u,k),b=Mo(n.logical,u,I=>[...I,k]),_=[],E=Ni(b,u,_);return E.push(...Ot(n.logical,_)),i(E.length?We("속성 추가",[N,...E]):N),h},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(g=>g.modelId===u),p=m?Rt(m.attributes):0,f=Me();return i(jt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:p,dbAttrs:[]})),f},updateAttribute(u,m,p){d(u,m,p)},setAttributeGroupCode(u,m,p){d(u,m,{groupCode:p,type:p?Dn:Rr})},setEmbedColumns(u,m,p){var b,_;if(a(u))return;const f=on(u,m,{dbAttrs:p}),h=(b=n.logical.entities.find(E=>E.modelId===u))==null?void 0:b.attributes.find(E=>E.modelId===m),g=(_=h==null?void 0:h.embedded)==null?void 0:_.associationRef,k=g?n.logical.associations.find(E=>E.modelId===g):void 0,N=[];k&&g&&(k.end1.legacyEmbedRaw&&N.push(Tt(g,"end1",{legacyEmbedRaw:void 0})),k.end2.legacyEmbedRaw&&N.push(Tt(g,"end2",{legacyEmbedRaw:void 0}))),i(N.length?We("임베드 컬럼 수정",[f,...N]):f)},removeAttribute(u,m){if(a(u))return;if(Ji(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=un(u,[m],p),h=Mo(n.logical,u,N=>N.filter(b=>b.modelId!==m)),g=[...Ni(h,u,p),...Ot(n.logical,p)],k=[...f,...g];i(k.length===1?k[0]:We("속성 삭제",k))},removeAttributes(u,m){var b;if(!m.length||a(u))return;const p=m.filter(_=>!Ji(n.logical,u,_));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],h=un(u,p,f),g=new Set(p),k=Mo(n.logical,u,_=>_.filter(E=>!g.has(E.modelId))),N=[...h,...Ni(k,u,f),...Ot(n.logical,f)];i(N.length===1?N[0]:We("속성 삭제",N)),((b=c.value)==null?void 0:b.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,p){i(aa(u,m,p))},setAttributeSwatches(u,m,p){m.length&&(m.length===1?i(aa(u,m[0],p)):i(We("속성 색상",m.map(f=>aa(u,f,p)))))},reorderAttributes(u,m,p){if(!m.length||a(u))return;const f=ol(u,m,p),h=hx(n.logical,u,m,p);i(h.length?We("속성 재정렬",[f,...h]):f)}}}function Nx(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Me(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=Me();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Me()}for(const a of n.indexes??[]){a.modelId=Me();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Me();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const wx=220;function Ix(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||wx));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of n.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of n.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const es=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function vx(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const g=c.filter(k=>n.logical.entities.some(N=>N.modelId===k));if(g.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:g}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const g=n.logical.entities.find(N=>N.modelId===d.entityId);if(!g)return;const k=[...g.attributes].sort((N,b)=>N.order-b.order).filter(N=>d.ids.includes(N.modelId));if(!k.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:k}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(g=>g.modelId===u),p=n.layout.entityLayouts.find(g=>g.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let h;if(p){const{entityRef:g,geo:k,locked:N,...b}=p;Object.keys(b).length&&(h=b)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:h}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const h=n.logical.entities.find(E=>E.modelId===f);if(!h)return[];const g=new Set(h.attributes.map(E=>E.name)),k=new Set(h.attributes.flatMap(E=>E.dbAttrs.map(I=>I.physicalName))),N=Rt(h.attributes),b=[],_=c.attributes.map((E,I)=>{const A=JSON.parse(JSON.stringify(E));A.modelId=Me();for(const T of A.dbAttrs)T.modelId=Me();g.has(A.name)&&(A.name=co(`${A.name}_copy`,g)),g.add(A.name);for(const T of A.dbAttrs)T.physicalName&&k.has(T.physicalName)&&(T.physicalName=co(`${T.physicalName}_copy`,k)),T.physicalName&&k.add(T.physicalName);return A.order=N+I,b.push(A.modelId),jt(f,A)});return l(_.length===1?_[0]:We("속성 붙여넣기",_)),i.value={kind:"attribute",entityId:f,ids:b,anchor:b[b.length-1]},[]}const{clone:d,idMap:u}=Nx(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let p;if(c.layoutExtras){const f={...c.layoutExtras},h=g=>u.get(g);f.attributeStyles&&(f.attributeStyles=ta(f.attributeStyles,h)),f.operationStyles&&(f.operationStyles=ta(f.operationStyles,h)),p=f}return l(ia(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Pc(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const p=(u==null?void 0:u.placement)??"append-right",f=p==="append-right"?Ix(n.layout,m.layout):p.offset,h=new Map(m.layout.entityLayouts.map(_=>[_.entityRef,_])),g=new Map(m.layout.associationLayouts.map(_=>[_.associationRef,_])),k=new Map(m.layout.groupLayouts.map(_=>[_.groupRef,_])),N=[];let b=80;for(const _ of m.logical.entities){const E=h.get(_.modelId),I=E?{location:es(E.geo.location,f),size:{...E.geo.size}}:{location:{x:b+=40,y:80},size:{width:220,height:140}};let A;if(E){const{entityRef:T,geo:L,locked:x,...R}=E;A=R}N.push(ia(_,I,A))}for(const _ of m.logical.associations){const E=g.get(_.modelId),I=E?{...E,waypoints:E.waypoints.map(A=>es(A,f))}:{associationRef:_.modelId,waypoints:[]};N.push(sa(_,I))}for(const _ of m.logical.groups){const E=k.get(_.modelId),I=E?{location:es(E.geo.location,f),size:{...E.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(E){const{groupRef:T,geo:L,locked:x,memberNoteRefs:R,...$}=E;A=$}N.push(ra(_,I,A))}return l(We("다이어그램 가져오기",N)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(_=>_.modelId)}};return s}function xx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l}=e;return{addEntity(s="NewEntity",c={x:80,y:80}){if(!o.value)return null;const d=Me(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Me(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Me(),physicalName:"id",dataType:"BIGINT"}]}]};return i(ia(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(Wc(s,c))},updateEntity(s,c){if(a(s))return;const d=qc(s,c),u=n.logical.entities.find(f=>f.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",p=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const f=u.attributes.filter(_=>_.identifier&&!_.derivedFrom).map(_=>on(s,_.modelId,{identifier:!1})),h=Mo({...n.logical,entities:n.logical.entities.map(_=>_.modelId===s?{..._,stereotype:"JPA_EMBEDDABLE"}:_)},s,_=>_.map(E=>E.identifier&&!E.derivedFrom?{...E,identifier:!1}:E)),g=[],k=Ja(h,[s],g);k.push(...Ot(n.logical,g));const N=_x(n.logical,s),b=[d,...f,...k,...N];i(b.length>1?We("임베더블 변환",b):d);return}if(p){const f=bx(n.logical,s),h=[d,...f];i(h.length>1?We("엔터티 전환",h):d);return}i(d)},moveEntity(s,c){a(s)||i(ko(s,c))},resizeEntity(s,c){a(s)||i(Jc(s,c))},removeEntity(s){if(a(s))return;const c=Yc(s);if(!n.logical.entities.find(k=>k.modelId===s)){i(c);return}const u=n.logical.associations.filter(k=>k.end1.entityRef===s||k.end2.entityRef===s),m=new Set(u.map(k=>k.modelId)),p=[],f=[];for(const k of n.logical.entities)if(k.modelId!==s)for(const N of k.attributes)N.embedded&&m.has(N.embedded.associationRef)&&p.push(...un(k.modelId,[N.modelId],f));for(const k of u){if(k.end1.entityRef===s||!k.end1.attributeRef)continue;const N=n.logical.entities.find(_=>_.modelId===k.end1.entityRef),b=N==null?void 0:N.attributes.find(_=>_.modelId===k.end1.attributeRef&&_.attrType==="RELATION_REF");b&&p.push(...un(N.modelId,[b.modelId],f))}const h={...n.logical,entities:n.logical.entities.filter(k=>k.modelId!==s),associations:n.logical.associations.filter(k=>!m.has(k.modelId))},g=new Set(u.filter(k=>k.end1.entityRef===s&&k.end2.entityRef!==s).map(k=>k.end2.entityRef));p.push(...Ja(h,[...g],f)),p.push(...Ot(n.logical,f.filter(k=>k.entityId!==s))),i(p.length?We("엔티티 삭제",[c,...p]):c)},setEntitySwatch(s,c){i(Xc(s,c))},setEntityCollapsed(s,c){i(Zc(s,c))},setEntityLocked(s,c){i(Qc(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(nl(!0))},expandAll(){i(nl(!1))}}}function Cx(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(N=>n.layout.entityLayouts.find(b=>b.entityRef===N)).filter(N=>!!N);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,h=-1/0;for(const N of u){const b=N.geo.size.width||220,_=N.geo.size.height||140;m=Math.min(m,N.geo.location.x),p=Math.min(p,N.geo.location.y),f=Math.max(f,N.geo.location.x+b),h=Math.max(h,N.geo.location.y+_)}const g=40,k=28;return{location:{x:m-g,y:p-g-k},size:{width:f-m+g*2,height:h-p+g*2+k}}}return{dragGroup(d,u,m){l(d)||i(We("그룹 이동",Sf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(id(d,u))},setGroupSwatch(d,u){i(ad(d,u))},setGroupLocked(d,u){i(rd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(ed(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const h of n.logical.groups)for(const g of d)h.memberEntityRefs.includes(g)&&m.push(la(h.modelId,g));const p=Me(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(ra(f,c(d))),i(We("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Me();return i(ra({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(td(d))},dropEntity(d,u,m){var h;if(r(d))return;const p=((h=n.logical.groups.find(g=>g.memberEntityRefs.includes(d)))==null?void 0:h.modelId)??null,f=[ko(d,u)];p!==m&&(p&&f.push(la(p,d)),m&&f.push(nd(m,d))),i(We("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(la(u.modelId,d))},dropNote(d,u,m){var h;const p=((h=n.layout.groupLayouts.find(g=>{var k;return(k=g.memberNoteRefs)==null?void 0:k.includes(d)}))==null?void 0:h.groupRef)??null,f=[ti(d,u)];p!==m&&(p&&f.push(Sd(p,d)),m&&f.push(Cd(m,d))),i(We("이동",f))}}}function Sx(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(g,k){if(d(),!o.value||!e.opTransport)return;const N=new Dd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:b=>{i.value=!1,a.value=b},onError:e.onOpError});N.seed((k==null?void 0:k.revSeed)??{}),c=N.attach(g),s=N}const m=t.computed(()=>o.value&&r!==void 0),p=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function h(g){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let k;try{k=await l(g)}catch(N){return{ok:!1,reason:N instanceof Error?N.message:String(N)}}return k.ok&&p.value++,k}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:h,reloadRequest:p}}function Rx(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Me();return o(Nd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(wd(i))},moveNote(i,a){o(ti(i,a))},resizeNote(i,a){o(Id(i,a))},setNoteMemo(i,a){o(vd(i,a))},setNoteSwatch(i,a){o(xd(i,a))},addNoteConnection(i,a){o(Rd(i,a))},removeNoteConnection(i,a){o(Ad(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o($d(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Td(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Md(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Vd(i,a))}}}function Ax(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const E=p.ids.includes(u),I=E?p.ids.filter(T=>T!==u):[...p.ids,u];if(!I.length){o.value=null;return}const A=E&&p.anchor===u?I[I.length-1]:E?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:I,anchor:A};return}const h=n.logical.entities.find(E=>E.modelId===d),g=[...(h==null?void 0:h.attributes)??[]].sort((E,I)=>E.order-I.order).map(E=>E.modelId),k=g.indexOf(p.anchor),N=g.indexOf(u);if(k<0||N<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[b,_]=k<=N?[k,N]:[N,k];o.value={kind:"attribute",entityId:d,ids:g.slice(b,_+1),anchor:p.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(g=>g.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(g=>g.modelId===u.anchor);if(p<0)return!1;const f=Math.min(Math.max(p+d,0),m.attributes.length-1);if(f===p)return!0;const h=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[h],anchor:h},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(E=>E.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),h=p.map((E,I)=>f.has(E.modelId)?I:-1).filter(E=>E>=0);if(!h.length)return!1;const g=Math.min(...h),k=p.filter(E=>!f.has(E.modelId)),N=p.slice(0,g).filter(E=>!f.has(E.modelId)).length;let b;if(d<0){if(N<=0)return!0;b=N-1}else{if(k.length-N<=0)return!0;b=N+1}if(r(u.entityId))return!0;const _=p.filter(E=>f.has(E.modelId)).map(E=>E.modelId);return a(ol(u.entityId,_,b)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(b=>b.modelId)),f=new Set(n.logical.groups.map(b=>b.modelId)),h=new Set(n.layout.notes.map(b=>b.modelId)),g=new Set;for(const b of d){if(!f.has(b))continue;const _=n.logical.groups.find(E=>E.modelId===b);for(const E of(_==null?void 0:_.memberEntityRefs)??[])g.add(E)}const k=[],N=[];for(const b of d)if(f.has(b)){if(s(b))continue;const _=n.layout.groupLayouts.find(T=>T.groupRef===b);if(!_)continue;const E=n.logical.groups.find(T=>T.modelId===b),I=((E==null?void 0:E.memberEntityRefs)??[]).map(T=>{var x;const L=((x=n.layout.entityLayouts.find(R=>R.entityRef===T))==null?void 0:x.geo.location)??{x:0,y:0};return{id:T,location:{x:L.x+u,y:L.y+m}}}),A={x:_.geo.location.x+u,y:_.geo.location.y+m};k.push(We("그룹 이동",Sf(n,b,A,I))),N.push("g:"+b)}else if(p.has(b)){if(g.has(b)||l(b))continue;const _=n.layout.entityLayouts.find(E=>E.entityRef===b);if(!_)continue;k.push(ko(b,{x:_.geo.location.x+u,y:_.geo.location.y+m})),N.push("e:"+b)}else if(h.has(b)){const _=n.layout.notes.find(E=>E.modelId===b);if(!_)continue;k.push(ti(b,{x:_.geo.location.x+u,y:_.geo.location.y+m})),N.push("n:"+b)}return k.length?(a(We("이동",k,"nudge:"+N.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const no=Symbol("editorController");function Rf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function $x(e=Rf(),n={}){var ae,Be,Ve;const o=t.reactive(e);let i=new tl(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),u=t.ref(n.uiLocale??"ko"),m=(H,V)=>Dt(u.value,H,V),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),h=t.ref(n.largeEntityThreshold),g=t.ref(n.flagEntitiesWithoutRelations??!1),k=t.ref(!1),N=t.ref(!1),b=t.ref(!1),_=t.ref(0),E=t.ref(null);let I=0;const A=H=>{if(n.onNotice){n.onNotice(H);return}E.value={text:H,id:++I}},T=t.ref(((ae=n.meta)==null?void 0:ae.schemaVersion)??1),L=t.ref(((Be=n.meta)==null?void 0:Be.opWriteEnabled)??!1),x=t.ref(((Ve=n.meta)==null?void 0:Ve.referenceOnly)??!1),R=t.computed(()=>T.value>=2&&L.value),$=t.ref(!(T.value>=2&&L.value===!1)),B=t.ref("LOGICAL_PHYSICAL"),O=t.ref("straight"),y=t.ref(!0),w=t.ref(!0),v=t.ref(null),M=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),D=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?v.value.ids:[]}),U=t.computed(()=>{var H,V;return((H=v.value)==null?void 0:H.kind)==="entity"?v.value.id:((V=v.value)==null?void 0:V.kind)==="attribute"?v.value.entityId:null}),W=t.ref(null),ie=t.ref(null),pe=t.ref(null),ye=t.ref(null),ge=Sx({state:o,opMode:R,editable:$,opConflict:pe,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function me(){i.onChange(()=>{k.value=i.canUndo,N.value=i.canRedo,b.value=i.isDirty,_.value++})}me(),ge.setupOpAdapter(i,n.meta);const se=t.computed(()=>Ss(o.logical,o.layout)),ke=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:h.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Se=()=>Ks(o.logical,x.value),ce=n.validationDebounceMs??250;let fe,oe=()=>{};if(ce>0){const H=t.shallowRef(Xi(Se(),ke.value));let V;oe=()=>{V!==void 0&&(clearTimeout(V),V=void 0),H.value=Xi(Se(),ke.value)},t.watch([_,ke,x],()=>{V!==void 0&&clearTimeout(V),V=setTimeout(oe,ce)},{flush:"sync"}),fe=t.computed(()=>H.value)}else fe=t.computed(()=>Xi(Se(),ke.value));const le=t.computed(()=>{const H=new Map;for(const V of fe.value){if(!V.targetRef)continue;const Pe=H.get(V.targetRef);Pe?Pe.push(V):H.set(V.targetRef,[V])}return H}),ue=1500,z=new Map,P=H=>{const V=Date.now();V-(z.get(H)??0)<ue||(z.set(H,V),A(H))},F=H=>{if(!ye.value){if(!$.value){P(m("em.notice.readOnly"));return}try{i.execute(H)}catch(V){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${H.label}):`,V),$.value=!1,ye.value={label:H.label}}}},Q=H=>o.layout.entityLayouts.some(V=>V.entityRef===H&&!!V.locked),X=H=>o.layout.groupLayouts.some(V=>V.groupRef===H&&!!V.locked),_e=H=>{const V=o.logical.associations.find(Pe=>Pe.modelId===H);return!!V&&(Q(V.end1.entityRef)||Q(V.end2.entityRef))},he=H=>Q(H)?(P(m("em.notice.entityLocked")),!0):!1,we=H=>X(H)?(P(m("em.notice.groupLocked")),!0):!1,Ie=H=>_e(H)?(P(m("em.notice.assocLocked")),!0):!1,Y=vx({state:o,clipboard:ie,selection:v,inspectedEntityId:U,editable:$,run:F}),j=Ax({state:o,selection:v,focusRequest:W,run:F,gateEntityLocked:he,isEntityLockedFn:Q,isGroupLockedFn:X}),J=xx({state:o,editable:$,run:F,gateEntityLocked:he,isEntityLockedFn:Q,isAssocLockedFn:_e}),ve=Ex({state:o,editable:$,run:F,gateEntityLocked:he,embeddableCatalog:a,t:m,emitGateNotice:P,selection:v}),Te=Cx({state:o,editable:$,run:F,selection:v,gateEntityLocked:he,gateGroupLocked:we,isGroupLockedFn:X}),K=Rx({editable:$,run:F}),te=kx({state:o,editable:$,run:F,gateEntityLocked:he,gateAssocLocked:Ie});return{state:o,resolved:se,issues:fe,issuesByRef:le,flagEntitiesWithoutRelations:g,canUndo:k,canRedo:N,dirty:b,revision:_,notice:E,editable:$,schemaVersion:T,opWriteEnabled:L,opMode:R,opConflict:pe,commandFailure:ye,historyTransport:ge.historyTransport,historyAvailable:ge.historyAvailable,restoreTransport:ge.restoreTransport,restoreAvailable:ge.restoreAvailable,restoreToSeq:ge.restoreToSeq,reloadRequest:ge.reloadRequest,displayMode:B,routingMode:O,showGrid:y,showMinimap:w,selection:v,selectedAttr:M,selectedAttrIds:D,inspectedEntityId:U,focusRequest:W,clipboard:ie,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:x,uiLocale:u,t:m,selectableDataTypes:f,setEditable(H){$.value=H&&R.value},setEmbeddableCatalog(H){a.value=H},setGroupCodeCatalog(H){r.value=H},setPredefinedCustomTypeCatalog(H){l.value=H},setSuperClassCatalog(H){s.value=H},selectAttribute:j.selectAttribute,moveAttributeFocus:j.moveAttributeFocus,nudgeSelectedAttributes:j.nudgeSelectedAttributes,nudgeNodes:j.nudgeNodes,requestFocus:j.requestFocus,deleteSelection(){if(!$.value)return!1;const H=v.value;if(!H)return!1;if(H.kind==="attribute"){if(he(H.entityId))return!1;const V=H.ids;if(!V.length)return!1;V.length===1?ve.removeAttribute(H.entityId,V[0]):ve.removeAttributes(H.entityId,V)}else if(H.kind==="entity"){if(he(H.id))return!1;J.removeEntity(H.id)}else if(H.kind==="note")K.removeNote(H.id);else if(H.kind==="group"){if(we(H.id))return!1;Te.removeGroup(H.id)}else te.removeAssociation(H.id);return v.value=null,!0},undo:()=>{$.value&&i.undo()},redo:()=>{$.value&&i.redo()},markSaved:()=>{$.value&&(ge.flush(),i.markSavePoint())},loadDiagram(H,V){ge.teardownOpAdapter(),o.logical=H.logical,o.layout=H.layout,i=new tl(o),me(),T.value=(V==null?void 0:V.schemaVersion)??1,L.value=(V==null?void 0:V.opWriteEnabled)??!1,x.value=(V==null?void 0:V.referenceOnly)??!1,$.value=!(T.value>=2&&L.value===!1),pe.value=null,ye.value=null,v.value=null,k.value=i.canUndo,N.value=i.canRedo,b.value=i.isDirty,ge.setupOpAdapter(i,V),oe()},flush:ge.flush,whenOpsSettled:ge.whenOpsSettled,addEntity:J.addEntity,renameEntity:J.renameEntity,updateEntity:J.updateEntity,moveEntity:J.moveEntity,resizeEntity:J.resizeEntity,removeEntity:J.removeEntity,setEntitySwatch:J.setEntitySwatch,setEntityCollapsed:J.setEntityCollapsed,setEntityLocked:J.setEntityLocked,isEntityLocked:J.isEntityLocked,isAssociationLocked:J.isAssociationLocked,collapseAll:J.collapseAll,expandAll:J.expandAll,setAttributeSwatch:ve.setAttributeSwatch,dragGroup:Te.dragGroup,resizeGroup:Te.resizeGroup,setGroupSwatch:Te.setGroupSwatch,setGroupLocked:Te.setGroupLocked,isGroupLocked:Te.isGroupLocked,updateGroup:Te.updateGroup,createGroup:Te.createGroup,addEmptyGroup:Te.addEmptyGroup,removeGroup:Te.removeGroup,dropEntity:Te.dropEntity,ungroupEntity:Te.ungroupEntity,dropNote:Te.dropNote,addPredefinedEmbed:ve.addPredefinedEmbed,addAttribute:ve.addAttribute,addDivider:ve.addDivider,updateAttribute:ve.updateAttribute,setAttributeGroupCode:ve.setAttributeGroupCode,setEmbedColumns:ve.setEmbedColumns,removeAttribute:ve.removeAttribute,removeAttributes:ve.removeAttributes,setAttributeSwatches:ve.setAttributeSwatches,reorderAttributes:ve.reorderAttributes,addIndex(H,V){he(H)||F(hd(H,V))},updateIndex(H,V,Pe){he(H)||F(da(H,V,Pe))},removeIndex(H,V){he(H)||F(yd(H,V))},addOperation(H,V={}){if(!$.value||he(H))return null;const Pe=o.logical.entities.find(De=>De.modelId===H),Ze=Pe!=null&&Pe.operations?Rt(Pe.operations):0,Ue=V.modelId??Me(),Le={modelId:Ue,name:V.name??`method${Ze}`,visibility:V.visibility??"PACKAGE",order:Ze,...V};return F(cd(H,Le)),Ue},updateOperation(H,V,Pe){he(H)||F(dd(H,V,Pe))},removeOperation(H,V){he(H)||F(ud(H,V))},reorderOperations(H,V,Pe){!V.length||he(H)||F(md(H,V,Pe))},setOperationSwatch(H,V,Pe){F(fd(H,V,Pe))},addAssociation:te.addAssociation,addEmbedAssociation:te.addEmbedAssociation,setEmbedCardinality:te.setEmbedCardinality,removeAssociation:te.removeAssociation,setAssociationIdentifying:te.setAssociationIdentifying,updateAssociationEnd:te.updateAssociationEnd,hasQuickFix(H){if(!$.value)return!1;const V=Fr(H,o.logical);return V?V.kind==="setEndCascades"?!_e(V.assocRef):!Q(V.entityRef):!1},applyQuickFix(H){if(!$.value)return!1;const V=Fr(H,o.logical);if(!V)return!1;if(V.kind==="setIndexColumns")return he(V.entityRef)?!1:(F(da(V.entityRef,V.indexRef,{columns:V.columns})),!0);if(Ie(V.assocRef))return!1;const Pe=o.logical.associations.find(Ze=>Ze.modelId===V.assocRef);return Pe?(F(Tt(V.assocRef,V.which,{jpa:{...Pe[V.which].jpa,cascadeTypes:V.cascades}})),!0):!1},moveWaypoint(H,V,Pe){F(gd(H,V,Pe))},addWaypoint(H,V,Pe){F(Ed(H,V,Pe))},removeWaypoint(H,V){F(bd(H,V))},clearWaypoints(H){F(kd(H))},addNote:K.addNote,removeNote:K.removeNote,moveNote:K.moveNote,resizeNote:K.resizeNote,setNoteMemo:K.setNoteMemo,setNoteSwatch:K.setNoteSwatch,addNoteConnection:K.addNoteConnection,removeNoteConnection:K.removeNoteConnection,moveNoteConnectionWaypoint:K.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:K.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:K.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:K.clearNoteConnectionWaypoints,autoLayout(){const H=Rs(o.logical,o.layout);H.length&&F(We("자동 배치",H.map(V=>ko(V.id,V.location))))},copy:Y.copy,paste:Y.paste,importEntities:Y.importEntities}}const Xa=Symbol("groupHover"),Af=Symbol("groupDrag"),Vo=Symbol("relationHighlight"),$f=Symbol("diffOverlay"),Tf=Symbol("nodeInternals"),Mf=Symbol("columnResolution");function Tx(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function Vf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!Tx(e[o],n[o]))return!1;return!0}function Mx(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!Vf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function Vx(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Bx(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!Vx(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!Mx(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Vf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function Dx(){let e;return(n,o)=>e=Ox(n,o,e)}function Ox(e,n,o){const i=e.entities,a=new Map;for(const r of i){const l=new Map,s=new Map,c=new Map;let d=null;const u=()=>d??(d=so(kn(r,i)));for(const g of r.attributes){if(Oi(g)){const _=g.dbAttrs[0];if(!(_!=null&&_.physicalName&&(_!=null&&_.dataType))){const E=Li(g,r,i,e.associations);E&&l.set(g.modelId,{...g,dbAttrs:[{..._,physicalName:(_==null?void 0:_.physicalName)||E.physicalName,dataType:(_==null?void 0:_.dataType)||E.dataType,length:(_==null?void 0:_.length)??E.length,scale:(_==null?void 0:_.scale)??E.scale},...g.dbAttrs.slice(1)]})}}const k=Ar(g,e.associations);if(k&&c.set(g.modelId,k),!g.attrType.startsWith("EMBED")||g.dbAttrs.length===0)continue;if(g.attrType!=="EMBED_PREDEF"){const _=u();s.set(g.modelId,g.dbAttrs.map((E,I)=>{const A=Bn(E,_);return A?{...E,physicalName:A.physicalName}:Vn(g,E,I,r,e)}));continue}const N=n==null?void 0:n.find(_=>_.type===g.type);if(!N)continue;const b=u();s.set(g.modelId,g.dbAttrs.map((_,E)=>{const I=N.fields[E],A=Bn(_,b);return A?{..._,physicalName:A.physicalName,logicalName:_.logicalName??(I==null?void 0:I.logicalName),dataType:_.dataType||(I==null?void 0:I.dataType)||""}:I?{..._,physicalName:_.physicalName||I.physicalName,logicalName:_.logicalName??I.logicalName,dataType:_.dataType||I.dataType,length:_.length??I.length}:_}))}const m=new Map,p=new Map;for(const g of r.attributes){const k=s.get(g.modelId);if(k)for(let N=0;N<k.length;N++){const b=`${g.attrType}\0${g.type??""}\0${N}`,_={attrId:g.modelId,slot:N,name:k[N].physicalName??""},E=p.get(b);E?E.push(_):p.set(b,[_])}}for(const g of p.values()){if(g.length<2)continue;const k=new Map;for(const N of g)k.set(N.name,(k.get(N.name)??0)+1);for(const N of g){if((k.get(N.name)??0)<2)continue;const b=m.get(N.attrId);b?b.add(N.slot):m.set(N.attrId,new Set([N.slot]))}}const f={effectiveAttrs:l,embedCols:s,collectionTypes:c,redundantSlots:m},h=o==null?void 0:o.get(r.modelId);a.set(r.modelId,h&&Bx(f,h)?h:f)}return a}const Bf=Symbol("embedSlotCollapse"),Df=(e,n)=>`${e}:${n}`,Of="all:",Lf="one:",Pf=e=>`${Of}${e}`,zf=(e,n)=>`${Lf}${e}:${n}`,Lx=e=>!e.startsWith(Of)&&!e.startsWith(Lf),Px=["title"],zx={key:0,class:"em-sel","aria-hidden":"true"},Fx=["title","aria-expanded","disabled"],Ux={class:"em-entity__stereotype"},Hx={key:1,class:"em-entity__name"},jx=["title","aria-expanded"],Kx={"aria-hidden":"true"},Gx=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Yx=["onPointerdown"],qx={key:1,class:"em-entity__divider-label"},Wx=["title"],Jx={class:"em-key-slot"},Xx={class:"em-key-slot"},Zx=["title","aria-expanded","onClick"],Qx=["title","onClick"],eC=["title","aria-expanded","onClick"],tC={key:2,class:"em-entity__type"},nC=["onClick"],oC={class:"em-entity__attrname"},iC={class:"em-entity__type"},aC={key:1,class:"em-entity__embed-summary"},rC=["title"],lC=["data-op"],sC=["onPointerdown"],cC={class:"em-entity__op-vis","aria-hidden":"true"},dC=["title"],uC={key:4,class:"em-entity__footer"},Ff=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(no,null),i=(C,S)=>o?o.t(C,S):Dt("ko",C,S),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=ee.useModal();function l(){o&&qa(r,o,n.id)}const s=t.inject(Xa,null),c=t.inject(Vo,null),d=t.inject($f,null),u=t.computed(()=>{var C;return((C=d==null?void 0:d.marks.value)==null?void 0:C.get(n.id))??null}),m=t.inject(Mf,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(Bf,void 0),h=t.inject(Tf,null);t.onUpdated(()=>h==null?void 0:h.mark(n.id));const g=t.computed(()=>!!o&&o.editable.value);function k(){s&&(s.value=n.data.groupRef??null)}function N(){c==null||c.setEntityHover(n.id)}function b(){c==null||c.setEntityHover(null)}const _=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),E=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!_.value),I=t.computed(()=>{var C;return((C=o==null?void 0:o.selection.value)==null?void 0:C.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!I.value),T=t.computed(()=>{var C;return o&&((C=o.selectedAttr.value)==null?void 0:C.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),L=t.computed(()=>T.value.size>0);function x(C,S){const q=S.shiftKey?"range":S.metaKey||S.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,C.modelId,q)}const R=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!I.value),$=t.computed(()=>n.data.entity),B=t.computed(()=>Bh($.value,o==null?void 0:o.referenceOnlyDocument.value)),O=t.computed(()=>[...$.value.attributes].sort((C,S)=>C.order-S.order)),y=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>n.data.collapsed??!1),v=t.computed(()=>n.data.locked??!1),M=t.computed(()=>g.value&&!v.value);function D(){g.value&&(o==null||o.setEntityCollapsed(n.id,!w.value))}const U=t.computed(()=>y.value==="PHYSICAL"||y.value==="LOGICAL_PHYSICAL"),W=t.computed(()=>{const C=y.value==="PHYSICAL"||y.value==="LOGICAL_PHYSICAL",S={};for(const q of O.value){const re=q.attrType.startsWith("RELATION")&&q.dbAttrs.length>0;S[q.modelId]={pk:q.identifier,fk:re&&C,required:q.notNull&&!q.identifier}}return S});function ie(C){if(!C)return"";const S=[];return C.pk&&C.fk?S.push(i("em.node.keyPfk")):C.pk?S.push(i("em.node.keyPk")):C.fk&&S.push(i("em.node.keyFk")),C.required&&S.push(i("em.node.required")),S.join(" · ")}const pe=t.computed(()=>{const C=Jl(_t(n.data.style)),S={};return C&&(S["--em-header-bg"]=C.bar,S["--em-header-fg"]=C.barOn),S});function ye(C){var S,q;return(q=Jl(_t((S=n.data.attributeStyles)==null?void 0:S[C.modelId])))==null?void 0:q.text}const ge=t.computed(()=>[...$.value.operations??[]].sort((C,S)=>C.order-S.order)),me=t.computed(()=>y.value==="CLASS"&&ge.value.length>0),se={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ke(C){return C?se[C]:"~"}function Se(C){var S,q;return(q=Jl(_t((S=n.data.operationStyles)==null?void 0:S[C.modelId])))==null?void 0:q.text}function ce(C,S,q){switch(y.value){case"CLASS":return[{text:C}];case"PHYSICAL":return[{text:q||C}];case"LOGICAL":return[S?{text:S}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=S?{text:S}:{text:i("em.node.logicalMissing"),missing:!0};return q?[re,{text:` · ${q}`}]:[re]}}}function fe(C){var S;return((S=p.value)==null?void 0:S.effectiveAttrs.get(C.modelId))??C}function oe(C){var q,re,ne;if(le(C))return[{text:C.name}];const S=fe(C);return ce(C.name,(re=(q=S.dbAttrs[0])==null?void 0:q.logicalName)==null?void 0:re[a.value],((ne=S.dbAttrs[0])==null?void 0:ne.physicalName)??"")}function le(C){return C.attrType.startsWith("EMBED")&&C.dbAttrs.length>0}function ue(C){return C.attrType==="DIVIDER"}function z(C){var S;return((S=p.value)==null?void 0:S.embedCols.get(C.modelId))??C.dbAttrs}function P(C){var S;return(S=p.value)==null?void 0:S.redundantSlots.get(C.modelId)}const F=t.computed(()=>(f==null?void 0:f.isCollapsed(Pf(n.id)))??!1),Q=t.computed(()=>F.value&&U.value?O.value.reduce((C,S)=>le(S)?C+z(S).length:C,0):0),X=t.computed(()=>O.value.some(C=>le(C)));function _e(C){const S=P(C);return!S||S.size===0?!1:f?f.isCollapsed(Df(n.id,C.modelId)):!1}function he(C){var S;return _e(C)?((S=P(C))==null?void 0:S.size)??0:0}function we(C){return f?f.isCollapsed(zf(n.id,C.modelId)):!1}function Ie(C){var S;return!U.value||F.value?null:we(C)?"attr":(((S=P(C))==null?void 0:S.size)??0)>0?"slot":null}function Y(C){return!F.value&&le(C)}function j(C){return we(C)?z(C).length:0}function J(C){if(F.value||we(C))return[];const S=z(C);if(!_e(C))return S;const q=P(C);return S.filter((re,ne)=>!q.has(ne))}function ve(C){f==null||f.toggle(Df(n.id,C.modelId))}function Te(C){f==null||f.toggle(zf(n.id,C.modelId))}function K(){f==null||f.toggle(Pf(n.id))}function te(C){var S;return ce(C.physicalName,(S=C.logicalName)==null?void 0:S[a.value],C.physicalName)}function G(C){var q;const S=(q=p.value)==null?void 0:q.collectionTypes.get(C.modelId);return $r(y.value,fe(C),S)}const ae=t.computed(()=>{const C={};for(const S of O.value)C[S.modelId]=G(S);return C}),Be=t.computed(()=>{var C,S,q;return ce($.value.name,(S=(C=$.value.table)==null?void 0:C.logicalName)==null?void 0:S[a.value],((q=$.value.table)==null?void 0:q.physicalName)??"")}),Ve=t.ref(!1),H=t.ref(""),V=t.ref(null);async function Pe(){var C,S;M.value&&(H.value=$.value.name,Ve.value=!0,await t.nextTick(),(C=V.value)==null||C.focus(),(S=V.value)==null||S.select())}function Ze(){if(!Ve.value)return;Ve.value=!1;const C=H.value.trim();C&&C!==$.value.name&&(o==null||o.renameEntity(n.id,C))}function Ue(){o==null||o.addAttribute(n.id)}function Le(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:De,findNode:Z}=je(),dt=t.ref(null),yn=t.computed(()=>{const C=dt.value??n.data.size;return C?{width:`${C.width}px`,minHeight:`${C.height}px`}:void 0});let Et=null;function gn(C){var re,ne,xe;if(!M.value)return;C.stopPropagation();const S=(re=Z(n.id))==null?void 0:re.dimensions,q=De({x:C.clientX,y:C.clientY});Et={fx:q.x,fy:q.y,w:(S==null?void 0:S.width)??((ne=n.data.size)==null?void 0:ne.width)??200,h:(S==null?void 0:S.height)??((xe=n.data.size)==null?void 0:xe.height)??120},C.target.setPointerCapture(C.pointerId)}function Ee(C){if(!Et)return;const S=De({x:C.clientX,y:C.clientY});dt.value={width:Math.max(40,Et.w+(S.x-Et.fx)),height:Math.max(40,Et.h+(S.y-Et.fy))}}function at(C){var S,q,re;if(Et&&dt.value&&o){const ne=(S=Z(n.id))==null?void 0:S.dimensions;o.resizeEntity(n.id,{width:Math.round((ne==null?void 0:ne.width)??dt.value.width),height:Math.round((ne==null?void 0:ne.height)??dt.value.height)})}Et=null,dt.value=null,(re=(q=C.target).releasePointerCapture)==null||re.call(q,C.pointerId)}const zt=t.ref(null),ut=t.ref(null);function Qt(C,S){if(!M.value)return;S.stopPropagation(),S.preventDefault();const q=T.value,re=q.has(C.modelId)?new Set(q):new Set([C.modelId]);ut.value={ids:re,dropIndex:-1,lineY:0},S.target.setPointerCapture(S.pointerId)}function en(C){if(!ut.value||!zt.value)return;const S=Array.from(zt.value.querySelectorAll(".em-entity__row"));if(!S.length)return;let q=S.length;for(let xe=0;xe<S.length;xe++){const de=S[xe].getBoundingClientRect();if(C.clientY<de.top+de.height/2){q=xe;break}}const re=S[S.length-1],ne=q<S.length?S[q].offsetTop:re.offsetTop+re.offsetHeight;ut.value={...ut.value,dropIndex:q,lineY:ne}}function Ne(){const C=ut.value;if(ut.value=null,!C||C.dropIndex<0)return;const S=O.value,q=S.filter(Ce=>C.ids.has(Ce.modelId)).map(Ce=>Ce.modelId),re=S.filter((Ce,Fe)=>C.ids.has(Ce.modelId)&&Fe<C.dropIndex).length,ne=C.dropIndex-re,xe=S.filter(Ce=>!C.ids.has(Ce.modelId)).map(Ce=>Ce.modelId);[...xe.slice(0,ne),...q,...xe.slice(ne)].join(",")!==S.map(Ce=>Ce.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,q,ne))}function et(){ut.value=null}const Ft=t.ref(null),pt=t.ref(null);function nt(C,S){M.value&&(S.stopPropagation(),S.preventDefault(),pt.value={id:C.modelId,dropIndex:-1,lineY:0},S.target.setPointerCapture(S.pointerId))}function Fo(C){if(!pt.value||!Ft.value)return;const S=Array.from(Ft.value.querySelectorAll(".em-entity__op-row"));if(!S.length)return;let q=S.length;for(let xe=0;xe<S.length;xe++){const de=S[xe].getBoundingClientRect();if(C.clientY<de.top+de.height/2){q=xe;break}}const re=S[S.length-1],ne=q<S.length?S[q].offsetTop:re.offsetTop+re.offsetHeight;pt.value={...pt.value,dropIndex:q,lineY:ne}}function Uo(){const C=pt.value;if(pt.value=null,!C||C.dropIndex<0)return;const q=ge.value.findIndex(ne=>ne.modelId===C.id);if(q<0)return;const re=C.dropIndex-(q<C.dropIndex?1:0);re!==q&&(o==null||o.reorderOperations(n.id,[C.id],re))}function Ho(){pt.value=null}return(C,S)=>{var q,re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":_.value,"is-related":E.value,"is-dimmed":R.value,"is-selected":I.value,"is-multi-selected":A.value,"has-focused-attr":L.value,"is-locked":v.value,"is-reference-only":B.value,"is-diff-added":((q=u.value)==null?void 0:q.verb)==="added","is-diff-modified":((re=u.value)==null?void 0:re.verb)==="modified"}]),tabindex:"-1",title:B.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(yn.value),onPointerdown:k,onMouseenter:N,onMouseleave:b,onDblclick:l},[I.value?(t.openBlock(),t.createElementBlock("div",zx,[...S[11]||(S[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(pe.value),onDblclick:t.withModifiers(Pe,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(w.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!w.value,disabled:!g.value,onClick:t.withModifiers(D,["stop"]),onPointerdown:S[0]||(S[0]=t.withModifiers(()=>{},["stop"])),onDblclick:S[1]||(S[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(w.value?"▸":"▾"),41,Fx),t.createElementVNode("span",Ux,"«"+t.toDisplayString(t.unref(Ko)($.value.stereotype))+"»",1),Ve.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:V,"onUpdate:modelValue":S[2]||(S[2]=ne=>H.value=ne),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Ze,["enter"]),S[3]||(S[3]=t.withKeys(ne=>Ve.value=!1,["esc"]))],onBlur:Ze,onPointerdown:S[4]||(S[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,H.value]]):(t.openBlock(),t.createElementBlock("span",Hx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Be.value,(ne,xe)=>(t.openBlock(),t.createElementBlock("span",{key:xe,class:t.normalizeClass({"em-entity__missing":ne.missing})},t.toDisplayString(ne.text),3))),128))])),!w.value&&U.value&&X.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:F.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!F.value,onClick:t.withModifiers(K,["stop"]),onPointerdown:S[5]||(S[5]=t.withModifiers(()=>{},["stop"])),onDblclick:S[6]||(S[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",Kx,t.toDisplayString(F.value?"▸":"▾"),1)],40,jx)):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(Ae,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:zt,class:"em-entity__attrs"},[ut.value&&ut.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ut.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.value,ne=>{var xe,de,Ce,Fe,He,rt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ne.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":T.value.has(ne.modelId),"is-dragging":(xe=ut.value)==null?void 0:xe.ids.has(ne.modelId),"is-embed":le(ne),"is-divider":ue(ne),"has-embed-badge":!!Ie(ne),nodrag:ue(ne)&&M.value,"is-diff-changed":!!((de=u.value)!=null&&de.changedAttributeIds.has(ne.modelId))}]),"data-attr":ne.modelId,onClick:t.withModifiers(ze=>x(ne,ze),["stop"]),onPointerdown:ze=>ue(ne)?Qt(ne,ze):void 0,onPointermove:ze=>ue(ne)?en(ze):void 0,onPointerup:ze=>ue(ne)?Ne():void 0,onPointercancel:ze=>ue(ne)?et():void 0},[M.value&&!ue(ne)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ze=>Qt(ne,ze),onPointermove:en,onPointerup:Ne,onPointercancel:et,onClick:S[7]||(S[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Yx)):t.createCommentVNode("",!0),ue(ne)?(t.openBlock(),t.createElementBlock("span",qx,t.toDisplayString(ne.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Xn),{id:`l:${ne.modelId}`,type:"target",position:t.unref($e).Left,class:"em-handle",title:M.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:ie(W.value[ne.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",Jx,[(Ce=W.value[ne.modelId])!=null&&Ce.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Fe=W.value[ne.modelId])!=null&&Fe.required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",Xx,[U.value&&Y(ne)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:we(ne)?i("em.node.embedAttrShow",{count:j(ne)}):i("em.node.embedAttrHide"),"aria-expanded":!we(ne),onClick:t.withModifiers(ze=>Te(ne),["stop"]),onPointerdown:S[8]||(S[8]=t.withModifiers(()=>{},["stop"])),onDblclick:S[9]||(S[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(we(ne)?"▸":"▾"),41,Zx)):le(ne)?(t.openBlock(),t.createBlock(Ae,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(He=W.value[ne.modelId])!=null&&He.fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,Wx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:ye(ne)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe(ne),(ze,ot)=>(t.openBlock(),t.createElementBlock("span",{key:ot,class:t.normalizeClass({"em-entity__missing":ze.missing})},t.toDisplayString(ze.text),3))),128))],4),Ie(ne)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:j(ne)}),onClick:t.withModifiers(ze=>Te(ne),["stop"])},"+"+t.toDisplayString(j(ne)),9,Qx)):Ie(ne)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:_e(ne)?i("em.node.embedRepeatedShow",{count:((rt=P(ne))==null?void 0:rt.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!_e(ne),onClick:t.withModifiers(ze=>ve(ne),["stop"])},t.toDisplayString(_e(ne)?`+${he(ne)}`:"−"),9,eC)):t.createCommentVNode("",!0),ae.value[ne.modelId]?(t.openBlock(),t.createElementBlock("span",tC,t.toDisplayString(ae.value[ne.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Xn),{id:`r:${ne.modelId}`,type:"source",position:t.unref($e).Right,class:"em-handle",title:M.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,Gx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le(ne)&&U.value?J(ne):[],ze=>(t.openBlock(),t.createElementBlock("li",{key:`${ne.modelId}:${ze.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":T.value.has(ne.modelId)}]),onClick:t.withModifiers(ot=>x(ne,ot),["stop"])},[S[12]||(S[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",oC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te(ze),(ot,tt)=>(t.openBlock(),t.createElementBlock("span",{key:tt,class:t.normalizeClass({"em-entity__missing":ot.missing})},t.toDisplayString(ot.text),3))),128))]),t.createElementVNode("span",iC,t.toDisplayString(ze.dataType),1)],10,nC))),128))],64)}),128)),Q.value?(t.openBlock(),t.createElementBlock("li",aC,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(K,["stop"])},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:Q.value})),1)],8,rC)])):t.createCommentVNode("",!0)],512)),!w.value&&me.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ft,class:"em-entity__ops"},[pt.value&&pt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${pt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,ne=>{var xe,de;return t.openBlock(),t.createElementBlock("li",{key:ne.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((xe=pt.value)==null?void 0:xe.id)===ne.modelId,"is-diff-changed":!!((de=u.value)!=null&&de.changedOperationIds.has(ne.modelId))}]),"data-op":ne.modelId},[M.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ce=>nt(ne,Ce),onPointermove:Fo,onPointerup:Uo,onPointercancel:Ho,onClick:S[10]||(S[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,sC)):t.createCommentVNode("",!0),t.createElementVNode("span",cC,t.toDisplayString(ke(ne.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:Se(ne)})},t.toDisplayString(ne.name)+"()",5)],10,lC)}),128))],512)):ge.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ge.value.length})},[t.createVNode(Ae,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ge.value.length})),1)],8,dC)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("footer",uC,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Ue},t.toDisplayString(i("em.node.addAttr")),1),S[13]||(S[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Le},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),M.value&&!Ve.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:gn,onPointermove:Ee,onPointerup:at},null,32)):t.createCommentVNode("",!0)],46,Px)}}}),[["__scopeId","data-v-4dfeab79"]]),mC={key:0,class:"em-sel","aria-hidden":"true"},fC={class:"em-group__label"},pC={class:"em-group__name"},hC={key:0,class:"em-group__pkg"},yC={key:1,class:"em-group__flag"},Uf=Ke(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>_t(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(no,null),s=($,B)=>l?l.t($,B):Dt("ko",$,B),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var $;return!!n.id&&(($=l==null?void 0:l.selection.value)==null?void 0:$.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Xa,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Vo,null);function h(){n.id&&(f==null||f.setGroupHover(n.id))}function g(){f==null||f.setGroupHover(null)}const k=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),N=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:b,findNode:_}=je();let E=null,I=null;function A($){var y;if(!n.id||!c.value)return;$.stopPropagation();const B=((y=_(n.id))==null?void 0:y.dimensions)??{width:400,height:300},O=b({x:$.clientX,y:$.clientY});E={fx:O.x,fy:O.y,w:B.width,h:B.height},$.target.setPointerCapture($.pointerId)}function T($){if(!E||!n.id)return;const B=b({x:$.clientX,y:$.clientY});I={width:Math.max(160,E.w+(B.x-E.fx)),height:Math.max(120,E.h+(B.y-E.fy))};const O=_(n.id);O&&(O.style={width:`${I.width}px`,height:`${I.height}px`})}function L($){var B,O;E&&I&&n.id&&l&&l.resizeGroup(n.id,I),E=null,I=null,(O=(B=$.target).releasePointerCapture)==null||O.call(B,$.pointerId)}const x=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),R=t.computed(()=>{const $=o.value.name;return($==null?void 0:$[x.value])||($==null?void 0:$.ko)||($==null?void 0:$.en)||($==null?void 0:$.ja)||($==null?void 0:$.zh)||o.value.packageName||s("em.group.fallback")});return($,B)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":k.value,"is-dimmed":N.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:h,onMouseleave:g},[d.value?(t.openBlock(),t.createElementBlock("div",mC,[...B[0]||(B[0]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",fC,[t.createElementVNode("span",pC,t.toDisplayString(R.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",hC,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",yC,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ae,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:T,onPointerup:L},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),gC={key:0,class:"em-sel","aria-hidden":"true"},bC={key:2,class:"em-note__text"},Hf=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(no,null),i=t.inject(Xa,null),a=t.inject(Vo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>_t(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const p=t.computed(()=>{var y;return((y=a==null?void 0:a.source.value)==null?void 0:y.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),h=t.computed(()=>{var y;return((y=o==null?void 0:o.selection.value)==null?void 0:y.kind)==="note"&&o.selection.value.id===n.id}),g=t.computed(()=>!!n.selected&&!h.value),k=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!h.value),N=[{id:"n-top",pos:$e.Top},{id:"n-right",pos:$e.Right},{id:"n-bottom",pos:$e.Bottom},{id:"n-left",pos:$e.Left}],b=t.ref(!1),_=t.ref(""),E=t.ref(null);async function I(){var y;l.value&&(_.value=r.value.memo,b.value=!0,await t.nextTick(),(y=E.value)==null||y.focus())}function A(){b.value&&(b.value=!1,_.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,_.value)))}const{screenToFlowCoordinate:T,findNode:L}=je();let x=null,R=null;function $(y){var M;if(!l.value)return;y.stopPropagation();const w=((M=L(n.id))==null?void 0:M.dimensions)??r.value.geo.size,v=T({x:y.clientX,y:y.clientY});x={fx:v.x,fy:v.y,w:w.width,h:w.height},y.target.setPointerCapture(y.pointerId)}function B(y){if(!x)return;const w=T({x:y.clientX,y:y.clientY});R={width:Math.max(140,x.w+(w.x-x.fx)),height:Math.max(60,x.h+(w.y-x.fy))};const v=L(n.id);v&&(v.style={width:`${R.width}px`,height:`${R.height}px`})}function O(y){var w,v;x&&R&&o&&o.resizeNote(n.id,R),x=null,R=null,(v=(w=y.target).releasePointerCapture)==null||v.call(w,y.pointerId)}return(y,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":k.value,"is-selected":h.value,"is-multi-selected":g.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:I,onPointerdown:d,onMouseenter:u,onMouseleave:m},[h.value?(t.openBlock(),t.createElementBlock("div",gC,[...w[4]||(w[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),b.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:E,"onUpdate:modelValue":w[0]||(w[0]=v=>_.value=v),class:"em-note__edit nodrag",onBlur:A,onKeydown:w[1]||(w[1]=t.withKeys(v=>b.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,_.value]]):(t.openBlock(),t.createElementBlock("div",bC,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(N,v=>t.createVNode(t.unref(Xn),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!b.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:$,onPointermove:B,onPointerup:O},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Za(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const Bo=.5;function jf(e,n,o,i,a,r){const l=Za(n),s=Za(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let p=e;const f=(k,N)=>{(Math.abs(k.x-p.x)>=Bo||Math.abs(k.y-p.y)>=Bo)&&(m.push({a:p,b:k,seg:N}),p=k)};f(c,0);let h=l.x!==0,g=c;for(let k=1;k<u.length;k++){const N=u[k],b=k<=o.length?k-1:o.length,_=Math.abs(N.x-g.x)<Bo,E=Math.abs(N.y-g.y)<Bo;_&&E||(_?(f(N,b),h=!1):E?(f(N,b),h=!0):h?(f({x:g.x,y:N.y},b),f(N,b),h=!0):(f({x:N.x,y:g.y},b),f(N,b),h=!1),g=N)}return f(i,o.length),m}function Kf(e,n,o,i,a,r=20){const l=jf(e,n,o,i,a,r);let s=`M ${kt(e.x)},${kt(e.y)}`;for(const c of l)s+=` L ${kt(c.b.x)},${kt(c.b.y)}`;return s}const _C=14;function Gf(e,n,o,i,a,r=20){return jf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=_C).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function kt(e){return Math.round(e*100)/100}const kC=36;function EC(e,n,o=kC){const i=Math.max(e.x,n.x)+o;return`M ${kt(e.x)},${kt(e.y)} L ${kt(i)},${kt(e.y)} L ${kt(i)},${kt(n.y)} L ${kt(n.x)},${kt(n.y)}`}function Yf(e,n,o){const i=[e,...n,o];let a=`M ${kt(i[0].x)},${kt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${kt(i[r].x)},${kt(i[r].y)}`;return a}function NC(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function qf(e,n){const o=NC(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Bo&&Math.abs(l)<Bo)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function Wf(e,n,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:n},side:i?"right":"left"}}function Jf(e,n,o){const i=[e,...n,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const wC=20,IC=22,vC=7,xC=22,Xf=31,Zf=7,CC=20,Qf=11,ep=11,SC=Xf+Zf;function RC(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function AC(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Qa(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function tp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function er(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function np(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:tp(e,n);return[er(o,a,r-Math.PI/2),er(o,a,r+Math.PI/2)]}function op(e,n,o,i){const a=n*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function ip(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Qa(e,n,wC),[d,u]=np(e,n,c,IC);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),RC(o.multiplicity)){const m=Qa(e,n,Xf);r.push({cx:m.x,cy:m.y,r:Zf})}if(AC(o.multiplicity)){const m=Qa(e,n,vC),[p,f]=np(e,n,m,xC);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Qa(e,n,CC),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=tp(e,n),m=er(d,Qf/2,u-Math.PI/2),p=er(d,Qf/2,u+Math.PI/2);l.push({points:[e,m,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=op(s,c,ep,!0),u=op(s,c,ep,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:r,polygons:l}}const ap=200,rp=120,ts=24;function lp(e){var a,r;if(!e)return{x:0,y:0,width:ap,height:rp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||ap,i=((r=e.dimensions)==null?void 0:r.height)||rp;return{x:n.x,y:n.y,width:o,height:i}}function sp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function cp(e){const n=t.computed(()=>lp(e.sourceNode())),o=t.computed(()=>lp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,h;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<ts){const g=(m+p)/2;m=g-ts/2,p=g+ts/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??sp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??sp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Wf(n.value,d,r.value.x):qf(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Wf(o.value,d,l.value.x):qf(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const ns=Symbol("waypointController"),$C=["d"],TC=["d"],MC=["d"],VC=["x1","y1","x2","y2"],BC=["cx","cy","r"],DC=["x","y"],OC=["x","y"],LC=["cx","cy","onDblclick"],PC=["x","y","onPointerdown","onDblclick"],dp=Ke(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(ns),a=t.inject(no,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Af,null),s=t.inject(Vo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var oe;return((oe=a==null?void 0:a.selection.value)==null?void 0:oe.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const oe=l==null?void 0:l.value;if(!oe||!a)return null;const le=a.resolved.value.entities,ue=P=>{var F;return(F=le.find(Q=>Q.entity.modelId===P))==null?void 0:F.groupRef},z=n.data.association;return ue(z.end1.entityRef)===oe.groupId&&ue(z.end2.entityRef)===oe.groupId?{dx:oe.dx,dy:oe.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),h=t.ref({x:0,y:0}),g=t.computed(()=>{const oe=m.value;return p.value.map((le,ue)=>ue===f.value?h.value:oe?{x:le.x+oe.dx,y:le.y+oe.dy}:le)}),k=t.computed(()=>{var oe;return!!((oe=n.sourceNode.data)!=null&&oe.collapsed)}),N=t.computed(()=>{var oe;return!!((oe=n.targetNode.data)!=null&&oe.collapsed)}),{source:b,target:_,sourceSide:E,targetSide:I,isSelf:A}=cp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>g.value,sourceRowY:()=>n.data.sourceColumnRef&&!k.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!N.value?n.targetY:void 0}),T=SC+4,L=t.computed(()=>A.value?EC(b.value,_.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Kf(b.value,E.value,g.value,_.value,I.value,T):Yf(b.value,g.value,_.value)),x=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Gf(b.value,E.value,g.value,_.value,I.value,T):Jf(b.value,g.value,_.value).map((oe,le)=>({point:oe,segIndex:le}))),R=t.computed(()=>A.value||!r.value?[]:g.value),$=Hi;function B(oe,le){f.value=oe,h.value={...p.value[oe]},le.target.setPointerCapture(le.pointerId),le.stopPropagation()}function O(oe){if(f.value<0)return;const le=o({x:oe.clientX,y:oe.clientY});h.value={x:le.x,y:le.y}}function y(oe){var le,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...h.value}),f.value=-1,(ue=(le=oe.target).releasePointerCapture)==null||ue.call(le,oe.pointerId)}function w(oe,le){le.stopPropagation(),i==null||i.removePoint(n.id,oe)}function v(oe,le){if(!i)return;const ue=o({x:le.clientX,y:le.clientY});i.insertPoint(n.id,oe,{x:ue.x,y:ue.y})}const M=t.computed(()=>$(n.data.association.end1.multiplicity)),D=t.computed(()=>$(n.data.association.end2.multiplicity)),U=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),W=t.computed(()=>U.value==="class"),ie=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const oe=Za(E.value);return{x:b.value.x+oe.x*10,y:b.value.y+oe.y*10}}return g.value[0]??_.value}),pe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const le=Za(I.value);return{x:_.value.x+le.x*10,y:_.value.y+le.y*10}}const oe=g.value;return oe[oe.length-1]??b.value}),ye=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end1.multiplicity,navigable:oe.end1.navigable,composition:oe.end1.composition,otherNavigable:oe.end2.navigable}}),ge=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end2.multiplicity,navigable:oe.end2.navigable,composition:oe.end2.composition,otherNavigable:oe.end1.navigable}}),me=t.computed(()=>ip(b.value,ie.value,ye.value,U.value)),se=t.computed(()=>ip(_.value,pe.value,ge.value,U.value)),ke=t.computed(()=>[...me.value.lines,...se.value.lines]),Se=t.computed(()=>[...me.value.circles,...se.value.circles]),ce=t.computed(()=>[...me.value.polygons,...se.value.polygons].map(oe=>`M${oe.points.map(le=>`${le.x},${le.y}`).join(" L")} Z`)),fe=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(oe,le)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:L.value,fill:"none",class:"em-edge__hit"},null,8,$C),t.createElementVNode("path",{d:L.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,TC),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,(ue,z)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${z}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",fe.value])},null,10,MC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ke.value,(ue,z)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${z}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,VC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${z}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,BC))),128)),W.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(b).x+8,y:t.unref(b).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(M.value),11,DC),t.createElementVNode("text",{x:t.unref(_).x-8,y:t.unref(_).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(D.value),11,OC)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${z}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(P=>v(ue.segIndex,P),["stop"])},null,42,LC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.value,(ue,z)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${z}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:P=>B(z,P),onPointermove:O,onPointerup:y,onDblclick:P=>w(z,P)},null,42,PC))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var mn=(e=>(e.Lines="lines",e.Dots="dots",e))(mn||{});const up=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},mp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};mn.Lines+"",mn.Dots+"";const zC={[mn.Dots]:"#81818a",[mn.Lines]:"#eee"},FC=["id","x","y","width","height","patternTransform"],UC={key:2,height:"100",width:"100"},HC=["fill"],jC=["x","y","fill"],KC={name:"Background",compatConfig:{MODE:3}},GC=t.defineComponent({...KC,props:{id:{},variant:{default:()=>mn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=je(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||zC[e.variant||mn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(mn).Lines?(t.openBlock(),t.createBlock(t.unref(up),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(mn).Dots?(t.openBlock(),t.createBlock(t.unref(mp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",UC,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,HC)])):t.createCommentVNode("",!0)])],8,FC)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,jC),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),YC={name:"ControlButton",compatConfig:{MODE:3}},qC=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},WC={type:"button",class:"vue-flow__controls-button"};function JC(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",WC,[t.renderSlot(e.$slots,"default")])}const oo=qC(YC,[["render",JC]]),XC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ZC=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function QC(e,n){return t.openBlock(),t.createElementBlock("svg",XC,ZC)}const eS={render:QC},tS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},nS=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function oS(e,n){return t.openBlock(),t.createElementBlock("svg",tS,nS)}const iS={render:oS},aS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},rS=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function lS(e,n){return t.openBlock(),t.createElementBlock("svg",aS,rS)}const sS={render:lS},cS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function uS(e,n){return t.openBlock(),t.createElementBlock("svg",cS,dS)}const mS={render:uS},fS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function hS(e,n){return t.openBlock(),t.createElementBlock("svg",fS,pS)}const yS={render:hS},gS={name:"Controls",compatConfig:{MODE:3}},bS=t.defineComponent({...gS,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>um.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=je(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),h=t.toRef(()=>d.value.zoom>=m.value);function g(){l(),n("zoomIn")}function k(){s(),n("zoomOut")}function N(){c(e.fitViewParams),n("fitView")}function b(){r(!p.value),n("interactionChange",!p.value)}return(_,E)=>(t.openBlock(),t.createBlock(t.unref(df),{class:"vue-flow__controls",position:_.position},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"top"),_.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(_.$slots,"control-zoom-in",{},()=>[t.createVNode(oo,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(eS))))])]),_:3},8,["disabled"])]),t.renderSlot(_.$slots,"control-zoom-out",{},()=>[t.createVNode(oo,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:k},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(iS))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),_.showFitView?t.renderSlot(_.$slots,"control-fit-view",{key:1},()=>[t.createVNode(oo,{class:"vue-flow__controls-fitview",onClick:N},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(sS))))])]),_:3})]):t.createCommentVNode("",!0),_.showInteractive?t.renderSlot(_.$slots,"control-interactive",{key:2},()=>[_.showInteractive?(t.openBlock(),t.createBlock(oo,{key:0,class:"vue-flow__controls-interactive",onClick:b},{default:t.withCtx(()=>[p.value?t.renderSlot(_.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(yS))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(_.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(mS))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(_.$slots,"default")]),_:3},8,["position"]))}});var _S={value:()=>{}};function os(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new tr(o)}function tr(e){this._=e}function kS(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}tr.prototype=os.prototype={constructor:tr,on:function(e,n){var o=this._,i=kS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=ES(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=fp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=fp(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new tr(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function ES(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function fp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=_S,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var is="http://www.w3.org/1999/xhtml";const pp={svg:"http://www.w3.org/2000/svg",xhtml:is,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),pp.hasOwnProperty(n)?{space:pp[n],local:e}:e}function NS(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===is&&n.documentElement.namespaceURI===is?n.createElement(e):n.createElementNS(o,e)}}function wS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hp(e){var n=nr(e);return(n.local?wS:NS)(n)}function IS(){}function as(e){return e==null?IS:function(){return this.querySelector(e)}}function vS(e){typeof e!="function"&&(e=as(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new St(i,this._parents)}function xS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function CS(){return[]}function yp(e){return e==null?CS:function(){return this.querySelectorAll(e)}}function SS(e){return function(){return xS(e.apply(this,arguments))}}function RS(e){typeof e=="function"?e=SS(e):e=yp(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new St(i,a)}function gp(e){return function(){return this.matches(e)}}function bp(e){return function(n){return n.matches(e)}}var AS=Array.prototype.find;function $S(e){return function(){return AS.call(this.children,e)}}function TS(){return this.firstElementChild}function MS(e){return this.select(e==null?TS:$S(typeof e=="function"?e:bp(e)))}var VS=Array.prototype.filter;function BS(){return Array.from(this.children)}function DS(e){return function(){return VS.call(this.children,e)}}function OS(e){return this.selectAll(e==null?BS:DS(typeof e=="function"?e:bp(e)))}function LS(e){typeof e!="function"&&(e=gp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new St(i,this._parents)}function _p(e){return new Array(e.length)}function PS(){return new St(this._enter||this._groups.map(_p),this._parents)}function or(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}or.prototype={constructor:or,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function zS(e){return function(){return e}}function FS(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new or(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function US(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new or(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function HS(e){return e.__data__}function jS(e,n){if(!arguments.length)return Array.from(this,HS);var o=n?US:FS,i=this._parents,a=this._groups;typeof e!="function"&&(e=zS(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=KS(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),k=l[d]=new Array(h),N=c[d]=new Array(p);o(u,m,g,k,N,f,n);for(var b=0,_=0,E,I;b<h;++b)if(E=g[b]){for(b>=_&&(_=b+1);!(I=k[_])&&++_<h;);E._next=I||null}}return l=new St(l,i),l._enter=s,l._exit=c,l}function KS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function GS(){return new St(this._exit||this._groups.map(_p),this._parents)}function YS(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function qS(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new St(s,this._parents)}function WS(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function JS(e){e||(e=XS);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new St(a,this._parents).order()}function XS(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function ZS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function QS(){return Array.from(this)}function eR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function tR(){let e=0;for(const n of this)++e;return e}function nR(){return!this.node()}function oR(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function iR(e){return function(){this.removeAttribute(e)}}function aR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rR(e,n){return function(){this.setAttribute(e,n)}}function lR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function sR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function cR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function dR(e,n){var o=nr(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?aR:iR:typeof n=="function"?o.local?cR:sR:o.local?lR:rR)(o,n))}function kp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function uR(e){return function(){this.style.removeProperty(e)}}function mR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function fR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function pR(e,n,o){return arguments.length>1?this.each((n==null?uR:typeof n=="function"?fR:mR)(e,n,o??"")):Do(this.node(),e)}function Do(e,n){return e.style.getPropertyValue(n)||kp(e).getComputedStyle(e,null).getPropertyValue(n)}function hR(e){return function(){delete this[e]}}function yR(e,n){return function(){this[e]=n}}function gR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function bR(e,n){return arguments.length>1?this.each((n==null?hR:typeof n=="function"?gR:yR)(e,n)):this.node()[e]}function Ep(e){return e.trim().split(/^|\s+/)}function rs(e){return e.classList||new Np(e)}function Np(e){this._node=e,this._names=Ep(e.getAttribute("class")||"")}Np.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function wp(e,n){for(var o=rs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Ip(e,n){for(var o=rs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function _R(e){return function(){wp(this,e)}}function kR(e){return function(){Ip(this,e)}}function ER(e,n){return function(){(n.apply(this,arguments)?wp:Ip)(this,e)}}function NR(e,n){var o=Ep(e+"");if(arguments.length<2){for(var i=rs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?ER:n?_R:kR)(o,n))}function wR(){this.textContent=""}function IR(e){return function(){this.textContent=e}}function vR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function xR(e){return arguments.length?this.each(e==null?wR:(typeof e=="function"?vR:IR)(e)):this.node().textContent}function CR(){this.innerHTML=""}function SR(e){return function(){this.innerHTML=e}}function RR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function AR(e){return arguments.length?this.each(e==null?CR:(typeof e=="function"?RR:SR)(e)):this.node().innerHTML}function $R(){this.nextSibling&&this.parentNode.appendChild(this)}function TR(){return this.each($R)}function MR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function VR(){return this.each(MR)}function BR(e){var n=typeof e=="function"?e:hp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function DR(){return null}function OR(e,n){var o=typeof e=="function"?e:hp(e),i=n==null?DR:typeof n=="function"?n:as(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function LR(){var e=this.parentNode;e&&e.removeChild(this)}function PR(){return this.each(LR)}function zR(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function FR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function UR(e){return this.select(e?FR:zR)}function HR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function jR(e){return function(n){e.call(this,n,this.__data__)}}function KR(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function GR(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function YR(e,n,o){return function(){var i=this.__on,a,r=jR(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function qR(e,n,o){var i=KR(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?YR:GR,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function vp(e,n,o){var i=kp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function WR(e,n){return function(){return vp(this,e,n)}}function JR(e,n){return function(){return vp(this,e,n.apply(this,arguments))}}function XR(e,n){return this.each((typeof n=="function"?JR:WR)(e,n))}function*ZR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var xp=[null];function St(e,n){this._groups=e,this._parents=n}function wi(){return new St([[document.documentElement]],xp)}function QR(){return this}St.prototype=wi.prototype={constructor:St,select:vS,selectAll:RS,selectChild:MS,selectChildren:OS,filter:LS,data:jS,enter:PS,exit:GS,join:YS,merge:qS,selection:QR,order:WS,sort:JS,call:ZS,nodes:QS,node:eR,size:tR,empty:nR,each:oR,attr:dR,style:pR,property:bR,classed:NR,text:xR,html:AR,raise:TR,lower:VR,append:BR,insert:OR,remove:PR,clone:UR,datum:HR,on:qR,dispatch:XR,[Symbol.iterator]:ZR};function Rn(e){return typeof e=="string"?new St([[document.querySelector(e)]],[document.documentElement]):new St([[e]],xp)}function eA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function An(e,n){if(e=eA(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const ls={capture:!0,passive:!1};function ss(e){e.preventDefault(),e.stopImmediatePropagation()}function tA(e){var n=e.document.documentElement,o=Rn(e).on("dragstart.drag",ss,ls);"onselectstart"in n?o.on("selectstart.drag",ss,ls):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function nA(e,n){var o=e.document.documentElement,i=Rn(e).on("dragstart.drag",null);n&&(i.on("click.drag",ss,ls),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function cs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Cp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Ii(){}var vi=.7,ir=1/vi,Oo="\\s*([+-]?\\d+)\\s*",xi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oA=/^#([0-9a-f]{3,8})$/,iA=new RegExp(`^rgb\\(${Oo},${Oo},${Oo}\\)$`),aA=new RegExp(`^rgb\\(${Xt},${Xt},${Xt}\\)$`),rA=new RegExp(`^rgba\\(${Oo},${Oo},${Oo},${xi}\\)$`),lA=new RegExp(`^rgba\\(${Xt},${Xt},${Xt},${xi}\\)$`),sA=new RegExp(`^hsl\\(${xi},${Xt},${Xt}\\)$`),cA=new RegExp(`^hsla\\(${xi},${Xt},${Xt},${xi}\\)$`),Sp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};cs(Ii,Ci,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Rp,formatHex:Rp,formatHex8:dA,formatHsl:uA,formatRgb:Ap,toString:Ap});function Rp(){return this.rgb().formatHex()}function dA(){return this.rgb().formatHex8()}function uA(){return Bp(this).formatHsl()}function Ap(){return this.rgb().formatRgb()}function Ci(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=oA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?$p(n):o===3?new It(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ar(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ar(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=iA.exec(e))?new It(n[1],n[2],n[3],1):(n=aA.exec(e))?new It(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=rA.exec(e))?ar(n[1],n[2],n[3],n[4]):(n=lA.exec(e))?ar(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=sA.exec(e))?Vp(n[1],n[2]/100,n[3]/100,1):(n=cA.exec(e))?Vp(n[1],n[2]/100,n[3]/100,n[4]):Sp.hasOwnProperty(e)?$p(Sp[e]):e==="transparent"?new It(NaN,NaN,NaN,0):null}function $p(e){return new It(e>>16&255,e>>8&255,e&255,1)}function ar(e,n,o,i){return i<=0&&(e=n=o=NaN),new It(e,n,o,i)}function mA(e){return e instanceof Ii||(e=Ci(e)),e?(e=e.rgb(),new It(e.r,e.g,e.b,e.opacity)):new It}function ds(e,n,o,i){return arguments.length===1?mA(e):new It(e,n,o,i??1)}function It(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}cs(It,ds,Cp(Ii,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vi:Math.pow(vi,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new It(io(this.r),io(this.g),io(this.b),rr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Tp,formatHex:Tp,formatHex8:fA,formatRgb:Mp,toString:Mp}));function Tp(){return`#${ao(this.r)}${ao(this.g)}${ao(this.b)}`}function fA(){return`#${ao(this.r)}${ao(this.g)}${ao(this.b)}${ao((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mp(){const e=rr(this.opacity);return`${e===1?"rgb(":"rgba("}${io(this.r)}, ${io(this.g)}, ${io(this.b)}${e===1?")":`, ${e})`}`}function rr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function io(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ao(e){return e=io(e),(e<16?"0":"")+e.toString(16)}function Vp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Lt(e,n,o,i)}function Bp(e){if(e instanceof Lt)return new Lt(e.h,e.s,e.l,e.opacity);if(e instanceof Ii||(e=Ci(e)),!e)return new Lt;if(e instanceof Lt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Lt(l,s,c,e.opacity)}function pA(e,n,o,i){return arguments.length===1?Bp(e):new Lt(e,n,o,i??1)}function Lt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}cs(Lt,pA,Cp(Ii,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new Lt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vi:Math.pow(vi,e),new Lt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new It(us(e>=240?e-240:e+120,a,i),us(e,a,i),us(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Lt(Dp(this.h),lr(this.s),lr(this.l),rr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=rr(this.opacity);return`${e===1?"hsl(":"hsla("}${Dp(this.h)}, ${lr(this.s)*100}%, ${lr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dp(e){return e=(e||0)%360,e<0?e+360:e}function lr(e){return Math.max(0,Math.min(1,e||0))}function us(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Op=e=>()=>e;function hA(e,n){return function(o){return e+o*n}}function yA(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function gA(e){return(e=+e)==1?Lp:function(n,o){return o-n?yA(n,o,e):Op(isNaN(n)?o:n)}}function Lp(e,n){var o=n-e;return o?hA(e,o):Op(isNaN(e)?n:e)}const Pp=(function e(n){var o=gA(n);function i(a,r){var l=o((a=ds(a)).r,(r=ds(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Lp(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function $n(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var ms=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fs=new RegExp(ms.source,"g");function bA(e){return function(){return e}}function _A(e){return function(n){return e(n)+""}}function kA(e,n){var o=ms.lastIndex=fs.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=ms.exec(e))&&(a=fs.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:$n(i,a)})),o=fs.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?_A(c[0].x):bA(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var zp=180/Math.PI,ps={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fp(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*zp,skewX:Math.atan(c)*zp,scaleX:l,scaleY:s}}var sr;function EA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?ps:Fp(n.a,n.b,n.c,n.d,n.e,n.f)}function NA(e){return e==null||(sr||(sr=document.createElementNS("http://www.w3.org/2000/svg","g")),sr.setAttribute("transform",e),!(e=sr.transform.baseVal.consolidate()))?ps:(e=e.matrix,Fp(e.a,e.b,e.c,e.d,e.e,e.f))}function Up(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:$n(d,m)},{i:g-2,x:$n(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:$n(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:$n(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:$n(d,m)},{i:g-2,x:$n(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,k;++h<g;)m[(k=p[h]).i]=k.x(f);return m.join("")}}}var wA=Up(EA,"px, ","px)","deg)"),IA=Up(NA,", ",")",")"),vA=1e-12;function Hp(e){return((e=Math.exp(e))+1/e)/2}function xA(e){return((e=Math.exp(e))-1/e)/2}function CA(e){return((e=Math.exp(2*e))-1)/(e+1)}const SA=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,k,N;if(g<vA)N=Math.log(p/d)/n,k=function(T){return[s+T*f,c+T*h,d*Math.exp(n*T*N)]};else{var b=Math.sqrt(g),_=(p*p-d*d+i*g)/(2*d*o*b),E=(p*p-d*d-i*g)/(2*p*o*b),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(E*E+1)-E);N=(A-I)/n,k=function(T){var L=T*N,x=Hp(I),R=d/(o*b)*(x*CA(n*L+I)-xA(I));return[s+R*f,c+R*h,d*x/Hp(n*L+I)]}}return k.duration=N*1e3*n/Math.SQRT2,k}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Lo=0,Si=0,Ri=0,jp=1e3,cr,Ai,dr=0,ro=0,ur=0,$i=typeof performance=="object"&&performance.now?performance:Date,Kp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function hs(){return ro||(Kp(RA),ro=$i.now()+ur)}function RA(){ro=0}function mr(){this._call=this._time=this._next=null}mr.prototype=Gp.prototype={constructor:mr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?hs():+o)+(n==null?0:+n),!this._next&&Ai!==this&&(Ai?Ai._next=this:cr=this,Ai=this),this._call=e,this._time=o,ys()},stop:function(){this._call&&(this._call=null,this._time=1/0,ys())}};function Gp(e,n,o){var i=new mr;return i.restart(e,n,o),i}function AA(){hs(),++Lo;for(var e=cr,n;e;)(n=ro-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Lo}function Yp(){ro=(dr=$i.now())+ur,Lo=Si=0;try{AA()}finally{Lo=0,TA(),ro=0}}function $A(){var e=$i.now(),n=e-dr;n>jp&&(ur-=n,dr=e)}function TA(){for(var e,n=cr,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:cr=o);Ai=e,ys(i)}function ys(e){if(!Lo){Si&&(Si=clearTimeout(Si));var n=e-ro;n>24?(e<1/0&&(Si=setTimeout(Yp,e-$i.now()-ur)),Ri&&(Ri=clearInterval(Ri))):(Ri||(dr=$i.now(),Ri=setInterval($A,jp)),Lo=1,Kp(Yp))}}function qp(e,n,o){var i=new mr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var MA=os("start","end","cancel","interrupt"),VA=[],Wp=0,Jp=1,gs=2,fr=3,Xp=4,bs=5,pr=6;function hr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;BA(e,o,{name:n,index:i,group:a,on:MA,tween:VA,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Wp})}function _s(e,n){var o=Pt(e,n);if(o.state>Wp)throw new Error("too late; already scheduled");return o}function Zt(e,n){var o=Pt(e,n);if(o.state>fr)throw new Error("too late; already running");return o}function Pt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function BA(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Gp(r,0,o.time);function r(d){o.state=Jp,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==Jp)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===fr)return qp(l);f.state===Xp?(f.state=pr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=pr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(qp(function(){o.state===fr&&(o.state=Xp,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=gs,o.on.call("start",e,e.__data__,o.index,o.group),o.state===gs){for(o.state=fr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=bs,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===bs&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=pr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function yr(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>gs&&i.state<bs,i.state=pr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function DA(e){return this.each(function(){yr(this,e)})}function OA(e,n){var o,i;return function(){var a=Zt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function LA(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Zt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function PA(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Pt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?OA:LA)(o,e,n))}function ks(e,n,o){var i=e._id;return e.each(function(){var a=Zt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Pt(a,i).value[n]}}function Zp(e,n){var o;return(typeof n=="number"?$n:n instanceof Ci?Pp:(o=Ci(n))?(n=o,Pp):kA)(e,n)}function zA(e){return function(){this.removeAttribute(e)}}function FA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function UA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function HA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function jA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function KA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function GA(e,n){var o=nr(e),i=o==="transform"?IA:Zp;return this.attrTween(e,typeof n=="function"?(o.local?KA:jA)(o,i,ks(this,"attr."+e,n)):n==null?(o.local?FA:zA)(o):(o.local?HA:UA)(o,i,n))}function YA(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function qA(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function WA(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&qA(e,r)),o}return a._value=n,a}function JA(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&YA(e,r)),o}return a._value=n,a}function XA(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=nr(e);return this.tween(o,(i.local?WA:JA)(i,n))}function ZA(e,n){return function(){_s(this,e).delay=+n.apply(this,arguments)}}function QA(e,n){return n=+n,function(){_s(this,e).delay=n}}function e$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?ZA:QA)(n,e)):Pt(this.node(),n).delay}function t$(e,n){return function(){Zt(this,e).duration=+n.apply(this,arguments)}}function n$(e,n){return n=+n,function(){Zt(this,e).duration=n}}function o$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?t$:n$)(n,e)):Pt(this.node(),n).duration}function i$(e,n){if(typeof n!="function")throw new Error;return function(){Zt(this,e).ease=n}}function a$(e){var n=this._id;return arguments.length?this.each(i$(n,e)):Pt(this.node(),n).ease}function r$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Zt(this,e).ease=o}}function l$(e){if(typeof e!="function")throw new Error;return this.each(r$(this._id,e))}function s$(e){typeof e!="function"&&(e=gp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new fn(i,this._parents,this._name,this._id)}function c$(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new fn(l,this._parents,this._name,this._id)}function d$(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function u$(e,n,o){var i,a,r=d$(n)?_s:Zt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function m$(e,n){var o=this._id;return arguments.length<2?Pt(this.node(),o).on.on(e):this.each(u$(o,e,n))}function f$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function p$(){return this.on("end.remove",f$(this._id))}function h$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=as(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,hr(d[p],n,o,p,d,Pt(u,o)));return new fn(r,this._parents,n,o)}function y$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=yp(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=Pt(u,o),g=0,k=p.length;g<k;++g)(f=p[g])&&hr(f,n,o,g,p,h);r.push(p),l.push(u)}return new fn(r,l,n,o)}var g$=wi.prototype.constructor;function b$(){return new g$(this._groups,this._parents)}function _$(e,n){var o,i,a;return function(){var r=Do(this,e),l=(this.style.removeProperty(e),Do(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Qp(e){return function(){this.style.removeProperty(e)}}function k$(e,n,o){var i,a=o+"",r;return function(){var l=Do(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function E$(e,n,o){var i,a,r;return function(){var l=Do(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Do(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function N$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Zt(this,e),d=c.on,u=c.value[r]==null?s||(s=Qp(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function w$(e,n,o){var i=(e+="")=="transform"?wA:Zp;return n==null?this.styleTween(e,_$(e,i)).on("end.style."+e,Qp(e)):typeof n=="function"?this.styleTween(e,E$(e,i,ks(this,"style."+e,n))).each(N$(this._id,e)):this.styleTween(e,k$(e,i,n),o).on("end.style."+e,null)}function I$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function v$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&I$(e,l,o)),i}return r._value=n,r}function x$(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,v$(e,n,o??""))}function C$(e){return function(){this.textContent=e}}function S$(e){return function(){var n=e(this);this.textContent=n??""}}function R$(e){return this.tween("text",typeof e=="function"?S$(ks(this,"text",e)):C$(e==null?"":e+""))}function A$(e){return function(n){this.textContent=e.call(this,n)}}function $$(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&A$(a)),n}return i._value=e,i}function T$(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,$$(e))}function M$(){for(var e=this._name,n=this._id,o=eh(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Pt(c,n);hr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new fn(i,this._parents,e,o)}function V$(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Zt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var B$=0;function fn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function eh(){return++B$}var pn=wi.prototype;fn.prototype={constructor:fn,select:h$,selectAll:y$,selectChild:pn.selectChild,selectChildren:pn.selectChildren,filter:s$,merge:c$,selection:b$,transition:M$,call:pn.call,nodes:pn.nodes,node:pn.node,size:pn.size,empty:pn.empty,each:pn.each,on:m$,attr:GA,attrTween:XA,style:w$,styleTween:x$,text:R$,textTween:T$,remove:p$,tween:PA,delay:e$,duration:o$,ease:a$,easeVarying:l$,end:V$,[Symbol.iterator]:pn[Symbol.iterator]};function D$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var O$={time:null,delay:0,duration:250,ease:D$};function L$(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function P$(e){var n,o;e instanceof fn?(n=e._id,e=e._name):(n=eh(),(o=O$).time=hs(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&hr(c,e,n,d,l,o||L$(c,n));return new fn(i,this._parents,e,n)}wi.prototype.interrupt=DA,wi.prototype.transition=P$;const gr=e=>()=>e;function z$(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function hn(e,n,o){this.k=e,this.x=n,this.y=o}hn.prototype={constructor:hn,scale:function(e){return e===1?this:new hn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new hn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Es=new hn(1,0,0);hn.prototype;function Ns(e){e.stopImmediatePropagation()}function Ti(e){e.preventDefault(),e.stopImmediatePropagation()}function F$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function U$(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function th(){return this.__zoom||Es}function H$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function j$(){return navigator.maxTouchPoints||"ontouchstart"in this}function K$(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function G$(){var e=F$,n=U$,o=K$,i=H$,a=j$,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=SA,d=os("start","zoom","end"),u,m,p,f=500,h=150,g=0,k=10;function N(y){y.property("__zoom",th).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(y,w,v,M){var D=y.selection?y.selection():y;D.property("__zoom",th),y!==D?I(y,w,v,M):D.interrupt().each(function(){A(this,arguments).event(M).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},N.scaleBy=function(y,w,v,M){N.scaleTo(y,function(){var D=this.__zoom.k,U=typeof w=="function"?w.apply(this,arguments):w;return D*U},v,M)},N.scaleTo=function(y,w,v,M){N.transform(y,function(){var D=n.apply(this,arguments),U=this.__zoom,W=v==null?E(D):typeof v=="function"?v.apply(this,arguments):v,ie=U.invert(W),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(b(U,pe),W,ie),D,l)},v,M)},N.translateBy=function(y,w,v,M){N.transform(y,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,M)},N.translateTo=function(y,w,v,M,D){N.transform(y,function(){var U=n.apply(this,arguments),W=this.__zoom,ie=M==null?E(U):typeof M=="function"?M.apply(this,arguments):M;return o(Es.translate(ie[0],ie[1]).scale(W.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),U,l)},M,D)};function b(y,w){return w=Math.max(r[0],Math.min(r[1],w)),w===y.k?y:new hn(w,y.x,y.y)}function _(y,w,v){var M=w[0]-v[0]*y.k,D=w[1]-v[1]*y.k;return M===y.x&&D===y.y?y:new hn(y.k,M,D)}function E(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function I(y,w,v,M){y.on("start.zoom",function(){A(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,U=arguments,W=A(D,U).event(M),ie=n.apply(D,U),pe=v==null?E(ie):typeof v=="function"?v.apply(D,U):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=D.__zoom,me=typeof w=="function"?w.apply(D,U):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new hn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}W.zoom(null,ke)}})}function A(y,w,v){return!v&&y.__zooming||new T(y,w)}function T(y,w){this.that=y,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(y,w),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,w){return this.mouse&&y!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var w=Rn(this.that).datum();d.call(y,this.that,new z$(y,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:d}),w)}};function L(y,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(y),M=this.__zoom,D=Math.max(r[0],Math.min(r[1],M.k*Math.pow(2,i.apply(this,arguments)))),U=An(y);if(v.wheel)(v.mouse[0][0]!==U[0]||v.mouse[0][1]!==U[1])&&(v.mouse[1]=M.invert(v.mouse[0]=U)),clearTimeout(v.wheel);else{if(M.k===D)return;v.mouse=[U,M.invert(U)],yr(this),v.start()}Ti(y),v.wheel=setTimeout(W,h),v.zoom("mouse",o(_(b(M,D),v.mouse[0],v.mouse[1]),v.extent,l));function W(){v.wheel=null,v.end()}}function x(y,...w){if(p||!e.apply(this,arguments))return;var v=y.currentTarget,M=A(this,w,!0).event(y),D=Rn(y.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),U=An(y,v),W=y.clientX,ie=y.clientY;tA(y.view),Ns(y),M.mouse=[U,this.__zoom.invert(U)],yr(this),M.start();function pe(ge){if(Ti(ge),!M.moved){var me=ge.clientX-W,se=ge.clientY-ie;M.moved=me*me+se*se>g}M.event(ge).zoom("mouse",o(_(M.that.__zoom,M.mouse[0]=An(ge,v),M.mouse[1]),M.extent,l))}function ye(ge){D.on("mousemove.zoom mouseup.zoom",null),nA(ge.view,M.moved),Ti(ge),M.event(ge).end()}}function R(y,...w){if(e.apply(this,arguments)){var v=this.__zoom,M=An(y.changedTouches?y.changedTouches[0]:y,this),D=v.invert(M),U=v.k*(y.shiftKey?.5:2),W=o(_(b(v,U),M,D),n.apply(this,w),l);Ti(y),s>0?Rn(this).transition().duration(s).call(I,W,M,y):Rn(this).call(N.transform,W,M,y)}}function $(y,...w){if(e.apply(this,arguments)){var v=y.touches,M=v.length,D=A(this,w,y.changedTouches.length===M).event(y),U,W,ie,pe;for(Ns(y),W=0;W<M;++W)ie=v[W],pe=An(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],D.touch0?!D.touch1&&D.touch0[2]!==pe[2]&&(D.touch1=pe,D.taps=0):(D.touch0=pe,U=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),U&&(D.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),yr(this),D.start())}}function B(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W,ie,pe;for(Ti(y),U=0;U<D;++U)W=M[U],ie=An(W,this),v.touch0&&v.touch0[2]===W.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===W.identifier&&(v.touch1[0]=ie);if(W=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;W=b(W,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(_(W,ie,pe),v.extent,l))}}function O(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W;for(Ns(y),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),U=0;U<D;++U)W=M[U],v.touch0&&v.touch0[2]===W.identifier?delete v.touch0:v.touch1&&v.touch1[2]===W.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(W=An(W,this),Math.hypot(m[0]-W[0],m[1]-W[1])<k)){var ie=Rn(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return N.wheelDelta=function(y){return arguments.length?(i=typeof y=="function"?y:gr(+y),N):i},N.filter=function(y){return arguments.length?(e=typeof y=="function"?y:gr(!!y),N):e},N.touchable=function(y){return arguments.length?(a=typeof y=="function"?y:gr(!!y),N):a},N.extent=function(y){return arguments.length?(n=typeof y=="function"?y:gr([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),N):n},N.scaleExtent=function(y){return arguments.length?(r[0]=+y[0],r[1]=+y[1],N):[r[0],r[1]]},N.translateExtent=function(y){return arguments.length?(l[0][0]=+y[0][0],l[1][0]=+y[1][0],l[0][1]=+y[0][1],l[1][1]=+y[1][1],N):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},N.constrain=function(y){return arguments.length?(o=y,N):o},N.duration=function(y){return arguments.length?(s=+y,N):s},N.interpolate=function(y){return arguments.length?(c=y,N):c},N.on=function(){var y=d.on.apply(d,arguments);return y===d?N:y},N.clickDistance=function(y){return arguments.length?(g=(y=+y)*y,N):Math.sqrt(g)},N.tapDistance=function(y){return arguments.length?(k=+y,N):k},N}const nh=Symbol("MiniMapSlots"),Y$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],q$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},W$=t.defineComponent({...q$,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:n}){const o=e,i=t.inject(nh),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,p)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,Y$))],64)):t.createCommentVNode("",!0)}}),J$=["width","height","viewBox","aria-labelledby"],X$=["id"],Z$=["d","fill","stroke","stroke-width"],Q$={name:"MiniMap",compatConfig:{MODE:3}},eT=t.defineComponent({...Q$,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:p,d3Zoom:f,getNodesInitialized:h}=je(),g=t.ref();t.provide(nh,o);const k=t.toRef(()=>{var D;return e.width??((D=i.style)==null?void 0:D.width)??a}),N=t.toRef(()=>{var D;return e.height??((D=i.style)==null?void 0:D.height)??r}),b=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",_=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),E=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),I=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=t.computed(()=>Dl(h.value.filter(D=>!D.hidden))),T=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),L=t.computed(()=>h.value&&h.value.length?k0(A.value,T.value):T.value),x=t.computed(()=>{const D=L.value.width/k.value,U=L.value.height/N.value;return Math.max(D,U)}),R=t.computed(()=>{const D=x.value*k.value,U=x.value*N.value,W=e.offsetScale*x.value;return{offset:W,x:L.value.x-(D-L.value.width)/2-W,y:L.value.y-(U-L.value.height)/2-W,width:D+W*2,height:U+W*2}}),$=t.computed(()=>!R.value.x||!R.value.y?"":`
|
|
52
|
+
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class ft extends Error{constructor(n,...o){var i;super((i=Dm[n])==null?void 0:i.call(Dm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Ul(e){return"clientX"in e}function A0(e){return"sourceEvent"in e}function Jt(e,n){const o=Ul(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}}const ki=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function $0(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function La(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const T0=()=>!0;function Hl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function M0(e,n,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of n.values())Va(a,Ma(r))>0&&i.push(r);return i}const V0=250;function B0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=M0(e,o,n+V0);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:p,y:f}=$o(d,m,m.position,!0),h=Math.sqrt((p-e.x)**2+(f-e.y)**2);h>n||(h<s?(l=[{...m,x:p,y:f}],s=h):h===s&&l.push({...m,x:p,y:f}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function Om(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=T0},u,m,p,f){const h=r==="target",g=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:k,y:N}=Jt(e),b=l.elementFromPoint(k,N),_=b!=null&&b.classList.contains(`${s}-flow__handle`)?b:g,E={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const I=Lm(void 0,_),A=_.getAttribute("data-nodeid"),T=_.getAttribute("data-handleid"),L=_.classList.contains("connectable"),x=_.classList.contains("connectableend");if(!A||!I)return E;const R={source:h?A:i,sourceHandle:h?T:a,target:h?i:A,targetHandle:h?a:T};E.connection=R;const B=L&&x&&(o===cn.Strict?h&&I==="source"||!h&&I==="target":A!==i||T!==a);E.isValid=B&&d(R,{nodes:m,edges:u,sourceNode:p(R.source),targetNode:p(R.target)}),E.toHandle=Pm(A,I,T,f,o,!0)}return E}function Lm(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function D0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function O0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Pm(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===cn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...$o(d,m,m.position,!0)}:m}const jl={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},L0=["production","prod"];function Ei(e,...n){zm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function zm(){return!L0.includes(process.env.NODE_ENV||"")}function Fm(e,n,o,i,a){const r=n.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Ba(l)}}):null}function Kl(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ct(e){return typeof t.unref(e)<"u"}function P0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ft(st.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return vn(e)?a=e:a={...e,id:km(e)},a=bm(a,void 0,i),_0(a,n)?!1:a}function z0(e,n,o,i,a){if(!n.source||!n.target)return a(new ft(st.EDGE_INVALID,e.id)),!1;if(!o)return a(new ft(st.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?km(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Um(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Wn(l)){o(new ft(st.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=y0(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new ft(st.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Hm(e,n,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,n)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,n)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,n))}}function Gl(e,n,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;Hm("source",c,u,e,a,l),Hm("target",c,d,e,r,s)}}function jm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Yl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=vn(d)?d:P0(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new ft(st.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ft(st.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new ft(st.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new ft(st.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...bm(u,f,r),sourceNode:m,targetNode:p})}return c}const Km=Symbol("vueFlow"),Gm=Symbol("nodeId"),Ym=Symbol("nodeRef"),F0=Symbol("edgeId"),U0=Symbol("edgeRef"),Pa=Symbol("slots");function qm(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:p,findNode:f,multiSelectionActive:h,nodesSelectionActive:g,selectNodesOnDrag:k,removeSelectedElements:N,addSelectedNodes:b,updateNodePositions:_,emits:E}=je(),{onStart:I,onDrag:A,onStop:T,onClick:L,el:x,disabled:R,id:$,selectable:B,dragHandle:O}=e,y=t.shallowRef(!1);let w=[],v,M=null,D={x:void 0,y:void 0},U={x:0,y:0},W=null,ie=!1,pe=!1,ye=0,ge=!1;const me=K0(),se=({x:le,y:ue})=>{D={x:le,y:ue};let z=!1;if(w=w.map(P=>{const F={x:le-P.distance.x,y:ue-P.distance.y},{computedPosition:Q}=Fl(P,o.value?La(F,i.value):F,E.error,l.value,P.parentNode?f(P.parentNode):void 0);return z=z||P.position.x!==Q.x||P.position.y!==Q.y,P.position=Q,P}),pe=pe||z,!!z&&(_(w,!0,!0),y.value=!0,W)){const[P,F]=zl({id:$,dragItems:w,findNode:f});A({event:W,node:P,nodes:F})}},ke=()=>{if(!M)return;const[le,ue]=Cm(U,M,u.value);if(le!==0||ue!==0){const z={x:(D.x??0)-le/c.value.zoom,y:(D.y??0)-ue/c.value.zoom};p({x:le,y:ue})&&se(z)}ye=requestAnimationFrame(ke)},Se=(le,ue)=>{ie=!0;const z=f($);!k.value&&!h.value&&z&&(z.selected||N()),z&&t.toValue(B)&&k.value&&Kl(z,h.value,b,N,g,!1,ue);const P=me(le.sourceEvent);if(D=P,w=I0(r.value,m.value,P,$),w.length){const[F,Q]=zl({id:$,dragItems:w,findNode:f});I({event:le.sourceEvent,node:F,nodes:Q})}},ce=(le,ue)=>{var z;le.sourceEvent.type==="touchmove"&&le.sourceEvent.touches.length>1||(pe=!1,s.value===0&&Se(le,ue),D=me(le.sourceEvent),M=((z=n.value)==null?void 0:z.getBoundingClientRect())||null,U=Jt(le.sourceEvent,M))},fe=(le,ue)=>{const z=me(le.sourceEvent);if(!ge&&ie&&d.value&&(ge=!0,ke()),!ie){const P=z.xSnapped-(D.x??0),F=z.ySnapped-(D.y??0);Math.sqrt(P*P+F*F)>s.value&&Se(le,ue)}(D.x!==z.xSnapped||D.y!==z.ySnapped)&&w.length&&ie&&(W=le.sourceEvent,U=Jt(le.sourceEvent,M),se(z))},oe=le=>{let ue=!1;if(!ie&&!y.value&&!h.value){const z=le.sourceEvent,P=me(z),F=P.xSnapped-(D.x??0),Q=P.ySnapped-(D.y??0),X=Math.sqrt(F*F+Q*Q);X!==0&&X<=s.value&&(L==null||L(z),ue=!0)}if(w.length&&!ue){pe&&(_(w,!1,!1),pe=!1);const[z,P]=zl({id:$,dragItems:w,findNode:f});T({event:le.sourceEvent,node:z,nodes:P})}w=[],y.value=!1,ge=!1,ie=!1,D={x:void 0,y:void 0},cancelAnimationFrame(ye)};return t.watch([()=>t.toValue(R),x],([le,ue],z,P)=>{if(ue){const F=Mt(ue);le||(v=hE().on("start",Q=>ce(Q,ue)).on("drag",Q=>fe(Q,ue)).on("end",Q=>oe(Q)).filter(Q=>{const X=Q.target,_e=t.toValue(O);return!Q.button&&(!a.value||!Mm(X,`.${a.value}`,ue)&&(!_e||Mm(X,_e,ue)))}),F.call(v)),P(()=>{F.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),y}function H0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),updateStart:Re(),update:Re(),updateEnd:Re()}}function j0(e,n){const o=H0();return o.doubleClick.on(i=>{var a,r;n.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;n.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;n.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;n.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function K0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=je();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=A0(a)?a.sourceEvent:a,{x:c,y:d}=Jt(s,l),u=bi({x:c,y:d},e.value),{x:m,y:p}=o.value?La(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function za(){return!0}function Wm({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:p,nodesConnectable:f,autoPanOnConnect:h,autoPanSpeed:g,findNode:k,panBy:N,startConnection:b,updateConnection:_,endConnection:E,emits:I,viewport:A,edges:T,nodes:L,isValidConnection:x,nodeLookup:R}=je();let $=null,B=!1,O=null;function y(v){var M;const D=t.toValue(o)==="target",U=Ul(v),W=gm(v.target),ie=v.currentTarget;if(ie&&(U&&v.button===0||!U)){let pe=function(Ie){z=Jt(Ie,oe),se=B0(bi(z,A.value,!1,[1,1]),u.value,R.value,Q),P||(F(),P=!0);const Y=Om(Ie,{handle:se,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:D?"target":"source",isValidConnection:me,doc:W,lib:"vue",flowId:s,nodeLookup:R.value},T.value,L.value,k,R.value);O=Y.handleDomNode,$=Y.connection,B=O0(!!se,Y.isValid);const j={...we,isValid:B,to:Y.toHandle&&B?gi({x:Y.toHandle.x,y:Y.toHandle.y},A.value):z,toHandle:Y.toHandle,toPosition:B&&Y.toHandle?Y.toHandle.position:jl[Q.position],toNode:Y.toHandle?R.value.get(Y.toHandle.nodeId):null};if(B&&se&&(we!=null&&we.toHandle)&&j.toHandle&&we.toHandle.type===j.toHandle.type&&we.toHandle.nodeId===j.toHandle.nodeId&&we.toHandle.id===j.toHandle.id&&we.to.x===j.to.x&&we.to.y===j.to.y)return;const J=se??Y.toHandle;if(_(J&&B?gi({x:J.x,y:J.y},A.value):z,J,D0(!!J,B)),we=j,!se&&!B&&!O)return Hl(ue);$&&$.source!==$.target&&O&&(Hl(ue),ue=O,O.classList.add("connecting","vue-flow__handle-connecting"),O.classList.toggle("valid",!!B),O.classList.toggle("vue-flow__handle-valid",!!B))},ye=function(Ie){"touches"in Ie&&Ie.touches.length>0||((se||O)&&$&&B&&(r?r(Ie,$):I.connect($)),I.connectEnd(Ie),a&&(l==null||l(Ie)),Hl(ue),cancelAnimationFrame(ke),E(Ie),P=!1,B=!1,$=null,O=null,W.removeEventListener("mousemove",pe),W.removeEventListener("mouseup",ye),W.removeEventListener("touchmove",pe),W.removeEventListener("touchend",ye))};const ge=k(t.toValue(n));let me=t.toValue(i)||x.value||za;!me&&ge&&(me=(D?ge.isValidSourcePos:ge.isValidTargetPos)||za);let se,ke=0;const{x:Se,y:ce}=Jt(v),fe=Lm(t.toValue(a),ie),oe=(M=c.value)==null?void 0:M.getBoundingClientRect();if(!oe||!fe)return;const le=Pm(t.toValue(n),fe,t.toValue(e),R.value,d.value);if(!le)return;let ue,z=Jt(v,oe),P=!1;const F=()=>{if(!h.value)return;const[Ie,Y]=Cm(z,oe,g.value);N({x:Ie,y:Y}),ke=requestAnimationFrame(F)},Q={...le,nodeId:t.toValue(n),type:fe,position:le.position},X=R.value.get(t.toValue(n)),he={inProgress:!0,isValid:null,from:$o(X,Q,$e.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:X,to:z,toHandle:null,toPosition:jl[Q.position],toNode:null};b({nodeId:t.toValue(n),id:t.toValue(e),type:fe,position:(ie==null?void 0:ie.getAttribute("data-handlepos"))||$e.Top,...z},{x:Se-oe.left,y:ce-oe.top}),I.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:fe});let we=he;W.addEventListener("mousemove",pe),W.addEventListener("mouseup",ye),W.addEventListener("touchmove",pe),W.addEventListener("touchend",ye)}}function w(v){var M,D;if(!m.value)return;const U=t.toValue(o)==="target";if(!p.value){I.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),b({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:$e.Top,...Jt(v)},void 0,!0);return}let W=t.toValue(i)||x.value||za;const ie=k(t.toValue(n));if(!W&&ie&&(W=(U?ie.isValidSourcePos:ie.isValidTargetPos)||za),ie&&(typeof ie.connectable>"u"?f.value:ie.connectable)===!1)return;const pe=gm(v.target),ye=Om(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:$e.Top,...Jt(v)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:W,doc:pe,lib:"vue",flowId:s,nodeLookup:R.value},T.value,L.value,k,R.value),ge=((M=ye.connection)==null?void 0:M.source)===((D=ye.connection)==null?void 0:D.target);ye.isValid&&ye.connection&&!ge&&I.connect(ye.connection),I.clickConnectEnd(v),E(v,!0)}return{handlePointerDown:y,handleClick:w}}function G0(){return t.inject(Gm,"")}function Jm(e){const n=e??G0()??"",o=t.inject(Ym,t.ref(null)),{findNode:i,edges:a,emits:r}=je(),l=i(n);return l||r.error(new ft(st.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Jn([l],a.value))}}function Y0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),dragStart:Re(),drag:Re(),dragStop:Re()}}function q0(e,n){const o=Y0();return o.doubleClick.on(i=>{var a,r;n.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;n.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;n.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;n.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function Xm(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=je();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,p=d?4:1,f=c.x*u*p,h=c.y*m*p,g=[];for(const k of e.value)if(k.draggable||l&&typeof k.draggable>"u"){const N={x:k.computedPosition.x+f,y:k.computedPosition.y+h},{position:b}=Fl(k,N,s.error,n.value,k.parentNode?i(k.parentNode):void 0);g.push({id:k.id,position:b,from:k.position,distance:{x:c.x,y:c.y},dimensions:k.dimensions})}o(g,!0,!1)}}const Fa=.1,W0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Sn(){return Ei("Viewport not initialized yet."),Promise.resolve(!1)}const J0={zoomIn:Sn,zoomOut:Sn,zoomTo:Sn,fitView:Sn,setCenter:Sn,fitBounds:Sn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Sn,setTransform:Sn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function X0(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?si:wa).scaleBy(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}=ym({x:-i,y:-a},e.translateExtent),m=So.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?si:wa).transform(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"?si:wa).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:Fa,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Ol(s),{x:d,y:u,zoom:m}=Im(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Fa);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:Fa})=>{const{x:l,y:s,zoom:c}=Im(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Fa);return o(l,s,c,r)},project:a=>bi(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return bi(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return gi(s,e.viewport)}return{x:0,y:0}}}:J0)}function ql(e,n=0,o=W0,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function Z0(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,k,N=!!(o.nodes.value.length||o.edges.value.length);g=wo([e.modelValue,()=>{var b,_;return(_=(b=e.modelValue)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setElements(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([b,_])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...b,..._],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},r=()=>{i.run(()=>{let g,k,N=!!o.nodes.value.length;g=wo([e.nodes,()=>{var b,_;return(_=(b=e.nodes)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setNodes(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.nodes,()=>o.nodes.value.length],([b])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...b],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},l=()=>{i.run(()=>{let g,k,N=!!o.edges.value.length;g=wo([e.edges,()=>{var b,_;return(_=(b=e.edges)==null?void 0:b.value)==null?void 0:_.length}],([b])=>{b&&Array.isArray(b)&&(k==null||k.pause(),o.setEdges(b),!k&&!N&&b.length?N=!0:k==null||k.resume())}),k=wo([o.edges,()=>o.edges.value.length],([b])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...b],t.nextTick(()=>{g==null||g.resume()}))},{immediate:N}),t.onScopeDispose(()=>{g==null||g.stop(),k==null||k.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ct(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ct(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ct(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ct(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ct(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const g=async k=>{let N=k;typeof n.autoConnect=="function"&&(N=await n.autoConnect(k)),N!==!1&&o.addEdges([N])};t.watch(()=>n.autoConnect,()=>{ct(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(k,N,b)=>{k?o.onConnect(g):o.hooks.value.connect.off(g),b(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},f=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const k of Object.keys(n)){const N=k;if(!g.includes(N)){const b=t.toRef(()=>n[N]),_=o[N];t.isRef(_)&&i.run(()=>{t.watch(b,E=>{ct(E)&&(_.value=E)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function Q0(){return{edgesChange:Re(),nodesChange:Re(),nodeDoubleClick:Re(),nodeClick:Re(),nodeMouseEnter:Re(),nodeMouseMove:Re(),nodeMouseLeave:Re(),nodeContextMenu:Re(),nodeDragStart:Re(),nodeDrag:Re(),nodeDragStop:Re(),nodesInitialized:Re(),miniMapNodeClick:Re(),miniMapNodeDoubleClick:Re(),miniMapNodeMouseEnter:Re(),miniMapNodeMouseMove:Re(),miniMapNodeMouseLeave:Re(),connect:Re(),connectStart:Re(),connectEnd:Re(),clickConnectStart:Re(),clickConnectEnd:Re(),paneReady:Re(),init:Re(),move:Re(),moveStart:Re(),moveEnd:Re(),selectionDragStart:Re(),selectionDrag:Re(),selectionDragStop:Re(),selectionContextMenu:Re(),selectionStart:Re(),selectionEnd:Re(),viewportChangeStart:Re(),viewportChange:Re(),viewportChangeEnd:Re(),paneScroll:Re(),paneClick:Re(),paneContextMenu:Re(),paneMouseEnter:Re(),paneMouseMove:Re(),paneMouseLeave:Re(),edgeContextMenu:Re(),edgeMouseEnter:Re(),edgeMouseMove:Re(),edgeMouseLeave:Re(),edgeDoubleClick:Re(),edgeClick:Re(),edgeUpdateStart:Re(),edgeUpdate:Re(),edgeUpdateEnd:Re(),updateNodeInternals:Re(),error:Re(e=>Ei(e.message))}}function eN(e,n){const o=t.getCurrentInstance();t.onBeforeMount(()=>{for(const[a,r]of Object.entries(n.value)){const l=s=>{e(a,s)};r.setEmitter(l),ni(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),ni(r.removeHasEmitListeners)}});function i(a){var r;const l=tN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function tN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Zm(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Vl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:pi.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Yn.Bezier,style:{}},connectionMode:cn.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:ki()?"Meta":"Control",zoomActivationKeyCode:ki()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Q0(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const nN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function oN(e,n,o){const i=X0(e),a=z=>{const P=z??[];e.hooks.updateNodeInternals.trigger(P)},r=z=>b0(z,e.nodes,e.edges),l=z=>g0(z,e.nodes,e.edges),s=z=>Jn(z,e.edges),c=({id:z,type:P,nodeId:F})=>{var Q;const X=z?`-${P}-${z}`:`-${P}`;return Array.from(((Q=e.connectionLookup.get(`${F}${X}`))==null?void 0:Q.values())??[])},d=z=>{if(z)return n.value.get(z)},u=z=>{if(z)return o.value.get(z)},m=(z,P,F)=>{var Q,X;const _e=[];for(const he of z){const we={id:he.id,type:"position",dragging:F,from:he.from};if(P&&(we.position=he.position,he.parentNode)){const Ie=d(he.parentNode);we.position={x:we.position.x-(((Q=Ie==null?void 0:Ie.computedPosition)==null?void 0:Q.x)??0),y:we.position.y-(((X=Ie==null?void 0:Ie.computedPosition)==null?void 0:X.y)??0)}}_e.push(we)}_e!=null&&_e.length&&e.hooks.nodesChange.trigger(_e)},p=z=>{if(!e.vueFlowRef)return;const P=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!P)return;const F=window.getComputedStyle(P),{m22:Q}=new window.DOMMatrixReadOnly(F.transform),X=[];for(const _e of z){const he=_e,we=d(he.id);if(we){const Ie=Ba(he.nodeElement);if(!!(Ie.width&&Ie.height&&(we.dimensions.width!==Ie.width||we.dimensions.height!==Ie.height||he.forceUpdate))){const j=he.nodeElement.getBoundingClientRect();we.dimensions=Ie,we.handleBounds.source=Fm("source",he.nodeElement,j,Q,we.id),we.handleBounds.target=Fm("target",he.nodeElement,j,Q,we.id),X.push({id:we.id,type:"dimensions",dimensions:Ie})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),X.length&&e.hooks.nodesChange.trigger(X)},f=(z,P)=>{const F=new Set,Q=new Set;for(const he of z)Wn(he)?F.add(he.id):vn(he)&&Q.add(he.id);const X=Cn(n.value,F,!0),_e=Cn(o.value,Q);if(e.multiSelectionActive){for(const he of F)X.push(xn(he,P));for(const he of Q)_e.push(xn(he,P))}X.length&&e.hooks.nodesChange.trigger(X),_e.length&&e.hooks.edgesChange.trigger(_e)},h=z=>{if(e.multiSelectionActive){const P=z.map(F=>xn(F.id,!0));e.hooks.nodesChange.trigger(P);return}e.hooks.nodesChange.trigger(Cn(n.value,new Set(z.map(P=>P.id)),!0)),e.hooks.edgesChange.trigger(Cn(o.value))},g=z=>{if(e.multiSelectionActive){const P=z.map(F=>xn(F.id,!0));e.hooks.edgesChange.trigger(P);return}e.hooks.edgesChange.trigger(Cn(o.value,new Set(z.map(P=>P.id)))),e.hooks.nodesChange.trigger(Cn(n.value,new Set,!0))},k=z=>{f(z,!0)},N=z=>{const F=(z||e.nodes).map(Q=>(Q.selected=!1,xn(Q.id,!1)));e.hooks.nodesChange.trigger(F)},b=z=>{const F=(z||e.edges).map(Q=>(Q.selected=!1,xn(Q.id,!1)));e.hooks.edgesChange.trigger(F)},_=z=>{if(!z||!z.length)return f([],!1);const P=z.reduce((F,Q)=>{const X=xn(Q.id,!1);return Wn(Q)?F.nodes.push(X):F.edges.push(X),F},{nodes:[],edges:[]});P.nodes.length&&e.hooks.nodesChange.trigger(P.nodes),P.edges.length&&e.hooks.edgesChange.trigger(P.edges)},E=z=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([z,e.maxZoom]),e.minZoom=z},I=z=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([e.minZoom,z]),e.maxZoom=z},A=z=>{var P;(P=e.d3Zoom)==null||P.translateExtent(z),e.translateExtent=z},T=z=>{e.nodeExtent=z,a()},L=z=>{var P;(P=e.d3Zoom)==null||P.clickDistance(z)},x=z=>{e.nodesDraggable=z,e.nodesConnectable=z,e.elementsSelectable=z},R=z=>{const P=z instanceof Function?z(e.nodes):z;!e.initialized&&!P.length||(e.nodes=Um(P,d,e.hooks.error.trigger))},$=z=>{const P=z instanceof Function?z(e.edges):z;if(!e.initialized&&!P.length)return;const F=Yl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Gl(e.connectionLookup,o.value,F),e.edges=F},B=z=>{const P=z instanceof Function?z([...e.nodes,...e.edges]):z;!e.initialized&&!P.length||(R(P.filter(Wn)),$(P.filter(vn)))},O=z=>{let P=z instanceof Function?z(e.nodes):z;P=Array.isArray(P)?P:[P];const F=Um(P,d,e.hooks.error.trigger),Q=[];for(const X of F)Q.push(Rm(X));Q.length&&e.hooks.nodesChange.trigger(Q)},y=z=>{let P=z instanceof Function?z(e.edges):z;P=Array.isArray(P)?P:[P];const F=Yl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const X of F)Q.push(Rm(X));Q.length&&e.hooks.edgesChange.trigger(Q)},w=(z,P=!0,F=!1)=>{const Q=z instanceof Function?z(e.nodes):z,X=Array.isArray(Q)?Q:[Q],_e=[],he=[];function we(Y){const j=s(Y);for(const J of j)(!ct(J.deletable)||J.deletable)&&he.push($m(J.id,J.source,J.target,J.sourceHandle,J.targetHandle))}function Ie(Y){const j=[];for(const J of e.nodes)J.parentNode===Y&&j.push(J);if(j.length){for(const J of j)_e.push(Am(J.id));P&&we(j);for(const J of j)Ie(J.id)}}for(const Y of X){const j=typeof Y=="string"?d(Y):Y;j&&(ct(j.deletable)&&!j.deletable||(_e.push(Am(j.id)),P&&we([j]),F&&Ie(j.id)))}he.length&&e.hooks.edgesChange.trigger(he),_e.length&&e.hooks.nodesChange.trigger(_e)},v=z=>{const P=z instanceof Function?z(e.edges):z,F=Array.isArray(P)?P:[P],Q=[];for(const X of F){const _e=typeof X=="string"?u(X):X;_e&&(ct(_e.deletable)&&!_e.deletable||Q.push($m(typeof X=="string"?X:X.id,_e.source,_e.target,_e.sourceHandle,_e.targetHandle)))}e.hooks.edgesChange.trigger(Q)},M=(z,P,F=!0)=>{const Q=u(z.id);if(!Q)return!1;const X=e.edges.indexOf(Q),_e=z0(z,P,Q,F,e.hooks.error.trigger);if(_e){const[he]=Yl([_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),Gl(e.connectionLookup,o.value,[he]),he}return!1},D=(z,P,F={replace:!1})=>{const Q=u(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=F.replace?X:{...Q.data,...X}},U=z=>Sm(z,e.nodes),W=z=>{const P=Sm(z,e.edges);return Gl(e.connectionLookup,o.value,P),P},ie=(z,P,F={replace:!1})=>{const Q=d(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;F.replace?e.nodes.splice(e.nodes.indexOf(Q),1,X):Object.assign(Q,X)},pe=(z,P,F={replace:!1})=>{const Q=d(z);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=F.replace?X:{...Q.data,...X}},ye=(z,P,F=!1)=>{F?e.connectionClickStartHandle=z:e.connectionStartHandle=z,e.connectionEndHandle=null,e.connectionStatus=null,P&&(e.connectionPosition=P)},ge=(z,P=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=z,e.connectionEndHandle=P,e.connectionStatus=F)},me=(z,P)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,P?e.connectionClickStartHandle=null:e.connectionStartHandle=null},se=z=>{const P=h0(z),F=P?null:yi(z)?z:d(z.id);return!P&&!F?[null,null,P]:[P?z:Ma(F),F,P]},ke=(z,P=!0,F=e.nodes)=>{const[Q,X,_e]=se(z);if(!Q)return[];const he=[];for(const we of F||e.nodes){if(!_e&&(we.id===X.id||!we.computedPosition))continue;const Ie=Ma(we),Y=Va(Ie,Q);(P&&Y>0||Y>=Ie.width*Ie.height||Y>=Number(Q.width)*Number(Q.height))&&he.push(we)}return he},Se=(z,P,F=!0)=>{const[Q]=se(z);if(!Q)return!1;const X=Va(Q,P);return F&&X>0||X>=Number(Q.width)*Number(Q.height)},ce=z=>{const{viewport:P,dimensions:F,d3Zoom:Q,d3Selection:X,translateExtent:_e}=e;if(!Q||!X||!z.x&&!z.y)return!1;const he=So.translate(P.x+z.x,P.y+z.y).scale(P.zoom),we=[[0,0],[F.width,F.height]],Ie=Q.constrain()(he,we,_e),Y=e.viewport.x!==Ie.x||e.viewport.y!==Ie.y||e.viewport.zoom!==Ie.k;return Q.transform(X,Ie),Y},fe=z=>{const P=z instanceof Function?z(e):z,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ct(P.defaultEdgeOptions)&&(e.defaultEdgeOptions=P.defaultEdgeOptions);const Q=P.modelValue||P.nodes||P.edges?[]:void 0;Q&&(P.modelValue&&Q.push(...P.modelValue),P.nodes&&Q.push(...P.nodes),P.edges&&Q.push(...P.edges),B(Q));const X=()=>{ct(P.maxZoom)&&I(P.maxZoom),ct(P.minZoom)&&E(P.minZoom),ct(P.translateExtent)&&A(P.translateExtent)};for(const _e of Object.keys(P)){const he=_e,we=P[he];![...nN,...F].includes(he)&&ct(we)&&(e[he]=we)}fl(()=>e.d3Zoom).not.toBeNull().then(X),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:B,setNodes:R,setEdges:$,addNodes:O,addEdges:y,removeNodes:w,removeEdges:v,findNode:d,findEdge:u,updateEdge:M,updateEdgeData:D,updateNode:ie,updateNodeData:pe,applyEdgeChanges:W,applyNodeChanges:U,addSelectedElements:k,addSelectedNodes:h,addSelectedEdges:g,setMinZoom:E,setMaxZoom:I,setTranslateExtent:A,setNodeExtent:T,setPaneClickDistance:L,removeSelectedElements:_,removeSelectedNodes:N,removeSelectedEdges:b,startConnection:ye,updateConnection:ge,endConnection:me,setInteractive:x,setState:fe,getIntersectingNodes:ke,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Se,panBy:ce,fitView:z=>i.value.fitView(z),zoomIn:z=>i.value.zoomIn(z),zoomOut:z=>i.value.zoomOut(z),zoomTo:(z,P)=>i.value.zoomTo(z,P),setViewport:(z,P)=>i.value.setViewport(z,P),setTransform:(z,P)=>i.value.setTransform(z,P),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(z,P,F)=>i.value.setCenter(z,P,F),fitBounds:(z,P)=>i.value.fitBounds(z,P),project:z=>i.value.project(z),screenToFlowCoordinate:z=>i.value.screenToFlowCoordinate(z),flowToScreenCoordinate:z=>i.value.flowToScreenCoordinate(z),toObject:()=>{const z=[],P=[];for(const F of e.nodes){const{computedPosition:Q,handleBounds:X,selected:_e,dimensions:he,isParent:we,resizing:Ie,dragging:Y,events:j,...J}=F;z.push(J)}for(const F of e.edges){const{selected:Q,sourceNode:X,targetNode:_e,events:he,...we}=F;P.push(we)}return JSON.parse(JSON.stringify({nodes:z,edges:P,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:z=>new Promise(P=>{const{nodes:F,edges:Q,position:X,zoom:_e,viewport:he}=z;F&&R(F),Q&&$(Q);const[we,Ie]=he!=null&&he.x&&(he!=null&&he.y)?[he.x,he.y]:X??[null,null];if(we&&Ie){const Y=(he==null?void 0:he.zoom)||_e||e.viewport.zoom;return fl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:we,y:Ie,zoom:Y}).then(()=>{P(!0)})})}else P(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const z=Zm();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const P=So.translate(z.defaultViewport.x??0,z.defaultViewport.y??0).scale(qn(z.defaultViewport.zoom??1,z.minZoom,z.maxZoom)),F=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[F.width,F.height]],X=e.d3Zoom.constrain()(P,Q,z.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}fe(z)},$destroy:()=>{}}}const iN=["data-id","data-handleid","data-nodeid","data-handlepos"],aN={name:"Handle",compatConfig:{MODE:3}},Xn=t.defineComponent({...aN,props:{id:{default:null},type:{},position:{default:()=>$e.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:p}=je(),{id:f,node:h,nodeEl:g,connectedEdges:k}=Jm(),N=t.ref(),b=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),E=t.toRef(()=>{var $,B,O,y,w,v;return(($=l.value)==null?void 0:$.nodeId)===f&&((B=l.value)==null?void 0:B.id)===e.id&&((O=l.value)==null?void 0:O.type)===i.value||((y=c.value)==null?void 0:y.nodeId)===f&&((w=c.value)==null?void 0:w.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),I=t.toRef(()=>{var $,B,O;return(($=s.value)==null?void 0:$.nodeId)===f&&((B=s.value)==null?void 0:B.id)===e.id&&((O=s.value)==null?void 0:O.type)===i.value}),{handlePointerDown:A,handleClick:T}=Wm({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),L=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!k.value.some($=>{const B=$[`${i.value}Handle`];return $[i.value]!==f?!1:B?B===e.id:!0}):typeof e.connectable=="number"?k.value.filter($=>{const B=$[`${i.value}Handle`];return $[i.value]!==f?!1:B?B===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,k.value):ct(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var $;if(!h.dimensions.width||!h.dimensions.height)return;const B=($=h.handleBounds[i.value])==null?void 0:$.find(U=>U.id===e.id);if(!d.value||B)return;const O=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!N.value||!O||!e.id)return;const y=g.value.getBoundingClientRect(),w=N.value.getBoundingClientRect(),v=window.getComputedStyle(O),{m22:M}=new window.DOMMatrixReadOnly(v.transform),D={id:e.id,position:e.position,x:(w.left-y.left)/M,y:(w.top-y.top)/M,type:i.value,nodeId:f,...Ba(N.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],D]});function x($){const B=Ul($);L.value&&b.value&&(B&&$.button===0||!B)&&A($)}function R($){!f||!s.value&&!b.value||L.value&&T($)}return n({handleClick:T,handlePointerDown:A,onClick:R,onPointerDown:x}),($,B)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:N,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":$.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${$.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:L.value,connecting:I.value,connectablestart:b.value,connectableend:_.value,connectionindicator:L.value&&(b.value&&!E.value||_.value&&E.value)}]]),onMousedown:x,onTouchstartPassive:x,onClick:R},[t.renderSlot($.$slots,"default",{id:$.id})],42,iN))}}),Ua=function({sourcePosition:e=$e.Bottom,targetPosition:n=$e.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Xn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Xn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Ua.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ua.inheritAttrs=!1,Ua.compatConfig={MODE:3};const rN=Ua,Ha=function({targetPosition:e=$e.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Xn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};Ha.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ha.inheritAttrs=!1,Ha.compatConfig={MODE:3};const lN=Ha,ja=function({sourcePosition:e=$e.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Xn,{type:"source",position:e,connectable:o,isValidConnection:i})]};ja.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ja.inheritAttrs=!1,ja.compatConfig={MODE:3};const sN=ja,cN=["transform"],dN=["width","height","x","y","rx","ry"],uN=["y"],mN={name:"EdgeText",compatConfig:{MODE:3}},fN=t.defineComponent({...mN,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),i=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(a),t.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==n.value.width||r.height!==n.value.height)&&(n.value=r)}return(r,l)=>(t.openBlock(),t.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*r.labelBgPadding[0]}px`,height:`${n.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:t.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,dN)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:r.labelStyle}),[t.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(r.label),1)],64))])],16,uN)],8,cN))}}),pN=["id","d","marker-end","marker-start"],hN=["d","stroke-width"],yN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ka=t.defineComponent({...yN,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),i=t.ref(null),a=t.ref(null),r=t.useAttrs();return n({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,pN),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,hN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(fN,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function Qm({sourceX:e,sourceY:n,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-n)/2,s=i<n?i+l:i-l;return[r,s,a,l]}function ef({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=n*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function Ga(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function tf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case $e.Left:l=n-Ga(n-i,r),s=o;break;case $e.Right:l=n+Ga(i-n,r),s=o;break;case $e.Top:l=n,s=o-Ga(o-a,r);break;case $e.Bottom:l=n,s=o+Ga(a-o,r);break}return[l,s]}function nf(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,curvature:s=.25}=e,[c,d]=tf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=tf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,h,g]=ef({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,p,f,h,g]}function of({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case $e.Left:case $e.Right:r=.5*(n+i),l=o;break;case $e.Top:case $e.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function af(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top}=e,[s,c]=of({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=of({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,h]=ef({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,p,f,h]}const rf={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};function gN({source:e,sourcePosition:n=$e.Bottom,target:o}){return n===$e.Left||n===$e.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function lf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function bN({source:e,sourcePosition:n=$e.Bottom,target:o,targetPosition:i=$e.Top,center:a,offset:r}){const l=rf[n],s=rf[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=gN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,h,g;const k={x:0,y:0},N={x:0,y:0},[b,_,E,I]=Qm({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){h=a.x??b,g=a.y??_;const T=[{x:h,y:c.y},{x:h,y:d.y}],L=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===p?f=m==="x"?T:L:f=m==="x"?L:T}else{const T=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?L:T:f=l.y===p?T:L,n===i){const O=Math.abs(e[m]-o[m]);if(O<=r){const y=Math.min(r-1,r-O);l[m]===p?k[m]=(c[m]>e[m]?-1:1)*y:N[m]=(d[m]>o[m]?-1:1)*y}}if(n!==i){const O=m==="x"?"y":"x",y=l[m]===s[O],w=c[O]>d[O],v=c[O]<d[O];(l[m]===1&&(!y&&w||y&&v)||l[m]!==1&&(!y&&v||y&&w))&&(f=m==="x"?T:L)}const x={x:c.x+k.x,y:c.y+k.y},R={x:d.x+N.x,y:d.y+N.y},$=Math.max(Math.abs(x.x-f[0].x),Math.abs(R.x-f[0].x)),B=Math.max(Math.abs(x.y-f[0].y),Math.abs(R.y-f[0].y));$>=B?(h=(x.x+R.x)/2,g=f[0].y):(h=f[0].x,g=(x.y+R.y)/2)}return[[e,{x:c.x+k.x,y:c.y+k.y},...f,{x:d.x+N.x,y:d.y+N.y},o],h,g,E,I]}function _N(e,n,o,i){const a=Math.min(lf(e,n)/2,lf(n,o)/2,i),{x:r,y:l}=n;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function Wl(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,h,g]=bN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((N,b,_)=>{let E;return _>0&&_<m.length-1?E=_N(m[_-1],b,m[_+1],s):E=`${_===0?"M":"L"}${b.x} ${b.y}`,N+=E,N},""),p,f,h,g]}function kN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Qm({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const EN=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=kN(e);return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),sf=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Wl({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),NN=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(sf,{...e,...n,borderRadius:0})}}),wN=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=nf({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),IN=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=af({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ka,{path:o,labelX:i,labelY:a,...n,...e})}}}),vN={input:sN,default:rN,output:lN},xN={default:wN,straight:EN,step:NN,smoothstep:sf,simplebezier:IN};function CN(e,n,o){const i=t.computed(()=>g=>n.value.get(g)),a=t.computed(()=>g=>o.value.get(g)),r=t.computed(()=>{const g={...xN,...e.edgeTypes},k=Object.keys(g);for(const N of e.edges)N.type&&!k.includes(N.type)&&(g[N.type]=N.type);return g}),l=t.computed(()=>{const g={...vN,...e.nodeTypes},k=Object.keys(g);for(const N of e.nodes)N.type&&!k.includes(N.type)&&(g[N.type]=N.type);return g}),s=t.computed(()=>e.onlyRenderVisibleElements?wm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const k of e.edges){const N=n.value.get(k.source),b=n.value.get(k.target);S0({sourcePos:N.computedPosition||{x:0,y:0},targetPos:b.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:b.dimensions.width,targetHeight:b.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(k)}return g}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const g=[];for(const k of e.nodes)k.selected&&g.push(k);return g}),m=t.computed(()=>{const g=[];for(const k of e.edges)k.selected&&g.push(k);return g}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const g=[];for(const k of e.nodes)k.dimensions.width&&k.dimensions.height&&k.handleBounds!==void 0&&g.push(k);return g}),h=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:h}}class Zn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Zn.instance;return Zn.instance=i??new Zn,o&&(o.config.globalProperties.$vueFlowStorage=Zn.instance),Zn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=Zm(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[h]=f.on}const l={};for(const[p,f]of Object.entries(a.hooks))l[p]=f.trigger;const s=t.computed(()=>{const p=new Map;for(const f of a.nodes)p.set(f.id,f);return p}),c=t.computed(()=>{const p=new Map;for(const f of a.edges)p.set(f.id,f);return p}),d=CN(a,s,c),u=oN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...I_(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function je(e){const n=Zn.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Km,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,p,f)=>{const h=k=>{d.applyNodeChanges(k)},g=k=>{d.applyEdgeChanges(k)};m?(d.onNodesChange(h),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)),f(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),ni(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ei(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Km,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ft(st.USEVUEFLOW_OPTIONS))}return s}function SN(e){const{emits:n,dimensions:o}=je();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Ba(e.value);(s.width===0||s.height===0)&&n.error(new ft(st.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const RN={name:"UserSelection",compatConfig:{MODE:3}},AN=t.defineComponent({...RN,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),$N=["tabIndex"],TN={name:"NodesSelection",compatConfig:{MODE:3}},MN=t.defineComponent({...TN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=je(),s=Xm(),c=t.ref(null),d=qm({el:c,onStart(h){n.selectionDragStart(h),n.nodeDragStart(h)},onDrag(h){n.selectionDrag(h),n.nodeDrag(h)},onStop(h){n.selectionDragStop(h),n.nodeDragStop(h)}});t.onMounted(()=>{var h;r.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=t.computed(()=>Ol(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){n.selectionContextMenu({event:h,nodes:i.value})}function f(h){r.value||Ro[h.key]&&(h.preventDefault(),s({x:Ro[h.key].x,y:Ro[h.key].y},h.shiftKey))}return(h,g)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,$N)],6)):t.createCommentVNode("",!0)}});function VN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const BN={name:"Pane",compatConfig:{MODE:3}},DN=t.defineComponent({...BN,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:p,removeEdges:f,selectionMode:h,deleteKeyCode:g,multiSelectionKeyCode:k,multiSelectionActive:N,edgeLookup:b,nodeLookup:_,connectionLookup:E,defaultEdgeOptions:I,connectionStartHandle:A,panOnDrag:T}=je(),L=t.shallowRef(null),x=t.shallowRef(new Set),R=t.shallowRef(new Set),$=t.shallowRef(null),B=t.toRef(()=>c.value&&(e.isSelecting||r.value)),O=t.toRef(()=>A.value!==null);let y=!1,w=!1;const v=hi(g,{actInsideInputWithModifier:!1}),M=hi(k);t.watch(v,me=>{me&&(p(m.value),f(u.value),d.value=!1)}),t.watch(M,me=>{N.value=me});function D(me,se){return ke=>{ke.target===se&&(me==null||me(ke))}}function U(me){if(y||O.value){y=!1;return}a.paneClick(me),l(),d.value=!1}function W(me){var se;if(Array.isArray(T.value)&&((se=T.value)!=null&&se.includes(2))){me.preventDefault();return}a.paneContextMenu(me)}function ie(me){a.paneScroll(me)}function pe(me){var se,ke,Se;if($.value=((se=n.value)==null?void 0:se.getBoundingClientRect())??null,!c.value||!e.isSelecting||me.button!==0||me.target!==L.value||!$.value)return;(Se=(ke=me.target)==null?void 0:ke.setPointerCapture)==null||Se.call(ke,me.pointerId);const{x:ce,y:fe}=VN(me,$.value);w=!0,y=!1,l(),s.value={width:0,height:0,startX:ce,startY:fe,x:ce,y:fe},a.selectionStart(me)}function ye(me){var se;if(!$.value||!s.value)return;y=!0;const{x:ke,y:Se}=Jt(me,$.value),{startX:ce=0,startY:fe=0}=s.value,oe={startX:ce,startY:fe,x:ke<ce?ke:ce,y:Se<fe?Se:fe,width:Math.abs(ke-ce),height:Math.abs(Se-fe)},le=x.value,ue=R.value;x.value=new Set(wm(o.value,oe,i.value,h.value===Vl.Partial,!0).map(P=>P.id)),R.value=new Set;const z=((se=I.value)==null?void 0:se.selectable)??!0;for(const P of x.value){const F=E.value.get(P);if(F)for(const{edgeId:Q}of F.values()){const X=b.value.get(Q);X&&(X.selectable??z)&&R.value.add(Q)}}if(!jm(le,x.value)){const P=Cn(_.value,x.value,!0);a.nodesChange(P)}if(!jm(ue,R.value)){const P=Cn(b.value,R.value);a.edgesChange(P)}s.value=oe,r.value=!0,d.value=!1}function ge(me){var se;me.button!==0||!w||((se=me.target)==null||se.releasePointerCapture(me.pointerId),!r.value&&s.value&&me.target===L.value&&U(me),r.value=!1,s.value=null,d.value=x.value.size>0,a.selectionEnd(me),e.selectionKeyPressed&&(y=!1),w=!1)}return(me,se)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:L,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:me.isSelecting}]),onClick:se[0]||(se[0]=ke=>B.value?void 0:D(U,L.value)(ke)),onContextmenu:se[1]||(se[1]=ke=>D(W,L.value)(ke)),onWheelPassive:se[2]||(se[2]=ke=>D(ie,L.value)(ke)),onPointerenter:se[3]||(se[3]=ke=>B.value?void 0:t.unref(a).paneMouseEnter(ke)),onPointerdown:se[4]||(se[4]=ke=>B.value?pe(ke):t.unref(a).paneMouseMove(ke)),onPointermove:se[5]||(se[5]=ke=>B.value?ye(ke):t.unref(a).paneMouseMove(ke)),onPointerup:se[6]||(se[6]=ke=>B.value?ge(ke):void 0),onPointerleave:se[7]||(se[7]=ke=>t.unref(a).paneMouseLeave(ke))},[t.renderSlot(me.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(AN,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(MN,{key:1})):t.createCommentVNode("",!0)],34))}}),ON={name:"Transform",compatConfig:{MODE:3}},LN=t.defineComponent({...ON,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=je(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),PN={name:"Viewport",compatConfig:{MODE:3}},zN=t.defineComponent({...PN,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:p,zoomOnPinch:f,zoomOnScroll:h,preventScrolling:g,noWheelClassName:k,noPanClassName:N,emits:b,connectionStartHandle:_,userSelectionActive:E,paneDragging:I,d3Zoom:A,d3Selection:T,d3ZoomHandler:L,viewport:x,viewportRef:R,paneClickDistance:$}=je();SN(R);const B=t.shallowRef(!1),O=t.shallowRef(!1);let y=null,w=!1,v=0,M={x:0,y:0,zoom:0};const D=hi(s),U=hi(l),W=hi(r),ie=t.toRef(()=>(!U.value||U.value&&l.value===!0)&&(D.value||m.value)),pe=t.toRef(()=>D.value||c.value),ye=t.toRef(()=>l.value===!0&&ie.value!==!0),ge=t.toRef(()=>U.value&&l.value!==!0||E.value||ye.value),me=t.toRef(()=>_.value!==null);t.onMounted(()=>{if(!R.value){Ei("Viewport element is missing");return}const fe=R.value,oe=fe.getBoundingClientRect(),le=s0().clickDistance($.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Mt(fe).call(le),z=ue.on("wheel.zoom"),P=So.translate(i.value.x??0,i.value.y??0).scale(qn(i.value.zoom??1,n.value,o.value)),F=[[0,0],[oe.width,oe.height]],Q=le.constrain()(P,F,a.value);le.transform(ue,Q),le.wheelDelta(Ll),A.value=le,T.value=ue,L.value=z,x.value={x:Q.x,y:Q.y,zoom:Q.k},le.on("start",X=>{var _e;if(!X.sourceEvent)return null;v=X.sourceEvent.button,B.value=!0;const he=Se(X.transform);((_e=X.sourceEvent)==null?void 0:_e.type)==="mousedown"&&(I.value=!0),M=he,b.viewportChangeStart(he),b.moveStart({event:X,flowTransform:he})}),le.on("end",X=>{if(!X.sourceEvent)return null;if(B.value=!1,I.value=!1,se(ie.value,v??0)&&!w&&b.paneContextMenu(X.sourceEvent),w=!1,ke(M,X.transform)){const _e=Se(X.transform);M=_e,b.viewportChangeEnd(_e),b.moveEnd({event:X,flowTransform:_e})}}),le.filter(X=>{var _e;const he=W.value||h.value,we=f.value&&X.ctrlKey,Ie=X.button,Y=X.type==="wheel";if(Ie===1&&X.type==="mousedown"&&(ce(X,"vue-flow__node")||ce(X,"vue-flow__edge")))return!0;if(!ie.value&&!he&&!pe.value&&!p.value&&!f.value||E.value||me.value&&!Y||!p.value&&X.type==="dblclick"||ce(X,k.value)&&Y||ce(X,N.value)&&(!Y||pe.value&&Y&&!W.value)||!f.value&&X.ctrlKey&&Y||!he&&!pe.value&&!we&&Y)return!1;if(!f&&X.type==="touchstart"&&((_e=X.touches)==null?void 0:_e.length)>1)return X.preventDefault(),!1;if(!ie.value&&(X.type==="mousedown"||X.type==="touchstart")||ye.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ie===0||Array.isArray(m.value)&&!m.value.includes(Ie)&&(X.type==="mousedown"||X.type==="touchstart"))return!1;const j=Array.isArray(m.value)&&m.value.includes(Ie)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ie||Ie<=1;return(!X.ctrlKey||D.value||Y)&&j}),t.watch([E,ie],()=>{E.value&&!B.value?le.on("zoom",null):E.value||le.on("zoom",X=>{x.value={x:X.transform.x,y:X.transform.y,zoom:X.transform.k};const _e=Se(X.transform);w=se(ie.value,v??0),b.viewportChange(_e),b.move({event:X,flowTransform:_e})})},{immediate:!0}),t.watch([E,pe,d,W,f,g,k],()=>{pe.value&&!W.value&&!E.value?ue.on("wheel.zoom",X=>{if(ce(X,k.value))return!1;const _e=W.value||h.value,he=f.value&&X.ctrlKey;if(!(!g.value||pe.value||_e||he))return!1;X.preventDefault(),X.stopImmediatePropagation();const Ie=ue.property("__zoom").k||1,Y=ki();if(!D.value&&X.ctrlKey&&f.value&&Y){const K=Gt(X),te=Ll(X),G=Ie*2**te;le.scaleTo(ue,G,K,X);return}const j=X.deltaMode===1?20:1;let J=d.value===pi.Vertical?0:X.deltaX*j,ve=d.value===pi.Horizontal?0:X.deltaY*j;!Y&&X.shiftKey&&d.value!==pi.Vertical&&!J&&ve&&(J=ve,ve=0),le.translateBy(ue,-(J/Ie)*u.value,-(ve/Ie)*u.value);const Te=Se(ue.property("__zoom"));y&&clearTimeout(y),O.value?(b.move({event:X,flowTransform:Te}),b.viewportChange(Te),y=setTimeout(()=>{b.moveEnd({event:X,flowTransform:Te}),b.viewportChangeEnd(Te),O.value=!1},150)):(O.value=!0,b.moveStart({event:X,flowTransform:Te}),b.viewportChangeStart(Te))},{passive:!1}):typeof z<"u"&&ue.on("wheel.zoom",function(X,_e){const he=!g.value&&X.type==="wheel"&&!X.ctrlKey,we=W.value||h.value,Ie=f.value&&X.ctrlKey;if(!we&&!c.value&&!Ie&&X.type==="wheel"||he||ce(X,k.value))return null;X.preventDefault(),z.call(this,X,_e)},{passive:!1})},{immediate:!0})});function se(fe,oe){return oe===2&&Array.isArray(fe)&&fe.includes(2)}function ke(fe,oe){return fe.x!==oe.x&&!Number.isNaN(oe.x)||fe.y!==oe.y&&!Number.isNaN(oe.y)||fe.zoom!==oe.k&&!Number.isNaN(oe.k)}function Se(fe){return{x:fe.x,y:fe.y,zoom:fe.k}}function ce(fe,oe){return fe.target.closest(`.${oe}`)}return(fe,oe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:R,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(DN,{"is-selecting":ge.value,"selection-key-pressed":t.unref(U),class:t.normalizeClass({connecting:me.value,dragging:t.unref(I),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(LN,null,{default:t.withCtx(()=>[t.renderSlot(fe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),FN=["id"],UN=["id"],HN=["id"],jN={name:"A11yDescriptions",compatConfig:{MODE:3}},KN=t.defineComponent({...jN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(fm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,FN),t.createElementVNode("div",{id:`${t.unref(pm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,UN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(p0)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(i)),9,HN))],64))}});function GN(){const e=je();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function YN(e,n,o){return o===$e.Left?e-n:o===$e.Right?e+n:e}function qN(e,n,o){return o===$e.Top?e-n:o===$e.Bottom?e+n:e}const Jl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=$e.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:YN(n,e,i),cy:qN(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Jl.props=["radius","centerX","centerY","position","type"],Jl.compatConfig={MODE:3};const cf=Jl,WN=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:p,multiSelectionActive:f,disableKeyboardA11y:h,elementsSelectable:g,edgesUpdatable:k,edgesFocusable:N,hooks:b}=je(),_=t.computed(()=>u(e.id)),{emit:E,on:I}=j0(_.value,r),A=t.inject(Pa),T=t.getCurrentInstance(),L=t.ref(!1),x=t.ref(!1),R=t.ref(""),$=t.ref(null),B=t.ref("source"),O=t.ref(null),y=t.toRef(()=>typeof _.value.selectable>"u"?g.value:_.value.selectable),w=t.toRef(()=>typeof _.value.updatable>"u"?k.value:_.value.updatable),v=t.toRef(()=>typeof _.value.focusable>"u"?N.value:_.value.focusable);t.provide(F0,e.id),t.provide(U0,O);const M=t.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),D=t.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),U=t.computed(()=>{const P=_.value.type||"default",F=A==null?void 0:A[`edge-${P}`];if(F)return F;let Q=_.value.template??c.value[P];if(typeof Q=="string"&&T){const X=Object.keys(T.appContext.components);X&&X.includes(P)&&(Q=t.resolveComponent(P,!1))}return Q&&typeof Q!="string"?Q:(r.error(new ft(st.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:W}=Wm({nodeId:R,handleId:$,type:B,isValidConnection:p,edgeUpdaterType:B,onEdgeUpdate:ye,onEdgeUpdateEnd:ge});return()=>{const P=m(_.value.source),F=m(_.value.target),Q="pathOptions"in _.value?_.value.pathOptions:{};if(!P&&!F)return r.error(new ft(st.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!P)return r.error(new ft(st.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!F)return r.error(new ft(st.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||P.hidden||F.hidden)return null;let X;i.value===cn.Strict?X=P.handleBounds.source:X=[...P.handleBounds.source||[],...P.handleBounds.target||[]];const _e=Bm(X,_.value.sourceHandle);let he;i.value===cn.Strict?he=F.handleBounds.target:he=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const we=Bm(he,_.value.targetHandle),Ie=(_e==null?void 0:_e.position)||$e.Bottom,Y=(we==null?void 0:we.position)||$e.Top,{x:j,y:J}=$o(P,_e,Ie),{x:ve,y:Te}=$o(F,we,Y);return _.value.sourceX=j,_.value.sourceY=J,_.value.targetX=ve,_.value.targetY=Te,t.h("g",{ref:O,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${U.value===!1?"default":_.value.type||"default"}`,s.value,M.value,{updating:L.value,selected:_.value.selected,animated:_.value.animated,inactive:!y.value&&!b.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":v.value?`${pm}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",..._.value.domAttributes,onClick:se,onContextmenu:ke,onDblclick:Se,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onKeyDown:v.value?z:void 0},[x.value?null:t.h(U.value===!1?c.value.default:U.value,{id:e.id,sourceNode:P,targetNode:F,source:_.value.source,target:_.value.target,type:_.value.type,updatable:w.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...I},style:D.value,markerStart:`url('#${_i(_.value.markerStart,n)}')`,markerEnd:`url('#${_i(_.value.markerEnd,n)}')`,sourcePosition:Ie,targetPosition:Y,sourceX:j,sourceY:J,targetX:ve,targetY:Te,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...Q}),[w.value==="source"||w.value===!0?[t.h("g",{onMousedown:le,onMouseenter:ie,onMouseout:pe},t.h(cf,{position:Ie,centerX:j,centerY:J,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:ie,onMouseout:pe},t.h(cf,{position:Y,centerX:ve,centerY:Te,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ie(){L.value=!0}function pe(){L.value=!1}function ye(P,F){E.update({event:P,edge:_.value,connection:F})}function ge(P){E.updateEnd({event:P,edge:_.value}),x.value=!1}function me(P,F){P.button===0&&(x.value=!0,R.value=F?_.value.target:_.value.source,$.value=(F?_.value.targetHandle:_.value.sourceHandle)??null,B.value=F?"target":"source",E.updateStart({event:P,edge:_.value}),W(P))}function se(P){var F;const Q={event:P,edge:_.value};y.value&&(l.value=!1,_.value.selected&&f.value?(d([_.value]),(F=O.value)==null||F.blur()):o([_.value])),E.click(Q)}function ke(P){E.contextMenu({event:P,edge:_.value})}function Se(P){E.doubleClick({event:P,edge:_.value})}function ce(P){E.mouseEnter({event:P,edge:_.value})}function fe(P){E.mouseMove({event:P,edge:_.value})}function oe(P){E.mouseLeave({event:P,edge:_.value})}function le(P){me(P,!0)}function ue(P){me(P,!1)}function z(P){var F;!h.value&&hm.includes(P.key)&&y.value&&(P.key==="Escape"?((F=O.value)==null||F.blur(),d([u(e.id)])):o([u(e.id)]))}}}),JN=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=je(),p=(e=t.inject(Pa))==null?void 0:e["connection-line"],f=t.computed(()=>{var b;return m((b=i.value)==null?void 0:b.nodeId)}),h=t.computed(()=>{var b;return m((b=a.value)==null?void 0:b.nodeId)??null}),g=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),k=t.computed(()=>c.value.markerStart?`url(#${_i(c.value.markerStart,n)})`:""),N=t.computed(()=>c.value.markerEnd?`url(#${_i(c.value.markerEnd,n)})`:"");return()=>{var b,_,E;if(!f.value||!i.value)return null;const I=i.value.id,A=i.value.type,T=f.value.handleBounds;let L=(T==null?void 0:T[A])??[];if(o.value===cn.Loose){const D=(T==null?void 0:T[A==="source"?"target":"source"])??[];L=[...L,...D]}if(!L)return null;const x=(I?L.find(D=>D.id===I):L[0])??null,R=(x==null?void 0:x.position)??$e.Top,{x:$,y:B}=$o(f.value,x,R);let O=null;h.value&&(o.value===cn.Strict?O=((b=h.value.handleBounds[A==="source"?"target":"source"])==null?void 0:b.find(D=>{var U;return D.id===((U=a.value)==null?void 0:U.id)}))||null:O=((_=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:_.find(D=>{var U;return D.id===((U=a.value)==null?void 0:U.id)}))||null);const y=((E=a.value)==null?void 0:E.position)??(R?jl[R]:null);if(!R||!y)return null;const w=l.value??c.value.type??Yn.Bezier;let v="";const M={sourceX:$,sourceY:B,sourcePosition:R,targetX:g.value.x,targetY:g.value.y,targetPosition:y};return w===Yn.Bezier?[v]=nf(M):w===Yn.Step?[v]=Wl({...M,borderRadius:0}):w===Yn.SmoothStep?[v]=Wl(M):w===Yn.SimpleBezier?[v]=af(M):v=`M${$},${B} ${g.value.x},${g.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:$,sourceY:B,sourcePosition:R,targetX:g.value.x,targetY:g.value.y,targetPosition:y,sourceNode:f.value,sourceHandle:x,targetNode:h.value,targetHandle:O,markerEnd:N.value,markerStart:k.value,connectionStatus:d.value}):t.h("path",{d:v,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":N.value,"marker-start":k.value})))}}}),XN=["id","markerWidth","markerHeight","markerUnits","orient"],ZN={name:"MarkerType",compatConfig:{MODE:3}},QN=t.defineComponent({...ZN,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(Bl).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(Bl).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,XN))}}),ew={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},tw={name:"MarkerDefinitions",compatConfig:{MODE:3}},nw=t.defineComponent({...tw,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=je(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=_i(d,n);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.add(u))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const u of[d.markerStart,d.markerEnd])c(u);return s.sort((d,u)=>d.id.localeCompare(u.id))});return(l,s)=>(t.openBlock(),t.createElementBlock("svg",ew,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(QN,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),ow={name:"Edges",compatConfig:{MODE:3}},iw=t.defineComponent({...ow,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(nw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(R0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(WN),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(JN))],64))}}),aw=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:p,elevateNodesOnSelect:f,disableKeyboardA11y:h,ariaLiveMessage:g,snapToGrid:k,snapGrid:N,nodeDragThreshold:b,nodesDraggable:_,elementsSelectable:E,nodesConnectable:I,nodesFocusable:A,hooks:T}=je(),L=t.ref(null);t.provide(Ym,L),t.provide(Gm,e.id);const x=t.inject(Pa),R=t.getCurrentInstance(),$=Xm(),{node:B,parentNode:O}=Jm(e.id),{emit:y,on:w}=q0(B,l),v=t.toRef(()=>typeof B.draggable>"u"?_.value:B.draggable),M=t.toRef(()=>typeof B.selectable>"u"?E.value:B.selectable),D=t.toRef(()=>typeof B.connectable>"u"?I.value:B.connectable),U=t.toRef(()=>typeof B.focusable>"u"?A.value:B.focusable),W=t.computed(()=>M.value||v.value||T.value.nodeClick.hasListeners()||T.value.nodeDoubleClick.hasListeners()||T.value.nodeMouseEnter.hasListeners()||T.value.nodeMouseMove.hasListeners()||T.value.nodeMouseLeave.hasListeners()),ie=t.toRef(()=>!!B.dimensions.width&&!!B.dimensions.height),pe=t.computed(()=>{const F=B.type||"default",Q=x==null?void 0:x[`node-${F}`];if(Q)return Q;let X=B.template||m.value[F];if(typeof X=="string"&&R){const _e=Object.keys(R.appContext.components);_e&&_e.includes(F)&&(X=t.resolveComponent(F,!1))}return X&&typeof X!="string"?X:(l.error(new ft(st.NODE_TYPE_MISSING,X)),!1)}),ye=qm({id:e.id,el:L,disabled:()=>!v.value,selectable:M,dragHandle:()=>B.dragHandle,onStart(F){y.dragStart(F)},onDrag(F){y.drag(F)},onStop(F){y.dragStop(F)},onClick(F){z(F)}}),ge=t.computed(()=>B.class instanceof Function?B.class(B):B.class),me=t.computed(()=>{const F=(B.style instanceof Function?B.style(B):B.style)||{},Q=B.width instanceof Function?B.width(B):B.width,X=B.height instanceof Function?B.height(B):B.height;return!F.width&&Q&&(F.width=typeof Q=="string"?Q:`${Q}px`),!F.height&&X&&(F.height=typeof X=="string"?X:`${X}px`),F}),se=t.toRef(()=>Number(B.zIndex??me.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Se()}),t.onMounted(()=>{t.watch(()=>B.hidden,(F=!1,Q,X)=>{!F&&L.value&&(e.resizeObserver.observe(L.value),X(()=>{L.value&&e.resizeObserver.unobserve(L.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>B.type,()=>B.sourcePosition,()=>B.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])})}),t.watch([()=>B.position.x,()=>B.position.y,()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=O.value)==null?void 0:F.computedPosition.z},se,()=>B.selected,()=>B.dimensions.height,()=>B.dimensions.width,()=>{var F;return(F=O.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=O.value)==null?void 0:F.dimensions.width}],([F,Q,X,_e,he,we])=>{const Ie={x:F,y:Q,z:we+(f.value&&B.selected?1e3:0)};typeof X<"u"&&typeof _e<"u"?B.computedPosition=w0({x:X,y:_e,z:he},Ie):B.computedPosition=Ie},{flush:"post",immediate:!0}),t.watch([()=>B.extent,p],([F,Q],[X,_e])=>{(F!==X||Q!==_e)&&ke()}),B.extent==="parent"||typeof B.extent=="object"&&"range"in B.extent&&B.extent.range==="parent"?fl(()=>ie).toBe(!0).then(ke):ke(),()=>B.hidden?null:t.h("div",{ref:L,"data-id":B.id,class:["vue-flow__node",`vue-flow__node-${pe.value===!1?"default":B.type||"default"}`,{[o.value]:v.value,dragging:ye==null?void 0:ye.value,draggable:v.value,selected:B.selected,selectable:M.value,parent:B.isParent},ge.value],style:{visibility:ie.value?"visible":"hidden",zIndex:B.computedPosition.z??se.value,transform:`translate(${B.computedPosition.x}px,${B.computedPosition.y}px)`,pointerEvents:W.value?"all":"none",...me.value},tabIndex:U.value?0:void 0,role:U.value?"group":void 0,"aria-describedby":h.value?void 0:`${fm}-${n}`,"aria-label":B.ariaLabel,"aria-roledescription":"node",...B.domAttributes,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onContextmenu:le,onClick:z,onDblclick:ue,onKeydown:P},[t.h(pe.value===!1?m.value.default:pe.value,{id:B.id,type:B.type,data:B.data,events:{...B.events,...w},selected:B.selected,resizing:B.resizing,dragging:ye.value,connectable:D.value,position:B.computedPosition,dimensions:B.dimensions,isValidTargetPos:B.isValidTargetPos,isValidSourcePos:B.isValidSourcePos,parent:B.parentNode,parentNodeId:B.parentNode,zIndex:B.computedPosition.z??se.value,targetPosition:B.targetPosition,sourcePosition:B.sourcePosition,label:B.label,dragHandle:B.dragHandle,onUpdateNodeInternals:Se})]);function ke(){const F=B.computedPosition,{computedPosition:Q,position:X}=Fl(B,k.value?La(F,N.value):F,l.error,p.value,O.value);(B.computedPosition.x!==Q.x||B.computedPosition.y!==Q.y)&&(B.computedPosition={...B.computedPosition,...Q}),(B.position.x!==X.x||B.position.y!==X.y)&&(B.position=X)}function Se(){L.value&&d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])}function ce(F){ye!=null&&ye.value||y.mouseEnter({event:F,node:B})}function fe(F){ye!=null&&ye.value||y.mouseMove({event:F,node:B})}function oe(F){ye!=null&&ye.value||y.mouseLeave({event:F,node:B})}function le(F){return y.contextMenu({event:F,node:B})}function ue(F){return y.doubleClick({event:F,node:B})}function z(F){M.value&&(!i.value||!v.value||b.value>0)&&Kl(B,r.value,c,s,a,!1,L.value),y.click({event:F,node:B})}function P(F){if(!(Dl(F)||h.value))if(hm.includes(F.key)&&M.value){const Q=F.key==="Escape";Kl(B,r.value,c,s,a,Q,L.value)}else v.value&&B.selected&&Ro[F.key]&&(F.preventDefault(),g.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~B.position.x}, y: ${~~B.position.y}`,$({x:Ro[F.key].x,y:Ro[F.key].y},F.shiftKey))}}});function rw(e={includeHiddenNodes:!1}){const{nodes:n}=je();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const lw={class:"vue-flow__nodes vue-flow__container"},sw={name:"Nodes",compatConfig:{MODE:3}},cw=t.defineComponent({...sw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=je(),a=rw(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",lw,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(aw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=p,f},s,0),128)):t.createCommentVNode("",!0)]))}});function dw(){const{emits:e}=je();t.onMounted(()=>{if(zm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ft(st.MISSING_STYLES))}})}const uw=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),mw={name:"VueFlow",compatConfig:{MODE:3}},fw=t.defineComponent({...mw,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const i=e,a=t.useSlots(),r=pl(i,"modelValue",o),l=pl(i,"nodes",o),s=pl(i,"edges",o),c=je(i),d=Z0({modelValue:r,nodes:l,edges:s},i,c);return eN(o,c.hooks),GN(),dw(),t.provide(Pa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(zN,null,{default:t.withCtx(()=>[t.createVNode(iw),uw,t.createVNode(cw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(KN)],512))}}),pw={name:"Panel",compatConfig:{MODE:3}},df=t.defineComponent({...pw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=je(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),hw=["width","height","innerHTML"],yw=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(t.openBlock(),t.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:n[e.name]??""},null,8,hw))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ae=Ke(yw,[["__scopeId","data-v-05aac699"]]),Qn=["red","amber","green","teal","blue","indigo","violet","pink"],uf={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function gw(e){return typeof e=="string"&&e in uf}const bw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},_w=.15;function kw(e){const n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n)return null;let o=n[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function Ew(e){if(typeof e!="string")return null;const n=kw(e);if(!n||n.s<_w)return null;let o=null,i=1/0;for(const a of Qn){const r=Math.abs(n.h-bw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function _t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(gw(n))return n;const o=e==null?void 0:e.properties;return Ew((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Xl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Nw={red:"var(--em-swatch-red-bar)",amber:"var(--em-swatch-amber-bar)",green:"var(--em-swatch-green-bar)",teal:"var(--em-swatch-teal-bar)",blue:"var(--em-swatch-blue-bar)",indigo:"var(--em-swatch-indigo-bar)",violet:"var(--em-swatch-violet-bar)",pink:"var(--em-swatch-pink-bar)"},ww={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function mf(e,n=!1){return e?n?ww[e]:Nw[e]:null}function eo(e){return uf[e]}function To(e){return`var(--em-swatch-${e}-bar)`}function Iw(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function vw(e,n){const o=Iw(n);return o?e(o):n.split("-")[1]??n}function xw(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function ff(e,n){const o=xw(n);if(n.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=n.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,n.params)}function Cw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Sw={class:"em-inline-issue__msgs"},to=Ke(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode(Ae,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",Sw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(c,d)=>(t.openBlock(),t.createElementBlock("span",{key:d},t.toDisplayString(t.unref(ff)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Rw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Aw={key:0,class:"em-mlang__dot"},$w=["id","role","aria-labelledby"],Tw=["title"],dn=Ke(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const N=o.defaultLang;return N&&o.languages.includes(N)?N:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const N=o.activeLang;return N&&o.languages.includes(N)?N:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(N){var b,_;return!!((_=(b=o.modelValue)==null?void 0:b[N])!=null&&_.trim())}const d=N=>`${o.name}-tab-${N}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(N){var E,I;const b=o.languages,_=b[(N+b.length)%b.length];_&&(l.value=_,await t.nextTick(),(I=(E=m.value)==null?void 0:E.querySelectorAll('[role="tab"]')[b.indexOf(_)])==null||I.focus())}function f(N){p(o.languages.indexOf(s.value)+N)}const h=t.computed(()=>o.languages.filter(N=>{var b,_;return N!==s.value&&!!((_=(b=o.modelValue)==null?void 0:b[N])!=null&&_.trim())})),g=t.computed(()=>{var N;return((N=o.modelValue)==null?void 0:N[s.value])??""});function k(N){const b={...o.modelValue};N.trim()===""?delete b[s.value]:b[s.value]=N,i("update:modelValue",b)}return(N,b)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,_=>(t.openBlock(),t.createElementBlock("span",{id:d(_),key:_,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===_}]),role:"tab","aria-selected":s.value===_,"aria-controls":u.value,tabindex:s.value===_?0:-1,onClick:E=>l.value=_,onKeydown:[t.withKeys(t.withModifiers(E=>l.value=_,["prevent"]),["enter"]),t.withKeys(t.withModifiers(E=>l.value=_,["prevent"]),["space"]),b[0]||(b[0]=t.withKeys(t.withModifiers(E=>f(-1),["prevent"]),["left"])),b[1]||(b[1]=t.withKeys(t.withModifiers(E=>f(1),["prevent"]),["right"])),b[2]||(b[2]=t.withKeys(t.withModifiers(E=>p(0),["prevent"]),["home"])),b[3]||(b[3]=t.withKeys(t.withModifiers(E=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(_),1),c(_)?(t.openBlock(),t.createElementBlock("span",Aw,"•")):t.createCommentVNode("",!0)],42,Rw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(ee.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":k},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":k},null,8,["name","placeholder","model-value"]))],8,$w),r.value&&h.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:h.value.join(", "),"aria-hidden":"true"},"•",8,Tw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Mw=["disabled"],Vw={class:"em-panel__sub-label"},Bw={class:"em-field"},Dw={class:"em-field"},Ow={class:"em-field"},Lw={class:"em-class"},Pw={class:"em-field"},zw={class:"em-field"},Fw={class:"em-field"},Uw={class:"em-field"},Hw={class:"em-multilang"},jw={class:"em-multilang"},Kw={class:"em-jpa"},Gw={class:"em-field"},Yw={class:"em-field"},qw={class:"em-field"},Ww=["title"],Jw={class:"em-swatch"},Xw={class:"em-swatch__row"},Zw=["title"],Qw=["title","onClick"],pf=Ke(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(O=>O.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(O=>O.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var O;return _t(((O=l.value)==null?void 0:O.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],m=O=>O;function p(O){return O==="inherit"?a.t("em.common.inherit"):O}function f(O){r.value&&a.updateEntity(r.value.modelId,O)}function h(O,y,w){var M;const v=((M=r.value)==null?void 0:M.table)??{physicalName:""};f(O==="physicalName"?{table:{...v,physicalName:w}}:{table:{...v,logicalName:{...v.logicalName,[y]:w}}})}function g(O){f({description:Object.keys(O).length?O:void 0})}function k(O,y){var w;f({jpaAttrs:{...(w=r.value)==null?void 0:w.jpaAttrs,[O]:y}})}function N(O,y){k(O,y)}const b=t.computed(()=>{var O,y;return((y=(O=r.value)==null?void 0:O.jpaAttrs)==null?void 0:y.discriminatorType)??"inherit"}),_=t.computed(()=>{var O,y;return!((y=(O=r.value)==null?void 0:O.jpaAttrs)!=null&&y.useDiscriminator)});function E(O){k("discriminatorType",O==="inherit"?void 0:O)}function I(O){f({hasPersonalInfo:O})}function A(O){f({referenceOnly:O?!0:void 0})}function T(O){f({superClass:O.trim()||void 0})}function L(O){f({schema:O.trim()||void 0})}function x(O){f({abstractClass:O})}const R=t.computed(()=>{var O,y;return((y=(O=r.value)==null?void 0:O.declarationOfInterfaces)==null?void 0:y.join(", "))??""});function $(O){const y=O.split(",").map(w=>w.trim()).filter(Boolean);f({declarationOfInterfaces:y.length?y:void 0})}function B(O){r.value&&a.setEntitySwatch(r.value.modelId,O)}return(O,y)=>{var w,v,M;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:y[0]||(y[0]=D=>i("toggle"))},[t.createElementVNode("span",Vw,[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(to,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Bw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":y[1]||(y[1]=D=>f({name:D}))},null,8,["model-value"])]),t.createElementVNode("label",Dw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(Ko),"onUpdate:modelValue":y[2]||(y[2]=D=>f({stereotype:D}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Ow,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":y[3]||(y[3]=D=>f({packageName:D}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Lw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Pw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":y[4]||(y[4]=D=>T(D))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",zw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":R.value,"onUpdate:modelValue":y[5]||(y[5]=D=>$(D))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":y[6]||(y[6]=D=>x(D))},null,8,["label","model-value"])]),t.createElementVNode("label",Fw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-table",width:"100%","model-value":((w=r.value.table)==null?void 0:w.physicalName)??"","onUpdate:modelValue":y[7]||(y[7]=D=>h("physicalName",null,D))},null,8,["model-value"])]),t.createElementVNode("label",Uw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":y[8]||(y[8]=D=>L(D))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",Hw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,D=>{var U,W;return t.openBlock(),t.createElementBlock("label",{key:D,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(D),1),t.createVNode(t.unref(ee.BSTextInput),{name:`ent-logical-${D}`,width:"100%","model-value":((W=(U=r.value.table)==null?void 0:U.logicalName)==null?void 0:W[D])??"","onUpdate:modelValue":ie=>h("logicalName",D,ie)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Kw,[y[13]||(y[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,D=>{var U;return t.createVNode(t.unref(ee.BSCheckbox),{key:D.key,name:`jpa-${D.key}`,class:"em-check",label:D.label,"model-value":!!((U=r.value.jpaAttrs)!=null&&U[D.key]),"onUpdate:modelValue":W=>N(D.key,W)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Gw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:_.value,"model-value":((v=r.value.jpaAttrs)==null?void 0:v.discriminatorColumnName)??"","onUpdate:modelValue":y[9]||(y[9]=D=>k("discriminatorColumnName",D.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",Yw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(ee.BSSelect),{disabled:_.value,"model-value":b.value,items:u,"value-provider":m,"label-provider":p,"onUpdate:modelValue":y[10]||(y[10]=D=>D&&E(D))},null,8,["disabled","model-value"])]),t.createElementVNode("label",qw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(ee.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:_.value,"model-value":(M=r.value.jpaAttrs)==null?void 0:M.discriminatorLength,"onUpdate:modelValue":y[11]||(y[11]=D=>k("discriminatorLength",D||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":I},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":A},null,8,["label","model-value"])],8,Ww),t.createElementVNode("fieldset",Jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",Xw,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:y[12]||(y[12]=D=>B(null))},"∅",10,Zw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),D=>(t.openBlock(),t.createElementBlock("button",{key:D,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===D}]),style:t.normalizeStyle({background:t.unref(To)(D)}),title:t.unref(a).t(t.unref(eo)(D)),onClick:U=>B(D)},null,14,Qw))),128))])])],64)):t.createCommentVNode("",!0)],8,Mw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),eI=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"],hf=["inherit","true","false"],Ya="__OWN__";function yf(e,n){const o=t.computed(()=>e.state.logical.entities.find(K=>K.modelId===n())??null),i=t.computed(()=>{var K;return((K=o.value)==null?void 0:K.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(K){return K==="none"?e.t("em.common.noneParen"):K}const l=K=>K;function s(K,te){o.value&&e.updateAttribute(o.value.modelId,K.modelId,te)}function c(K){return!!o.value&&!!Ji(e.state.logical,o.value.modelId,K.modelId)}function d(K,te){s(K,{naturalId:te||void 0,naturalIdMutable:te?K.naturalIdMutable:void 0})}function u(){return{naturalId:void 0,naturalIdMutable:void 0}}function m(K,te){s(K,{identifier:te,...te?u():{}})}function p(K,te){s(K,{transient:te||void 0,...te?u():{}})}function f(K){return!!K.transient||K.attrType==="RELATION_REF"}function h(K){return Oi(K)}function g(K,te=0){var G;return((G=Li(K,o.value,e.state.logical.entities,e.state.logical.associations,te))==null?void 0:G.physicalName)||void 0}const k=K=>K.value,N=K=>K.label;function b(K,te){if(!te)return;const G=$.value.find(ae=>ae.type===te);if(G){const ae=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};s(K,{type:te,customType:void 0,dbAttrs:[{...ae,dataType:G.dataType,length:G.length,scale:G.scale}]});return}s(K,te===tn?{type:te}:{type:te,customType:void 0})}function _(K,te){s(K,{customType:te.trim()===""?void 0:te})}function E(K,te){if(K.attrType==="RELATION_REF")return;const ae={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...te};te.dataType!==void 0&&!Rr.has(ae.dataType)&&(ae.scale=void 0),s(K,{dbAttrs:[ae]})}function I(K){var te;return Rr.has(((te=K.dbAttrs[0])==null?void 0:te.dataType)??"")}function A(K){return!I(K)&&!h(K)&&!f(K)?e.t("em.attr.scaleTypeHint"):void 0}function T(K,te){E(K,{logicalName:Object.keys(te).length?te:void 0})}function L(K,te){s(K,{description:Object.keys(te).length?te:void 0})}function x(K){return K.personalInfoAttributeType??"none"}function R(K,te){s(K,{personalInfoAttributeType:te==="none"?void 0:te})}const $=t.computed(()=>e.predefinedCustomTypeCatalog.value),B=t.computed(()=>e.embeddableCatalog.value);function O(K){var te,G,ae;return((te=K.label)==null?void 0:te[e.userLanguage.value])??((G=K.label)==null?void 0:G.ko)??((ae=K.label)==null?void 0:ae.en)??K.type}const y=t.computed(()=>e.groupCodeCatalog.value);function w(K){var te;return((te=y.value.find(G=>G.groupCode===K.groupCode))==null?void 0:te.codes)??[]}function v(K){return["none",...w(K)]}function M(K){return K==="none"?"none":K.code}function D(K){var G,ae,Be;if(K==="none")return e.t("em.common.noneParen");const te=((G=K.label)==null?void 0:G[e.userLanguage.value])??((ae=K.label)==null?void 0:ae.ko)??((Be=K.label)==null?void 0:Be.en);return te?`${K.code} (${te})`:K.code}function U(K,te){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,te)}function W(K,te){s(K,{defaultValue:te==="none"?void 0:te})}function ie(K,te){s(K,{defaultValue:te.trim()===""?void 0:te})}function pe(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}function ye(K,te,G){const ae=K.dbAttrs.map((Be,Ve)=>{if(Ve!==te)return Be;const H={...Be,...G};for(const V of Object.keys(G))G[V]===void 0&&delete H[V];return H});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,ae)}function ge(K,te,G){ye(K,te,{logicalName:Object.keys(G).length?G:void 0})}function me(K,te){var Be,Ve,H;if(K.attrType==="EMBED_PREDEF"){const V=(Be=e.embeddableCatalog.value.find(Pe=>Pe.type===K.type))==null?void 0:Be.fields[te];return V?{name:V.name,physicalName:V.physicalName,dataType:V.dataType,length:V.length,scale:V.scale,shareable:V.shareable,logicalName:V.logicalName}:void 0}const G=(Ve=K.embedded)==null?void 0:Ve.embeddableRef;if(!G)return;const ae=(H=e.state.logical.entities.find(V=>V.modelId===G))==null?void 0:H.attributes.flatMap(V=>V.dbAttrs)[te];return ae?{physicalName:ae.physicalName,dataType:ae.dataType,length:ae.length,scale:ae.scale,logicalName:ae.logicalName}:void 0}function se(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.dataType)||((ae=K.dbAttrs[te])==null?void 0:ae.dataType)||""}function ke(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.length)??((ae=K.dbAttrs[te])==null?void 0:ae.length)}function Se(K,te){var G,ae;return((G=me(K,te))==null?void 0:G.scale)??((ae=K.dbAttrs[te])==null?void 0:ae.scale)}const ce=hf;function fe(K){return K==="inherit"?e.t("em.common.inherit"):K}function oe(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function le(K,te,G){ye(K,te,{updatable:G==="inherit"?void 0:G==="true"})}function ue(K,te){E(K,{updatable:te==="inherit"?void 0:te==="true"})}const z=hf;function P(K){return K==="inherit"?e.t("em.common.inherit"):K}function F(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function Q(K,te,G){ye(K,te,{insertable:G==="inherit"?void 0:G==="true"})}function X(K,te){E(K,{insertable:te==="inherit"?void 0:te==="true"})}const _e=t.computed(()=>o.value?Nr(o.value,e.state.logical.entities):[]),he=t.computed(()=>so(_e.value.flatMap(K=>K.attributes.flatMap(te=>te.dbAttrs)))),we=t.computed(()=>_e.value.flatMap(K=>K.attributes.filter(te=>te.attrType==="NORMAL"&&te.dbAttrs.length===1&&te.dbAttrs[0]).map(te=>{var G;return{modelId:te.dbAttrs[0].modelId,physical:te.dbAttrs[0].physicalName||te.name,isCurrency:te.type==="Currency",ownerName:K.modelId===((G=o.value)==null?void 0:G.modelId)?void 0:K.name}})));function Ie(){const K=[...we.value].sort((te,G)=>Number(G.isCurrency)-Number(te.isCurrency));return[Ya,...K.map(te=>te.modelId)]}function Y(K){if(K===Ya)return e.t("em.attr.sharedOwn");const te=we.value.find(ae=>ae.modelId===K);if(!te)return K;const G=te.ownerName?`${te.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:G,physical:te.physical,mode:te.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function j(K){return(K==null?void 0:K.sharedColumnRef)??Ya}function J(K,te,G){ye(K,te,{sharedColumnRef:G===Ya?void 0:G})}function ve(K){return(K==null?void 0:K.sharedColumnRef)!=null}function Te(K){var te;return((te=Bn(K,he.value))==null?void 0:te.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:eI,piiLabel:r,idn:l,setAttr:s,isManagedFk:c,setNaturalId:d,clearNaturalIdPatch:u,setIdentifier:m,setTransient:p,dbLocked:f,fkDerived:h,fkOriginPhysical:g,typeValueOf:k,typeLabelOf:N,setAttrType:b,setAttrCustomType:_,setDb:E,scaleApplicable:I,scaleHint:A,setDbLogical:T,setAttrDescription:L,attrPiiValue:x,setAttrPii:R,predefinedCustomTypeCatalog:$,embeddableCatalog:B,predefinedLabel:O,groupCodeCatalog:y,attrGroupCodes:w,attrCodeItems:v,codeValueOf:M,codeLabelOf:D,setAttrGroupCode:U,setAttrCode:W,setAttrDefaultValue:ie,isEmbedExpanded:pe,setDbAt:ye,setDbLogicalAt:ge,embedColMeta:me,fixedDataType:se,fixedLength:ke,fixedScale:Se,updatableItems:ce,updatableLabel:fe,updatableValue:oe,setUpdatableAt:le,setUpdatable:ue,insertableItems:z,insertableLabel:P,insertableValue:F,setInsertableAt:Q,setInsertable:X,scopeEntities:_e,columnsById:he,sharedCandidates:we,sharedItems:Ie,sharedLabel:Y,sharedValue:j,setSharedAt:J,isShared:ve,sharedPhysical:Te}}const gf={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every embedded column in this entity","em.node.embedAllShow":"Expand all collapsed embedded columns","em.node.embedAllSummary":"{n} embedded column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},bf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティの埋め込み列をすべて折りたたむ","em.node.embedAllShow":"折りたたまれた埋め込み列をすべて展開","em.node.embedAllSummary":"埋め込み列 {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},_f={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 임베드 컬럼 모두 접기","em.node.embedAllShow":"접힌 임베드 컬럼 모두 펼치기","em.node.embedAllSummary":"임베드 컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},tI=["ko","en","ja"],Zl={ko:_f,en:gf,ja:bf};function Dt(e,n,o){let a=(Zl[e]??Zl.ko)[n]??Zl.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const kf=["ko","en","ja","zh"];function nI(e){if(e)for(const n of kf){const o=e[n];if(o)return o}}function Ql(e){const n=nI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function oI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:kf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const iI=["aria-expanded","placeholder"],aI=["aria-selected","onClick","onMouseenter"],rI={key:0,class:"gcc__opt gcc__opt--empty"},Ef=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(x,R)=>Dt(o.locale??"ko",x,R),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),p=t.computed(()=>o.items.find(x=>x.groupCode===o.modelValue)),f=t.computed(()=>p.value?Ql(p.value):"");t.watch(f,x=>{d.value||(c.value=x)},{immediate:!0});const h=t.computed(()=>c.value===f.value?o.items:oI(o.items,c.value));function g(){var R;const x=(R=r.value)==null?void 0:R.getBoundingClientRect();x&&(m.value={left:`${x.left}px`,top:`${x.bottom}px`,width:`${x.width}px`})}function k(){d.value=!0,g(),u.value=Math.max(0,h.value.findIndex(x=>x.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",L)}function N(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",L)}t.onBeforeUnmount(N);function b(){k(),t.nextTick(()=>{var x;return(x=l.value)==null?void 0:x.select()})}function _(){d.value||k(),u.value=0}function E(x){i("update:modelValue",x.groupCode),c.value=Ql(x),N()}function I(){i("update:modelValue",void 0),c.value="",N()}function A(){c.value.trim()===""?I():(c.value=f.value,N())}function T(x){var R;if(x.key==="ArrowDown")d.value||k(),u.value=Math.min(u.value+1,h.value.length-1),x.preventDefault();else if(x.key==="ArrowUp")u.value=Math.max(u.value-1,0),x.preventDefault();else if(x.key==="Enter"){const $=h.value[u.value];$&&E($),x.preventDefault()}else x.key==="Escape"&&(c.value=f.value,N(),(R=l.value)==null||R.blur())}function L(x){var $,B;const R=x.target;!(($=r.value)!=null&&$.contains(R))&&!((B=s.value)!=null&&B.contains(R))&&A()}return(x,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":R[0]||(R[0]=$=>c.value=$),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:b,onInput:_,onKeydown:T},null,40,iI),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:R[1]||(R[1]=t.withModifiers(()=>{},["prevent"])),onClick:I},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,($,B)=>(t.openBlock(),t.createElementBlock("li",{key:$.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":B===u.value,"is-selected":$.groupCode===e.modelValue}]),role:"option","aria-selected":$.groupCode===e.modelValue,onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["prevent"])),onClick:O=>E($),onMouseenter:O=>u.value=B},t.toDisplayString(t.unref(Ql)($)),43,aI))),128)),h.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",rI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),lI=["aria-labelledby"],sI=["aria-checked","tabindex","onClick","onKeydown"],Nf=Ke(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,sI))),128))],8,lI))}}),[["__scopeId","data-v-5c793bbb"]]),cI=["disabled"],dI={class:"em-aw__toolbar"},uI={class:"em-aw__count"},mI={class:"em-aw__scroll"},fI={class:"em-aw__table"},pI={class:"c-name"},hI={class:"c-type"},yI={class:"c-logical"},gI=["id"],bI={class:"c-col"},_I={class:"c-constraints"},kI={class:"c-del"},EI={class:"c-expand"},NI=["title","onClick","onKeydown"],wI=["title"],II={key:1,class:"em-aw__muted"},vI=["title"],xI=["title"],CI=["title"],SI={class:"em-aw__cflags"},RI=["title"],AI={colspan:"8"},$I={class:"em-aw__detail"},TI={class:"em-aw__dgroup"},MI=["title"],VI={class:"em-aw__df"},BI={class:"em-aw__df"},DI={class:"em-aw__dgroup"},OI={key:0,class:"em-aw__dgroup"},LI={class:"em-aw__df"},PI={key:0,class:"em-aw__df"},zI={class:"em-aw__df"},FI={class:"em-aw__dgroup em-aw__ddesc"},UI={class:"c-expand"},HI={class:"em-aw__caret is-static","aria-hidden":"true"},jI={class:"c-del"},KI={class:"c-expand"},GI=["title","onClick","onKeydown"],YI={class:"em-aw__embed-label"},qI=["title"],WI=["title"],JI={class:"em-aw__ro"},XI=["title"],ZI={class:"em-aw__ro"},QI=["title"],ev={class:"em-aw__ro"},tv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},nv={colspan:"8"},ov={class:"em-aw__detail"},iv={class:"em-aw__dgroup"},av={key:0,class:"em-aw__df"},rv={class:"em-aw__df"},lv={class:"em-aw__df"},sv={key:0},cv={colspan:"99",class:"em-aw__empty"},dv=6,uv=5,mv=Ke(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:p,setTransient:f,dbLocked:h,fkDerived:g,fkOriginPhysical:k,typeValueOf:N,typeLabelOf:b,setAttrType:_,setAttrCustomType:E,setDb:I,scaleApplicable:A,scaleHint:T,setDbLogical:L,attrPiiValue:x,setAttrPii:R,predefinedCustomTypeCatalog:$,embeddableCatalog:B,predefinedLabel:O,groupCodeCatalog:y,attrGroupCodes:w,attrCodeItems:v,codeValueOf:M,codeLabelOf:D,setAttrGroupCode:U,setAttrCode:W,setAttrDefaultValue:ie,setAttrDescription:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:z,insertableItems:P,insertableLabel:F,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:Y,isShared:j,sharedPhysical:J}=yf(o,()=>n.entityId),ve=t.computed(()=>{var Ve;return[...((Ve=i.value)==null?void 0:Ve.attributes)??[]].sort((H,V)=>H.order-V.order)}),Te=t.computed(()=>{var Ve;return(((Ve=i.value)==null?void 0:Ve.attributes)??[]).filter(H=>H.attrType!=="DIVIDER").length}),K=t.ref(new Set);function te(Ve){return K.value.has(Ve)}function G(Ve){const H=new Set(K.value);H.has(Ve)?H.delete(Ve):H.add(Ve),K.value=H}const ae=t.ref(o.userLanguage.value);function Be(Ve){!Ve||!i.value||o.addPredefinedEmbed(i.value.modelId,Ve)}return(Ve,H)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",dI,[t.createElementVNode("span",uI,t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:H[0]||(H[0]=V=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:H[1]||(H[1]=V=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(B).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(B),"value-provider":V=>V.type,"label-provider":t.unref(O),"onUpdate:modelValue":Be},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",mI,[t.createElementVNode("table",fI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[H[3]||(H[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",pI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",hI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",yI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,gI),t.createVNode(Nf,{modelValue:ae.value,"onUpdate:modelValue":H[2]||(H[2]=V=>ae.value=V),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",bI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),H[4]||(H[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),H[5]||(H[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",_I,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),H[6]||(H[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value,V=>{var Pe,Ze,Ue,Le,De,Z,dt,yn,Et,gn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:V.modelId},[V.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(V.modelId)}])},[H[7]||(H[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-divlabel-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:dv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",kI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])])],2)):t.unref(ye)(V)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(V.modelId)}])},[t.createElementVNode("td",UI,[t.createElementVNode("span",HI,[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-type-${V.modelId}`,width:"100%",disabled:"","model-value":V.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:uv,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:V.dbAttrs.length})),1),t.createElementVNode("td",jI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.dbAttrs,(Ee,at)=>{var zt,ut,Qt,en,Ne,et,Ft,pt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":te(Ee.modelId)}])},[t.createElementVNode("td",KI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(Ee.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(Ee.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:nt=>G(Ee.modelId),onKeydown:[t.withKeys(t.withModifiers(nt=>G(Ee.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(nt=>G(Ee.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,GI)]),t.createElementVNode("td",YI,"↳ "+t.toDisplayString(((zt=t.unref(se)(V,at))==null?void 0:zt.name)??((ut=t.unref(se)(V,at))==null?void 0:ut.physicalName)??t.unref(o).t("em.attr.colFallback",{n:at+1})),1),H[14]||(H[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(dn,{name:`aw-embed-logical-${Ee.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:((en=(Qt=t.unref(se)(V,at))==null?void 0:Qt.logicalName)==null?void 0:en[ae.value])??((et=(Ne=t.unref(se)(V,at))==null?void 0:Ne.logicalName)==null?void 0:et.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ee.logicalName,"onUpdate:modelValue":nt=>t.unref(me)(V,at,nt)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(j)(Ee)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-embed-col-${Ee.modelId}`,width:"100%",disabled:t.unref(j)(Ee),placeholder:((Ft=t.unref(se)(V,at))==null?void 0:Ft.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(j)(Ee)?t.unref(J)(Ee):Ee.physicalName,"onUpdate:modelValue":nt=>t.unref(ge)(V,at,{physicalName:nt})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(to,{controller:t.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"])],8,qI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",JI,t.toDisplayString(t.unref(ke)(V,at)),1)],8,WI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",ZI,t.toDisplayString(t.unref(Se)(V,at)??""),1)],8,XI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",ev,t.toDisplayString(t.unref(ce)(V,at)!=null?`scale ${t.unref(ce)(V,at)}`:""),1)],8,QI),H[15]||(H[15]=t.createElementVNode("td",null,null,-1))],2),te(Ee.modelId)?(t.openBlock(),t.createElementBlock("tr",tv,[H[18]||(H[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",nv,[t.createElementVNode("div",ov,[t.createElementVNode("fieldset",iv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(pt=t.unref(se)(V,at))!=null&&pt.shareable?(t.openBlock(),t.createElementBlock("label",av,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(Ie)(Ee),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":nt=>nt&&t.unref(Y)(V,at,nt)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",rv,[H[16]||(H[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ee),"model-value":t.unref(j)(Ee)?"false":t.unref(Q)(Ee),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":nt=>nt&&t.unref(X)(V,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",lv,[H[17]||(H[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ee),"model-value":t.unref(j)(Ee)?"false":t.unref(le)(Ee),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":nt=>nt&&t.unref(ue)(V,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(r).has(V.modelId),"em-aw__open":te(V.modelId)})},[t.createElementVNode("td",EI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(V.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(V.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:Ee=>G(V.modelId),onKeydown:[t.withKeys(t.withModifiers(Ee=>G(V.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Ee=>G(V.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,NI)]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":Ee=>t.unref(d)(V,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-type-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!V.groupCode||V.attrType==="RELATION_REF"||t.unref(g)(V),items:t.unref(ec)(V.type,t.unref($)),"value-provider":t.unref(N),"label-provider":t.unref(b),"model-value":V.type,"onUpdate:modelValue":Ee=>t.unref(_)(V,Ee)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),V.type===t.unref(tn)&&!t.unref(g)(V)?(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:0,name:`aw-customtype-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":V.customType??"","onUpdate:modelValue":Ee=>t.unref(E)(V,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,wI),t.createElementVNode("td",null,[V.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(dn,{key:0,name:`aw-logical-${V.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Pe=V.dbAttrs[0])==null?void 0:Pe.logicalName,"onUpdate:modelValue":Ee=>t.unref(L)(V,Ee)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",II,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-col-${V.modelId}`,width:"100%",placeholder:t.unref(k)(V)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(h)(V),"model-value":((Ze=V.dbAttrs[0])==null?void 0:Ze.physicalName)??"","onUpdate:modelValue":Ee=>t.unref(I)(V,{physicalName:Ee})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(to,{controller:t.unref(o),"ref-id":(Ue=V.dbAttrs[0])==null?void 0:Ue.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-dtype-${V.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(h)(V)||t.unref(g)(V),items:t.unref(Xs)(((Le=V.dbAttrs[0])==null?void 0:Le.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Sr),"model-value":((De=V.dbAttrs[0])==null?void 0:De.dataType)??"","onUpdate:modelValue":Ee=>Ee&&t.unref(I)(V,{dataType:Ee})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,vI),t.createElementVNode("td",{title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-len-${V.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(h)(V)||t.unref(g)(V),"model-value":(Z=V.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":Ee=>t.unref(I)(V,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,xI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(g)(V)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",SI,[t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-pk-${V.modelId}`,label:"PK","model-value":V.identifier,disabled:t.unref(a)||t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(p)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nn-${V.modelId}`,label:"NN","model-value":V.notNull,disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(d)(V,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-uq-${V.modelId}`,label:"UQ","model-value":!!((dt=V.dbAttrs[0])!=null&&dt.unique),disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(I)(V,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,CI),t.createElementVNode("td",{class:"c-del",title:t.unref(u)(V)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,V.modelId)},null,8,["onClick"])],8,RI)],2),te(V.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(V.modelId)}])},[H[13]||(H[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",AI,[t.createElementVNode("div",$I,[t.createElementVNode("fieldset",TI,[H[11]||(H[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(T)(V)},[H[8]||(H[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-scale-${V.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(h)(V)||t.unref(g)(V)||!t.unref(A)(V),"model-value":(yn=V.dbAttrs[0])==null?void 0:yn.scale,"onUpdate:modelValue":Ee=>t.unref(I)(V,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,MI),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-ai-${V.modelId}`,label:"Auto Increment","model-value":!!((Et=V.dbAttrs[0])!=null&&Et.autoIncrement),disabled:t.unref(h)(V)||t.unref(g)(V)||!V.identifier,"onUpdate:modelValue":Ee=>t.unref(I)(V,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",VI,[H[9]||(H[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-ins-${V.modelId}`,width:"110px",disabled:t.unref(h)(V),"model-value":t.unref(Q)(V.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ee=>Ee&&t.unref(_e)(V,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",BI,[H[10]||(H[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-upd-${V.modelId}`,width:"110px",disabled:t.unref(h)(V),"model-value":t.unref(le)(V.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ee=>Ee&&t.unref(z)(V,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",DI,[H[12]||(H[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-tr-${V.modelId}`,label:"@Transient","model-value":!!V.transient,disabled:V.identifier||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(f)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nid-${V.modelId}`,label:"@NaturalId","model-value":!!V.naturalId,disabled:V.identifier||t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(m)(V,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${V.modelId}`,label:"mutable","model-value":!!V.naturalIdMutable,disabled:t.unref(h)(V)||!V.naturalId,"onUpdate:modelValue":Ee=>t.unref(d)(V,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-mv-${V.modelId}`,label:"Multi-Value (Set)","model-value":!!((gn=V.dbAttrs[0])!=null&&gn.multiValue),disabled:t.unref(h)(V)||t.unref(g)(V),"onUpdate:modelValue":Ee=>t.unref(I)(V,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(g)(V)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",OI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",LI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(x)(V),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ee=>Ee&&t.unref(R)(V,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(y).length?(t.openBlock(),t.createElementBlock("label",PI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Ef,{"model-value":V.groupCode,items:t.unref(y),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ee=>t.unref(U)(V,Ee)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",zI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(w)(V).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"150px","model-value":V.defaultValue??"none",items:t.unref(v)(V),"value-provider":t.unref(M),"label-provider":t.unref(D),"onUpdate:modelValue":Ee=>Ee&&t.unref(W)(V,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`aw-default-${V.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":V.defaultValue??"","onUpdate:modelValue":Ee=>t.unref(ie)(V,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",FI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`aw-desc-${V.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":V.description,"onUpdate:modelValue":Ee=>t.unref(pe)(V,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",sv,[t.createElementVNode("td",cv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,cI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-559a29b3"]]);function es(e,n){return n&&n!==e?`${e} (${n})`:e}function wf(e,n,o){const i=e.dbAttrs[n];return i?Go(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function If(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):es(o,wf(e,0,n))}function vf(e,n){var l;if(Mn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?es(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 es(i,wf(o,r<0?0:r,n))}const fv=["disabled"],pv={class:"em-idxw__list"},hv={class:"em-idxw__list-head"},yv=["aria-label"],gv=["aria-current","onClick","onKeydown"],bv={class:"em-idxw__item-name"},_v={key:0,class:"em-idxw__badge"},kv={class:"em-idxw__item-cnt"},Ev={key:0,class:"em-idxw__empty"},Nv={key:0,class:"em-idxw__edit"},wv={class:"em-idxw__form"},Iv={class:"em-field em-idxw__name"},vv={class:"em-field"},xv=["value","placeholder"],Cv={class:"em-idxw__transfer"},Sv={class:"em-idxw__pane"},Rv={class:"em-idxw__pane-head"},Av=["aria-label"],$v=["aria-pressed","onClick","onKeydown"],Tv=["title"],Mv={key:0,class:"em-idxw__empty"},Vv={class:"em-idxw__arrows"},Bv={class:"em-idxw__pane"},Dv={class:"em-idxw__pane-head"},Ov={class:"em-idxw__col-name"},Lv=["title"],Pv={class:"em-idxw__col-ops"},zv=["title","disabled","onClick"],Fv=["title","disabled","onClick"],Uv=["title","onClick"],Hv={key:0,class:"em-idxw__empty"},jv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Kv=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(y=>y.modelId===n.entityId)??null),a=t.computed(()=>{var y;return((y=i.value)==null?void 0:y.indexes)??[]}),r=t.computed(()=>{var y;return((y=i.value)==null?void 0:y.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,y=>{var w;y.some(v=>v.modelId===s.value)||(s.value=((w=y[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(y=>y.modelId===s.value)??null),d=t.computed(()=>i.value?jo(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Tn(r.value)),m=y=>u.value.canon(y),p=t.computed(()=>{var y;return new Set((((y=c.value)==null?void 0:y.columns)??[]).map(w=>m(w.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function h(y){return If(y,f.value)}function g(y){return y.physicalName&&y.physicalName!==y.field?`${y.field} (${y.physicalName})`:y.field}function k(y){return vf(y,f.value)}const N=t.computed(()=>[...r.value.filter(y=>y.dbAttrs.length>0&&!p.value.has(m(y.modelId))).map(y=>({ref:y.modelId,label:h(y),inherited:!1})),...d.value.filter(y=>!p.value.has(m(y.modelId))).map(y=>({ref:y.modelId,label:g(y),inherited:!0}))]),b=t.ref(new Set);t.watch(s,()=>b.value=new Set);function _(y){return Mn(y)}function E(y,w){i.value&&o.updateIndex(i.value.modelId,y,w)}function I(){var w;if(!i.value)return;const y=Me();o.addIndex(i.value.modelId,{modelId:y,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=y}function A(y){i.value&&o.removeIndex(i.value.modelId,y)}function T(y){c.value&&E(c.value.modelId,{parameters:y.trim()===""?void 0:y})}function L(y){const w=new Set(b.value);w.has(y)?w.delete(y):w.add(y),b.value=w}function x(){const y=c.value;if(!y||!b.value.size)return;const w=[...b.value].map(v=>({columnRef:v,descending:!1}));E(y.modelId,{columns:[...y.columns,...w]}),b.value=new Set}function R(y){const w=c.value;w&&E(w.modelId,{columns:w.columns.filter((v,M)=>M!==y)})}function $(y,w){const v=c.value;v&&E(v.modelId,{columns:v.columns.map((M,D)=>D===y?{...M,descending:w}:M)})}function B(y,w){const v=c.value;if(!v)return;const M=y+w;if(M<0||M>=v.columns.length)return;const D=[...v.columns];[D[y],D[M]]=[D[M],D[y]],E(v.modelId,{columns:D}),O(M,w)}async function O(y,w){var W,ie;await t.nextTick();const v=(W=l.value)==null?void 0:W.querySelectorAll(".em-idxw__col--idx")[y];if(!v)return;const M=pe=>v.querySelector(`[data-move="${pe}"]`),D=M(w<0?"up":"down"),U=M(w<0?"down":"up");(ie=D&&!D.disabled?D:U)==null||ie.focus()}return(y,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",pv,[t.createElementVNode("div",hv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:I},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":v.modelId===s.value}]),role:"button",tabindex:"0","aria-current":v.modelId===s.value?"true":void 0,onClick:M=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(M=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(M=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",bv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",_v,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",kv,t.toDisplayString(v.columns.length),1)],42,gv))),128))],8,yv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Ev,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Nv,[t.createElementVNode("div",wv,[t.createElementVNode("label",Iv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=v=>E(c.value.modelId,{name:v}))},null,8,["model-value"]),t.createVNode(to,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=v=>E(c.value.modelId,{unique:v}))},null,8,["model-value"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=v=>A(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",vv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=v=>T(v.target.value))},null,40,xv)]),t.createElementVNode("div",Cv,[t.createElementVNode("div",Sv,[t.createElementVNode("div",Rv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:N.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:N.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":b.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":b.value.has(v.ref),onClick:M=>L(v.ref),onKeydown:[t.withKeys(t.withModifiers(M=>L(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(M=>L(v.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(v.label),1),v.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Tv)):t.createCommentVNode("",!0)],42,$v))),128))],8,Av),N.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Mv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",Vv,[t.createVNode(t.unref(ee.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!b.value.size,onClick:x},null,8,["caption","disabled"])]),t.createElementVNode("div",Bv,[t.createElementVNode("div",Dv,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(v,M)=>(t.openBlock(),t.createElementBlock("li",{key:M,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",Ov,[t.createTextVNode(t.toDisplayString(k(v.columnRef)),1),_(v.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,Lv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idxw-desc-${M}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":D=>$(M,D)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",Pv,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:M===0,onClick:D=>B(M,-1)},"↑",8,zv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:M===c.value.columns.length-1,onClick:D=>B(M,1)},"↓",8,Fv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:D=>R(M)},"✕",8,Uv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Hv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",jv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,fv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),Gv={class:"em-op-src"},Yv=["placeholder"],qv={class:"em-op-src__actions"},xf=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(l,s)=>Dt(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",Gv,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,Yv),[[t.vModelText,a.value]]),t.createElementVNode("div",qv,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),Wv=["disabled"],Jv={class:"em-ow__toolbar"},Xv={class:"em-ow__count"},Zv={class:"em-ow__scroll"},Qv={class:"em-ow__table"},ex={class:"c-name"},tx={class:"c-desc"},nx=["id"],ox={class:"c-pii"},ix={class:"c-src"},ax={class:"c-del"},rx={key:0},lx={colspan:"6",class:"em-ow__empty"},sx=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModal(),a=t.computed(()=>o.state.logical.entities.find(k=>k.modelId===n.entityId)??null),r=t.computed(()=>{var k;return[...((k=a.value)==null?void 0:k.operations)??[]].sort((N,b)=>N.order-b.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(k){return k==="none"?o.t("em.common.noneParen"):k}const u=k=>k;function m(k,N){a.value&&o.updateOperation(a.value.modelId,k.modelId,N)}function p(k,N){m(k,{description:Object.keys(N).length?N:void 0})}function f(k){return k.personalInfoAttributeType??"none"}function h(k,N){m(k,{personalInfoAttributeType:N==="none"?void 0:N})}function g(k){i.openModal({component:xf,bind:{operationName:k.name,sourceCode:k.sourceCode??"",locale:o.uiLocale.value,onSave:N=>m(k,{sourceCode:N})}})}return(k,N)=>{var b,_;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",Jv,[t.createElementVNode("span",Xv,t.toDisplayString(t.unref(o).t("em.op.section",{n:((b=a.value.operations)==null?void 0:b.length)??0})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:N[0]||(N[0]=E=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",Zv,[t.createElementVNode("table",Qv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",ex,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),N[2]||(N[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",tx,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,nx),t.createVNode(Nf,{modelValue:l.value,"onUpdate:modelValue":N[1]||(N[1]=E=>l.value=E),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",ox,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",ix,t.toDisplayString(t.unref(o).t("em.op.body")),1),N[3]||(N[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,E=>(t.openBlock(),t.createElementBlock("tr",{key:E.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`ow-name-${E.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":E.name,"onUpdate:modelValue":I=>m(E,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":E.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&m(E,{visibility:I})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(dn,{name:`ow-desc-${E.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":E.description,"onUpdate:modelValue":I=>p(E,I)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":f(E),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":I=>I&&h(E,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t(E.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:I=>g(E)},null,8,["caption","onClick"])]),t.createElementVNode("td",ax,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(o).removeOperation(a.value.modelId,E.modelId)},null,8,["onClick"])])]))),128)),(_=a.value.operations)!=null&&_.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",rx,[t.createElementVNode("td",lx,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,Wv)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),cx={class:"em-detail__tabs"},dx=["onClick"],ux={key:0,class:"em-detail__lock"},mx=["disabled"],fx={key:0,class:"em-detail__narrow"},px=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",cx,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:p=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,dx)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",ux,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",fx,[t.createVNode(pf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(mv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(Kv,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(sx,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,mx)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function qa(e,n,o){e.openModal({component:px,bind:{controller:t.markRaw(n),entityId:o}})}function un(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>ld(e,r))}function Ot(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of Pd(l,r))i.push(da(a,s.indexRef,{columns:s.columns}))}return i}function Wa(e,n,o,i){var c;const a=[];a.push(...un(n,o.remove,i));for(const d of o.update)a.push(on(n,d.attributeId,d.patch));for(const d of o.add)a.push(jt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const p=l.filter(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,h)=>f.order-h.order)[0];p&&a.push(Tt(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function Mo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Ni(e,n,o){const i=[];for(const[a,r]of bc(e,n,Me))i.push(...Wa(e,a,r,o));for(const a of qg(e,n,Me))i.push(on(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function hx(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Yr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return Fd(e,n,r).map(l=>on(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function yx(e,n,o){const i=new Set(o.remove);return Mo(e,n,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function Ja(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of _c(e,r,Me)){const c=i.get(l);i.set(l,c?gc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...Wa(e,r,gx(l),o));return a}function gx(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function Cf(e){return e.attributes.flatMap(n=>n.dbAttrs).map(n=>({...n,modelId:Me()}))}function bx(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=Rt(o.attributes),p=new Set(o.attributes.map(h=>h.name));let f="id";for(let h=2;p.has(f);h++)f=`id${h}`;a={modelId:Me(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Me(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(jt(n,a))}const r=[];for(const m of e.entities)for(const p of m.attributes){if(((u=p.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(N=>N.modelId===p.embedded.associationRef);if(!f)continue;const h=f.end1.entityRef===m.modelId,g=h?f.end1:f.end2,k=h?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1},end2:{entityRef:n,multiplicity:k.multiplicity,navigable:k.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const p=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return p.size?{...m,attributes:m.attributes.filter(f=>!p.has(f.modelId))}:m}),associations:e.associations.map(m=>{const p=r.find(f=>f.assocId===m.modelId);return p?{...m,end1:p.end1,end2:p.end2}:m})},s=Wo(l,n,Me);for(const m of r){const p=s.add.find(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...un(m.ownerId,[m.dispId],c)),i.push(ca(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Wa(l,n,s,c));const d=yx(l,n,s);return i.push(...Ni(d,n,c)),i.push(...Ot(e,c)),i}function _x(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(_=>_.modelId===c);if(!d||d.attributes.some(_=>{var E;return((E=_.embedded)==null?void 0:E.associationRef)===r.modelId}))continue;const u=Me(),m=Rt(d.attributes),p=new Set(d.attributes.map(_=>_.name)),f=a(o.name);let h=f;for(let _=2;p.has(h);_++)h=`${f}${_}`;const g=o.attributes.filter(_=>!_.identifier&&!_.derivedFrom).flatMap(_=>_.dbAttrs).map(_=>({..._,modelId:Me()})),k={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(jt(c,k));const N=l?"end2":"end1",b=l?"end1":"end2";i.push(ca(r.modelId,{identifying:!1,[N]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Me()},[b]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Sf(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[od(n,o),...i.map(u=>ko(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(_d(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const p=e.layout.notes.find(f=>f.modelId===m);p&&c.push(ti(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}function kx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Me(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},p={...n.logical,associations:[...n.logical.associations,m]},f=Wo(p,s,Me),h=f.add[0];h&&(m.end2.attributeRef=h.modelId);const g={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(h==null?void 0:h.modelId)??d},k=sa(m,g),N=Wa(p,s,f,[]);return i(N.length?We("관계 추가",[k,...N]):k),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(A=>A.modelId===l),d=n.logical.entities.find(A=>A.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Me(),m=Me(),p=Me(),f=Rt(c.attributes),h=Cf(d),g=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),k=new Set(c.attributes.map(A=>A.name)),N=g(d.name);let b=N;for(let A=2;k.has(b);A++)b=`${N}${A}`;const _={modelId:m,name:b,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:h,embedded:{associationRef:u,embeddableRef:s}},E={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},I={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(We("임베드 추가",[jt(l,_),sa(E,I)])),u},setEmbedCardinality(l,s){var N;if(r(l))return;const c=n.logical.associations.find(b=>b.modelId===l);if(!c)return;let d,u;for(const b of n.logical.entities){const _=b.attributes.find(E=>{var I;return((I=E.embedded)==null?void 0:I.associationRef)===l&&E.attrType==="EMBED_OWN"});if(_){d=b.modelId,u=_;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,p=c.end2.entityRef===m?"end2":"end1",f=c[p];if(f.multiplicity===s)return;const h=b=>b==="ZERO_OR_MORE_INSTANCES"||b==="ONE_OR_MORE_INSTANCES",g=h(f.multiplicity),k=h(s);if(g===k){i(Tt(l,p,{multiplicity:s}));return}if(k)i(We("임베드 컬렉션 전환",[on(d,u.modelId,{dbAttrs:[]}),Tt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((N=f.jpa)==null?void 0:N.collectionType)??"LIST"}})]));else{const b=n.logical.entities.find(_=>_.modelId===m);if(!b)return;i(We("임베드 단일 전환",[on(d,u.modelId,{dbAttrs:Cf(b)}),Tt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=pd(l);if(!s){i(c);return}for(const f of n.logical.entities){const h=f.attributes.find(g=>{var k;return((k=g.embedded)==null?void 0:k.associationRef)===l});if(h){const g=[];i(We("임베드 삭제",[c,...un(f.modelId,[h.modelId],g),...Ot(n.logical,g)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=Ja(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(g=>g.modelId===s.end1.entityRef),h=f==null?void 0:f.attributes.find(g=>g.modelId===s.end1.attributeRef&&g.attrType==="RELATION_REF");h&&p.push(...un(f.modelId,[h.modelId],m))}p.push(...Ot(n.logical,m)),i(p.length?We("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(h=>h.modelId===l),d=ca(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(h=>h.modelId===l?{...h,identifying:s}:h)},p=[],f=Ja(m,[u],p);f.push(...Ot(n.logical,p)),i(f.length?We("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.modelId===d.end2.entityRef),p=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!p){if(c.navigable===!0&&!d.end1.attributeRef){const f=Ui(d.end2.multiplicity),h=d.end1.navFieldNameHint||ji(m.name,f),g=uo(h,new Set(u.attributes.map(_=>_.name))),k=Me(),N=Rt(u.attributes),b={modelId:k,name:g,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:N,dbAttrs:[]};i(We("inverse nav 추가",[jt(d.end1.entityRef,b),Tt(l,"end1",{...c,attributeRef:k,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,h=u.attributes.find(b=>b.modelId===f&&b.attrType==="RELATION_REF"),g=Tt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(h==null?void 0:h.name)??d.end1.navFieldNameHint}),k=[],N=h?un(d.end1.entityRef,[f],k):[];i(h?We("inverse nav 제거",[...N,g,...Ot(n.logical,k)]):g);return}}}i(Tt(l,s,c))}}}function Ex(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,p)=>{if(a(u))return;const f=on(u,m,p),h=Mo(n.logical,u,N=>N.map(b=>b.modelId===m?{...b,...p}:b)),g=[],k=Ni(h,u,g);k.push(...Ot(n.logical,g)),i(k.length?We("속성 수정",[f,...k]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(b=>b.type===m),f=n.logical.entities.find(b=>b.modelId===u);if(!p||!f)return null;const h=Rt(f.attributes),g=Me(),k=p.fields.map(()=>({modelId:Me(),physicalName:"",dataType:""})),N={modelId:g,name:p.defaultName,type:p.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:h,dbAttrs:k};return i(jt(u,N)),g},addAttribute(u,m={}){if(!o.value||a(u))return null;const p=n.logical.entities.find(I=>I.modelId===u),f=p?Rt(p.attributes):0,h=m.modelId??Me(),g=m.name??`field${f}`,k={modelId:h,name:g,type:m.type??Ar,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Me(),physicalName:g,dataType:"VARCHAR"}],...m},N=jt(u,k),b=Mo(n.logical,u,I=>[...I,k]),_=[],E=Ni(b,u,_);return E.push(...Ot(n.logical,_)),i(E.length?We("속성 추가",[N,...E]):N),h},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(g=>g.modelId===u),p=m?Rt(m.attributes):0,f=Me();return i(jt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:p,dbAttrs:[]})),f},updateAttribute(u,m,p){d(u,m,p)},setAttributeGroupCode(u,m,p){d(u,m,{groupCode:p,type:p?Dn:Ar})},setEmbedColumns(u,m,p){var b,_;if(a(u))return;const f=on(u,m,{dbAttrs:p}),h=(b=n.logical.entities.find(E=>E.modelId===u))==null?void 0:b.attributes.find(E=>E.modelId===m),g=(_=h==null?void 0:h.embedded)==null?void 0:_.associationRef,k=g?n.logical.associations.find(E=>E.modelId===g):void 0,N=[];k&&g&&(k.end1.legacyEmbedRaw&&N.push(Tt(g,"end1",{legacyEmbedRaw:void 0})),k.end2.legacyEmbedRaw&&N.push(Tt(g,"end2",{legacyEmbedRaw:void 0}))),i(N.length?We("임베드 컬럼 수정",[f,...N]):f)},removeAttribute(u,m){if(a(u))return;if(Ji(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=un(u,[m],p),h=Mo(n.logical,u,N=>N.filter(b=>b.modelId!==m)),g=[...Ni(h,u,p),...Ot(n.logical,p)],k=[...f,...g];i(k.length===1?k[0]:We("속성 삭제",k))},removeAttributes(u,m){var b;if(!m.length||a(u))return;const p=m.filter(_=>!Ji(n.logical,u,_));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],h=un(u,p,f),g=new Set(p),k=Mo(n.logical,u,_=>_.filter(E=>!g.has(E.modelId))),N=[...h,...Ni(k,u,f),...Ot(n.logical,f)];i(N.length===1?N[0]:We("속성 삭제",N)),((b=c.value)==null?void 0:b.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,p){i(aa(u,m,p))},setAttributeSwatches(u,m,p){m.length&&(m.length===1?i(aa(u,m[0],p)):i(We("속성 색상",m.map(f=>aa(u,f,p)))))},reorderAttributes(u,m,p){if(!m.length||a(u))return;const f=il(u,m,p),h=hx(n.logical,u,m,p);i(h.length?We("속성 재정렬",[f,...h]):f)}}}function Nx(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Me(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=Me();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Me()}for(const a of n.indexes??[]){a.modelId=Me();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Me();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const wx=220;function Ix(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||wx));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of n.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of n.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const ts=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function vx(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const g=c.filter(k=>n.logical.entities.some(N=>N.modelId===k));if(g.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:g}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const g=n.logical.entities.find(N=>N.modelId===d.entityId);if(!g)return;const k=[...g.attributes].sort((N,b)=>N.order-b.order).filter(N=>d.ids.includes(N.modelId));if(!k.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:k}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(g=>g.modelId===u),p=n.layout.entityLayouts.find(g=>g.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let h;if(p){const{entityRef:g,geo:k,locked:N,...b}=p;Object.keys(b).length&&(h=b)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:h}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const h=n.logical.entities.find(E=>E.modelId===f);if(!h)return[];const g=new Set(h.attributes.map(E=>E.name)),k=new Set(h.attributes.flatMap(E=>E.dbAttrs.map(I=>I.physicalName))),N=Rt(h.attributes),b=[],_=c.attributes.map((E,I)=>{const A=JSON.parse(JSON.stringify(E));A.modelId=Me();for(const T of A.dbAttrs)T.modelId=Me();g.has(A.name)&&(A.name=uo(`${A.name}_copy`,g)),g.add(A.name);for(const T of A.dbAttrs)T.physicalName&&k.has(T.physicalName)&&(T.physicalName=uo(`${T.physicalName}_copy`,k)),T.physicalName&&k.add(T.physicalName);return A.order=N+I,b.push(A.modelId),jt(f,A)});return l(_.length===1?_[0]:We("속성 붙여넣기",_)),i.value={kind:"attribute",entityId:f,ids:b,anchor:b[b.length-1]},[]}const{clone:d,idMap:u}=Nx(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let p;if(c.layoutExtras){const f={...c.layoutExtras},h=g=>u.get(g);f.attributeStyles&&(f.attributeStyles=ta(f.attributeStyles,h)),f.operationStyles&&(f.operationStyles=ta(f.operationStyles,h)),p=f}return l(ia(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Pc(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const p=(u==null?void 0:u.placement)??"append-right",f=p==="append-right"?Ix(n.layout,m.layout):p.offset,h=new Map(m.layout.entityLayouts.map(_=>[_.entityRef,_])),g=new Map(m.layout.associationLayouts.map(_=>[_.associationRef,_])),k=new Map(m.layout.groupLayouts.map(_=>[_.groupRef,_])),N=[];let b=80;for(const _ of m.logical.entities){const E=h.get(_.modelId),I=E?{location:ts(E.geo.location,f),size:{...E.geo.size}}:{location:{x:b+=40,y:80},size:{width:220,height:140}};let A;if(E){const{entityRef:T,geo:L,locked:x,...R}=E;A=R}N.push(ia(_,I,A))}for(const _ of m.logical.associations){const E=g.get(_.modelId),I=E?{...E,waypoints:E.waypoints.map(A=>ts(A,f))}:{associationRef:_.modelId,waypoints:[]};N.push(sa(_,I))}for(const _ of m.logical.groups){const E=k.get(_.modelId),I=E?{location:ts(E.geo.location,f),size:{...E.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(E){const{groupRef:T,geo:L,locked:x,memberNoteRefs:R,...$}=E;A=$}N.push(ra(_,I,A))}return l(We("다이어그램 가져오기",N)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(_=>_.modelId)}};return s}function xx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l}=e;return{addEntity(s="NewEntity",c={x:80,y:80}){if(!o.value)return null;const d=Me(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Me(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Me(),physicalName:"id",dataType:"BIGINT"}]}]};return i(ia(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(Wc(s,c))},updateEntity(s,c){if(a(s))return;const d=qc(s,c),u=n.logical.entities.find(f=>f.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",p=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const f=u.attributes.filter(_=>_.identifier&&!_.derivedFrom).map(_=>on(s,_.modelId,{identifier:!1})),h=Mo({...n.logical,entities:n.logical.entities.map(_=>_.modelId===s?{..._,stereotype:"JPA_EMBEDDABLE"}:_)},s,_=>_.map(E=>E.identifier&&!E.derivedFrom?{...E,identifier:!1}:E)),g=[],k=Ja(h,[s],g);k.push(...Ot(n.logical,g));const N=_x(n.logical,s),b=[d,...f,...k,...N];i(b.length>1?We("임베더블 변환",b):d);return}if(p){const f=bx(n.logical,s),h=[d,...f];i(h.length>1?We("엔터티 전환",h):d);return}i(d)},moveEntity(s,c){a(s)||i(ko(s,c))},resizeEntity(s,c){a(s)||i(Jc(s,c))},removeEntity(s){if(a(s))return;const c=Yc(s);if(!n.logical.entities.find(k=>k.modelId===s)){i(c);return}const u=n.logical.associations.filter(k=>k.end1.entityRef===s||k.end2.entityRef===s),m=new Set(u.map(k=>k.modelId)),p=[],f=[];for(const k of n.logical.entities)if(k.modelId!==s)for(const N of k.attributes)N.embedded&&m.has(N.embedded.associationRef)&&p.push(...un(k.modelId,[N.modelId],f));for(const k of u){if(k.end1.entityRef===s||!k.end1.attributeRef)continue;const N=n.logical.entities.find(_=>_.modelId===k.end1.entityRef),b=N==null?void 0:N.attributes.find(_=>_.modelId===k.end1.attributeRef&&_.attrType==="RELATION_REF");b&&p.push(...un(N.modelId,[b.modelId],f))}const h={...n.logical,entities:n.logical.entities.filter(k=>k.modelId!==s),associations:n.logical.associations.filter(k=>!m.has(k.modelId))},g=new Set(u.filter(k=>k.end1.entityRef===s&&k.end2.entityRef!==s).map(k=>k.end2.entityRef));p.push(...Ja(h,[...g],f)),p.push(...Ot(n.logical,f.filter(k=>k.entityId!==s))),i(p.length?We("엔티티 삭제",[c,...p]):c)},setEntitySwatch(s,c){i(Xc(s,c))},setEntityCollapsed(s,c){i(Zc(s,c))},setEntityLocked(s,c){i(Qc(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(ol(!0))},expandAll(){i(ol(!1))}}}function Cx(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(N=>n.layout.entityLayouts.find(b=>b.entityRef===N)).filter(N=>!!N);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,h=-1/0;for(const N of u){const b=N.geo.size.width||220,_=N.geo.size.height||140;m=Math.min(m,N.geo.location.x),p=Math.min(p,N.geo.location.y),f=Math.max(f,N.geo.location.x+b),h=Math.max(h,N.geo.location.y+_)}const g=40,k=28;return{location:{x:m-g,y:p-g-k},size:{width:f-m+g*2,height:h-p+g*2+k}}}return{dragGroup(d,u,m){l(d)||i(We("그룹 이동",Sf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(id(d,u))},setGroupSwatch(d,u){i(ad(d,u))},setGroupLocked(d,u){i(rd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(ed(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const h of n.logical.groups)for(const g of d)h.memberEntityRefs.includes(g)&&m.push(la(h.modelId,g));const p=Me(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(ra(f,c(d))),i(We("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Me();return i(ra({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(td(d))},dropEntity(d,u,m){var h;if(r(d))return;const p=((h=n.logical.groups.find(g=>g.memberEntityRefs.includes(d)))==null?void 0:h.modelId)??null,f=[ko(d,u)];p!==m&&(p&&f.push(la(p,d)),m&&f.push(nd(m,d))),i(We("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(la(u.modelId,d))},dropNote(d,u,m){var h;const p=((h=n.layout.groupLayouts.find(g=>{var k;return(k=g.memberNoteRefs)==null?void 0:k.includes(d)}))==null?void 0:h.groupRef)??null,f=[ti(d,u)];p!==m&&(p&&f.push(Sd(p,d)),m&&f.push(Cd(m,d))),i(We("이동",f))}}}function Sx(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(g,k){if(d(),!o.value||!e.opTransport)return;const N=new Dd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:b=>{i.value=!1,a.value=b},onError:e.onOpError});N.seed((k==null?void 0:k.revSeed)??{}),c=N.attach(g),s=N}const m=t.computed(()=>o.value&&r!==void 0),p=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function h(g){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let k;try{k=await l(g)}catch(N){return{ok:!1,reason:N instanceof Error?N.message:String(N)}}return k.ok&&p.value++,k}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:h,reloadRequest:p}}function Rx(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Me();return o(Nd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(wd(i))},moveNote(i,a){o(ti(i,a))},resizeNote(i,a){o(Id(i,a))},setNoteMemo(i,a){o(vd(i,a))},setNoteSwatch(i,a){o(xd(i,a))},addNoteConnection(i,a){o(Rd(i,a))},removeNoteConnection(i,a){o(Ad(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o($d(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Td(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Md(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Vd(i,a))}}}function Ax(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const E=p.ids.includes(u),I=E?p.ids.filter(T=>T!==u):[...p.ids,u];if(!I.length){o.value=null;return}const A=E&&p.anchor===u?I[I.length-1]:E?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:I,anchor:A};return}const h=n.logical.entities.find(E=>E.modelId===d),g=[...(h==null?void 0:h.attributes)??[]].sort((E,I)=>E.order-I.order).map(E=>E.modelId),k=g.indexOf(p.anchor),N=g.indexOf(u);if(k<0||N<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[b,_]=k<=N?[k,N]:[N,k];o.value={kind:"attribute",entityId:d,ids:g.slice(b,_+1),anchor:p.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(g=>g.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(g=>g.modelId===u.anchor);if(p<0)return!1;const f=Math.min(Math.max(p+d,0),m.attributes.length-1);if(f===p)return!0;const h=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[h],anchor:h},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(E=>E.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),h=p.map((E,I)=>f.has(E.modelId)?I:-1).filter(E=>E>=0);if(!h.length)return!1;const g=Math.min(...h),k=p.filter(E=>!f.has(E.modelId)),N=p.slice(0,g).filter(E=>!f.has(E.modelId)).length;let b;if(d<0){if(N<=0)return!0;b=N-1}else{if(k.length-N<=0)return!0;b=N+1}if(r(u.entityId))return!0;const _=p.filter(E=>f.has(E.modelId)).map(E=>E.modelId);return a(il(u.entityId,_,b)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(b=>b.modelId)),f=new Set(n.logical.groups.map(b=>b.modelId)),h=new Set(n.layout.notes.map(b=>b.modelId)),g=new Set;for(const b of d){if(!f.has(b))continue;const _=n.logical.groups.find(E=>E.modelId===b);for(const E of(_==null?void 0:_.memberEntityRefs)??[])g.add(E)}const k=[],N=[];for(const b of d)if(f.has(b)){if(s(b))continue;const _=n.layout.groupLayouts.find(T=>T.groupRef===b);if(!_)continue;const E=n.logical.groups.find(T=>T.modelId===b),I=((E==null?void 0:E.memberEntityRefs)??[]).map(T=>{var x;const L=((x=n.layout.entityLayouts.find(R=>R.entityRef===T))==null?void 0:x.geo.location)??{x:0,y:0};return{id:T,location:{x:L.x+u,y:L.y+m}}}),A={x:_.geo.location.x+u,y:_.geo.location.y+m};k.push(We("그룹 이동",Sf(n,b,A,I))),N.push("g:"+b)}else if(p.has(b)){if(g.has(b)||l(b))continue;const _=n.layout.entityLayouts.find(E=>E.entityRef===b);if(!_)continue;k.push(ko(b,{x:_.geo.location.x+u,y:_.geo.location.y+m})),N.push("e:"+b)}else if(h.has(b)){const _=n.layout.notes.find(E=>E.modelId===b);if(!_)continue;k.push(ti(b,{x:_.geo.location.x+u,y:_.geo.location.y+m})),N.push("n:"+b)}return k.length?(a(We("이동",k,"nudge:"+N.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const no=Symbol("editorController");function Rf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function $x(e=Rf(),n={}){var ae,Be,Ve;const o=t.reactive(e);let i=new nl(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),u=t.ref(n.uiLocale??"ko"),m=(H,V)=>Dt(u.value,H,V),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),h=t.ref(n.largeEntityThreshold),g=t.ref(n.flagEntitiesWithoutRelations??!1),k=t.ref(!1),N=t.ref(!1),b=t.ref(!1),_=t.ref(0),E=t.ref(null);let I=0;const A=H=>{if(n.onNotice){n.onNotice(H);return}E.value={text:H,id:++I}},T=t.ref(((ae=n.meta)==null?void 0:ae.schemaVersion)??1),L=t.ref(((Be=n.meta)==null?void 0:Be.opWriteEnabled)??!1),x=t.ref(((Ve=n.meta)==null?void 0:Ve.referenceOnly)??!1),R=t.computed(()=>T.value>=2&&L.value),$=t.ref(!(T.value>=2&&L.value===!1)),B=t.ref("LOGICAL_PHYSICAL"),O=t.ref("straight"),y=t.ref(!0),w=t.ref(!0),v=t.ref(null),M=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),D=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?v.value.ids:[]}),U=t.computed(()=>{var H,V;return((H=v.value)==null?void 0:H.kind)==="entity"?v.value.id:((V=v.value)==null?void 0:V.kind)==="attribute"?v.value.entityId:null}),W=t.ref(null),ie=t.ref(null),pe=t.ref(null),ye=t.ref(null),ge=Sx({state:o,opMode:R,editable:$,opConflict:pe,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function me(){i.onChange(()=>{k.value=i.canUndo,N.value=i.canRedo,b.value=i.isDirty,_.value++})}me(),ge.setupOpAdapter(i,n.meta);const se=t.computed(()=>Rs(o.logical,o.layout)),ke=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:h.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Se=()=>Ir(o.logical,x.value),ce=n.validationDebounceMs??250;let fe,oe=()=>{};if(ce>0){const H=t.shallowRef(Xi(Se(),ke.value));let V;oe=()=>{V!==void 0&&(clearTimeout(V),V=void 0),H.value=Xi(Se(),ke.value)},t.watch([_,ke,x],()=>{V!==void 0&&clearTimeout(V),V=setTimeout(oe,ce)},{flush:"sync"}),fe=t.computed(()=>H.value)}else fe=t.computed(()=>Xi(Se(),ke.value));const le=t.computed(()=>{const H=new Map;for(const V of fe.value){if(!V.targetRef)continue;const Pe=H.get(V.targetRef);Pe?Pe.push(V):H.set(V.targetRef,[V])}return H}),ue=1500,z=new Map,P=H=>{const V=Date.now();V-(z.get(H)??0)<ue||(z.set(H,V),A(H))},F=H=>{if(!ye.value){if(!$.value){P(m("em.notice.readOnly"));return}try{i.execute(H)}catch(V){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${H.label}):`,V),$.value=!1,ye.value={label:H.label}}}},Q=H=>o.layout.entityLayouts.some(V=>V.entityRef===H&&!!V.locked),X=H=>o.layout.groupLayouts.some(V=>V.groupRef===H&&!!V.locked),_e=H=>{const V=o.logical.associations.find(Pe=>Pe.modelId===H);return!!V&&(Q(V.end1.entityRef)||Q(V.end2.entityRef))},he=H=>Q(H)?(P(m("em.notice.entityLocked")),!0):!1,we=H=>X(H)?(P(m("em.notice.groupLocked")),!0):!1,Ie=H=>_e(H)?(P(m("em.notice.assocLocked")),!0):!1,Y=vx({state:o,clipboard:ie,selection:v,inspectedEntityId:U,editable:$,run:F}),j=Ax({state:o,selection:v,focusRequest:W,run:F,gateEntityLocked:he,isEntityLockedFn:Q,isGroupLockedFn:X}),J=xx({state:o,editable:$,run:F,gateEntityLocked:he,isEntityLockedFn:Q,isAssocLockedFn:_e}),ve=Ex({state:o,editable:$,run:F,gateEntityLocked:he,embeddableCatalog:a,t:m,emitGateNotice:P,selection:v}),Te=Cx({state:o,editable:$,run:F,selection:v,gateEntityLocked:he,gateGroupLocked:we,isGroupLockedFn:X}),K=Rx({editable:$,run:F}),te=kx({state:o,editable:$,run:F,gateEntityLocked:he,gateAssocLocked:Ie});return{state:o,resolved:se,issues:fe,issuesByRef:le,flagEntitiesWithoutRelations:g,canUndo:k,canRedo:N,dirty:b,revision:_,notice:E,editable:$,schemaVersion:T,opWriteEnabled:L,opMode:R,opConflict:pe,commandFailure:ye,historyTransport:ge.historyTransport,historyAvailable:ge.historyAvailable,restoreTransport:ge.restoreTransport,restoreAvailable:ge.restoreAvailable,restoreToSeq:ge.restoreToSeq,reloadRequest:ge.reloadRequest,displayMode:B,routingMode:O,showGrid:y,showMinimap:w,selection:v,selectedAttr:M,selectedAttrIds:D,inspectedEntityId:U,focusRequest:W,clipboard:ie,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:x,uiLocale:u,t:m,selectableDataTypes:f,setEditable(H){$.value=H&&R.value},setEmbeddableCatalog(H){a.value=H},setGroupCodeCatalog(H){r.value=H},setPredefinedCustomTypeCatalog(H){l.value=H},setSuperClassCatalog(H){s.value=H},selectAttribute:j.selectAttribute,moveAttributeFocus:j.moveAttributeFocus,nudgeSelectedAttributes:j.nudgeSelectedAttributes,nudgeNodes:j.nudgeNodes,requestFocus:j.requestFocus,deleteSelection(){if(!$.value)return!1;const H=v.value;if(!H)return!1;if(H.kind==="attribute"){if(he(H.entityId))return!1;const V=H.ids;if(!V.length)return!1;V.length===1?ve.removeAttribute(H.entityId,V[0]):ve.removeAttributes(H.entityId,V)}else if(H.kind==="entity"){if(he(H.id))return!1;J.removeEntity(H.id)}else if(H.kind==="note")K.removeNote(H.id);else if(H.kind==="group"){if(we(H.id))return!1;Te.removeGroup(H.id)}else te.removeAssociation(H.id);return v.value=null,!0},undo:()=>{$.value&&i.undo()},redo:()=>{$.value&&i.redo()},markSaved:()=>{$.value&&(ge.flush(),i.markSavePoint())},loadDiagram(H,V){ge.teardownOpAdapter(),o.logical=H.logical,o.layout=H.layout,i=new nl(o),me(),T.value=(V==null?void 0:V.schemaVersion)??1,L.value=(V==null?void 0:V.opWriteEnabled)??!1,x.value=(V==null?void 0:V.referenceOnly)??!1,$.value=!(T.value>=2&&L.value===!1),pe.value=null,ye.value=null,v.value=null,k.value=i.canUndo,N.value=i.canRedo,b.value=i.isDirty,ge.setupOpAdapter(i,V),oe()},flush:ge.flush,whenOpsSettled:ge.whenOpsSettled,addEntity:J.addEntity,renameEntity:J.renameEntity,updateEntity:J.updateEntity,moveEntity:J.moveEntity,resizeEntity:J.resizeEntity,removeEntity:J.removeEntity,setEntitySwatch:J.setEntitySwatch,setEntityCollapsed:J.setEntityCollapsed,setEntityLocked:J.setEntityLocked,isEntityLocked:J.isEntityLocked,isAssociationLocked:J.isAssociationLocked,collapseAll:J.collapseAll,expandAll:J.expandAll,setAttributeSwatch:ve.setAttributeSwatch,dragGroup:Te.dragGroup,resizeGroup:Te.resizeGroup,setGroupSwatch:Te.setGroupSwatch,setGroupLocked:Te.setGroupLocked,isGroupLocked:Te.isGroupLocked,updateGroup:Te.updateGroup,createGroup:Te.createGroup,addEmptyGroup:Te.addEmptyGroup,removeGroup:Te.removeGroup,dropEntity:Te.dropEntity,ungroupEntity:Te.ungroupEntity,dropNote:Te.dropNote,addPredefinedEmbed:ve.addPredefinedEmbed,addAttribute:ve.addAttribute,addDivider:ve.addDivider,updateAttribute:ve.updateAttribute,setAttributeGroupCode:ve.setAttributeGroupCode,setEmbedColumns:ve.setEmbedColumns,removeAttribute:ve.removeAttribute,removeAttributes:ve.removeAttributes,setAttributeSwatches:ve.setAttributeSwatches,reorderAttributes:ve.reorderAttributes,addIndex(H,V){he(H)||F(hd(H,V))},updateIndex(H,V,Pe){he(H)||F(da(H,V,Pe))},removeIndex(H,V){he(H)||F(yd(H,V))},addOperation(H,V={}){if(!$.value||he(H))return null;const Pe=o.logical.entities.find(De=>De.modelId===H),Ze=Pe!=null&&Pe.operations?Rt(Pe.operations):0,Ue=V.modelId??Me(),Le={modelId:Ue,name:V.name??`method${Ze}`,visibility:V.visibility??"PACKAGE",order:Ze,...V};return F(cd(H,Le)),Ue},updateOperation(H,V,Pe){he(H)||F(dd(H,V,Pe))},removeOperation(H,V){he(H)||F(ud(H,V))},reorderOperations(H,V,Pe){!V.length||he(H)||F(md(H,V,Pe))},setOperationSwatch(H,V,Pe){F(fd(H,V,Pe))},addAssociation:te.addAssociation,addEmbedAssociation:te.addEmbedAssociation,setEmbedCardinality:te.setEmbedCardinality,removeAssociation:te.removeAssociation,setAssociationIdentifying:te.setAssociationIdentifying,updateAssociationEnd:te.updateAssociationEnd,hasQuickFix(H){if(!$.value)return!1;const V=Ur(H,o.logical);return V?V.kind==="setEndCascades"?!_e(V.assocRef):!Q(V.entityRef):!1},applyQuickFix(H){if(!$.value)return!1;const V=Ur(H,o.logical);if(!V)return!1;if(V.kind==="setIndexColumns")return he(V.entityRef)?!1:(F(da(V.entityRef,V.indexRef,{columns:V.columns})),!0);if(Ie(V.assocRef))return!1;const Pe=o.logical.associations.find(Ze=>Ze.modelId===V.assocRef);return Pe?(F(Tt(V.assocRef,V.which,{jpa:{...Pe[V.which].jpa,cascadeTypes:V.cascades}})),!0):!1},moveWaypoint(H,V,Pe){F(gd(H,V,Pe))},addWaypoint(H,V,Pe){F(Ed(H,V,Pe))},removeWaypoint(H,V){F(bd(H,V))},clearWaypoints(H){F(kd(H))},addNote:K.addNote,removeNote:K.removeNote,moveNote:K.moveNote,resizeNote:K.resizeNote,setNoteMemo:K.setNoteMemo,setNoteSwatch:K.setNoteSwatch,addNoteConnection:K.addNoteConnection,removeNoteConnection:K.removeNoteConnection,moveNoteConnectionWaypoint:K.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:K.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:K.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:K.clearNoteConnectionWaypoints,autoLayout(){const H=As(o.logical,o.layout);H.length&&F(We("자동 배치",H.map(V=>ko(V.id,V.location))))},copy:Y.copy,paste:Y.paste,importEntities:Y.importEntities}}const Xa=Symbol("groupHover"),Af=Symbol("groupDrag"),Vo=Symbol("relationHighlight"),$f=Symbol("diffOverlay"),Tf=Symbol("nodeInternals"),Mf=Symbol("columnResolution");function Tx(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function Vf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!Tx(e[o],n[o]))return!1;return!0}function Mx(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!Vf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function Vx(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Bx(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!Vx(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!Mx(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Vf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function Dx(){let e;return(n,o)=>e=Ox(n,o,e)}function Ox(e,n,o){const i=e.entities,a=new Map;for(const r of i){const l=new Map,s=new Map,c=new Map;let d=null;const u=()=>d??(d=so(kn(r,i)));for(const g of r.attributes){if(Oi(g)){const _=g.dbAttrs[0];if(!(_!=null&&_.physicalName&&(_!=null&&_.dataType))){const E=Li(g,r,i,e.associations);E&&l.set(g.modelId,{...g,dbAttrs:[{..._,physicalName:(_==null?void 0:_.physicalName)||E.physicalName,dataType:(_==null?void 0:_.dataType)||E.dataType,length:(_==null?void 0:_.length)??E.length,scale:(_==null?void 0:_.scale)??E.scale},...g.dbAttrs.slice(1)]})}}const k=$r(g,e.associations);if(k&&c.set(g.modelId,k),!g.attrType.startsWith("EMBED")||g.dbAttrs.length===0)continue;if(g.attrType!=="EMBED_PREDEF"){const _=u();s.set(g.modelId,g.dbAttrs.map((E,I)=>{const A=Bn(E,_);return A?{...E,physicalName:A.physicalName}:Vn(g,E,I,r,e)}));continue}const N=n==null?void 0:n.find(_=>_.type===g.type);if(!N)continue;const b=u();s.set(g.modelId,g.dbAttrs.map((_,E)=>{const I=N.fields[E],A=Bn(_,b);return A?{..._,physicalName:A.physicalName,logicalName:_.logicalName??(I==null?void 0:I.logicalName),dataType:_.dataType||(I==null?void 0:I.dataType)||""}:I?{..._,physicalName:_.physicalName||I.physicalName,logicalName:_.logicalName??I.logicalName,dataType:_.dataType||I.dataType,length:_.length??I.length}:_}))}const m=new Map,p=new Map;for(const g of r.attributes){const k=s.get(g.modelId);if(k)for(let N=0;N<k.length;N++){const b=`${g.attrType}\0${g.type??""}\0${N}`,_={attrId:g.modelId,slot:N,name:k[N].physicalName??""},E=p.get(b);E?E.push(_):p.set(b,[_])}}for(const g of p.values()){if(g.length<2)continue;const k=new Map;for(const N of g)k.set(N.name,(k.get(N.name)??0)+1);for(const N of g){if((k.get(N.name)??0)<2)continue;const b=m.get(N.attrId);b?b.add(N.slot):m.set(N.attrId,new Set([N.slot]))}}const f={effectiveAttrs:l,embedCols:s,collectionTypes:c,redundantSlots:m},h=o==null?void 0:o.get(r.modelId);a.set(r.modelId,h&&Bx(f,h)?h:f)}return a}const Bf=Symbol("embedSlotCollapse"),Df=(e,n)=>`${e}:${n}`,Of="all:",Lf="one:",Pf=e=>`${Of}${e}`,zf=(e,n)=>`${Lf}${e}:${n}`,Lx=e=>!e.startsWith(Of)&&!e.startsWith(Lf),Px=["title"],zx={key:0,class:"em-sel","aria-hidden":"true"},Fx=["title","aria-expanded","disabled"],Ux={class:"em-entity__stereotype"},Hx={key:1,class:"em-entity__name"},jx=["title","aria-expanded"],Kx={"aria-hidden":"true"},Gx=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Yx=["onPointerdown"],qx={key:1,class:"em-entity__divider-label"},Wx=["title"],Jx={class:"em-key-slot"},Xx={class:"em-key-slot"},Zx=["title","aria-expanded","onClick"],Qx=["title","onClick"],eC=["title","aria-expanded","onClick"],tC={key:2,class:"em-entity__type"},nC=["onClick"],oC={class:"em-entity__attrname"},iC={class:"em-entity__type"},aC={key:1,class:"em-entity__embed-summary"},rC=["title"],lC=["data-op"],sC=["onPointerdown"],cC={class:"em-entity__op-vis","aria-hidden":"true"},dC=["title"],uC={key:4,class:"em-entity__footer"},Ff=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(no,null),i=(C,S)=>o?o.t(C,S):Dt("ko",C,S),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=ee.useModal();function l(){o&&qa(r,o,n.id)}const s=t.inject(Xa,null),c=t.inject(Vo,null),d=t.inject($f,null),u=t.computed(()=>{var C;return((C=d==null?void 0:d.marks.value)==null?void 0:C.get(n.id))??null}),m=t.inject(Mf,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(Bf,void 0),h=t.inject(Tf,null);t.onUpdated(()=>h==null?void 0:h.mark(n.id));const g=t.computed(()=>!!o&&o.editable.value);function k(){s&&(s.value=n.data.groupRef??null)}function N(){c==null||c.setEntityHover(n.id)}function b(){c==null||c.setEntityHover(null)}const _=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),E=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!_.value),I=t.computed(()=>{var C;return((C=o==null?void 0:o.selection.value)==null?void 0:C.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!I.value),T=t.computed(()=>{var C;return o&&((C=o.selectedAttr.value)==null?void 0:C.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),L=t.computed(()=>T.value.size>0);function x(C,S){const q=S.shiftKey?"range":S.metaKey||S.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,C.modelId,q)}const R=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!I.value),$=t.computed(()=>n.data.entity),B=t.computed(()=>Mh($.value,o==null?void 0:o.referenceOnlyDocument.value)),O=t.computed(()=>[...$.value.attributes].sort((C,S)=>C.order-S.order)),y=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>n.data.collapsed??!1),v=t.computed(()=>n.data.locked??!1),M=t.computed(()=>g.value&&!v.value);function D(){g.value&&(o==null||o.setEntityCollapsed(n.id,!w.value))}const U=t.computed(()=>y.value==="PHYSICAL"||y.value==="LOGICAL_PHYSICAL"),W=t.computed(()=>{const C=y.value==="PHYSICAL"||y.value==="LOGICAL_PHYSICAL",S={};for(const q of O.value){const re=q.attrType.startsWith("RELATION")&&q.dbAttrs.length>0;S[q.modelId]={pk:q.identifier,fk:re&&C,required:q.notNull&&!q.identifier}}return S});function ie(C){if(!C)return"";const S=[];return C.pk&&C.fk?S.push(i("em.node.keyPfk")):C.pk?S.push(i("em.node.keyPk")):C.fk&&S.push(i("em.node.keyFk")),C.required&&S.push(i("em.node.required")),S.join(" · ")}const pe=t.computed(()=>{const C=Xl(_t(n.data.style)),S={};return C&&(S["--em-header-bg"]=C.bar,S["--em-header-fg"]=C.barOn),S});function ye(C){var S,q;return(q=Xl(_t((S=n.data.attributeStyles)==null?void 0:S[C.modelId])))==null?void 0:q.text}const ge=t.computed(()=>[...$.value.operations??[]].sort((C,S)=>C.order-S.order)),me=t.computed(()=>y.value==="CLASS"&&ge.value.length>0),se={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ke(C){return C?se[C]:"~"}function Se(C){var S,q;return(q=Xl(_t((S=n.data.operationStyles)==null?void 0:S[C.modelId])))==null?void 0:q.text}function ce(C,S,q){switch(y.value){case"CLASS":return[{text:C}];case"PHYSICAL":return[{text:q||C}];case"LOGICAL":return[S?{text:S}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=S?{text:S}:{text:i("em.node.logicalMissing"),missing:!0};return q?[re,{text:` · ${q}`}]:[re]}}}function fe(C){var S;return((S=p.value)==null?void 0:S.effectiveAttrs.get(C.modelId))??C}function oe(C){var q,re,ne;if(le(C))return[{text:C.name}];const S=fe(C);return ce(C.name,(re=(q=S.dbAttrs[0])==null?void 0:q.logicalName)==null?void 0:re[a.value],((ne=S.dbAttrs[0])==null?void 0:ne.physicalName)??"")}function le(C){return C.attrType.startsWith("EMBED")&&C.dbAttrs.length>0}function ue(C){return C.attrType==="DIVIDER"}function z(C){var S;return((S=p.value)==null?void 0:S.embedCols.get(C.modelId))??C.dbAttrs}function P(C){var S;return(S=p.value)==null?void 0:S.redundantSlots.get(C.modelId)}const F=t.computed(()=>(f==null?void 0:f.isCollapsed(Pf(n.id)))??!1),Q=t.computed(()=>F.value&&U.value?O.value.reduce((C,S)=>le(S)?C+z(S).length:C,0):0),X=t.computed(()=>O.value.some(C=>le(C)));function _e(C){const S=P(C);return!S||S.size===0?!1:f?f.isCollapsed(Df(n.id,C.modelId)):!1}function he(C){var S;return _e(C)?((S=P(C))==null?void 0:S.size)??0:0}function we(C){return f?f.isCollapsed(zf(n.id,C.modelId)):!1}function Ie(C){var S;return!U.value||F.value?null:we(C)?"attr":(((S=P(C))==null?void 0:S.size)??0)>0?"slot":null}function Y(C){return!F.value&&le(C)}function j(C){return we(C)?z(C).length:0}function J(C){if(F.value||we(C))return[];const S=z(C);if(!_e(C))return S;const q=P(C);return S.filter((re,ne)=>!q.has(ne))}function ve(C){f==null||f.toggle(Df(n.id,C.modelId))}function Te(C){f==null||f.toggle(zf(n.id,C.modelId))}function K(){f==null||f.toggle(Pf(n.id))}function te(C){var S;return ce(C.physicalName,(S=C.logicalName)==null?void 0:S[a.value],C.physicalName)}function G(C){var q;const S=(q=p.value)==null?void 0:q.collectionTypes.get(C.modelId);return Tr(y.value,fe(C),S)}const ae=t.computed(()=>{const C={};for(const S of O.value)C[S.modelId]=G(S);return C}),Be=t.computed(()=>{var C,S,q;return ce($.value.name,(S=(C=$.value.table)==null?void 0:C.logicalName)==null?void 0:S[a.value],((q=$.value.table)==null?void 0:q.physicalName)??"")}),Ve=t.ref(!1),H=t.ref(""),V=t.ref(null);async function Pe(){var C,S;M.value&&(H.value=$.value.name,Ve.value=!0,await t.nextTick(),(C=V.value)==null||C.focus(),(S=V.value)==null||S.select())}function Ze(){if(!Ve.value)return;Ve.value=!1;const C=H.value.trim();C&&C!==$.value.name&&(o==null||o.renameEntity(n.id,C))}function Ue(){o==null||o.addAttribute(n.id)}function Le(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:De,findNode:Z}=je(),dt=t.ref(null),yn=t.computed(()=>{const C=dt.value??n.data.size;return C?{width:`${C.width}px`,minHeight:`${C.height}px`}:void 0});let Et=null;function gn(C){var re,ne,xe;if(!M.value)return;C.stopPropagation();const S=(re=Z(n.id))==null?void 0:re.dimensions,q=De({x:C.clientX,y:C.clientY});Et={fx:q.x,fy:q.y,w:(S==null?void 0:S.width)??((ne=n.data.size)==null?void 0:ne.width)??200,h:(S==null?void 0:S.height)??((xe=n.data.size)==null?void 0:xe.height)??120},C.target.setPointerCapture(C.pointerId)}function Ee(C){if(!Et)return;const S=De({x:C.clientX,y:C.clientY});dt.value={width:Math.max(40,Et.w+(S.x-Et.fx)),height:Math.max(40,Et.h+(S.y-Et.fy))}}function at(C){var S,q,re;if(Et&&dt.value&&o){const ne=(S=Z(n.id))==null?void 0:S.dimensions;o.resizeEntity(n.id,{width:Math.round((ne==null?void 0:ne.width)??dt.value.width),height:Math.round((ne==null?void 0:ne.height)??dt.value.height)})}Et=null,dt.value=null,(re=(q=C.target).releasePointerCapture)==null||re.call(q,C.pointerId)}const zt=t.ref(null),ut=t.ref(null);function Qt(C,S){if(!M.value)return;S.stopPropagation(),S.preventDefault();const q=T.value,re=q.has(C.modelId)?new Set(q):new Set([C.modelId]);ut.value={ids:re,dropIndex:-1,lineY:0},S.target.setPointerCapture(S.pointerId)}function en(C){if(!ut.value||!zt.value)return;const S=Array.from(zt.value.querySelectorAll(".em-entity__row"));if(!S.length)return;let q=S.length;for(let xe=0;xe<S.length;xe++){const de=S[xe].getBoundingClientRect();if(C.clientY<de.top+de.height/2){q=xe;break}}const re=S[S.length-1],ne=q<S.length?S[q].offsetTop:re.offsetTop+re.offsetHeight;ut.value={...ut.value,dropIndex:q,lineY:ne}}function Ne(){const C=ut.value;if(ut.value=null,!C||C.dropIndex<0)return;const S=O.value,q=S.filter(Ce=>C.ids.has(Ce.modelId)).map(Ce=>Ce.modelId),re=S.filter((Ce,Fe)=>C.ids.has(Ce.modelId)&&Fe<C.dropIndex).length,ne=C.dropIndex-re,xe=S.filter(Ce=>!C.ids.has(Ce.modelId)).map(Ce=>Ce.modelId);[...xe.slice(0,ne),...q,...xe.slice(ne)].join(",")!==S.map(Ce=>Ce.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,q,ne))}function et(){ut.value=null}const Ft=t.ref(null),pt=t.ref(null);function nt(C,S){M.value&&(S.stopPropagation(),S.preventDefault(),pt.value={id:C.modelId,dropIndex:-1,lineY:0},S.target.setPointerCapture(S.pointerId))}function Fo(C){if(!pt.value||!Ft.value)return;const S=Array.from(Ft.value.querySelectorAll(".em-entity__op-row"));if(!S.length)return;let q=S.length;for(let xe=0;xe<S.length;xe++){const de=S[xe].getBoundingClientRect();if(C.clientY<de.top+de.height/2){q=xe;break}}const re=S[S.length-1],ne=q<S.length?S[q].offsetTop:re.offsetTop+re.offsetHeight;pt.value={...pt.value,dropIndex:q,lineY:ne}}function Uo(){const C=pt.value;if(pt.value=null,!C||C.dropIndex<0)return;const q=ge.value.findIndex(ne=>ne.modelId===C.id);if(q<0)return;const re=C.dropIndex-(q<C.dropIndex?1:0);re!==q&&(o==null||o.reorderOperations(n.id,[C.id],re))}function Ho(){pt.value=null}return(C,S)=>{var q,re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":_.value,"is-related":E.value,"is-dimmed":R.value,"is-selected":I.value,"is-multi-selected":A.value,"has-focused-attr":L.value,"is-locked":v.value,"is-reference-only":B.value,"is-diff-added":((q=u.value)==null?void 0:q.verb)==="added","is-diff-modified":((re=u.value)==null?void 0:re.verb)==="modified"}]),tabindex:"-1",title:B.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(yn.value),onPointerdown:k,onMouseenter:N,onMouseleave:b,onDblclick:l},[I.value?(t.openBlock(),t.createElementBlock("div",zx,[...S[11]||(S[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(pe.value),onDblclick:t.withModifiers(Pe,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(w.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!w.value,disabled:!g.value,onClick:t.withModifiers(D,["stop"]),onPointerdown:S[0]||(S[0]=t.withModifiers(()=>{},["stop"])),onDblclick:S[1]||(S[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(w.value?"▸":"▾"),41,Fx),t.createElementVNode("span",Ux,"«"+t.toDisplayString(t.unref(Ko)($.value.stereotype))+"»",1),Ve.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:V,"onUpdate:modelValue":S[2]||(S[2]=ne=>H.value=ne),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Ze,["enter"]),S[3]||(S[3]=t.withKeys(ne=>Ve.value=!1,["esc"]))],onBlur:Ze,onPointerdown:S[4]||(S[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,H.value]]):(t.openBlock(),t.createElementBlock("span",Hx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Be.value,(ne,xe)=>(t.openBlock(),t.createElementBlock("span",{key:xe,class:t.normalizeClass({"em-entity__missing":ne.missing})},t.toDisplayString(ne.text),3))),128))])),!w.value&&U.value&&X.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:F.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!F.value,onClick:t.withModifiers(K,["stop"]),onPointerdown:S[5]||(S[5]=t.withModifiers(()=>{},["stop"])),onDblclick:S[6]||(S[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",Kx,t.toDisplayString(F.value?"▸":"▾"),1)],40,jx)):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(Ae,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:zt,class:"em-entity__attrs"},[ut.value&&ut.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ut.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.value,ne=>{var xe,de,Ce,Fe,He,rt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ne.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":T.value.has(ne.modelId),"is-dragging":(xe=ut.value)==null?void 0:xe.ids.has(ne.modelId),"is-embed":le(ne),"is-divider":ue(ne),"has-embed-badge":!!Ie(ne),nodrag:ue(ne)&&M.value,"is-diff-changed":!!((de=u.value)!=null&&de.changedAttributeIds.has(ne.modelId))}]),"data-attr":ne.modelId,onClick:t.withModifiers(ze=>x(ne,ze),["stop"]),onPointerdown:ze=>ue(ne)?Qt(ne,ze):void 0,onPointermove:ze=>ue(ne)?en(ze):void 0,onPointerup:ze=>ue(ne)?Ne():void 0,onPointercancel:ze=>ue(ne)?et():void 0},[M.value&&!ue(ne)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ze=>Qt(ne,ze),onPointermove:en,onPointerup:Ne,onPointercancel:et,onClick:S[7]||(S[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Yx)):t.createCommentVNode("",!0),ue(ne)?(t.openBlock(),t.createElementBlock("span",qx,t.toDisplayString(ne.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Xn),{id:`l:${ne.modelId}`,type:"target",position:t.unref($e).Left,class:"em-handle",title:M.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:ie(W.value[ne.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",Jx,[(Ce=W.value[ne.modelId])!=null&&Ce.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Fe=W.value[ne.modelId])!=null&&Fe.required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",Xx,[U.value&&Y(ne)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:we(ne)?i("em.node.embedAttrShow",{count:j(ne)}):i("em.node.embedAttrHide"),"aria-expanded":!we(ne),onClick:t.withModifiers(ze=>Te(ne),["stop"]),onPointerdown:S[8]||(S[8]=t.withModifiers(()=>{},["stop"])),onDblclick:S[9]||(S[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(we(ne)?"▸":"▾"),41,Zx)):le(ne)?(t.openBlock(),t.createBlock(Ae,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(He=W.value[ne.modelId])!=null&&He.fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,Wx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:ye(ne)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe(ne),(ze,ot)=>(t.openBlock(),t.createElementBlock("span",{key:ot,class:t.normalizeClass({"em-entity__missing":ze.missing})},t.toDisplayString(ze.text),3))),128))],4),Ie(ne)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:j(ne)}),onClick:t.withModifiers(ze=>Te(ne),["stop"])},"+"+t.toDisplayString(j(ne)),9,Qx)):Ie(ne)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:_e(ne)?i("em.node.embedRepeatedShow",{count:((rt=P(ne))==null?void 0:rt.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!_e(ne),onClick:t.withModifiers(ze=>ve(ne),["stop"])},t.toDisplayString(_e(ne)?`+${he(ne)}`:"−"),9,eC)):t.createCommentVNode("",!0),ae.value[ne.modelId]?(t.openBlock(),t.createElementBlock("span",tC,t.toDisplayString(ae.value[ne.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Xn),{id:`r:${ne.modelId}`,type:"source",position:t.unref($e).Right,class:"em-handle",title:M.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,Gx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le(ne)&&U.value?J(ne):[],ze=>(t.openBlock(),t.createElementBlock("li",{key:`${ne.modelId}:${ze.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":T.value.has(ne.modelId)}]),onClick:t.withModifiers(ot=>x(ne,ot),["stop"])},[S[12]||(S[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",oC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te(ze),(ot,tt)=>(t.openBlock(),t.createElementBlock("span",{key:tt,class:t.normalizeClass({"em-entity__missing":ot.missing})},t.toDisplayString(ot.text),3))),128))]),t.createElementVNode("span",iC,t.toDisplayString(ze.dataType),1)],10,nC))),128))],64)}),128)),Q.value?(t.openBlock(),t.createElementBlock("li",aC,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(K,["stop"])},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:Q.value})),1)],8,rC)])):t.createCommentVNode("",!0)],512)),!w.value&&me.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ft,class:"em-entity__ops"},[pt.value&&pt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${pt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,ne=>{var xe,de;return t.openBlock(),t.createElementBlock("li",{key:ne.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((xe=pt.value)==null?void 0:xe.id)===ne.modelId,"is-diff-changed":!!((de=u.value)!=null&&de.changedOperationIds.has(ne.modelId))}]),"data-op":ne.modelId},[M.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ce=>nt(ne,Ce),onPointermove:Fo,onPointerup:Uo,onPointercancel:Ho,onClick:S[10]||(S[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,sC)):t.createCommentVNode("",!0),t.createElementVNode("span",cC,t.toDisplayString(ke(ne.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:Se(ne)})},t.toDisplayString(ne.name)+"()",5)],10,lC)}),128))],512)):ge.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ge.value.length})},[t.createVNode(Ae,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ge.value.length})),1)],8,dC)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("footer",uC,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Ue},t.toDisplayString(i("em.node.addAttr")),1),S[13]||(S[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Le},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),M.value&&!Ve.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:gn,onPointermove:Ee,onPointerup:at},null,32)):t.createCommentVNode("",!0)],46,Px)}}}),[["__scopeId","data-v-4dfeab79"]]),mC={key:0,class:"em-sel","aria-hidden":"true"},fC={class:"em-group__label"},pC={class:"em-group__name"},hC={key:0,class:"em-group__pkg"},yC={key:1,class:"em-group__flag"},Uf=Ke(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>_t(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(no,null),s=($,B)=>l?l.t($,B):Dt("ko",$,B),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var $;return!!n.id&&(($=l==null?void 0:l.selection.value)==null?void 0:$.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Xa,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Vo,null);function h(){n.id&&(f==null||f.setGroupHover(n.id))}function g(){f==null||f.setGroupHover(null)}const k=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),N=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:b,findNode:_}=je();let E=null,I=null;function A($){var y;if(!n.id||!c.value)return;$.stopPropagation();const B=((y=_(n.id))==null?void 0:y.dimensions)??{width:400,height:300},O=b({x:$.clientX,y:$.clientY});E={fx:O.x,fy:O.y,w:B.width,h:B.height},$.target.setPointerCapture($.pointerId)}function T($){if(!E||!n.id)return;const B=b({x:$.clientX,y:$.clientY});I={width:Math.max(160,E.w+(B.x-E.fx)),height:Math.max(120,E.h+(B.y-E.fy))};const O=_(n.id);O&&(O.style={width:`${I.width}px`,height:`${I.height}px`})}function L($){var B,O;E&&I&&n.id&&l&&l.resizeGroup(n.id,I),E=null,I=null,(O=(B=$.target).releasePointerCapture)==null||O.call(B,$.pointerId)}const x=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),R=t.computed(()=>{const $=o.value.name;return($==null?void 0:$[x.value])||($==null?void 0:$.ko)||($==null?void 0:$.en)||($==null?void 0:$.ja)||($==null?void 0:$.zh)||o.value.packageName||s("em.group.fallback")});return($,B)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":k.value,"is-dimmed":N.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:h,onMouseleave:g},[d.value?(t.openBlock(),t.createElementBlock("div",mC,[...B[0]||(B[0]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",fC,[t.createElementVNode("span",pC,t.toDisplayString(R.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",hC,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",yC,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ae,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:T,onPointerup:L},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),gC={key:0,class:"em-sel","aria-hidden":"true"},bC={key:2,class:"em-note__text"},Hf=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(no,null),i=t.inject(Xa,null),a=t.inject(Vo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>_t(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const p=t.computed(()=>{var y;return((y=a==null?void 0:a.source.value)==null?void 0:y.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),h=t.computed(()=>{var y;return((y=o==null?void 0:o.selection.value)==null?void 0:y.kind)==="note"&&o.selection.value.id===n.id}),g=t.computed(()=>!!n.selected&&!h.value),k=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!h.value),N=[{id:"n-top",pos:$e.Top},{id:"n-right",pos:$e.Right},{id:"n-bottom",pos:$e.Bottom},{id:"n-left",pos:$e.Left}],b=t.ref(!1),_=t.ref(""),E=t.ref(null);async function I(){var y;l.value&&(_.value=r.value.memo,b.value=!0,await t.nextTick(),(y=E.value)==null||y.focus())}function A(){b.value&&(b.value=!1,_.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,_.value)))}const{screenToFlowCoordinate:T,findNode:L}=je();let x=null,R=null;function $(y){var M;if(!l.value)return;y.stopPropagation();const w=((M=L(n.id))==null?void 0:M.dimensions)??r.value.geo.size,v=T({x:y.clientX,y:y.clientY});x={fx:v.x,fy:v.y,w:w.width,h:w.height},y.target.setPointerCapture(y.pointerId)}function B(y){if(!x)return;const w=T({x:y.clientX,y:y.clientY});R={width:Math.max(140,x.w+(w.x-x.fx)),height:Math.max(60,x.h+(w.y-x.fy))};const v=L(n.id);v&&(v.style={width:`${R.width}px`,height:`${R.height}px`})}function O(y){var w,v;x&&R&&o&&o.resizeNote(n.id,R),x=null,R=null,(v=(w=y.target).releasePointerCapture)==null||v.call(w,y.pointerId)}return(y,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":k.value,"is-selected":h.value,"is-multi-selected":g.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:I,onPointerdown:d,onMouseenter:u,onMouseleave:m},[h.value?(t.openBlock(),t.createElementBlock("div",gC,[...w[4]||(w[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),b.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:E,"onUpdate:modelValue":w[0]||(w[0]=v=>_.value=v),class:"em-note__edit nodrag",onBlur:A,onKeydown:w[1]||(w[1]=t.withKeys(v=>b.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,_.value]]):(t.openBlock(),t.createElementBlock("div",bC,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(N,v=>t.createVNode(t.unref(Xn),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!b.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:$,onPointermove:B,onPointerup:O},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Za(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const Bo=.5;function jf(e,n,o,i,a,r){const l=Za(n),s=Za(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let p=e;const f=(k,N)=>{(Math.abs(k.x-p.x)>=Bo||Math.abs(k.y-p.y)>=Bo)&&(m.push({a:p,b:k,seg:N}),p=k)};f(c,0);let h=l.x!==0,g=c;for(let k=1;k<u.length;k++){const N=u[k],b=k<=o.length?k-1:o.length,_=Math.abs(N.x-g.x)<Bo,E=Math.abs(N.y-g.y)<Bo;_&&E||(_?(f(N,b),h=!1):E?(f(N,b),h=!0):h?(f({x:g.x,y:N.y},b),f(N,b),h=!0):(f({x:N.x,y:g.y},b),f(N,b),h=!1),g=N)}return f(i,o.length),m}function Kf(e,n,o,i,a,r=20){const l=jf(e,n,o,i,a,r);let s=`M ${kt(e.x)},${kt(e.y)}`;for(const c of l)s+=` L ${kt(c.b.x)},${kt(c.b.y)}`;return s}const _C=14;function Gf(e,n,o,i,a,r=20){return jf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=_C).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function kt(e){return Math.round(e*100)/100}const kC=36;function EC(e,n,o=kC){const i=Math.max(e.x,n.x)+o;return`M ${kt(e.x)},${kt(e.y)} L ${kt(i)},${kt(e.y)} L ${kt(i)},${kt(n.y)} L ${kt(n.x)},${kt(n.y)}`}function Yf(e,n,o){const i=[e,...n,o];let a=`M ${kt(i[0].x)},${kt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${kt(i[r].x)},${kt(i[r].y)}`;return a}function NC(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function qf(e,n){const o=NC(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Bo&&Math.abs(l)<Bo)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function Wf(e,n,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:n},side:i?"right":"left"}}function Jf(e,n,o){const i=[e,...n,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const wC=20,IC=22,vC=7,xC=22,Xf=31,Zf=7,CC=20,Qf=11,ep=11,SC=Xf+Zf;function RC(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function AC(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Qa(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function tp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function er(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function np(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:tp(e,n);return[er(o,a,r-Math.PI/2),er(o,a,r+Math.PI/2)]}function op(e,n,o,i){const a=n*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function ip(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Qa(e,n,wC),[d,u]=np(e,n,c,IC);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),RC(o.multiplicity)){const m=Qa(e,n,Xf);r.push({cx:m.x,cy:m.y,r:Zf})}if(AC(o.multiplicity)){const m=Qa(e,n,vC),[p,f]=np(e,n,m,xC);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Qa(e,n,CC),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=tp(e,n),m=er(d,Qf/2,u-Math.PI/2),p=er(d,Qf/2,u+Math.PI/2);l.push({points:[e,m,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=op(s,c,ep,!0),u=op(s,c,ep,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:r,polygons:l}}const ap=200,rp=120,ns=24;function lp(e){var a,r;if(!e)return{x:0,y:0,width:ap,height:rp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||ap,i=((r=e.dimensions)==null?void 0:r.height)||rp;return{x:n.x,y:n.y,width:o,height:i}}function sp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function cp(e){const n=t.computed(()=>lp(e.sourceNode())),o=t.computed(()=>lp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,h;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<ns){const g=(m+p)/2;m=g-ns/2,p=g+ns/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??sp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??sp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Wf(n.value,d,r.value.x):qf(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Wf(o.value,d,l.value.x):qf(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const os=Symbol("waypointController"),$C=["d"],TC=["d"],MC=["d"],VC=["x1","y1","x2","y2"],BC=["cx","cy","r"],DC=["x","y"],OC=["x","y"],LC=["cx","cy","onDblclick"],PC=["x","y","onPointerdown","onDblclick"],dp=Ke(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(os),a=t.inject(no,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Af,null),s=t.inject(Vo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var oe;return((oe=a==null?void 0:a.selection.value)==null?void 0:oe.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const oe=l==null?void 0:l.value;if(!oe||!a)return null;const le=a.resolved.value.entities,ue=P=>{var F;return(F=le.find(Q=>Q.entity.modelId===P))==null?void 0:F.groupRef},z=n.data.association;return ue(z.end1.entityRef)===oe.groupId&&ue(z.end2.entityRef)===oe.groupId?{dx:oe.dx,dy:oe.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),h=t.ref({x:0,y:0}),g=t.computed(()=>{const oe=m.value;return p.value.map((le,ue)=>ue===f.value?h.value:oe?{x:le.x+oe.dx,y:le.y+oe.dy}:le)}),k=t.computed(()=>{var oe;return!!((oe=n.sourceNode.data)!=null&&oe.collapsed)}),N=t.computed(()=>{var oe;return!!((oe=n.targetNode.data)!=null&&oe.collapsed)}),{source:b,target:_,sourceSide:E,targetSide:I,isSelf:A}=cp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>g.value,sourceRowY:()=>n.data.sourceColumnRef&&!k.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!N.value?n.targetY:void 0}),T=SC+4,L=t.computed(()=>A.value?EC(b.value,_.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Kf(b.value,E.value,g.value,_.value,I.value,T):Yf(b.value,g.value,_.value)),x=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Gf(b.value,E.value,g.value,_.value,I.value,T):Jf(b.value,g.value,_.value).map((oe,le)=>({point:oe,segIndex:le}))),R=t.computed(()=>A.value||!r.value?[]:g.value),$=Hi;function B(oe,le){f.value=oe,h.value={...p.value[oe]},le.target.setPointerCapture(le.pointerId),le.stopPropagation()}function O(oe){if(f.value<0)return;const le=o({x:oe.clientX,y:oe.clientY});h.value={x:le.x,y:le.y}}function y(oe){var le,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...h.value}),f.value=-1,(ue=(le=oe.target).releasePointerCapture)==null||ue.call(le,oe.pointerId)}function w(oe,le){le.stopPropagation(),i==null||i.removePoint(n.id,oe)}function v(oe,le){if(!i)return;const ue=o({x:le.clientX,y:le.clientY});i.insertPoint(n.id,oe,{x:ue.x,y:ue.y})}const M=t.computed(()=>$(n.data.association.end1.multiplicity)),D=t.computed(()=>$(n.data.association.end2.multiplicity)),U=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),W=t.computed(()=>U.value==="class"),ie=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const oe=Za(E.value);return{x:b.value.x+oe.x*10,y:b.value.y+oe.y*10}}return g.value[0]??_.value}),pe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const le=Za(I.value);return{x:_.value.x+le.x*10,y:_.value.y+le.y*10}}const oe=g.value;return oe[oe.length-1]??b.value}),ye=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end1.multiplicity,navigable:oe.end1.navigable,composition:oe.end1.composition,otherNavigable:oe.end2.navigable}}),ge=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end2.multiplicity,navigable:oe.end2.navigable,composition:oe.end2.composition,otherNavigable:oe.end1.navigable}}),me=t.computed(()=>ip(b.value,ie.value,ye.value,U.value)),se=t.computed(()=>ip(_.value,pe.value,ge.value,U.value)),ke=t.computed(()=>[...me.value.lines,...se.value.lines]),Se=t.computed(()=>[...me.value.circles,...se.value.circles]),ce=t.computed(()=>[...me.value.polygons,...se.value.polygons].map(oe=>`M${oe.points.map(le=>`${le.x},${le.y}`).join(" L")} Z`)),fe=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(oe,le)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:L.value,fill:"none",class:"em-edge__hit"},null,8,$C),t.createElementVNode("path",{d:L.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,TC),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,(ue,z)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${z}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",fe.value])},null,10,MC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ke.value,(ue,z)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${z}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,VC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${z}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,BC))),128)),W.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(b).x+8,y:t.unref(b).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(M.value),11,DC),t.createElementVNode("text",{x:t.unref(_).x-8,y:t.unref(_).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(D.value),11,OC)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${z}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(P=>v(ue.segIndex,P),["stop"])},null,42,LC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.value,(ue,z)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${z}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:P=>B(z,P),onPointermove:O,onPointerup:y,onDblclick:P=>w(z,P)},null,42,PC))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var mn=(e=>(e.Lines="lines",e.Dots="dots",e))(mn||{});const up=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},mp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};mn.Lines+"",mn.Dots+"";const zC={[mn.Dots]:"#81818a",[mn.Lines]:"#eee"},FC=["id","x","y","width","height","patternTransform"],UC={key:2,height:"100",width:"100"},HC=["fill"],jC=["x","y","fill"],KC={name:"Background",compatConfig:{MODE:3}},GC=t.defineComponent({...KC,props:{id:{},variant:{default:()=>mn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=je(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||zC[e.variant||mn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(mn).Lines?(t.openBlock(),t.createBlock(t.unref(up),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(mn).Dots?(t.openBlock(),t.createBlock(t.unref(mp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",UC,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,HC)])):t.createCommentVNode("",!0)])],8,FC)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,jC),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),YC={name:"ControlButton",compatConfig:{MODE:3}},qC=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},WC={type:"button",class:"vue-flow__controls-button"};function JC(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",WC,[t.renderSlot(e.$slots,"default")])}const oo=qC(YC,[["render",JC]]),XC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ZC=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function QC(e,n){return t.openBlock(),t.createElementBlock("svg",XC,ZC)}const eS={render:QC},tS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},nS=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function oS(e,n){return t.openBlock(),t.createElementBlock("svg",tS,nS)}const iS={render:oS},aS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},rS=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function lS(e,n){return t.openBlock(),t.createElementBlock("svg",aS,rS)}const sS={render:lS},cS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function uS(e,n){return t.openBlock(),t.createElementBlock("svg",cS,dS)}const mS={render:uS},fS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pS=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function hS(e,n){return t.openBlock(),t.createElementBlock("svg",fS,pS)}const yS={render:hS},gS={name:"Controls",compatConfig:{MODE:3}},bS=t.defineComponent({...gS,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>um.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=je(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),h=t.toRef(()=>d.value.zoom>=m.value);function g(){l(),n("zoomIn")}function k(){s(),n("zoomOut")}function N(){c(e.fitViewParams),n("fitView")}function b(){r(!p.value),n("interactionChange",!p.value)}return(_,E)=>(t.openBlock(),t.createBlock(t.unref(df),{class:"vue-flow__controls",position:_.position},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"top"),_.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(_.$slots,"control-zoom-in",{},()=>[t.createVNode(oo,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(eS))))])]),_:3},8,["disabled"])]),t.renderSlot(_.$slots,"control-zoom-out",{},()=>[t.createVNode(oo,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:k},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(iS))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),_.showFitView?t.renderSlot(_.$slots,"control-fit-view",{key:1},()=>[t.createVNode(oo,{class:"vue-flow__controls-fitview",onClick:N},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(sS))))])]),_:3})]):t.createCommentVNode("",!0),_.showInteractive?t.renderSlot(_.$slots,"control-interactive",{key:2},()=>[_.showInteractive?(t.openBlock(),t.createBlock(oo,{key:0,class:"vue-flow__controls-interactive",onClick:b},{default:t.withCtx(()=>[p.value?t.renderSlot(_.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(yS))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(_.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(mS))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(_.$slots,"default")]),_:3},8,["position"]))}});var _S={value:()=>{}};function is(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new tr(o)}function tr(e){this._=e}function kS(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}tr.prototype=is.prototype={constructor:tr,on:function(e,n){var o=this._,i=kS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=ES(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=fp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=fp(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new tr(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function ES(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function fp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=_S,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var as="http://www.w3.org/1999/xhtml";const pp={svg:"http://www.w3.org/2000/svg",xhtml:as,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),pp.hasOwnProperty(n)?{space:pp[n],local:e}:e}function NS(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===as&&n.documentElement.namespaceURI===as?n.createElement(e):n.createElementNS(o,e)}}function wS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hp(e){var n=nr(e);return(n.local?wS:NS)(n)}function IS(){}function rs(e){return e==null?IS:function(){return this.querySelector(e)}}function vS(e){typeof e!="function"&&(e=rs(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new St(i,this._parents)}function xS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function CS(){return[]}function yp(e){return e==null?CS:function(){return this.querySelectorAll(e)}}function SS(e){return function(){return xS(e.apply(this,arguments))}}function RS(e){typeof e=="function"?e=SS(e):e=yp(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new St(i,a)}function gp(e){return function(){return this.matches(e)}}function bp(e){return function(n){return n.matches(e)}}var AS=Array.prototype.find;function $S(e){return function(){return AS.call(this.children,e)}}function TS(){return this.firstElementChild}function MS(e){return this.select(e==null?TS:$S(typeof e=="function"?e:bp(e)))}var VS=Array.prototype.filter;function BS(){return Array.from(this.children)}function DS(e){return function(){return VS.call(this.children,e)}}function OS(e){return this.selectAll(e==null?BS:DS(typeof e=="function"?e:bp(e)))}function LS(e){typeof e!="function"&&(e=gp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new St(i,this._parents)}function _p(e){return new Array(e.length)}function PS(){return new St(this._enter||this._groups.map(_p),this._parents)}function or(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}or.prototype={constructor:or,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function zS(e){return function(){return e}}function FS(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new or(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function US(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new or(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function HS(e){return e.__data__}function jS(e,n){if(!arguments.length)return Array.from(this,HS);var o=n?US:FS,i=this._parents,a=this._groups;typeof e!="function"&&(e=zS(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=KS(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),k=l[d]=new Array(h),N=c[d]=new Array(p);o(u,m,g,k,N,f,n);for(var b=0,_=0,E,I;b<h;++b)if(E=g[b]){for(b>=_&&(_=b+1);!(I=k[_])&&++_<h;);E._next=I||null}}return l=new St(l,i),l._enter=s,l._exit=c,l}function KS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function GS(){return new St(this._exit||this._groups.map(_p),this._parents)}function YS(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function qS(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new St(s,this._parents)}function WS(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function JS(e){e||(e=XS);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new St(a,this._parents).order()}function XS(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function ZS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function QS(){return Array.from(this)}function eR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function tR(){let e=0;for(const n of this)++e;return e}function nR(){return!this.node()}function oR(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function iR(e){return function(){this.removeAttribute(e)}}function aR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rR(e,n){return function(){this.setAttribute(e,n)}}function lR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function sR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function cR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function dR(e,n){var o=nr(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?aR:iR:typeof n=="function"?o.local?cR:sR:o.local?lR:rR)(o,n))}function kp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function uR(e){return function(){this.style.removeProperty(e)}}function mR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function fR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function pR(e,n,o){return arguments.length>1?this.each((n==null?uR:typeof n=="function"?fR:mR)(e,n,o??"")):Do(this.node(),e)}function Do(e,n){return e.style.getPropertyValue(n)||kp(e).getComputedStyle(e,null).getPropertyValue(n)}function hR(e){return function(){delete this[e]}}function yR(e,n){return function(){this[e]=n}}function gR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function bR(e,n){return arguments.length>1?this.each((n==null?hR:typeof n=="function"?gR:yR)(e,n)):this.node()[e]}function Ep(e){return e.trim().split(/^|\s+/)}function ls(e){return e.classList||new Np(e)}function Np(e){this._node=e,this._names=Ep(e.getAttribute("class")||"")}Np.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function wp(e,n){for(var o=ls(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Ip(e,n){for(var o=ls(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function _R(e){return function(){wp(this,e)}}function kR(e){return function(){Ip(this,e)}}function ER(e,n){return function(){(n.apply(this,arguments)?wp:Ip)(this,e)}}function NR(e,n){var o=Ep(e+"");if(arguments.length<2){for(var i=ls(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?ER:n?_R:kR)(o,n))}function wR(){this.textContent=""}function IR(e){return function(){this.textContent=e}}function vR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function xR(e){return arguments.length?this.each(e==null?wR:(typeof e=="function"?vR:IR)(e)):this.node().textContent}function CR(){this.innerHTML=""}function SR(e){return function(){this.innerHTML=e}}function RR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function AR(e){return arguments.length?this.each(e==null?CR:(typeof e=="function"?RR:SR)(e)):this.node().innerHTML}function $R(){this.nextSibling&&this.parentNode.appendChild(this)}function TR(){return this.each($R)}function MR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function VR(){return this.each(MR)}function BR(e){var n=typeof e=="function"?e:hp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function DR(){return null}function OR(e,n){var o=typeof e=="function"?e:hp(e),i=n==null?DR:typeof n=="function"?n:rs(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function LR(){var e=this.parentNode;e&&e.removeChild(this)}function PR(){return this.each(LR)}function zR(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function FR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function UR(e){return this.select(e?FR:zR)}function HR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function jR(e){return function(n){e.call(this,n,this.__data__)}}function KR(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function GR(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function YR(e,n,o){return function(){var i=this.__on,a,r=jR(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function qR(e,n,o){var i=KR(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?YR:GR,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function vp(e,n,o){var i=kp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function WR(e,n){return function(){return vp(this,e,n)}}function JR(e,n){return function(){return vp(this,e,n.apply(this,arguments))}}function XR(e,n){return this.each((typeof n=="function"?JR:WR)(e,n))}function*ZR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var xp=[null];function St(e,n){this._groups=e,this._parents=n}function wi(){return new St([[document.documentElement]],xp)}function QR(){return this}St.prototype=wi.prototype={constructor:St,select:vS,selectAll:RS,selectChild:MS,selectChildren:OS,filter:LS,data:jS,enter:PS,exit:GS,join:YS,merge:qS,selection:QR,order:WS,sort:JS,call:ZS,nodes:QS,node:eR,size:tR,empty:nR,each:oR,attr:dR,style:pR,property:bR,classed:NR,text:xR,html:AR,raise:TR,lower:VR,append:BR,insert:OR,remove:PR,clone:UR,datum:HR,on:qR,dispatch:XR,[Symbol.iterator]:ZR};function Rn(e){return typeof e=="string"?new St([[document.querySelector(e)]],[document.documentElement]):new St([[e]],xp)}function eA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function An(e,n){if(e=eA(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const ss={capture:!0,passive:!1};function cs(e){e.preventDefault(),e.stopImmediatePropagation()}function tA(e){var n=e.document.documentElement,o=Rn(e).on("dragstart.drag",cs,ss);"onselectstart"in n?o.on("selectstart.drag",cs,ss):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function nA(e,n){var o=e.document.documentElement,i=Rn(e).on("dragstart.drag",null);n&&(i.on("click.drag",cs,ss),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function ds(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Cp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Ii(){}var vi=.7,ir=1/vi,Oo="\\s*([+-]?\\d+)\\s*",xi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oA=/^#([0-9a-f]{3,8})$/,iA=new RegExp(`^rgb\\(${Oo},${Oo},${Oo}\\)$`),aA=new RegExp(`^rgb\\(${Xt},${Xt},${Xt}\\)$`),rA=new RegExp(`^rgba\\(${Oo},${Oo},${Oo},${xi}\\)$`),lA=new RegExp(`^rgba\\(${Xt},${Xt},${Xt},${xi}\\)$`),sA=new RegExp(`^hsl\\(${xi},${Xt},${Xt}\\)$`),cA=new RegExp(`^hsla\\(${xi},${Xt},${Xt},${xi}\\)$`),Sp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ds(Ii,Ci,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Rp,formatHex:Rp,formatHex8:dA,formatHsl:uA,formatRgb:Ap,toString:Ap});function Rp(){return this.rgb().formatHex()}function dA(){return this.rgb().formatHex8()}function uA(){return Bp(this).formatHsl()}function Ap(){return this.rgb().formatRgb()}function Ci(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=oA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?$p(n):o===3?new It(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ar(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ar(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=iA.exec(e))?new It(n[1],n[2],n[3],1):(n=aA.exec(e))?new It(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=rA.exec(e))?ar(n[1],n[2],n[3],n[4]):(n=lA.exec(e))?ar(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=sA.exec(e))?Vp(n[1],n[2]/100,n[3]/100,1):(n=cA.exec(e))?Vp(n[1],n[2]/100,n[3]/100,n[4]):Sp.hasOwnProperty(e)?$p(Sp[e]):e==="transparent"?new It(NaN,NaN,NaN,0):null}function $p(e){return new It(e>>16&255,e>>8&255,e&255,1)}function ar(e,n,o,i){return i<=0&&(e=n=o=NaN),new It(e,n,o,i)}function mA(e){return e instanceof Ii||(e=Ci(e)),e?(e=e.rgb(),new It(e.r,e.g,e.b,e.opacity)):new It}function us(e,n,o,i){return arguments.length===1?mA(e):new It(e,n,o,i??1)}function It(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}ds(It,us,Cp(Ii,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vi:Math.pow(vi,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new It(io(this.r),io(this.g),io(this.b),rr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Tp,formatHex:Tp,formatHex8:fA,formatRgb:Mp,toString:Mp}));function Tp(){return`#${ao(this.r)}${ao(this.g)}${ao(this.b)}`}function fA(){return`#${ao(this.r)}${ao(this.g)}${ao(this.b)}${ao((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mp(){const e=rr(this.opacity);return`${e===1?"rgb(":"rgba("}${io(this.r)}, ${io(this.g)}, ${io(this.b)}${e===1?")":`, ${e})`}`}function rr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function io(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ao(e){return e=io(e),(e<16?"0":"")+e.toString(16)}function Vp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Lt(e,n,o,i)}function Bp(e){if(e instanceof Lt)return new Lt(e.h,e.s,e.l,e.opacity);if(e instanceof Ii||(e=Ci(e)),!e)return new Lt;if(e instanceof Lt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Lt(l,s,c,e.opacity)}function pA(e,n,o,i){return arguments.length===1?Bp(e):new Lt(e,n,o,i??1)}function Lt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}ds(Lt,pA,Cp(Ii,{brighter(e){return e=e==null?ir:Math.pow(ir,e),new Lt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vi:Math.pow(vi,e),new Lt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new It(ms(e>=240?e-240:e+120,a,i),ms(e,a,i),ms(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Lt(Dp(this.h),lr(this.s),lr(this.l),rr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=rr(this.opacity);return`${e===1?"hsl(":"hsla("}${Dp(this.h)}, ${lr(this.s)*100}%, ${lr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dp(e){return e=(e||0)%360,e<0?e+360:e}function lr(e){return Math.max(0,Math.min(1,e||0))}function ms(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Op=e=>()=>e;function hA(e,n){return function(o){return e+o*n}}function yA(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function gA(e){return(e=+e)==1?Lp:function(n,o){return o-n?yA(n,o,e):Op(isNaN(n)?o:n)}}function Lp(e,n){var o=n-e;return o?hA(e,o):Op(isNaN(e)?n:e)}const Pp=(function e(n){var o=gA(n);function i(a,r){var l=o((a=us(a)).r,(r=us(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Lp(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function $n(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var fs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ps=new RegExp(fs.source,"g");function bA(e){return function(){return e}}function _A(e){return function(n){return e(n)+""}}function kA(e,n){var o=fs.lastIndex=ps.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=fs.exec(e))&&(a=ps.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:$n(i,a)})),o=ps.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?_A(c[0].x):bA(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var zp=180/Math.PI,hs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fp(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*zp,skewX:Math.atan(c)*zp,scaleX:l,scaleY:s}}var sr;function EA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?hs:Fp(n.a,n.b,n.c,n.d,n.e,n.f)}function NA(e){return e==null||(sr||(sr=document.createElementNS("http://www.w3.org/2000/svg","g")),sr.setAttribute("transform",e),!(e=sr.transform.baseVal.consolidate()))?hs:(e=e.matrix,Fp(e.a,e.b,e.c,e.d,e.e,e.f))}function Up(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:$n(d,m)},{i:g-2,x:$n(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:$n(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:$n(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:$n(d,m)},{i:g-2,x:$n(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,k;++h<g;)m[(k=p[h]).i]=k.x(f);return m.join("")}}}var wA=Up(EA,"px, ","px)","deg)"),IA=Up(NA,", ",")",")"),vA=1e-12;function Hp(e){return((e=Math.exp(e))+1/e)/2}function xA(e){return((e=Math.exp(e))-1/e)/2}function CA(e){return((e=Math.exp(2*e))-1)/(e+1)}const SA=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,k,N;if(g<vA)N=Math.log(p/d)/n,k=function(T){return[s+T*f,c+T*h,d*Math.exp(n*T*N)]};else{var b=Math.sqrt(g),_=(p*p-d*d+i*g)/(2*d*o*b),E=(p*p-d*d-i*g)/(2*p*o*b),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(E*E+1)-E);N=(A-I)/n,k=function(T){var L=T*N,x=Hp(I),R=d/(o*b)*(x*CA(n*L+I)-xA(I));return[s+R*f,c+R*h,d*x/Hp(n*L+I)]}}return k.duration=N*1e3*n/Math.SQRT2,k}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Lo=0,Si=0,Ri=0,jp=1e3,cr,Ai,dr=0,ro=0,ur=0,$i=typeof performance=="object"&&performance.now?performance:Date,Kp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ys(){return ro||(Kp(RA),ro=$i.now()+ur)}function RA(){ro=0}function mr(){this._call=this._time=this._next=null}mr.prototype=Gp.prototype={constructor:mr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ys():+o)+(n==null?0:+n),!this._next&&Ai!==this&&(Ai?Ai._next=this:cr=this,Ai=this),this._call=e,this._time=o,gs()},stop:function(){this._call&&(this._call=null,this._time=1/0,gs())}};function Gp(e,n,o){var i=new mr;return i.restart(e,n,o),i}function AA(){ys(),++Lo;for(var e=cr,n;e;)(n=ro-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Lo}function Yp(){ro=(dr=$i.now())+ur,Lo=Si=0;try{AA()}finally{Lo=0,TA(),ro=0}}function $A(){var e=$i.now(),n=e-dr;n>jp&&(ur-=n,dr=e)}function TA(){for(var e,n=cr,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:cr=o);Ai=e,gs(i)}function gs(e){if(!Lo){Si&&(Si=clearTimeout(Si));var n=e-ro;n>24?(e<1/0&&(Si=setTimeout(Yp,e-$i.now()-ur)),Ri&&(Ri=clearInterval(Ri))):(Ri||(dr=$i.now(),Ri=setInterval($A,jp)),Lo=1,Kp(Yp))}}function qp(e,n,o){var i=new mr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var MA=is("start","end","cancel","interrupt"),VA=[],Wp=0,Jp=1,bs=2,fr=3,Xp=4,_s=5,pr=6;function hr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;BA(e,o,{name:n,index:i,group:a,on:MA,tween:VA,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Wp})}function ks(e,n){var o=Pt(e,n);if(o.state>Wp)throw new Error("too late; already scheduled");return o}function Zt(e,n){var o=Pt(e,n);if(o.state>fr)throw new Error("too late; already running");return o}function Pt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function BA(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Gp(r,0,o.time);function r(d){o.state=Jp,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==Jp)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===fr)return qp(l);f.state===Xp?(f.state=pr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=pr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(qp(function(){o.state===fr&&(o.state=Xp,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=bs,o.on.call("start",e,e.__data__,o.index,o.group),o.state===bs){for(o.state=fr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=_s,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===_s&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=pr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function yr(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>bs&&i.state<_s,i.state=pr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function DA(e){return this.each(function(){yr(this,e)})}function OA(e,n){var o,i;return function(){var a=Zt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function LA(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Zt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function PA(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Pt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?OA:LA)(o,e,n))}function Es(e,n,o){var i=e._id;return e.each(function(){var a=Zt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Pt(a,i).value[n]}}function Zp(e,n){var o;return(typeof n=="number"?$n:n instanceof Ci?Pp:(o=Ci(n))?(n=o,Pp):kA)(e,n)}function zA(e){return function(){this.removeAttribute(e)}}function FA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function UA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function HA(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function jA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function KA(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function GA(e,n){var o=nr(e),i=o==="transform"?IA:Zp;return this.attrTween(e,typeof n=="function"?(o.local?KA:jA)(o,i,Es(this,"attr."+e,n)):n==null?(o.local?FA:zA)(o):(o.local?HA:UA)(o,i,n))}function YA(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function qA(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function WA(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&qA(e,r)),o}return a._value=n,a}function JA(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&YA(e,r)),o}return a._value=n,a}function XA(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=nr(e);return this.tween(o,(i.local?WA:JA)(i,n))}function ZA(e,n){return function(){ks(this,e).delay=+n.apply(this,arguments)}}function QA(e,n){return n=+n,function(){ks(this,e).delay=n}}function e$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?ZA:QA)(n,e)):Pt(this.node(),n).delay}function t$(e,n){return function(){Zt(this,e).duration=+n.apply(this,arguments)}}function n$(e,n){return n=+n,function(){Zt(this,e).duration=n}}function o$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?t$:n$)(n,e)):Pt(this.node(),n).duration}function i$(e,n){if(typeof n!="function")throw new Error;return function(){Zt(this,e).ease=n}}function a$(e){var n=this._id;return arguments.length?this.each(i$(n,e)):Pt(this.node(),n).ease}function r$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Zt(this,e).ease=o}}function l$(e){if(typeof e!="function")throw new Error;return this.each(r$(this._id,e))}function s$(e){typeof e!="function"&&(e=gp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new fn(i,this._parents,this._name,this._id)}function c$(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new fn(l,this._parents,this._name,this._id)}function d$(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function u$(e,n,o){var i,a,r=d$(n)?ks:Zt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function m$(e,n){var o=this._id;return arguments.length<2?Pt(this.node(),o).on.on(e):this.each(u$(o,e,n))}function f$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function p$(){return this.on("end.remove",f$(this._id))}function h$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=rs(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,hr(d[p],n,o,p,d,Pt(u,o)));return new fn(r,this._parents,n,o)}function y$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=yp(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=Pt(u,o),g=0,k=p.length;g<k;++g)(f=p[g])&&hr(f,n,o,g,p,h);r.push(p),l.push(u)}return new fn(r,l,n,o)}var g$=wi.prototype.constructor;function b$(){return new g$(this._groups,this._parents)}function _$(e,n){var o,i,a;return function(){var r=Do(this,e),l=(this.style.removeProperty(e),Do(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Qp(e){return function(){this.style.removeProperty(e)}}function k$(e,n,o){var i,a=o+"",r;return function(){var l=Do(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function E$(e,n,o){var i,a,r;return function(){var l=Do(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Do(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function N$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Zt(this,e),d=c.on,u=c.value[r]==null?s||(s=Qp(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function w$(e,n,o){var i=(e+="")=="transform"?wA:Zp;return n==null?this.styleTween(e,_$(e,i)).on("end.style."+e,Qp(e)):typeof n=="function"?this.styleTween(e,E$(e,i,Es(this,"style."+e,n))).each(N$(this._id,e)):this.styleTween(e,k$(e,i,n),o).on("end.style."+e,null)}function I$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function v$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&I$(e,l,o)),i}return r._value=n,r}function x$(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,v$(e,n,o??""))}function C$(e){return function(){this.textContent=e}}function S$(e){return function(){var n=e(this);this.textContent=n??""}}function R$(e){return this.tween("text",typeof e=="function"?S$(Es(this,"text",e)):C$(e==null?"":e+""))}function A$(e){return function(n){this.textContent=e.call(this,n)}}function $$(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&A$(a)),n}return i._value=e,i}function T$(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,$$(e))}function M$(){for(var e=this._name,n=this._id,o=eh(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Pt(c,n);hr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new fn(i,this._parents,e,o)}function V$(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Zt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var B$=0;function fn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function eh(){return++B$}var pn=wi.prototype;fn.prototype={constructor:fn,select:h$,selectAll:y$,selectChild:pn.selectChild,selectChildren:pn.selectChildren,filter:s$,merge:c$,selection:b$,transition:M$,call:pn.call,nodes:pn.nodes,node:pn.node,size:pn.size,empty:pn.empty,each:pn.each,on:m$,attr:GA,attrTween:XA,style:w$,styleTween:x$,text:R$,textTween:T$,remove:p$,tween:PA,delay:e$,duration:o$,ease:a$,easeVarying:l$,end:V$,[Symbol.iterator]:pn[Symbol.iterator]};function D$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var O$={time:null,delay:0,duration:250,ease:D$};function L$(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function P$(e){var n,o;e instanceof fn?(n=e._id,e=e._name):(n=eh(),(o=O$).time=ys(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&hr(c,e,n,d,l,o||L$(c,n));return new fn(i,this._parents,e,n)}wi.prototype.interrupt=DA,wi.prototype.transition=P$;const gr=e=>()=>e;function z$(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function hn(e,n,o){this.k=e,this.x=n,this.y=o}hn.prototype={constructor:hn,scale:function(e){return e===1?this:new hn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new hn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ns=new hn(1,0,0);hn.prototype;function ws(e){e.stopImmediatePropagation()}function Ti(e){e.preventDefault(),e.stopImmediatePropagation()}function F$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function U$(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function th(){return this.__zoom||Ns}function H$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function j$(){return navigator.maxTouchPoints||"ontouchstart"in this}function K$(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function G$(){var e=F$,n=U$,o=K$,i=H$,a=j$,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=SA,d=is("start","zoom","end"),u,m,p,f=500,h=150,g=0,k=10;function N(y){y.property("__zoom",th).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(y,w,v,M){var D=y.selection?y.selection():y;D.property("__zoom",th),y!==D?I(y,w,v,M):D.interrupt().each(function(){A(this,arguments).event(M).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},N.scaleBy=function(y,w,v,M){N.scaleTo(y,function(){var D=this.__zoom.k,U=typeof w=="function"?w.apply(this,arguments):w;return D*U},v,M)},N.scaleTo=function(y,w,v,M){N.transform(y,function(){var D=n.apply(this,arguments),U=this.__zoom,W=v==null?E(D):typeof v=="function"?v.apply(this,arguments):v,ie=U.invert(W),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(b(U,pe),W,ie),D,l)},v,M)},N.translateBy=function(y,w,v,M){N.transform(y,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,M)},N.translateTo=function(y,w,v,M,D){N.transform(y,function(){var U=n.apply(this,arguments),W=this.__zoom,ie=M==null?E(U):typeof M=="function"?M.apply(this,arguments):M;return o(Ns.translate(ie[0],ie[1]).scale(W.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),U,l)},M,D)};function b(y,w){return w=Math.max(r[0],Math.min(r[1],w)),w===y.k?y:new hn(w,y.x,y.y)}function _(y,w,v){var M=w[0]-v[0]*y.k,D=w[1]-v[1]*y.k;return M===y.x&&D===y.y?y:new hn(y.k,M,D)}function E(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function I(y,w,v,M){y.on("start.zoom",function(){A(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,U=arguments,W=A(D,U).event(M),ie=n.apply(D,U),pe=v==null?E(ie):typeof v=="function"?v.apply(D,U):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=D.__zoom,me=typeof w=="function"?w.apply(D,U):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new hn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}W.zoom(null,ke)}})}function A(y,w,v){return!v&&y.__zooming||new T(y,w)}function T(y,w){this.that=y,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(y,w),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,w){return this.mouse&&y!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var w=Rn(this.that).datum();d.call(y,this.that,new z$(y,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:d}),w)}};function L(y,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(y),M=this.__zoom,D=Math.max(r[0],Math.min(r[1],M.k*Math.pow(2,i.apply(this,arguments)))),U=An(y);if(v.wheel)(v.mouse[0][0]!==U[0]||v.mouse[0][1]!==U[1])&&(v.mouse[1]=M.invert(v.mouse[0]=U)),clearTimeout(v.wheel);else{if(M.k===D)return;v.mouse=[U,M.invert(U)],yr(this),v.start()}Ti(y),v.wheel=setTimeout(W,h),v.zoom("mouse",o(_(b(M,D),v.mouse[0],v.mouse[1]),v.extent,l));function W(){v.wheel=null,v.end()}}function x(y,...w){if(p||!e.apply(this,arguments))return;var v=y.currentTarget,M=A(this,w,!0).event(y),D=Rn(y.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),U=An(y,v),W=y.clientX,ie=y.clientY;tA(y.view),ws(y),M.mouse=[U,this.__zoom.invert(U)],yr(this),M.start();function pe(ge){if(Ti(ge),!M.moved){var me=ge.clientX-W,se=ge.clientY-ie;M.moved=me*me+se*se>g}M.event(ge).zoom("mouse",o(_(M.that.__zoom,M.mouse[0]=An(ge,v),M.mouse[1]),M.extent,l))}function ye(ge){D.on("mousemove.zoom mouseup.zoom",null),nA(ge.view,M.moved),Ti(ge),M.event(ge).end()}}function R(y,...w){if(e.apply(this,arguments)){var v=this.__zoom,M=An(y.changedTouches?y.changedTouches[0]:y,this),D=v.invert(M),U=v.k*(y.shiftKey?.5:2),W=o(_(b(v,U),M,D),n.apply(this,w),l);Ti(y),s>0?Rn(this).transition().duration(s).call(I,W,M,y):Rn(this).call(N.transform,W,M,y)}}function $(y,...w){if(e.apply(this,arguments)){var v=y.touches,M=v.length,D=A(this,w,y.changedTouches.length===M).event(y),U,W,ie,pe;for(ws(y),W=0;W<M;++W)ie=v[W],pe=An(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],D.touch0?!D.touch1&&D.touch0[2]!==pe[2]&&(D.touch1=pe,D.taps=0):(D.touch0=pe,U=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),U&&(D.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),yr(this),D.start())}}function B(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W,ie,pe;for(Ti(y),U=0;U<D;++U)W=M[U],ie=An(W,this),v.touch0&&v.touch0[2]===W.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===W.identifier&&(v.touch1[0]=ie);if(W=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;W=b(W,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(_(W,ie,pe),v.extent,l))}}function O(y,...w){if(this.__zooming){var v=A(this,w).event(y),M=y.changedTouches,D=M.length,U,W;for(ws(y),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),U=0;U<D;++U)W=M[U],v.touch0&&v.touch0[2]===W.identifier?delete v.touch0:v.touch1&&v.touch1[2]===W.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(W=An(W,this),Math.hypot(m[0]-W[0],m[1]-W[1])<k)){var ie=Rn(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return N.wheelDelta=function(y){return arguments.length?(i=typeof y=="function"?y:gr(+y),N):i},N.filter=function(y){return arguments.length?(e=typeof y=="function"?y:gr(!!y),N):e},N.touchable=function(y){return arguments.length?(a=typeof y=="function"?y:gr(!!y),N):a},N.extent=function(y){return arguments.length?(n=typeof y=="function"?y:gr([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),N):n},N.scaleExtent=function(y){return arguments.length?(r[0]=+y[0],r[1]=+y[1],N):[r[0],r[1]]},N.translateExtent=function(y){return arguments.length?(l[0][0]=+y[0][0],l[1][0]=+y[1][0],l[0][1]=+y[0][1],l[1][1]=+y[1][1],N):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},N.constrain=function(y){return arguments.length?(o=y,N):o},N.duration=function(y){return arguments.length?(s=+y,N):s},N.interpolate=function(y){return arguments.length?(c=y,N):c},N.on=function(){var y=d.on.apply(d,arguments);return y===d?N:y},N.clickDistance=function(y){return arguments.length?(g=(y=+y)*y,N):Math.sqrt(g)},N.tapDistance=function(y){return arguments.length?(k=+y,N):k},N}const nh=Symbol("MiniMapSlots"),Y$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],q$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},W$=t.defineComponent({...q$,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:n}){const o=e,i=t.inject(nh),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,p)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,Y$))],64)):t.createCommentVNode("",!0)}}),J$=["width","height","viewBox","aria-labelledby"],X$=["id"],Z$=["d","fill","stroke","stroke-width"],Q$={name:"MiniMap",compatConfig:{MODE:3}},eT=t.defineComponent({...Q$,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:p,d3Zoom:f,getNodesInitialized:h}=je(),g=t.ref();t.provide(nh,o);const k=t.toRef(()=>{var D;return e.width??((D=i.style)==null?void 0:D.width)??a}),N=t.toRef(()=>{var D;return e.height??((D=i.style)==null?void 0:D.height)??r}),b=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",_=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),E=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),I=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=t.computed(()=>Ol(h.value.filter(D=>!D.hidden))),T=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),L=t.computed(()=>h.value&&h.value.length?k0(A.value,T.value):T.value),x=t.computed(()=>{const D=L.value.width/k.value,U=L.value.height/N.value;return Math.max(D,U)}),R=t.computed(()=>{const D=x.value*k.value,U=x.value*N.value,W=e.offsetScale*x.value;return{offset:W,x:L.value.x-(D-L.value.width)/2-W,y:L.value.y-(U-L.value.height)/2-W,width:D+W*2,height:U+W*2}}),$=t.computed(()=>!R.value.x||!R.value.y?"":`
|
|
53
53
|
M${R.value.x-R.value.offset},${R.value.y-R.value.offset}
|
|
54
54
|
h${R.value.width+R.value.offset*2}
|
|
55
55
|
v${R.value.height+R.value.offset*2}
|
|
@@ -62,5 +62,5 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
|
|
|
62
62
|
h${-(T.value.width-2*e.maskBorderRadius)}
|
|
63
63
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
64
64
|
v${-(T.value.height-2*e.maskBorderRadius)}
|
|
65
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(D=>{if(g.value){const U=Rn(g.value),W=ye=>{if(ye.sourceEvent.type!=="wheel"||!p.value||!f.value)return;const ge=ye.sourceEvent.ctrlKey&&ki()?10:1,me=-ye.sourceEvent.deltaY*(ye.sourceEvent.deltaMode===1?.05:ye.sourceEvent.deltaMode?1:.002)*e.zoomStep,se=c.value.zoom*2**(me*ge);f.value.scaleTo(p.value,se)},ie=ye=>{if(ye.sourceEvent.type!=="mousemove"||!p.value||!f.value)return;const ge=x.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),me={x:c.value.x-ye.sourceEvent.movementX*ge,y:c.value.y-ye.sourceEvent.movementY*ge},se=[[0,0],[u.value.width,u.value.height]],ke=Es.translate(me.x,me.y).scale(c.value.zoom),Se=f.value.constrain()(ke,se,d.value);f.value.transform(p.value,Se)},pe=G$().wheelDelta(ye=>Ol(ye)*(e.zoomStep/10)).on("zoom",e.pannable?ie:()=>{}).on("zoom.wheel",e.zoomable?W:()=>{});U.call(pe),D(()=>{U.on("zoom",null)})}},{flush:"post"});function B(D){const[U,W]=An(D);n("click",{event:D,position:{x:U,y:W}})}function O(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeClick(W),n("nodeClick",W)}function y(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeDoubleClick(W),n("nodeDblclick",W)}function w(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseEnter(W),n("nodeMouseenter",W)}function v(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseMove(W),n("nodeMousemove",W)}function M(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseLeave(W),n("nodeMouseleave",W)}return(D,U)=>(t.openBlock(),t.createBlock(t.unref(df),{position:D.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:D.pannable,zoomable:D.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:g,width:k.value,height:N.value,viewBox:[R.value.x,R.value.y,R.value.width,R.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:B},[D.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(D.ariaLabel),9,X$)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(h),W=>(t.openBlock(),t.createBlock(W$,{id:W.id,key:W.id,f:"",position:W.computedPosition,dimensions:W.dimensions,selected:W.selected,dragging:W.dragging,style:t.normalizeStyle(W.style),class:t.normalizeClass(I.value(W)),color:_.value(W),"border-radius":D.nodeBorderRadius,"stroke-color":E.value(W),"stroke-width":D.nodeStrokeWidth,"shape-rendering":t.unref(b),type:W.type,hidden:W.hidden,onClick:ie=>O(ie,W),onDblclick:ie=>y(ie,W),onMouseenter:ie=>w(ie,W),onMousemove:ie=>v(ie,W),onMouseleave:ie=>M(ie,W)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:$.value,fill:D.maskColor,stroke:D.maskStrokeColor,"stroke-width":D.maskStrokeWidth,"fill-rule":"evenodd"},null,8,Z$)],8,J$))]),_:1},8,["position","class"]))}}),tT=["d"],nT=["cx","cy","onDblclick"],oT=["x","y","onPointerdown","onDblclick"],iT=Ke(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(ns),a=t.inject(no,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Vo,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((L,x)=>x===d.value?u.value:L)),{source:p,target:f,sourceSide:h,targetSide:g}=cp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),k=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Kf(p.value,h.value,m.value,f.value,g.value):Yf(p.value,m.value,f.value)),N=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Gf(p.value,h.value,m.value,f.value,g.value):Jf(p.value,m.value,f.value).map((L,x)=>({point:L,segIndex:x})):[]),b=t.computed(()=>r.value?m.value:[]);function _(L,x){d.value=L,u.value={...c.value[L]},x.target.setPointerCapture(x.pointerId),x.stopPropagation()}function E(L){if(d.value<0)return;const x=o({x:L.clientX,y:L.clientY});u.value={x:x.x,y:x.y}}function I(L){var x,R;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(R=(x=L.target).releasePointerCapture)==null||R.call(x,L.pointerId)}function A(L,x){x.stopPropagation(),i==null||i.removePoint(n.id,L)}function T(L,x){if(!i)return;const R=o({x:x.clientX,y:x.clientY});i.insertPoint(n.id,L,{x:R.x,y:R.y})}return(L,x)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:k.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,tT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,(R,$)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${$}`,cx:R.point.x,cy:R.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(B=>T(R.segIndex,B),["stop"])},null,42,nT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,(R,$)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${$}`,x:R.x-5,y:R.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:B=>_($,B),onPointermove:E,onPointerup:I,onDblclick:B=>A($,B)},null,42,oT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),aT=["data-theme"],rT={key:0,class:"em-ctx__sep",role:"separator"},lT=["aria-label"],sT={class:"em-ctx__swatches-label","aria-hidden":"true"},cT={class:"em-ctx__chips",role:"none"},dT=["aria-checked","aria-label","title","onClick"],uT=["aria-checked","aria-label","title","onClick"],mT=["disabled","onClick"],fT={class:"em-ctx__icon"},pT={class:"em-ctx__caption"},hT=Ke(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(_,E)=>Dt(o.locale??"ko",_,E),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(_,E){var T,L;r.value=E,l.value=(T=_.target)!=null&&T.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=_.clientX,c.y=_.clientY,a.value=!0,window.addEventListener("keydown",k),window.addEventListener("resize",p),await t.nextTick();const I=s.value;if(!I)return;const A=I.getBoundingClientRect();c.x+A.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-A.width)),c.y+A.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-A.height)),(L=f()[0])==null||L.focus()}function p(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",k),window.removeEventListener("resize",p);const _=d;d=null,_!=null&&_.isConnected&&_.focus()}function f(){const _=s.value;if(!_)return[];const E=[];for(const I of Array.from(_.children))if(I.classList.contains("em-ctx__item"))I.disabled||E.push(I);else if(I.classList.contains("em-ctx__swatches")){const A=Array.from(I.querySelectorAll(".em-ctx__chip"));A.length&&E.push(A.find(T=>T===document.activeElement)??A[0])}return E}function h(_){var T;const E=f();if(!E.length)return;const I=E.indexOf(document.activeElement),A=I<0?_>0?0:E.length-1:(I+_+E.length)%E.length;(T=E[A])==null||T.focus()}function g(_){var T,L;const E=(T=document.activeElement)==null?void 0:T.closest(".em-ctx__swatches");if(!E)return!1;const I=Array.from(E.querySelectorAll(".em-ctx__chip")),A=I.indexOf(document.activeElement);return A<0?!1:((L=I[(A+_+I.length)%I.length])==null||L.focus(),!0)}function k(_){var E,I;switch(_.key){case"Escape":_.stopPropagation(),p();return;case"ArrowDown":_.preventDefault(),h(1);return;case"ArrowUp":_.preventDefault(),h(-1);return;case"ArrowRight":g(1)&&_.preventDefault();return;case"ArrowLeft":g(-1)&&_.preventDefault();return;case"Home":_.preventDefault(),(E=f()[0])==null||E.focus();return;case"End":{_.preventDefault();const A=f();(I=A[A.length-1])==null||I.focus();return}case"Tab":_.preventDefault(),h(_.shiftKey?-1:1)}}function N(_){_.disabled||(_.handler(),p())}function b(_,E){_.onPick(E),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(_,E)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:p,onContextmenu:t.withModifiers(p,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:E[0]||(E[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(I,A)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:A},[I.type==="separator"?(t.openBlock(),t.createElementBlock("div",rT)):I.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":I.caption},[t.createElementVNode("span",sT,t.toDisplayString(I.caption),1),t.createElementVNode("div",cT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":I.current===null}]),role:"menuitemradio","aria-checked":I.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:T=>b(I,null)},null,10,dT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),T=>(t.openBlock(),t.createElementBlock("button",{key:T,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":I.current===T}]),style:t.normalizeStyle({background:t.unref(To)(T)}),role:"menuitemradio","aria-checked":I.current===T,"aria-label":i(t.unref(eo)(T)),title:i(t.unref(eo)(T)),onClick:L=>b(I,T)},null,14,uT))),128))])],8,lT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":I.danger,"is-disabled":I.disabled}]),disabled:I.disabled,role:"menuitem",onClick:T=>N(I)},[t.createElementVNode("span",fT,[I.icon?(t.openBlock(),t.createBlock(Ae,{key:0,name:I.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",pT,t.toDisplayString(I.caption),1)],10,mT))],64))),128))],36)],8,aT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function oh(e,n){return n?`${e}:${n}`:e}function ih(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(oh(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function yT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=oh(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function ah(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(ih(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=ih(e.storageKey,s)),t.watch(o,s=>yT(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const ws=[".em-entity__grip",".em-entity__add",".em-entity__footer",".em-sel",".em-handle",".em-note-handle",".vue-flow__handle",".em-group__resize",".em-note__resize",".em-edge__waypoint",".em-edge__mid",".em-note-edge__waypoint",".em-note-edge__mid"].join(",");function Po(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function gT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function bT(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const h=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const g=n(h.left,h.top+h.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,p=0;const f=()=>{const h=d.trim();if(h){const g=n(m,(u+p)/2);c.push({...i,x:g.x,y:g.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(r,h),a.setEnd(r,h+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(f(),u=g.top,m=g.left,p=g.bottom,d=s[h]):(d+=s[h],p=Math.max(p,g.bottom))}return f(),c}function br(e,n){const o=[];for(const i of e.querySelectorAll("*"))gT(i)&&(i.closest(ws)||Po(i)&&o.push(...bT(i,n)));return o}function Mi(e){return Math.round(e*100)/100}function _T(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(ws)||!Po(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=n(a.left,a.top),l=n(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${Mi(r.x)}" y="${Mi(r.y)}" width="${Mi(l.x-r.x)}" height="${Mi(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function kT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Po(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Mi(parseFloat(o.getAttribute(d)??"0"));s==="line"?n.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?n.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&n.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return n}function rh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(ws)||!Po(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:r.borderTopColor,strokeWidth:l})}return i}function Vi(e,n){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=n(o.left,o.top),r=n(o.right,o.bottom),l=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function Is(e,n){e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x+n.w),e.maxY=Math.max(e.maxY,n.y+n.h)}function ET(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,h)=>e.screenToFlowCoordinate({x:f,y:h}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const h=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!h||!Po(h))continue;const g=h.firstElementChild;if(g)if(f.type==="group"){const k=Vi(g,o);Is(s,k),i.push({...k,texts:[]});const N=g.querySelector(".em-group__label");N&&i.push({...Vi(N,o),stroke:"none",texts:[]}),i.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:br(g,o)})}else if(f.type==="note"){const k={...Vi(g,o),texts:br(g,o),lines:rh(g,g,o)};Is(s,k),r.push(k)}else{const k=Vi(g,o);Is(s,k);const N=k.radius??{tl:0,tr:0};a.push({...k,stroke:"none",texts:[]});const b=g.querySelector(".em-entity__header");if(b){const _=Vi(b,o);a.push({x:k.x,y:k.y,w:k.w,h:_.y+_.h-k.y,fill:_.fill,stroke:"none",radius:{tl:N.tl,tr:N.tr,br:0,bl:0},texts:[]})}a.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:br(g,o),lines:rh(g,g,o),icons:_T(g,o)}),a.push({...k,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const h=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!Po(h))continue;const g=h.getAttribute("d");if(!g)continue;const k=getComputedStyle(h),N=k.strokeDasharray,b=kT(f);l.push({d:g,stroke:k.stroke,strokeWidth:parseFloat(k.strokeWidth)||1.5,strokeDasharray:N&&N!=="none"?N:void 0,labels:br(f,o),markers:b.length?b:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function vs(e){return mc(ET(e))}function lh(e,n){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function sh(e,n="diagram.svg"){const o=vs(e);lh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function NT(e){var i,a;const n=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:n>0?n:1,h:o>0?o:1}}async function ch(e,n="diagram.png",o=2){const i=vs(e),{w:a,h:r}=NT(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,p)=>{s.onload=()=>m(),s.onerror=()=>p(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");lh(u,n)}finally{URL.revokeObjectURL(l)}}const wT={class:"em-shortcuts"},IT={class:"em-shortcuts__list"},vT={class:"em-shortcuts__title"},xT={class:"em-shortcuts__keys"},CT={class:"em-shortcuts__kbd"},ST={key:0,class:"em-shortcuts__plus"},RT={class:"em-shortcuts__desc"},AT={class:"em-shortcuts__actions"},dh=Ke(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(s,c)=>Dt(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",wT,[t.createElementVNode("div",IT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,d=>(t.openBlock(),t.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[t.createElementVNode("h4",vT,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",xT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+p},[t.createElementVNode("kbd",CT,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",ST,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",RT,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",AT,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function zo(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function $T(e,n){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(n);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const TT=["aria-label"],MT=["aria-activedescendant","aria-label","placeholder"],VT={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},BT=["aria-label"],DT={class:"em-cmdk__section","aria-hidden":"true"},OT=["id","aria-selected","onMouseenter","onClick"],LT={class:"em-cmdk__label"},PT={key:0,class:"em-cmdk__tag"},zT={key:1,class:"em-cmdk__sub"},FT=["aria-label"],UT={class:"em-cmdk__section","aria-hidden":"true"},HT=["id","aria-selected","aria-disabled","onMouseenter","onClick"],jT={class:"em-cmdk__label"},KT={key:1,class:"em-cmdk__empty"},GT=Ke(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const I=c.value,A=a.state.logical.entities.map(L=>{var x,R,$,B,O,y;return{type:"goto",kind:"entity",id:L.modelId,label:((R=(x=L.table)==null?void 0:x.logicalName)==null?void 0:R[I])||L.name,sub:($=L.table)==null?void 0:$.physicalName,match:zo(L.name,(O=(B=L.table)==null?void 0:B.logicalName)==null?void 0:O[I],(y=L.table)==null?void 0:y.physicalName)??""}}),T=a.state.logical.groups.map(L=>{var x,R,$,B;return{type:"goto",kind:"group",id:L.modelId,label:((x=L.name)==null?void 0:x[I])||((R=L.name)==null?void 0:R.ko)||L.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:zo(($=L.name)==null?void 0:$[I],(B=L.name)==null?void 0:B.ko,L.packageName)??""}});return[...A,...T]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const I=[];a.editable.value&&(I.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),I.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),I.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),I.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),I.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),I.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),I.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),I.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const A of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])I.push({type:"action",id:`dm-${A}`,label:a.t(u[A]),run:()=>a.displayMode.value=A});return I});function p(I,A){return I.label.toLowerCase().includes(A)}const f=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?d.value.filter(A=>A.match.includes(I)):d.value}),h=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?m.value.filter(A=>p(A,I)):m.value}),g=t.computed(()=>[...f.value,...h.value]);t.watch([f,h],()=>{l.value=0});function k(I){return g.value.indexOf(I)}const N=I=>`em-cmdk-opt-${I}`,b=t.computed(()=>g.value[l.value]?N(l.value):void 0);t.watch(l,async()=>{var A;await t.nextTick();const I=b.value;I&&((A=document.getElementById(I))==null||A.scrollIntoView({block:"nearest"}))});function _(I){if(I.type==="goto")a.selection.value={kind:I.kind,id:I.id},a.requestFocus(I.id);else{if(I.disabled)return;I.run()}i("close")}function E(I){if(I.key==="Escape"){i("close"),I.preventDefault();return}if(I.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),I.preventDefault();return}if(I.key==="ArrowUp"){l.value=Math.max(l.value-1,0),I.preventDefault();return}if(I.key==="Enter"){const A=g.value[l.value];A&&_(A),I.preventDefault();return}I.key==="Tab"&&I.preventDefault()}return t.nextTick(()=>{var I;return(I=s.value)==null?void 0:I.focus()}),(I,A)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:A[1]||(A[1]=t.withModifiers(T=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":A[0]||(A[0]=T=>r.value=T),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":b.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:E},null,40,MT),[[t.vModelText,r.value]]),t.createElementVNode("div",VT,[g.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",DT,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,T=>(t.openBlock(),t.createElementBlock("button",{id:N(k(T)),key:T.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":k(T)===l.value}]),role:"option","aria-selected":k(T)===l.value,onMouseenter:L=>l.value=k(T),onClick:L=>_(T)},[t.createElementVNode("span",LT,t.toDisplayString(T.label),1),T.tag?(t.openBlock(),t.createElementBlock("span",PT,t.toDisplayString(T.tag),1)):T.sub?(t.openBlock(),t.createElementBlock("span",zT,t.toDisplayString(T.sub),1)):t.createCommentVNode("",!0)],42,OT))),128))],8,BT)):t.createCommentVNode("",!0),h.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",UT,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,T=>(t.openBlock(),t.createElementBlock("button",{id:N(k(T)),key:T.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":k(T)===l.value,"is-disabled":T.disabled}]),role:"option","aria-selected":k(T)===l.value,"aria-disabled":T.disabled||void 0,onMouseenter:L=>l.value=k(T),onClick:L=>_(T)},[t.createElementVNode("span",jT,t.toDisplayString(T.label),1)],42,HT))),128))],8,FT)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",KT,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,TT)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function YT(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const qT={key:0,class:"em-canvas__empty","aria-hidden":"true"},WT={class:"em-canvas__empty-title"},JT=["innerHTML"],XT=["innerHTML"],ZT=["innerHTML"],QT={key:1,class:"em-canvas__empty-title"},eM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},tM={class:"em-conflict-banner__body"},nM={class:"em-conflict-banner__title"},oM={class:"em-conflict-banner__detail"},iM={key:0,class:"em-toast",role:"status","aria-live":"polite"},xs="nc:",uh=Ke(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(C){l.value=C,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,C=>{C&&c(C.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const C=YT(i.opConflict.value);return C?{title:i.t(C.titleKey),detail:i.t(C.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(C){p.x=C.clientX,p.y=C.clientY}const h=t.ref(null);t.provide(Xa,h);const g=t.ref(null);t.provide(Af,g);const k=t.ref(null),N=t.computed(()=>{const C=k.value,S=new Set;if(!C)return S;if(C.kind==="entity")S.add(C.id);else if(C.kind==="group"){const q=i.resolved.value.groups.find(re=>re.group.modelId===C.id);for(const re of(q==null?void 0:q.group.memberEntityRefs)??[])S.add(re)}return S}),b=t.computed(()=>{const C=k.value,S=new Set(N.value),q=new Set,re=new Set;if(!C)return{related:S,edges:q,notes:re};if(C.kind==="note"){re.add(C.id);for(const xe of i.resolved.value.noteConnections)xe.noteRef===C.id&&S.add(xe.targetRef);return{related:S,edges:q,notes:re}}const ne=N.value;if(!ne.size)return{related:S,edges:q,notes:re};for(const xe of i.resolved.value.associations){const{end1:de,end2:Ce}=xe.association;(ne.has(de.entityRef)||ne.has(Ce.entityRef))&&(q.add(xe.association.modelId),S.add(de.entityRef),S.add(Ce.entityRef))}for(const xe of i.resolved.value.noteConnections)S.has(xe.targetRef)&&re.add(xe.noteRef);return{related:S,edges:q,notes:re}});t.provide(Vo,{source:k,active:t.computed(()=>k.value!==null),primaryEntityIds:N,relatedEntityIds:t.computed(()=>b.value.related),relatedEdgeIds:t.computed(()=>b.value.edges),relatedNoteIds:t.computed(()=>b.value.notes),hoverGroupId:t.computed(()=>{var C;return((C=k.value)==null?void 0:C.kind)==="group"?k.value.id:null}),setEntityHover:C=>{g.value||m.value||(k.value=C?{kind:"entity",id:C}:null)},setGroupHover:C=>{g.value||m.value||(k.value=C?{kind:"group",id:C}:null)},setNoteHover:C=>{g.value||m.value||(k.value=C?{kind:"note",id:C}:null)}}),t.provide(no,i);const _=Dx(),E=t.computed(()=>_(i.state.logical,i.embeddableCatalog.value));t.provide(Mf,E);const I=ah({expandableKeys:()=>[],defaultCollapsed:Lx,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(Bf,{isCollapsed:I.isCollapsed,toggle:I.toggle}),t.provide($f,{marks:t.toRef(o,"diffMarks")});function A(C,S){return`${xs}${C}:${S}`}function T(C){if(!C.startsWith(xs))return null;const[S,q]=C.slice(xs.length).split(":");return S&&q?{noteRef:S,targetRef:q}:null}t.provide(ns,{points:C=>{var q,re;const S=T(C);return S?((q=i.resolved.value.noteConnections.find(ne=>ne.noteRef===S.noteRef&&ne.targetRef===S.targetRef))==null?void 0:q.waypoints)??[]:((re=i.resolved.value.associations.find(ne=>ne.association.modelId===C))==null?void 0:re.waypoints)??[]},movePoint:(C,S,q)=>{const re=T(C);re?i.moveNoteConnectionWaypoint(re.noteRef,re.targetRef,S,q):i.moveWaypoint(C,S,q)},insertPoint:(C,S,q)=>{const re=T(C);re?i.addNoteConnectionWaypoint(re.noteRef,re.targetRef,S,q):i.addWaypoint(C,S,q)},removePoint:(C,S)=>{const q=T(C);q?i.removeNoteConnectionWaypoint(q.noteRef,q.targetRef,S):i.removeWaypoint(C,S)}});const L=je(),{nodes:x,edges:R,findNode:$,findEdge:B,addNodes:O,addEdges:y,removeNodes:w,removeEdges:v,fitView:M,setCenter:D,getViewport:U,screenToFlowCoordinate:W,getSelectedNodes:ie,updateNodeInternals:pe}=L,ye=t.ref(!1);async function ge(C){ye.value=!0,await t.nextTick(),await new Promise(S=>requestAnimationFrame(()=>S(null)));try{return await C()}finally{ye.value=!1}}async function me(){try{await ge(()=>sh(L))}catch(C){console.error("[entity-modeler] SVG export failed",C),c(i.t("em.canvas.exportFailed"))}}async function se(){try{await ge(()=>ch(L))}catch(C){console.error("[entity-modeler] PNG export failed",C),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:me,exportPng:se,fitView:M});const ke=t.computed(()=>i.resolved.value.entities.length===0);function Se(){const C=U(),{width:S,height:q}=L.dimensions.value;return{x:(S/2-C.x)/C.zoom,y:(q/2-C.y)/C.zoom}}function ce(){const C=Se();i.addEntity("NewEntity",{x:C.x,y:C.y})}function fe(){const C=Se();i.addNote("메모",{x:C.x,y:C.y})}function oe(C){for(const S of i.resolved.value.groups){const{location:q,size:re}=S.geo;if(C.x>=q.x&&C.x<=q.x+re.width&&C.y>=q.y&&C.y<=q.y+re.height)return S.group.modelId}return null}function le(C,S){return C.x===S.x&&C.y===S.y}function ue(C,S){return(C==null?void 0:C.width)===(S==null?void 0:S.width)&&(C==null?void 0:C.height)===(S==null?void 0:S.height)}function z(C,S){return C.entity===S.entity&&C.displayMode===S.displayMode&&C.collapsed===S.collapsed&&C.locked===S.locked&&C.groupRef===S.groupRef&&ue(C.size,S.size)&&C.style===S.style&&C.attributeStyles===S.attributeStyles&&C.operationStyles===S.operationStyles}function P(C,S){const q=Object.keys(C);if(q.length!==Object.keys(S).length)return!1;for(const re of q)if(re==="geo"){const ne=C.geo,xe=S.geo;if(!le(ne.location,xe.location)||!ue(ne.size,xe.size))return!1}else if(C[re]!==S[re])return!1;return!0}function F(){const C=i.resolved.value,S=new Map(C.groups.map(de=>[de.group.modelId,de.geo])),q=new Set(C.groups.map(de=>de.group.modelId)),re=new Set([...q,...C.entities.map(de=>de.entity.modelId),...C.notes.map(de=>de.note.modelId)]);for(const de of[...x.value])re.has(de.id)||w([de.id]);for(const de of C.groups){const Ce=de.group.modelId,Fe={width:`${de.geo.size.width}px`,height:`${de.geo.size.height}px`},He={group:de.group,style:de.style,locked:de.locked},rt=de.locked?!1:void 0,ze=$(Ce);if(ze){le(ze.position,de.geo.location)||(ze.position={...de.geo.location});const ot=ze.data;(ot.group!==He.group||ot.style!==He.style||ot.locked!==He.locked)&&(ze.data=He);const tt=ze.style;((tt==null?void 0:tt.width)!==Fe.width||(tt==null?void 0:tt.height)!==Fe.height)&&(ze.style=Fe),ze.draggable!==rt&&(ze.draggable=rt)}else O([{id:Ce,type:"group",position:{...de.geo.location},draggable:rt,style:Fe,data:He}])}for(const de of C.entities){const Ce=de.entity.modelId,Fe=de.groupRef&&q.has(de.groupRef)?de.groupRef:void 0,He={entity:de.entity,displayMode:i.displayMode.value,collapsed:de.collapsed,locked:de.locked,groupRef:Fe,size:de.geo.size,style:de.style,attributeStyles:de.attributeStyles,operationStyles:de.operationStyles},rt=de.locked?!1:void 0,ze=de.locked?!1:void 0,ot=Fe?S.get(Fe):void 0,tt=ot?{x:de.geo.location.x-ot.location.x,y:de.geo.location.y-ot.location.y}:{...de.geo.location},Ge=$(Ce);Ge?(le(Ge.position,tt)||(Ge.position=tt),z(Ge.data,He)||(Ge.data=He),Ge.parentNode!==Fe&&(Ge.parentNode=Fe),Ge.draggable!==rt&&(Ge.draggable=rt),Ge.connectable!==ze&&(Ge.connectable=ze)):O([{id:Ce,type:"entity",position:tt,parentNode:Fe,draggable:rt,connectable:ze,data:He}])}for(const de of C.notes){const Ce=de.note,Fe=Ce.modelId,He=de.groupRef&&q.has(de.groupRef)?de.groupRef:void 0,rt={note:Ce,groupRef:He},ze={width:`${Ce.geo.size.width}px`,height:`${Ce.geo.size.height}px`},ot=He?S.get(He):void 0,tt=ot?{x:Ce.geo.location.x-ot.location.x,y:Ce.geo.location.y-ot.location.y}:{...Ce.geo.location},Ge=$(Fe);if(Ge){le(Ge.position,tt)||(Ge.position=tt);const lo=Ge.data;(lo.groupRef!==He||!P(lo.note,Ce))&&(Ge.data=rt);const bn=Ge.style;((bn==null?void 0:bn.width)!==ze.width||(bn==null?void 0:bn.height)!==ze.height)&&(Ge.style=ze),Ge.parentNode!==He&&(Ge.parentNode=He)}else O([{id:Fe,type:"note",position:tt,parentNode:He,style:ze,data:rt}])}const ne=new Map(C.associations.map(de=>[de.association.modelId,de])),xe=new Set(C.noteConnections.map(de=>A(de.noteRef,de.targetRef)));for(const de of[...R.value])!ne.has(de.id)&&!xe.has(de.id)&&v([de.id]);for(const[de,Ce]of ne){const Fe={id:de,type:"association",source:Ce.association.end1.entityRef,target:Ce.association.end2.entityRef,sourceHandle:Ce.sourceColumnRef?`r:${Ce.sourceColumnRef}`:void 0,targetHandle:Ce.targetColumnRef?`l:${Ce.targetColumnRef}`:void 0,data:{association:Ce.association,sourceColumnRef:Ce.sourceColumnRef,targetColumnRef:Ce.targetColumnRef}},He=B(de);if(He){const rt=He.data;(rt.association!==Fe.data.association||rt.sourceColumnRef!==Fe.data.sourceColumnRef||rt.targetColumnRef!==Fe.data.targetColumnRef)&&(He.data=Fe.data),He.sourceHandle!==Fe.sourceHandle&&(He.sourceHandle=Fe.sourceHandle),He.targetHandle!==Fe.targetHandle&&(He.targetHandle=Fe.targetHandle)}else y([Fe])}for(const de of C.noteConnections){const Ce=A(de.noteRef,de.targetRef),Fe={noteRef:de.noteRef,targetRef:de.targetRef};B(Ce)||y([{id:Ce,type:"note-connection",source:de.noteRef,target:de.targetRef,data:Fe}])}}const Q=new Set;let X=!1,_e=!1;const he=new Map;function we(C){const S=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(C)}"]`);if(!S)return null;let q=`${S.offsetHeight}`;for(const re of S.querySelectorAll(".em-entity__row"))q+=`|${re.dataset.attr}:${re.offsetTop}`;return q}function Ie(){_e=!1;const C=X;X=!1;const S=[...Q];if(Q.clear(),C){pe();for(const re of x.value){const ne=we(re.id);ne!==null&&he.set(re.id,ne)}return}const q=[];for(const re of S){const ne=we(re);if(ne===null){he.delete(re);continue}he.get(re)!==ne&&(he.set(re,ne),q.push(re))}q.length&&pe(q)}function Y(C){if(C)for(const S of C)Q.add(S);else X=!0;_e||(_e=!0,t.nextTick(()=>requestAnimationFrame(Ie)))}t.provide(Tf,{mark:C=>Y([C])});function j(){const C=ie.value.map(q=>q.id);if(C.length)return C;const S=i.selection.value;return S&&(S.kind==="entity"||S.kind==="note"||S.kind==="group")?[S.id]:[]}function J(){return ie.value.filter(C=>C.type==="entity").map(C=>C.id)}function ve(){return ie.value.filter(C=>C.type==="group").map(C=>C.id)}function Te(C){var S;return[...((S=i.state.logical.groups.find(q=>q.modelId===C))==null?void 0:S.memberEntityRefs)??[]]}function K(){const C=ve().flatMap(Te);return[...new Set([...J(),...C])]}function te(){return ve().length>0||J().length>1}function G(){te()?i.copy(K()):i.copy()}async function ae(C){if(!C.length)return;await t.nextTick();const S=ie.value;S.length&&L.removeSelectedNodes(S);const q=C.map(re=>$(re)).filter(re=>!!re);q.length&&L.addSelectedNodes(q)}function Be(C){if(te()&&J().includes(C)){const S=K();return{caption:i.t("em.ctx.copyN",{n:S.length}),icon:"copy",handler:()=>i.copy(S)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:C},i.copy()}}}function Ve(C){var ne;const S=C.target;if(S&&(S.tagName==="INPUT"||S.tagName==="TEXTAREA"||S.isContentEditable))return;if(C.key==="?"){a.openModal({component:dh,bind:{locale:i.uiLocale.value}}),C.preventDefault();return}if((C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="k"){r.value=!0,C.preventDefault();return}if(!i.editable.value){(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="c"&&(G(),C.preventDefault());return}if(C.key==="Delete"||C.key==="Backspace"){i.deleteSelection()&&C.preventDefault();return}if(C.key==="ArrowUp"||C.key==="ArrowDown"||C.key==="ArrowLeft"||C.key==="ArrowRight"){if(((ne=i.selection.value)==null?void 0:ne.kind)==="attribute"){if(C.key==="ArrowUp"||C.key==="ArrowDown"){const Fe=C.key==="ArrowDown"?1:-1;(C.altKey?i.nudgeSelectedAttributes(Fe):i.moveAttributeFocus(Fe))&&C.preventDefault()}return}const xe=C.shiftKey?10:1,de=C.key==="ArrowLeft"?-xe:C.key==="ArrowRight"?xe:0,Ce=C.key==="ArrowUp"?-xe:C.key==="ArrowDown"?xe:0;i.nudgeNodes(j(),de,Ce)&&C.preventDefault();return}if(!(C.metaKey||C.ctrlKey))return;const re=C.key.toLowerCase();re==="c"?(G(),C.preventDefault()):re==="v"?(ae(i.paste()),C.preventDefault()):re==="z"&&(C.shiftKey?i.redo():i.undo(),C.preventDefault())}t.onMounted(async()=>{F(),await t.nextTick(),M(),Y(),window.addEventListener("keydown",Ve),window.addEventListener("pointerup",H),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ve),window.removeEventListener("pointerup",H),window.removeEventListener("pointermove",f)});function H(){h.value=null}function V(){m.value=!0,k.value=null}function Pe(){var re;m.value=!1;const C=(re=document.elementFromPoint(p.x,p.y))==null?void 0:re.closest(".vue-flow__node"),S=C==null?void 0:C.dataset.id;if(!S){k.value=null;return}const q=C.classList.contains("vue-flow__node-group")?"group":C.classList.contains("vue-flow__node-note")?"note":"entity";k.value={kind:q,id:S}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],F),t.watch(()=>i.resolved.value,C=>{const S=k.value;if(!S)return;(S.kind==="entity"?C.entities.some(re=>re.entity.modelId===S.id):S.kind==="group"?C.groups.some(re=>re.group.modelId===S.id):C.notes.some(re=>re.note.modelId===S.id))||(k.value=null)});function Ze(C){const S=C.computedPosition??C.position,q=C.dimensions??{width:0,height:0};return{x:S.x+q.width/2,y:S.y+q.height/2}}function Ue(C){const S=C.node;if(S){if(k.value=null,S.type==="group"){const q=i.resolved.value.groups.find(re=>re.group.modelId===S.id);g.value=q?{groupId:S.id,dx:S.position.x-q.geo.location.x,dy:S.position.y-q.geo.location.y}:null,h.value=null;return}if(S.type!=="entity"&&S.type!=="note"){h.value=null;return}h.value=oe(Ze(S))}}function Le(C){var re;h.value=null,g.value=null;const S=(re=C.nodes)!=null&&re.length?C.nodes:[C.node],q=S.filter(ne=>(ne==null?void 0:ne.type)==="group");if(q.length){for(const ne of q){if(!ne)continue;const xe=i.resolved.value.entities.filter(de=>de.groupRef===ne.id).map(de=>{const Ce=$(de.entity.modelId),Fe=(Ce==null?void 0:Ce.computedPosition)??(Ce==null?void 0:Ce.position)??{x:0,y:0};return{id:de.entity.modelId,location:{x:Fe.x,y:Fe.y}}});i.dragGroup(ne.id,{x:ne.position.x,y:ne.position.y},xe)}return}for(const ne of S){if(!ne||ne.type==="group")continue;const xe=ne.computedPosition??ne.position,de=ne.dimensions??{width:0,height:0},Ce={x:xe.x+de.width/2,y:xe.y+de.height/2};ne.type==="note"?i.dropNote(ne.id,{x:xe.x,y:xe.y},oe(Ce)):i.dropEntity(ne.id,{x:xe.x,y:xe.y},oe(Ce))}}function De(C){var Fe,He,rt,ze,ot;if(!i.editable.value||!C.source||!C.target)return;const S=((Fe=$(C.source))==null?void 0:Fe.type)==="note",q=((He=$(C.target))==null?void 0:He.type)==="note";if(S||q){if(S&&q)return;const tt=S?C.source:C.target,Ge=S?C.target:C.source;((rt=$(Ge))==null?void 0:rt.type)==="entity"&&i.addNoteConnection(tt,Ge);return}const re=tt=>{var Ge;return(Ge=i.state.logical.entities.find(lo=>lo.modelId===tt))==null?void 0:Ge.stereotype},ne=re(C.source)==="JPA_EMBEDDABLE",xe=re(C.target)==="JPA_EMBEDDABLE";if(ne||xe){if(ne&&xe)return;const tt=ne?C.source:C.target,Ge=ne?C.target:C.source;i.addEmbedAssociation(Ge,tt);return}const de=(ze=C.sourceHandle)!=null&&ze.startsWith("r:")?C.sourceHandle.slice(2):void 0,Ce=(ot=C.targetHandle)!=null&&ot.startsWith("l:")?C.targetHandle.slice(2):void 0;i.addAssociation(C.source,C.target,de,Ce)}const Z=t.ref(null);function dt(C,S){var re;const q=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=q==null?void 0:q.attributeStyles)==null?void 0:re[S])}function yn(C,S){var re;const q=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=q==null?void 0:q.operationStyles)==null?void 0:re[S])}function Et(C){var S;return _t((S=i.state.layout.groupLayouts.find(q=>q.groupRef===C))==null?void 0:S.style)}function gn(C){var S;return _t((S=i.state.layout.notes.find(q=>q.modelId===C))==null?void 0:S.style)}function Ee(C){var ne,xe;if(C.preventDefault(),!i.editable.value)return;const S=()=>W({x:C.clientX,y:C.clientY}),q=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const de=S();i.addEntity("NewEntity",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const de=S();i.addNote("메모",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const de=S();i.addEmptyGroup({x:de.x,y:de.y})}}],re=(ne=i.clipboard.value)==null?void 0:ne.kind;(re==="entity"||re==="entities")&&q.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>ae(i.paste())}),i.resolved.value.entities.length>0&&q.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(xe=Z.value)==null||xe.open(C,q)}function at({event:C,node:S}){var Fe,He,rt,ze,ot,tt,Ge,lo,bn,yh,gh,bh,_h,kh,Eh,Nh,wh,Ih,vh;const q=C;if(q.preventDefault(),!i.editable.value){if(S.type==="group"||S.type==="note")return;const Ye=(He=(Fe=q.target)==null?void 0:Fe.closest("[data-attr]"))==null?void 0:He.dataset.attr;if(Ye){const lt=i.selection.value;(lt==null?void 0:lt.kind)==="attribute"&<.entityId===S.id&<.ids.includes(Ye)||i.selectAttribute(S.id,Ye);const _n=((rt=i.selection.value)==null?void 0:rt.kind)==="attribute"&&i.selection.value.entityId===S.id?[...i.selection.value.ids]:[Ye];(ze=Z.value)==null||ze.open(q,[{caption:_n.length>1?i.t("em.ctx.copyN",{n:_n.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(ot=Z.value)==null||ot.open(q,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>qa(a,i,S.id)},Be(S.id)]);return}if(S.type==="group"){const Ye=i.isGroupLocked(S.id),lt=[];Ye||lt.push({type:"swatches",caption:i.t("em.common.color"),current:Et(S.id),onPick:_n=>i.setGroupSwatch(S.id,_n)},{type:"separator"});const ht=te()&&ve().includes(S.id)?K():Te(S.id);ht.length&<.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(ht)}),lt.push({caption:Ye?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Ye?"unlock":"lock",handler:()=>i.setGroupLocked(S.id,!Ye)}),Ye||lt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(S.id)}),(tt=Z.value)==null||tt.open(q,lt);return}if(S.type==="note"){(Ge=Z.value)==null||Ge.open(q,[{type:"swatches",caption:i.t("em.common.color"),current:gn(S.id),onPick:Ye=>i.setNoteSwatch(S.id,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(S.id)}]);return}const re=(bn=(lo=q.target)==null?void 0:lo.closest("[data-attr]"))==null?void 0:bn.dataset.attr;if(re){const Ye=i.selection.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ye.entityId===S.id&&Ye.ids.includes(re)||i.selectAttribute(S.id,re);const ht=((yh=i.selection.value)==null?void 0:yh.kind)==="attribute"&&i.selection.value.entityId===S.id?[...i.selection.value.ids]:[re];if(i.isEntityLocked(S.id)){(gh=Z.value)==null||gh.open(q,[{caption:ht.length>1?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const _n=ht.length>1,Cs=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(S.id)},{type:"swatches",caption:_n?i.t("em.ctx.colorN",{n:ht.length}):i.t("em.common.color"),current:_n?null:dt(S.id,re),onPick:cD=>i.setAttributeSwatches(S.id,ht,cD)},{type:"separator"},{caption:_n?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Bi=i.clipboard.value;(Bi==null?void 0:Bi.kind)==="attribute"&&Cs.push({caption:Bi.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Bi.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:S.id},i.paste()}}),Cs.push({type:"separator"},{caption:_n?i.t("em.ctx.deleteAttrN",{n:ht.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(S.id,ht)}),(bh=Z.value)==null||bh.open(q,Cs);return}const ne=(kh=(_h=q.target)==null?void 0:_h.closest("[data-op]"))==null?void 0:kh.dataset.op;if(ne){if(i.isEntityLocked(S.id))return;(Eh=Z.value)==null||Eh.open(q,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(S.id)},{type:"swatches",caption:i.t("em.common.color"),current:yn(S.id,ne),onPick:Ye=>i.setOperationSwatch(S.id,ne,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(S.id,ne)}]);return}const xe=i.resolved.value.entities.find(Ye=>Ye.entity.modelId===S.id),de=!!(xe!=null&&xe.locked),Ce=[{caption:de?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>qa(a,i,S.id)}];if(!de){Ce.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(S.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(S.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const lt=ie.value.filter(ht=>ht.type==="entity").map(ht=>ht.id);i.createGroup(lt.includes(S.id)&<.length?lt:[S.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(S.id,S.id)});const Ye=i.embeddableCatalog.value;if(Ye.length){Ce.push({type:"separator"});for(const lt of Ye){const ht=((Nh=lt.label)==null?void 0:Nh[i.userLanguage.value])??((wh=lt.label)==null?void 0:wh.ko)??((Ih=lt.label)==null?void 0:Ih.en)??lt.type;Ce.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:ht}),icon:"link",handler:()=>i.addPredefinedEmbed(S.id,lt.type)})}}}if(Ce.push({type:"separator"}),Ce.push({caption:xe!=null&&xe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:xe!=null&&xe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(S.id,!(xe!=null&&xe.collapsed))}),xe!=null&&xe.groupRef&&!de&&Ce.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(S.id)}),Ce.push({caption:de?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:de?"unlock":"lock",handler:()=>i.setEntityLocked(S.id,!de)}),Ce.push(Be(S.id)),!de){const Ye=i.clipboard.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ce.push({caption:Ye.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Ye.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:S.id},i.paste()}}),Ce.push({type:"separator"}),Ce.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(S.id)})}(vh=Z.value)==null||vh.open(q,Ce)}function zt({event:C,edge:S}){var xe,de;const q=C;if(q.preventDefault(),!i.editable.value)return;const re=T(S.id);if(re){(xe=Z.value)==null||xe.open(q,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(re.noteRef,re.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(re.noteRef,re.targetRef)}]);return}const ne=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(S.id)}];i.isAssociationLocked(S.id)||ne.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(S.id)}),(de=Z.value)==null||de.open(q,ne)}function ut(C){return C==="group"?"group":C==="note"?"note":"entity"}function Qt({node:C}){if(ie.value.length>1){i.selection.value=null;return}i.selection.value={kind:ut(C.type),id:C.id}}function en({nodes:C}){C.length>1&&(i.selection.value=null)}function Ne({edge:C}){const S=T(C.id);i.selection.value=S?{kind:"note",id:S.noteRef}:{kind:"association",id:C.id}}function et(C){const S=i.selection.value;return!!S&&S.kind!=="attribute"&&S.id===C.id}function Ft(C){var S,q;return et(C)?C.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":C.type==="note"?"var(--em-note-soft)":C.type==="group"?mf(_t((S=C.data)==null?void 0:S.style),!0)??"var(--em-mm-group)":mf(_t((q=C.data)==null?void 0:q.style))??"var(--em-mm-entity)"}function pt(C){return et(C)?"var(--em-selection)":C.type==="note"?"var(--em-note-accent)":C.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function nt(C,S){D(C,S,{zoom:U().zoom,duration:350})}t.watch(()=>i.focusRequest.value,C=>{if(!C)return;const S=$(C.id);if(!S)return;const q=S.computedPosition??S.position,re=S.dimensions??{width:0,height:0};nt(q.x+re.width/2,q.y+re.height/2)});function Fo({position:C}){nt(C.x,C.y)}function Uo({node:C}){i.selection.value={kind:ut(C.type),id:C.id};const S=C.computedPosition??C.position,q=C.dimensions??{width:0,height:0};nt(S.x+q.width/2,S.y+q.height/2)}function Ho({node:C}){M({nodes:[C.id],duration:350,maxZoom:1.2,padding:.6})}return(C,S)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(fw),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ye.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(cn).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:V,onMoveEnd:Pe,onConnect:De,onConnectStart:S[1]||(S[1]=q=>u.value=!0),onConnectEnd:S[2]||(S[2]=q=>u.value=!1),onNodeDrag:Ue,onNodeDragStop:Le,onNodeClick:Qt,onEdgeClick:Ne,onSelectionChange:en,onPaneClick:S[3]||(S[3]=q=>t.unref(i).selection.value=null),onPaneContextMenu:Ee,onNodeContextMenu:at,onEdgeContextMenu:zt},{"node-group":t.withCtx(q=>[t.createVNode(Uf,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"node-entity":t.withCtx(q=>[t.createVNode(Ff,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"node-note":t.withCtx(q=>[t.createVNode(Hf,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"edge-association":t.withCtx(q=>[t.createVNode(dp,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"edge-note-connection":t.withCtx(q=>[t.createVNode(iT,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(GC),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(bS),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(oo),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:ce},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(oo),{title:t.unref(i).t("em.ctx.addNote"),onClick:fe},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(oo),{title:t.unref(i).t("em.palette.autoLayout"),onClick:S[0]||(S[0]=q=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(eT),{key:1,pannable:"",width:224,height:160,"node-color":Ft,"node-stroke-color":pt,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:Fo,onNodeClick:Uo,onNodeDblclick:Ho})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ke.value?(t.openBlock(),t.createElementBlock("div",qT,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",WT,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,JT),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,XT),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,ZT)],64)):(t.openBlock(),t.createElementBlock("p",QT,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(GT,{key:1,controller:t.unref(i),onClose:S[4]||(S[4]=q=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",eM,[t.createVNode(Ae,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",tM,[t.createElementVNode("strong",nM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",oM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(hT,{ref_key:"menuRef",ref:Z,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",iM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),aM={class:"em-explorer em-scroll-overlay"},rM={class:"em-explorer__search"},lM=["placeholder","aria-label"],sM=["aria-label","title"],cM={key:0,class:"em-explorer__empty"},dM=["aria-label"],uM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],mM=["onClick"],fM=["title"],pM={class:"em-key-slot"},hM={class:"em-key-slot"},yM={class:"em-explorer__label"},gM={key:2,class:"em-explorer__sr"},mh=Ke(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.computed(()=>{var ke,Se;const O=i.resolved.value,y=i.displayMode.value,w=i.userLanguage.value,v=ce=>{var fe,oe,le;return Pi(y,ce.name,(oe=(fe=ce.table)==null?void 0:fe.logicalName)==null?void 0:oe[w],(le=ce.table)==null?void 0:le.physicalName,i.t("em.node.logicalMissing"))},M=y==="PHYSICAL"||y==="LOGICAL_PHYSICAL",D=ce=>{const fe=ce.attrType.startsWith("RELATION")&&ce.dbAttrs.length>0;return{icon:ce.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:ce.identifier,fk:fe&&M}}},U=ce=>ce.attrType.startsWith("EMBED")&&ce.dbAttrs.length>0,W=y==="PHYSICAL"||y==="LOGICAL_PHYSICAL",ie=ce=>{if(ce.attrType!=="EMBED_PREDEF")return ce.dbAttrs;const fe=i.embeddableCatalog.value.find(oe=>oe.type===ce.type);return fe?ce.dbAttrs.map((oe,le)=>{const ue=fe.fields[le];return ue?{...oe,physicalName:oe.physicalName||ue.physicalName,logicalName:oe.logicalName??ue.logicalName,dataType:oe.dataType||ue.dataType,length:oe.length??ue.length}:oe}):ce.dbAttrs},pe=(ce,fe)=>{var z,P,F,Q,X,_e,he,we,Ie;const oe={entityId:fe,attrId:ce.modelId};if(U(ce)){const Y=$r(y,ce);return{key:`attr:${ce.modelId}`,label:ce.name+(Y?` : ${Y}`:""),icon:"table",attrRef:oe,focusId:fe,matchText:zo(ce.name,(P=(z=ce.dbAttrs[0])==null?void 0:z.logicalName)==null?void 0:P[w],(F=ce.dbAttrs[0])==null?void 0:F.physicalName),children:W?ie(ce).map(j=>{var J,ve;return{key:`attr:${ce.modelId}:col:${j.modelId}`,label:Pi(y,j.physicalName,(J=j.logicalName)==null?void 0:J[w],j.physicalName,i.t("em.node.logicalMissing"))+(j.dataType?` : ${j.dataType}`:""),icon:"field",attrRef:oe,focusId:fe,matchText:zo(j.physicalName,(ve=j.logicalName)==null?void 0:ve[w]),children:[]}}):[]}}const le=Ar(ce,i.state.logical.associations),ue=$r(y,ce,le);return{key:`attr:${ce.modelId}`,label:Pi(y,ce.name,(X=(Q=ce.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:X[w],(_e=ce.dbAttrs[0])==null?void 0:_e.physicalName,i.t("em.node.logicalMissing"))+(ue?` : ${ue}`:""),...D(ce),attrRef:oe,focusId:fe,matchText:zo(ce.name,(we=(he=ce.dbAttrs[0])==null?void 0:he.logicalName)==null?void 0:we[w],(Ie=ce.dbAttrs[0])==null?void 0:Ie.physicalName),children:[]}},ye=ce=>{var le,ue,z;const fe=ce.entity,oe=[...fe.attributes].sort((P,F)=>P.order-F.order);return{key:`entity:${fe.modelId}`,label:v(fe),icon:"table",selectKind:"entity",selectId:fe.modelId,focusId:fe.modelId,matchText:zo(fe.name,(ue=(le=fe.table)==null?void 0:le.logicalName)==null?void 0:ue[w],(z=fe.table)==null?void 0:z.physicalName),children:oe.map(P=>pe(P,fe.modelId))}},ge=new Map,me=[];for(const ce of O.entities)if(ce.groupRef){const fe=ge.get(ce.groupRef)??[];fe.push(ce),ge.set(ce.groupRef,fe)}else me.push(ce);const se=[];for(const ce of O.groups){const fe=ce.group;se.push({key:`group:${fe.modelId}`,label:((ke=fe.name)==null?void 0:ke[w])||((Se=fe.name)==null?void 0:Se.ko)||fe.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:fe.modelId,children:(ge.get(fe.modelId)??[]).map(ye)})}for(const ce of me)se.push(ye(ce));if(O.associations.length){const ce=new Map(O.entities.map(fe=>[fe.entity.modelId,v(fe.entity)]));se.push({key:"section:associations",label:i.t("em.explorer.associations",{n:O.associations.length}),icon:"arrow-lr",children:O.associations.map(fe=>{const oe=fe.association,le=ce.get(oe.end1.entityRef)??oe.end1.entityRef,ue=ce.get(oe.end2.entityRef)??oe.end2.entityRef;return{key:`assoc:${oe.modelId}`,label:`${le} — ${ue}`,icon:"arrow-lr",selectKind:"association",selectId:oe.modelId,children:[]}})})}return O.notes.length&&se.push({key:"section:notes",label:i.t("em.explorer.notes",{n:O.notes.length}),icon:"note",children:O.notes.map(({note:ce})=>{var fe;return{key:`note:${ce.modelId}`,label:((fe=ce.memo.split(`
|
|
66
|
-
`)[0])==null?void 0:fe.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:ce.modelId,focusId:ce.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:se}});function l(O){return O?O.pk&&O.fk?i.t("em.node.keyPfk"):O.pk?i.t("em.node.keyPk"):O.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const O=[],y=w=>{if(w.children.length){w.key!=="root"&&O.push(w.key);for(const v of w.children)y(v)}};return y(r.value),O}),c=O=>O.startsWith("entity:")||O==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=ah({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),h=t.ref(null),g=t.computed(()=>f.value.trim().length>0),k=t.computed(()=>{const O=[];if(g.value){const w=$T(r.value,f.value.trim().toLowerCase()),v=(M,D,U,W,ie)=>{if(!w.has(M.key))return;O.push({node:M,depth:D,parentKey:U,posinset:W,setsize:ie});const pe=M.children.filter(ye=>w.has(ye.key));pe.forEach((ye,ge)=>v(ye,D+1,M.key,ge+1,pe.length))};return v(r.value,0,null,1,1),O}const y=(w,v,M,D,U)=>{O.push({node:w,depth:v,parentKey:M,posinset:D,setsize:U}),d(w.key)||w.children.forEach((W,ie)=>y(W,v+1,w.key,ie+1,w.children.length))};return y(r.value,0,null,1,1),O}),N=t.ref(null),b=t.ref(null),_=t.computed(()=>{var y;const O=k.value;return b.value&&O.some(w=>w.node.key===b.value)?b.value:((y=O[0])==null?void 0:y.node.key)??null}),E=O=>!g.value&&d(O);async function I(O){var y,w;O&&(b.value=O,await t.nextTick(),(w=(y=N.value)==null?void 0:y.querySelector(`[data-key="${O}"]`))==null||w.focus())}function A(O,y){var M,D,U,W,ie;const w=k.value,v=w.findIndex(pe=>pe.node.key===y.node.key);switch(O.key){case"ArrowDown":O.preventDefault(),I((M=w[v+1])==null?void 0:M.node.key);return;case"ArrowUp":O.preventDefault(),I((D=w[v-1])==null?void 0:D.node.key);return;case"Home":O.preventDefault(),I((U=w[0])==null?void 0:U.node.key);return;case"End":O.preventDefault(),I((W=w[w.length-1])==null?void 0:W.node.key);return;case"ArrowRight":if(O.preventDefault(),!y.node.children.length)return;E(y.node.key)?u(y.node.key):I((ie=w[v+1])==null?void 0:ie.node.key);return;case"ArrowLeft":O.preventDefault(),y.node.children.length&&!E(y.node.key)?u(y.node.key):I(y.parentKey);return;case"Enter":case" ":O.preventDefault(),$(y.node,O);return;case"F2":O.preventDefault(),B(y.node)}}const T=t.computed(()=>g.value&&k.value.length<=1);function L(O){var v;if(O.key!=="/"||O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;const y=O.target,w=y==null?void 0:y.tagName;w==="INPUT"||w==="TEXTAREA"||w==="SELECT"||y!=null&&y.isContentEditable||(O.preventDefault(),(v=h.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",L)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",L)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function x(O){const y=i.selection.value;return O.attrRef?(y==null?void 0:y.kind)==="attribute"&&y.entityId===O.attrRef.entityId&&y.ids.includes(O.attrRef.attrId):!!y&&y.kind!=="attribute"&&!!O.selectId&&O.selectKind===y.kind&&O.selectId===y.id}function R(O){const y=i.selection.value;return O.selectKind==="entity"&&(y==null?void 0:y.kind)==="attribute"&&y.entityId===O.selectId}function $(O,y){if(O.attrRef){const w=y.shiftKey?"range":y.metaKey||y.ctrlKey?"toggle":"replace";i.selectAttribute(O.attrRef.entityId,O.attrRef.attrId,w)}else O.selectKind&&O.selectId&&(i.selection.value={kind:O.selectKind,id:O.selectId});O.focusId&&i.requestFocus(O.focusId)}function B(O){O.selectKind==="entity"&&O.selectId&&qa(a,i,O.selectId)}return(O,y)=>(t.openBlock(),t.createElementBlock("section",aM,[t.createElementVNode("div",rM,[t.createVNode(Ae,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":y[0]||(y[0]=w=>f.value=w),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:y[1]||(y[1]=t.withKeys(w=>f.value="",["esc"]))},null,40,lM),[[t.vModelText,f.value]]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:y[2]||(y[2]=w=>f.value="")},[t.createVNode(Ae,{name:"x",size:13})],8,sM)):t.createCommentVNode("",!0)]),T.value?(t.openBlock(),t.createElementBlock("p",cM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:N,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,w=>(t.openBlock(),t.createElementBlock("div",{key:w.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":x(w.node),"is-focus-parent":R(w.node),"is-selectable":!!w.node.selectKind||!!w.node.attrRef||!!w.node.focusId}]),"data-key":w.node.key,role:"treeitem","aria-level":w.depth+1,"aria-posinset":w.posinset,"aria-setsize":w.setsize,"aria-expanded":w.node.children.length?!E(w.node.key):void 0,"aria-selected":x(w.node),tabindex:w.node.key===_.value?0:-1,style:t.normalizeStyle({paddingLeft:4+w.depth*14+"px"}),onClick:v=>$(w.node,v),onDblclick:v=>B(w.node),onFocus:v=>b.value=w.node.key,onKeydown:v=>A(v,w)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!w.node.children.length,"is-open":!E(w.node.key)}]),onClick:t.withModifiers(v=>w.node.children.length&&t.unref(u)(w.node.key),["stop"])},[w.node.children.length?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,mM),w.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(w.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",pM,[w.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-pk"})):w.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",hM,[w.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,fM)):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",yM,t.toDisplayString(w.node.label),1),l(w.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",gM,t.toDisplayString(l(w.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,uM))),128))],8,dM)]))}}),[["__scopeId","data-v-e5303c65"]]),bM={class:"em-text-export"},_M=["id","aria-selected","tabindex","onClick"],kM=["aria-labelledby"],EM={class:"em-text-export__actions"},NM=Ke(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(m,p)=>Dt(n.locale??"ko",m,p),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var p,f;a.value=m,await t.nextTick(),(f=(p=l.value)==null?void 0:p.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const p=n.formats.length;p&&s((a.value+m+p)%p)}async function d(){try{await navigator.clipboard.writeText(r().content),ee.showNotification(i("em.export.copied"),"info")}catch{ee.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),p=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(p);try{const h=document.createElement("a");h.href=f,h.download=m.filename,document.body.appendChild(h),h.click(),h.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",bM,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,h)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${h}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":h===a.value}]),"aria-selected":h===a.value,"aria-controls":"em-text-export-panel",tabindex:h===a.value?0:-1,onClick:g=>a.value=h,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(g=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(g=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(g=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(g=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,_M))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,kM),t.createElementVNode("div",EM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),wM={class:"em-text-import"},IM=["aria-label"],vM=["aria-checked","tabindex","onClick"],xM=["placeholder"],CM={class:"em-text-import__status"},SM={class:"em-text-import__ok"},RM={key:0,class:"em-text-import__warn"},AM={key:1,class:"em-text-import__err"},$M={key:2,class:"em-text-import__err"},TM={key:3,class:"em-text-import__err"},MM={class:"em-text-import__actions"},VM=Ke(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(g,k)=>Dt(n.locale??"ko",g,k),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(g){var N,b;const k=l[(g+l.length)%l.length];k&&(r.value=k.key,await t.nextTick(),(b=(N=s.value)==null?void 0:N.querySelectorAll('[role="radio"]')[l.indexOf(k)])==null||b.focus())}function d(g){c(l.findIndex(k=>k.key===r.value)+g)}function u(g){return g?g.startsWith("{")?"json":/\berdiagram\b/i.test(g)?"mermaid":/\bcreate\s+table\b/i.test(g)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const g=a.value.trim();if(!g)return{status:"empty"};const k=m.value;if(!k)return{status:"unknown"};try{let N,b=[];return k==="json"?N=dc(g):k==="mermaid"?N=nc(g):(N=rc(g),b=Tr(g).warnings),N.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:N,warnings:b}}catch(N){return{status:"error",message:N instanceof Error?N.message:String(N)}}}),f=t.computed(()=>p.value.status==="ok");function h(){const g=p.value;g.status!=="ok"||!g.source||(n.onImport(g.source),o.close())}return(g,k)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",wM,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,N=>t.createElementVNode("button",{key:N.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":N.key===r.value}]),"aria-checked":N.key===r.value,tabindex:N.key===r.value?0:-1,onClick:b=>r.value=N.key,onKeydown:[k[0]||(k[0]=t.withKeys(t.withModifiers(b=>d(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(b=>d(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(b=>c(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(b=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(N.labelKey)),43,vM)),64))],8,IM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":k[4]||(k[4]=N=>a.value=N),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,xM),[[t.vModelText,a.value]]),t.createElementVNode("div",CM,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",SM,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:p.value.source.logical.entities.length,relations:p.value.source.logical.associations.length})),1),p.value.warnings&&p.value.warnings.length?(t.openBlock(),t.createElementBlock("span",RM," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:p.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):p.value.status==="error"?(t.openBlock(),t.createElementBlock("span",AM,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",$M,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",TM,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",MM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:h},null,8,["caption","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:k[5]||(k[5]=N=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),BM={class:"em-toolbar"},DM=["title"],OM={class:"em-toolbar__mode"},fh=Ke(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=ee.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:h=>i.displayMode.value=h});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const h=i.resolved.value.entities;return h.length>0&&h.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const h=Ks(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:NM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Fs(h,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Ir(h,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Ir(h,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:lc(h,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:cc(h,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:VM,bind:{locale:i.uiLocale.value,onImport:h=>{i.importEntities(h,h.logical.entities.map(g=>g.modelId))}}})}function f(){r.openModal({component:dh,bind:{locale:i.uiLocale.value}})}return(h,g)=>(t.openBlock(),t.createElementBlock("div",BM,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,DM)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:g[0]||(g[0]=k=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:g[1]||(g[1]=k=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",OM,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(ee.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=k=>s.value=k),items:l,"value-provider":k=>k.v,"label-provider":k=>t.unref(i).t(k.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=k=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=k=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(Ae,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:p},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=k=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=k=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"camera",size:16})]),_:1},8,["tooltip"]),g[11]||(g[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=k=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),g[8]||(g[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),LM=["title"],PM=["title"],zM=["disabled","aria-pressed"],FM=["disabled","aria-pressed"],UM=Ke(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>Dt(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode(Ae,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,LM)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode(Ae,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,zM),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode(Ae,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,FM)],10,PM))}}),[["__scopeId","data-v-2b5162b7"]]),HM=["disabled"],jM={class:"em-panel__sub"},KM={class:"em-nav"},GM={key:0,class:"em-nav__divider","aria-hidden":"true"},YM={key:1},qM=["onClick","onKeydown"],WM={class:"em-nav__name"},JM=["title"],XM={key:0,class:"em-panel__note"},ZM=["data-attr-block"],QM={class:"em-attr__row"},e2=["title"],t2={key:0,class:"em-attr__row"},n2={key:1,class:"em-attr__navhint"},o2={key:0,class:"em-attr__navhint"},i2={class:"em-attr__row"},a2={class:"em-attr__row"},r2=["title"],l2={class:"em-attr__flags"},s2={class:"em-attr__pii"},c2={class:"em-attr__pii"},d2={key:1,class:"em-attr__pii"},u2={key:2,class:"em-attr__pii em-attr__codetop"},m2={class:"em-multilang"},f2={key:3,class:"em-embed-cols"},p2={class:"em-embed-col__label"},h2={class:"em-attr__row"},y2=["title"],g2=["title"],b2=["title"],_2={class:"em-attr__row"},k2={key:0,class:"em-embed-upd"},E2={key:1,class:"em-attr__navhint"},N2={class:"em-embed-upd"},w2={class:"em-embed-upd"},I2={class:"em-swatch__row em-attr__swatch"},v2=["title","onClick"],x2=["title","onClick"],C2={key:0,class:"em-attr__swatch-hint"},S2=Ke(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:p,setTransient:f,dbLocked:h,fkDerived:g,fkOriginPhysical:k,typeValueOf:N,typeLabelOf:b,setAttrType:_,setAttrCustomType:E,setDb:I,scaleApplicable:A,scaleHint:T,setDbLogical:L,setAttrDescription:x,attrPiiValue:R,setAttrPii:$,predefinedCustomTypeCatalog:B,embeddableCatalog:O,predefinedLabel:y,groupCodeCatalog:w,attrGroupCodes:v,attrCodeItems:M,codeValueOf:D,codeLabelOf:U,setAttrGroupCode:W,setAttrCode:ie,setAttrDefaultValue:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:z,insertableItems:P,insertableLabel:F,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:Y,isShared:j,sharedPhysical:J}=yf(o,()=>n.entityId),ve=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Le=>Le.entityRef===i.value.modelId)??null:null),Te=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes.filter(De=>De.attrType!=="DIVIDER"))??[]}),K=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes)??[]}),te=t.computed(()=>Te.value.filter(Le=>r.value.has(Le.modelId)));function G(Le){return{pk:Le.identifier,fk:Le.attrType.startsWith("RELATION")&&Le.dbAttrs.length>0,required:Le.notNull&&!Le.identifier}}function ae(Le){const De=G(Le),Z=[De.pk&&"PK",De.fk&&"FK",De.required&&"NOT NULL"].filter(Boolean);return Z.length?Z.join(" · "):void 0}function Be(Le,De){i.value&&o.selectAttribute(i.value.modelId,Le.modelId,De.shiftKey?"range":De.metaKey||De.ctrlKey?"toggle":"replace")}function Ve(Le){var De,Z;return _t((Z=(De=ve.value)==null?void 0:De.attributeStyles)==null?void 0:Z[Le.modelId])}function H(Le){return r.value.size>1&&r.value.has(Le.modelId)}function V(Le,De){if(!i.value)return;const Z=H(Le)?o.selectedAttrIds.value:[Le.modelId];o.setAttributeSwatches(i.value.modelId,Z,De)}const Pe=t.ref(void 0);function Ze(Le){if(!Le||!i.value)return;const De=o.addPredefinedEmbed(i.value.modelId,Le);De&&o.selectAttribute(i.value.modelId,De),Pe.value=void 0}function Ue(){if(!i.value)return;const Le=o.addAttribute(i.value.modelId);Le&&o.selectAttribute(i.value.modelId,Le)}return(Le,De)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",jM,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value.length}))+" ",1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ue},null,8,["caption"]),t.unref(O).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":Pe.value,items:t.unref(O),"value-provider":Z=>Z.type,"label-provider":t.unref(y),"onUpdate:modelValue":Ze},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",KM,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(K.value,Z=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[Z.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",GM,[...De[0]||(De[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",YM,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Z.modelId)}]),role:"button",tabindex:"0",onClick:dt=>Be(Z,dt),onKeydown:[t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["space"])]},[t.createElementVNode("span",WM,t.toDisplayString(Z.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:ae(Z)},[G(Z).pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):G(Z).required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),G(Z).fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,JM)],42,qM)]))],64))),128))]),Te.value.length&&!te.value.length?(t.openBlock(),t.createElementBlock("p",XM,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.value,Z=>{var dt,yn,Et,gn,Ee,at,zt,ut,Qt,en;return t.openBlock(),t.createElementBlock("div",{key:Z.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(Z.modelId)}]),"data-attr-block":Z.modelId},[t.createElementVNode("div",QM,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-name-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":Z.name,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{name:Ne})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-type-${Z.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Z.attrType.startsWith("EMBED")||!!Z.groupCode||Z.attrType==="RELATION_REF"||t.unref(g)(Z),items:t.unref(ec)(Z.type,t.unref(B)),"value-provider":t.unref(N),"label-provider":t.unref(b),"model-value":Z.type,"onUpdate:modelValue":Ne=>t.unref(_)(Z,Ne)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(u)(Z)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ne=>t.unref(o).removeAttribute(t.unref(i).modelId,Z.modelId)},null,8,["onClick"])],8,e2)]),Z.type===t.unref(tn)&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("div",t2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-customtype-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Z.customType??"","onUpdate:modelValue":Ne=>t.unref(E)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",n2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ye)(Z)?(t.openBlock(),t.createElementBlock("div",f2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.dbAttrs,(Ne,et)=>{var Ft,pt,nt,Fo,Uo,Ho,C,S;return t.openBlock(),t.createElementBlock("div",{key:Ne.modelId,class:"em-embed-col"},[t.createElementVNode("span",p2,t.toDisplayString(((Ft=t.unref(se)(Z,et))==null?void 0:Ft.name)??((pt=t.unref(se)(Z,et))==null?void 0:pt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:et+1})),1),t.createElementVNode("div",h2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`embed-col-${Ne.modelId}`,width:"100%",disabled:t.unref(j)(Ne),placeholder:((nt=t.unref(se)(Z,et))==null?void 0:nt.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(j)(Ne)?t.unref(J)(Ne):Ne.physicalName,"onUpdate:modelValue":q=>t.unref(ge)(Z,et,{physicalName:q})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSTextInput),{name:`embed-dtype-${Ne.modelId}`,width:"84px",disabled:"","model-value":t.unref(ke)(Z,et)},null,8,["name","model-value"])],8,y2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-len-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(Se)(Z,et)},null,8,["name","model-value"])],8,g2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-scale-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ce)(Z,et)},null,8,["name","model-value"])],8,b2)]),t.createVNode(to,{controller:t.unref(o),"ref-id":Ne.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",_2,[t.createVNode(dn,{class:"grow",name:`embed-logical-${Ne.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Uo=(Fo=t.unref(se)(Z,et))==null?void 0:Fo.logicalName)==null?void 0:Uo[t.unref(o).userLanguage.value])??((C=(Ho=t.unref(se)(Z,et))==null?void 0:Ho.logicalName)==null?void 0:C.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ne.logicalName,"onUpdate:modelValue":q=>t.unref(me)(Z,et,q)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(S=t.unref(se)(Z,et))!=null&&S.shareable?(t.openBlock(),t.createElementBlock("label",k2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"110px","model-value":t.unref(Ie)(Ne),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":q=>q&&t.unref(Y)(Z,et,q)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(j)(Ne)?(t.openBlock(),t.createElementBlock("p",E2,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",N2,[De[3]||(De[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ne),"model-value":t.unref(j)(Ne)?"false":t.unref(Q)(Ne),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":q=>q&&t.unref(X)(Z,et,q)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",w2,[De[4]||(De[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ne),"model-value":t.unref(j)(Ne)?"false":t.unref(le)(Ne),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":q=>q&&t.unref(ue)(Z,et,q)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("p",o2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",i2,[t.createVNode(dn,{class:"grow",name:`attr-logical-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(dt=Z.dbAttrs[0])==null?void 0:dt.logicalName,"onUpdate:modelValue":Ne=>t.unref(L)(Z,Ne)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",a2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(k)(Z)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(h)(Z),"model-value":((yn=Z.dbAttrs[0])==null?void 0:yn.physicalName)??"","onUpdate:modelValue":Ne=>t.unref(I)(Z,{physicalName:Ne})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-dtype-${Z.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(h)(Z)||t.unref(g)(Z),items:t.unref(Xs)(((Et=Z.dbAttrs[0])==null?void 0:Et.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Cr),"model-value":((gn=Z.dbAttrs[0])==null?void 0:gn.dataType)??"","onUpdate:modelValue":Ne=>Ne&&t.unref(I)(Z,{dataType:Ne})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-len-${Z.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(h)(Z)||t.unref(g)(Z),"model-value":(Ee=Z.dbAttrs[0])==null?void 0:Ee.length,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{length:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(T)(Z)},[t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-scale-${Z.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(h)(Z)||t.unref(g)(Z)||!t.unref(A)(Z),"model-value":(at=Z.dbAttrs[0])==null?void 0:at.scale,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{scale:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,r2)]),t.createVNode(to,{controller:t.unref(o),"ref-id":(zt=Z.dbAttrs[0])==null?void 0:zt.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",l2,[t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:t.unref(a)||t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(p)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(d)(Z,{notNull:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-uq-${Z.modelId}`,label:"Unique","model-value":!!((ut=Z.dbAttrs[0])!=null&&ut.unique),disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{unique:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-ai-${Z.modelId}`,label:"Auto Increment","model-value":!!((Qt=Z.dbAttrs[0])!=null&&Qt.autoIncrement),disabled:t.unref(h)(Z)||t.unref(g)(Z)||!Z.identifier,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{autoIncrement:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-tr-${Z.modelId}`,label:"@Transient","model-value":!!Z.transient,disabled:Z.identifier||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(f)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(m)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Z.modelId}`,label:"mutable","model-value":!!Z.naturalIdMutable,disabled:t.unref(h)(Z)||!Z.naturalId,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{naturalIdMutable:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-mv-${Z.modelId}`,label:"Multi-Value (Set)","model-value":!!((en=Z.dbAttrs[0])!=null&&en.multiValue),disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{multiValue:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",s2,[De[1]||(De[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(h)(Z),"model-value":t.unref(Q)(Z.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ne=>Ne&&t.unref(_e)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",c2,[De[2]||(De[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(h)(Z),"model-value":t.unref(le)(Z.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ne=>Ne&&t.unref(z)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",d2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":t.unref(R)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ne=>Ne&&t.unref($)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(w).length&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("label",u2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Ef,{"model-value":Z.groupCode,items:t.unref(w),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ne=>t.unref(W)(Z,Ne)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(w).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(v)(Z).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"100%","model-value":Z.defaultValue??"none",items:t.unref(M)(Z),"value-provider":t.unref(D),"label-provider":t.unref(U),"onUpdate:modelValue":Ne=>Ne&&t.unref(ie)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`attr-default-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Z.defaultValue??"","onUpdate:modelValue":Ne=>t.unref(pe)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",m2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`attr-desc-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Z.description,"onUpdate:modelValue":Ne=>t.unref(x)(Z,Ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",I2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ve(Z)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:Ne=>V(Z,null)},"∅",10,v2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),Ne=>(t.openBlock(),t.createElementBlock("button",{key:Ne,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ve(Z)===Ne}]),style:t.normalizeStyle({background:t.unref(To)(Ne)}),title:t.unref(o).t(t.unref(eo)(Ne)),onClick:et=>V(Z,Ne)},null,14,x2))),128)),H(Z)?(t.openBlock(),t.createElementBlock("span",C2,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,ZM)}),128))],8,HM)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-2c47fef2"]]),R2=["disabled"],A2={class:"em-panel__sub-label"},$2={class:"em-attr__row"},T2={class:"em-field em-idx-params"},M2=["value","placeholder","onChange"],V2=Ke(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(I=>I.modelId===o.entityId)??null),l=t.computed(()=>r.value?jo(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var I;return Tn(((I=r.value)==null?void 0:I.attributes)??[])}),c=I=>s.value.canon(I),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>{var I;return[...(((I=r.value)==null?void 0:I.attributes)??[]).filter(A=>A.dbAttrs.length>0).map(A=>({value:A.modelId,label:If(A,d.value)})),...l.value.map(A=>({value:A.modelId,label:a.t("em.index.inherited",{field:A.field})}))]});function m(I,A){var R;const T=new Set(I.columns.filter(($,B)=>B!==A).map($=>c($.columnRef))),L=u.value.filter($=>!T.has(c($.value))),x=(R=I.columns[A])==null?void 0:R.columnRef;return x&&!L.some($=>$.value===x)&&L.push({value:x,label:p(x)}),L}function p(I){return vf(I,d.value)}function f(I){const A=new Set(I.columns.map(T=>c(T.columnRef)));return u.value.filter(T=>!A.has(c(T.value)))}function h(){var A;if(!r.value)return;const I=u.value[0];a.addIndex(r.value.modelId,{modelId:Me(),name:`idx_${(((A=r.value.indexes)==null?void 0:A.length)??0)+1}`,unique:!1,columns:I?[{columnRef:I.value,descending:!1}]:[]})}function g(I,A){r.value&&a.updateIndex(r.value.modelId,I,A)}function k(I){const A=f(I)[0];A&&g(I.modelId,{columns:[...I.columns,{columnRef:A.value,descending:!1}]})}function N(I,A,T){g(I.modelId,{columns:I.columns.map((L,x)=>x===A?{...L,columnRef:T}:L)})}function b(I,A,T){g(I.modelId,{columns:I.columns.map((L,x)=>x===A?{...L,descending:T}:L)})}function _(I,A){g(I.modelId,{columns:I.columns.filter((T,L)=>L!==A)})}function E(I,A){g(I.modelId,{parameters:A.trim()===""?void 0:A})}return(I,A)=>{var T;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:A[0]||(A[0]=L=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",A2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:((T=r.value.indexes)==null?void 0:T.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(h,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],L=>(t.openBlock(),t.createElementBlock("div",{key:L.modelId,class:"em-attr"},[t.createElementVNode("div",$2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`idx-name-${L.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":L.name,"onUpdate:modelValue":x=>g(L.modelId,{name:x})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-uq-${L.modelId}`,class:"em-check",label:"UQ","model-value":L.unique,"onUpdate:modelValue":x=>g(L.modelId,{unique:x})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:x=>t.unref(a).removeIndex(r.value.modelId,L.modelId)},null,8,["onClick"])]),t.createVNode(to,{controller:t.unref(a),"ref-id":L.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(L.columns,(x,R)=>(t.openBlock(),t.createElementBlock("div",{key:R,class:"em-attr__row"},[t.createVNode(t.unref(ee.BSSelect),{class:"grow","model-value":x.columnRef,items:m(L,R),"value-provider":$=>$.value,"label-provider":$=>$.label,"onUpdate:modelValue":$=>$&&N(L,R,$)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-${L.modelId}-desc-${R}`,class:"em-check",label:"DESC","model-value":x.descending,"onUpdate:modelValue":$=>b(L,R,$)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:"−",onClick:$=>_(L,R)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(L).length,onClick:x=>k(L)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",T2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:L.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:x=>E(L,x.target.value)},null,40,M2)])]))),128)):t.createCommentVNode("",!0)],8,R2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),B2=["disabled"],D2={class:"em-panel__sub-label"},O2={class:"em-attr__row"},L2={class:"em-attr__row"},P2={class:"em-multilang"},z2={class:"em-attr__pii"},F2={class:"em-swatch__row em-attr__swatch"},U2=["title","onClick"],H2=["title","onClick"],j2=Ke(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=ee.useModal(),l=t.computed(()=>a.state.logical.entities.find(_=>_.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(_=>_.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(_){return _==="none"?a.t("em.common.noneParen"):_}const m=_=>_;function p(_,E){l.value&&a.updateOperation(l.value.modelId,_.modelId,E)}function f(_,E){p(_,{description:Object.keys(E).length?E:void 0})}function h(_){return _.personalInfoAttributeType??"none"}function g(_,E){p(_,{personalInfoAttributeType:E==="none"?void 0:E})}function k(_){var E,I;return _t((I=(E=s.value)==null?void 0:E.operationStyles)==null?void 0:I[_.modelId])}function N(_,E){l.value&&a.setOperationSwatch(l.value.modelId,_.modelId,E)}function b(_){r.openModal({component:xf,bind:{operationName:_.name,sourceCode:_.sourceCode??"",locale:a.uiLocale.value,onSave:E=>p(_,{sourceCode:E})}})}return(_,E)=>{var I;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:E[1]||(E[1]=A=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",D2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((I=l.value.operations)==null?void 0:I.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:E[0]||(E[0]=t.withModifiers(A=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],A=>(t.openBlock(),t.createElementBlock("div",{key:A.modelId,class:"em-attr"},[t.createElementVNode("div",O2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":T=>p(A,{name:T})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":T=>T&&p(A,{visibility:T})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:T=>t.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),t.createElementVNode("div",L2,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:T=>b(A)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",P2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`op-desc-${A.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":T=>f(A,T)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",z2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":h(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":T=>T&&g(A,T)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",F2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":k(A)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:T=>N(A,null)},"∅",10,U2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),T=>(t.openBlock(),t.createElementBlock("button",{key:T,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":k(A)===T}]),style:t.normalizeStyle({background:t.unref(To)(T)}),title:t.unref(a).t(t.unref(eo)(T)),onClick:L=>N(A,T)},null,14,H2))),128))])]))),128)):t.createCommentVNode("",!0)],8,B2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),K2=["title"],G2={class:"em-panel__head"},Y2={class:"em-panel__head-row"},q2=["title"],W2={class:"em-panel__context"},J2={key:0,class:"em-panel__lock"},X2=["disabled"],Z2={key:0,class:"em-panel__note"},Q2={key:1,class:"em-panel__note"},eV={key:2,class:"em-jpa"},tV={class:"em-field"},nV={class:"em-field"},oV={class:"em-field"},iV={key:0,class:"em-field"},aV={class:"em-panel__note"},rV={class:"em-panel__sub"},lV={class:"em-field"},sV={class:"em-field"},cV={class:"em-jpa"},dV={key:0,class:"em-panel__note"},uV={key:1,class:"em-panel__note"},mV={class:"em-jpa"},fV={class:"em-field"},pV={key:0,class:"em-panel__note"},hV={class:"em-field"},yV={class:"em-multilang"},gV={class:"em-field"},bV=["value"],_V={class:"em-field"},kV={class:"em-swatch"},EV={class:"em-swatch__row"},NV=["title"],wV=["title","onClick"],IV={class:"em-panel__note"},vV={class:"em-field"},xV=["value"],CV={class:"em-swatch"},SV={class:"em-swatch__row"},RV=["title"],AV=["title","onClick"],ph=Ke(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var Y;return(Y=r.value)==null?void 0:Y.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const Y=c.value;return Y?l.state.logical.entities.find(j=>j.modelId===Y)??null:null}),u=t.computed(()=>{const Y=s.value;if((Y==null?void 0:Y.kind)==="association")return l.isAssociationLocked(Y.id);const j=c.value;return!!j&&l.isEntityLocked(j)}),m=t.computed(()=>{var Y;return((Y=l.selectedAttr.value)==null?void 0:Y.attrId)??null}),p=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),h=t.ref({});t.watch(f,()=>{h.value={}});function g(Y){return h.value[Y]??f.value}function k(Y){h.value={...h.value,[Y]:!g(Y)}}const N=t.computed(()=>{var J;const Y=d.value;if(!Y)return l.t("em.entity.fallback");const j=(J=Y.table)==null?void 0:J.physicalName;return j?`${Y.name} (${j})`:Y.name}),b=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="association"?l.state.logical.associations.find(j=>j.modelId===Y.id)??null:null}),_=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="group"?l.state.logical.groups.find(j=>j.modelId===Y.id)??null:null}),E=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="note"?l.state.layout.notes.find(j=>j.modelId===Y.id)??null:null}),I=t.computed(()=>{var j,J;const Y=(j=_.value)==null?void 0:j.name;return(Y==null?void 0:Y[l.userLanguage.value])||(Y==null?void 0:Y.ko)||(Y==null?void 0:Y.en)||(Y==null?void 0:Y.ja)||(Y==null?void 0:Y.zh)||((J=_.value)==null?void 0:J.packageName)||l.t("em.group.fallback")}),A=t.computed(()=>{if(d.value){const Y=p.value.size;if(Y>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:Y});if(m.value){const j=d.value.attributes.find(J=>J.modelId===m.value);return(j==null?void 0:j.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(j==null?void 0:j.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(b.value){const Y=j=>{var J;return((J=l.state.logical.entities.find(ve=>ve.modelId===j))==null?void 0:J.name)??j};return l.t("em.inspector.ctxAssoc",{a:Y(b.value.end1.entityRef),b:Y(b.value.end2.entityRef)})}return _.value?l.t("em.inspector.ctxGroup",{name:I.value}):E.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),T=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],L=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],x={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},R=Y=>{const j=x[Y];return j?l.t(j):Y},$=Y=>{var j;return((j=l.state.logical.entities.find(J=>J.modelId===Y))==null?void 0:j.name)??Y},B=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],O=["LIST","SET"],y=["inherit","LAZY","EAGER"],w=Y=>Y;function v(Y){return Y==="inherit"?l.t("em.common.inherit"):Y}const M=t.computed(()=>!!b.value&&b.value.end1.entityRef===b.value.end2.entityRef);function D(Y,j){b.value&&l.updateAssociationEnd(b.value.modelId,Y,j)}function U(Y){return oe.value?Y:Y==="end1"?"end2":"end1"}function W(Y){var Te;const j=(Te=b.value)==null?void 0:Te[Y];if(!(j!=null&&j.attributeRef))return;const J=l.state.logical.entities.find(K=>K.modelId===j.entityRef),ve=J==null?void 0:J.attributes.find(K=>K.modelId===j.attributeRef);return ve&&(ve.attrType==="RELATION_OWN"||ve.attrType==="RELATION_REF")?ve.name:void 0}function ie(Y,j){var ve;const J=(ve=b.value)==null?void 0:ve[Y];J!=null&&J.attributeRef&&l.updateAttribute(J.entityRef,J.attributeRef,{name:j})}function pe(Y){var K;const j=W(Y);if(j!==void 0)return j;const J=(K=b.value)==null?void 0:K[Y];if(J!=null&&J.navFieldNameHint)return J.navFieldNameHint;const ve=Y==="end1"?"end2":"end1",Te=l.state.logical.entities.find(te=>{var G;return te.modelId===((G=b.value)==null?void 0:G[ve].entityRef)});return Te?ji(Te.name,Ui(b.value[ve].multiplicity)):""}function ye(Y){return!!oe.value||W(Y)!==void 0}function ge(Y){b.value&&!M.value&&l.setAssociationIdentifying(b.value.modelId,Y)}function me(Y){var j,J,ve;return!!((ve=(J=(j=b.value)==null?void 0:j[Y].jpa)==null?void 0:J.cascadeTypes)!=null&&ve.includes("ALL"))}function se(Y,j,J){var K,te;const ve=(K=b.value)==null?void 0:K[Y];if(j==="ALL"&&J){D(Y,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:["ALL"]}});return}const Te=new Set(((te=ve==null?void 0:ve.jpa)==null?void 0:te.cascadeTypes)??[]);J?Te.add(j):Te.delete(j),D(Y,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:[...Te]}})}function ke(Y,j){var ve;const J=(ve=b.value)==null?void 0:ve[Y];D(Y,{jpa:{...J==null?void 0:J.jpa,...j}})}function Se(Y){var j,J;return((J=(j=b.value)==null?void 0:j[Y].jpa)==null?void 0:J.fetchType)??"inherit"}function ce(Y,j){ke(Y,{fetchType:j==="inherit"?void 0:j})}function fe(Y){var J;const j=(J=b.value)==null?void 0:J[Y==="end1"?"end2":"end1"];return(j==null?void 0:j.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(j==null?void 0:j.multiplicity)==="ONE_OR_MORE_INSTANCES"}const oe=t.computed(()=>{const Y=b.value;if(!Y)return null;for(const j of l.state.logical.entities){const J=j.attributes.find(te=>{var G;return((G=te.embedded)==null?void 0:G.associationRef)===Y.modelId&&te.attrType==="EMBED_OWN"});if(!J)continue;const ve=Y.end2.entityRef===J.embedded.embeddableRef?"end2":"end1",Te=Y[ve].multiplicity,K=Y[ve].jpa;return{which:ve,cardinality:Te,isCollection:Te==="ZERO_OR_MORE_INSTANCES"||Te==="ONE_OR_MORE_INSTANCES",collectionType:(K==null?void 0:K.collectionType)??"LIST",collectionTable:(K==null?void 0:K.collectionTable)??"",orderColumn:(K==null?void 0:K.orderColumn)??""}}return null});function le(Y){b.value&&l.setEmbedCardinality(b.value.modelId,Y)}function ue(Y){const j=oe.value;j&&ke(j.which,Y==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function z(Y){const j=oe.value;j&&ke(j.which,{collectionTable:Y.trim()||void 0})}function P(Y){const j=oe.value;j&&ke(j.which,{orderColumn:Y.trim()||void 0})}function F(Y){_.value&&l.updateGroup(_.value.modelId,Y)}function Q(Y,j){var J;F({name:{...(J=_.value)==null?void 0:J.name,[Y]:j}})}const X=t.computed(()=>{var Y;return _.value?_t((Y=l.state.layout.groupLayouts.find(j=>j.groupRef===_.value.modelId))==null?void 0:Y.style):null});function _e(Y){_.value&&l.setGroupSwatch(_.value.modelId,Y)}function he(Y){E.value&&l.setNoteMemo(E.value.modelId,Y)}const we=t.computed(()=>{var Y;return _t((Y=E.value)==null?void 0:Y.style)});function Ie(Y){E.value&&l.setNoteSwatch(E.value.modelId,Y)}return(Y,j)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:j[0]||(j[0]=(...J)=>e.startResize&&e.startResize(...J))},null,42,K2),t.createElementVNode("header",G2,[t.createElementVNode("div",Y2,[j[14]||(j[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:j[1]||(j[1]=J=>a("collapse"))},[t.createVNode(Ae,{name:"panel-right-close",size:16})],8,q2)]),t.createElementVNode("p",W2,t.toDisplayString(A.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",J2,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:j[2]||(j[2]=J=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(pf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("basics"),title:N.value,onToggle:j[3]||(j[3]=J=>k("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(S2,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(V2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("index"),onToggle:j[4]||(j[4]=J=>k("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(j2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("ops"),onToggle:j[5]||(j[5]=J=>k("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!b.value.identifying,disabled:M.value||!!oe.value,"onUpdate:modelValue":ge},null,8,["label","model-value","disabled"]),M.value?(t.openBlock(),t.createElementBlock("p",Z2,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):oe.value?(t.openBlock(),t.createElementBlock("p",Q2,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("fieldset",eV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",tV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.cardinality,items:L,"value-provider":w,"label-provider":R,"onUpdate:modelValue":j[6]||(j[6]=J=>J&&le(J))},null,8,["model-value"])]),oe.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",nV,[j[15]||(j[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.collectionType,items:O,"value-provider":w,"label-provider":w,"onUpdate:modelValue":j[7]||(j[7]=J=>J&&ue(J))},null,8,["model-value"])]),t.createElementVNode("label",oV,[j[16]||(j[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":oe.value.collectionTable,"onUpdate:modelValue":z},null,8,["placeholder","model-value"])]),oe.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",iV,[j[17]||(j[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":oe.value.orderColumn,"onUpdate:modelValue":P},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",aV,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],J=>{var ve,Te,K;return t.withDirectives(t.createElementVNode("div",{key:J,class:"em-end"},[t.createElementVNode("h4",rV,t.toDisplayString(J)+" → "+t.toDisplayString($(b.value[J].entityRef)),1),oe.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",lV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":b.value[J].multiplicity,items:T,"value-provider":w,"label-provider":t.unref(Hi),"onUpdate:modelValue":te=>D(J,{multiplicity:te})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-navigable`,class:"em-check",label:"navigable",title:U(J)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:U(J)==="end2","model-value":U(J)==="end2"?!0:b.value[U(J)].navigable,"onUpdate:modelValue":te=>D(U(J),{navigable:te})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",sV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(ee.BSTextInput),{name:`${U(J)}-navname`,width:"100%",disabled:!ye(U(J)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":pe(U(J)),"onUpdate:modelValue":te=>ie(U(J),te)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-composition`,class:"em-check",label:"composition","model-value":b.value[U(J)].composition,"onUpdate:modelValue":te=>D(U(J),{composition:te})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",cV,[j[18]||(j[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(B,te=>{var G,ae;return t.createVNode(t.unref(ee.BSCheckbox),{key:te,name:`${U(J)}-cascade-${te}`,class:"em-check",label:te,"model-value":!!((ae=(G=b.value[U(J)].jpa)==null?void 0:G.cascadeTypes)!=null&&ae.includes(te)),disabled:!ye(U(J))||te!=="ALL"&&me(U(J)),"onUpdate:modelValue":Be=>se(U(J),te,Be)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ye(U(J))?me(U(J))?(t.openBlock(),t.createElementBlock("p",uV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",dV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",mV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",fV,[j[19]||(j[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(ee.BSSelect),{disabled:!ye(U(J)),"model-value":Se(U(J)),items:y,"value-provider":w,"label-provider":v,"onUpdate:modelValue":te=>te&&ce(U(J),te)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((ve=b.value[U(J)].jpa)!=null&&ve.orphanRemoval),disabled:!ye(U(J))||fe(J),"onUpdate:modelValue":te=>ke(U(J),{orphanRemoval:te})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),fe(J)&&((Te=b.value[U(J)].jpa)!=null&&Te.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",pV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",hV,[j[20]||(j[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:`${U(J)}-orderby`,width:"100%",disabled:!ye(U(J)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((K=b.value[U(J)].jpa)==null?void 0:K.orderBy)??"","onUpdate:modelValue":te=>ke(U(J),{orderBy:te.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!oe.value||J===oe.value.which]])}),64))],64)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",yV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,J=>{var ve;return t.openBlock(),t.createElementBlock("label",{key:J,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(J),1),t.createVNode(t.unref(ee.BSTextInput),{name:`grp-name-${J}`,width:"100%","model-value":((ve=_.value.name)==null?void 0:ve[J])??"","onUpdate:modelValue":Te=>Q(J,Te)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",gV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:j[8]||(j[8]=J=>F({description:J.target.value}))},null,40,bV)]),t.createElementVNode("label",_V,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":j[9]||(j[9]=J=>F({packageName:J}))},null,8,["model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":j[10]||(j[10]=J=>F({excludeDDLGeneration:J}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",kV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",EV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":X.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:j[11]||(j[11]=J=>_e(null))},"∅",10,NV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":X.value===J}]),style:t.normalizeStyle({background:t.unref(To)(J)}),title:t.unref(l).t(t.unref(eo)(J)),onClick:ve=>_e(J)},null,14,wV))),128))])]),t.createElementVNode("p",IV,t.toDisplayString(t.unref(l).t("em.group.members",{n:_.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",vV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:E.value.memo,rows:"6",onChange:j[12]||(j[12]=J=>he(J.target.value))},null,40,xV)]),t.createElementVNode("fieldset",CV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",SV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":we.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:j[13]||(j[13]=J=>Ie(null))},"∅",10,RV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":we.value===J}]),style:t.normalizeStyle({background:t.unref(To)(J)}),title:t.unref(l).t(t.unref(eo)(J)),onClick:ve=>Ie(J)},null,14,AV))),128))])])],64)):t.createCommentVNode("",!0)],8,X2)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),$V=["title"],TV={class:"em-validation__title"},MV=["title","onClick"],VV={key:0,class:"em-validation__body"},BV={class:"em-validation__opt"},DV={key:0,class:"em-validation__empty"},OV={key:1,class:"em-validation__empty"},LV={key:2,class:"em-validation__list"},PV=["onClick"],zV={class:"em-validation__item-msg"},FV={key:0,class:"em-validation__item-entity"},UV=["title","onClick"],HV=["title"],jV=Ke(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const g=new Map;for(const k of o.state.logical.entities)g.set(k.modelId,k.name);return g});function r(g){const k=Cw(g);if(!k)return null;const N=a.value.get(k);return N===void 0?null:N.trim()===""?o.t("em.validation.nameless"):N}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const g={error:0,warning:0,info:0};for(const k of i.value)g[k.severity]++;return g}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,k)=>l[g.severity].order-l[k.severity].order)),u=t.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:ff(o.t,g),category:vw(o.t,g.ruleId)}))),m=t.ref(!1);function p(g){c.value[g]=!c.value[g]}function f(g){if(!m.value){m.value=!0;return}p(g)}function h(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,k)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:k[1]||(k[1]=N=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Ae,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",TV,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,$V),t.createElementVNode("div",{class:"em-validation__counts",onClick:k[0]||(k[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],N=>t.createElementVNode("button",{key:N,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${N}`,{"is-off":!c.value[N]}]]),title:m.value?t.unref(o).t(c.value[N]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[N].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:b=>f(N)},[t.createVNode(Ae,{name:l[N].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[N]),1)],10,MV)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",VV,[t.createElementVNode("label",BV,[t.createVNode(t.unref(ee.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":k[2]||(k[2]=N=>t.unref(o).flagEntitiesWithoutRelations.value=N)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",DV,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",OV,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",LV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:N,entityName:b,message:_,category:E},I)=>(t.openBlock(),t.createElementBlock("li",{key:`${N.ruleId}:${N.targetRef??"model"}:${I}`,class:t.normalizeClass(["em-validation__item",[`is-${N.severity}`,{"is-clickable":!!N.targetRef}]]),onClick:A=>h(N)},[t.createVNode(Ae,{name:l[N.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",zV,[b?(t.openBlock(),t.createElementBlock("span",FV,t.toDisplayString(b),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(_),1)]),t.unref(o).hasQuickFix(N)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers(A=>t.unref(o).applyQuickFix(N),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,UV)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:N.ruleId},t.toDisplayString(E),9,HV)],10,PV))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),KV={class:"em-history"},GV={class:"em-history__head"},YV={class:"em-history__title"},qV={class:"em-history__head-actions"},WV=["title","disabled"],JV=["title"],XV={class:"em-history__filters"},ZV={class:"em-history__filter"},QV={class:"em-history__filters em-history__filters--period"},eB={class:"em-history__filter-label"},tB=["title","aria-label","max"],nB=["title","aria-label","min"],oB=["title"],iB={key:0,class:"em-history__diffbar"},aB={class:"em-history__diffbar-range"},rB={class:"em-history__diffbar-count"},lB={class:"em-history__body"},sB={key:0,class:"em-history__empty"},cB={key:1,class:"em-history__diff-list"},dB=["onClick"],uB={class:"em-history__action-head"},mB={class:"em-history__action-name"},fB={key:0,class:"em-history__fields"},pB={class:"em-history__fname"},hB={key:0,class:"em-history__old"},yB={class:"em-history__val"},gB={key:1,class:"em-history__empty"},bB={key:2,class:"em-history__empty is-error"},_B={key:3,class:"em-history__empty"},kB={key:4,class:"em-history__list"},EB=["onClick"],NB={class:"em-history__summary"},wB={class:"em-history__seq"},IB={class:"em-history__gmeta"},vB={class:"em-history__who"},xB={key:0,class:"em-history__time"},CB={key:1,class:"em-history__restored-from"},SB=["onClick"],RB={key:0,class:"em-history__detail"},AB={class:"em-history__action-head"},$B={class:"em-history__action-name"},TB={key:0,class:"em-history__fields"},MB={class:"em-history__fname"},VB={key:0,class:"em-history__old"},BB={class:"em-history__val"},DB={class:"em-history__preview"},OB=["disabled"],LB={key:0,class:"em-history__diff-list is-preview"},PB={class:"em-history__action-head"},zB={class:"em-history__action-name"},FB={key:0,class:"em-history__fields"},UB={class:"em-history__fname"},HB={key:0,class:"em-history__old"},jB={class:"em-history__val"},KB={class:"em-history__confirm-row"},GB={class:"em-history__confirm-msg"},YB=["disabled","onClick"],qB=["disabled"],WB=["onClick"],_r=50,JB=Ke(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((G,ae)=>ae.seq>G?ae.seq:G,-1/0));async function u(G){if(a.historyTransport){l.value=!0,s.value=null;try{const ae=!(G!=null&&G.full)&&r.value.length>0&&Number.isFinite(d.value),Be=await a.historyTransport(ae?d.value:void 0);if(!ae)r.value=Be;else if(Be.length){const Ve=new Set(r.value.map(V=>V.seq)),H=Be.filter(V=>!Ve.has(V.seq));H.length&&(r.value=[...r.value,...H])}c.value=!0}catch(ae){s.value=ae instanceof Error?ae.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const p=t.ref(null),f=t.ref(null);t.watch(()=>o.open,G=>{G?m():(p.value=null,f.value=null)},{immediate:!0});let h=null;t.watch(()=>a.revision.value,()=>{o.open&&(h&&clearTimeout(h),h=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const g=t.computed(()=>new Map(a.state.logical.entities.map(G=>[G.modelId,G]))),k=t.computed(()=>new Map(a.state.logical.associations.map(G=>[G.modelId,G]))),N=t.computed(()=>{const G=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(ae=>{var Be,Ve;return[ae.modelId,ae.packageName||((Be=ae.name)==null?void 0:Be[G])||((Ve=ae.name)==null?void 0:Ve.ko)||ae.modelId]}))});function b(G){var H,V,Pe,Ze,Ue,Le,De;const ae=k.value.get(G);if(!ae)return a.t("em.history.assocFallback");if((H=ae.description)!=null&&H.trim())return ae.description.trim();const Be=(Ze=(Pe=g.value.get((V=ae.end1)==null?void 0:V.entityRef))==null?void 0:Pe.name)==null?void 0:Ze.trim(),Ve=(De=(Le=g.value.get((Ue=ae.end2)==null?void 0:Ue.entityRef))==null?void 0:Le.name)==null?void 0:De.trim();return Be&&Ve?`${Be}→${Ve}`:a.t("em.history.assocFallback")}function _(G){var ae,Be,Ve,H;if(G.kind==="entity")return((Be=(ae=g.value.get(G.ref))==null?void 0:ae.name)==null?void 0:Be.trim())||a.t("em.attr.nameless");if(G.kind==="attribute"||G.kind==="operation"||G.kind==="index"){const V=G.entityRef?g.value.get(G.entityRef):void 0,Ze=((G.kind==="attribute"?V==null?void 0:V.attributes:G.kind==="operation"?V==null?void 0:V.operations:V==null?void 0:V.indexes)??[]).find(Le=>Le.modelId===G.ref),Ue=(Ve=V==null?void 0:V.name)==null?void 0:Ve.trim();return`${Ue?Ue+".":""}${((H=Ze==null?void 0:Ze.name)==null?void 0:H.trim())||G.ref}`}return G.kind==="association"?b(G.ref):G.kind==="associationEnd"?`${b(G.ref)}(${G.end})`:G.kind==="group"?a.t("em.history.groupSubject",{name:N.value.get(G.ref)??G.ref}):G.ref}const E={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},I={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},A=t.ref("all"),T=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],L=t.computed({get:()=>A.value,set:G=>{G&&(A.value=G)}}),x=t.computed(()=>Qr(r.value)),R=t.computed(()=>x.value.length?x.value[0].seq:null),$=t.computed(()=>A.value==="all"?x.value:x.value.filter(G=>(G.kind??"edit")===A.value)),B=t.ref(_r),O=t.ref(""),y=t.ref(""),w=t.computed(()=>!!O.value||!!y.value);function v(){O.value="",y.value=""}const M=t.computed(()=>{const G=O.value?new Date(`${O.value}T00:00:00`).getTime():null,ae=y.value?new Date(`${y.value}T23:59:59.999`).getTime():null;return G==null&&ae==null?$.value:$.value.filter(Be=>{if(Be.ts==null)return!1;const Ve=new Date(Be.ts).getTime();return!(isNaN(Ve)||G!=null&&Ve<G||ae!=null&&Ve>ae)})}),D=t.computed(()=>M.value.slice(0,B.value)),U=t.computed(()=>Math.max(0,M.value.length-B.value));function W(){B.value+=_r}t.watch([A,O,y],()=>{B.value=_r}),t.watch(()=>o.open,G=>{G&&(B.value=_r,v())});function ie(G){return G===void 0?"—":G===null?a.t("em.history.emptyValue"):typeof G=="object"?JSON.stringify(G):String(G)}function pe(G){const ae=_(G.subject);if(G.verb==="add")return a.t("em.history.summaryAdd",{name:ae});if(G.verb==="remove")return a.t("em.history.summaryRemove",{name:ae});if(G.fields.length===1){const Be=G.fields[0];return`${ae}.${Be.field} ${Be.oldValue!==void 0?ie(Be.oldValue)+"→":""}${ie(Be.value)}`}return a.t("em.history.summaryFields",{name:ae,n:G.fields.length})}function ye(G){return G.actions.length===0?a.t("em.history.noChange"):G.actions.length===1?pe(G.actions[0]):a.t("em.history.summaryMore",{summary:pe(G.actions[0]),n:G.actions.length-1})}const ge=t.ref(new Set);function me(G){const ae=new Set(ge.value);ae.has(G)?ae.delete(G):ae.add(G),ge.value=ae}function se(G){if(G==null)return"";const ae=new Date(G);return isNaN(ae.getTime())?String(G):ae.toLocaleString()}function ke(G){const ae=G.author,Be=G.origin;return ae&&Be?`${ae}(${Be})`:ae||(Be?`(${Be})`:"—")}const Se=t.computed(()=>p.value==null?null:el(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Se.value?Kc(Se.value):null,G=>i("diffChange",G));function ce(G){p.value=G,f.value=null,j.value=null}function fe(){p.value=null,f.value=null}const oe=t.computed(()=>x.value.map(G=>G.seq)),le=t.computed(()=>R.value??1/0),ue=t.computed(()=>f.value??le.value),z=t.computed(()=>f.value??le.value),P=t.computed(()=>oe.value.filter(G=>G<ue.value).map(G=>({v:G}))),F=t.computed(()=>oe.value.filter(G=>p.value!=null&&G>p.value).map(G=>({v:G})));function Q(G){G!=null&&(p.value=G,f.value!=null&&f.value<=G&&(f.value=null))}function X(G){G!=null&&(f.value=G>=le.value?null:G)}function _e(G){return G>=le.value?a.t("em.history.diff.current"):`#${G}`}function he(G){return G.kind==="entity"?g.value.has(G.ref)?G.ref:null:(G.kind==="attribute"||G.kind==="operation"||G.kind==="index")&&G.entityRef?g.value.has(G.entityRef)?G.entityRef:null:G.kind==="group"&&N.value.has(G.ref)?G.ref:null}function we(G){const ae=he(G);ae&&a.requestFocus(ae)}const Ie={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},Y={added:"add",modified:"update",removed:"remove"},j=t.ref(null),J=t.ref(!1),ve=t.computed(()=>j.value==null?null:el(r.value,{fromSeq:j.value})),Te=t.ref(!1);function K(G){j.value=G,Te.value=!1}async function te(G){J.value=!0;try{const ae=await a.restoreToSeq(G);ae.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:ae.reason??a.t("em.history.unknown")})}finally{J.value=!1,j.value=null}}return(G,ae)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Be,Ve;return[t.withDirectives(t.createElementVNode("section",KV,[t.createElementVNode("header",GV,[t.createElementVNode("div",YV,[t.createVNode(Ae,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",qV,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:ae[0]||(ae[0]=H=>u({full:!0}))},[t.createVNode(Ae,{name:"redo",size:15})],8,WV),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:ae[1]||(ae[1]=H=>i("close"))},[t.createVNode(Ae,{name:"panel-close",size:15})],8,JV)])]),t.createElementVNode("div",XV,[t.createElementVNode("label",ZV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(ee.BSSelect),{modelValue:L.value,"onUpdate:modelValue":ae[2]||(ae[2]=H=>L.value=H),items:T,"value-provider":H=>H.v,"label-provider":H=>t.unref(a).t(H.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",QV,[t.createElementVNode("span",eB,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:y.value||void 0,"onUpdate:modelValue":ae[3]||(ae[3]=H=>O.value=H)},null,8,tB),[[t.vModelText,O.value]]),ae[9]||(ae[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:O.value||void 0,"onUpdate:modelValue":ae[4]||(ae[4]=H=>y.value=H)},null,8,nB),[[t.vModelText,y.value]]),w.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:v},[t.createVNode(Ae,{name:"x",size:12})],8,oB)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",iB,[t.createElementVNode("div",aB,[t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:P.value,"value-provider":H=>H.v,"label-provider":H=>`#${H.v}`,"onUpdate:modelValue":ae[5]||(ae[5]=H=>Q(H??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ae,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":z.value,items:F.value,"value-provider":H=>H.v,"label-provider":H=>_e(H.v),"onUpdate:modelValue":ae[6]||(ae[6]=H=>X(H??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",rB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Be=Se.value)==null?void 0:Be.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:fe},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",lB,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ve=Se.value)!=null&&Ve.entries.length?(t.openBlock(),t.createElementBlock("ul",cB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value.entries,(H,V)=>(t.openBlock(),t.createElementBlock("li",{key:V,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!he(H.subject)}]),onClick:Pe=>we(H.subject)},[t.createElementVNode("div",uB,[t.createVNode(Ae,{name:E[H.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",mB,t.toDisplayString(_(H.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[H.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[H.verb])),3)]),H.fields.length?(t.openBlock(),t.createElementBlock("ul",fB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.fields,(Pe,Ze)=>(t.openBlock(),t.createElementBlock("li",{key:Ze,class:"em-history__field"},[t.createElementVNode("span",pB,t.toDisplayString(Pe.field),1),Pe.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",hB,t.toDisplayString(ie(Pe.oldValue)),1)):t.createCommentVNode("",!0),Pe.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",yB,t.toDisplayString(ie(Pe.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,dB))),128))])):(t.openBlock(),t.createElementBlock("p",sB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",gB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",bB,t.toDisplayString(s.value),1)):M.value.length===0?(t.openBlock(),t.createElementBlock("p",_B,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",kB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.value,H=>{var V,Pe,Ze;return t.openBlock(),t.createElementBlock("li",{key:H.seq,class:t.normalizeClass(["em-history__group",[`is-${H.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Ue=>me(H.seq)},[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":ge.value.has(H.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${H.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(H.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",NB,t.toDisplayString(ye(H)),1),t.createElementVNode("span",wB,"#"+t.toDisplayString(H.seq),1)],8,EB),t.createElementVNode("div",IB,[t.createElementVNode("span",vB,t.toDisplayString(ke(H)),1),H.ts?(t.openBlock(),t.createElementBlock("span",xB,t.toDisplayString(se(H.ts)),1)):t.createCommentVNode("",!0),H.kind==="restore"&&H.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",CB,"← #"+t.toDisplayString(H.restoredFromSeq),1)):t.createCommentVNode("",!0),H.seq!==R.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Ue=>ce(H.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,SB)):t.createCommentVNode("",!0)]),ge.value.has(H.seq)?(t.openBlock(),t.createElementBlock("div",RB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.actions,(Ue,Le)=>(t.openBlock(),t.createElementBlock("div",{key:Le,class:"em-history__action"},[t.createElementVNode("div",AB,[t.createVNode(Ae,{name:E[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",$B,t.toDisplayString(_(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Ue.verb}`])},t.toDisplayString(t.unref(a).t(I[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",TB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",MB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",VB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",BB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&H.seq!==R.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":j.value===H.seq}])},[j.value===H.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",DB,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((V=ve.value)!=null&&V.entries.length),onClick:ae[7]||(ae[7]=Ue=>Te.value=!Te.value)},[t.createVNode(Ae,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Te.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Pe=ve.value)!=null&&Pe.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:ve.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,OB),Te.value&&((Ze=ve.value)!=null&&Ze.entries.length)?(t.openBlock(),t.createElementBlock("ul",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value.entries,(Ue,Le)=>(t.openBlock(),t.createElementBlock("li",{key:Le,class:"em-history__diff-entry"},[t.createElementVNode("div",PB,[t.createVNode(Ae,{name:E[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",zB,t.toDisplayString(_(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[Ue.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",FB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",UB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",HB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",jB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",KB,[t.createElementVNode("span",GB,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:J.value,onClick:Ue=>te(H.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,YB),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:J.value,onClick:ae[8]||(ae[8]=Ue=>j.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,qB)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Ue=>K(H.seq)},[t.createVNode(Ae,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,WB))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&U.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:W},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:U.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function XB(e,n){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=n?i:null}function hh(e){const n=t.ref(XB(e.storageKey,e.min)??e.initial),o=t.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=n.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),n.value=m},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const ZB={class:"em-modeler"},QB={class:"em-modeler__body"},eD={class:"em-drawer__inner"},tD={class:"em-drawer__head"},nD={class:"em-drawer__actions"},oD=["title"],iD=["title"],aD=["title"],rD=["title"],lD=["title"],sD=Ke(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(E){t.nextTick(()=>{const I=E();I&&("focusCollapse"in I?I.focusCollapse():I.focus())})}function c(E){n.value=E,s(()=>E?i.value:a.value)}function d(E){o.value=E,s(()=>E?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:h}=hh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:g,dragging:k,startResize:N}=hh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),b=t.ref(null),_=t.ref(null);return(E,I)=>{var A,T,L;return t.openBlock(),t.createElementBlock("div",ZB,[t.createVNode(fh,{controller:e.controller,"history-open":u.value,onExportSvg:I[0]||(I[0]=x=>{var R;return(R=b.value)==null?void 0:R.exportSvg()}),onExportPng:I[1]||(I[1]=x=>{var R;return(R=b.value)==null?void 0:R.exportPng()}),onToggleHistory:I[2]||(I[2]=x=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",QB,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",eD,[t.createElementVNode("header",tD,[I[11]||(I[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",nD,[(A=_.value)!=null&&A.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((T=_.value)!=null&&T.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:I[3]||(I[3]=x=>{var R;return(R=_.value)==null?void 0:R.toggleAll()})},[t.createVNode(Ae,{name:(L=_.value)!=null&&L.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,oD)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:I[4]||(I[4]=x=>c(!1))},[t.createVNode(Ae,{name:"panel-close",size:16})],8,iD)])]),t.createVNode(mh,{ref_key:"explorer",ref:_,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:I[5]||(I[5]=(...x)=>t.unref(h)&&t.unref(h)(...x))},null,42,aD),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:I[6]||(I[6]=x=>c(!0))},[t.createVNode(Ae,{name:"panel-open",size:18})],8,rD),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(p)-6+"px"})},[t.createVNode(uh,{ref_key:"canvas",ref:b,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(ph,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(g),resizing:t.unref(k),"start-resize":t.unref(N),onCollapse:I[7]||(I[7]=x=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:I[8]||(I[8]=x=>d(!0))},[t.createVNode(Ae,{name:"panel-right-open",size:18})],8,lD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(JB,{controller:e.controller,open:u.value,onClose:I[9]||(I[9]=x=>u.value=!1),onDiffChange:I[10]||(I[10]=x=>m.value=x)},null,8,["controller","open"])]),t.createVNode(jV,{controller:e.controller,"panel-width":t.unref(g),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=Vb,be.AssociationEdge=dp,be.CUSTOM_TYPE_VALUE=tn,be.CommandStack=tl,be.DEFAULT_JAVA_TYPE=Rr,be.DIAGRAM_JSON_FORMAT=Vr,be.DIAGRAM_JSON_VERSION=Br,be.DiagramCanvas=uh,be.DiagramExplorer=mh,be.EDITOR=no,be.EditModeToggle=UM,be.EditorToolbar=fh,be.EntityModeler=sD,be.EntityNode=Ff,be.GROUP_CODE_ENUM_VALUE=Dn,be.GroupNode=Uf,be.INHERITED_REF_PREFIX=Di,be.InvalidDiagramJsonError=Ln,be.JAVA_TYPES=qo,be.NoteNode=Hf,be.OpSyncAdapter=Dd,be.PHYSICAL_NAME_MAX_LENGTH=Jo,be.PropertyPanel=ph,be.RevCache=Bd,be.SELECTABLE_JAVA_TYPES=Qs,be.SYMBOLIC_OP_KINDS=Od,be.SYMBOLIC_OP_SCHEMA=tu,be.UI_LOCALES=tI,be.buildAgentBatch=Bb,be.buildDiagramSvg=vs,be.buildDiffMarks=Kc,be.collectSharedColumns=kn,be.commands=Fg,be.computeAutoLayout=Rs,be.createEditorController=$x,be.dedupeModelIds=hg,be.defaultMermaidDialect=Dh,be.defaultSqlDialect=py,be.diagramToJson=cc,be.displayLabel=Pi,be.emptyState=Rf,be.entityModelToDdl=lc,be.entityModelToMermaid=Ir,be.entityModelToText=Fs,be.exportDiagramPng=ch,be.exportDiagramSvg=sh,be.fromPersisted=uu,be.isGeneratable=Ic,be.isInheritedColumnRef=Mn,be.javaTypeLabel=mo,be.makeInheritedColumnRef=Ts,be.mergeDiagram=Pc,be.mermaidErToImportSource=nc,be.migrateLegacyMoney=pg,be.multiplicityLabel=Hi,be.newId=Me,be.packEntityBoxes=kr,be.parseDiagramJson=dc,be.parseInheritedColumnRef=Er,be.parseMermaidEr=tc,be.parseSqlDdl=Tr,be.planHealBackfillOps=h_,be.projectActionLog=Qr,be.projectEntityAudit=Hc,be.projectFieldAudit=En,be.projectInheritedColumns=jo,be.projectSeqDiff=el,be.renderDiagramSvg=mc,be.resolveColumnPhysicalName=Go,be.resolveDiagram=Ss,be.resolveEffectiveColumn=Vn,be.resolveQuickFix=Fr,be.resolveSharedColumn=Bn,be.resolveSymbolicOps=hb,be.restoreDeepEqual=Pn,be.scaffoldEntityJava=Fy,be.sharedColumnScopeEntities=Nr,be.sqlDdlToImportSource=rc,be.stereotypeLabel=Ko,be.synthesizeRestoreOps=Cg,be.toPersisted=m_,be.toPersistedV2=f_,be.translate=Dt,be.uiMessagesEn=gf,be.uiMessagesJa=bf,be.uiMessagesKo=_f,be.validateModel=Xi,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|
|
65
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(D=>{if(g.value){const U=Rn(g.value),W=ye=>{if(ye.sourceEvent.type!=="wheel"||!p.value||!f.value)return;const ge=ye.sourceEvent.ctrlKey&&ki()?10:1,me=-ye.sourceEvent.deltaY*(ye.sourceEvent.deltaMode===1?.05:ye.sourceEvent.deltaMode?1:.002)*e.zoomStep,se=c.value.zoom*2**(me*ge);f.value.scaleTo(p.value,se)},ie=ye=>{if(ye.sourceEvent.type!=="mousemove"||!p.value||!f.value)return;const ge=x.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),me={x:c.value.x-ye.sourceEvent.movementX*ge,y:c.value.y-ye.sourceEvent.movementY*ge},se=[[0,0],[u.value.width,u.value.height]],ke=Ns.translate(me.x,me.y).scale(c.value.zoom),Se=f.value.constrain()(ke,se,d.value);f.value.transform(p.value,Se)},pe=G$().wheelDelta(ye=>Ll(ye)*(e.zoomStep/10)).on("zoom",e.pannable?ie:()=>{}).on("zoom.wheel",e.zoomable?W:()=>{});U.call(pe),D(()=>{U.on("zoom",null)})}},{flush:"post"});function B(D){const[U,W]=An(D);n("click",{event:D,position:{x:U,y:W}})}function O(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeClick(W),n("nodeClick",W)}function y(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeDoubleClick(W),n("nodeDblclick",W)}function w(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseEnter(W),n("nodeMouseenter",W)}function v(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseMove(W),n("nodeMousemove",W)}function M(D,U){const W={event:D,node:U,connectedEdges:Jn([U],s.value)};m.miniMapNodeMouseLeave(W),n("nodeMouseleave",W)}return(D,U)=>(t.openBlock(),t.createBlock(t.unref(df),{position:D.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:D.pannable,zoomable:D.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:g,width:k.value,height:N.value,viewBox:[R.value.x,R.value.y,R.value.width,R.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:B},[D.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(D.ariaLabel),9,X$)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(h),W=>(t.openBlock(),t.createBlock(W$,{id:W.id,key:W.id,f:"",position:W.computedPosition,dimensions:W.dimensions,selected:W.selected,dragging:W.dragging,style:t.normalizeStyle(W.style),class:t.normalizeClass(I.value(W)),color:_.value(W),"border-radius":D.nodeBorderRadius,"stroke-color":E.value(W),"stroke-width":D.nodeStrokeWidth,"shape-rendering":t.unref(b),type:W.type,hidden:W.hidden,onClick:ie=>O(ie,W),onDblclick:ie=>y(ie,W),onMouseenter:ie=>w(ie,W),onMousemove:ie=>v(ie,W),onMouseleave:ie=>M(ie,W)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:$.value,fill:D.maskColor,stroke:D.maskStrokeColor,"stroke-width":D.maskStrokeWidth,"fill-rule":"evenodd"},null,8,Z$)],8,J$))]),_:1},8,["position","class"]))}}),tT=["d"],nT=["cx","cy","onDblclick"],oT=["x","y","onPointerdown","onDblclick"],iT=Ke(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(os),a=t.inject(no,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Vo,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((L,x)=>x===d.value?u.value:L)),{source:p,target:f,sourceSide:h,targetSide:g}=cp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),k=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Kf(p.value,h.value,m.value,f.value,g.value):Yf(p.value,m.value,f.value)),N=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Gf(p.value,h.value,m.value,f.value,g.value):Jf(p.value,m.value,f.value).map((L,x)=>({point:L,segIndex:x})):[]),b=t.computed(()=>r.value?m.value:[]);function _(L,x){d.value=L,u.value={...c.value[L]},x.target.setPointerCapture(x.pointerId),x.stopPropagation()}function E(L){if(d.value<0)return;const x=o({x:L.clientX,y:L.clientY});u.value={x:x.x,y:x.y}}function I(L){var x,R;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(R=(x=L.target).releasePointerCapture)==null||R.call(x,L.pointerId)}function A(L,x){x.stopPropagation(),i==null||i.removePoint(n.id,L)}function T(L,x){if(!i)return;const R=o({x:x.clientX,y:x.clientY});i.insertPoint(n.id,L,{x:R.x,y:R.y})}return(L,x)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:k.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,tT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,(R,$)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${$}`,cx:R.point.x,cy:R.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(B=>T(R.segIndex,B),["stop"])},null,42,nT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,(R,$)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${$}`,x:R.x-5,y:R.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:B=>_($,B),onPointermove:E,onPointerup:I,onDblclick:B=>A($,B)},null,42,oT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),aT=["data-theme"],rT={key:0,class:"em-ctx__sep",role:"separator"},lT=["aria-label"],sT={class:"em-ctx__swatches-label","aria-hidden":"true"},cT={class:"em-ctx__chips",role:"none"},dT=["aria-checked","aria-label","title","onClick"],uT=["aria-checked","aria-label","title","onClick"],mT=["disabled","onClick"],fT={class:"em-ctx__icon"},pT={class:"em-ctx__caption"},hT=Ke(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(_,E)=>Dt(o.locale??"ko",_,E),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(_,E){var T,L;r.value=E,l.value=(T=_.target)!=null&&T.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=_.clientX,c.y=_.clientY,a.value=!0,window.addEventListener("keydown",k),window.addEventListener("resize",p),await t.nextTick();const I=s.value;if(!I)return;const A=I.getBoundingClientRect();c.x+A.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-A.width)),c.y+A.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-A.height)),(L=f()[0])==null||L.focus()}function p(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",k),window.removeEventListener("resize",p);const _=d;d=null,_!=null&&_.isConnected&&_.focus()}function f(){const _=s.value;if(!_)return[];const E=[];for(const I of Array.from(_.children))if(I.classList.contains("em-ctx__item"))I.disabled||E.push(I);else if(I.classList.contains("em-ctx__swatches")){const A=Array.from(I.querySelectorAll(".em-ctx__chip"));A.length&&E.push(A.find(T=>T===document.activeElement)??A[0])}return E}function h(_){var T;const E=f();if(!E.length)return;const I=E.indexOf(document.activeElement),A=I<0?_>0?0:E.length-1:(I+_+E.length)%E.length;(T=E[A])==null||T.focus()}function g(_){var T,L;const E=(T=document.activeElement)==null?void 0:T.closest(".em-ctx__swatches");if(!E)return!1;const I=Array.from(E.querySelectorAll(".em-ctx__chip")),A=I.indexOf(document.activeElement);return A<0?!1:((L=I[(A+_+I.length)%I.length])==null||L.focus(),!0)}function k(_){var E,I;switch(_.key){case"Escape":_.stopPropagation(),p();return;case"ArrowDown":_.preventDefault(),h(1);return;case"ArrowUp":_.preventDefault(),h(-1);return;case"ArrowRight":g(1)&&_.preventDefault();return;case"ArrowLeft":g(-1)&&_.preventDefault();return;case"Home":_.preventDefault(),(E=f()[0])==null||E.focus();return;case"End":{_.preventDefault();const A=f();(I=A[A.length-1])==null||I.focus();return}case"Tab":_.preventDefault(),h(_.shiftKey?-1:1)}}function N(_){_.disabled||(_.handler(),p())}function b(_,E){_.onPick(E),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(_,E)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:p,onContextmenu:t.withModifiers(p,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:E[0]||(E[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(I,A)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:A},[I.type==="separator"?(t.openBlock(),t.createElementBlock("div",rT)):I.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":I.caption},[t.createElementVNode("span",sT,t.toDisplayString(I.caption),1),t.createElementVNode("div",cT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":I.current===null}]),role:"menuitemradio","aria-checked":I.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:T=>b(I,null)},null,10,dT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),T=>(t.openBlock(),t.createElementBlock("button",{key:T,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":I.current===T}]),style:t.normalizeStyle({background:t.unref(To)(T)}),role:"menuitemradio","aria-checked":I.current===T,"aria-label":i(t.unref(eo)(T)),title:i(t.unref(eo)(T)),onClick:L=>b(I,T)},null,14,uT))),128))])],8,lT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":I.danger,"is-disabled":I.disabled}]),disabled:I.disabled,role:"menuitem",onClick:T=>N(I)},[t.createElementVNode("span",fT,[I.icon?(t.openBlock(),t.createBlock(Ae,{key:0,name:I.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",pT,t.toDisplayString(I.caption),1)],10,mT))],64))),128))],36)],8,aT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function oh(e,n){return n?`${e}:${n}`:e}function ih(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(oh(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function yT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=oh(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function ah(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(ih(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=ih(e.storageKey,s)),t.watch(o,s=>yT(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const Is=[".em-entity__grip",".em-entity__add",".em-entity__footer",".em-sel",".em-handle",".em-note-handle",".vue-flow__handle",".em-group__resize",".em-note__resize",".em-edge__waypoint",".em-edge__mid",".em-note-edge__waypoint",".em-note-edge__mid"].join(",");function Po(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function gT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function bT(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const h=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const g=n(h.left,h.top+h.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,p=0;const f=()=>{const h=d.trim();if(h){const g=n(m,(u+p)/2);c.push({...i,x:g.x,y:g.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(r,h),a.setEnd(r,h+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(f(),u=g.top,m=g.left,p=g.bottom,d=s[h]):(d+=s[h],p=Math.max(p,g.bottom))}return f(),c}function br(e,n){const o=[];for(const i of e.querySelectorAll("*"))gT(i)&&(i.closest(Is)||Po(i)&&o.push(...bT(i,n)));return o}function Mi(e){return Math.round(e*100)/100}function _T(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Is)||!Po(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=n(a.left,a.top),l=n(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${Mi(r.x)}" y="${Mi(r.y)}" width="${Mi(l.x-r.x)}" height="${Mi(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function kT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Po(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Mi(parseFloat(o.getAttribute(d)??"0"));s==="line"?n.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?n.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&n.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return n}function rh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Is)||!Po(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:r.borderTopColor,strokeWidth:l})}return i}function Vi(e,n){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=n(o.left,o.top),r=n(o.right,o.bottom),l=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function vs(e,n){e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x+n.w),e.maxY=Math.max(e.maxY,n.y+n.h)}function ET(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,h)=>e.screenToFlowCoordinate({x:f,y:h}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const h=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!h||!Po(h))continue;const g=h.firstElementChild;if(g)if(f.type==="group"){const k=Vi(g,o);vs(s,k),i.push({...k,texts:[]});const N=g.querySelector(".em-group__label");N&&i.push({...Vi(N,o),stroke:"none",texts:[]}),i.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:br(g,o)})}else if(f.type==="note"){const k={...Vi(g,o),texts:br(g,o),lines:rh(g,g,o)};vs(s,k),r.push(k)}else{const k=Vi(g,o);vs(s,k);const N=k.radius??{tl:0,tr:0};a.push({...k,stroke:"none",texts:[]});const b=g.querySelector(".em-entity__header");if(b){const _=Vi(b,o);a.push({x:k.x,y:k.y,w:k.w,h:_.y+_.h-k.y,fill:_.fill,stroke:"none",radius:{tl:N.tl,tr:N.tr,br:0,bl:0},texts:[]})}a.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:br(g,o),lines:rh(g,g,o),icons:_T(g,o)}),a.push({...k,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const h=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!Po(h))continue;const g=h.getAttribute("d");if(!g)continue;const k=getComputedStyle(h),N=k.strokeDasharray,b=kT(f);l.push({d:g,stroke:k.stroke,strokeWidth:parseFloat(k.strokeWidth)||1.5,strokeDasharray:N&&N!=="none"?N:void 0,labels:br(f,o),markers:b.length?b:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function xs(e){return mc(ET(e))}function lh(e,n){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function sh(e,n="diagram.svg"){const o=xs(e);lh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function NT(e){var i,a;const n=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:n>0?n:1,h:o>0?o:1}}async function ch(e,n="diagram.png",o=2){const i=xs(e),{w:a,h:r}=NT(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,p)=>{s.onload=()=>m(),s.onerror=()=>p(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");lh(u,n)}finally{URL.revokeObjectURL(l)}}const wT={class:"em-shortcuts"},IT={class:"em-shortcuts__list"},vT={class:"em-shortcuts__title"},xT={class:"em-shortcuts__keys"},CT={class:"em-shortcuts__kbd"},ST={key:0,class:"em-shortcuts__plus"},RT={class:"em-shortcuts__desc"},AT={class:"em-shortcuts__actions"},dh=Ke(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(s,c)=>Dt(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",wT,[t.createElementVNode("div",IT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,d=>(t.openBlock(),t.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[t.createElementVNode("h4",vT,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",xT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+p},[t.createElementVNode("kbd",CT,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",ST,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",RT,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",AT,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function zo(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function $T(e,n){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(n);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const TT=["aria-label"],MT=["aria-activedescendant","aria-label","placeholder"],VT={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},BT=["aria-label"],DT={class:"em-cmdk__section","aria-hidden":"true"},OT=["id","aria-selected","onMouseenter","onClick"],LT={class:"em-cmdk__label"},PT={key:0,class:"em-cmdk__tag"},zT={key:1,class:"em-cmdk__sub"},FT=["aria-label"],UT={class:"em-cmdk__section","aria-hidden":"true"},HT=["id","aria-selected","aria-disabled","onMouseenter","onClick"],jT={class:"em-cmdk__label"},KT={key:1,class:"em-cmdk__empty"},GT=Ke(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const I=c.value,A=a.state.logical.entities.map(L=>{var x,R,$,B,O,y;return{type:"goto",kind:"entity",id:L.modelId,label:((R=(x=L.table)==null?void 0:x.logicalName)==null?void 0:R[I])||L.name,sub:($=L.table)==null?void 0:$.physicalName,match:zo(L.name,(O=(B=L.table)==null?void 0:B.logicalName)==null?void 0:O[I],(y=L.table)==null?void 0:y.physicalName)??""}}),T=a.state.logical.groups.map(L=>{var x,R,$,B;return{type:"goto",kind:"group",id:L.modelId,label:((x=L.name)==null?void 0:x[I])||((R=L.name)==null?void 0:R.ko)||L.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:zo(($=L.name)==null?void 0:$[I],(B=L.name)==null?void 0:B.ko,L.packageName)??""}});return[...A,...T]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const I=[];a.editable.value&&(I.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),I.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),I.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),I.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),I.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),I.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),I.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),I.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const A of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])I.push({type:"action",id:`dm-${A}`,label:a.t(u[A]),run:()=>a.displayMode.value=A});return I});function p(I,A){return I.label.toLowerCase().includes(A)}const f=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?d.value.filter(A=>A.match.includes(I)):d.value}),h=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?m.value.filter(A=>p(A,I)):m.value}),g=t.computed(()=>[...f.value,...h.value]);t.watch([f,h],()=>{l.value=0});function k(I){return g.value.indexOf(I)}const N=I=>`em-cmdk-opt-${I}`,b=t.computed(()=>g.value[l.value]?N(l.value):void 0);t.watch(l,async()=>{var A;await t.nextTick();const I=b.value;I&&((A=document.getElementById(I))==null||A.scrollIntoView({block:"nearest"}))});function _(I){if(I.type==="goto")a.selection.value={kind:I.kind,id:I.id},a.requestFocus(I.id);else{if(I.disabled)return;I.run()}i("close")}function E(I){if(I.key==="Escape"){i("close"),I.preventDefault();return}if(I.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),I.preventDefault();return}if(I.key==="ArrowUp"){l.value=Math.max(l.value-1,0),I.preventDefault();return}if(I.key==="Enter"){const A=g.value[l.value];A&&_(A),I.preventDefault();return}I.key==="Tab"&&I.preventDefault()}return t.nextTick(()=>{var I;return(I=s.value)==null?void 0:I.focus()}),(I,A)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:A[1]||(A[1]=t.withModifiers(T=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":A[0]||(A[0]=T=>r.value=T),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":b.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:E},null,40,MT),[[t.vModelText,r.value]]),t.createElementVNode("div",VT,[g.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",DT,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,T=>(t.openBlock(),t.createElementBlock("button",{id:N(k(T)),key:T.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":k(T)===l.value}]),role:"option","aria-selected":k(T)===l.value,onMouseenter:L=>l.value=k(T),onClick:L=>_(T)},[t.createElementVNode("span",LT,t.toDisplayString(T.label),1),T.tag?(t.openBlock(),t.createElementBlock("span",PT,t.toDisplayString(T.tag),1)):T.sub?(t.openBlock(),t.createElementBlock("span",zT,t.toDisplayString(T.sub),1)):t.createCommentVNode("",!0)],42,OT))),128))],8,BT)):t.createCommentVNode("",!0),h.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",UT,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,T=>(t.openBlock(),t.createElementBlock("button",{id:N(k(T)),key:T.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":k(T)===l.value,"is-disabled":T.disabled}]),role:"option","aria-selected":k(T)===l.value,"aria-disabled":T.disabled||void 0,onMouseenter:L=>l.value=k(T),onClick:L=>_(T)},[t.createElementVNode("span",jT,t.toDisplayString(T.label),1)],42,HT))),128))],8,FT)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",KT,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,TT)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function YT(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const qT={key:0,class:"em-canvas__empty","aria-hidden":"true"},WT={class:"em-canvas__empty-title"},JT=["innerHTML"],XT=["innerHTML"],ZT=["innerHTML"],QT={key:1,class:"em-canvas__empty-title"},eM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},tM={class:"em-conflict-banner__body"},nM={class:"em-conflict-banner__title"},oM={class:"em-conflict-banner__detail"},iM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Cs="nc:",uh=Ke(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(C){l.value=C,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,C=>{C&&c(C.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const C=YT(i.opConflict.value);return C?{title:i.t(C.titleKey),detail:i.t(C.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(C){p.x=C.clientX,p.y=C.clientY}const h=t.ref(null);t.provide(Xa,h);const g=t.ref(null);t.provide(Af,g);const k=t.ref(null),N=t.computed(()=>{const C=k.value,S=new Set;if(!C)return S;if(C.kind==="entity")S.add(C.id);else if(C.kind==="group"){const q=i.resolved.value.groups.find(re=>re.group.modelId===C.id);for(const re of(q==null?void 0:q.group.memberEntityRefs)??[])S.add(re)}return S}),b=t.computed(()=>{const C=k.value,S=new Set(N.value),q=new Set,re=new Set;if(!C)return{related:S,edges:q,notes:re};if(C.kind==="note"){re.add(C.id);for(const xe of i.resolved.value.noteConnections)xe.noteRef===C.id&&S.add(xe.targetRef);return{related:S,edges:q,notes:re}}const ne=N.value;if(!ne.size)return{related:S,edges:q,notes:re};for(const xe of i.resolved.value.associations){const{end1:de,end2:Ce}=xe.association;(ne.has(de.entityRef)||ne.has(Ce.entityRef))&&(q.add(xe.association.modelId),S.add(de.entityRef),S.add(Ce.entityRef))}for(const xe of i.resolved.value.noteConnections)S.has(xe.targetRef)&&re.add(xe.noteRef);return{related:S,edges:q,notes:re}});t.provide(Vo,{source:k,active:t.computed(()=>k.value!==null),primaryEntityIds:N,relatedEntityIds:t.computed(()=>b.value.related),relatedEdgeIds:t.computed(()=>b.value.edges),relatedNoteIds:t.computed(()=>b.value.notes),hoverGroupId:t.computed(()=>{var C;return((C=k.value)==null?void 0:C.kind)==="group"?k.value.id:null}),setEntityHover:C=>{g.value||m.value||(k.value=C?{kind:"entity",id:C}:null)},setGroupHover:C=>{g.value||m.value||(k.value=C?{kind:"group",id:C}:null)},setNoteHover:C=>{g.value||m.value||(k.value=C?{kind:"note",id:C}:null)}}),t.provide(no,i);const _=Dx(),E=t.computed(()=>_(i.state.logical,i.embeddableCatalog.value));t.provide(Mf,E);const I=ah({expandableKeys:()=>[],defaultCollapsed:Lx,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(Bf,{isCollapsed:I.isCollapsed,toggle:I.toggle}),t.provide($f,{marks:t.toRef(o,"diffMarks")});function A(C,S){return`${Cs}${C}:${S}`}function T(C){if(!C.startsWith(Cs))return null;const[S,q]=C.slice(Cs.length).split(":");return S&&q?{noteRef:S,targetRef:q}:null}t.provide(os,{points:C=>{var q,re;const S=T(C);return S?((q=i.resolved.value.noteConnections.find(ne=>ne.noteRef===S.noteRef&&ne.targetRef===S.targetRef))==null?void 0:q.waypoints)??[]:((re=i.resolved.value.associations.find(ne=>ne.association.modelId===C))==null?void 0:re.waypoints)??[]},movePoint:(C,S,q)=>{const re=T(C);re?i.moveNoteConnectionWaypoint(re.noteRef,re.targetRef,S,q):i.moveWaypoint(C,S,q)},insertPoint:(C,S,q)=>{const re=T(C);re?i.addNoteConnectionWaypoint(re.noteRef,re.targetRef,S,q):i.addWaypoint(C,S,q)},removePoint:(C,S)=>{const q=T(C);q?i.removeNoteConnectionWaypoint(q.noteRef,q.targetRef,S):i.removeWaypoint(C,S)}});const L=je(),{nodes:x,edges:R,findNode:$,findEdge:B,addNodes:O,addEdges:y,removeNodes:w,removeEdges:v,fitView:M,setCenter:D,getViewport:U,screenToFlowCoordinate:W,getSelectedNodes:ie,updateNodeInternals:pe}=L,ye=t.ref(!1);async function ge(C){ye.value=!0,await t.nextTick(),await new Promise(S=>requestAnimationFrame(()=>S(null)));try{return await C()}finally{ye.value=!1}}async function me(){try{await ge(()=>sh(L))}catch(C){console.error("[entity-modeler] SVG export failed",C),c(i.t("em.canvas.exportFailed"))}}async function se(){try{await ge(()=>ch(L))}catch(C){console.error("[entity-modeler] PNG export failed",C),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:me,exportPng:se,fitView:M});const ke=t.computed(()=>i.resolved.value.entities.length===0);function Se(){const C=U(),{width:S,height:q}=L.dimensions.value;return{x:(S/2-C.x)/C.zoom,y:(q/2-C.y)/C.zoom}}function ce(){const C=Se();i.addEntity("NewEntity",{x:C.x,y:C.y})}function fe(){const C=Se();i.addNote("메모",{x:C.x,y:C.y})}function oe(C){for(const S of i.resolved.value.groups){const{location:q,size:re}=S.geo;if(C.x>=q.x&&C.x<=q.x+re.width&&C.y>=q.y&&C.y<=q.y+re.height)return S.group.modelId}return null}function le(C,S){return C.x===S.x&&C.y===S.y}function ue(C,S){return(C==null?void 0:C.width)===(S==null?void 0:S.width)&&(C==null?void 0:C.height)===(S==null?void 0:S.height)}function z(C,S){return C.entity===S.entity&&C.displayMode===S.displayMode&&C.collapsed===S.collapsed&&C.locked===S.locked&&C.groupRef===S.groupRef&&ue(C.size,S.size)&&C.style===S.style&&C.attributeStyles===S.attributeStyles&&C.operationStyles===S.operationStyles}function P(C,S){const q=Object.keys(C);if(q.length!==Object.keys(S).length)return!1;for(const re of q)if(re==="geo"){const ne=C.geo,xe=S.geo;if(!le(ne.location,xe.location)||!ue(ne.size,xe.size))return!1}else if(C[re]!==S[re])return!1;return!0}function F(){const C=i.resolved.value,S=new Map(C.groups.map(de=>[de.group.modelId,de.geo])),q=new Set(C.groups.map(de=>de.group.modelId)),re=new Set([...q,...C.entities.map(de=>de.entity.modelId),...C.notes.map(de=>de.note.modelId)]);for(const de of[...x.value])re.has(de.id)||w([de.id]);for(const de of C.groups){const Ce=de.group.modelId,Fe={width:`${de.geo.size.width}px`,height:`${de.geo.size.height}px`},He={group:de.group,style:de.style,locked:de.locked},rt=de.locked?!1:void 0,ze=$(Ce);if(ze){le(ze.position,de.geo.location)||(ze.position={...de.geo.location});const ot=ze.data;(ot.group!==He.group||ot.style!==He.style||ot.locked!==He.locked)&&(ze.data=He);const tt=ze.style;((tt==null?void 0:tt.width)!==Fe.width||(tt==null?void 0:tt.height)!==Fe.height)&&(ze.style=Fe),ze.draggable!==rt&&(ze.draggable=rt)}else O([{id:Ce,type:"group",position:{...de.geo.location},draggable:rt,style:Fe,data:He}])}for(const de of C.entities){const Ce=de.entity.modelId,Fe=de.groupRef&&q.has(de.groupRef)?de.groupRef:void 0,He={entity:de.entity,displayMode:i.displayMode.value,collapsed:de.collapsed,locked:de.locked,groupRef:Fe,size:de.geo.size,style:de.style,attributeStyles:de.attributeStyles,operationStyles:de.operationStyles},rt=de.locked?!1:void 0,ze=de.locked?!1:void 0,ot=Fe?S.get(Fe):void 0,tt=ot?{x:de.geo.location.x-ot.location.x,y:de.geo.location.y-ot.location.y}:{...de.geo.location},Ge=$(Ce);Ge?(le(Ge.position,tt)||(Ge.position=tt),z(Ge.data,He)||(Ge.data=He),Ge.parentNode!==Fe&&(Ge.parentNode=Fe),Ge.draggable!==rt&&(Ge.draggable=rt),Ge.connectable!==ze&&(Ge.connectable=ze)):O([{id:Ce,type:"entity",position:tt,parentNode:Fe,draggable:rt,connectable:ze,data:He}])}for(const de of C.notes){const Ce=de.note,Fe=Ce.modelId,He=de.groupRef&&q.has(de.groupRef)?de.groupRef:void 0,rt={note:Ce,groupRef:He},ze={width:`${Ce.geo.size.width}px`,height:`${Ce.geo.size.height}px`},ot=He?S.get(He):void 0,tt=ot?{x:Ce.geo.location.x-ot.location.x,y:Ce.geo.location.y-ot.location.y}:{...Ce.geo.location},Ge=$(Fe);if(Ge){le(Ge.position,tt)||(Ge.position=tt);const lo=Ge.data;(lo.groupRef!==He||!P(lo.note,Ce))&&(Ge.data=rt);const bn=Ge.style;((bn==null?void 0:bn.width)!==ze.width||(bn==null?void 0:bn.height)!==ze.height)&&(Ge.style=ze),Ge.parentNode!==He&&(Ge.parentNode=He)}else O([{id:Fe,type:"note",position:tt,parentNode:He,style:ze,data:rt}])}const ne=new Map(C.associations.map(de=>[de.association.modelId,de])),xe=new Set(C.noteConnections.map(de=>A(de.noteRef,de.targetRef)));for(const de of[...R.value])!ne.has(de.id)&&!xe.has(de.id)&&v([de.id]);for(const[de,Ce]of ne){const Fe={id:de,type:"association",source:Ce.association.end1.entityRef,target:Ce.association.end2.entityRef,sourceHandle:Ce.sourceColumnRef?`r:${Ce.sourceColumnRef}`:void 0,targetHandle:Ce.targetColumnRef?`l:${Ce.targetColumnRef}`:void 0,data:{association:Ce.association,sourceColumnRef:Ce.sourceColumnRef,targetColumnRef:Ce.targetColumnRef}},He=B(de);if(He){const rt=He.data;(rt.association!==Fe.data.association||rt.sourceColumnRef!==Fe.data.sourceColumnRef||rt.targetColumnRef!==Fe.data.targetColumnRef)&&(He.data=Fe.data),He.sourceHandle!==Fe.sourceHandle&&(He.sourceHandle=Fe.sourceHandle),He.targetHandle!==Fe.targetHandle&&(He.targetHandle=Fe.targetHandle)}else y([Fe])}for(const de of C.noteConnections){const Ce=A(de.noteRef,de.targetRef),Fe={noteRef:de.noteRef,targetRef:de.targetRef};B(Ce)||y([{id:Ce,type:"note-connection",source:de.noteRef,target:de.targetRef,data:Fe}])}}const Q=new Set;let X=!1,_e=!1;const he=new Map;function we(C){const S=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(C)}"]`);if(!S)return null;let q=`${S.offsetHeight}`;for(const re of S.querySelectorAll(".em-entity__row"))q+=`|${re.dataset.attr}:${re.offsetTop}`;return q}function Ie(){_e=!1;const C=X;X=!1;const S=[...Q];if(Q.clear(),C){pe();for(const re of x.value){const ne=we(re.id);ne!==null&&he.set(re.id,ne)}return}const q=[];for(const re of S){const ne=we(re);if(ne===null){he.delete(re);continue}he.get(re)!==ne&&(he.set(re,ne),q.push(re))}q.length&&pe(q)}function Y(C){if(C)for(const S of C)Q.add(S);else X=!0;_e||(_e=!0,t.nextTick(()=>requestAnimationFrame(Ie)))}t.provide(Tf,{mark:C=>Y([C])});function j(){const C=ie.value.map(q=>q.id);if(C.length)return C;const S=i.selection.value;return S&&(S.kind==="entity"||S.kind==="note"||S.kind==="group")?[S.id]:[]}function J(){return ie.value.filter(C=>C.type==="entity").map(C=>C.id)}function ve(){return ie.value.filter(C=>C.type==="group").map(C=>C.id)}function Te(C){var S;return[...((S=i.state.logical.groups.find(q=>q.modelId===C))==null?void 0:S.memberEntityRefs)??[]]}function K(){const C=ve().flatMap(Te);return[...new Set([...J(),...C])]}function te(){return ve().length>0||J().length>1}function G(){te()?i.copy(K()):i.copy()}async function ae(C){if(!C.length)return;await t.nextTick();const S=ie.value;S.length&&L.removeSelectedNodes(S);const q=C.map(re=>$(re)).filter(re=>!!re);q.length&&L.addSelectedNodes(q)}function Be(C){if(te()&&J().includes(C)){const S=K();return{caption:i.t("em.ctx.copyN",{n:S.length}),icon:"copy",handler:()=>i.copy(S)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:C},i.copy()}}}function Ve(C){var ne;const S=C.target;if(S&&(S.tagName==="INPUT"||S.tagName==="TEXTAREA"||S.isContentEditable))return;if(C.key==="?"){a.openModal({component:dh,bind:{locale:i.uiLocale.value}}),C.preventDefault();return}if((C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="k"){r.value=!0,C.preventDefault();return}if(!i.editable.value){(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="c"&&(G(),C.preventDefault());return}if(C.key==="Delete"||C.key==="Backspace"){i.deleteSelection()&&C.preventDefault();return}if(C.key==="ArrowUp"||C.key==="ArrowDown"||C.key==="ArrowLeft"||C.key==="ArrowRight"){if(((ne=i.selection.value)==null?void 0:ne.kind)==="attribute"){if(C.key==="ArrowUp"||C.key==="ArrowDown"){const Fe=C.key==="ArrowDown"?1:-1;(C.altKey?i.nudgeSelectedAttributes(Fe):i.moveAttributeFocus(Fe))&&C.preventDefault()}return}const xe=C.shiftKey?10:1,de=C.key==="ArrowLeft"?-xe:C.key==="ArrowRight"?xe:0,Ce=C.key==="ArrowUp"?-xe:C.key==="ArrowDown"?xe:0;i.nudgeNodes(j(),de,Ce)&&C.preventDefault();return}if(!(C.metaKey||C.ctrlKey))return;const re=C.key.toLowerCase();re==="c"?(G(),C.preventDefault()):re==="v"?(ae(i.paste()),C.preventDefault()):re==="z"&&(C.shiftKey?i.redo():i.undo(),C.preventDefault())}t.onMounted(async()=>{F(),await t.nextTick(),M(),Y(),window.addEventListener("keydown",Ve),window.addEventListener("pointerup",H),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ve),window.removeEventListener("pointerup",H),window.removeEventListener("pointermove",f)});function H(){h.value=null}function V(){m.value=!0,k.value=null}function Pe(){var re;m.value=!1;const C=(re=document.elementFromPoint(p.x,p.y))==null?void 0:re.closest(".vue-flow__node"),S=C==null?void 0:C.dataset.id;if(!S){k.value=null;return}const q=C.classList.contains("vue-flow__node-group")?"group":C.classList.contains("vue-flow__node-note")?"note":"entity";k.value={kind:q,id:S}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],F),t.watch(()=>i.resolved.value,C=>{const S=k.value;if(!S)return;(S.kind==="entity"?C.entities.some(re=>re.entity.modelId===S.id):S.kind==="group"?C.groups.some(re=>re.group.modelId===S.id):C.notes.some(re=>re.note.modelId===S.id))||(k.value=null)});function Ze(C){const S=C.computedPosition??C.position,q=C.dimensions??{width:0,height:0};return{x:S.x+q.width/2,y:S.y+q.height/2}}function Ue(C){const S=C.node;if(S){if(k.value=null,S.type==="group"){const q=i.resolved.value.groups.find(re=>re.group.modelId===S.id);g.value=q?{groupId:S.id,dx:S.position.x-q.geo.location.x,dy:S.position.y-q.geo.location.y}:null,h.value=null;return}if(S.type!=="entity"&&S.type!=="note"){h.value=null;return}h.value=oe(Ze(S))}}function Le(C){var re;h.value=null,g.value=null;const S=(re=C.nodes)!=null&&re.length?C.nodes:[C.node],q=S.filter(ne=>(ne==null?void 0:ne.type)==="group");if(q.length){for(const ne of q){if(!ne)continue;const xe=i.resolved.value.entities.filter(de=>de.groupRef===ne.id).map(de=>{const Ce=$(de.entity.modelId),Fe=(Ce==null?void 0:Ce.computedPosition)??(Ce==null?void 0:Ce.position)??{x:0,y:0};return{id:de.entity.modelId,location:{x:Fe.x,y:Fe.y}}});i.dragGroup(ne.id,{x:ne.position.x,y:ne.position.y},xe)}return}for(const ne of S){if(!ne||ne.type==="group")continue;const xe=ne.computedPosition??ne.position,de=ne.dimensions??{width:0,height:0},Ce={x:xe.x+de.width/2,y:xe.y+de.height/2};ne.type==="note"?i.dropNote(ne.id,{x:xe.x,y:xe.y},oe(Ce)):i.dropEntity(ne.id,{x:xe.x,y:xe.y},oe(Ce))}}function De(C){var Fe,He,rt,ze,ot;if(!i.editable.value||!C.source||!C.target)return;const S=((Fe=$(C.source))==null?void 0:Fe.type)==="note",q=((He=$(C.target))==null?void 0:He.type)==="note";if(S||q){if(S&&q)return;const tt=S?C.source:C.target,Ge=S?C.target:C.source;((rt=$(Ge))==null?void 0:rt.type)==="entity"&&i.addNoteConnection(tt,Ge);return}const re=tt=>{var Ge;return(Ge=i.state.logical.entities.find(lo=>lo.modelId===tt))==null?void 0:Ge.stereotype},ne=re(C.source)==="JPA_EMBEDDABLE",xe=re(C.target)==="JPA_EMBEDDABLE";if(ne||xe){if(ne&&xe)return;const tt=ne?C.source:C.target,Ge=ne?C.target:C.source;i.addEmbedAssociation(Ge,tt);return}const de=(ze=C.sourceHandle)!=null&&ze.startsWith("r:")?C.sourceHandle.slice(2):void 0,Ce=(ot=C.targetHandle)!=null&&ot.startsWith("l:")?C.targetHandle.slice(2):void 0;i.addAssociation(C.source,C.target,de,Ce)}const Z=t.ref(null);function dt(C,S){var re;const q=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=q==null?void 0:q.attributeStyles)==null?void 0:re[S])}function yn(C,S){var re;const q=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=q==null?void 0:q.operationStyles)==null?void 0:re[S])}function Et(C){var S;return _t((S=i.state.layout.groupLayouts.find(q=>q.groupRef===C))==null?void 0:S.style)}function gn(C){var S;return _t((S=i.state.layout.notes.find(q=>q.modelId===C))==null?void 0:S.style)}function Ee(C){var ne,xe;if(C.preventDefault(),!i.editable.value)return;const S=()=>W({x:C.clientX,y:C.clientY}),q=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const de=S();i.addEntity("NewEntity",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const de=S();i.addNote("메모",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const de=S();i.addEmptyGroup({x:de.x,y:de.y})}}],re=(ne=i.clipboard.value)==null?void 0:ne.kind;(re==="entity"||re==="entities")&&q.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>ae(i.paste())}),i.resolved.value.entities.length>0&&q.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(xe=Z.value)==null||xe.open(C,q)}function at({event:C,node:S}){var Fe,He,rt,ze,ot,tt,Ge,lo,bn,yh,gh,bh,_h,kh,Eh,Nh,wh,Ih,vh;const q=C;if(q.preventDefault(),!i.editable.value){if(S.type==="group"||S.type==="note")return;const Ye=(He=(Fe=q.target)==null?void 0:Fe.closest("[data-attr]"))==null?void 0:He.dataset.attr;if(Ye){const lt=i.selection.value;(lt==null?void 0:lt.kind)==="attribute"&<.entityId===S.id&<.ids.includes(Ye)||i.selectAttribute(S.id,Ye);const _n=((rt=i.selection.value)==null?void 0:rt.kind)==="attribute"&&i.selection.value.entityId===S.id?[...i.selection.value.ids]:[Ye];(ze=Z.value)==null||ze.open(q,[{caption:_n.length>1?i.t("em.ctx.copyN",{n:_n.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(ot=Z.value)==null||ot.open(q,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>qa(a,i,S.id)},Be(S.id)]);return}if(S.type==="group"){const Ye=i.isGroupLocked(S.id),lt=[];Ye||lt.push({type:"swatches",caption:i.t("em.common.color"),current:Et(S.id),onPick:_n=>i.setGroupSwatch(S.id,_n)},{type:"separator"});const ht=te()&&ve().includes(S.id)?K():Te(S.id);ht.length&<.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(ht)}),lt.push({caption:Ye?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Ye?"unlock":"lock",handler:()=>i.setGroupLocked(S.id,!Ye)}),Ye||lt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(S.id)}),(tt=Z.value)==null||tt.open(q,lt);return}if(S.type==="note"){(Ge=Z.value)==null||Ge.open(q,[{type:"swatches",caption:i.t("em.common.color"),current:gn(S.id),onPick:Ye=>i.setNoteSwatch(S.id,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(S.id)}]);return}const re=(bn=(lo=q.target)==null?void 0:lo.closest("[data-attr]"))==null?void 0:bn.dataset.attr;if(re){const Ye=i.selection.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ye.entityId===S.id&&Ye.ids.includes(re)||i.selectAttribute(S.id,re);const ht=((yh=i.selection.value)==null?void 0:yh.kind)==="attribute"&&i.selection.value.entityId===S.id?[...i.selection.value.ids]:[re];if(i.isEntityLocked(S.id)){(gh=Z.value)==null||gh.open(q,[{caption:ht.length>1?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const _n=ht.length>1,Ss=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(S.id)},{type:"swatches",caption:_n?i.t("em.ctx.colorN",{n:ht.length}):i.t("em.common.color"),current:_n?null:dt(S.id,re),onPick:cD=>i.setAttributeSwatches(S.id,ht,cD)},{type:"separator"},{caption:_n?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Bi=i.clipboard.value;(Bi==null?void 0:Bi.kind)==="attribute"&&Ss.push({caption:Bi.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Bi.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:S.id},i.paste()}}),Ss.push({type:"separator"},{caption:_n?i.t("em.ctx.deleteAttrN",{n:ht.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(S.id,ht)}),(bh=Z.value)==null||bh.open(q,Ss);return}const ne=(kh=(_h=q.target)==null?void 0:_h.closest("[data-op]"))==null?void 0:kh.dataset.op;if(ne){if(i.isEntityLocked(S.id))return;(Eh=Z.value)==null||Eh.open(q,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(S.id)},{type:"swatches",caption:i.t("em.common.color"),current:yn(S.id,ne),onPick:Ye=>i.setOperationSwatch(S.id,ne,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(S.id,ne)}]);return}const xe=i.resolved.value.entities.find(Ye=>Ye.entity.modelId===S.id),de=!!(xe!=null&&xe.locked),Ce=[{caption:de?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>qa(a,i,S.id)}];if(!de){Ce.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(S.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(S.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const lt=ie.value.filter(ht=>ht.type==="entity").map(ht=>ht.id);i.createGroup(lt.includes(S.id)&<.length?lt:[S.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(S.id,S.id)});const Ye=i.embeddableCatalog.value;if(Ye.length){Ce.push({type:"separator"});for(const lt of Ye){const ht=((Nh=lt.label)==null?void 0:Nh[i.userLanguage.value])??((wh=lt.label)==null?void 0:wh.ko)??((Ih=lt.label)==null?void 0:Ih.en)??lt.type;Ce.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:ht}),icon:"link",handler:()=>i.addPredefinedEmbed(S.id,lt.type)})}}}if(Ce.push({type:"separator"}),Ce.push({caption:xe!=null&&xe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:xe!=null&&xe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(S.id,!(xe!=null&&xe.collapsed))}),xe!=null&&xe.groupRef&&!de&&Ce.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(S.id)}),Ce.push({caption:de?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:de?"unlock":"lock",handler:()=>i.setEntityLocked(S.id,!de)}),Ce.push(Be(S.id)),!de){const Ye=i.clipboard.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ce.push({caption:Ye.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Ye.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:S.id},i.paste()}}),Ce.push({type:"separator"}),Ce.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(S.id)})}(vh=Z.value)==null||vh.open(q,Ce)}function zt({event:C,edge:S}){var xe,de;const q=C;if(q.preventDefault(),!i.editable.value)return;const re=T(S.id);if(re){(xe=Z.value)==null||xe.open(q,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(re.noteRef,re.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(re.noteRef,re.targetRef)}]);return}const ne=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(S.id)}];i.isAssociationLocked(S.id)||ne.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(S.id)}),(de=Z.value)==null||de.open(q,ne)}function ut(C){return C==="group"?"group":C==="note"?"note":"entity"}function Qt({node:C}){if(ie.value.length>1){i.selection.value=null;return}i.selection.value={kind:ut(C.type),id:C.id}}function en({nodes:C}){C.length>1&&(i.selection.value=null)}function Ne({edge:C}){const S=T(C.id);i.selection.value=S?{kind:"note",id:S.noteRef}:{kind:"association",id:C.id}}function et(C){const S=i.selection.value;return!!S&&S.kind!=="attribute"&&S.id===C.id}function Ft(C){var S,q;return et(C)?C.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":C.type==="note"?"var(--em-note-soft)":C.type==="group"?mf(_t((S=C.data)==null?void 0:S.style),!0)??"var(--em-mm-group)":mf(_t((q=C.data)==null?void 0:q.style))??"var(--em-mm-entity)"}function pt(C){return et(C)?"var(--em-selection)":C.type==="note"?"var(--em-note-accent)":C.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function nt(C,S){D(C,S,{zoom:U().zoom,duration:350})}t.watch(()=>i.focusRequest.value,C=>{if(!C)return;const S=$(C.id);if(!S)return;const q=S.computedPosition??S.position,re=S.dimensions??{width:0,height:0};nt(q.x+re.width/2,q.y+re.height/2)});function Fo({position:C}){nt(C.x,C.y)}function Uo({node:C}){i.selection.value={kind:ut(C.type),id:C.id};const S=C.computedPosition??C.position,q=C.dimensions??{width:0,height:0};nt(S.x+q.width/2,S.y+q.height/2)}function Ho({node:C}){M({nodes:[C.id],duration:350,maxZoom:1.2,padding:.6})}return(C,S)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(fw),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ye.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(cn).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:V,onMoveEnd:Pe,onConnect:De,onConnectStart:S[1]||(S[1]=q=>u.value=!0),onConnectEnd:S[2]||(S[2]=q=>u.value=!1),onNodeDrag:Ue,onNodeDragStop:Le,onNodeClick:Qt,onEdgeClick:Ne,onSelectionChange:en,onPaneClick:S[3]||(S[3]=q=>t.unref(i).selection.value=null),onPaneContextMenu:Ee,onNodeContextMenu:at,onEdgeContextMenu:zt},{"node-group":t.withCtx(q=>[t.createVNode(Uf,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"node-entity":t.withCtx(q=>[t.createVNode(Ff,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"node-note":t.withCtx(q=>[t.createVNode(Hf,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"edge-association":t.withCtx(q=>[t.createVNode(dp,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),"edge-note-connection":t.withCtx(q=>[t.createVNode(iT,t.normalizeProps(t.guardReactiveProps(q)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(GC),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(bS),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(oo),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:ce},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(oo),{title:t.unref(i).t("em.ctx.addNote"),onClick:fe},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(oo),{title:t.unref(i).t("em.palette.autoLayout"),onClick:S[0]||(S[0]=q=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(eT),{key:1,pannable:"",width:224,height:160,"node-color":Ft,"node-stroke-color":pt,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:Fo,onNodeClick:Uo,onNodeDblclick:Ho})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ke.value?(t.openBlock(),t.createElementBlock("div",qT,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",WT,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,JT),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,XT),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,ZT)],64)):(t.openBlock(),t.createElementBlock("p",QT,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(GT,{key:1,controller:t.unref(i),onClose:S[4]||(S[4]=q=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",eM,[t.createVNode(Ae,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",tM,[t.createElementVNode("strong",nM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",oM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(hT,{ref_key:"menuRef",ref:Z,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",iM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),aM={class:"em-explorer em-scroll-overlay"},rM={class:"em-explorer__search"},lM=["placeholder","aria-label"],sM=["aria-label","title"],cM={key:0,class:"em-explorer__empty"},dM=["aria-label"],uM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],mM=["onClick"],fM=["title"],pM={class:"em-key-slot"},hM={class:"em-key-slot"},yM={class:"em-explorer__label"},gM={key:2,class:"em-explorer__sr"},mh=Ke(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.computed(()=>{var ke,Se;const O=i.resolved.value,y=i.displayMode.value,w=i.userLanguage.value,v=ce=>{var fe,oe,le;return Pi(y,ce.name,(oe=(fe=ce.table)==null?void 0:fe.logicalName)==null?void 0:oe[w],(le=ce.table)==null?void 0:le.physicalName,i.t("em.node.logicalMissing"))},M=y==="PHYSICAL"||y==="LOGICAL_PHYSICAL",D=ce=>{const fe=ce.attrType.startsWith("RELATION")&&ce.dbAttrs.length>0;return{icon:ce.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:ce.identifier,fk:fe&&M}}},U=ce=>ce.attrType.startsWith("EMBED")&&ce.dbAttrs.length>0,W=y==="PHYSICAL"||y==="LOGICAL_PHYSICAL",ie=ce=>{if(ce.attrType!=="EMBED_PREDEF")return ce.dbAttrs;const fe=i.embeddableCatalog.value.find(oe=>oe.type===ce.type);return fe?ce.dbAttrs.map((oe,le)=>{const ue=fe.fields[le];return ue?{...oe,physicalName:oe.physicalName||ue.physicalName,logicalName:oe.logicalName??ue.logicalName,dataType:oe.dataType||ue.dataType,length:oe.length??ue.length}:oe}):ce.dbAttrs},pe=(ce,fe)=>{var z,P,F,Q,X,_e,he,we,Ie;const oe={entityId:fe,attrId:ce.modelId};if(U(ce)){const Y=Tr(y,ce);return{key:`attr:${ce.modelId}`,label:ce.name+(Y?` : ${Y}`:""),icon:"table",attrRef:oe,focusId:fe,matchText:zo(ce.name,(P=(z=ce.dbAttrs[0])==null?void 0:z.logicalName)==null?void 0:P[w],(F=ce.dbAttrs[0])==null?void 0:F.physicalName),children:W?ie(ce).map(j=>{var J,ve;return{key:`attr:${ce.modelId}:col:${j.modelId}`,label:Pi(y,j.physicalName,(J=j.logicalName)==null?void 0:J[w],j.physicalName,i.t("em.node.logicalMissing"))+(j.dataType?` : ${j.dataType}`:""),icon:"field",attrRef:oe,focusId:fe,matchText:zo(j.physicalName,(ve=j.logicalName)==null?void 0:ve[w]),children:[]}}):[]}}const le=$r(ce,i.state.logical.associations),ue=Tr(y,ce,le);return{key:`attr:${ce.modelId}`,label:Pi(y,ce.name,(X=(Q=ce.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:X[w],(_e=ce.dbAttrs[0])==null?void 0:_e.physicalName,i.t("em.node.logicalMissing"))+(ue?` : ${ue}`:""),...D(ce),attrRef:oe,focusId:fe,matchText:zo(ce.name,(we=(he=ce.dbAttrs[0])==null?void 0:he.logicalName)==null?void 0:we[w],(Ie=ce.dbAttrs[0])==null?void 0:Ie.physicalName),children:[]}},ye=ce=>{var le,ue,z;const fe=ce.entity,oe=[...fe.attributes].sort((P,F)=>P.order-F.order);return{key:`entity:${fe.modelId}`,label:v(fe),icon:"table",selectKind:"entity",selectId:fe.modelId,focusId:fe.modelId,matchText:zo(fe.name,(ue=(le=fe.table)==null?void 0:le.logicalName)==null?void 0:ue[w],(z=fe.table)==null?void 0:z.physicalName),children:oe.map(P=>pe(P,fe.modelId))}},ge=new Map,me=[];for(const ce of O.entities)if(ce.groupRef){const fe=ge.get(ce.groupRef)??[];fe.push(ce),ge.set(ce.groupRef,fe)}else me.push(ce);const se=[];for(const ce of O.groups){const fe=ce.group;se.push({key:`group:${fe.modelId}`,label:((ke=fe.name)==null?void 0:ke[w])||((Se=fe.name)==null?void 0:Se.ko)||fe.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:fe.modelId,children:(ge.get(fe.modelId)??[]).map(ye)})}for(const ce of me)se.push(ye(ce));if(O.associations.length){const ce=new Map(O.entities.map(fe=>[fe.entity.modelId,v(fe.entity)]));se.push({key:"section:associations",label:i.t("em.explorer.associations",{n:O.associations.length}),icon:"arrow-lr",children:O.associations.map(fe=>{const oe=fe.association,le=ce.get(oe.end1.entityRef)??oe.end1.entityRef,ue=ce.get(oe.end2.entityRef)??oe.end2.entityRef;return{key:`assoc:${oe.modelId}`,label:`${le} — ${ue}`,icon:"arrow-lr",selectKind:"association",selectId:oe.modelId,children:[]}})})}return O.notes.length&&se.push({key:"section:notes",label:i.t("em.explorer.notes",{n:O.notes.length}),icon:"note",children:O.notes.map(({note:ce})=>{var fe;return{key:`note:${ce.modelId}`,label:((fe=ce.memo.split(`
|
|
66
|
+
`)[0])==null?void 0:fe.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:ce.modelId,focusId:ce.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:se}});function l(O){return O?O.pk&&O.fk?i.t("em.node.keyPfk"):O.pk?i.t("em.node.keyPk"):O.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const O=[],y=w=>{if(w.children.length){w.key!=="root"&&O.push(w.key);for(const v of w.children)y(v)}};return y(r.value),O}),c=O=>O.startsWith("entity:")||O==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=ah({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),h=t.ref(null),g=t.computed(()=>f.value.trim().length>0),k=t.computed(()=>{const O=[];if(g.value){const w=$T(r.value,f.value.trim().toLowerCase()),v=(M,D,U,W,ie)=>{if(!w.has(M.key))return;O.push({node:M,depth:D,parentKey:U,posinset:W,setsize:ie});const pe=M.children.filter(ye=>w.has(ye.key));pe.forEach((ye,ge)=>v(ye,D+1,M.key,ge+1,pe.length))};return v(r.value,0,null,1,1),O}const y=(w,v,M,D,U)=>{O.push({node:w,depth:v,parentKey:M,posinset:D,setsize:U}),d(w.key)||w.children.forEach((W,ie)=>y(W,v+1,w.key,ie+1,w.children.length))};return y(r.value,0,null,1,1),O}),N=t.ref(null),b=t.ref(null),_=t.computed(()=>{var y;const O=k.value;return b.value&&O.some(w=>w.node.key===b.value)?b.value:((y=O[0])==null?void 0:y.node.key)??null}),E=O=>!g.value&&d(O);async function I(O){var y,w;O&&(b.value=O,await t.nextTick(),(w=(y=N.value)==null?void 0:y.querySelector(`[data-key="${O}"]`))==null||w.focus())}function A(O,y){var M,D,U,W,ie;const w=k.value,v=w.findIndex(pe=>pe.node.key===y.node.key);switch(O.key){case"ArrowDown":O.preventDefault(),I((M=w[v+1])==null?void 0:M.node.key);return;case"ArrowUp":O.preventDefault(),I((D=w[v-1])==null?void 0:D.node.key);return;case"Home":O.preventDefault(),I((U=w[0])==null?void 0:U.node.key);return;case"End":O.preventDefault(),I((W=w[w.length-1])==null?void 0:W.node.key);return;case"ArrowRight":if(O.preventDefault(),!y.node.children.length)return;E(y.node.key)?u(y.node.key):I((ie=w[v+1])==null?void 0:ie.node.key);return;case"ArrowLeft":O.preventDefault(),y.node.children.length&&!E(y.node.key)?u(y.node.key):I(y.parentKey);return;case"Enter":case" ":O.preventDefault(),$(y.node,O);return;case"F2":O.preventDefault(),B(y.node)}}const T=t.computed(()=>g.value&&k.value.length<=1);function L(O){var v;if(O.key!=="/"||O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;const y=O.target,w=y==null?void 0:y.tagName;w==="INPUT"||w==="TEXTAREA"||w==="SELECT"||y!=null&&y.isContentEditable||(O.preventDefault(),(v=h.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",L)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",L)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function x(O){const y=i.selection.value;return O.attrRef?(y==null?void 0:y.kind)==="attribute"&&y.entityId===O.attrRef.entityId&&y.ids.includes(O.attrRef.attrId):!!y&&y.kind!=="attribute"&&!!O.selectId&&O.selectKind===y.kind&&O.selectId===y.id}function R(O){const y=i.selection.value;return O.selectKind==="entity"&&(y==null?void 0:y.kind)==="attribute"&&y.entityId===O.selectId}function $(O,y){if(O.attrRef){const w=y.shiftKey?"range":y.metaKey||y.ctrlKey?"toggle":"replace";i.selectAttribute(O.attrRef.entityId,O.attrRef.attrId,w)}else O.selectKind&&O.selectId&&(i.selection.value={kind:O.selectKind,id:O.selectId});O.focusId&&i.requestFocus(O.focusId)}function B(O){O.selectKind==="entity"&&O.selectId&&qa(a,i,O.selectId)}return(O,y)=>(t.openBlock(),t.createElementBlock("section",aM,[t.createElementVNode("div",rM,[t.createVNode(Ae,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":y[0]||(y[0]=w=>f.value=w),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:y[1]||(y[1]=t.withKeys(w=>f.value="",["esc"]))},null,40,lM),[[t.vModelText,f.value]]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:y[2]||(y[2]=w=>f.value="")},[t.createVNode(Ae,{name:"x",size:13})],8,sM)):t.createCommentVNode("",!0)]),T.value?(t.openBlock(),t.createElementBlock("p",cM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:N,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,w=>(t.openBlock(),t.createElementBlock("div",{key:w.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":x(w.node),"is-focus-parent":R(w.node),"is-selectable":!!w.node.selectKind||!!w.node.attrRef||!!w.node.focusId}]),"data-key":w.node.key,role:"treeitem","aria-level":w.depth+1,"aria-posinset":w.posinset,"aria-setsize":w.setsize,"aria-expanded":w.node.children.length?!E(w.node.key):void 0,"aria-selected":x(w.node),tabindex:w.node.key===_.value?0:-1,style:t.normalizeStyle({paddingLeft:4+w.depth*14+"px"}),onClick:v=>$(w.node,v),onDblclick:v=>B(w.node),onFocus:v=>b.value=w.node.key,onKeydown:v=>A(v,w)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!w.node.children.length,"is-open":!E(w.node.key)}]),onClick:t.withModifiers(v=>w.node.children.length&&t.unref(u)(w.node.key),["stop"])},[w.node.children.length?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,mM),w.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(w.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",pM,[w.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-pk"})):w.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",hM,[w.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,fM)):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",yM,t.toDisplayString(w.node.label),1),l(w.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",gM,t.toDisplayString(l(w.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,uM))),128))],8,dM)]))}}),[["__scopeId","data-v-e5303c65"]]),bM={class:"em-text-export"},_M=["id","aria-selected","tabindex","onClick"],kM=["aria-labelledby"],EM={class:"em-text-export__actions"},NM=Ke(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(m,p)=>Dt(n.locale??"ko",m,p),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var p,f;a.value=m,await t.nextTick(),(f=(p=l.value)==null?void 0:p.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const p=n.formats.length;p&&s((a.value+m+p)%p)}async function d(){try{await navigator.clipboard.writeText(r().content),ee.showNotification(i("em.export.copied"),"info")}catch{ee.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),p=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(p);try{const h=document.createElement("a");h.href=f,h.download=m.filename,document.body.appendChild(h),h.click(),h.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",bM,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,h)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${h}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":h===a.value}]),"aria-selected":h===a.value,"aria-controls":"em-text-export-panel",tabindex:h===a.value?0:-1,onClick:g=>a.value=h,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(g=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(g=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(g=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(g=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,_M))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,kM),t.createElementVNode("div",EM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),wM={class:"em-text-import"},IM=["aria-label"],vM=["aria-checked","tabindex","onClick"],xM=["placeholder"],CM={class:"em-text-import__status"},SM={class:"em-text-import__ok"},RM={key:0,class:"em-text-import__warn"},AM={key:1,class:"em-text-import__err"},$M={key:2,class:"em-text-import__err"},TM={key:3,class:"em-text-import__err"},MM={class:"em-text-import__actions"},VM=Ke(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(g,k)=>Dt(n.locale??"ko",g,k),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(g){var N,b;const k=l[(g+l.length)%l.length];k&&(r.value=k.key,await t.nextTick(),(b=(N=s.value)==null?void 0:N.querySelectorAll('[role="radio"]')[l.indexOf(k)])==null||b.focus())}function d(g){c(l.findIndex(k=>k.key===r.value)+g)}function u(g){return g?g.startsWith("{")?"json":/\berdiagram\b/i.test(g)?"mermaid":/\bcreate\s+table\b/i.test(g)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const g=a.value.trim();if(!g)return{status:"empty"};const k=m.value;if(!k)return{status:"unknown"};try{let N,b=[];return k==="json"?N=dc(g):k==="mermaid"?N=nc(g):(N=rc(g),b=Mr(g).warnings),N.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:N,warnings:b}}catch(N){return{status:"error",message:N instanceof Error?N.message:String(N)}}}),f=t.computed(()=>p.value.status==="ok");function h(){const g=p.value;g.status!=="ok"||!g.source||(n.onImport(g.source),o.close())}return(g,k)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",wM,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,N=>t.createElementVNode("button",{key:N.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":N.key===r.value}]),"aria-checked":N.key===r.value,tabindex:N.key===r.value?0:-1,onClick:b=>r.value=N.key,onKeydown:[k[0]||(k[0]=t.withKeys(t.withModifiers(b=>d(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(b=>d(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(b=>c(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(b=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(N.labelKey)),43,vM)),64))],8,IM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":k[4]||(k[4]=N=>a.value=N),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,xM),[[t.vModelText,a.value]]),t.createElementVNode("div",CM,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",SM,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:p.value.source.logical.entities.length,relations:p.value.source.logical.associations.length})),1),p.value.warnings&&p.value.warnings.length?(t.openBlock(),t.createElementBlock("span",RM," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:p.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):p.value.status==="error"?(t.openBlock(),t.createElementBlock("span",AM,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",$M,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",TM,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",MM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:h},null,8,["caption","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:k[5]||(k[5]=N=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),BM={class:"em-toolbar"},DM=["title"],OM={class:"em-toolbar__mode"},fh=Ke(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=ee.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:h=>i.displayMode.value=h});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const h=i.resolved.value.entities;return h.length>0&&h.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const h=Ir(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:NM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Us(h,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:vr(h,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:vr(h,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:lc(h,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:cc(h,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:VM,bind:{locale:i.uiLocale.value,onImport:h=>{i.importEntities(h,h.logical.entities.map(g=>g.modelId))}}})}function f(){r.openModal({component:dh,bind:{locale:i.uiLocale.value}})}return(h,g)=>(t.openBlock(),t.createElementBlock("div",BM,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,DM)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:g[0]||(g[0]=k=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:g[1]||(g[1]=k=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",OM,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(ee.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=k=>s.value=k),items:l,"value-provider":k=>k.v,"label-provider":k=>t.unref(i).t(k.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=k=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=k=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(Ae,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:p},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=k=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=k=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"camera",size:16})]),_:1},8,["tooltip"]),g[11]||(g[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=k=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),g[8]||(g[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),LM=["title"],PM=["title"],zM=["disabled","aria-pressed"],FM=["disabled","aria-pressed"],UM=Ke(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>Dt(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode(Ae,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,LM)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode(Ae,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,zM),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode(Ae,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,FM)],10,PM))}}),[["__scopeId","data-v-2b5162b7"]]),HM=["disabled"],jM={class:"em-panel__sub"},KM={class:"em-nav"},GM={key:0,class:"em-nav__divider","aria-hidden":"true"},YM={key:1},qM=["onClick","onKeydown"],WM={class:"em-nav__name"},JM=["title"],XM={key:0,class:"em-panel__note"},ZM=["data-attr-block"],QM={class:"em-attr__row"},e2=["title"],t2={key:0,class:"em-attr__row"},n2={key:1,class:"em-attr__navhint"},o2={key:0,class:"em-attr__navhint"},i2={class:"em-attr__row"},a2={class:"em-attr__row"},r2=["title"],l2={class:"em-attr__flags"},s2={class:"em-attr__pii"},c2={class:"em-attr__pii"},d2={key:1,class:"em-attr__pii"},u2={key:2,class:"em-attr__pii em-attr__codetop"},m2={class:"em-multilang"},f2={key:3,class:"em-embed-cols"},p2={class:"em-embed-col__label"},h2={class:"em-attr__row"},y2=["title"],g2=["title"],b2=["title"],_2={class:"em-attr__row"},k2={key:0,class:"em-embed-upd"},E2={key:1,class:"em-attr__navhint"},N2={class:"em-embed-upd"},w2={class:"em-embed-upd"},I2={class:"em-swatch__row em-attr__swatch"},v2=["title","onClick"],x2=["title","onClick"],C2={key:0,class:"em-attr__swatch-hint"},S2=Ke(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:p,setTransient:f,dbLocked:h,fkDerived:g,fkOriginPhysical:k,typeValueOf:N,typeLabelOf:b,setAttrType:_,setAttrCustomType:E,setDb:I,scaleApplicable:A,scaleHint:T,setDbLogical:L,setAttrDescription:x,attrPiiValue:R,setAttrPii:$,predefinedCustomTypeCatalog:B,embeddableCatalog:O,predefinedLabel:y,groupCodeCatalog:w,attrGroupCodes:v,attrCodeItems:M,codeValueOf:D,codeLabelOf:U,setAttrGroupCode:W,setAttrCode:ie,setAttrDefaultValue:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:z,insertableItems:P,insertableLabel:F,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:Y,isShared:j,sharedPhysical:J}=yf(o,()=>n.entityId),ve=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Le=>Le.entityRef===i.value.modelId)??null:null),Te=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes.filter(De=>De.attrType!=="DIVIDER"))??[]}),K=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes)??[]}),te=t.computed(()=>Te.value.filter(Le=>r.value.has(Le.modelId)));function G(Le){return{pk:Le.identifier,fk:Le.attrType.startsWith("RELATION")&&Le.dbAttrs.length>0,required:Le.notNull&&!Le.identifier}}function ae(Le){const De=G(Le),Z=[De.pk&&"PK",De.fk&&"FK",De.required&&"NOT NULL"].filter(Boolean);return Z.length?Z.join(" · "):void 0}function Be(Le,De){i.value&&o.selectAttribute(i.value.modelId,Le.modelId,De.shiftKey?"range":De.metaKey||De.ctrlKey?"toggle":"replace")}function Ve(Le){var De,Z;return _t((Z=(De=ve.value)==null?void 0:De.attributeStyles)==null?void 0:Z[Le.modelId])}function H(Le){return r.value.size>1&&r.value.has(Le.modelId)}function V(Le,De){if(!i.value)return;const Z=H(Le)?o.selectedAttrIds.value:[Le.modelId];o.setAttributeSwatches(i.value.modelId,Z,De)}const Pe=t.ref(void 0);function Ze(Le){if(!Le||!i.value)return;const De=o.addPredefinedEmbed(i.value.modelId,Le);De&&o.selectAttribute(i.value.modelId,De),Pe.value=void 0}function Ue(){if(!i.value)return;const Le=o.addAttribute(i.value.modelId);Le&&o.selectAttribute(i.value.modelId,Le)}return(Le,De)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",jM,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value.length}))+" ",1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ue},null,8,["caption"]),t.unref(O).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":Pe.value,items:t.unref(O),"value-provider":Z=>Z.type,"label-provider":t.unref(y),"onUpdate:modelValue":Ze},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",KM,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(K.value,Z=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[Z.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",GM,[...De[0]||(De[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",YM,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Z.modelId)}]),role:"button",tabindex:"0",onClick:dt=>Be(Z,dt),onKeydown:[t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["space"])]},[t.createElementVNode("span",WM,t.toDisplayString(Z.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:ae(Z)},[G(Z).pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):G(Z).required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),G(Z).fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,JM)],42,qM)]))],64))),128))]),Te.value.length&&!te.value.length?(t.openBlock(),t.createElementBlock("p",XM,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.value,Z=>{var dt,yn,Et,gn,Ee,at,zt,ut,Qt,en;return t.openBlock(),t.createElementBlock("div",{key:Z.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(Z.modelId)}]),"data-attr-block":Z.modelId},[t.createElementVNode("div",QM,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-name-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":Z.name,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{name:Ne})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-type-${Z.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Z.attrType.startsWith("EMBED")||!!Z.groupCode||Z.attrType==="RELATION_REF"||t.unref(g)(Z),items:t.unref(ec)(Z.type,t.unref(B)),"value-provider":t.unref(N),"label-provider":t.unref(b),"model-value":Z.type,"onUpdate:modelValue":Ne=>t.unref(_)(Z,Ne)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(u)(Z)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ne=>t.unref(o).removeAttribute(t.unref(i).modelId,Z.modelId)},null,8,["onClick"])],8,e2)]),Z.type===t.unref(tn)&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("div",t2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-customtype-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Z.customType??"","onUpdate:modelValue":Ne=>t.unref(E)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",n2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ye)(Z)?(t.openBlock(),t.createElementBlock("div",f2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.dbAttrs,(Ne,et)=>{var Ft,pt,nt,Fo,Uo,Ho,C,S;return t.openBlock(),t.createElementBlock("div",{key:Ne.modelId,class:"em-embed-col"},[t.createElementVNode("span",p2,t.toDisplayString(((Ft=t.unref(se)(Z,et))==null?void 0:Ft.name)??((pt=t.unref(se)(Z,et))==null?void 0:pt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:et+1})),1),t.createElementVNode("div",h2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`embed-col-${Ne.modelId}`,width:"100%",disabled:t.unref(j)(Ne),placeholder:((nt=t.unref(se)(Z,et))==null?void 0:nt.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(j)(Ne)?t.unref(J)(Ne):Ne.physicalName,"onUpdate:modelValue":q=>t.unref(ge)(Z,et,{physicalName:q})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSTextInput),{name:`embed-dtype-${Ne.modelId}`,width:"84px",disabled:"","model-value":t.unref(ke)(Z,et)},null,8,["name","model-value"])],8,y2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-len-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(Se)(Z,et)},null,8,["name","model-value"])],8,g2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-scale-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ce)(Z,et)},null,8,["name","model-value"])],8,b2)]),t.createVNode(to,{controller:t.unref(o),"ref-id":Ne.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",_2,[t.createVNode(dn,{class:"grow",name:`embed-logical-${Ne.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Uo=(Fo=t.unref(se)(Z,et))==null?void 0:Fo.logicalName)==null?void 0:Uo[t.unref(o).userLanguage.value])??((C=(Ho=t.unref(se)(Z,et))==null?void 0:Ho.logicalName)==null?void 0:C.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ne.logicalName,"onUpdate:modelValue":q=>t.unref(me)(Z,et,q)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(S=t.unref(se)(Z,et))!=null&&S.shareable?(t.openBlock(),t.createElementBlock("label",k2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"110px","model-value":t.unref(Ie)(Ne),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":q=>q&&t.unref(Y)(Z,et,q)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(j)(Ne)?(t.openBlock(),t.createElementBlock("p",E2,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",N2,[De[3]||(De[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ne),"model-value":t.unref(j)(Ne)?"false":t.unref(Q)(Ne),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":q=>q&&t.unref(X)(Z,et,q)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",w2,[De[4]||(De[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(j)(Ne),"model-value":t.unref(j)(Ne)?"false":t.unref(le)(Ne),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":q=>q&&t.unref(ue)(Z,et,q)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("p",o2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",i2,[t.createVNode(dn,{class:"grow",name:`attr-logical-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(dt=Z.dbAttrs[0])==null?void 0:dt.logicalName,"onUpdate:modelValue":Ne=>t.unref(L)(Z,Ne)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",a2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(k)(Z)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(h)(Z),"model-value":((yn=Z.dbAttrs[0])==null?void 0:yn.physicalName)??"","onUpdate:modelValue":Ne=>t.unref(I)(Z,{physicalName:Ne})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-dtype-${Z.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(h)(Z)||t.unref(g)(Z),items:t.unref(Xs)(((Et=Z.dbAttrs[0])==null?void 0:Et.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Sr),"model-value":((gn=Z.dbAttrs[0])==null?void 0:gn.dataType)??"","onUpdate:modelValue":Ne=>Ne&&t.unref(I)(Z,{dataType:Ne})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-len-${Z.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(h)(Z)||t.unref(g)(Z),"model-value":(Ee=Z.dbAttrs[0])==null?void 0:Ee.length,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{length:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(T)(Z)},[t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-scale-${Z.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(h)(Z)||t.unref(g)(Z)||!t.unref(A)(Z),"model-value":(at=Z.dbAttrs[0])==null?void 0:at.scale,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{scale:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,r2)]),t.createVNode(to,{controller:t.unref(o),"ref-id":(zt=Z.dbAttrs[0])==null?void 0:zt.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",l2,[t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:t.unref(a)||t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(p)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(d)(Z,{notNull:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-uq-${Z.modelId}`,label:"Unique","model-value":!!((ut=Z.dbAttrs[0])!=null&&ut.unique),disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{unique:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-ai-${Z.modelId}`,label:"Auto Increment","model-value":!!((Qt=Z.dbAttrs[0])!=null&&Qt.autoIncrement),disabled:t.unref(h)(Z)||t.unref(g)(Z)||!Z.identifier,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{autoIncrement:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-tr-${Z.modelId}`,label:"@Transient","model-value":!!Z.transient,disabled:Z.identifier||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(f)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(m)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Z.modelId}`,label:"mutable","model-value":!!Z.naturalIdMutable,disabled:t.unref(h)(Z)||!Z.naturalId,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{naturalIdMutable:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-mv-${Z.modelId}`,label:"Multi-Value (Set)","model-value":!!((en=Z.dbAttrs[0])!=null&&en.multiValue),disabled:t.unref(h)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{multiValue:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",s2,[De[1]||(De[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(h)(Z),"model-value":t.unref(Q)(Z.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ne=>Ne&&t.unref(_e)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",c2,[De[2]||(De[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(h)(Z),"model-value":t.unref(le)(Z.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ne=>Ne&&t.unref(z)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",d2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":t.unref(R)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ne=>Ne&&t.unref($)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(w).length&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("label",u2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Ef,{"model-value":Z.groupCode,items:t.unref(w),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ne=>t.unref(W)(Z,Ne)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(w).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(v)(Z).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"100%","model-value":Z.defaultValue??"none",items:t.unref(M)(Z),"value-provider":t.unref(D),"label-provider":t.unref(U),"onUpdate:modelValue":Ne=>Ne&&t.unref(ie)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`attr-default-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Z.defaultValue??"","onUpdate:modelValue":Ne=>t.unref(pe)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",m2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`attr-desc-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Z.description,"onUpdate:modelValue":Ne=>t.unref(x)(Z,Ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",I2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ve(Z)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:Ne=>V(Z,null)},"∅",10,v2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),Ne=>(t.openBlock(),t.createElementBlock("button",{key:Ne,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ve(Z)===Ne}]),style:t.normalizeStyle({background:t.unref(To)(Ne)}),title:t.unref(o).t(t.unref(eo)(Ne)),onClick:et=>V(Z,Ne)},null,14,x2))),128)),H(Z)?(t.openBlock(),t.createElementBlock("span",C2,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,ZM)}),128))],8,HM)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-2c47fef2"]]),R2=["disabled"],A2={class:"em-panel__sub-label"},$2={class:"em-attr__row"},T2={class:"em-field em-idx-params"},M2=["value","placeholder","onChange"],V2=Ke(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(I=>I.modelId===o.entityId)??null),l=t.computed(()=>r.value?jo(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var I;return Tn(((I=r.value)==null?void 0:I.attributes)??[])}),c=I=>s.value.canon(I),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>{var I;return[...(((I=r.value)==null?void 0:I.attributes)??[]).filter(A=>A.dbAttrs.length>0).map(A=>({value:A.modelId,label:If(A,d.value)})),...l.value.map(A=>({value:A.modelId,label:a.t("em.index.inherited",{field:A.field})}))]});function m(I,A){var R;const T=new Set(I.columns.filter(($,B)=>B!==A).map($=>c($.columnRef))),L=u.value.filter($=>!T.has(c($.value))),x=(R=I.columns[A])==null?void 0:R.columnRef;return x&&!L.some($=>$.value===x)&&L.push({value:x,label:p(x)}),L}function p(I){return vf(I,d.value)}function f(I){const A=new Set(I.columns.map(T=>c(T.columnRef)));return u.value.filter(T=>!A.has(c(T.value)))}function h(){var A;if(!r.value)return;const I=u.value[0];a.addIndex(r.value.modelId,{modelId:Me(),name:`idx_${(((A=r.value.indexes)==null?void 0:A.length)??0)+1}`,unique:!1,columns:I?[{columnRef:I.value,descending:!1}]:[]})}function g(I,A){r.value&&a.updateIndex(r.value.modelId,I,A)}function k(I){const A=f(I)[0];A&&g(I.modelId,{columns:[...I.columns,{columnRef:A.value,descending:!1}]})}function N(I,A,T){g(I.modelId,{columns:I.columns.map((L,x)=>x===A?{...L,columnRef:T}:L)})}function b(I,A,T){g(I.modelId,{columns:I.columns.map((L,x)=>x===A?{...L,descending:T}:L)})}function _(I,A){g(I.modelId,{columns:I.columns.filter((T,L)=>L!==A)})}function E(I,A){g(I.modelId,{parameters:A.trim()===""?void 0:A})}return(I,A)=>{var T;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:A[0]||(A[0]=L=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",A2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:((T=r.value.indexes)==null?void 0:T.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(h,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],L=>(t.openBlock(),t.createElementBlock("div",{key:L.modelId,class:"em-attr"},[t.createElementVNode("div",$2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`idx-name-${L.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":L.name,"onUpdate:modelValue":x=>g(L.modelId,{name:x})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-uq-${L.modelId}`,class:"em-check",label:"UQ","model-value":L.unique,"onUpdate:modelValue":x=>g(L.modelId,{unique:x})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:x=>t.unref(a).removeIndex(r.value.modelId,L.modelId)},null,8,["onClick"])]),t.createVNode(to,{controller:t.unref(a),"ref-id":L.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(L.columns,(x,R)=>(t.openBlock(),t.createElementBlock("div",{key:R,class:"em-attr__row"},[t.createVNode(t.unref(ee.BSSelect),{class:"grow","model-value":x.columnRef,items:m(L,R),"value-provider":$=>$.value,"label-provider":$=>$.label,"onUpdate:modelValue":$=>$&&N(L,R,$)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-${L.modelId}-desc-${R}`,class:"em-check",label:"DESC","model-value":x.descending,"onUpdate:modelValue":$=>b(L,R,$)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:"−",onClick:$=>_(L,R)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(L).length,onClick:x=>k(L)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",T2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:L.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:x=>E(L,x.target.value)},null,40,M2)])]))),128)):t.createCommentVNode("",!0)],8,R2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),B2=["disabled"],D2={class:"em-panel__sub-label"},O2={class:"em-attr__row"},L2={class:"em-attr__row"},P2={class:"em-multilang"},z2={class:"em-attr__pii"},F2={class:"em-swatch__row em-attr__swatch"},U2=["title","onClick"],H2=["title","onClick"],j2=Ke(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=ee.useModal(),l=t.computed(()=>a.state.logical.entities.find(_=>_.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(_=>_.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(_){return _==="none"?a.t("em.common.noneParen"):_}const m=_=>_;function p(_,E){l.value&&a.updateOperation(l.value.modelId,_.modelId,E)}function f(_,E){p(_,{description:Object.keys(E).length?E:void 0})}function h(_){return _.personalInfoAttributeType??"none"}function g(_,E){p(_,{personalInfoAttributeType:E==="none"?void 0:E})}function k(_){var E,I;return _t((I=(E=s.value)==null?void 0:E.operationStyles)==null?void 0:I[_.modelId])}function N(_,E){l.value&&a.setOperationSwatch(l.value.modelId,_.modelId,E)}function b(_){r.openModal({component:xf,bind:{operationName:_.name,sourceCode:_.sourceCode??"",locale:a.uiLocale.value,onSave:E=>p(_,{sourceCode:E})}})}return(_,E)=>{var I;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:E[1]||(E[1]=A=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",D2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((I=l.value.operations)==null?void 0:I.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:E[0]||(E[0]=t.withModifiers(A=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],A=>(t.openBlock(),t.createElementBlock("div",{key:A.modelId,class:"em-attr"},[t.createElementVNode("div",O2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":T=>p(A,{name:T})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":T=>T&&p(A,{visibility:T})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:T=>t.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),t.createElementVNode("div",L2,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:T=>b(A)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",P2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`op-desc-${A.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":T=>f(A,T)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",z2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":h(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":T=>T&&g(A,T)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",F2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":k(A)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:T=>N(A,null)},"∅",10,U2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),T=>(t.openBlock(),t.createElementBlock("button",{key:T,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":k(A)===T}]),style:t.normalizeStyle({background:t.unref(To)(T)}),title:t.unref(a).t(t.unref(eo)(T)),onClick:L=>N(A,T)},null,14,H2))),128))])]))),128)):t.createCommentVNode("",!0)],8,B2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),K2=["title"],G2={class:"em-panel__head"},Y2={class:"em-panel__head-row"},q2=["title"],W2={class:"em-panel__context"},J2={key:0,class:"em-panel__lock"},X2=["disabled"],Z2={key:0,class:"em-panel__note"},Q2={key:1,class:"em-panel__note"},eV={key:2,class:"em-jpa"},tV={class:"em-field"},nV={class:"em-field"},oV={class:"em-field"},iV={key:0,class:"em-field"},aV={class:"em-panel__note"},rV={class:"em-panel__sub"},lV={class:"em-field"},sV={class:"em-field"},cV={class:"em-jpa"},dV={key:0,class:"em-panel__note"},uV={key:1,class:"em-panel__note"},mV={class:"em-jpa"},fV={class:"em-field"},pV={key:0,class:"em-panel__note"},hV={class:"em-field"},yV={class:"em-multilang"},gV={class:"em-field"},bV=["value"],_V={class:"em-field"},kV={class:"em-swatch"},EV={class:"em-swatch__row"},NV=["title"],wV=["title","onClick"],IV={class:"em-panel__note"},vV={class:"em-field"},xV=["value"],CV={class:"em-swatch"},SV={class:"em-swatch__row"},RV=["title"],AV=["title","onClick"],ph=Ke(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var Y;return(Y=r.value)==null?void 0:Y.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const Y=c.value;return Y?l.state.logical.entities.find(j=>j.modelId===Y)??null:null}),u=t.computed(()=>{const Y=s.value;if((Y==null?void 0:Y.kind)==="association")return l.isAssociationLocked(Y.id);const j=c.value;return!!j&&l.isEntityLocked(j)}),m=t.computed(()=>{var Y;return((Y=l.selectedAttr.value)==null?void 0:Y.attrId)??null}),p=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),h=t.ref({});t.watch(f,()=>{h.value={}});function g(Y){return h.value[Y]??f.value}function k(Y){h.value={...h.value,[Y]:!g(Y)}}const N=t.computed(()=>{var J;const Y=d.value;if(!Y)return l.t("em.entity.fallback");const j=(J=Y.table)==null?void 0:J.physicalName;return j?`${Y.name} (${j})`:Y.name}),b=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="association"?l.state.logical.associations.find(j=>j.modelId===Y.id)??null:null}),_=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="group"?l.state.logical.groups.find(j=>j.modelId===Y.id)??null:null}),E=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="note"?l.state.layout.notes.find(j=>j.modelId===Y.id)??null:null}),I=t.computed(()=>{var j,J;const Y=(j=_.value)==null?void 0:j.name;return(Y==null?void 0:Y[l.userLanguage.value])||(Y==null?void 0:Y.ko)||(Y==null?void 0:Y.en)||(Y==null?void 0:Y.ja)||(Y==null?void 0:Y.zh)||((J=_.value)==null?void 0:J.packageName)||l.t("em.group.fallback")}),A=t.computed(()=>{if(d.value){const Y=p.value.size;if(Y>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:Y});if(m.value){const j=d.value.attributes.find(J=>J.modelId===m.value);return(j==null?void 0:j.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(j==null?void 0:j.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(b.value){const Y=j=>{var J;return((J=l.state.logical.entities.find(ve=>ve.modelId===j))==null?void 0:J.name)??j};return l.t("em.inspector.ctxAssoc",{a:Y(b.value.end1.entityRef),b:Y(b.value.end2.entityRef)})}return _.value?l.t("em.inspector.ctxGroup",{name:I.value}):E.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),T=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],L=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],x={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},R=Y=>{const j=x[Y];return j?l.t(j):Y},$=Y=>{var j;return((j=l.state.logical.entities.find(J=>J.modelId===Y))==null?void 0:j.name)??Y},B=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],O=["LIST","SET"],y=["inherit","LAZY","EAGER"],w=Y=>Y;function v(Y){return Y==="inherit"?l.t("em.common.inherit"):Y}const M=t.computed(()=>!!b.value&&b.value.end1.entityRef===b.value.end2.entityRef);function D(Y,j){b.value&&l.updateAssociationEnd(b.value.modelId,Y,j)}function U(Y){return oe.value?Y:Y==="end1"?"end2":"end1"}function W(Y){var Te;const j=(Te=b.value)==null?void 0:Te[Y];if(!(j!=null&&j.attributeRef))return;const J=l.state.logical.entities.find(K=>K.modelId===j.entityRef),ve=J==null?void 0:J.attributes.find(K=>K.modelId===j.attributeRef);return ve&&(ve.attrType==="RELATION_OWN"||ve.attrType==="RELATION_REF")?ve.name:void 0}function ie(Y,j){var ve;const J=(ve=b.value)==null?void 0:ve[Y];J!=null&&J.attributeRef&&l.updateAttribute(J.entityRef,J.attributeRef,{name:j})}function pe(Y){var K;const j=W(Y);if(j!==void 0)return j;const J=(K=b.value)==null?void 0:K[Y];if(J!=null&&J.navFieldNameHint)return J.navFieldNameHint;const ve=Y==="end1"?"end2":"end1",Te=l.state.logical.entities.find(te=>{var G;return te.modelId===((G=b.value)==null?void 0:G[ve].entityRef)});return Te?ji(Te.name,Ui(b.value[ve].multiplicity)):""}function ye(Y){return!!oe.value||W(Y)!==void 0}function ge(Y){b.value&&!M.value&&l.setAssociationIdentifying(b.value.modelId,Y)}function me(Y){var j,J,ve;return!!((ve=(J=(j=b.value)==null?void 0:j[Y].jpa)==null?void 0:J.cascadeTypes)!=null&&ve.includes("ALL"))}function se(Y,j,J){var K,te;const ve=(K=b.value)==null?void 0:K[Y];if(j==="ALL"&&J){D(Y,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:["ALL"]}});return}const Te=new Set(((te=ve==null?void 0:ve.jpa)==null?void 0:te.cascadeTypes)??[]);J?Te.add(j):Te.delete(j),D(Y,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:[...Te]}})}function ke(Y,j){var ve;const J=(ve=b.value)==null?void 0:ve[Y];D(Y,{jpa:{...J==null?void 0:J.jpa,...j}})}function Se(Y){var j,J;return((J=(j=b.value)==null?void 0:j[Y].jpa)==null?void 0:J.fetchType)??"inherit"}function ce(Y,j){ke(Y,{fetchType:j==="inherit"?void 0:j})}function fe(Y){var J;const j=(J=b.value)==null?void 0:J[Y==="end1"?"end2":"end1"];return(j==null?void 0:j.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(j==null?void 0:j.multiplicity)==="ONE_OR_MORE_INSTANCES"}const oe=t.computed(()=>{const Y=b.value;if(!Y)return null;for(const j of l.state.logical.entities){const J=j.attributes.find(te=>{var G;return((G=te.embedded)==null?void 0:G.associationRef)===Y.modelId&&te.attrType==="EMBED_OWN"});if(!J)continue;const ve=Y.end2.entityRef===J.embedded.embeddableRef?"end2":"end1",Te=Y[ve].multiplicity,K=Y[ve].jpa;return{which:ve,cardinality:Te,isCollection:Te==="ZERO_OR_MORE_INSTANCES"||Te==="ONE_OR_MORE_INSTANCES",collectionType:(K==null?void 0:K.collectionType)??"LIST",collectionTable:(K==null?void 0:K.collectionTable)??"",orderColumn:(K==null?void 0:K.orderColumn)??""}}return null});function le(Y){b.value&&l.setEmbedCardinality(b.value.modelId,Y)}function ue(Y){const j=oe.value;j&&ke(j.which,Y==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function z(Y){const j=oe.value;j&&ke(j.which,{collectionTable:Y.trim()||void 0})}function P(Y){const j=oe.value;j&&ke(j.which,{orderColumn:Y.trim()||void 0})}function F(Y){_.value&&l.updateGroup(_.value.modelId,Y)}function Q(Y,j){var J;F({name:{...(J=_.value)==null?void 0:J.name,[Y]:j}})}const X=t.computed(()=>{var Y;return _.value?_t((Y=l.state.layout.groupLayouts.find(j=>j.groupRef===_.value.modelId))==null?void 0:Y.style):null});function _e(Y){_.value&&l.setGroupSwatch(_.value.modelId,Y)}function he(Y){E.value&&l.setNoteMemo(E.value.modelId,Y)}const we=t.computed(()=>{var Y;return _t((Y=E.value)==null?void 0:Y.style)});function Ie(Y){E.value&&l.setNoteSwatch(E.value.modelId,Y)}return(Y,j)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:j[0]||(j[0]=(...J)=>e.startResize&&e.startResize(...J))},null,42,K2),t.createElementVNode("header",G2,[t.createElementVNode("div",Y2,[j[14]||(j[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:j[1]||(j[1]=J=>a("collapse"))},[t.createVNode(Ae,{name:"panel-right-close",size:16})],8,q2)]),t.createElementVNode("p",W2,t.toDisplayString(A.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",J2,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:j[2]||(j[2]=J=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(pf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("basics"),title:N.value,onToggle:j[3]||(j[3]=J=>k("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(S2,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(V2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("index"),onToggle:j[4]||(j[4]=J=>k("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(j2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("ops"),onToggle:j[5]||(j[5]=J=>k("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!b.value.identifying,disabled:M.value||!!oe.value,"onUpdate:modelValue":ge},null,8,["label","model-value","disabled"]),M.value?(t.openBlock(),t.createElementBlock("p",Z2,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):oe.value?(t.openBlock(),t.createElementBlock("p",Q2,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("fieldset",eV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",tV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.cardinality,items:L,"value-provider":w,"label-provider":R,"onUpdate:modelValue":j[6]||(j[6]=J=>J&&le(J))},null,8,["model-value"])]),oe.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",nV,[j[15]||(j[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.collectionType,items:O,"value-provider":w,"label-provider":w,"onUpdate:modelValue":j[7]||(j[7]=J=>J&&ue(J))},null,8,["model-value"])]),t.createElementVNode("label",oV,[j[16]||(j[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":oe.value.collectionTable,"onUpdate:modelValue":z},null,8,["placeholder","model-value"])]),oe.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",iV,[j[17]||(j[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":oe.value.orderColumn,"onUpdate:modelValue":P},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",aV,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],J=>{var ve,Te,K;return t.withDirectives(t.createElementVNode("div",{key:J,class:"em-end"},[t.createElementVNode("h4",rV,t.toDisplayString(J)+" → "+t.toDisplayString($(b.value[J].entityRef)),1),oe.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",lV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":b.value[J].multiplicity,items:T,"value-provider":w,"label-provider":t.unref(Hi),"onUpdate:modelValue":te=>D(J,{multiplicity:te})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-navigable`,class:"em-check",label:"navigable",title:U(J)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:U(J)==="end2","model-value":U(J)==="end2"?!0:b.value[U(J)].navigable,"onUpdate:modelValue":te=>D(U(J),{navigable:te})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",sV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(ee.BSTextInput),{name:`${U(J)}-navname`,width:"100%",disabled:!ye(U(J)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":pe(U(J)),"onUpdate:modelValue":te=>ie(U(J),te)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-composition`,class:"em-check",label:"composition","model-value":b.value[U(J)].composition,"onUpdate:modelValue":te=>D(U(J),{composition:te})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",cV,[j[18]||(j[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(B,te=>{var G,ae;return t.createVNode(t.unref(ee.BSCheckbox),{key:te,name:`${U(J)}-cascade-${te}`,class:"em-check",label:te,"model-value":!!((ae=(G=b.value[U(J)].jpa)==null?void 0:G.cascadeTypes)!=null&&ae.includes(te)),disabled:!ye(U(J))||te!=="ALL"&&me(U(J)),"onUpdate:modelValue":Be=>se(U(J),te,Be)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ye(U(J))?me(U(J))?(t.openBlock(),t.createElementBlock("p",uV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",dV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",mV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",fV,[j[19]||(j[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(ee.BSSelect),{disabled:!ye(U(J)),"model-value":Se(U(J)),items:y,"value-provider":w,"label-provider":v,"onUpdate:modelValue":te=>te&&ce(U(J),te)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${U(J)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((ve=b.value[U(J)].jpa)!=null&&ve.orphanRemoval),disabled:!ye(U(J))||fe(J),"onUpdate:modelValue":te=>ke(U(J),{orphanRemoval:te})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),fe(J)&&((Te=b.value[U(J)].jpa)!=null&&Te.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",pV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",hV,[j[20]||(j[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:`${U(J)}-orderby`,width:"100%",disabled:!ye(U(J)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((K=b.value[U(J)].jpa)==null?void 0:K.orderBy)??"","onUpdate:modelValue":te=>ke(U(J),{orderBy:te.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!oe.value||J===oe.value.which]])}),64))],64)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",yV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,J=>{var ve;return t.openBlock(),t.createElementBlock("label",{key:J,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(J),1),t.createVNode(t.unref(ee.BSTextInput),{name:`grp-name-${J}`,width:"100%","model-value":((ve=_.value.name)==null?void 0:ve[J])??"","onUpdate:modelValue":Te=>Q(J,Te)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",gV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:j[8]||(j[8]=J=>F({description:J.target.value}))},null,40,bV)]),t.createElementVNode("label",_V,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":j[9]||(j[9]=J=>F({packageName:J}))},null,8,["model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":j[10]||(j[10]=J=>F({excludeDDLGeneration:J}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",kV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",EV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":X.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:j[11]||(j[11]=J=>_e(null))},"∅",10,NV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":X.value===J}]),style:t.normalizeStyle({background:t.unref(To)(J)}),title:t.unref(l).t(t.unref(eo)(J)),onClick:ve=>_e(J)},null,14,wV))),128))])]),t.createElementVNode("p",IV,t.toDisplayString(t.unref(l).t("em.group.members",{n:_.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",vV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:E.value.memo,rows:"6",onChange:j[12]||(j[12]=J=>he(J.target.value))},null,40,xV)]),t.createElementVNode("fieldset",CV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",SV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":we.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:j[13]||(j[13]=J=>Ie(null))},"∅",10,RV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Qn),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":we.value===J}]),style:t.normalizeStyle({background:t.unref(To)(J)}),title:t.unref(l).t(t.unref(eo)(J)),onClick:ve=>Ie(J)},null,14,AV))),128))])])],64)):t.createCommentVNode("",!0)],8,X2)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),$V=["title"],TV={class:"em-validation__title"},MV=["title","onClick"],VV={key:0,class:"em-validation__body"},BV={class:"em-validation__opt"},DV={key:0,class:"em-validation__empty"},OV={key:1,class:"em-validation__empty"},LV={key:2,class:"em-validation__list"},PV=["onClick"],zV={class:"em-validation__item-msg"},FV={key:0,class:"em-validation__item-entity"},UV=["title","onClick"],HV=["title"],jV=Ke(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const g=new Map;for(const k of o.state.logical.entities)g.set(k.modelId,k.name);return g});function r(g){const k=Cw(g);if(!k)return null;const N=a.value.get(k);return N===void 0?null:N.trim()===""?o.t("em.validation.nameless"):N}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const g={error:0,warning:0,info:0};for(const k of i.value)g[k.severity]++;return g}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,k)=>l[g.severity].order-l[k.severity].order)),u=t.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:ff(o.t,g),category:vw(o.t,g.ruleId)}))),m=t.ref(!1);function p(g){c.value[g]=!c.value[g]}function f(g){if(!m.value){m.value=!0;return}p(g)}function h(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,k)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:k[1]||(k[1]=N=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Ae,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",TV,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,$V),t.createElementVNode("div",{class:"em-validation__counts",onClick:k[0]||(k[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],N=>t.createElementVNode("button",{key:N,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${N}`,{"is-off":!c.value[N]}]]),title:m.value?t.unref(o).t(c.value[N]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[N].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:b=>f(N)},[t.createVNode(Ae,{name:l[N].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[N]),1)],10,MV)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",VV,[t.createElementVNode("label",BV,[t.createVNode(t.unref(ee.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":k[2]||(k[2]=N=>t.unref(o).flagEntitiesWithoutRelations.value=N)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",DV,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",OV,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",LV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:N,entityName:b,message:_,category:E},I)=>(t.openBlock(),t.createElementBlock("li",{key:`${N.ruleId}:${N.targetRef??"model"}:${I}`,class:t.normalizeClass(["em-validation__item",[`is-${N.severity}`,{"is-clickable":!!N.targetRef}]]),onClick:A=>h(N)},[t.createVNode(Ae,{name:l[N.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",zV,[b?(t.openBlock(),t.createElementBlock("span",FV,t.toDisplayString(b),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(_),1)]),t.unref(o).hasQuickFix(N)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers(A=>t.unref(o).applyQuickFix(N),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,UV)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:N.ruleId},t.toDisplayString(E),9,HV)],10,PV))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),KV={class:"em-history"},GV={class:"em-history__head"},YV={class:"em-history__title"},qV={class:"em-history__head-actions"},WV=["title","disabled"],JV=["title"],XV={class:"em-history__filters"},ZV={class:"em-history__filter"},QV={class:"em-history__filters em-history__filters--period"},eB={class:"em-history__filter-label"},tB=["title","aria-label","max"],nB=["title","aria-label","min"],oB=["title"],iB={key:0,class:"em-history__diffbar"},aB={class:"em-history__diffbar-range"},rB={class:"em-history__diffbar-count"},lB={class:"em-history__body"},sB={key:0,class:"em-history__empty"},cB={key:1,class:"em-history__diff-list"},dB=["onClick"],uB={class:"em-history__action-head"},mB={class:"em-history__action-name"},fB={key:0,class:"em-history__fields"},pB={class:"em-history__fname"},hB={key:0,class:"em-history__old"},yB={class:"em-history__val"},gB={key:1,class:"em-history__empty"},bB={key:2,class:"em-history__empty is-error"},_B={key:3,class:"em-history__empty"},kB={key:4,class:"em-history__list"},EB=["onClick"],NB={class:"em-history__summary"},wB={class:"em-history__seq"},IB={class:"em-history__gmeta"},vB={class:"em-history__who"},xB={key:0,class:"em-history__time"},CB={key:1,class:"em-history__restored-from"},SB=["onClick"],RB={key:0,class:"em-history__detail"},AB={class:"em-history__action-head"},$B={class:"em-history__action-name"},TB={key:0,class:"em-history__fields"},MB={class:"em-history__fname"},VB={key:0,class:"em-history__old"},BB={class:"em-history__val"},DB={class:"em-history__preview"},OB=["disabled"],LB={key:0,class:"em-history__diff-list is-preview"},PB={class:"em-history__action-head"},zB={class:"em-history__action-name"},FB={key:0,class:"em-history__fields"},UB={class:"em-history__fname"},HB={key:0,class:"em-history__old"},jB={class:"em-history__val"},KB={class:"em-history__confirm-row"},GB={class:"em-history__confirm-msg"},YB=["disabled","onClick"],qB=["disabled"],WB=["onClick"],_r=50,JB=Ke(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((G,ae)=>ae.seq>G?ae.seq:G,-1/0));async function u(G){if(a.historyTransport){l.value=!0,s.value=null;try{const ae=!(G!=null&&G.full)&&r.value.length>0&&Number.isFinite(d.value),Be=await a.historyTransport(ae?d.value:void 0);if(!ae)r.value=Be;else if(Be.length){const Ve=new Set(r.value.map(V=>V.seq)),H=Be.filter(V=>!Ve.has(V.seq));H.length&&(r.value=[...r.value,...H])}c.value=!0}catch(ae){s.value=ae instanceof Error?ae.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const p=t.ref(null),f=t.ref(null);t.watch(()=>o.open,G=>{G?m():(p.value=null,f.value=null)},{immediate:!0});let h=null;t.watch(()=>a.revision.value,()=>{o.open&&(h&&clearTimeout(h),h=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const g=t.computed(()=>new Map(a.state.logical.entities.map(G=>[G.modelId,G]))),k=t.computed(()=>new Map(a.state.logical.associations.map(G=>[G.modelId,G]))),N=t.computed(()=>{const G=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(ae=>{var Be,Ve;return[ae.modelId,ae.packageName||((Be=ae.name)==null?void 0:Be[G])||((Ve=ae.name)==null?void 0:Ve.ko)||ae.modelId]}))});function b(G){var H,V,Pe,Ze,Ue,Le,De;const ae=k.value.get(G);if(!ae)return a.t("em.history.assocFallback");if((H=ae.description)!=null&&H.trim())return ae.description.trim();const Be=(Ze=(Pe=g.value.get((V=ae.end1)==null?void 0:V.entityRef))==null?void 0:Pe.name)==null?void 0:Ze.trim(),Ve=(De=(Le=g.value.get((Ue=ae.end2)==null?void 0:Ue.entityRef))==null?void 0:Le.name)==null?void 0:De.trim();return Be&&Ve?`${Be}→${Ve}`:a.t("em.history.assocFallback")}function _(G){var ae,Be,Ve,H;if(G.kind==="entity")return((Be=(ae=g.value.get(G.ref))==null?void 0:ae.name)==null?void 0:Be.trim())||a.t("em.attr.nameless");if(G.kind==="attribute"||G.kind==="operation"||G.kind==="index"){const V=G.entityRef?g.value.get(G.entityRef):void 0,Ze=((G.kind==="attribute"?V==null?void 0:V.attributes:G.kind==="operation"?V==null?void 0:V.operations:V==null?void 0:V.indexes)??[]).find(Le=>Le.modelId===G.ref),Ue=(Ve=V==null?void 0:V.name)==null?void 0:Ve.trim();return`${Ue?Ue+".":""}${((H=Ze==null?void 0:Ze.name)==null?void 0:H.trim())||G.ref}`}return G.kind==="association"?b(G.ref):G.kind==="associationEnd"?`${b(G.ref)}(${G.end})`:G.kind==="group"?a.t("em.history.groupSubject",{name:N.value.get(G.ref)??G.ref}):G.ref}const E={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},I={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},A=t.ref("all"),T=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],L=t.computed({get:()=>A.value,set:G=>{G&&(A.value=G)}}),x=t.computed(()=>el(r.value)),R=t.computed(()=>x.value.length?x.value[0].seq:null),$=t.computed(()=>A.value==="all"?x.value:x.value.filter(G=>(G.kind??"edit")===A.value)),B=t.ref(_r),O=t.ref(""),y=t.ref(""),w=t.computed(()=>!!O.value||!!y.value);function v(){O.value="",y.value=""}const M=t.computed(()=>{const G=O.value?new Date(`${O.value}T00:00:00`).getTime():null,ae=y.value?new Date(`${y.value}T23:59:59.999`).getTime():null;return G==null&&ae==null?$.value:$.value.filter(Be=>{if(Be.ts==null)return!1;const Ve=new Date(Be.ts).getTime();return!(isNaN(Ve)||G!=null&&Ve<G||ae!=null&&Ve>ae)})}),D=t.computed(()=>M.value.slice(0,B.value)),U=t.computed(()=>Math.max(0,M.value.length-B.value));function W(){B.value+=_r}t.watch([A,O,y],()=>{B.value=_r}),t.watch(()=>o.open,G=>{G&&(B.value=_r,v())});function ie(G){return G===void 0?"—":G===null?a.t("em.history.emptyValue"):typeof G=="object"?JSON.stringify(G):String(G)}function pe(G){const ae=_(G.subject);if(G.verb==="add")return a.t("em.history.summaryAdd",{name:ae});if(G.verb==="remove")return a.t("em.history.summaryRemove",{name:ae});if(G.fields.length===1){const Be=G.fields[0];return`${ae}.${Be.field} ${Be.oldValue!==void 0?ie(Be.oldValue)+"→":""}${ie(Be.value)}`}return a.t("em.history.summaryFields",{name:ae,n:G.fields.length})}function ye(G){return G.actions.length===0?a.t("em.history.noChange"):G.actions.length===1?pe(G.actions[0]):a.t("em.history.summaryMore",{summary:pe(G.actions[0]),n:G.actions.length-1})}const ge=t.ref(new Set);function me(G){const ae=new Set(ge.value);ae.has(G)?ae.delete(G):ae.add(G),ge.value=ae}function se(G){if(G==null)return"";const ae=new Date(G);return isNaN(ae.getTime())?String(G):ae.toLocaleString()}function ke(G){const ae=G.author,Be=G.origin;return ae&&Be?`${ae}(${Be})`:ae||(Be?`(${Be})`:"—")}const Se=t.computed(()=>p.value==null?null:tl(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Se.value?Kc(Se.value):null,G=>i("diffChange",G));function ce(G){p.value=G,f.value=null,j.value=null}function fe(){p.value=null,f.value=null}const oe=t.computed(()=>x.value.map(G=>G.seq)),le=t.computed(()=>R.value??1/0),ue=t.computed(()=>f.value??le.value),z=t.computed(()=>f.value??le.value),P=t.computed(()=>oe.value.filter(G=>G<ue.value).map(G=>({v:G}))),F=t.computed(()=>oe.value.filter(G=>p.value!=null&&G>p.value).map(G=>({v:G})));function Q(G){G!=null&&(p.value=G,f.value!=null&&f.value<=G&&(f.value=null))}function X(G){G!=null&&(f.value=G>=le.value?null:G)}function _e(G){return G>=le.value?a.t("em.history.diff.current"):`#${G}`}function he(G){return G.kind==="entity"?g.value.has(G.ref)?G.ref:null:(G.kind==="attribute"||G.kind==="operation"||G.kind==="index")&&G.entityRef?g.value.has(G.entityRef)?G.entityRef:null:G.kind==="group"&&N.value.has(G.ref)?G.ref:null}function we(G){const ae=he(G);ae&&a.requestFocus(ae)}const Ie={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},Y={added:"add",modified:"update",removed:"remove"},j=t.ref(null),J=t.ref(!1),ve=t.computed(()=>j.value==null?null:tl(r.value,{fromSeq:j.value})),Te=t.ref(!1);function K(G){j.value=G,Te.value=!1}async function te(G){J.value=!0;try{const ae=await a.restoreToSeq(G);ae.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:ae.reason??a.t("em.history.unknown")})}finally{J.value=!1,j.value=null}}return(G,ae)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Be,Ve;return[t.withDirectives(t.createElementVNode("section",KV,[t.createElementVNode("header",GV,[t.createElementVNode("div",YV,[t.createVNode(Ae,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",qV,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:ae[0]||(ae[0]=H=>u({full:!0}))},[t.createVNode(Ae,{name:"redo",size:15})],8,WV),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:ae[1]||(ae[1]=H=>i("close"))},[t.createVNode(Ae,{name:"panel-close",size:15})],8,JV)])]),t.createElementVNode("div",XV,[t.createElementVNode("label",ZV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(ee.BSSelect),{modelValue:L.value,"onUpdate:modelValue":ae[2]||(ae[2]=H=>L.value=H),items:T,"value-provider":H=>H.v,"label-provider":H=>t.unref(a).t(H.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",QV,[t.createElementVNode("span",eB,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:y.value||void 0,"onUpdate:modelValue":ae[3]||(ae[3]=H=>O.value=H)},null,8,tB),[[t.vModelText,O.value]]),ae[9]||(ae[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:O.value||void 0,"onUpdate:modelValue":ae[4]||(ae[4]=H=>y.value=H)},null,8,nB),[[t.vModelText,y.value]]),w.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:v},[t.createVNode(Ae,{name:"x",size:12})],8,oB)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",iB,[t.createElementVNode("div",aB,[t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:P.value,"value-provider":H=>H.v,"label-provider":H=>`#${H.v}`,"onUpdate:modelValue":ae[5]||(ae[5]=H=>Q(H??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ae,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":z.value,items:F.value,"value-provider":H=>H.v,"label-provider":H=>_e(H.v),"onUpdate:modelValue":ae[6]||(ae[6]=H=>X(H??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",rB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Be=Se.value)==null?void 0:Be.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:fe},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",lB,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ve=Se.value)!=null&&Ve.entries.length?(t.openBlock(),t.createElementBlock("ul",cB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value.entries,(H,V)=>(t.openBlock(),t.createElementBlock("li",{key:V,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!he(H.subject)}]),onClick:Pe=>we(H.subject)},[t.createElementVNode("div",uB,[t.createVNode(Ae,{name:E[H.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",mB,t.toDisplayString(_(H.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[H.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[H.verb])),3)]),H.fields.length?(t.openBlock(),t.createElementBlock("ul",fB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.fields,(Pe,Ze)=>(t.openBlock(),t.createElementBlock("li",{key:Ze,class:"em-history__field"},[t.createElementVNode("span",pB,t.toDisplayString(Pe.field),1),Pe.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",hB,t.toDisplayString(ie(Pe.oldValue)),1)):t.createCommentVNode("",!0),Pe.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",yB,t.toDisplayString(ie(Pe.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,dB))),128))])):(t.openBlock(),t.createElementBlock("p",sB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",gB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",bB,t.toDisplayString(s.value),1)):M.value.length===0?(t.openBlock(),t.createElementBlock("p",_B,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",kB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.value,H=>{var V,Pe,Ze;return t.openBlock(),t.createElementBlock("li",{key:H.seq,class:t.normalizeClass(["em-history__group",[`is-${H.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Ue=>me(H.seq)},[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":ge.value.has(H.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${H.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(H.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",NB,t.toDisplayString(ye(H)),1),t.createElementVNode("span",wB,"#"+t.toDisplayString(H.seq),1)],8,EB),t.createElementVNode("div",IB,[t.createElementVNode("span",vB,t.toDisplayString(ke(H)),1),H.ts?(t.openBlock(),t.createElementBlock("span",xB,t.toDisplayString(se(H.ts)),1)):t.createCommentVNode("",!0),H.kind==="restore"&&H.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",CB,"← #"+t.toDisplayString(H.restoredFromSeq),1)):t.createCommentVNode("",!0),H.seq!==R.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Ue=>ce(H.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,SB)):t.createCommentVNode("",!0)]),ge.value.has(H.seq)?(t.openBlock(),t.createElementBlock("div",RB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.actions,(Ue,Le)=>(t.openBlock(),t.createElementBlock("div",{key:Le,class:"em-history__action"},[t.createElementVNode("div",AB,[t.createVNode(Ae,{name:E[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",$B,t.toDisplayString(_(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Ue.verb}`])},t.toDisplayString(t.unref(a).t(I[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",TB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",MB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",VB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",BB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&H.seq!==R.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":j.value===H.seq}])},[j.value===H.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",DB,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((V=ve.value)!=null&&V.entries.length),onClick:ae[7]||(ae[7]=Ue=>Te.value=!Te.value)},[t.createVNode(Ae,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Te.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Pe=ve.value)!=null&&Pe.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:ve.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,OB),Te.value&&((Ze=ve.value)!=null&&Ze.entries.length)?(t.openBlock(),t.createElementBlock("ul",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value.entries,(Ue,Le)=>(t.openBlock(),t.createElementBlock("li",{key:Le,class:"em-history__diff-entry"},[t.createElementVNode("div",PB,[t.createVNode(Ae,{name:E[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",zB,t.toDisplayString(_(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[Ue.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",FB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",UB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",HB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",jB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",KB,[t.createElementVNode("span",GB,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:J.value,onClick:Ue=>te(H.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,YB),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:J.value,onClick:ae[8]||(ae[8]=Ue=>j.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,qB)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Ue=>K(H.seq)},[t.createVNode(Ae,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,WB))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&U.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:W},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:U.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function XB(e,n){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=n?i:null}function hh(e){const n=t.ref(XB(e.storageKey,e.min)??e.initial),o=t.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=n.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),n.value=m},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const ZB={class:"em-modeler"},QB={class:"em-modeler__body"},eD={class:"em-drawer__inner"},tD={class:"em-drawer__head"},nD={class:"em-drawer__actions"},oD=["title"],iD=["title"],aD=["title"],rD=["title"],lD=["title"],sD=Ke(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(E){t.nextTick(()=>{const I=E();I&&("focusCollapse"in I?I.focusCollapse():I.focus())})}function c(E){n.value=E,s(()=>E?i.value:a.value)}function d(E){o.value=E,s(()=>E?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:h}=hh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:g,dragging:k,startResize:N}=hh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),b=t.ref(null),_=t.ref(null);return(E,I)=>{var A,T,L;return t.openBlock(),t.createElementBlock("div",ZB,[t.createVNode(fh,{controller:e.controller,"history-open":u.value,onExportSvg:I[0]||(I[0]=x=>{var R;return(R=b.value)==null?void 0:R.exportSvg()}),onExportPng:I[1]||(I[1]=x=>{var R;return(R=b.value)==null?void 0:R.exportPng()}),onToggleHistory:I[2]||(I[2]=x=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",QB,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",eD,[t.createElementVNode("header",tD,[I[11]||(I[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",nD,[(A=_.value)!=null&&A.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((T=_.value)!=null&&T.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:I[3]||(I[3]=x=>{var R;return(R=_.value)==null?void 0:R.toggleAll()})},[t.createVNode(Ae,{name:(L=_.value)!=null&&L.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,oD)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:I[4]||(I[4]=x=>c(!1))},[t.createVNode(Ae,{name:"panel-close",size:16})],8,iD)])]),t.createVNode(mh,{ref_key:"explorer",ref:_,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:I[5]||(I[5]=(...x)=>t.unref(h)&&t.unref(h)(...x))},null,42,aD),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:I[6]||(I[6]=x=>c(!0))},[t.createVNode(Ae,{name:"panel-open",size:18})],8,rD),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(p)-6+"px"})},[t.createVNode(uh,{ref_key:"canvas",ref:b,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(ph,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(g),resizing:t.unref(k),"start-resize":t.unref(N),onCollapse:I[7]||(I[7]=x=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:I[8]||(I[8]=x=>d(!0))},[t.createVNode(Ae,{name:"panel-right-open",size:18})],8,lD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(JB,{controller:e.controller,open:u.value,onClose:I[9]||(I[9]=x=>u.value=!1),onDiffChange:I[10]||(I[10]=x=>m.value=x)},null,8,["controller","open"])]),t.createVNode(jV,{controller:e.controller,"panel-width":t.unref(g),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=Vb,be.AssociationEdge=dp,be.CUSTOM_TYPE_VALUE=tn,be.CommandStack=nl,be.DEFAULT_JAVA_TYPE=Ar,be.DIAGRAM_JSON_FORMAT=Br,be.DIAGRAM_JSON_VERSION=Dr,be.DiagramCanvas=uh,be.DiagramExplorer=mh,be.EDITOR=no,be.EditModeToggle=UM,be.EditorToolbar=fh,be.EntityModeler=sD,be.EntityNode=Ff,be.GROUP_CODE_ENUM_VALUE=Dn,be.GroupNode=Uf,be.INHERITED_REF_PREFIX=Di,be.InvalidDiagramJsonError=Ln,be.JAVA_TYPES=qo,be.NoteNode=Hf,be.OpSyncAdapter=Dd,be.PHYSICAL_NAME_MAX_LENGTH=Jo,be.PropertyPanel=ph,be.RevCache=Bd,be.SELECTABLE_JAVA_TYPES=Qs,be.SYMBOLIC_OP_KINDS=Od,be.SYMBOLIC_OP_SCHEMA=tu,be.UI_LOCALES=tI,be.applyDocumentReferenceOnly=Ir,be.buildAgentBatch=Bb,be.buildDiagramSvg=xs,be.buildDiffMarks=Kc,be.collectSharedColumns=kn,be.commands=Fg,be.computeAutoLayout=As,be.createEditorController=$x,be.dedupeModelIds=hg,be.defaultMermaidDialect=Dh,be.defaultSqlDialect=py,be.diagramToJson=cc,be.displayLabel=Pi,be.emptyState=Rf,be.entityModelToDdl=lc,be.entityModelToMermaid=vr,be.entityModelToText=Us,be.exportDiagramPng=ch,be.exportDiagramSvg=sh,be.fromPersisted=uu,be.isGeneratable=Ic,be.isInheritedColumnRef=Mn,be.javaTypeLabel=mo,be.makeInheritedColumnRef=Ms,be.mergeDiagram=Pc,be.mermaidErToImportSource=nc,be.migrateLegacyMoney=pg,be.multiplicityLabel=Hi,be.newId=Me,be.packEntityBoxes=kr,be.parseDiagramJson=dc,be.parseInheritedColumnRef=Er,be.parseMermaidEr=tc,be.parseSqlDdl=Mr,be.planHealBackfillOps=h_,be.projectActionLog=el,be.projectEntityAudit=Hc,be.projectFieldAudit=En,be.projectInheritedColumns=jo,be.projectSeqDiff=tl,be.renderDiagramSvg=mc,be.resolveColumnPhysicalName=Go,be.resolveDiagram=Rs,be.resolveEffectiveColumn=Vn,be.resolveQuickFix=Ur,be.resolveSharedColumn=Bn,be.resolveSymbolicOps=hb,be.restoreDeepEqual=Pn,be.scaffoldEntityJava=Fy,be.sharedColumnScopeEntities=Nr,be.sqlDdlToImportSource=rc,be.stereotypeLabel=Ko,be.synthesizeRestoreOps=Cg,be.toPersisted=m_,be.toPersistedV2=f_,be.translate=Dt,be.uiMessagesEn=gf,be.uiMessagesJa=bf,be.uiMessagesKo=_f,be.validateModel=Xi,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|