@g1cloud/entity-modeler-next 5.0.0-beta.1 → 5.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/associationNav.d.ts +10 -0
- package/dist/core/types.d.ts +4 -5
- package/dist/entity-modeler-next.css +1 -1
- package/dist/entity-modeler.js +8121 -7979
- package/dist/entity-modeler.umd.cjs +29 -29
- package/dist/i18n/ko.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`).trim()}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`),o=[],i=new Map,a=[],r=c=>{const d=i.get(c);if(d)return d;const u={modelId:De(),name:c,stereotype:"JPA_ENTITY",table:{physicalName:c},attributes:[]};return o.push(u),i.set(c,u),u};let l=null;for(const c of t){const d=c.trim();if(!d||d==="erDiagram"||d.startsWith("%%"))continue;if(l){if(d==="}"){l=null;continue}const f=Pf(d,l.attributes.length);f&&l.attributes.push(f);continue}const u=d.match(/^(\S+)\s*\{$/);if(u){l=r(u[1]);continue}const m=d.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(m&&/--|\.\./.test(m[2])){const[f,p]=m[2].split(/--|\.\./);let y=(m[4]??"").trim();const g=y.match(/^"([^"]*)"$/);g&&(y=g[1]),a.push({left:m[1],right:m[3],cardL:f??"",cardR:p??"",label:y});continue}/^\S+$/.test(d)&&r(d)}const s=a.map(c=>{const d=r(c.left),u=r(c.right);return{modelId:De(),description:c.label||void 0,end1:{entityRef:d.modelId,multiplicity:Of[c.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:u.modelId,multiplicity:Lf[c.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return{modelId:De(),entities:o,associations:s,groups:[]}}function Kl(e){const t=jl(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(t.entities.length||1)))),a=Ga(t.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:t.modelId,entityLayouts:a,associationLayouts:t.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:t,layout:r}}const Yl={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"}},zf=Object.keys(Yl).sort((e,t)=>t.length-e.length),Wl=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,On=`${Wl}(?:\\.${Wl})*`,Uf=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${On})\s*\(([\s\S]*)\)\s*$`,"i"),Ff=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${On})\s*\(([^)]*)\)`,"i"),Hf=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${On})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${On})\s*\(([^)]*)\)`,"i"),Gf=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${On})\s+ON\s+(${On})\s*\(([^)]*)\)`,"i");function bt(e){let t=e.trim().replace(/[";`\[\]]/g,"");const o=t.lastIndexOf(".");return o>=0&&(t=t.slice(o+1)),t}function dn(e){const t=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(t.push(i),i=""):i+=a;return i.trim()&&t.push(i),t.map(a=>a.trim()).filter(Boolean)}function jf(e){const t=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!t)return null;const o=bt(t[1]),i=t[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const _ of zf)if(a.startsWith(_)){const b=Yl[_];r=b.dataType,l=!!b.autoIncrement;let N=i.slice(_.length);const h=N.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);h&&(s=Number(h[1]),h[2]!=null&&(c=Number(h[2])),N=N.slice(h[0].length)),d=N,u=!0;break}if(!u){const _=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);_&&(r=_[1].toUpperCase(),_[2]!=null&&(s=Number(_[2])),_[3]!=null&&(c=Number(_[3])),d=_[4]??"")}const m=d.toUpperCase(),f=/\bPRIMARY\s+KEY\b/.test(m),p=f||/\bNOT\s+NULL\b/.test(m),y=/\bUNIQUE\b/.test(m),g={modelId:De(),physicalName:o,dataType:r};return s!=null&&(g.length=s),c!=null&&(g.scale=c),y&&(g.unique=!0),l&&(g.autoIncrement=!0),{primaryKey:f,attr:{modelId:De(),name:o,type:r,attrType:"NORMAL",identifier:f,notNull:p,order:0,dbAttrs:[g]}}}function Kf(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function ql(e){const t=e.match(/\(([^)]*)\)/);return t?dn(t[1]).map(bt):[]}function Wa(e){const t=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(d=>d.trim()).filter(Boolean);for(const d of c){const u=d.match(Uf);if(!u)continue;const m=bt(u[1]),f=u[2],p={modelId:De(),name:m,stereotype:"JPA_ENTITY",table:{physicalName:m},attributes:[]},y=new Map,g=[];let _=0;for(const b of dn(f)){if(Kf(b)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(b))g.push(...ql(b));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(b))for(const k of ql(b)){const P=y.get(k.toLowerCase());P!=null&&P.dbAttrs[0]&&(P.dbAttrs[0].unique=!0)}const h=b.match(Ff);h&&l.push({childTable:m,childCols:dn(h[1]).map(bt),parentTable:bt(h[2]),parentCols:dn(h[3]).map(bt)});continue}const N=jf(b);if(!N){t.push(`컬럼 정의 해석 실패: ${b.slice(0,40)}`);continue}N.attr.order=_++,p.attributes.push(N.attr),y.set(N.attr.name.toLowerCase(),N.attr)}for(const b of g){const N=y.get(b.toLowerCase());N&&(N.identifier=!0,N.notNull=!0)}o.push(p),i.set(m.toLowerCase(),p);for(const[b,N]of y)a.set(`${m.toLowerCase()}.${b}`,N)}for(const d of c){const u=d.match(Hf);u&&l.push({childTable:bt(u[1]),childCols:dn(u[2]).map(bt),parentTable:bt(u[3]),parentCols:dn(u[4]).map(bt)})}for(const d of l){const u=i.get(d.childTable.toLowerCase()),m=i.get(d.parentTable.toLowerCase());if(!u||!m){t.push(`FK 대상 테이블 없음: ${d.childTable}→${d.parentTable}`);continue}const f={modelId:De(),end1:{entityRef:m.modelId,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:u.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};d.childCols.forEach((p,y)=>{const g=a.get(`${d.childTable.toLowerCase()}.${p.toLowerCase()}`),_=a.get(`${d.parentTable.toLowerCase()}.${(d.parentCols[y]??"").toLowerCase()}`);g&&(g.attrType="RELATION_OWN",g.derivedFrom={associationRef:f.modelId,sourceAttributeRef:(_==null?void 0:_.modelId)??""},y===0&&(f.end2.attributeRef=g.modelId))}),r.push(f)}for(const d of c){const u=d.match(Gf);if(!u)continue;const m=bt(u[3]),f=i.get(m.toLowerCase());if(!f){t.push(`인덱스 대상 테이블 없음: ${m}`);continue}const y=dn(u[4]).map(_=>bt(_.replace(/\s+(ASC|DESC)$/i,""))).map(_=>{var b,N;return(N=(b=a.get(`${m.toLowerCase()}.${_.toLowerCase()}`))==null?void 0:b.dbAttrs[0])==null?void 0:N.modelId}).filter(_=>!!_).map(_=>({columnRef:_,descending:!1}));if(!y.length)continue;const g={modelId:De(),name:bt(u[2]),unique:!!u[1],columns:y};f.indexes=[...f.indexes??[],g]}return{logical:{modelId:De(),entities:o,associations:r,groups:[]},warnings:t}}function Xl(e){const{logical:t}=Wa(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(t.entities.length||1)))),a=Ga(t.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:t.modelId,entityLayouts:a,associationLayouts:t.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:t,layout:r}}const Yf=["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"],Wf=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"]),qf=Yf.filter(e=>!Wf.has(e)),Xf={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function qa(e){return Xf[e]??e}const Jf=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),_o=new Set(["NUMERIC","DECIMAL"]);function Jl(e,t=qf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Rt="CustomType",Ln="GroupCodeEnum",Xa="String",di=[{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:Ln,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Rt,label:"CustomType"}],Zf=new Map(di.map(e=>[e.value,e.label]));function Pn(e){return Zf.get(e)??e}const Qf=new Set([Ln,"CustomMoneyType"]),Zl=di.filter(e=>!Qf.has(e.value)).map(e=>e.value===Rt?{...e,label:"CustomType (사용자정의)"}:e);function Ql(e,t=[]){const o=t.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=[...Zl,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:Pn(e)},...i]:i}function ep(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Ja(e,t){var r;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.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 Za(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${Pn(t.type)}>`:ep(t)?Pn(t.type):e==="CLASS"?t.type===Rt&&t.customType||Pn(t.type):qa(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function ui(e,t){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=t.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 un(e,t){return ui(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function mn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function zn(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const ko=63;function mi(e){if(!e)return null;const t=e.length;return t>ko?t:null}function es(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Nt(e){return!e||e.trim()===""}function Eo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function tp(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const m=t.get(u.end1.entityRef)??[];m.push(u.end2.entityRef),t.set(u.end1.entityRef,m)}const o=0,i=1,a=2,r=new Map,l=[],s=[],c=new Set,d=u=>{r.set(u,i),l.push(u);for(const m of t.get(u)??[]){const f=r.get(m)??o;if(f===o)d(m);else if(f===i){const p=l.slice(l.indexOf(m)),y=[...p].sort().join(" ");c.has(y)||(c.add(y),s.push(p))}}l.pop(),r.set(u,a)};for(const u of e.entities)(r.get(u.modelId)??o)===o&&d(u.modelId);return s}function fi(e,t,o,i,a){var r,l,s,c,d;if(!Nt(t.physicalName))return t.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(u=>u.type===e.type))==null?void 0:l.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const m=(d=i.entities.find(f=>f.modelId===u))==null?void 0:d.attributes.flatMap(f=>f.dbAttrs)[o];return(m==null?void 0:m.physicalName)??""}return t.physicalName??""}function Qa(e,t){const o=new Map;for(const i of e){const a=t(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=t(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function ts(e,t){var r,l,s,c,d;const o=[];for(const u of Qa(e.entities,m=>m.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{name:u.name}});for(const u of e.entities){const m=u.attributes.filter(h=>h.attrType!=="DIVIDER");if(Nt(u.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:u.modelId}),u.stereotype==="JPA_ENTITY"&&!u.abstractClass&&(m.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:u.modelId}),Nt((r=u.table)==null?void 0:r.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:u.modelId})),u.stereotype==="JPA_EMBEDDABLE")for(const h of m.filter(k=>k.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.identifier&&k.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m)if(!h.identifier)for(const k of h.dbAttrs)!k.autoIncrement&&Nt(k.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:k.modelId,contextRef:u.modelId,params:k.autoIncrement?{name:h.name}:{name:h.name,seq:k.sequenceName??""}});for(const h of m.filter(k=>k.naturalId&&k.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.naturalId&&k.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.naturalId&&!k.notNull&&!k.identifier&&!k.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});!u.abstractClass&&m.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:u.modelId}),(t==null?void 0:t.largeEntityThreshold)!=null&&m.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:u.modelId,params:{count:m.length,threshold:t.largeEntityThreshold}});for(const h of Qa(m,k=>k.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m)Nt(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId});const f=m.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),p=m.flatMap(h=>h.dbAttrs.map((k,P)=>({col:k,name:fi(h,k,P,e,t)})).filter(k=>k.col.sharedColumnRef==null));for(const h of Qa(p,k=>k.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of f){const k=mi(h.physicalName);k!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{max:ko,len:k}}),t!=null&&t.reservedWords&&!Nt(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.physicalName}}),t!=null&&t.selectableDataTypes&&!Nt(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{dataType:h.dataType}}),!Nt(h.dataType)&&Jf.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{dataType:h.dataType}})}if((l=t==null?void 0:t.embeddableCatalog)!=null&&l.length){const h=mn(un(u,e.entities));for(const k of m){if(k.attrType!=="EMBED_PREDEF")continue;const P=t.embeddableCatalog.find(A=>A.type===k.type);P&&k.dbAttrs.forEach((A,G)=>{if(A.sharedColumnRef==null)return;const K=P.fields[G],v=h.get(A.sharedColumnRef);if(!K||!v)return;(v.dataType!==K.dataType||(v.length??null)!==(K.length??null)||(v.scale??null)!==(K.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:A.modelId,contextRef:u.modelId,params:{targetType:es(v),metaName:K.name,metaType:es(K)}})})}}for(const h of m){const k=h.dbAttrs[0];if(!(k!=null&&k.multiValue))continue;h.type===Ln&&k.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:k.modelId,contextRef:u.modelId,params:{type:h.type||"",dataType:k.dataType||""}})}const y=(s=u.table)==null?void 0:s.physicalName,g=mi(y);g!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{max:ko,len:g}}),t!=null&&t.reservedWords&&!Nt(y)&&t.reservedWords.has(y.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{name:y}});const _=new Set;for(const h of u.attributes){_.add(h.modelId);for(const k of h.dbAttrs)_.add(k.modelId)}const b=new Set(go(u,(t==null?void 0:t.superClassCatalog)??[]).map(h=>h.modelId)),N=(((c=t==null?void 0:t.superClassCatalog)==null?void 0:c.length)??0)>0;for(const h of u.indexes??[]){const k=mi(h.name);k!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:{max:ko,len:k}}),t!=null&&t.reservedWords&&!Nt(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const P of h.columns){const A=P.columnRef;if(_.has(A)||b.has(A))continue;const G=yo(A);G&&!N||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:G?{name:h.name,field:((d=ja(A))==null?void 0:d.field)??A}:{name:h.name}})}}}const i=new Map;for(const u of e.entities)for(const m of u.attributes)m.attrType==="EMBED_OWN"&&m.embedded&&i.set(m.embedded.associationRef,m);for(const u of e.associations){Eo(u.end1.multiplicity)&&Eo(u.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:u.modelId}),i.has(u.modelId)&&u.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:u.modelId});for(const m of["end1","end2"]){const f=u[m].jpa;if(!f)continue;const p=f.cascadeTypes??[],y=p.includes("ALL"),g=p.includes("REMOVE");y&&p.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.orphanRemoval&&(g||y)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:u.modelId,params:{which:m,cascade:y?"ALL":"REMOVE"}}),Eo(u[m].multiplicity)&&f.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.orphanRemoval&&Eo(u[m==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:u.modelId,params:{which:m}}),!Eo(u[m].multiplicity)&&(f.collectionType||f.collectionTable||f.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.collectionType==="SET"&&f.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}})}}const a=new Map(e.entities.map(u=>[u.modelId,u.name||u.modelId]));for(const u of tp(e)){const m=[...u,u[0]].map(f=>a.get(f)??f).join(" → ");for(const f of u)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:f,params:{path:m}})}if(t!=null&&t.flagEntitiesWithoutRelations){const u=new Set;for(const f of e.associations)u.add(f.end1.entityRef),u.add(f.end2.entityRef);const m=new Map(e.entities.map(f=>[f.name,f.modelId]));for(const f of e.entities){for(const p of f.attributes)p.embedded&&(u.add(f.modelId),u.add(p.embedded.embeddableRef));if(!Nt(f.superClass)){u.add(f.modelId);const p=m.get(f.superClass);p&&u.add(p)}}for(const f of e.entities)u.has(f.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:f.modelId})}return o}function np(){return"postgres"}function ns(e,t="postgres",o){return lp(e,o)}const No=e=>e==null||e.trim()==="";function er(e){return[...e.attributes].filter(t=>t.attrType!=="DIVIDER"&&!t.transient).sort((t,o)=>t.order-o.order)}function op(e){return e.entities.filter(t=>t.stereotype!=="JPA_EMBEDDABLE")}function os(e){var t;return((t=e.table)==null?void 0:t.physicalName)||e.name}const ip={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 ap(e){const t=e.dataType;if(e.autoIncrement){if(t==="BIGINT")return"bigserial";if(t==="SMALLINT")return"smallserial";if(t==="INTEGER")return"serial"}return t==="NUMERIC"||t==="DECIMAL"?e.length==null?"numeric":e.scale!=null?`numeric(${e.length}, ${e.scale})`:`numeric(${e.length})`:t==="CHAR"||t==="NCHAR"?e.length!=null?`char(${e.length})`:"char":t==="VARCHAR"||t==="NVARCHAR"?e.length!=null?`varchar(${e.length})`:"varchar":ip[t]??t.toLowerCase()}function rp(e,t,o){const i=[];for(const a of er(e))a.dbAttrs.forEach((r,l)=>{if(r.sharedColumnRef!=null)return;const s=fi(a,r,l,t,o);No(s)||i.push({attr:a,col:r,name:s})});return i}function lp(e,t){const o=op(e),i=new Map,a=new Map,r=new Map;for(const u of e.entities)for(const m of u.attributes)i.set(m.modelId,u),m.dbAttrs.forEach((f,p)=>{const y=fi(m,f,p,e,t);p===0&&a.set(m.modelId,y),r.set(f.modelId,y)});const l=[],s=[],c=[];for(const u of o){const m=os(u),f=rp(u,e,t);if(f.length===0)continue;const p=f.map(({attr:b,col:N,name:h})=>{const k=[` ${h} ${ap(N)}`];return b.notNull&&!b.identifier&&k.push("NOT NULL"),N.unique&&k.push("UNIQUE"),k.join(" ")}),y=er(u).filter(b=>b.identifier).map(b=>a.get(b.modelId)).filter(b=>!No(b));y.length&&p.push(` PRIMARY KEY (${y.join(", ")})`),l.push(`CREATE TABLE ${m} (
|
|
1
|
+
(function(Ee,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):(Ee=typeof globalThis<"u"?globalThis:Ee||self,t(Ee.EntityModeler={},Ee.Vue,Ee.OpenBlueseaCore))})(this,(function(Ee,t,ie){"use strict";var OT=Object.defineProperty;var LT=(Ee,t,ie)=>t in Ee?OT(Ee,t,{enumerable:!0,configurable:!0,writable:!0,value:ie}):Ee[t]=ie;var Xe=(Ee,t,ie)=>LT(Ee,typeof t!="symbol"?t+"":t,ie);const Sf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function $f(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 Bl(e,n,o={}){const i={...Sf,...o},a=new Map(e.entities.map(h=>[h.modelId,h])),r=new Map(e.associations.map(h=>[h.modelId,h])),l=new Map(n.entityLayouts.map(h=>[h.entityRef,h])),s=new Map(n.associationLayouts.map(h=>[h.associationRef,h])),c=n.entityLayouts.map(h=>h.entityRef).filter(h=>!a.has(h)),d=n.associationLayouts.map(h=>h.associationRef).filter(h=>!r.has(h)),u=new Map;for(const h of e.groups)for(const E of h.memberEntityRefs)u.set(E,h.modelId);const m=new Map;for(const h of n.groupLayouts)for(const E of h.memberNoteRefs??[])m.set(E,h.groupRef);let f=0;const p=e.entities.map(h=>{const E=u.get(h.modelId),D=l.get(h.modelId);if(D){const H={location:{x:D.geo.location.x,y:D.geo.location.y},size:{width:D.geo.size.width,height:D.geo.size.height}};return{entity:h,geo:H,collapsed:D.collapsed??!1,locked:D.locked??!1,groupRef:E,style:D.style,attributeStyles:D.attributeStyles,operationStyles:D.operationStyles}}const $=$f(f++,i);return{entity:h,geo:$,collapsed:!1,locked:!1,groupRef:E}}),y=new Map(n.groupLayouts.map(h=>[h.groupRef,h])),g=e.groups.map(h=>{const E=y.get(h.modelId),D=E?{location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:h,geo:D,style:E==null?void 0:E.style,locked:(E==null?void 0:E.locked)??!1}}),_=e.associations.map(h=>{const E=s.get(h.modelId);return{association:h,waypoints:(E==null?void 0:E.waypoints)??[],sourceColumnRef:E==null?void 0:E.sourceColumnRef,targetColumnRef:E==null?void 0:E.targetColumnRef}}),b=n.notes.map(h=>({note:{...h,geo:{location:{x:h.geo.location.x,y:h.geo.location.y},size:{width:h.geo.size.width,height:h.geo.size.height}}},groupRef:m.get(h.modelId)})),N=[];for(const h of n.notes)for(const E of h.connections??[])a.has(E.targetRef)&&N.push({noteRef:h.modelId,targetRef:E.targetRef,waypoints:E.waypoints.map(D=>({x:D.x,y:D.y}))});return{entities:p,associations:_,groups:g,notes:b,noteConnections:N,prunedEntityRefs:c,prunedAssociationRefs:d}}function ho(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 On=.5;function Dl(e,n,o,i,a,r){const l=ho(n),s=ho(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 f=e;const p=(_,b)=>{(Math.abs(_.x-f.x)>=On||Math.abs(_.y-f.y)>=On)&&(m.push({a:f,b:_,seg:b}),f=_)};p(c,0);let y=l.x!==0,g=c;for(let _=1;_<u.length;_++){const b=u[_],N=_<=o.length?_-1:o.length,h=Math.abs(b.x-g.x)<On,E=Math.abs(b.y-g.y)<On;h&&E||(h?(p(b,N),y=!1):E?(p(b,N),y=!0):y?(p({x:g.x,y:b.y},N),p(b,N),y=!0):(p({x:b.x,y:g.y},N),p(b,N),y=!1),g=b)}return p(i,o.length),m}function La(e,n,o,i,a,r=20){const l=Dl(e,n,o,i,a,r);let s=`M ${dt(e.x)},${dt(e.y)}`;for(const c of l)s+=` L ${dt(c.b.x)},${dt(c.b.y)}`;return s}const Rf=14;function Pa(e,n,o,i,a,r=20){return Dl(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=Rf).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function dt(e){return Math.round(e*100)/100}const Af=36;function Ol(e,n,o=Af){const i=Math.max(e.x,n.x)+o;return`M ${dt(e.x)},${dt(e.y)} L ${dt(i)},${dt(e.y)} L ${dt(i)},${dt(n.y)} L ${dt(n.x)},${dt(n.y)}`}function za(e,n,o){const i=[e,...n,o];let a=`M ${dt(i[0].x)},${dt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${dt(i[r].x)},${dt(i[r].y)}`;return a}function Tf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ua(e,n){const o=Tf(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<On&&Math.abs(l)<On)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 Fa(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 Ha(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 Vf={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ll(e,n,o={}){const i={...Vf,...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),f=m?m.location:{x:0,y:0},p=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((p-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,_)=>{const b=_%y,N=Math.floor(_/y);r.push({id:g,location:{x:f.x+i.pad+b*i.cellWidth,y:f.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const f=m%i.ungroupedCols,p=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+f*i.cellWidth,y:d+p*i.cellHeight}})}),r}const Pl={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function zl(e,n={}){const o={...Pl,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Ga(e,n={}){const o={...Pl,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=zl(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}}})}const si="inherited:";function Ul(e,n){return`${si}${e}:${n}`}function yo(e){return e.startsWith(si)}function ja(e){if(!yo(e))return null;const n=e.slice(si.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function go(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Ul(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})):[]}function ci(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}}function Fl(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 Hl(e){var r,l,s;const n=new Map(e.entities.map(c=>[c.modelId,c.name])),o=new Map;for(const c of e.entities)for(const d of c.attributes)o.set(d.modelId,d.name);const 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(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const m=[...c.attributes].sort((p,y)=>p.order-y.order);for(const p of m){if(p.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${p.name?` ${p.name} ${"─".repeat(8)}`:""}`);continue}const y=p.dbAttrs[0],g=y!=null&&y.length?`(${y.length}${y.scale!=null?`,${y.scale}`:""})`:"",_=y?` → ${y.physicalName} ${y.dataType}${g}`:"",b=[p.identifier?"PK":"",p.notNull?"NOT NULL":"",y!=null&&y.unique?"UNIQUE":"",y!=null&&y.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${p.name}: ${p.type}${_}${b.length?` {${b.join(", ")}}`:""}`)}for(const p of c.indexes??[]){const y=p.columns.map(g=>{var _;return`${o.get(g.columnRef)??((_=ja(g.columnRef))==null?void 0:_.field)??g.columnRef}${g.descending?" DESC":""}`}).join(", ");a.push(` index ${p.name}${p.unique?" UNIQUE":""}: ${y}`)}const f=[...c.operations??[]].sort((p,y)=>p.order-y.order);for(const p of f){const y=p.visibility?` {${p.visibility}}`:"",g=(s=p.description)!=null&&s.ko?` — ${p.description.ko}`:"";a.push(` method ${p.name}()${y}${g}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=n.get(c.end1.entityRef)??c.end1.entityRef,u=n.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Fl(c.end1.multiplicity)} —— ${Fl(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
+
`).trim()}function Mf(e){return e==="CLASS"?"class":"er"}function Ka(e,n){return n==="class"?Pf(e):Df(e)}function bo(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function Ya(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Gl(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=bo(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 Bf(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function jl(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 Kl(e,n){return(n==="left"?{NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"}:{NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"})[e]}function Df(e){var i,a;const n=Gl(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),o=["erDiagram"];for(const r of e.entities){const l=n.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){o.push(` ${l}`);continue}o.push(` ${l} {`);for(const c of s){const d=c.dbAttrs[0],u=bo((d==null?void 0:d.dataType)||c.type,"unknown"),m=bo((d==null?void 0:d.physicalName)||c.name,"col"),f=[c.identifier?"PK":"",Bf(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),p=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",y=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,g=Ya([y,p].filter(Boolean).join(" ")),_=[` ${u} ${m}`];f&&_.push(f);let b=_.join(" ");g&&(b+=` "${g}"`),o.push(b)}o.push(" }")}for(const r of e.associations){const l=n.get(r.end1.entityRef),s=n.get(r.end2.entityRef);if(!l||!s)continue;const c=`${Kl(r.end1.multiplicity,"left")}--${Kl(r.end2.multiplicity,"right")}`,d=Ya(r.description);o.push(` ${l} ${c} ${s} : "${d}"`)}return o.join(`
|
|
3
|
+
`)}function Of(e){return e&&e!=="UNDEFINED"?e:null}function Lf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function Pf(e){const n=Gl(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=Of(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(` +${Lf(c.type)} ${bo(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${bo(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=zf(i),s=Ya(i.description),c=` ${a} "${jl(i.end1.multiplicity)}" ${l} "${jl(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function zf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function De(){return crypto.randomUUID()}const Uf={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},Ff={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function Hf(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(p=>p.trim()).filter(Boolean));let d,u,m;if(i!=null){const p=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(p){d=Number(p[1]),p[2]!=null&&(u=Number(p[2]));const y=i.slice(0,p.index).trim();y&&(m=y)}else i.trim()&&(m=i.trim())}const f={modelId:De(),physicalName:s,dataType:l};return d!=null&&(f.length=d),u!=null&&(f.scale=u),c.has("UK")&&(f.unique=!0),m&&(f.logicalName={ko:m}),{modelId:De(),name:s,type:l,attrType:c.has("FK")?"RELATION_OWN":"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[f]}}function Yl(e){const n=e.split(`
|
|
5
|
+
`),o=[],i=new Map,a=[],r=c=>{const d=i.get(c);if(d)return d;const u={modelId:De(),name:c,stereotype:"JPA_ENTITY",table:{physicalName:c},attributes:[]};return o.push(u),i.set(c,u),u};let l=null;for(const c of n){const d=c.trim();if(!d||d==="erDiagram"||d.startsWith("%%"))continue;if(l){if(d==="}"){l=null;continue}const f=Hf(d,l.attributes.length);f&&l.attributes.push(f);continue}const u=d.match(/^(\S+)\s*\{$/);if(u){l=r(u[1]);continue}const m=d.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(m&&/--|\.\./.test(m[2])){const[f,p]=m[2].split(/--|\.\./);let y=(m[4]??"").trim();const g=y.match(/^"([^"]*)"$/);g&&(y=g[1]),a.push({left:m[1],right:m[3],cardL:f??"",cardR:p??"",label:y});continue}/^\S+$/.test(d)&&r(d)}const s=a.map(c=>{const d=r(c.left),u=r(c.right);return{modelId:De(),description:c.label||void 0,end1:{entityRef:d.modelId,multiplicity:Uf[c.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:u.modelId,multiplicity:Ff[c.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return{modelId:De(),entities:o,associations:s,groups:[]}}function Wl(e){const n=Yl(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Ga(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const ql={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"}},Gf=Object.keys(ql).sort((e,n)=>n.length-e.length),Xl=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,Ln=`${Xl}(?:\\.${Xl})*`,jf=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Ln})\s*\(([\s\S]*)\)\s*$`,"i"),Kf=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Ln})\s*\(([^)]*)\)`,"i"),Yf=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${Ln})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Ln})\s*\(([^)]*)\)`,"i"),Wf=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Ln})\s+ON\s+(${Ln})\s*\(([^)]*)\)`,"i");function bt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function dn(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 qf(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=bt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const _ of Gf)if(a.startsWith(_)){const b=ql[_];r=b.dataType,l=!!b.autoIncrement;let N=i.slice(_.length);const h=N.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);h&&(s=Number(h[1]),h[2]!=null&&(c=Number(h[2])),N=N.slice(h[0].length)),d=N,u=!0;break}if(!u){const _=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);_&&(r=_[1].toUpperCase(),_[2]!=null&&(s=Number(_[2])),_[3]!=null&&(c=Number(_[3])),d=_[4]??"")}const m=d.toUpperCase(),f=/\bPRIMARY\s+KEY\b/.test(m),p=f||/\bNOT\s+NULL\b/.test(m),y=/\bUNIQUE\b/.test(m),g={modelId:De(),physicalName:o,dataType:r};return s!=null&&(g.length=s),c!=null&&(g.scale=c),y&&(g.unique=!0),l&&(g.autoIncrement=!0),{primaryKey:f,attr:{modelId:De(),name:o,type:r,attrType:"NORMAL",identifier:f,notNull:p,order:0,dbAttrs:[g]}}}function Xf(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function Jl(e){const n=e.match(/\(([^)]*)\)/);return n?dn(n[1]).map(bt):[]}function Wa(e){const n=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(d=>d.trim()).filter(Boolean);for(const d of c){const u=d.match(jf);if(!u)continue;const m=bt(u[1]),f=u[2],p={modelId:De(),name:m,stereotype:"JPA_ENTITY",table:{physicalName:m},attributes:[]},y=new Map,g=[];let _=0;for(const b of dn(f)){if(Xf(b)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(b))g.push(...Jl(b));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(b))for(const E of Jl(b)){const D=y.get(E.toLowerCase());D!=null&&D.dbAttrs[0]&&(D.dbAttrs[0].unique=!0)}const h=b.match(Kf);h&&l.push({childTable:m,childCols:dn(h[1]).map(bt),parentTable:bt(h[2]),parentCols:dn(h[3]).map(bt)});continue}const N=qf(b);if(!N){n.push(`컬럼 정의 해석 실패: ${b.slice(0,40)}`);continue}N.attr.order=_++,p.attributes.push(N.attr),y.set(N.attr.name.toLowerCase(),N.attr)}for(const b of g){const N=y.get(b.toLowerCase());N&&(N.identifier=!0,N.notNull=!0)}o.push(p),i.set(m.toLowerCase(),p);for(const[b,N]of y)a.set(`${m.toLowerCase()}.${b}`,N)}for(const d of c){const u=d.match(Yf);u&&l.push({childTable:bt(u[1]),childCols:dn(u[2]).map(bt),parentTable:bt(u[3]),parentCols:dn(u[4]).map(bt)})}for(const d of l){const u=i.get(d.childTable.toLowerCase()),m=i.get(d.parentTable.toLowerCase());if(!u||!m){n.push(`FK 대상 테이블 없음: ${d.childTable}→${d.parentTable}`);continue}const f={modelId:De(),end1:{entityRef:m.modelId,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:u.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};d.childCols.forEach((p,y)=>{const g=a.get(`${d.childTable.toLowerCase()}.${p.toLowerCase()}`),_=a.get(`${d.parentTable.toLowerCase()}.${(d.parentCols[y]??"").toLowerCase()}`);g&&(g.attrType="RELATION_OWN",g.derivedFrom={associationRef:f.modelId,sourceAttributeRef:(_==null?void 0:_.modelId)??""},y===0&&(f.end2.attributeRef=g.modelId))}),r.push(f)}for(const d of c){const u=d.match(Wf);if(!u)continue;const m=bt(u[3]),f=i.get(m.toLowerCase());if(!f){n.push(`인덱스 대상 테이블 없음: ${m}`);continue}const y=dn(u[4]).map(_=>bt(_.replace(/\s+(ASC|DESC)$/i,""))).map(_=>{var b,N;return(N=(b=a.get(`${m.toLowerCase()}.${_.toLowerCase()}`))==null?void 0:b.dbAttrs[0])==null?void 0:N.modelId}).filter(_=>!!_).map(_=>({columnRef:_,descending:!1}));if(!y.length)continue;const g={modelId:De(),name:bt(u[2]),unique:!!u[1],columns:y};f.indexes=[...f.indexes??[],g]}return{logical:{modelId:De(),entities:o,associations:r,groups:[]},warnings:n}}function Zl(e){const{logical:n}=Wa(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Ga(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const Jf=["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"],Zf=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"]),Qf=Jf.filter(e=>!Zf.has(e)),ep={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function qa(e){return ep[e]??e}const tp=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),_o=new Set(["NUMERIC","DECIMAL"]);function Ql(e,n=Qf){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const Rt="CustomType",Pn="GroupCodeEnum",Xa="String",di=[{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:Pn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Rt,label:"CustomType"}],np=new Map(di.map(e=>[e.value,e.label]));function zn(e){return np.get(e)??e}const op=new Set([Pn,"CustomMoneyType"]),es=di.filter(e=>!op.has(e.value)).map(e=>e.value===Rt?{...e,label:"CustomType (사용자정의)"}:e);function ts(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=[...es,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:zn(e)},...i]:i}function ip(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Ja(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 Za(e,n,o){var i;return n.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&n.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${zn(n.type)}>`:ip(n)?zn(n.type):e==="CLASS"?n.type===Rt&&n.customType||zn(n.type):qa(((i=n.dbAttrs[0])==null?void 0:i.dataType)??"")}function ui(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 un(e,n){return ui(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function mn(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Un(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const Eo=63;function mi(e){if(!e)return null;const n=e.length;return n>Eo?n:null}function ns(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Nt(e){return!e||e.trim()===""}function ko(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function ap(e){const n=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const m=n.get(u.end1.entityRef)??[];m.push(u.end2.entityRef),n.set(u.end1.entityRef,m)}const o=0,i=1,a=2,r=new Map,l=[],s=[],c=new Set,d=u=>{r.set(u,i),l.push(u);for(const m of n.get(u)??[]){const f=r.get(m)??o;if(f===o)d(m);else if(f===i){const p=l.slice(l.indexOf(m)),y=[...p].sort().join(" ");c.has(y)||(c.add(y),s.push(p))}}l.pop(),r.set(u,a)};for(const u of e.entities)(r.get(u.modelId)??o)===o&&d(u.modelId);return s}function fi(e,n,o,i,a){var r,l,s,c,d;if(!Nt(n.physicalName))return n.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(u=>u.type===e.type))==null?void 0:l.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const m=(d=i.entities.find(f=>f.modelId===u))==null?void 0:d.attributes.flatMap(f=>f.dbAttrs)[o];return(m==null?void 0:m.physicalName)??""}return n.physicalName??""}function Qa(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 os(e,n){var r,l,s,c,d;const o=[];for(const u of Qa(e.entities,m=>m.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{name:u.name}});for(const u of e.entities){const m=u.attributes.filter(h=>h.attrType!=="DIVIDER");if(Nt(u.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:u.modelId}),u.stereotype==="JPA_ENTITY"&&!u.abstractClass&&(m.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:u.modelId}),Nt((r=u.table)==null?void 0:r.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:u.modelId})),u.stereotype==="JPA_EMBEDDABLE")for(const h of m.filter(E=>E.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(E=>E.identifier&&E.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m)if(!h.identifier)for(const E of h.dbAttrs)!E.autoIncrement&&Nt(E.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:E.modelId,contextRef:u.modelId,params:E.autoIncrement?{name:h.name}:{name:h.name,seq:E.sequenceName??""}});for(const h of m.filter(E=>E.naturalId&&E.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(E=>E.naturalId&&E.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(E=>E.naturalId&&!E.notNull&&!E.identifier&&!E.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});!u.abstractClass&&m.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:u.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&m.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:u.modelId,params:{count:m.length,threshold:n.largeEntityThreshold}});for(const h of Qa(m,E=>E.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m)Nt(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId});const f=m.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),p=m.flatMap(h=>h.dbAttrs.map((E,D)=>({col:E,name:fi(h,E,D,e,n)})).filter(E=>E.col.sharedColumnRef==null));for(const h of Qa(p,E=>E.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of f){const E=mi(h.physicalName);E!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{max:Eo,len:E}}),n!=null&&n.reservedWords&&!Nt(h.physicalName)&&n.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.physicalName}}),n!=null&&n.selectableDataTypes&&!Nt(h.dataType)&&!n.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{dataType:h.dataType}}),!Nt(h.dataType)&&tp.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{dataType:h.dataType}})}if((l=n==null?void 0:n.embeddableCatalog)!=null&&l.length){const h=mn(un(u,e.entities));for(const E of m){if(E.attrType!=="EMBED_PREDEF")continue;const D=n.embeddableCatalog.find($=>$.type===E.type);D&&E.dbAttrs.forEach(($,H)=>{if($.sharedColumnRef==null)return;const j=D.fields[H],v=h.get($.sharedColumnRef);if(!j||!v)return;(v.dataType!==j.dataType||(v.length??null)!==(j.length??null)||(v.scale??null)!==(j.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:$.modelId,contextRef:u.modelId,params:{targetType:ns(v),metaName:j.name,metaType:ns(j)}})})}}for(const h of m){const E=h.dbAttrs[0];if(!(E!=null&&E.multiValue))continue;h.type===Pn&&E.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:E.modelId,contextRef:u.modelId,params:{type:h.type||"",dataType:E.dataType||""}})}const y=(s=u.table)==null?void 0:s.physicalName,g=mi(y);g!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{max:Eo,len:g}}),n!=null&&n.reservedWords&&!Nt(y)&&n.reservedWords.has(y.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{name:y}});const _=new Set;for(const h of u.attributes){_.add(h.modelId);for(const E of h.dbAttrs)_.add(E.modelId)}const b=new Set(go(u,(n==null?void 0:n.superClassCatalog)??[]).map(h=>h.modelId)),N=(((c=n==null?void 0:n.superClassCatalog)==null?void 0:c.length)??0)>0;for(const h of u.indexes??[]){const E=mi(h.name);E!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:{max:Eo,len:E}}),n!=null&&n.reservedWords&&!Nt(h.name)&&n.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const D of h.columns){const $=D.columnRef;if(_.has($)||b.has($))continue;const H=yo($);H&&!N||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:H?{name:h.name,field:((d=ja($))==null?void 0:d.field)??$}:{name:h.name}})}}}const i=new Map;for(const u of e.entities)for(const m of u.attributes)m.attrType==="EMBED_OWN"&&m.embedded&&i.set(m.embedded.associationRef,m);for(const u of e.associations){ko(u.end1.multiplicity)&&ko(u.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:u.modelId}),i.has(u.modelId)&&u.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:u.modelId});for(const m of["end1","end2"]){const f=u[m].jpa;if(!f)continue;const p=f.cascadeTypes??[],y=p.includes("ALL"),g=p.includes("REMOVE");y&&p.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.orphanRemoval&&(g||y)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:u.modelId,params:{which:m,cascade:y?"ALL":"REMOVE"}}),ko(u[m].multiplicity)&&f.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.orphanRemoval&&ko(u[m==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:u.modelId,params:{which:m}}),!ko(u[m].multiplicity)&&(f.collectionType||f.collectionTable||f.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.collectionType==="SET"&&f.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}})}}const a=new Map(e.entities.map(u=>[u.modelId,u.name||u.modelId]));for(const u of ap(e)){const m=[...u,u[0]].map(f=>a.get(f)??f).join(" → ");for(const f of u)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:f,params:{path:m}})}if(n!=null&&n.flagEntitiesWithoutRelations){const u=new Set;for(const f of e.associations)u.add(f.end1.entityRef),u.add(f.end2.entityRef);const m=new Map(e.entities.map(f=>[f.name,f.modelId]));for(const f of e.entities){for(const p of f.attributes)p.embedded&&(u.add(f.modelId),u.add(p.embedded.embeddableRef));if(!Nt(f.superClass)){u.add(f.modelId);const p=m.get(f.superClass);p&&u.add(p)}}for(const f of e.entities)u.has(f.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:f.modelId})}return o}function rp(){return"postgres"}function is(e,n="postgres",o){return up(e,o)}const No=e=>e==null||e.trim()==="";function er(e){return[...e.attributes].filter(n=>n.attrType!=="DIVIDER"&&!n.transient).sort((n,o)=>n.order-o.order)}function lp(e){return e.entities.filter(n=>n.stereotype!=="JPA_EMBEDDABLE")}function as(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name}const sp={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 cp(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":sp[n]??n.toLowerCase()}function dp(e,n,o){const i=[];for(const a of er(e))a.dbAttrs.forEach((r,l)=>{if(r.sharedColumnRef!=null)return;const s=fi(a,r,l,n,o);No(s)||i.push({attr:a,col:r,name:s})});return i}function up(e,n){const o=lp(e),i=new Map,a=new Map,r=new Map;for(const u of e.entities)for(const m of u.attributes)i.set(m.modelId,u),m.dbAttrs.forEach((f,p)=>{const y=fi(m,f,p,e,n);p===0&&a.set(m.modelId,y),r.set(f.modelId,y)});const l=[],s=[],c=[];for(const u of o){const m=as(u),f=dp(u,e,n);if(f.length===0)continue;const p=f.map(({attr:b,col:N,name:h})=>{const E=[` ${h} ${cp(N)}`];return b.notNull&&!b.identifier&&E.push("NOT NULL"),N.unique&&E.push("UNIQUE"),E.join(" ")}),y=er(u).filter(b=>b.identifier).map(b=>a.get(b.modelId)).filter(b=>!No(b));y.length&&p.push(` PRIMARY KEY (${y.join(", ")})`),l.push(`CREATE TABLE ${m} (
|
|
6
6
|
${p.join(`,
|
|
7
7
|
`)}
|
|
8
|
-
);`);const g=new Map;for(const b of er(u)){const N=b.derivedFrom;if(!N)continue;const h=a.get(b.modelId),
|
|
8
|
+
);`);const g=new Map;for(const b of er(u)){const N=b.derivedFrom;if(!N)continue;const h=a.get(b.modelId),E=i.get(N.sourceAttributeRef),D=a.get(N.sourceAttributeRef);if(No(h)||!E||No(D))continue;const $=g.get(N.associationRef)??{childCols:[],parentTable:as(E),parentCols:[]};$.childCols.push(h),$.parentCols.push(D),g.set(N.associationRef,$)}let _=0;for(const b of g.values()){const N=`fk_${m}_${b.parentTable}${g.size>1?`_${++_}`:""}`;s.push(`ALTER TABLE ${m} ADD CONSTRAINT ${N} FOREIGN KEY (${b.childCols.join(", ")}) REFERENCES ${b.parentTable} (${b.parentCols.join(", ")});`)}for(const b of u.indexes??[]){const N=b.columns.map(E=>r.get(E.columnRef)).filter(E=>!No(E));if(!N.length)continue;const h=b.name||`ix_${m}_${N.join("_")}`;c.push(`CREATE ${b.unique?"UNIQUE ":""}INDEX ${h} ON ${m} (${N.join(", ")});`)}}return[l.join(`
|
|
9
9
|
|
|
10
10
|
`),s.join(`
|
|
11
11
|
`),c.join(`
|
|
12
12
|
`)].filter(u=>u.length).join(`
|
|
13
13
|
|
|
14
|
-
`)}const tr="entity-modeler-diagram",nr=1;class fn extends Error{constructor(
|
|
14
|
+
`)}const tr="entity-modeler-diagram",nr=1;class fn extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function rs(e,n){return JSON.stringify({format:tr,version:nr,logical:e,layout:n},null,2)}const pi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Fn=e=>Array.isArray(e)?e:[];function ls(e){let n;try{n=JSON.parse(e)}catch{throw new fn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!pi(n))throw new fn("최상위가 객체가 아닙니다.");if(n.format!==tr)throw new fn(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>nr)throw new fn(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!pi(o)||!Array.isArray(o.entities))throw new fn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!pi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new fn("엔티티 골격(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:Fn(o.associations),groups:Fn(o.groups)},a=pi(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Fn(a.entityLayouts),associationLayouts:Fn(a.associationLayouts),groupLayouts:Fn(a.groupLayouts),notes:Fn(a.notes)};return{logical:i,layout:r}}const mp=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function _t(e){return e.replace(mp,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Le(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function ss(e){return`<text ${[`x="${Le(e.x)}"`,`y="${Le(e.y)}"`,`fill="${_t(e.fill)}"`,`font-size="${Le(e.fontSize)}"`,e.fontFamily?`font-family="${_t(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${_t(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${_t(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${_t(e.text)}</text>`}function fp(e){return`<line x1="${Le(e.x1)}" y1="${Le(e.y)}" x2="${Le(e.x2)}" y2="${Le(e.y)}" stroke="${_t(e.stroke)}" stroke-width="${Le(e.strokeWidth??1)}" />`}function pp(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 hp(e,n,o,i,a){return[`M${Le(e+a.tl)},${Le(n)}`,`L${Le(e+o-a.tr)},${Le(n)}`,a.tr?`Q${Le(e+o)},${Le(n)} ${Le(e+o)},${Le(n+a.tr)}`:"",`L${Le(e+o)},${Le(n+i-a.br)}`,a.br?`Q${Le(e+o)},${Le(n+i)} ${Le(e+o-a.br)},${Le(n+i)}`:"",`L${Le(e+a.bl)},${Le(n+i)}`,a.bl?`Q${Le(e)},${Le(n+i)} ${Le(e)},${Le(n+i-a.bl)}`:"",`L${Le(e)},${Le(n+a.tl)}`,a.tl?`Q${Le(e)},${Le(n)} ${Le(e+a.tl)},${Le(n)}`:"","Z"].filter(Boolean).join(" ")}function or(e){const n=pp(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${_t(e.fill)}"`,`stroke="${_t(e.stroke)}"`,`stroke-width="${Le(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${_t(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Le(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${hp(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Le(e.x)}" y="${Le(e.y)}" width="${Le(e.w)}" height="${Le(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(fp(l));for(const l of e.texts)r.push(ss(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function yp(e){const o=[`<path ${[`d="${_t(e.d)}"`,'fill="none"',`stroke="${_t(e.stroke)}"`,`stroke-width="${Le(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${_t(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(ss(i));return`<g>${o.join("")}</g>`}function cs(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Le(n)}" y="${Le(o)}" width="${Le(i)}" height="${Le(a)}" fill="${_t(e.background)}" />`);for(const l of e.groups)r.push(or(l));for(const l of e.edges)r.push(yp(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="${Le(n)} ${Le(o)} ${Le(i)} ${Le(a)}" width="${Le(i)}" height="${Le(a)}">`+r.join("")+"</svg>"}function ir(e,n){var r,l,s;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}const Hn="javax.persistence",qe={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"},hi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function gp(e){if(!e)return;if(hi[e])return{simpleName:e,fqn:hi[e]};const n=Object.entries(hi).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function bp(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&&a.push(Np(l,e,o))}return a}class ds{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(`${Hn}.${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(`
|
|
15
15
|
`)+`
|
|
16
|
-
`}}function cs(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function hp(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(t,o)=>o.toUpperCase()):""}function Hn(e,t){t&&(e.import(We.lombokGetter),e.line(" @Getter"))}const yp=["ko","en","ja","zh"];function ar(e,t){if(!e)return[];const o=yp.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${t} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${t}/**`,`${t} * <ul>`,...o,`${t} * </ul>`,`${t} */`]}function yi(e,t,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...di,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Ln){if(i){const c=[`${Fn}.Enumerated`,`${Fn}.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:[`${Fn}.Enumerated`,`${Fn}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===Rt){const c=fp(t),d=c?`CustomType '${t}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${t??"(미지정)"}`;return{...a,type:t||"Object",fillIns:[d]}}if(e==="CustomMoneyType")return{type:"Money",primitive:!1,imports:["net.g1project.bluecomm.money.Money",`${Fn}.Convert`],fieldAnnotations:["@Convert(converter = net.g1project.bluecomm.money.MoneyAttributeConverter.class)"],fillIns:[]};const s=hi[e];if(s)return{type:e,primitive:!1,imports:[s,We.jdbcTypeCode,We.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 ds(e){return e.attributes.filter(t=>t.identifier&&(t.attrType==="NORMAL"||t.attrType==="RELATION_OWN")).sort((t,o)=>t.order-o.order)}function rr(e,t,o,i=new Set){if(e.attrType!=="RELATION_OWN")return yi(e.type,e.customType,o,e.groupCode).type;const a=t.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return yi(e.type,e.customType,o).type;const r=ds(a);return r.length>=2?`${a.name}PK`:r.length===1?rr(r[0],t,o,new Set([...i,a.modelId])):yi(e.type,e.customType,o).type}function gp(e,t,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!t)return!1;const i=!sr(t.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function bp(e,t,o){var K,v,T,H,C,ae;if(e.stereotype==="JPA_EMBEDDABLE")return _p(e,t,o);const i=new ss,a=e.name;let r=wo(e,t,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${gi}')`),r=gi);const l=new Map(t.entities.map(E=>[E.modelId,E])),s=r,c=Cp(e,o,i),d=new Map;for(const E of t.associations)E.end2.attributeRef&&d.set(E.end2.attributeRef,{assoc:E,role:"owner"}),E.end1.attributeRef&&E.end1.navigable&&d.set(E.end1.attributeRef,{assoc:E,role:"inverse"});const u=ds(e),m=new Set(u.filter(E=>E.attrType==="NORMAL").flatMap(E=>E.dbAttrs.map(Y=>Y.physicalName)).filter(Boolean)),f=new Set;for(const E of u)gp(E,(K=d.get(E.modelId))==null?void 0:K.assoc,m)&&f.add(E.modelId);const p=u.filter(E=>!f.has(E.modelId)),y=p.length>=2,g=p.length===1,_=`${a}PK`,b=E=>f.has(E.modelId)?"mapsId":E.identifier?"id":"none",N=o.lombok!==!1;i.jpa("Entity"),i.import(We.jsonIdentityInfo),i.import(We.jsogGenerator);const h=["@Entity"];h.push(Np(e,o,i)),h.push('@SuppressWarnings("serial")'),h.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),y&&(i.jpa("IdClass"),i.import(`${r}.${a}.${_}`),h.push(`@IdClass(${a}.${_}.class)`)),(v=e.jpaAttrs)!=null&&v.useDynamicInsert&&(h.push("@DynamicInsert"),i.import(We.dynamicInsert)),(T=e.jpaAttrs)!=null&&T.useDynamicUpdate&&(h.push("@DynamicUpdate"),i.import(We.dynamicUpdate)),(H=e.jpaAttrs)!=null&&H.useCacheable&&(h.push("@Cacheable"),i.jpa("Cacheable")),N&&(i.import(We.lombokNoArgs),i.import(We.lombokAccessLevel),h.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const E of ar((C=e.table)==null?void 0:C.logicalName,""))i.line(E);for(const E of h)i.line(E);i.line(`public class ${a}${c} {`);const k=e.attributes.filter(E=>E.attrType!=="DIVIDER").sort((E,Y)=>E.order-Y.order),P=(ae=e.jpaAttrs)!=null&&ae.useVersion?u.length?u[u.length-1].modelId:null:void 0,A=[];for(const E of k){if(E.attrType.startsWith("EMBED"))A.push(...hs(E,e,t,o,i));else if(E.attrType==="RELATION_OWN"){const Y=d.get(E.modelId);Y&&A.push(vp(E,Y.assoc,s,l,b(E),N,t,o,i))}else if(E.attrType==="RELATION_REF"){const Y=d.get(E.modelId);Y&&A.push(xp(E,Y.assoc,s,l,N,t,o,i))}else A.push(fs(E,a,o,i));E.modelId===P&&us(i,A,N)}P===null&&us(i,A,N),N||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),ms(A,i,N),y&&(i.import(We.jsonBackReference),i.import(We.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 ${_} getPK() {`),i.line(` return (${_}) HibernateBeanUtil.getPK(this);`),i.line(" }"),Sp(_,p.map(E=>({type:rr(E,t,o),name:E.name})),N,i)),i.line("}");let G;return y?G=$p(a,_,r):g&&(G=Rp(a,r,rr(p[0],t,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:G}}function us(e,t,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||t.push({type:"int",name:"dataVersion",category:0})}function ms(e,t,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;t.line(""),t.line(` public ${a.type} get${cs(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(t.import("java.util.Collections"),t.line(` return Collections.${r}(this.${a.name});`)):t.line(` return ${a.name};`),t.line(" }")}}function _p(e,t,o){var c;const i=new ss,a=e.name;let r=wo(e,t,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${gi}')`),r=gi),i.jpa("Embeddable"),i.import(We.jsonIdentityInfo),i.import(We.jsogGenerator),i.import(We.serializable);for(const d of ar((c=e.table)==null?void 0:c.logicalName,""))i.line(d);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)"),i.line(`public class ${a} implements Serializable {`);const l=e.attributes.filter(d=>d.attrType!=="DIVIDER").sort((d,u)=>d.order-u.order),s=[];for(const d of l){if(d.attrType.startsWith("EMBED")){s.push(...hs(d,e,t,o,i));continue}s.push(fs(d,a,o,i))}return ms(s,i,o.lombok!==!1),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function fs(e,t,o,i){const a=e.dbAttrs[0],r=e.name||hp(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${t}.${r}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const l=yi(e.type,e.customType,o,e.groupCode);for(const d of l.imports)i.import(d);for(const d of l.fillIns)i.fillIn(`${t}.${r}: ${d}`);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(`${t}.${r}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const d of ar(a==null?void 0:a.logicalName," "))i.line(d);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(We.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${Ip(e,a,i)}`);for(const d of l.fieldAnnotations)i.line(` ${d}`);return s?(i.line(` // TODO [손채움]: ${r} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),Hn(i,o.lombok!==!1),i.line(` private ${c} ${r} = new LinkedHashSet<>();`)):(Hn(i,o.lombok!==!1),i.line(` private ${c} ${r};`)),{type:c,name:r,category:0}}function ps(e,t,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?t.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 kp(e,t,o,i,a){const r=mn(un(t,o.entities)),l=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],u=zn(s,r);if(!d||!d.fieldName){(u||s.physicalName&&s.physicalName!==(d==null?void 0:d.defaultPhysical))&&a.fillIn(`${t.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 hs(e,t,o,i,a){var m,f,p,y;const r=t.name,l=wo(t,o,i);let s=e.type;if(e.attrType==="EMBED_OWN"){const g=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(_=>_.modelId===e.embedded.embeddableRef):void 0;if(g){s=g.name;const _=wo(g,o,i);_&&_!==l&&a.import(`${_}.${g.name}`)}}if(e.type==="Money")return[Ep(e,t,o,i,a)];const c=ps(e,o,i),d=kp(e,t,o,c,a),u=Ja(e,o.associations);if(a.line(""),u){const g=o.associations.find(P=>{var A;return P.modelId===((A=e.embedded)==null?void 0:A.associationRef)}),_=g?g.end2.entityRef===((f=e.embedded)==null?void 0:f.embeddableRef)?g.end2:g.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const b=(p=_==null?void 0:_.jpa)==null?void 0:p.collectionTable;b?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${b}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),lr(d,a);const N=u==="SET";!N&&((y=_==null?void 0:_.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${_.jpa.orderColumn}")`)),a.import(N?"java.util.Set":"java.util.List"),a.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${s}>`:`List<${s}>`,k=N?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${k};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),lr(d,a),Hn(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function Ep(e,t,o,i,a){a.jpa("Embedded"),a.import(We.compositeType),a.import(We.money),a.import(We.moneyUserType);const r=ps(e,o,i),l=mn(un(t,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var _,b;const u=((_=r[d])==null?void 0:_.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),m=zn(c,l),f=((b=r[d])==null?void 0:b.defaultPhysical)||"",p=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!p||p===f))return[];const g=[`name = "${m?m.physicalName:p||f}"`];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)"),lr(s,a),Hn(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function lr(e,t){e.length!==0&&(t.jpa("AttributeOverride"),t.jpa("AttributeOverrides"),t.jpa("Column"),t.line(" @AttributeOverrides({"),e.forEach((o,i)=>t.line(` ${o}${i<e.length-1?",":""}`)),t.line(" })"))}function Np(e,t,o){var c;o.jpa("Table");const i=((c=e.table)==null?void 0:c.physicalName)??"",a=e.indexes??[];if(a.length===0)return`@Table(name = "${i}")`;o.jpa("Index");const r=new Map;for(const d of e.attributes)for(const u of d.dbAttrs)r.set(u.modelId,u.physicalName);for(const d of go(e,t.superClassCatalog??[]))r.set(d.modelId,d.physicalName);const l=a.map(d=>{const u=[];for(const f of d.columns){const p=r.get(f.columnRef);p?u.push(p):o.fillIn(`${e.name}.@Index(${d.name}): 컬럼 참조 미해소(${f.columnRef}) — 카탈로그 확인`)}const m=d.unique?", unique = true":"";return`@Index(name = "${d.name}", columnList = "${u.join(", ")}"${m})`});if(l.length===1)return`@Table(name = "${i}", indexes = { ${l[0]} })`;const s=l.map(d=>` ${d}`).join(`,
|
|
16
|
+
`}}function us(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function _p(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function Gn(e,n){n&&(e.import(qe.lombokGetter),e.line(" @Getter"))}const Ep=["ko","en","ja","zh"];function ar(e,n){if(!e)return[];const o=Ep.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 yi(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...di,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Pn){if(i){const c=[`${Hn}.Enumerated`,`${Hn}.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:[`${Hn}.Enumerated`,`${Hn}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===Rt){const c=gp(n),d=c?`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${n??"(미지정)"}`;return{...a,type:n||"Object",fillIns:[d]}}if(e==="CustomMoneyType")return{type:"Money",primitive:!1,imports:["net.g1project.bluecomm.money.Money",`${Hn}.Convert`],fieldAnnotations:["@Convert(converter = net.g1project.bluecomm.money.MoneyAttributeConverter.class)"],fillIns:[]};const s=hi[e];if(s)return{type:e,primitive:!1,imports:[s,qe.jdbcTypeCode,qe.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 ms(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function rr(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return yi(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 yi(e.type,e.customType,o).type;const r=ms(a);return r.length>=2?`${a.name}PK`:r.length===1?rr(r[0],n,o,new Set([...i,a.modelId])):yi(e.type,e.customType,o).type}function kp(e,n,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!n)return!1;const i=!sr(n.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function Np(e,n,o){var j,v,T,F,I,le;if(e.stereotype==="JPA_EMBEDDABLE")return wp(e,n,o);const i=new ds,a=e.name;let r=wo(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${gi}')`),r=gi);const l=new Map(n.entities.map(k=>[k.modelId,k])),s=r,c=Ap(e,o,i),d=new Map;for(const k of n.associations)k.end2.attributeRef&&d.set(k.end2.attributeRef,{assoc:k,role:"owner"}),k.end1.attributeRef&&k.end1.navigable&&d.set(k.end1.attributeRef,{assoc:k,role:"inverse"});const u=ms(e),m=new Set(u.filter(k=>k.attrType==="NORMAL").flatMap(k=>k.dbAttrs.map(Y=>Y.physicalName)).filter(Boolean)),f=new Set;for(const k of u)kp(k,(j=d.get(k.modelId))==null?void 0:j.assoc,m)&&f.add(k.modelId);const p=u.filter(k=>!f.has(k.modelId)),y=p.length>=2,g=p.length===1,_=`${a}PK`,b=k=>f.has(k.modelId)?"mapsId":k.identifier?"id":"none",N=o.lombok!==!1;i.jpa("Entity"),i.import(qe.jsonIdentityInfo),i.import(qe.jsogGenerator);const h=["@Entity"];h.push(Ip(e,o,i)),h.push('@SuppressWarnings("serial")'),h.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),y&&(i.jpa("IdClass"),i.import(`${r}.${a}.${_}`),h.push(`@IdClass(${a}.${_}.class)`)),(v=e.jpaAttrs)!=null&&v.useDynamicInsert&&(h.push("@DynamicInsert"),i.import(qe.dynamicInsert)),(T=e.jpaAttrs)!=null&&T.useDynamicUpdate&&(h.push("@DynamicUpdate"),i.import(qe.dynamicUpdate)),(F=e.jpaAttrs)!=null&&F.useCacheable&&(h.push("@Cacheable"),i.jpa("Cacheable")),N&&(i.import(qe.lombokNoArgs),i.import(qe.lombokAccessLevel),h.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const k of ar((I=e.table)==null?void 0:I.logicalName,""))i.line(k);for(const k of h)i.line(k);i.line(`public class ${a}${c} {`);const E=e.attributes.filter(k=>k.attrType!=="DIVIDER").sort((k,Y)=>k.order-Y.order),D=(le=e.jpaAttrs)!=null&&le.useVersion?u.length?u[u.length-1].modelId:null:void 0,$=[];for(const k of E){if(k.attrType.startsWith("EMBED"))$.push(...gs(k,e,n,o,i));else if(k.attrType==="RELATION_OWN"){const Y=d.get(k.modelId);Y&&$.push(Sp(k,Y.assoc,s,l,b(k),N,n,o,i))}else if(k.attrType==="RELATION_REF"){const Y=d.get(k.modelId);Y&&$.push($p(k,Y.assoc,s,l,N,n,o,i))}else $.push(hs(k,a,o,i));k.modelId===D&&fs(i,$,N)}D===null&&fs(i,$,N),N||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),ps($,i,N),y&&(i.import(qe.jsonBackReference),i.import(qe.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 ${_} getPK() {`),i.line(` return (${_}) HibernateBeanUtil.getPK(this);`),i.line(" }"),Tp(_,p.map(k=>({type:rr(k,n,o),name:k.name})),N,i)),i.line("}");let H;return y?H=Vp(a,_,r):g&&(H=Mp(a,r,rr(p[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:H}}function fs(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 ps(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${us(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 wp(e,n,o){var c;const i=new ds,a=e.name;let r=wo(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${gi}')`),r=gi),i.jpa("Embeddable"),i.import(qe.jsonIdentityInfo),i.import(qe.jsogGenerator),i.import(qe.serializable);for(const d of ar((c=e.table)==null?void 0:c.logicalName,""))i.line(d);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)"),i.line(`public class ${a} implements Serializable {`);const l=e.attributes.filter(d=>d.attrType!=="DIVIDER").sort((d,u)=>d.order-u.order),s=[];for(const d of l){if(d.attrType.startsWith("EMBED")){s.push(...gs(d,e,n,o,i));continue}s.push(hs(d,a,o,i))}return ps(s,i,o.lombok!==!1),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function hs(e,n,o,i){const a=e.dbAttrs[0],r=e.name||_p(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${n}.${r}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const l=yi(e.type,e.customType,o,e.groupCode);for(const d of l.imports)i.import(d);for(const d of l.fillIns)i.fillIn(`${n}.${r}: ${d}`);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 d of ar(a==null?void 0:a.logicalName," "))i.line(d);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(qe.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${Rp(e,a,i)}`);for(const d of l.fieldAnnotations)i.line(` ${d}`);return s?(i.line(` // TODO [손채움]: ${r} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),Gn(i,o.lombok!==!1),i.line(` private ${c} ${r} = new LinkedHashSet<>();`)):(Gn(i,o.lombok!==!1),i.line(` private ${c} ${r};`)),{type:c,name:r,category:0}}function ys(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 vp(e,n,o,i,a){const r=mn(un(n,o.entities)),l=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],u=Un(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 gs(e,n,o,i,a){var m,f,p,y;const r=n.name,l=wo(n,o,i);let s=e.type;if(e.attrType==="EMBED_OWN"){const g=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(_=>_.modelId===e.embedded.embeddableRef):void 0;if(g){s=g.name;const _=wo(g,o,i);_&&_!==l&&a.import(`${_}.${g.name}`)}}if(e.type==="Money")return[xp(e,n,o,i,a)];const c=ys(e,o,i),d=vp(e,n,o,c,a),u=Ja(e,o.associations);if(a.line(""),u){const g=o.associations.find(D=>{var $;return D.modelId===(($=e.embedded)==null?void 0:$.associationRef)}),_=g?g.end2.entityRef===((f=e.embedded)==null?void 0:f.embeddableRef)?g.end2:g.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const b=(p=_==null?void 0:_.jpa)==null?void 0:p.collectionTable;b?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${b}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),lr(d,a);const N=u==="SET";!N&&((y=_==null?void 0:_.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${_.jpa.orderColumn}")`)),a.import(N?"java.util.Set":"java.util.List"),a.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${s}>`:`List<${s}>`,E=N?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${E};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),lr(d,a),Gn(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function xp(e,n,o,i,a){a.jpa("Embedded"),a.import(qe.compositeType),a.import(qe.money),a.import(qe.moneyUserType);const r=ys(e,o,i),l=mn(un(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var _,b;const u=((_=r[d])==null?void 0:_.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),m=Un(c,l),f=((b=r[d])==null?void 0:b.defaultPhysical)||"",p=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!p||p===f))return[];const g=[`name = "${m?m.physicalName:p||f}"`];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)"),lr(s,a),Gn(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function lr(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 Ip(e,n,o){var c;o.jpa("Table");const i=((c=e.table)==null?void 0:c.physicalName)??"",a=e.indexes??[];if(a.length===0)return`@Table(name = "${i}")`;o.jpa("Index");const r=new Map;for(const d of e.attributes)for(const u of d.dbAttrs)r.set(u.modelId,u.physicalName);for(const d of go(e,n.superClassCatalog??[]))r.set(d.modelId,d.physicalName);const l=a.map(d=>{const u=[];for(const f of d.columns){const p=r.get(f.columnRef);p?u.push(p):o.fillIn(`${e.name}.@Index(${d.name}): 컬럼 참조 미해소(${f.columnRef}) — 카탈로그 확인`)}const m=d.unique?", unique = true":"";return`@Index(name = "${d.name}", columnList = "${u.join(", ")}"${m})`});if(l.length===1)return`@Table(name = "${i}", indexes = { ${l[0]} })`;const s=l.map(d=>` ${d}`).join(`,
|
|
17
17
|
`);return`@Table(name = "${i}", indexes = {
|
|
18
18
|
${s}
|
|
19
|
-
})`}function sr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function
|
|
19
|
+
})`}function sr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Cp(e,n,o){var r;const i=o.get(n.end1.entityRef);if(e.derivedFrom){const l=i==null?void 0:i.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef);if(l!=null&&l.dbAttrs[0])return l.dbAttrs[0].physicalName}const a=i==null?void 0:i.attributes.find(l=>l.identifier&&l.dbAttrs.length>0);return(r=a==null?void 0:a.dbAttrs[0])==null?void 0:r.physicalName}function bs(e,n,o,i,a){if(!e)return;const r=wo(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function Sp(e,n,o,i,a,r,l,s,c){var N,h;const d=i.get(n.end1.entityRef),u=(d==null?void 0:d.name)??n.end1.entityRef,m=sr(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),bs(d,o,l,s,c);const f=n.end2.jpa,p=[];e.notNull&&p.push("optional = false"),f!=null&&f.fetchType&&(c.jpa("FetchType"),p.push(`fetch = FetchType.${f.fetchType}`)),(N=f==null?void 0:f.cascadeTypes)!=null&&N.length&&(c.jpa("CascadeType"),p.push(`cascade = { ${f.cascadeTypes.map(E=>`CascadeType.${E}`).join(", ")} }`));const y=e.dbAttrs[0];c.jpa("JoinColumn");const g=Cp(e,n,i),_=(y==null?void 0:y.physicalName)||g||"",b=[];return _?b.push(`name = "${_}"`):c.fillIn(`${((h=i.get(n.end2.entityRef))==null?void 0:h.name)??""}.${e.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),g&&b.push(`referencedColumnName = "${g}"`),e.notNull&&b.push("nullable = false"),(y==null?void 0:y.insertable)===!1&&b.push("insertable = false"),(y==null?void 0:y.updatable)===!1&&b.push("updatable = false"),c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${p.length?`(${p.join(", ")})`:""}`),c.line(` @JoinColumn(${b.join(", ")})`),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),Gn(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function $p(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;bs(c,o,r,l,s);const u=c==null?void 0:c.attributes.find(D=>D.modelId===n.end2.attributeRef),m=(u==null?void 0:u.name)??"",f=sr(n.end2.multiplicity);if(s.line(""),!f)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),Gn(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const p=n.end1.jpa,y=n.end1.composition||n.end2.composition;let g=(p==null?void 0:p.cascadeTypes)??[],_=p==null?void 0:p.orphanRemoval;y&&g.length===0&&(g=["ALL"],_==null&&(_=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const b=[`mappedBy = "${m}"`];g.length&&(s.jpa("CascadeType"),b.push(`cascade = { ${g.map(D=>`CascadeType.${D}`).join(", ")} }`)),_&&b.push("orphanRemoval = true"),p!=null&&p.fetchType&&(s.jpa("FetchType"),b.push(`fetch = FetchType.${p.fetchType}`)),s.line(` @OneToMany(${b.join(", ")})`),p!=null&&p.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${p.orderBy}")`));const N=(p==null?void 0:p.collectionType)==="SET";s.import(N?"java.util.Set":"java.util.List"),s.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${d}>`:`List<${d}>`,E=N?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${h} ${e.name} = ${E};`),{type:h,name:e.name,category:1,collection:!0}}function Rp(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=_o.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 Ap(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 Tp(e,n,o,i){i.import(qe.serializable),i.import(qe.objects),i.import(qe.jsonUtils),o&&i.import(qe.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${us(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 Vp(e,n,o){const i=[`${o}.${e}`,`${o}.${e}.${n}`,qe.jpaRepository,qe.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(`
|
|
20
20
|
`)+`
|
|
21
|
-
`}}function
|
|
21
|
+
`}}function Mp(e,n,o){const i=[`${n}.${e}`,qe.jpaRepository,qe.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(`
|
|
22
22
|
`)+`
|
|
23
|
-
`}}const gi="com.example",Ap="command.domain";function wo(e,t,o={}){if(e.packageName)return e.packageName;const i=o.packageConfig;if(i!=null&&i.basePackage){const a=t.groups.find(c=>{var d;return(d=c.memberEntityRefs)==null?void 0:d.includes(e.modelId)}),r=a!=null&&a.packageName?`.${a.packageName}`:"",l=i.layerSuffix??Ap,s=l?`.${l}`:"";return`${i.basePackage}${r}${s}`}return t.packageName||""}const Tp="CustomMoneyType",Vp="Money";function Mp(e){return!(e.type!==Tp||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Bp(e){const t=e.dbAttrs[0]??{modelId:De(),physicalName:"",dataType:""},o={modelId:De(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Vp,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Dp(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Mp(l)?(a=!0,t=!0,Bp(l)):l);return a?{...i,attributes:r}:i});return t?{...e,entities:o}:e}function gs(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function bs(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(gs);if(!i.length)continue;const a=o.filter(s=>!gs(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),t.attributes=l}}function Gn(e){return JSON.parse(JSON.stringify(e))}function _s(e,t,o){var K;const i=o.idFactory??De,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(t);if(o.includeRelated){const v=new Set(t);for(const T of r.associations){const H=v.has(T.end1.entityRef),C=v.has(T.end2.entityRef);H!==C&&s.add(H?T.end2.entityRef:T.end1.entityRef)}}const c=r.entities.filter(v=>s.has(v.modelId)),d=new Set(c.map(v=>v.modelId)),u=r.associations.filter(v=>d.has(v.end1.entityRef)&&d.has(v.end2.entityRef)),m=new Set(u.map(v=>v.modelId)),f=new Map,p=v=>{let T=f.get(v);return T||(T=i(),f.set(v,T)),T};for(const v of c){p(v.modelId);for(const T of v.attributes){p(T.modelId);for(const H of T.dbAttrs)p(H.modelId)}for(const T of v.indexes??[])p(T.modelId);for(const T of v.operations??[])p(T.modelId)}for(const v of u)p(v.modelId);const y=v=>f.get(v),g=c.map(v=>{const T=Gn(v);T.modelId=y(v.modelId),T.attributes=T.attributes.map(H=>Op(H,y,m,d));for(const H of T.indexes??[])H.modelId=y(H.modelId),H.columns=H.columns.map(C=>yo(C.columnRef)?C:{...C,columnRef:y(C.columnRef)}).filter(C=>C.columnRef!==void 0);for(const H of T.operations??[])H.modelId=y(H.modelId);return T});bs(g);const _=u.map(v=>{const T=Gn(v);return T.modelId=y(v.modelId),T.end1=ks(T.end1,y),T.end2=ks(T.end2,y),T}),b=[];for(const v of r.groups){const T=v.memberEntityRefs.filter(C=>d.has(C));if(T.length===0)continue;const H=Gn(v);H.modelId=p(v.modelId),H.memberEntityRefs=T.map(C=>y(C)),b.push(H)}const N=o.collisionSuffix??"_imported",h=new Set(o.existing.entities.map(v=>v.name)),k=new Set(o.existing.entities.map(v=>{var T;return(T=v.table)==null?void 0:T.physicalName}).filter(v=>!!v));for(const v of g)h.has(v.name)&&(v.name=`${v.name}${N}`),(K=v.table)!=null&&K.physicalName&&k.has(v.table.physicalName)&&(v.table.physicalName=`${v.table.physicalName}${N}`);const P=[];for(const v of l.entityLayouts){const T=y(v.entityRef);if(!T)continue;const H=Gn(v);H.entityRef=T,H.geo={...H.geo,location:cr(H.geo.location,a)},H.attributeStyles&&(H.attributeStyles=bi(H.attributeStyles,y)),H.operationStyles&&(H.operationStyles=bi(H.operationStyles,y)),P.push(H)}const A=[];for(const v of l.associationLayouts){const T=y(v.associationRef);if(!T)continue;const H=Gn(v);H.associationRef=T,H.sourceColumnRef=v.sourceColumnRef?y(v.sourceColumnRef):void 0,H.targetColumnRef=v.targetColumnRef?y(v.targetColumnRef):void 0,H.waypoints=H.waypoints.map(C=>cr(C,a)),A.push(H)}const G=[];for(const v of l.groupLayouts){const T=y(v.groupRef);if(!T)continue;const H=Gn(v);H.groupRef=T,H.geo={...H.geo,location:cr(H.geo.location,a)},delete H.memberNoteRefs,G.push(H)}return{logical:{entities:g,associations:_,groups:b},layout:{entityLayouts:P,associationLayouts:A,groupLayouts:G},idMap:f}}function cr(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Op(e,t,o,i){e.modelId=t(e.modelId);for(const a of e.dbAttrs)if(a.modelId=t(a.modelId),a.sharedColumnRef!==void 0){const r=t(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:t(e.derivedFrom.associationRef),sourceAttributeRef:t(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:t(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:t(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function ks(e,t){return{...e,entityRef:t(e.entityRef),attributeRef:e.attributeRef?t(e.attributeRef):void 0}}function bi(e,t){const o={};for(const[i,a]of Object.entries(e)){const r=t(i);r&&(o[r]=a)}return o}function dr(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function jn(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,i)=>jn(o,t[i]));if(typeof e=="object"&&typeof t=="object"){const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o)if(!jn(e[i],t[i]))return!1;return!0}return!1}function pn(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const r of a)o.has(r)||jn(e[r],t[r])||(i[r]=t[r]===void 0?null:t[r]);return Object.keys(i).length?i:null}function hn(e,t,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(t.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 Lp(e,t){const o=new Set(e),i=new Set(t),a=t.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const Pp=new Set(["attributes","operations","indexes","rev"]),zp=new Set(["end1","end2","rev"]),Up=new Set(["memberEntityRefs","rev"]),Es=new Set(["modelId"]),Fp=new Set(["modelId","columns"]),Hp=new Set([]);function Gp(e,t,o,i){const a=hn(t.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=pn(s,c,Es);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=hn(t.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=pn(s,c,Es);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=hn(t.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!jn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=pn(s,c,Fp);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function jp(e,t,o){const i=hn(e.entities??[],t.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:dr(l)});for(const{cur:l,tgt:s}of i.common){const c=pn(l,s,Pp);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Gp(l.modelId,l,s,o)}const a=hn(e.associations??[],t.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:dr(l)});for(const{cur:l,tgt:s}of a.common){const c=pn(l,s,zp);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=pn(l[d]??{},s[d]??{},Hp);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=hn(e.groups??[],t.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:dr(l)});for(const{cur:l,tgt:s}of r.common){const c=pn(l,s,Up);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Lp(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 _i(e,t,o,i,a,r,l){const s=hn(e,t,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)jn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function Kp(e,t,o){_i(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),_i(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),_i(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),_i(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Yp(e,t){const o=[];return jp(e.logical,t.logical,o),Kp(e.layout,t.layout,o),o}function Wp(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 qp={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 Xp{constructor(t){qe(this,"out",[]);qe(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...vo(t),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(t,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...vo(t),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({...vo(t),field:a,value:void 0,removed:!0});continue}this.out.push({...vo(t),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(t,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...vo(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function vo(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function At(e,t,o,i){if(o==null||typeof o!="object")return;const a=qp[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(t,r,l)}function yn(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function ur(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Zt(e,t){var r,l,s,c,d,u,m,f;const o=Wp(t),i=new Xp(t.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==t.entityRef)break;y.kind==="entity.add"?At(i,p,y.value,"entity"):y.kind==="entity.update"?yn(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((r=y.value)==null?void 0:r.attributes,t.attributeRef);g&&At(i,p,g,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===t.attributeRef?At(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===t.attributeRef?yn(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===t.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((s=y.value)==null?void 0:s.operations,t.operationRef);g&&At(i,p,g,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===t.operationRef?At(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===t.operationRef?yn(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===t.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((d=y.value)==null?void 0:d.indexes,t.indexRef);g&&At(i,p,g,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===t.indexRef?At(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===t.indexRef?yn(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===t.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==t.associationRef)break;y.kind==="association.add"?At(i,p,y.value,"association"):y.kind==="association.update"?yn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==t.associationRef)break;if(y.kind==="association.add"){const g=(m=y.value)==null?void 0:m[t.end];At(i,p,g,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===t.end?yn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==t.groupRef)break;if(y.kind==="group.add"){At(i,p,y.value,"group");const g=(f=y.value)==null?void 0:f.memberEntityRefs;if(Array.isArray(g))for(const _ of g)i.member(p,_,!1)}else y.kind==="group.update"?yn(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}function Jp(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function Kn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function Zp(e,t){const o=new Set,i=new Set,a=new Set;for(const r of e)for(const l of r.ops){const s=l;if(l.kind==="entity.add"&&s.entityRef===t){const c=s.value;Kn(c==null?void 0:c.attributes,o),Kn(c==null?void 0:c.operations,i),Kn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(l.kind==="attribute.add"?Kn([s.value],o):l.kind==="attribute.update"||l.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):l.kind==="operation.add"?Kn([s.value],i):l.kind==="operation.update"||l.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):l.kind==="index.add"?Kn([s.value],a):(l.kind==="index.update"||l.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function ki(e,t){return e.map(o=>({...o,subject:t}))}function Ns(e,t){const o=e.filter(s=>s.ops.some(c=>Jp(c,t))),{attributes:i,operations:a,indexes:r}=Zp(o,t),l=[...ki(Zt(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)l.push(...ki(Zt(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...ki(Zt(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...ki(Zt(o,{entityRef:t,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 ws(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Qp(e){var i,a,r;const t=new Set,o=(l,s)=>{typeof s=="string"&&t.add(`${l}:${s}:`)};for(const l of e)for(const s of l.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const u of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",u.modelId);for(const u of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(r=c.value)==null?void 0:r.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return t}function eh(e){const t=new Set,o=new Set,i=new Set;for(const a of e)for(const r of a.ops){const l=r,s=r.kind;if(s.startsWith("entity."))typeof l.entityRef=="string"&&t.add(l.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=l.containerRef??l.entityRef;typeof c=="string"&&t.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof l.associationRef=="string"&&o.add(l.associationRef):s.startsWith("group.")&&typeof l.groupRef=="string"&&i.add(l.groupRef)}return{entities:t,associations:o,groups:i}}function th(e){const{entities:t,associations:o,groups:i}=eh(e),a=[];for(const r of t)for(const l of Ns(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Zt(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Zt(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Zt(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function vs(e){const t=th(e),o=Qp(e),i=new Map;for(const l of t){const s=ws(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 t){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=ws(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)}class mr{constructor(t){qe(this,"undoStack",[]);qe(this,"redoStack",[]);qe(this,"savePoint",null);qe(this,"listeners",new Set);qe(this,"commandListeners",new Set);qe(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"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.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const a of this.commandListeners)a(t,o,i)}}function xs(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function ot(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function wt(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Xe(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function zt(e,t,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function Ei(e,t,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:t,...o})},invert(i){const a=xs(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=ot(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:t,...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 Is(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=xs(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=ot(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})}),t={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(f=>f.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(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...t.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of t.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],a=[];for(const r of t.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 t.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 t.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 t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:a.reverse()}}}}function Cs(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Xe(i,e);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(i){Object.assign(Xe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function Ss(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Xe(i,e);o=a.name,a.name=t},invert(i){Xe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function Yn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...t}},invert(i){const a=ot(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(t)],invert:[i(o)]}}}}function $s(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...t}},invert(i){const a=ot(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(t)],invert:[i(o)]}}}}function xo(e,t){const o={...(e==null?void 0:e.properties)??{}};return t?o.swatch=t:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function Rs(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=xo(r.style,t)},invert(i){const a=ot(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=ot(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 As(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=t},invert(i){const a=ot(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(t)],invert:[i(o)]}}}}function Ts(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=t},invert(i){const a=ot(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(t)],invert:[i(o)]}}}}function fr(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=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=t[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:t[l]}})}),{forward:i,invert:a}}}}function Ni(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const r=ot(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=xo(s[t],o);c?s[t]=c:delete s[t],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=ot(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=ot(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 wi(e,t,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:t,...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:t,...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 Vs(e,t){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(t))o[l]=r[l];Object.assign(r,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Ms(e){let t=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);t={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){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function Bs(e,t){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(t)&&(r.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(t))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function vi(e,t){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(t))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function Ds(e,t){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={...t}},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(t)],invert:[i(o)]}}}}function Os(e,t){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={...t}},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(t)],invert:[i(o)]}}}}function Ls(e,t){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=xo(a.style,t)},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 Ps(e,t){let o;return{label:t?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=t},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(t)],invert:[i(o)]}}}}function Ut(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Xe(o,e).attributes.push(t)},invert(o){const i=Xe(o,e),a=i.attributes.findIndex(r=>r.modelId===t.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function gn(e,t,o){const i={},a=r=>{const l=Xe(r,e).attributes.find(s=>s.modelId===t);if(!l)throw new Error(`속성 없음: ${t}`);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:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function Wn(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Xe(i,e),r=a.attributes.findIndex(l=>l.modelId===t);if(r<0)throw new Error(`속성 없음: ${t}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&Xe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function pr(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Xe(a,e);i=r.attributes.map(m=>({...m}));const l=new Set(t),s=r.attributes.filter(m=>l.has(m.modelId)),c=r.attributes.filter(m=>!l.has(m.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];r.attributes.splice(0,r.attributes.length,...u),r.attributes.forEach((m,f)=>m.order=f)},invert(a){i&&Xe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Xe(a,e).attributes.map(l=>({...l}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:r}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function zs(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Xe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var l;const a=Xe(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===t.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:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function Us(e,t,o){const i={},a=r=>{var s;const l=(s=Xe(r,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!l)throw new Error(`메서드 없음: ${t}`);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:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function Fs(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Xe(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(r<0)throw new Error(`메서드 없음: ${t}`);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=Xe(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:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Hs(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Xe(a,e),l=r.operations??[];i=l.map(f=>({...f}));const s=new Set(t),c=l.filter(f=>s.has(f.modelId)),d=l.filter(f=>!s.has(f.modelId)),u=Math.max(0,Math.min(o,d.length)),m=[...d.slice(0,u),...c,...d.slice(u)];l.splice(0,l.length,...m),l.forEach((f,p)=>f.order=p),r.operations=l},invert(a){if(!i)return;const r=Xe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=(Xe(a,e).operations??[]).map(l=>({...l}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:r}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Gs(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const r=ot(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=xo(s[t],o);c?s[t]=c:delete s[t],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=ot(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=ot(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 xi(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},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:t,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 js(e){let t=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);t={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){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Ii(e,t){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(t))o[l]=r[l];Object.assign(r,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function Qt(e,t,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[t]};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:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function Ks(e,t){return{label:"인덱스 추가",apply(o){const i=Xe(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var r;const i=Xe(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===t.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function Ys(e,t,o){const i={},a=r=>{var s;const l=(s=Xe(r,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!l)throw new Error(`인덱스 없음: ${t}`);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:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function Ws(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Xe(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===t))??-1;if(r<0)throw new Error(`인덱스 없음: ${t}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&Xe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Tt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Io=(e,t)=>{var o;return((o=wt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function qs(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=wt(a,e);if(!r||!r.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...r.waypoints[t]},r.waypoints.splice(t,1,{...o})},invert(a){const r=wt(a,e);r&&i&&r.waypoints.splice(t,1,i)},emitOps(a){const r=Io(a,e),l=r.map((s,c)=>c===t&&i?{...i}:s);return{forward:[Tt(e,r)],invert:[Tt(e,l)]}}}}function Xs(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=wt(i,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...a.waypoints[t]},a.waypoints.splice(t,1)},invert(i){const a=wt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=Io(i,e),r=a.slice();return o&&r.splice(t,0,{...o}),{forward:[Tt(e,a)],invert:[Tt(e,r)]}}}}function Js(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=wt(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+t,y:l.y+o}))},invert(a){const r=wt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Tt(e,Io(a,e))],invert:[Tt(e,i??[])]}}}}function Zs(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=wt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=wt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[Tt(e,Io(o,e))],invert:[Tt(e,t??[])]}}}}function Qs(e,t,o){return{label:"waypoint 추가",apply(i){const a=wt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=wt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=Io(i,e),r=a.slice();return r.splice(t,1),{forward:[Tt(e,a)],invert:[Tt(e,r)]}}}}function ec(e){return{label:"노트 추가",apply(t){t.layout.notes.push(e)},invert(t){const o=t.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&t.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 tc(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Co(e,t){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={...t}},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(t)],invert:[i(o)]}}}}function nc(e,t){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={...t}},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(t)],invert:[i(o)]}}}}function oc(e,t){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=t},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(t)],invert:[i(o)]}}}}function ic(e,t){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=xo(a.style,t)},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 ac(e,t){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(t)&&(l.memberNoteRefs.push(t),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(t);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function rc(e,t){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(t))??-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,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const en=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Ci=(e,t,o)=>{var i;return((i=zt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function lc(e,t){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===t)){o=!1;return}r.connections.push({targetRef:t,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===t);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function sc(e,t){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===t))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${t}`);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:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function cc(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(r){const l=zt(r,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=zt(r,e,t);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Ci(r,e,t),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[en(e,t,l)],invert:[en(e,t,s)]}}}}function dc(e,t,o,i){return{label:"waypoint 추가",apply(a){const r=zt(a,e,t);if(!r)throw new Error(`노트 연결 없음: ${e}→${t}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=zt(a,e,t);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Ci(a,e,t),l=r.slice();return l.splice(o,1),{forward:[en(e,t,r)],invert:[en(e,t,l)]}}}}function uc(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const r=zt(a,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=zt(a,e,t);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Ci(a,e,t),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[en(e,t,r)],invert:[en(e,t,l)]}}}}function mc(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=zt(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=zt(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[en(e,t,Ci(i,e,t))],invert:[en(e,t,o??[])]}}}}function Je(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const a of t)a.apply(i)},invert(i){for(let a=t.length-1;a>=0;a--)t[a].invert(i)},emitOps(i){const a=t.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 nh=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:xi,addAttribute:Ut,addEntity:Ei,addEntityToGroup:Bs,addGroup:wi,addIndex:Ks,addNote:ec,addNoteConnection:lc,addNoteConnectionWaypoint:dc,addNoteToGroup:ac,addOperation:zs,addWaypoint:Qs,clearNoteConnectionWaypoints:mc,clearWaypoints:Zs,composite:Je,moveEntity:Yn,moveGroup:Ds,moveNote:Co,moveNoteConnectionWaypoint:cc,moveWaypoint:qs,removeAssociation:js,removeAttribute:Wn,removeEntity:Is,removeEntityFromGroup:vi,removeGroup:Ms,removeIndex:Ws,removeNote:tc,removeNoteConnection:sc,removeNoteConnectionWaypoint:uc,removeNoteFromGroup:rc,removeOperation:Fs,removeWaypoint:Xs,renameEntity:Ss,reorderAttributes:pr,reorderOperations:Hs,resizeEntity:$s,resizeGroup:Os,resizeNote:nc,setAllEntitiesCollapsed:fr,setAttributeSwatch:Ni,setEntityCollapsed:As,setEntityLocked:Ts,setEntitySwatch:Rs,setGroupLocked:Ps,setGroupSwatch:Ls,setNoteMemo:oc,setNoteSwatch:ic,setOperationSwatch:Gs,translateWaypoints:Js,updateAssociation:Ii,updateAssociationEnd:Qt,updateAttribute:gn,updateEntity:Cs,updateGroup:Vs,updateIndex:Ys,updateOperation:Us},Symbol.toStringTag,{value:"Module"}));class fc{constructor(){qe(this,"revs",new Map);qe(this,"layoutVersion",0);qe(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class pc{constructor(t){qe(this,"cache",new fc);qe(this,"newClientOpId");qe(this,"debounceMs");qe(this,"emissions",new WeakMap);qe(this,"open",null);qe(this,"debounceHandle",null);qe(this,"queue",[]);qe(this,"sending",!1);qe(this,"_frozen",!1);qe(this,"stack",null);qe(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??De,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===t&&(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(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var l;if(this._frozen)return;let a;if(o==="do"){const s=(l=t.emitOps)==null?void 0:l.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);a=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);a=s}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=r,this.emissions.set(t,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,a),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((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(t){const o={},i=new Set;let a=!1,r=!1;for(const l of t)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:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(r){this.sending=!1,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",r),(a=(i=this.opts).onError)==null||a.call(i,r),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const hc=["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","group.add"],yc=()=>crypto.randomUUID(),oh=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,ih=e=>e&&e[0].toLowerCase()+e.slice(1),ah=e=>e&&e[0].toUpperCase()+e.slice(1),rh=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function lh(e,t){return ih(e)+ah(t)}function sh(e,t){const o=e.entities.find(l=>l.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(l=>l.identifier&&(l.attrType==="NORMAL"||l.attrType==="RELATION_OWN")).sort((l,s)=>l.order-s.order).map(l=>{const s=lh(o.name,l.name);return{associationRef:t.modelId,sourceAttributeRef:l.modelId,name:s,type:l.type,identifier:a,notNull:a,dbAttrs:l.dbAttrs.map(c=>({physicalName:rh(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Si=(e,t)=>`${e}::${t}`,$i=e=>e??void 0;function ch(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||$i(s.length)!==$i(r.length)||$i(s.scale)!==$i(r.scale)}))&&(i.dbAttrs=t.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 dh(e,t,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:t,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function So(e,t,o=yc){const i={add:[],update:[],remove:[]},a=e.entities.find(m=>m.modelId===t);if(!a)return i;const r=e.associations.filter(m=>m.end2.entityRef===t),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(m=>sh(e,m)),s=new Map(l.map(m=>[Si(m.associationRef,m.sourceAttributeRef),m])),c=a.attributes.filter(m=>m.derivedFrom),d=new Map(c.map(m=>[Si(m.derivedFrom.associationRef,m.derivedFrom.sourceAttributeRef),m]));for(const m of c){const f=Si(m.derivedFrom.associationRef,m.derivedFrom.sourceAttributeRef);s.has(f)||i.remove.push(m.modelId)}let u=a.attributes.reduce((m,f)=>Math.max(m,f.order),-1)+1;for(const m of l){const f=Si(m.associationRef,m.sourceAttributeRef),p=d.get(f);if(!p)i.add.push(dh(m,u++,o));else{const y=ch(p,m,o);y&&i.update.push({attributeId:p.modelId,patch:y})}}return i}function uh(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function mh(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function fh(e,t,o=yc){const i=new Map,a=mh(e),r=new Set,l=[t];for(;l.length;){const s=l.shift();if(r.has(s))continue;r.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=So(a,d,o);if(oh(u))continue;i.has(d)||i.set(d,u);const m=a.entities.find(f=>f.modelId===d);m&&uh(m,u),r.has(d)||l.push(d)}}return i}function Ri(e,t,o){var l;const i=e.entities.find(s=>s.modelId===t),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)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===t&&s.end1.attributeRef===o||s.end2.entityRef===t&&s.end2.attributeRef===o)}function ph(e,t){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===t.ref}),i=()=>e.entities.filter(r=>r.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function hh(e,t){const o=()=>e.attributes.filter(r=>r.name===t.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const a=o();return a.length?a:i()}function gc(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function mt(e,t){const o=ph(e,t);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 yh(e,t){const o=hh(e,t);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 gh(e,t){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===t.ref),i=()=>e.attributes.filter(r=>r.name===t.ref).flatMap(r=>r.dbAttrs);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function bh(e,t){const o=gh(e,t);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 bc(e,t){const o=e.filter(i=>i.physicalName===t.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 _h(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function kh(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Eh(e,t){const o=_h(e,t);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 Nh(e,t){const o=kh(e,t);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 _c(e,t,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:t,...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 kc(e,t,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),m=[];let f=!1;for(const p of t.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const g={ref:y.sharedColumnPhysicalName,by:"physicalName"},_=bc(un(i,a),g);if(!_.ok){s.push(_.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:_.matches}),f=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return f?null:{modelId:d,name:e.name,type:t.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}}function wh(e,t,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,f)=>{const p=t.fields[f],y=p?c.get(p.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},b=bc(un(i,a),_);if(!b.ok){s.push(b.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:b.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function Ec(e,t,o){return{modelId:o(),name:e.name,order:t,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Nc(e,t,o,i,a,r){const l=[];let s=!1;for(const c of t.columns){const d=bh(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:t.name,unique:t.unique??!1,columns:l,...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{}}}function vh(e,t,o={}){const i=o.mkId??De,a=o.embeddableCatalog??[],r=m=>a.find(f=>f.type===m),l=[],s=[],c=new Map,d=new Map,u=new Set;for(const m of t)m.kind==="entity.add"&&(u.add(m.spec.name),m.spec.physicalName&&u.add(m.spec.physicalName));return t.forEach((m,f)=>{var p,y,g,_;switch(m.kind){case"entity.add":{const b=i(),N={modelId:b,name:m.spec.name,stereotype:m.spec.stereotype??"JPA_ENTITY",attributes:[],...m.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...m.spec.physicalName?{table:{physicalName:m.spec.physicalName}}:{}},h={ref:m.spec.name};let k=!1;for(const[G,K]of(m.spec.attributes??[]).entries()){if(K.type==="GroupCodeEnum"&&!K.groupCode){s.push({code:"groupcode-required",opIndex:f,entity:h,handle:{ref:K.name}}),k=!0;continue}const v=r(K.type);if(v){const T=kc(K,v,G,N,e.entities,f,h,s,i);T?N.attributes.push(T):k=!0}else(p=K.embeddableOverrides)!=null&&p.length?(s.push({code:"embeddable-type-unresolved",opIndex:f,entity:h,handle:{ref:K.name}}),k=!0):N.attributes.push(_c(K,G,i))}const P=(m.spec.operations??[]).map((G,K)=>Ec(G,K,i));P.length&&(N.operations=P);const A=[];for(const G of m.spec.indexes??[]){const K=Nc(N,G,f,h,s,i);K?A.push(K):k=!0}if(A.length&&(N.indexes=A),k)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:N});break}case"entity.update":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}l.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:m.patch});break}case"entity.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}l.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}if(m.spec.type==="GroupCodeEnum"&&!m.spec.groupCode){s.push({code:"groupcode-required",opIndex:f,entity:m.entity,handle:{ref:m.spec.name}});break}const N=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,N+1);const h=r(m.spec.type);let k;if(h)k=kc(m.spec,h,N,b.value,e.entities,f,m.entity,s,i);else if((y=m.spec.embeddableOverrides)!=null&&y.length){s.push({code:"embeddable-type-unresolved",opIndex:f,entity:m.entity,handle:{ref:m.spec.name}});break}else k=_c(m.spec,N,i);if(!k)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:k});break}case"attribute.update":case"attribute.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=yh(b.value,m.attribute);if(!N.ok){s.push(N.reason==="not-found"?{code:"attribute-not-found",opIndex:f,entity:m.entity,handle:m.attribute}:{code:"attribute-ambiguous",opIndex:f,entity:m.entity,handle:m.attribute,matches:N.matches});break}if(m.kind==="attribute.update"){let h=m.patch;if((g=m.embeddableOverrides)!=null&&g.length){const k=r(N.value.type);if(!k||N.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:f,entity:m.entity,handle:m.attribute});break}const P=wh(N.value,k,m.embeddableOverrides,b.value,e.entities,f,m.entity,s);if(!P)break;h={...m.patch,dbAttrs:P}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:N.value.modelId,patch:h})}else l.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:N.value.modelId});break}case"association.add":{const b=mt(e,m.spec.from),N=mt(e,m.spec.to);if(b.ok||s.push(ft(b.reason,f,m.spec.from,b.matches,u)),N.ok||s.push(ft(N.reason,f,m.spec.to,N.matches,u)),!b.ok||!N.ok)break;if(m.spec.identifying&&b.value.modelId===N.value.modelId){s.push({code:"self-identifying",opIndex:f,handle:{from:m.spec.from,to:m.spec.to}});break}const h=i(),k={modelId:h,...m.spec.identifying!=null?{identifying:m.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:m.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:N.value.modelId,multiplicity:m.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:m.spec.composition??!1}},P={...e,associations:[...e.associations,k]},A=So(P,N.value.modelId,i);A.add[0]&&(k.end2.attributeRef=A.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:h,value:k});for(const G of A.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:N.value.modelId,entityRef:N.value.modelId,value:G});break}case"association.remove":{const b=mt(e,m.association.from),N=mt(e,m.association.to);if(b.ok||s.push(ft(b.reason,f,m.association.from,b.matches,u)),N.ok||s.push(ft(N.reason,f,m.association.to,N.matches,u)),!b.ok||!N.ok)break;const h=gc(e,b.value.modelId,N.value.modelId);if(h.length!==1){s.push(h.length===0?{code:"association-not-found",opIndex:f,handle:m.association}:{code:"association-ambiguous",opIndex:f,handle:m.association,matches:h.map(k=>k.modelId)});break}l.push({kind:"association.remove",casUnit:"logical",associationRef:h[0].modelId});break}case"association.update":{const b=wc(e,m.association,f,s,u);if(!b)break;l.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:m.patch});break}case"associationEnd.update":{const b=wc(e,m.association,f,s,u);if(!b)break;const N=m.end==="from"?"end1":"end2";l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:N,patch:m.patch});break}case"index.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Nc(b.value,m.spec,f,m.entity,s,i);if(!N)break;l.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.modelId,value:N});break}case"index.update":case"index.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Eh(b.value,m.index);if(!N.ok){s.push(N.reason==="not-found"?{code:"index-not-found",opIndex:f,entity:m.entity,handle:m.index}:{code:"index-ambiguous",opIndex:f,entity:m.entity,handle:m.index,matches:N.matches});break}if(m.kind==="index.update"){if("columns"in m.patch){s.push({code:"index-columns-patch-unsupported",opIndex:f,entity:m.entity,handle:m.index});break}l.push({kind:"index.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.value.modelId,patch:m.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.value.modelId});break}case"operation.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=d.get(b.value.modelId)??((_=b.value.operations)==null?void 0:_.length)??0;d.set(b.value.modelId,N+1);const h=Ec(m.spec,N,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:h.modelId,value:h});break}case"operation.update":case"operation.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Nh(b.value,m.operation);if(!N.ok){s.push(N.reason==="not-found"?{code:"operation-not-found",opIndex:f,entity:m.entity,handle:m.operation}:{code:"operation-ambiguous",opIndex:f,entity:m.entity,handle:m.operation,matches:N.matches});break}m.kind==="operation.update"?l.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.value.modelId,patch:m.patch}):l.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.value.modelId});break}case"group.add":{const b=[];let N=!1;for(const P of m.spec.members){const A=mt(e,P);if(!A.ok){s.push(ft(A.reason,f,P,A.matches,u)),N=!0;continue}b.push(A.value.modelId)}if(N)break;const h=i(),k={modelId:h,excludeDDLGeneration:m.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...m.spec.name?{name:m.spec.name}:{},...m.spec.packageName?{packageName:m.spec.packageName}:{},...m.spec.description?{description:m.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:h,value:k});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function ft(e,t,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:t,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function wc(e,t,o,i,a){const r=mt(e,t.from),l=mt(e,t.to);if(r.ok||i.push(ft(r.reason,o,t.from,r.matches,a)),l.ok||i.push(ft(l.reason,o,t.to,l.matches,a)),!r.ok||!l.ok)return null;const s=gc(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:s.map(c=>c.modelId)}),null):s[0]}const vc={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},xh={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Ih={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},Ai={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Ch={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:{...Ai,description:"속성 설명(다국어)."},columnLogicalName:{...Ai,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},Sh={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}},xc={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},$h={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...xc,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...xc,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},Rh={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...vc,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},Ah={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Ai,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Th={type:"object",properties:{name:{...Ai,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},Vh={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function lt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Mh={"entity.add":lt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":lt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":lt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":lt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":lt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":lt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":lt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":lt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":lt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":lt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":lt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":lt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":lt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":lt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":lt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":lt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":lt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Ic={anyOf:hc.map(e=>Mh[e])},Bh={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:vc,assocHandle:xh,entitySpec:Ih,attrSpec:Ch,embeddableOverrides:Sh,assocSpec:$h,indexSpec:Rh,operationSpec:Ah,groupSpec:Th,patch:Vh,symbolicOp:Ic}};function Dh(e,t,o,i={}){const a=i.mkClientOpId??De,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const Cc={location:{x:0,y:0},size:{width:220,height:140}};function Sc(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 Oh=/^[-=_*~\s]{3,}$/;function Lh(e){return e.attrType&&e.attrType!=="NORMAL"||!Oh.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Ph(e){return e.type===Rt&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function zh(e,t){if(e.attrType==="DIVIDER"||Lh(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]};const o=Ph(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??t,dbAttrs:e.dbAttrs.map(Sc)}}function Uh(e){const{modelId:t,name:o,visibility:i,sourceCode:a,description:r,order:l,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:a,description:r?{ko:r}:void 0,order:l??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Fh(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(t=>({columnRef:t.targetColumn.refId,descending:t.descending}))}}function Hh(e){var t,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(zh),operations:(t=e.operations)==null?void 0:t.map(Uh),indexes:(o=e.indexes)==null?void 0:o.map(Fh),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Gh(e){const t={};for(const i of e.attributes)i.style&&(t[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??{...Cc},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function $c(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 hr(e){var t;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(t=e.attribute)==null?void 0:t.modelId,jpa:$c(e)}}function jh(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:hr(e.end1),end2:hr(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:t,layout:o}}function Rc(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Ac(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Tc(e){var o;const t=e.attribute;return(t==null?void 0:t.attrType)==="EMBED_OWN"&&(((o=t.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function Vc(e,t){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:t,dbAttrs:(e.dbAttrs??[]).map(Sc)}}function Kh(e,t,o){var _,b;const i=Rc(e.end1.attribute),a=Rc(e.end2.attribute);if(i===a)return jh(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(b=(_=s.dbAttrs)==null?void 0:_[0])==null?void 0:b.targetModelId,d=c?o.get(c):void 0,u=t.get(l.endModel.refId),m=u?u.attributes.reduce((N,h)=>Math.max(N,h.order),-1)+1:s.order??0,f={...Vc(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(f);const p=(N,h)=>({entityRef:N.endModel.refId,multiplicity:N.multiplicity,navigable:N.navigable,composition:N.composition,attributeRef:h?d:f.modelId,legacyNavRaw:h?void 0:N.attribute,jpa:$c(N)}),y={modelId:e.modelId,description:e.description,end1:p(e.end1,i),end2:p(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:y.end1.attributeRef,targetColumnRef:y.end2.attributeRef,style:e.style};return{assoc:y,layout:g}}function Yh(e,t){const o=e.targetModelId?t.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 Wh(e,t,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=t.get(r.endModel.refId),c=s?s.attributes.reduce((g,_)=>Math.max(g,_.order),-1)+1:l.order??0,d={...Vc(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Yh(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...hr(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},f=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:f?d.modelId:void 0,targetColumnRef:f?void 0:d.modelId,style:e.style};return{assoc:m,layout:p}}function qh(e,t){var i,a,r,l;const o=[];for(const s of t){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 Mc(e,t={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=qh(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+t.x,y:a.location.y+t.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Bc(e,t,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(t.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 Xh(e){return(e.schemaVersion??1)>=2&&"logical"in e?Jh(e):Zh(e)}function Jh(e){const t=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:f,...p}=m;return f!=null&&(o[m.modelId]=f),p},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i),{version:s,...c}=e.layout;Bc(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Zh(e){var b,N;const t=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(h,k)=>{o.push(Hh(h));const P=Gh(h);P.geo={location:{x:P.geo.location.x+k.x,y:P.geo.location.y+k.y},size:P.geo.size},i.push(P);for(const A of h.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const m=[];for(const h of e.groups??[]){const k=h.entities??[];l.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:k.map(A=>A.modelId)});const P=((b=h.geo)==null?void 0:b.location)??u;if(h.geo){const A=(h.notes??[]).map(G=>G.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:A.length?A:void 0})}for(const A of k)d(A,P);for(const A of h.notes??[])m.push(Mc(A,P))}const f=new Map(o.map(h=>[h.modelId,h])),p=new Map,y=new Map;for(const h of o)for(const k of h.attributes)for(const P of k.dbAttrs)p.set(P.modelId,k.modelId),y.set(P.modelId,P);for(const h of c)for(const k of[h.end1,h.end2]){const P=k.attribute;if(P&&(((N=P.dbAttrs)==null?void 0:N.length)??0)>0)for(const A of P.dbAttrs)A.modelId&&p.set(A.modelId,P.modelId)}for(const h of c){const k=Ac(h.end1.attribute),P=Ac(h.end2.attribute),A=Tc(h.end1)||Tc(h.end2),{assoc:G,layout:K}=k!==P||A?Wh(h,f,y):Kh(h,f,p);a.push(G),r.push(K)}Bc(o,a,r),bs(o);const g={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(h=>Mc(h)),...m]}},_={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:_}}function Dc(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 Qh(e,t){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(Dc),style:t}}function ey(e,t){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:t}}function ty(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function tn(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function ny(e,t){const o=t==null?void 0:t.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{...Dc(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function oy(e){const t=new Set;for(const o of e.logical.associations){const i=o.end1.legacyNavRaw?o.end1:o.end2.legacyNavRaw?o.end2:void 0;i!=null&&i.attributeRef&&t.add(i.attributeRef)}return t}function iy(e){const t=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&t.add(i.modelId);return t}function ay(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function ry(e,t){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:ay(e.logicalName,t==null?void 0:t.logicalName)?void 0:e.logicalName,dataType:e.dataType===((t==null?void 0:t.dataType)??"")?"":e.dataType,length:o(e.length,t==null?void 0:t.length),scale:o(e.scale,t==null?void 0:t.scale),unique:o(e.unique,t==null?void 0:t.unique),autoIncrement:o(e.autoIncrement,t==null?void 0:t.autoIncrement),updatable:o(e.updatable,t==null?void 0:t.updatable),insertable:o(e.insertable,t==null?void 0:t.insertable)}}function ly(e,t,o){let i;for(const m of t.logical.entities){const f=m.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(f){i=f;break}}if(!i)return;const a=i.embedded.embeddableRef,r=t.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,f)=>ry(m,l[f]))},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:tn(e.end1,c?s:u),end2:tn(e.end2,c?u:s)}}function sy(e,t,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:tn(e.end1,e.end1.legacyEmbedRaw),end2:tn(e.end2,e.end2.legacyEmbedRaw)};const a=ly(e,t,i);if(a)return a;const r=!!e.end1.legacyNavRaw,l=!!e.end2.legacyNavRaw;if(r!==l){const s=r?e.end1:e.end2,c=r?e.end2:e.end1,d=t.logical.entities.find(y=>y.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(y=>y.modelId===s.attributeRef),m=t.logical.entities.find(y=>y.modelId===c.entityRef),f=u?ny(u,m):void 0,p=s.legacyNavRaw;return{...i,end1:tn(e.end1,r?p:f),end2:tn(e.end2,l?p:f)}}return{...i,end1:tn(e.end1),end2:tn(e.end2)}}function Oc(e,t,o,i,a={x:0,y:0}){var u,m;const r=t.layout.entityLayouts.find(f=>f.entityRef===e.modelId),l=t.logical.associations.filter(f=>f.end1.entityRef===e.modelId),s=f=>t.layout.associationLayouts.find(p=>p.associationRef===f),c=(r==null?void 0:r.geo)??{...Cc},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(f=>!o.has(f.modelId)&&!i.has(f.modelId)).map(f=>{var p;return Qh(f,(p=r==null?void 0:r.attributeStyles)==null?void 0:p[f.modelId])}),operations:(u=e.operations)==null?void 0:u.map(f=>{var p;return ey(f,(p=r==null?void 0:r.operationStyles)==null?void 0:p[f.modelId])}),ownedAssociations:l.map(f=>sy(f,t,s(f.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(ty),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 cy(e,t,o,i){const a=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>t.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=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Lc(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Oc(c,t,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 Lc(e,t={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-t.x,y:e.geo.location.y-t.y},size:e.geo.size},style:e.style,connections:e.connections}}function dy(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=oy(e),r=iy(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:t.id,diagramVersion:t.diagramVersion,version:t.version,size:t.size??e.layout.canvasSize,packageName:t.packageName??e.logical.packageName,entities:i.map(s=>Oc(s,e,a,r)),groups:e.logical.groups.map(s=>cy(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>Lc(s))}}function uy(e,t={}){var a,r,l;const o=((a=t.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((r=t.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=t.revSeed)==null?void 0:l.layoutVersion)??0}}}function $o(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Ft(e){return typeof e=="function"?e():n.unref(e)}const my=typeof window<"u"&&typeof document<"u",fy=e=>typeof e<"u",py=Object.prototype.toString,hy=e=>py.call(e)==="[object Object]",yy=()=>{};function gy(e,t){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(a).catch(r)})}return o}const Pc=e=>e();function by(e=Pc){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const a=(...r)=>{t.value&&e(...r)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:a}}function zc(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function _y(e,t,o={}){const{eventFilter:i=Pc,...a}=o;return n.watch(e,gy(i,t),a)}function qn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=by(i);return{stop:_y(e,t,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function ky(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=Ft(t.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 yr(e,t=!1){function o(m,{flush:f="sync",deep:p=!1,timeout:y,throwOnTimeout:g}={}){let _=null;const N=[new Promise(h=>{_=n.watch(e,k=>{m(k)!==t&&(_==null||_(),h(k))},{flush:f,deep:p,immediate:!0})})];return y!=null&&N.push(zc(y,g).then(()=>Ft(e)).finally(()=>_==null?void 0:_())),Promise.race(N)}function i(m,f){if(!n.isRef(m))return o(k=>k===m,f);const{flush:p="sync",deep:y=!1,timeout:g,throwOnTimeout:_}=f??{};let b=null;const h=[new Promise(k=>{b=n.watch([e,m],([P,A])=>{t!==(P===A)&&(b==null||b(),k(P))},{flush:p,deep:y,immediate:!0})})];return g!=null&&h.push(zc(g,_).then(()=>Ft(e)).finally(()=>(b==null||b(),Ft(e)))),Promise.race(h)}function a(m){return o(f=>!!f,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,f){return o(p=>{const y=Array.from(p);return y.includes(m)||y.includes(Ft(m))},f)}function d(m){return u(1,m)}function u(m=1,f){let p=-1;return o(()=>(p+=1,p>=m),f)}return Array.isArray(Ft(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return yr(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return yr(e,!t)}}}function gr(e){return yr(e)}function Ey(e){var t;const o=Ft(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Uc=my?window:void 0;function Fc(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Uc):[t,o,i,a]=e,!t)return yy;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,f,p)=>(u.addEventListener(m,f,p),()=>u.removeEventListener(m,f,p)),c=n.watch(()=>[Ey(t),Ft(a)],([u,m])=>{if(l(),!u)return;const f=hy(m)?{...m}:m;r.push(...o.flatMap(p=>i.map(y=>s(u,p,y,f))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return $o(d),d}function Ny(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Hc(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:a=Uc,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=Ny(t);return Fc(a,r,u=>{u.repeat&&Ft(s)||c(u)&&o(u)},l)}function wy(e){return JSON.parse(JSON.stringify(e))}function br(e,t,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:f}=i,p=n.getCurrentInstance(),y=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((l=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p==null?void 0:p.proxy));let g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const _=h=>s?typeof s=="function"?s(h):wy(h):h,b=()=>fy(e[t])?_(e[t]):m,N=h=>{f?f(h)&&y(g,h):y(g,h)};if(c){const h=b(),k=n.ref(h);let P=!1;return n.watch(()=>e[t],A=>{P||(P=!0,k.value=_(A),n.nextTick(()=>P=!1))}),n.watch(k,A=>{!P&&(A!==e[t]||u)&&N(A)},{deep:u}),k}else return n.computed({get(){return b()},set(h){N(h)}})}var vy={value:()=>{}};function Ti(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Vi(o)}function Vi(e){this._=e}function xy(e,t){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&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Vi.prototype=Ti.prototype={constructor:Vi,on:function(e,t){var o=this._,i=xy(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Iy(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Gc(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Gc(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Vi(e)},call:function(e,t){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(t,o)},apply:function(e,t,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(t,o)}};function Iy(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Gc(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=vy,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var _r="http://www.w3.org/1999/xhtml";const jc={svg:"http://www.w3.org/2000/svg",xhtml:_r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),jc.hasOwnProperty(t)?{space:jc[t],local:e}:e}function Cy(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===_r&&t.documentElement.namespaceURI===_r?t.createElement(e):t.createElementNS(o,e)}}function Sy(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Kc(e){var t=Mi(e);return(t.local?Sy:Cy)(t)}function $y(){}function kr(e){return e==null?$y:function(){return this.querySelector(e)}}function Ry(e){typeof e!="function"&&(e=kr(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[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 kt(i,this._parents)}function Ay(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ty(){return[]}function Yc(e){return e==null?Ty:function(){return this.querySelectorAll(e)}}function Vy(e){return function(){return Ay(e.apply(this,arguments))}}function My(e){typeof e=="function"?e=Vy(e):e=Yc(e);for(var t=this._groups,o=t.length,i=[],a=[],r=0;r<o;++r)for(var l=t[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 kt(i,a)}function Wc(e){return function(){return this.matches(e)}}function qc(e){return function(t){return t.matches(e)}}var By=Array.prototype.find;function Dy(e){return function(){return By.call(this.children,e)}}function Oy(){return this.firstElementChild}function Ly(e){return this.select(e==null?Oy:Dy(typeof e=="function"?e:qc(e)))}var Py=Array.prototype.filter;function zy(){return Array.from(this.children)}function Uy(e){return function(){return Py.call(this.children,e)}}function Fy(e){return this.selectAll(e==null?zy:Uy(typeof e=="function"?e:qc(e)))}function Hy(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[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 kt(i,this._parents)}function Xc(e){return new Array(e.length)}function Gy(){return new kt(this._enter||this._groups.map(Xc),this._parents)}function Bi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Bi.prototype={constructor:Bi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function jy(e){return function(){return e}}function Ky(e,t,o,i,a,r){for(var l=0,s,c=t.length,d=r.length;l<d;++l)(s=t[l])?(s.__data__=r[l],i[l]=s):o[l]=new Bi(e,r[l]);for(;l<c;++l)(s=t[l])&&(a[l]=s)}function Yy(e,t,o,i,a,r,l){var s,c,d=new Map,u=t.length,m=r.length,f=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=l.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new Bi(e,r[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(f[s])===c&&(a[s]=c)}function Wy(e){return e.__data__}function qy(e,t){if(!arguments.length)return Array.from(this,Wy);var o=t?Yy:Ky,i=this._parents,a=this._groups;typeof e!="function"&&(e=jy(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],f=m.length,p=Xy(e.call(u,u&&u.__data__,d,i)),y=p.length,g=s[d]=new Array(y),_=l[d]=new Array(y),b=c[d]=new Array(f);o(u,m,g,_,b,p,t);for(var N=0,h=0,k,P;N<y;++N)if(k=g[N]){for(N>=h&&(h=N+1);!(P=_[h])&&++h<y;);k._next=P||null}}return l=new kt(l,i),l._enter=s,l._exit=c,l}function Xy(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Jy(){return new kt(this._exit||this._groups.map(Xc),this._parents)}function Zy(e,t,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+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function Qy(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._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,f=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(f[y]=p);for(;c<a;++c)s[c]=o[c];return new kt(s,this._parents)}function eg(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],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 tg(e){e||(e=ng);function t(m,f){return m&&f?e(m.__data__,f.__data__):!m-!f}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(t)}return new kt(a,this._parents).order()}function ng(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function og(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ig(){return Array.from(this)}function ag(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function rg(){let e=0;for(const t of this)++e;return e}function lg(){return!this.node()}function sg(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function cg(e){return function(){this.removeAttribute(e)}}function dg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ug(e,t){return function(){this.setAttribute(e,t)}}function mg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fg(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function pg(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function hg(e,t){var o=Mi(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?dg:cg:typeof t=="function"?o.local?pg:fg:o.local?mg:ug)(o,t))}function Jc(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yg(e){return function(){this.style.removeProperty(e)}}function gg(e,t,o){return function(){this.style.setProperty(e,t,o)}}function bg(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function _g(e,t,o){return arguments.length>1?this.each((t==null?yg:typeof t=="function"?bg:gg)(e,t,o??"")):Xn(this.node(),e)}function Xn(e,t){return e.style.getPropertyValue(t)||Jc(e).getComputedStyle(e,null).getPropertyValue(t)}function kg(e){return function(){delete this[e]}}function Eg(e,t){return function(){this[e]=t}}function Ng(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function wg(e,t){return arguments.length>1?this.each((t==null?kg:typeof t=="function"?Ng:Eg)(e,t)):this.node()[e]}function Zc(e){return e.trim().split(/^|\s+/)}function Er(e){return e.classList||new Qc(e)}function Qc(e){this._node=e,this._names=Zc(e.getAttribute("class")||"")}Qc.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ed(e,t){for(var o=Er(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function td(e,t){for(var o=Er(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function vg(e){return function(){ed(this,e)}}function xg(e){return function(){td(this,e)}}function Ig(e,t){return function(){(t.apply(this,arguments)?ed:td)(this,e)}}function Cg(e,t){var o=Zc(e+"");if(arguments.length<2){for(var i=Er(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Ig:t?vg:xg)(o,t))}function Sg(){this.textContent=""}function $g(e){return function(){this.textContent=e}}function Rg(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ag(e){return arguments.length?this.each(e==null?Sg:(typeof e=="function"?Rg:$g)(e)):this.node().textContent}function Tg(){this.innerHTML=""}function Vg(e){return function(){this.innerHTML=e}}function Mg(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Bg(e){return arguments.length?this.each(e==null?Tg:(typeof e=="function"?Mg:Vg)(e)):this.node().innerHTML}function Dg(){this.nextSibling&&this.parentNode.appendChild(this)}function Og(){return this.each(Dg)}function Lg(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pg(){return this.each(Lg)}function zg(e){var t=typeof e=="function"?e:Kc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ug(){return null}function Fg(e,t){var o=typeof e=="function"?e:Kc(e),i=t==null?Ug:typeof t=="function"?t:kr(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Hg(){var e=this.parentNode;e&&e.removeChild(this)}function Gg(){return this.each(Hg)}function jg(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kg(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Yg(e){return this.select(e?Kg:jg)}function Wg(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qg(e){return function(t){e.call(this,t,this.__data__)}}function Xg(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Jg(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,r;o<a;++o)r=t[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++i]=r;++i?t.length=i:delete this.__on}}}function Zg(e,t,o){return function(){var i=this.__on,a,r=qg(t);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=t;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:t,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Qg(e,t,o){var i=Xg(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=t?Zg:Jg,a=0;a<r;++a)this.each(s(i[a],t,o));return this}function nd(e,t,o){var i=Jc(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function eb(e,t){return function(){return nd(this,e,t)}}function tb(e,t){return function(){return nd(this,e,t.apply(this,arguments))}}function nb(e,t){return this.each((typeof t=="function"?tb:eb)(e,t))}function*ob(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var od=[null];function kt(e,t){this._groups=e,this._parents=t}function Ro(){return new kt([[document.documentElement]],od)}function ib(){return this}kt.prototype=Ro.prototype={constructor:kt,select:Ry,selectAll:My,selectChild:Ly,selectChildren:Fy,filter:Hy,data:qy,enter:Gy,exit:Jy,join:Zy,merge:Qy,selection:ib,order:eg,sort:tg,call:og,nodes:ig,node:ag,size:rg,empty:lg,each:sg,attr:hg,style:_g,property:wg,classed:Cg,text:Ag,html:Bg,raise:Og,lower:Pg,append:zg,insert:Fg,remove:Gg,clone:Yg,datum:Wg,on:Qg,dispatch:nb,[Symbol.iterator]:ob};function vt(e){return typeof e=="string"?new kt([[document.querySelector(e)]],[document.documentElement]):new kt([[e]],od)}function ab(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Vt(e,t){if(e=ab(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const rb={passive:!1},Ao={capture:!0,passive:!1};function Nr(e){e.stopImmediatePropagation()}function Jn(e){e.preventDefault(),e.stopImmediatePropagation()}function id(e){var t=e.document.documentElement,o=vt(e).on("dragstart.drag",Jn,Ao);"onselectstart"in t?o.on("selectstart.drag",Jn,Ao):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ad(e,t){var o=e.document.documentElement,i=vt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Jn,Ao),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 Di=e=>()=>e;function wr(e,{sourceEvent:t,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:t,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}})}wr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function lb(e){return!e.ctrlKey&&!e.button}function sb(){return this.parentNode}function cb(e,t){return t??{x:e.x,y:e.y}}function db(){return navigator.maxTouchPoints||"ontouchstart"in this}function ub(){var e=lb,t=sb,o=cb,i=db,a={},r=Ti("start","drag","end"),l=0,s,c,d,u,m=0;function f(k){k.on("mousedown.drag",p).filter(i).on("touchstart.drag",_).on("touchmove.drag",b,rb).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(k,P){if(!(u||!e.call(this,k,P))){var A=h(this,t.call(this,k,P),k,P,"mouse");A&&(vt(k.view).on("mousemove.drag",y,Ao).on("mouseup.drag",g,Ao),id(k.view),Nr(k),d=!1,s=k.clientX,c=k.clientY,A("start",k))}}function y(k){if(Jn(k),!d){var P=k.clientX-s,A=k.clientY-c;d=P*P+A*A>m}a.mouse("drag",k)}function g(k){vt(k.view).on("mousemove.drag mouseup.drag",null),ad(k.view,d),Jn(k),a.mouse("end",k)}function _(k,P){if(e.call(this,k,P)){var A=k.changedTouches,G=t.call(this,k,P),K=A.length,v,T;for(v=0;v<K;++v)(T=h(this,G,k,P,A[v].identifier,A[v]))&&(Nr(k),T("start",k,A[v]))}}function b(k){var P=k.changedTouches,A=P.length,G,K;for(G=0;G<A;++G)(K=a[P[G].identifier])&&(Jn(k),K("drag",k,P[G]))}function N(k){var P=k.changedTouches,A=P.length,G,K;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),G=0;G<A;++G)(K=a[P[G].identifier])&&(Nr(k),K("end",k,P[G]))}function h(k,P,A,G,K,v){var T=r.copy(),H=Vt(v||A,P),C,ae,E;if((E=o.call(k,new wr("beforestart",{sourceEvent:A,target:f,identifier:K,active:l,x:H[0],y:H[1],dx:0,dy:0,dispatch:T}),G))!=null)return C=E.x-H[0]||0,ae=E.y-H[1]||0,function Y(S,W,ee){var ie=H,O;switch(S){case"start":a[K]=Y,O=l++;break;case"end":delete a[K],--l;case"drag":H=Vt(ee||W,P),O=l;break}T.call(S,k,new wr(S,{sourceEvent:W,subject:E,target:f,identifier:K,active:O,x:H[0]+C,y:H[1]+ae,dx:H[0]-ie[0],dy:H[1]-ie[1],dispatch:T}),G)}}return f.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Di(!!k),f):e},f.container=function(k){return arguments.length?(t=typeof k=="function"?k:Di(k),f):t},f.subject=function(k){return arguments.length?(o=typeof k=="function"?k:Di(k),f):o},f.touchable=function(k){return arguments.length?(i=typeof k=="function"?k:Di(!!k),f):i},f.on=function(){var k=r.on.apply(r,arguments);return k===r?f:k},f.clickDistance=function(k){return arguments.length?(m=(k=+k)*k,f):Math.sqrt(m)},f}function vr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function rd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function To(){}var Vo=.7,Oi=1/Vo,Zn="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mb=/^#([0-9a-f]{3,8})$/,fb=new RegExp(`^rgb\\(${Zn},${Zn},${Zn}\\)$`),pb=new RegExp(`^rgb\\(${Mt},${Mt},${Mt}\\)$`),hb=new RegExp(`^rgba\\(${Zn},${Zn},${Zn},${Mo}\\)$`),yb=new RegExp(`^rgba\\(${Mt},${Mt},${Mt},${Mo}\\)$`),gb=new RegExp(`^hsl\\(${Mo},${Mt},${Mt}\\)$`),bb=new RegExp(`^hsla\\(${Mo},${Mt},${Mt},${Mo}\\)$`),ld={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};vr(To,bn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sd,formatHex:sd,formatHex8:_b,formatHsl:kb,formatRgb:cd,toString:cd});function sd(){return this.rgb().formatHex()}function _b(){return this.rgb().formatHex8()}function kb(){return pd(this).formatHsl()}function cd(){return this.rgb().formatRgb()}function bn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=mb.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?dd(t):o===3?new ht(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Li(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Li(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=fb.exec(e))?new ht(t[1],t[2],t[3],1):(t=pb.exec(e))?new ht(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hb.exec(e))?Li(t[1],t[2],t[3],t[4]):(t=yb.exec(e))?Li(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gb.exec(e))?fd(t[1],t[2]/100,t[3]/100,1):(t=bb.exec(e))?fd(t[1],t[2]/100,t[3]/100,t[4]):ld.hasOwnProperty(e)?dd(ld[e]):e==="transparent"?new ht(NaN,NaN,NaN,0):null}function dd(e){return new ht(e>>16&255,e>>8&255,e&255,1)}function Li(e,t,o,i){return i<=0&&(e=t=o=NaN),new ht(e,t,o,i)}function Eb(e){return e instanceof To||(e=bn(e)),e?(e=e.rgb(),new ht(e.r,e.g,e.b,e.opacity)):new ht}function xr(e,t,o,i){return arguments.length===1?Eb(e):new ht(e,t,o,i??1)}function ht(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}vr(ht,xr,rd(To,{brighter(e){return e=e==null?Oi:Math.pow(Oi,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vo:Math.pow(Vo,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ht(_n(this.r),_n(this.g),_n(this.b),Pi(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:ud,formatHex:ud,formatHex8:Nb,formatRgb:md,toString:md}));function ud(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}`}function Nb(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}${kn((isNaN(this.opacity)?1:this.opacity)*255)}`}function md(){const e=Pi(this.opacity);return`${e===1?"rgb(":"rgba("}${_n(this.r)}, ${_n(this.g)}, ${_n(this.b)}${e===1?")":`, ${e})`}`}function Pi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function kn(e){return e=_n(e),(e<16?"0":"")+e.toString(16)}function fd(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new xt(e,t,o,i)}function pd(e){if(e instanceof xt)return new xt(e.h,e.s,e.l,e.opacity);if(e instanceof To||(e=bn(e)),!e)return new xt;if(e instanceof xt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),r=Math.max(t,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(t===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-t)/s+2:l=(t-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new xt(l,s,c,e.opacity)}function wb(e,t,o,i){return arguments.length===1?pd(e):new xt(e,t,o,i??1)}function xt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}vr(xt,wb,rd(To,{brighter(e){return e=e==null?Oi:Math.pow(Oi,e),new xt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vo:Math.pow(Vo,e),new xt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new ht(Ir(e>=240?e-240:e+120,a,i),Ir(e,a,i),Ir(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new xt(hd(this.h),zi(this.s),zi(this.l),Pi(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=Pi(this.opacity);return`${e===1?"hsl(":"hsla("}${hd(this.h)}, ${zi(this.s)*100}%, ${zi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hd(e){return e=(e||0)%360,e<0?e+360:e}function zi(e){return Math.max(0,Math.min(1,e||0))}function Ir(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Cr=e=>()=>e;function vb(e,t){return function(o){return e+o*t}}function xb(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function Ib(e){return(e=+e)==1?yd:function(t,o){return o-t?xb(t,o,e):Cr(isNaN(t)?o:t)}}function yd(e,t){var o=t-e;return o?vb(e,o):Cr(isNaN(e)?t:e)}const Ui=(function e(t){var o=Ib(t);function i(a,r){var l=o((a=xr(a)).r,(r=xr(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=yd(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 Cb(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+t[a]*r;return i}}function Sb(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $b(e,t){var o=t?t.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]=Bo(e[l],t[l]);for(;l<o;++l)r[l]=t[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function Rb(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function Bt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Ab(e,t){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?o[a]=Bo(e[a],t[a]):i[a]=t[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Sr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$r=new RegExp(Sr.source,"g");function Tb(e){return function(){return e}}function Vb(e){return function(t){return e(t)+""}}function gd(e,t){var o=Sr.lastIndex=$r.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Sr.exec(e))&&(a=$r.exec(t));)(r=a.index)>o&&(r=t.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:Bt(i,a)})),o=$r.lastIndex;return o<t.length&&(r=t.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?Vb(c[0].x):Tb(t):(t=c.length,function(d){for(var u=0,m;u<t;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function Bo(e,t){var o=typeof t,i;return t==null||o==="boolean"?Cr(t):(o==="number"?Bt:o==="string"?(i=bn(t))?(t=i,Ui):gd:t instanceof bn?Ui:t instanceof Date?Rb:Sb(t)?Cb:Array.isArray(t)?$b:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ab:Bt)(e,t)}var bd=180/Math.PI,Rr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _d(e,t,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(t,e)*bd,skewX:Math.atan(c)*bd,scaleX:l,scaleY:s}}var Fi;function Mb(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rr:_d(t.a,t.b,t.c,t.d,t.e,t.f)}function Bb(e){return e==null||(Fi||(Fi=document.createElementNS("http://www.w3.org/2000/svg","g")),Fi.setAttribute("transform",e),!(e=Fi.transform.baseVal.consolidate()))?Rr:(e=e.matrix,_d(e.a,e.b,e.c,e.d,e.e,e.f))}function kd(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push("translate(",null,t,null,o);y.push({i:g-4,x:Bt(d,m)},{i:g-2,x:Bt(u,f)})}else(m||f)&&p.push("translate("+m+t+f+o)}function l(d,u,m,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Bt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,f){d!==u?f.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Bt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push(a(p)+"scale(",null,",",null,")");y.push({i:g-4,x:Bt(d,m)},{i:g-2,x:Bt(u,f)})}else(m!==1||f!==1)&&p.push(a(p)+"scale("+m+","+f+")")}return function(d,u){var m=[],f=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,f),l(d.rotate,u.rotate,m,f),s(d.skewX,u.skewX,m,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,f),d=u=null,function(p){for(var y=-1,g=f.length,_;++y<g;)m[(_=f[y]).i]=_.x(p);return m.join("")}}}var Db=kd(Mb,"px, ","px)","deg)"),Ob=kd(Bb,", ",")",")"),Lb=1e-12;function Ed(e){return((e=Math.exp(e))+1/e)/2}function Pb(e){return((e=Math.exp(e))-1/e)/2}function zb(e){return((e=Math.exp(2*e))-1)/(e+1)}const Hi=(function e(t,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],f=l[2],p=u-s,y=m-c,g=p*p+y*y,_,b;if(g<Lb)b=Math.log(f/d)/t,_=function(G){return[s+G*p,c+G*y,d*Math.exp(t*G*b)]};else{var N=Math.sqrt(g),h=(f*f-d*d+i*g)/(2*d*o*N),k=(f*f-d*d-i*g)/(2*f*o*N),P=Math.log(Math.sqrt(h*h+1)-h),A=Math.log(Math.sqrt(k*k+1)-k);b=(A-P)/t,_=function(G){var K=G*b,v=Ed(P),T=d/(o*N)*(v*zb(t*K+P)-Pb(P));return[s+T*p,c+T*y,d*v/Ed(t*K+P)]}}return _.duration=b*1e3*t/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Qn=0,Do=0,Oo=0,Nd=1e3,Gi,Lo,ji=0,En=0,Ki=0,Po=typeof performance=="object"&&performance.now?performance:Date,wd=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ar(){return En||(wd(Ub),En=Po.now()+Ki)}function Ub(){En=0}function Yi(){this._call=this._time=this._next=null}Yi.prototype=vd.prototype={constructor:Yi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ar():+o)+(t==null?0:+t),!this._next&&Lo!==this&&(Lo?Lo._next=this:Gi=this,Lo=this),this._call=e,this._time=o,Tr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tr())}};function vd(e,t,o){var i=new Yi;return i.restart(e,t,o),i}function Fb(){Ar(),++Qn;for(var e=Gi,t;e;)(t=En-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qn}function xd(){En=(ji=Po.now())+Ki,Qn=Do=0;try{Fb()}finally{Qn=0,Gb(),En=0}}function Hb(){var e=Po.now(),t=e-ji;t>Nd&&(Ki-=t,ji=e)}function Gb(){for(var e,t=Gi,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Gi=o);Lo=e,Tr(i)}function Tr(e){if(!Qn){Do&&(Do=clearTimeout(Do));var t=e-En;t>24?(e<1/0&&(Do=setTimeout(xd,e-Po.now()-Ki)),Oo&&(Oo=clearInterval(Oo))):(Oo||(ji=Po.now(),Oo=setInterval(Hb,Nd)),Qn=1,wd(xd))}}function Id(e,t,o){var i=new Yi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var jb=Ti("start","end","cancel","interrupt"),Kb=[],Cd=0,Sd=1,Vr=2,Wi=3,$d=4,Mr=5,qi=6;function Xi(e,t,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;Yb(e,o,{name:t,index:i,group:a,on:jb,tween:Kb,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Cd})}function Br(e,t){var o=It(e,t);if(o.state>Cd)throw new Error("too late; already scheduled");return o}function Dt(e,t){var o=It(e,t);if(o.state>Wi)throw new Error("too late; already running");return o}function It(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Yb(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=vd(r,0,o.time);function r(d){o.state=Sd,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,f,p;if(o.state!==Sd)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Wi)return Id(l);p.state===$d?(p.state=qi,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=qi,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Id(function(){o.state===Wi&&(o.state=$d,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Vr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Vr){for(o.state=Wi,a=new Array(f=o.tween.length),u=0,m=-1;u<f;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Mr,1),m=-1,f=a.length;++m<f;)a[m].call(e,u);o.state===Mr&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=qi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ji(e,t){var o=e.__transition,i,a,r=!0,l;if(o){t=t==null?null:t+"";for(l in o){if((i=o[l]).name!==t){r=!1;continue}a=i.state>Vr&&i.state<Mr,i.state=qi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function Wb(e){return this.each(function(){Ji(this,e)})}function qb(e,t){var o,i;return function(){var a=Dt(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===t){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function Xb(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Dt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function Jb(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=It(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((t==null?qb:Xb)(o,e,t))}function Dr(e,t,o){var i=e._id;return e.each(function(){var a=Dt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return It(a,i).value[t]}}function Rd(e,t){var o;return(typeof t=="number"?Bt:t instanceof bn?Ui:(o=bn(t))?(t=o,Ui):gd)(e,t)}function Zb(e){return function(){this.removeAttribute(e)}}function Qb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function e_(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=t(i=l,o)}}function t_(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=t(i=l,o)}}function n_(e,t,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=t(i=l,s)))}}function o_(e,t,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=t(i=l,s)))}}function i_(e,t){var o=Mi(e),i=o==="transform"?Ob:Rd;return this.attrTween(e,typeof t=="function"?(o.local?o_:n_)(o,i,Dr(this,"attr."+e,t)):t==null?(o.local?Qb:Zb)(o):(o.local?t_:e_)(o,i,t))}function a_(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function r_(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function l_(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&r_(e,r)),o}return a._value=t,a}function s_(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&a_(e,r)),o}return a._value=t,a}function c_(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Mi(e);return this.tween(o,(i.local?l_:s_)(i,t))}function d_(e,t){return function(){Br(this,e).delay=+t.apply(this,arguments)}}function u_(e,t){return t=+t,function(){Br(this,e).delay=t}}function m_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?d_:u_)(t,e)):It(this.node(),t).delay}function f_(e,t){return function(){Dt(this,e).duration=+t.apply(this,arguments)}}function p_(e,t){return t=+t,function(){Dt(this,e).duration=t}}function h_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?f_:p_)(t,e)):It(this.node(),t).duration}function y_(e,t){if(typeof t!="function")throw new Error;return function(){Dt(this,e).ease=t}}function g_(e){var t=this._id;return arguments.length?this.each(y_(t,e)):It(this.node(),t).ease}function b_(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Dt(this,e).ease=o}}function __(e){if(typeof e!="function")throw new Error;return this.each(b_(this._id,e))}function k_(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[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 Ht(i,this._parents,this._name,this._id)}function E_(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=t[s],d=o[s],u=c.length,m=l[s]=new Array(u),f,p=0;p<u;++p)(f=c[p]||d[p])&&(m[p]=f);for(;s<i;++s)l[s]=t[s];return new Ht(l,this._parents,this._name,this._id)}function N_(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function w_(e,t,o){var i,a,r=N_(t)?Br:Dt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(t,o),l.on=a}}function v_(e,t){var o=this._id;return arguments.length<2?It(this.node(),o).on.on(e):this.each(w_(o,e,t))}function x_(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function I_(){return this.on("end.remove",x_(this._id))}function C_(e){var t=this._name,o=this._id;typeof e!="function"&&(e=kr(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,f=0;f<c;++f)(u=s[f])&&(m=e.call(u,u.__data__,f,s))&&("__data__"in u&&(m.__data__=u.__data__),d[f]=m,Xi(d[f],t,o,f,d,It(u,o)));return new Ht(r,this._parents,t,o)}function S_(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Yc(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 f=e.call(u,u.__data__,m,c),p,y=It(u,o),g=0,_=f.length;g<_;++g)(p=f[g])&&Xi(p,t,o,g,f,y);r.push(f),l.push(u)}return new Ht(r,l,t,o)}var $_=Ro.prototype.constructor;function R_(){return new $_(this._groups,this._parents)}function A_(e,t){var o,i,a;return function(){var r=Xn(this,e),l=(this.style.removeProperty(e),Xn(this,e));return r===l?null:r===o&&l===i?a:a=t(o=r,i=l)}}function Ad(e){return function(){this.style.removeProperty(e)}}function T_(e,t,o){var i,a=o+"",r;return function(){var l=Xn(this,e);return l===a?null:l===i?r:r=t(i=l,o)}}function V_(e,t,o){var i,a,r;return function(){var l=Xn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Xn(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s))}}function M_(e,t){var o,i,a,r="style."+t,l="end."+r,s;return function(){var c=Dt(this,e),d=c.on,u=c.value[r]==null?s||(s=Ad(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function B_(e,t,o){var i=(e+="")=="transform"?Db:Rd;return t==null?this.styleTween(e,A_(e,i)).on("end.style."+e,Ad(e)):typeof t=="function"?this.styleTween(e,V_(e,i,Dr(this,"style."+e,t))).each(M_(this._id,e)):this.styleTween(e,T_(e,i,t),o).on("end.style."+e,null)}function D_(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function O_(e,t,o){var i,a;function r(){var l=t.apply(this,arguments);return l!==a&&(i=(a=l)&&D_(e,l,o)),i}return r._value=t,r}function L_(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,O_(e,t,o??""))}function P_(e){return function(){this.textContent=e}}function z_(e){return function(){var t=e(this);this.textContent=t??""}}function U_(e){return this.tween("text",typeof e=="function"?z_(Dr(this,"text",e)):P_(e==null?"":e+""))}function F_(e){return function(t){this.textContent=e.call(this,t)}}function H_(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&F_(a)),t}return i._value=e,i}function G_(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,H_(e))}function j_(){for(var e=this._name,t=this._id,o=Td(),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=It(c,t);Xi(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ht(i,this._parents,e,o)}function K_(){var e,t,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=Dt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&r()})}var Y_=0;function Ht(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Td(){return++Y_}var Gt=Ro.prototype;Ht.prototype={constructor:Ht,select:C_,selectAll:S_,selectChild:Gt.selectChild,selectChildren:Gt.selectChildren,filter:k_,merge:E_,selection:R_,transition:j_,call:Gt.call,nodes:Gt.nodes,node:Gt.node,size:Gt.size,empty:Gt.empty,each:Gt.each,on:v_,attr:i_,attrTween:c_,style:B_,styleTween:L_,text:U_,textTween:G_,remove:I_,tween:Jb,delay:m_,duration:h_,ease:g_,easeVarying:__,end:K_,[Symbol.iterator]:Gt[Symbol.iterator]};function W_(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var q_={time:null,delay:0,duration:250,ease:W_};function X_(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function J_(e){var t,o;e instanceof Ht?(t=e._id,e=e._name):(t=Td(),(o=q_).time=Ar(),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])&&Xi(c,e,t,d,l,o||X_(c,t));return new Ht(i,this._parents,e,t)}Ro.prototype.interrupt=Wb,Ro.prototype.transition=J_;const Zi=e=>()=>e;function Z_(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function jt(e,t,o){this.k=e,this.x=t,this.y=o}jt.prototype={constructor:jt,scale:function(e){return e===1?this:new jt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jt(this.k,this.x+this.k*e,this.y+this.k*t)},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 eo=new jt(1,0,0);jt.prototype;function Or(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function Q_(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function e1(){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 Vd(){return this.__zoom||eo}function t1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function n1(){return navigator.maxTouchPoints||"ontouchstart"in this}function o1(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],r=e.invertY(t[0][1])-o[0][1],l=e.invertY(t[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 i1(){var e=Q_,t=e1,o=o1,i=t1,a=n1,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Hi,d=Ti("start","zoom","end"),u,m,f,p=500,y=150,g=0,_=10;function b(E){E.property("__zoom",Vd).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,Y,S,W){var ee=E.selection?E.selection():E;ee.property("__zoom",Vd),E!==ee?P(E,Y,S,W):ee.interrupt().each(function(){A(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(E,Y,S,W){b.scaleTo(E,function(){var ee=this.__zoom.k,ie=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*ie},S,W)},b.scaleTo=function(E,Y,S,W){b.transform(E,function(){var ee=t.apply(this,arguments),ie=this.__zoom,O=S==null?k(ee):typeof S=="function"?S.apply(this,arguments):S,U=ie.invert(O),ne=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(ie,ne),O,U),ee,l)},S,W)},b.translateBy=function(E,Y,S,W){b.transform(E,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,W)},b.translateTo=function(E,Y,S,W,ee){b.transform(E,function(){var ie=t.apply(this,arguments),O=this.__zoom,U=W==null?k(ie):typeof W=="function"?W.apply(this,arguments):W;return o(eo.translate(U[0],U[1]).scale(O.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),ie,l)},W,ee)};function N(E,Y){return Y=Math.max(r[0],Math.min(r[1],Y)),Y===E.k?E:new jt(Y,E.x,E.y)}function h(E,Y,S){var W=Y[0]-S[0]*E.k,ee=Y[1]-S[1]*E.k;return W===E.x&&ee===E.y?E:new jt(E.k,W,ee)}function k(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function P(E,Y,S,W){E.on("start.zoom",function(){A(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(W).end()}).tween("zoom",function(){var ee=this,ie=arguments,O=A(ee,ie).event(W),U=t.apply(ee,ie),ne=S==null?k(U):typeof S=="function"?S.apply(ee,ie):S,ce=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ge=ee.__zoom,se=typeof Y=="function"?Y.apply(ee,ie):Y,pe=c(ge.invert(ne).concat(ce/ge.k),se.invert(ne).concat(ce/se.k));return function(be){if(be===1)be=se;else{var xe=pe(be),Te=ce/xe[2];be=new jt(Te,ne[0]-xe[0]*Te,ne[1]-xe[1]*Te)}O.zoom(null,be)}})}function A(E,Y,S){return!S&&E.__zooming||new G(E,Y)}function G(E,Y){this.that=E,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,Y),this.taps=0}G.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,Y){return this.mouse&&E!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var Y=vt(this.that).datum();d.call(E,this.that,new Z_(E,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),Y)}};function K(E,...Y){if(!e.apply(this,arguments))return;var S=A(this,Y).event(E),W=this.__zoom,ee=Math.max(r[0],Math.min(r[1],W.k*Math.pow(2,i.apply(this,arguments)))),ie=Vt(E);if(S.wheel)(S.mouse[0][0]!==ie[0]||S.mouse[0][1]!==ie[1])&&(S.mouse[1]=W.invert(S.mouse[0]=ie)),clearTimeout(S.wheel);else{if(W.k===ee)return;S.mouse=[ie,W.invert(ie)],Ji(this),S.start()}zo(E),S.wheel=setTimeout(O,y),S.zoom("mouse",o(h(N(W,ee),S.mouse[0],S.mouse[1]),S.extent,l));function O(){S.wheel=null,S.end()}}function v(E,...Y){if(f||!e.apply(this,arguments))return;var S=E.currentTarget,W=A(this,Y,!0).event(E),ee=vt(E.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",ce,!0),ie=Vt(E,S),O=E.clientX,U=E.clientY;id(E.view),Or(E),W.mouse=[ie,this.__zoom.invert(ie)],Ji(this),W.start();function ne(ge){if(zo(ge),!W.moved){var se=ge.clientX-O,pe=ge.clientY-U;W.moved=se*se+pe*pe>g}W.event(ge).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=Vt(ge,S),W.mouse[1]),W.extent,l))}function ce(ge){ee.on("mousemove.zoom mouseup.zoom",null),ad(ge.view,W.moved),zo(ge),W.event(ge).end()}}function T(E,...Y){if(e.apply(this,arguments)){var S=this.__zoom,W=Vt(E.changedTouches?E.changedTouches[0]:E,this),ee=S.invert(W),ie=S.k*(E.shiftKey?.5:2),O=o(h(N(S,ie),W,ee),t.apply(this,Y),l);zo(E),s>0?vt(this).transition().duration(s).call(P,O,W,E):vt(this).call(b.transform,O,W,E)}}function H(E,...Y){if(e.apply(this,arguments)){var S=E.touches,W=S.length,ee=A(this,Y,E.changedTouches.length===W).event(E),ie,O,U,ne;for(Or(E),O=0;O<W;++O)U=S[O],ne=Vt(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==ne[2]&&(ee.touch1=ne,ee.taps=0):(ee.touch0=ne,ie=!0,ee.taps=1+!!u);u&&(u=clearTimeout(u)),ie&&(ee.taps<2&&(m=ne[0],u=setTimeout(function(){u=null},p)),Ji(this),ee.start())}}function C(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O,U,ne;for(zo(E),ie=0;ie<ee;++ie)O=W[ie],U=Vt(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=U:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=U);if(O=S.that.__zoom,S.touch1){var ce=S.touch0[0],ge=S.touch0[1],se=S.touch1[0],pe=S.touch1[1],be=(be=se[0]-ce[0])*be+(be=se[1]-ce[1])*be,xe=(xe=pe[0]-ge[0])*xe+(xe=pe[1]-ge[1])*xe;O=N(O,Math.sqrt(be/xe)),U=[(ce[0]+se[0])/2,(ce[1]+se[1])/2],ne=[(ge[0]+pe[0])/2,(ge[1]+pe[1])/2]}else if(S.touch0)U=S.touch0[0],ne=S.touch0[1];else return;S.zoom("touch",o(h(O,U,ne),S.extent,l))}}function ae(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O;for(Or(E),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),ie=0;ie<ee;++ie)O=W[ie],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=Vt(O,this),Math.hypot(m[0]-O[0],m[1]-O[1])<_)){var U=vt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Zi(+E),b):i},b.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Zi(!!E),b):e},b.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Zi(!!E),b):a},b.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Zi([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),b):t},b.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],b):[r[0],r[1]]},b.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(E){return arguments.length?(o=E,b):o},b.duration=function(E){return arguments.length?(s=+E,b):s},b.interpolate=function(E){return arguments.length?(c=E,b):c},b.on=function(){var E=d.on.apply(d,arguments);return E===d?b:E},b.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,b):Math.sqrt(g)},b.tapDistance=function(E){return arguments.length?(_=+E,b):_},b}var Re=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Re||{}),Lr=(e=>(e.Partial="partial",e.Full="full",e))(Lr||{}),Nn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Nn||{}),Kt=(e=>(e.Strict="strict",e.Loose="loose",e))(Kt||{}),Pr=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Pr||{}),Uo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Uo||{}),Md=(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))(Md||{});const a1=["INPUT","SELECT","TEXTAREA"],r1=typeof document<"u"?document:null;function zr(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.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 a1.includes(i==null?void 0:i.nodeName)||a||!!r}function l1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Bd(e,t,o,i){const a=t.replace("+",`
|
|
23
|
+
`}}const gi="com.example",Bp="command.domain";function wo(e,n,o={}){if(e.packageName)return e.packageName;const i=o.packageConfig;if(i!=null&&i.basePackage){const a=n.groups.find(c=>{var d;return(d=c.memberEntityRefs)==null?void 0:d.includes(e.modelId)}),r=a!=null&&a.packageName?`.${a.packageName}`:"",l=i.layerSuffix??Bp,s=l?`.${l}`:"";return`${i.basePackage}${r}${s}`}return n.packageName||""}const Dp="CustomMoneyType",Op="Money";function Lp(e){return!(e.type!==Dp||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Pp(e){const n=e.dbAttrs[0]??{modelId:De(),physicalName:"",dataType:""},o={modelId:De(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Op,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function zp(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Lp(l)?(a=!0,n=!0,Pp(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function _s(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Es(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(_s);if(!i.length)continue;const a=o.filter(s=>!_s(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 jn(e){return JSON.parse(JSON.stringify(e))}function ks(e,n,o){var j;const i=o.idFactory??De,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const v=new Set(n);for(const T of r.associations){const F=v.has(T.end1.entityRef),I=v.has(T.end2.entityRef);F!==I&&s.add(F?T.end2.entityRef:T.end1.entityRef)}}const c=r.entities.filter(v=>s.has(v.modelId)),d=new Set(c.map(v=>v.modelId)),u=r.associations.filter(v=>d.has(v.end1.entityRef)&&d.has(v.end2.entityRef)),m=new Set(u.map(v=>v.modelId)),f=new Map,p=v=>{let T=f.get(v);return T||(T=i(),f.set(v,T)),T};for(const v of c){p(v.modelId);for(const T of v.attributes){p(T.modelId);for(const F of T.dbAttrs)p(F.modelId)}for(const T of v.indexes??[])p(T.modelId);for(const T of v.operations??[])p(T.modelId)}for(const v of u)p(v.modelId);const y=v=>f.get(v),g=c.map(v=>{const T=jn(v);T.modelId=y(v.modelId),T.attributes=T.attributes.map(F=>Up(F,y,m,d));for(const F of T.indexes??[])F.modelId=y(F.modelId),F.columns=F.columns.map(I=>yo(I.columnRef)?I:{...I,columnRef:y(I.columnRef)}).filter(I=>I.columnRef!==void 0);for(const F of T.operations??[])F.modelId=y(F.modelId);return T});Es(g);const _=u.map(v=>{const T=jn(v);return T.modelId=y(v.modelId),T.end1=Ns(T.end1,y),T.end2=Ns(T.end2,y),T}),b=[];for(const v of r.groups){const T=v.memberEntityRefs.filter(I=>d.has(I));if(T.length===0)continue;const F=jn(v);F.modelId=p(v.modelId),F.memberEntityRefs=T.map(I=>y(I)),b.push(F)}const N=o.collisionSuffix??"_imported",h=new Set(o.existing.entities.map(v=>v.name)),E=new Set(o.existing.entities.map(v=>{var T;return(T=v.table)==null?void 0:T.physicalName}).filter(v=>!!v));for(const v of g)h.has(v.name)&&(v.name=`${v.name}${N}`),(j=v.table)!=null&&j.physicalName&&E.has(v.table.physicalName)&&(v.table.physicalName=`${v.table.physicalName}${N}`);const D=[];for(const v of l.entityLayouts){const T=y(v.entityRef);if(!T)continue;const F=jn(v);F.entityRef=T,F.geo={...F.geo,location:cr(F.geo.location,a)},F.attributeStyles&&(F.attributeStyles=bi(F.attributeStyles,y)),F.operationStyles&&(F.operationStyles=bi(F.operationStyles,y)),D.push(F)}const $=[];for(const v of l.associationLayouts){const T=y(v.associationRef);if(!T)continue;const F=jn(v);F.associationRef=T,F.sourceColumnRef=v.sourceColumnRef?y(v.sourceColumnRef):void 0,F.targetColumnRef=v.targetColumnRef?y(v.targetColumnRef):void 0,F.waypoints=F.waypoints.map(I=>cr(I,a)),$.push(F)}const H=[];for(const v of l.groupLayouts){const T=y(v.groupRef);if(!T)continue;const F=jn(v);F.groupRef=T,F.geo={...F.geo,location:cr(F.geo.location,a)},delete F.memberNoteRefs,H.push(F)}return{logical:{entities:g,associations:_,groups:b},layout:{entityLayouts:D,associationLayouts:$,groupLayouts:H},idMap:f}}function cr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function Up(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 Ns(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function bi(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function dr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function Kn(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)=>Kn(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(!Kn(e[i],n[i]))return!1;return!0}return!1}function pn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||Kn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function hn(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 Fp(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 Hp=new Set(["attributes","operations","indexes","rev"]),Gp=new Set(["end1","end2","rev"]),jp=new Set(["memberEntityRefs","rev"]),ws=new Set(["modelId"]),Kp=new Set(["modelId","columns"]),Yp=new Set([]);function Wp(e,n,o,i){const a=hn(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=pn(s,c,ws);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=hn(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=pn(s,c,ws);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=hn(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(!Kn(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=pn(s,c,Kp);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function qp(e,n,o){const i=hn(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:dr(l)});for(const{cur:l,tgt:s}of i.common){const c=pn(l,s,Hp);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Wp(l.modelId,l,s,o)}const a=hn(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:dr(l)});for(const{cur:l,tgt:s}of a.common){const c=pn(l,s,Gp);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=pn(l[d]??{},s[d]??{},Yp);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=hn(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:dr(l)});for(const{cur:l,tgt:s}of r.common){const c=pn(l,s,jp);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Fp(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 _i(e,n,o,i,a,r,l){const s=hn(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)Kn(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 Xp(e,n,o){_i(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),_i(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),_i(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),_i(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Jp(e,n){const o=[];return qp(e.logical,n.logical,o),Xp(e.layout,n.layout,o),o}function Zp(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 Qp={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 eh{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({...vo(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({...vo(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({...vo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...vo(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({...vo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function vo(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 At(e,n,o,i){if(o==null||typeof o!="object")return;const a=Qp[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function yn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function ur(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Qt(e,n){var r,l,s,c,d,u,m,f;const o=Zp(n),i=new eh(n.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?At(i,p,y.value,"entity"):y.kind==="entity.update"?yn(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const g=ur((r=y.value)==null?void 0:r.attributes,n.attributeRef);g&&At(i,p,g,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?At(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?yn(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const g=ur((s=y.value)==null?void 0:s.operations,n.operationRef);g&&At(i,p,g,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?At(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?yn(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const g=ur((d=y.value)==null?void 0:d.indexes,n.indexRef);g&&At(i,p,g,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?At(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?yn(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?At(i,p,y.value,"association"):y.kind==="association.update"?yn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const g=(m=y.value)==null?void 0:m[n.end];At(i,p,g,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?yn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){At(i,p,y.value,"group");const g=(f=y.value)==null?void 0:f.memberEntityRefs;if(Array.isArray(g))for(const _ of g)i.member(p,_,!1)}else y.kind==="group.update"?yn(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}function th(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Yn(e,n){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&n.add(o.modelId)}function nh(e,n){const o=new Set,i=new Set,a=new Set;for(const r of e)for(const l of r.ops){const s=l;if(l.kind==="entity.add"&&s.entityRef===n){const c=s.value;Yn(c==null?void 0:c.attributes,o),Yn(c==null?void 0:c.operations,i),Yn(c==null?void 0:c.indexes,a);continue}s.containerRef!==n&&s.entityRef!==n||(l.kind==="attribute.add"?Yn([s.value],o):l.kind==="attribute.update"||l.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):l.kind==="operation.add"?Yn([s.value],i):l.kind==="operation.update"||l.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):l.kind==="index.add"?Yn([s.value],a):(l.kind==="index.update"||l.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function Ei(e,n){return e.map(o=>({...o,subject:n}))}function vs(e,n){const o=e.filter(s=>s.ops.some(c=>th(c,n))),{attributes:i,operations:a,indexes:r}=nh(o,n),l=[...Ei(Qt(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...Ei(Qt(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...Ei(Qt(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...Ei(Qt(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 xs(e){return`${e.kind}:${e.ref}:${e.end??""}`}function oh(e){var i,a,r;const n=new Set,o=(l,s)=>{typeof s=="string"&&n.add(`${l}:${s}:`)};for(const l of e)for(const s of l.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const u of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",u.modelId);for(const u of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(r=c.value)==null?void 0:r.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return n}function ih(e){const n=new Set,o=new Set,i=new Set;for(const a of e)for(const r of a.ops){const l=r,s=r.kind;if(s.startsWith("entity."))typeof l.entityRef=="string"&&n.add(l.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=l.containerRef??l.entityRef;typeof c=="string"&&n.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof l.associationRef=="string"&&o.add(l.associationRef):s.startsWith("group.")&&typeof l.groupRef=="string"&&i.add(l.groupRef)}return{entities:n,associations:o,groups:i}}function ah(e){const{entities:n,associations:o,groups:i}=ih(e),a=[];for(const r of n)for(const l of vs(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Qt(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Qt(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Qt(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function Is(e){const n=ah(e),o=oh(e),i=new Map;for(const l of n){const s=xs(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=xs(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)}class mr{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.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 Cs(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function ot(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function wt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function Je(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function Ft(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 ki(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=Cs(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=ot(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 Ss(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Cs(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=ot(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(f=>f.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 $s(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=Je(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(Je(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:n}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function Rs(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=Je(i,e);o=a.name,a.name=n},invert(i){Je(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 Wn(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=ot(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=ot(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 As(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=ot(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=ot(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 xo(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 Ts(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=xo(r.style,n)},invert(i){const a=ot(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=ot(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 Vs(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=ot(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=ot(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 Ms(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=ot(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=ot(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 fr(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 Ni(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=ot(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=xo(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=ot(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=ot(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 wi(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 Bs(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:n}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Ds(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 Os(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 vi(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 Ls(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 Ps(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 zs(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=xo(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 Us(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 Tt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){Je(o,e).attributes.push(n)},invert(o){const i=Je(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 gn(e,n,o){const i={},a=r=>{const l=Je(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:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:{...i}}]}}}}function bn(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=Je(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&&Je(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 pr(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Je(a,e);i=r.attributes.map(m=>({...m}));const l=new Set(n),s=r.attributes.filter(m=>l.has(m.modelId)),c=r.attributes.filter(m=>!l.has(m.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];r.attributes.splice(0,r.attributes.length,...u),r.attributes.forEach((m,f)=>m.order=f)},invert(a){i&&Je(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Je(a,e).attributes.map(l=>({...l}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:r}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Fs(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=Je(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=Je(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 Hs(e,n,o){const i={},a=r=>{var s;const l=(s=Je(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:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:{...i}}]}}}}function Gs(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Je(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=Je(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 js(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Je(a,e),l=r.operations??[];i=l.map(f=>({...f}));const s=new Set(n),c=l.filter(f=>s.has(f.modelId)),d=l.filter(f=>!s.has(f.modelId)),u=Math.max(0,Math.min(o,d.length)),m=[...d.slice(0,u),...c,...d.slice(u)];l.splice(0,l.length,...m),l.forEach((f,p)=>f.order=p),r.operations=l},invert(a){if(!i)return;const r=Je(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=(Je(a,e).operations??[]).map(l=>({...l}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:r}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Ks(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=ot(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=xo(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=ot(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=ot(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 xi(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 Ys(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 Ii(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:n}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function Vt(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:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:{...i}}]}}}}function Ws(e,n){return{label:"인덱스 추가",apply(o){const i=Je(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=Je(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 qs(e,n,o){const i={},a=r=>{var s;const l=(s=Je(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:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:{...i}}]}}}}function Xs(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Je(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&&Je(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 Mt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),Io=(e,n)=>{var o;return((o=wt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Js(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=wt(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=wt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=Io(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Mt(e,r)],invert:[Mt(e,l)]}}}}function Zs(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=wt(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=wt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=Io(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Mt(e,a)],invert:[Mt(e,r)]}}}}function Qs(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=wt(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=wt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Mt(e,Io(a,e))],invert:[Mt(e,i??[])]}}}}function ec(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=wt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=wt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Mt(e,Io(o,e))],invert:[Mt(e,n??[])]}}}}function tc(e,n,o){return{label:"waypoint 추가",apply(i){const a=wt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=wt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=Io(i,e),r=a.slice();return r.splice(n,1),{forward:[Mt(e,a)],invert:[Mt(e,r)]}}}}function nc(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 oc(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 Co(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 ic(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 ac(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 rc(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=xo(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 lc(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 sc(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 en=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),Ci=(e,n,o)=>{var i;return((i=Ft(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function cc(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 dc(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 uc(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=Ft(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=Ft(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Ci(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[en(e,n,l)],invert:[en(e,n,s)]}}}}function mc(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=Ft(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=Ft(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Ci(a,e,n),l=r.slice();return l.splice(o,1),{forward:[en(e,n,r)],invert:[en(e,n,l)]}}}}function fc(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=Ft(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=Ft(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Ci(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[en(e,n,r)],invert:[en(e,n,l)]}}}}function pc(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Ft(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=Ft(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[en(e,n,Ci(i,e,n))],invert:[en(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 rh=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:xi,addAttribute:Tt,addEntity:ki,addEntityToGroup:Os,addGroup:wi,addIndex:Ws,addNote:nc,addNoteConnection:cc,addNoteConnectionWaypoint:mc,addNoteToGroup:lc,addOperation:Fs,addWaypoint:tc,clearNoteConnectionWaypoints:pc,clearWaypoints:ec,composite:We,moveEntity:Wn,moveGroup:Ls,moveNote:Co,moveNoteConnectionWaypoint:uc,moveWaypoint:Js,removeAssociation:Ys,removeAttribute:bn,removeEntity:Ss,removeEntityFromGroup:vi,removeGroup:Ds,removeIndex:Xs,removeNote:oc,removeNoteConnection:dc,removeNoteConnectionWaypoint:fc,removeNoteFromGroup:sc,removeOperation:Gs,removeWaypoint:Zs,renameEntity:Rs,reorderAttributes:pr,reorderOperations:js,resizeEntity:As,resizeGroup:Ps,resizeNote:ic,setAllEntitiesCollapsed:fr,setAttributeSwatch:Ni,setEntityCollapsed:Vs,setEntityLocked:Ms,setEntitySwatch:Ts,setGroupLocked:Us,setGroupSwatch:zs,setNoteMemo:ac,setNoteSwatch:rc,setOperationSwatch:Ks,translateWaypoints:Qs,updateAssociation:Ii,updateAssociationEnd:Vt,updateAttribute:gn,updateEntity:$s,updateGroup:Bs,updateIndex:qs,updateOperation:Hs},Symbol.toStringTag,{value:"Module"}));class hc{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}}}class yc{constructor(n){Xe(this,"cache",new hc);Xe(this,"newClientOpId");Xe(this,"debounceMs");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??De,this.debounceMs=n.debounceMs??300}seed(n){this.cache.seed(n)}attach(n){this.stack=n;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;if(this._frozen)return;let a;if(o==="do"){const s=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=s}else{const s=this.emissions.get(n);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=s}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(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=null;try{o=await this.opts.transport(n)}catch(r){this.sending=!1,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",r),(a=(i=this.opts).onError)==null||a.call(i,r),this.freeze({kind:"missing"});return}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 gc=["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","group.add"],bc=()=>crypto.randomUUID(),lh=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,sh=e=>e&&e[0].toLowerCase()+e.slice(1),ch=e=>e&&e[0].toUpperCase()+e.slice(1),dh=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function uh(e,n){return sh(e)+ch(n)}function mh(e,n){const o=e.entities.find(l=>l.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=n.end1.entityRef===n.end2.entityRef?!1:n.identifying===!0;return o.attributes.filter(l=>l.identifier&&(l.attrType==="NORMAL"||l.attrType==="RELATION_OWN")).sort((l,s)=>l.order-s.order).map(l=>{const s=uh(o.name,l.name);return{associationRef:n.modelId,sourceAttributeRef:l.modelId,name:s,type:l.type,identifier:a,notNull:a,dbAttrs:l.dbAttrs.map(c=>({physicalName:dh(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Si=(e,n)=>`${e}::${n}`,$i=e=>e??void 0;function fh(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||$i(s.length)!==$i(r.length)||$i(s.scale)!==$i(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 ph(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 So(e,n,o=bc){const i={add:[],update:[],remove:[]},a=e.entities.find(m=>m.modelId===n);if(!a)return i;const r=e.associations.filter(m=>m.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(m=>mh(e,m)),s=new Map(l.map(m=>[Si(m.associationRef,m.sourceAttributeRef),m])),c=a.attributes.filter(m=>m.derivedFrom),d=new Map(c.map(m=>[Si(m.derivedFrom.associationRef,m.derivedFrom.sourceAttributeRef),m]));for(const m of c){const f=Si(m.derivedFrom.associationRef,m.derivedFrom.sourceAttributeRef);s.has(f)||i.remove.push(m.modelId)}let u=a.attributes.reduce((m,f)=>Math.max(m,f.order),-1)+1;for(const m of l){const f=Si(m.associationRef,m.sourceAttributeRef),p=d.get(f);if(!p)i.add.push(ph(m,u++,o));else{const y=fh(p,m,o);y&&i.update.push({attributeId:p.modelId,patch:y})}}return i}function hh(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 yh(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function gh(e,n,o=bc){const i=new Map,a=yh(e),r=new Set,l=[n];for(;l.length;){const s=l.shift();if(r.has(s))continue;r.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=So(a,d,o);if(lh(u))continue;i.has(d)||i.set(d,u);const m=a.entities.find(f=>f.modelId===d);m&&hh(m,u),r.has(d)||l.push(d)}}return i}function Ri(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||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)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)}function bh(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==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function _h(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==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function _c(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function mt(e,n){const o=bh(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 Eh(e,n){const o=_h(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 kh(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==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Nh(e,n){const o=kh(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 Ec(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 wh(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function vh(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function xh(e,n){const o=wh(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 Ih(e,n){const o=vh(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 kc(e,n,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;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 Nc(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),m=[];let f=!1;for(const p of n.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const g={ref:y.sharedColumnPhysicalName,by:"physicalName"},_=Ec(un(i,a),g);if(!_.ok){s.push(_.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:_.matches}),f=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return f?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}}function Ch(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,f)=>{const p=n.fields[f],y=p?c.get(p.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},b=Ec(un(i,a),_);if(!b.ok){s.push(b.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:b.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function wc(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 vc(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=Nh(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 Sh(e,n,o={}){const i=o.mkId??De,a=o.embeddableCatalog??[],r=m=>a.find(f=>f.type===m),l=[],s=[],c=new Map,d=new Map,u=new Set;for(const m of n)m.kind==="entity.add"&&(u.add(m.spec.name),m.spec.physicalName&&u.add(m.spec.physicalName));return n.forEach((m,f)=>{var p,y,g,_;switch(m.kind){case"entity.add":{const b=i(),N={modelId:b,name:m.spec.name,stereotype:m.spec.stereotype??"JPA_ENTITY",attributes:[],...m.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...m.spec.physicalName?{table:{physicalName:m.spec.physicalName}}:{}},h={ref:m.spec.name};let E=!1;for(const[H,j]of(m.spec.attributes??[]).entries()){if(j.type==="GroupCodeEnum"&&!j.groupCode){s.push({code:"groupcode-required",opIndex:f,entity:h,handle:{ref:j.name}}),E=!0;continue}const v=r(j.type);if(v){const T=Nc(j,v,H,N,e.entities,f,h,s,i);T?N.attributes.push(T):E=!0}else(p=j.embeddableOverrides)!=null&&p.length?(s.push({code:"embeddable-type-unresolved",opIndex:f,entity:h,handle:{ref:j.name}}),E=!0):N.attributes.push(kc(j,H,i))}const D=(m.spec.operations??[]).map((H,j)=>wc(H,j,i));D.length&&(N.operations=D);const $=[];for(const H of m.spec.indexes??[]){const j=vc(N,H,f,h,s,i);j?$.push(j):E=!0}if($.length&&(N.indexes=$),E)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:N});break}case"entity.update":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}l.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:m.patch});break}case"entity.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}l.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}if(m.spec.type==="GroupCodeEnum"&&!m.spec.groupCode){s.push({code:"groupcode-required",opIndex:f,entity:m.entity,handle:{ref:m.spec.name}});break}const N=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,N+1);const h=r(m.spec.type);let E;if(h)E=Nc(m.spec,h,N,b.value,e.entities,f,m.entity,s,i);else if((y=m.spec.embeddableOverrides)!=null&&y.length){s.push({code:"embeddable-type-unresolved",opIndex:f,entity:m.entity,handle:{ref:m.spec.name}});break}else E=kc(m.spec,N,i);if(!E)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:E});break}case"attribute.update":case"attribute.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Eh(b.value,m.attribute);if(!N.ok){s.push(N.reason==="not-found"?{code:"attribute-not-found",opIndex:f,entity:m.entity,handle:m.attribute}:{code:"attribute-ambiguous",opIndex:f,entity:m.entity,handle:m.attribute,matches:N.matches});break}if(m.kind==="attribute.update"){let h=m.patch;if((g=m.embeddableOverrides)!=null&&g.length){const E=r(N.value.type);if(!E||N.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:f,entity:m.entity,handle:m.attribute});break}const D=Ch(N.value,E,m.embeddableOverrides,b.value,e.entities,f,m.entity,s);if(!D)break;h={...m.patch,dbAttrs:D}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:N.value.modelId,patch:h})}else l.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:N.value.modelId});break}case"association.add":{const b=mt(e,m.spec.from),N=mt(e,m.spec.to);if(b.ok||s.push(ft(b.reason,f,m.spec.from,b.matches,u)),N.ok||s.push(ft(N.reason,f,m.spec.to,N.matches,u)),!b.ok||!N.ok)break;if(m.spec.identifying&&b.value.modelId===N.value.modelId){s.push({code:"self-identifying",opIndex:f,handle:{from:m.spec.from,to:m.spec.to}});break}const h=i(),E={modelId:h,...m.spec.identifying!=null?{identifying:m.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:m.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:N.value.modelId,multiplicity:m.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:m.spec.composition??!1}},D={...e,associations:[...e.associations,E]},$=So(D,N.value.modelId,i);$.add[0]&&(E.end2.attributeRef=$.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:h,value:E});for(const H of $.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:N.value.modelId,entityRef:N.value.modelId,value:H});break}case"association.remove":{const b=mt(e,m.association.from),N=mt(e,m.association.to);if(b.ok||s.push(ft(b.reason,f,m.association.from,b.matches,u)),N.ok||s.push(ft(N.reason,f,m.association.to,N.matches,u)),!b.ok||!N.ok)break;const h=_c(e,b.value.modelId,N.value.modelId);if(h.length!==1){s.push(h.length===0?{code:"association-not-found",opIndex:f,handle:m.association}:{code:"association-ambiguous",opIndex:f,handle:m.association,matches:h.map(E=>E.modelId)});break}l.push({kind:"association.remove",casUnit:"logical",associationRef:h[0].modelId});break}case"association.update":{const b=xc(e,m.association,f,s,u);if(!b)break;l.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:m.patch});break}case"associationEnd.update":{const b=xc(e,m.association,f,s,u);if(!b)break;const N=m.end==="from"?"end1":"end2";l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:N,patch:m.patch});break}case"index.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=vc(b.value,m.spec,f,m.entity,s,i);if(!N)break;l.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.modelId,value:N});break}case"index.update":case"index.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=xh(b.value,m.index);if(!N.ok){s.push(N.reason==="not-found"?{code:"index-not-found",opIndex:f,entity:m.entity,handle:m.index}:{code:"index-ambiguous",opIndex:f,entity:m.entity,handle:m.index,matches:N.matches});break}if(m.kind==="index.update"){if("columns"in m.patch){s.push({code:"index-columns-patch-unsupported",opIndex:f,entity:m.entity,handle:m.index});break}l.push({kind:"index.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.value.modelId,patch:m.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.value.modelId});break}case"operation.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=d.get(b.value.modelId)??((_=b.value.operations)==null?void 0:_.length)??0;d.set(b.value.modelId,N+1);const h=wc(m.spec,N,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:h.modelId,value:h});break}case"operation.update":case"operation.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Ih(b.value,m.operation);if(!N.ok){s.push(N.reason==="not-found"?{code:"operation-not-found",opIndex:f,entity:m.entity,handle:m.operation}:{code:"operation-ambiguous",opIndex:f,entity:m.entity,handle:m.operation,matches:N.matches});break}m.kind==="operation.update"?l.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.value.modelId,patch:m.patch}):l.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.value.modelId});break}case"group.add":{const b=[];let N=!1;for(const D of m.spec.members){const $=mt(e,D);if(!$.ok){s.push(ft($.reason,f,D,$.matches,u)),N=!0;continue}b.push($.value.modelId)}if(N)break;const h=i(),E={modelId:h,excludeDDLGeneration:m.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...m.spec.name?{name:m.spec.name}:{},...m.spec.packageName?{packageName:m.spec.packageName}:{},...m.spec.description?{description:m.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:h,value:E});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function ft(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 xc(e,n,o,i,a){const r=mt(e,n.from),l=mt(e,n.to);if(r.ok||i.push(ft(r.reason,o,n.from,r.matches,a)),l.ok||i.push(ft(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=_c(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 Ic={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},$h={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Rh={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},Ai={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Ah={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:{...Ai,description:"속성 설명(다국어)."},columnLogicalName:{...Ai,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},Th={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}},Cc={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Vh={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Cc,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Cc,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},Mh={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Ic,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},Bh={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Ai,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Dh={type:"object",properties:{name:{...Ai,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},Oh={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function lt(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const Lh={"entity.add":lt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":lt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":lt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":lt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":lt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":lt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":lt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":lt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":lt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":lt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":lt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":lt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":lt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":lt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":lt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":lt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":lt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Sc={anyOf:gc.map(e=>Lh[e])},Ph={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Ic,assocHandle:$h,entitySpec:Rh,attrSpec:Ah,embeddableOverrides:Th,assocSpec:Vh,indexSpec:Mh,operationSpec:Bh,groupSpec:Dh,patch:Oh,symbolicOp:Sc}};function zh(e,n,o,i={}){const a=i.mkClientOpId??De,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const Uh=e=>e&&e[0].toLowerCase()+e.slice(1);function hr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Fh(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function yr(e,n){const o=Uh(e);return n?Fh(o):o}function $c(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}const Rc={location:{x:0,y:0},size:{width:220,height:140}};function Ac(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 Hh=/^[-=_*~\s]{3,}$/;function Gh(e){return e.attrType&&e.attrType!=="NORMAL"||!Hh.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function jh(e){return e.type===Rt&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Kh(e,n){if(e.attrType==="DIVIDER"||Gh(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=jh(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(Ac)}}function Yh(e){const{modelId:n,name:o,visibility:i,sourceCode:a,description:r,order:l,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:n,name:o,visibility:i,sourceCode:a,description:r?{ko:r}:void 0,order:l??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Wh(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 qh(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(Kh),operations:(n=e.operations)==null?void 0:n.map(Yh),indexes:(o=e.indexes)==null?void 0:o.map(Wh),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Xh(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??{...Rc},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 Tc(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 gr(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:Tc(e)}}function Jh(e){var i,a;const n={modelId:e.modelId,description:e.description,end1:gr(e.end1),end2:gr(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 Vc(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Mc(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Bc(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 Dc(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(Ac)}}function Zh(e,n,o){var h,E;const i=Vc(e.end1.attribute),a=Vc(e.end2.attribute);if(i===a)return Jh(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(E=(h=s.dbAttrs)==null?void 0:h[0])==null?void 0:E.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((D,$)=>Math.max(D,$.order),-1)+1:s.order??0,f={...Dc(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(f);const p=n.get(r.endModel.refId),y=l.attribute;let g;if(y&&p&&r.navigable){const D=hr(l.multiplicity);g={modelId:y.modelId??crypto.randomUUID(),name:y.name??yr((u==null?void 0:u.name)??l.endModel.refId,D),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:p.attributes.reduce(($,H)=>Math.max($,H.order),-1)+1,dbAttrs:[]},p.attributes.push(g)}const _=(D,$)=>({entityRef:D.endModel.refId,multiplicity:D.multiplicity,navigable:D.navigable,composition:D.composition,attributeRef:$?g==null?void 0:g.modelId:f.modelId,jpa:Tc(D)}),b={modelId:e.modelId,description:e.description,end1:_(e.end1,i),end2:_(e.end2,a)},N={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:f.modelId,targetColumnRef:i?f.modelId:d,style:e.style};return{assoc:b,layout:N}}function Qh(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 ey(e,n,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((g,_)=>Math.max(g,_.order),-1)+1:l.order??0,d={...Dc(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Qh(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...gr(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},f=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:f?d.modelId:void 0,targetColumnRef:f?void 0:d.modelId,style:e.style};return{assoc:m,layout:p}}function ty(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 Oc(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=ty(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 Lc(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 ny(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(m=>m.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=hr(i.end2.multiplicity),c=yr(r.name,s),d=$c(c,new Set(a.attributes.map(m=>m.name))),u=crypto.randomUUID();a.attributes.push({modelId:u,name:d,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((m,f)=>Math.max(m,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=u}}function oy(e){return(e.schemaVersion??1)>=2&&"logical"in e?iy(e):ay(e)}function iy(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:f,...p}=m;return f!=null&&(o[m.modelId]=f),p},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);ny(a,r);const{version:s,...c}=e.layout;Lc(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function ay(e){var b,N;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(h,E)=>{o.push(qh(h));const D=Xh(h);D.geo={location:{x:D.geo.location.x+E.x,y:D.geo.location.y+E.y},size:D.geo.size},i.push(D);for(const $ of h.ownedAssociations??[])c.push($)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const m=[];for(const h of e.groups??[]){const E=h.entities??[];l.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:E.map($=>$.modelId)});const D=((b=h.geo)==null?void 0:b.location)??u;if(h.geo){const $=(h.notes??[]).map(H=>H.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:$.length?$:void 0})}for(const $ of E)d($,D);for(const $ of h.notes??[])m.push(Oc($,D))}const f=new Map(o.map(h=>[h.modelId,h])),p=new Map,y=new Map;for(const h of o)for(const E of h.attributes)for(const D of E.dbAttrs)p.set(D.modelId,E.modelId),y.set(D.modelId,D);for(const h of c)for(const E of[h.end1,h.end2]){const D=E.attribute;if(D&&(((N=D.dbAttrs)==null?void 0:N.length)??0)>0)for(const $ of D.dbAttrs)$.modelId&&p.set($.modelId,D.modelId)}for(const h of c){const E=Mc(h.end1.attribute),D=Mc(h.end2.attribute),$=Bc(h.end1)||Bc(h.end2),{assoc:H,layout:j}=E!==D||$?ey(h,f,y):Zh(h,f,p);a.push(H),r.push(j)}Lc(o,a,r),Es(o);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(h=>Oc(h)),...m]}},_={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:_}}function Pc(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 ry(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(Pc),style:n}}function ly(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 sy(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 tn(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 cy(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{...Pc(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function dy(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function zc(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 uy(e){const n=new Set;for(const o of e.logical.associations){const i=zc(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function my(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 fy(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function py(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:fy(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 hy(e,n,o){let i;for(const m of n.logical.entities){const f=m.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(f){i=f;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,f)=>py(m,l[f]))},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:tn(e.end1,c?s:u),end2:tn(e.end2,c?u:s)}}function yy(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:tn(e.end1,e.end1.legacyEmbedRaw),end2:tn(e.end2,e.end2.legacyEmbedRaw)};const a=hy(e,n,i);if(a)return a;const r=zc(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?cy(r.fk,l):void 0,c=dy(r.navAttr);return{...i,end1:tn(e.end1,r.navEnd===e.end1?s:c),end2:tn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:tn(e.end1),end2:tn(e.end2)}}function Uc(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(f=>f.entityRef===e.modelId),l=n.logical.associations.filter(f=>f.end1.entityRef===e.modelId),s=f=>n.layout.associationLayouts.find(p=>p.associationRef===f),c=(r==null?void 0:r.geo)??{...Rc},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(f=>!o.has(f.modelId)&&!i.has(f.modelId)).map(f=>{var p;return ry(f,(p=r==null?void 0:r.attributeStyles)==null?void 0:p[f.modelId])}),operations:(u=e.operations)==null?void 0:u.map(f=>{var p;return ly(f,(p=r==null?void 0:r.operationStyles)==null?void 0:p[f.modelId])}),ownedAssociations:l.map(f=>yy(f,n,s(f.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(sy),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 gy(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=>Fc(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Uc(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 Fc(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 by(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=uy(e),r=my(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=>Uc(s,e,a,r)),groups:e.logical.groups.map(s=>gy(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>Fc(s))}}function _y(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}function $o(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function Ht(e){return typeof e=="function"?e():t.unref(e)}const Ey=typeof window<"u"&&typeof document<"u",ky=e=>typeof e<"u",Ny=Object.prototype.toString,wy=e=>Ny.call(e)==="[object Object]",vy=()=>{};function xy(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 Hc=e=>e();function Iy(e=Hc){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 Gc(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function Cy(e,n,o={}){const{eventFilter:i=Hc,...a}=o;return t.watch(e,xy(i,n),a)}function qn(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=Iy(i);return{stop:Cy(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function Sy(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=Ht(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 br(e,n=!1){function o(m,{flush:f="sync",deep:p=!1,timeout:y,throwOnTimeout:g}={}){let _=null;const N=[new Promise(h=>{_=t.watch(e,E=>{m(E)!==n&&(_==null||_(),h(E))},{flush:f,deep:p,immediate:!0})})];return y!=null&&N.push(Gc(y,g).then(()=>Ht(e)).finally(()=>_==null?void 0:_())),Promise.race(N)}function i(m,f){if(!t.isRef(m))return o(E=>E===m,f);const{flush:p="sync",deep:y=!1,timeout:g,throwOnTimeout:_}=f??{};let b=null;const h=[new Promise(E=>{b=t.watch([e,m],([D,$])=>{n!==(D===$)&&(b==null||b(),E(D))},{flush:p,deep:y,immediate:!0})})];return g!=null&&h.push(Gc(g,_).then(()=>Ht(e)).finally(()=>(b==null||b(),Ht(e)))),Promise.race(h)}function a(m){return o(f=>!!f,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,f){return o(p=>{const y=Array.from(p);return y.includes(m)||y.includes(Ht(m))},f)}function d(m){return u(1,m)}function u(m=1,f){let p=-1;return o(()=>(p+=1,p>=m),f)}return Array.isArray(Ht(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return br(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return br(e,!n)}}}function _r(e){return br(e)}function $y(e){var n;const o=Ht(e);return(n=o==null?void 0:o.$el)!=null?n:o}const jc=Ey?window:void 0;function Kc(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=jc):[n,o,i,a]=e,!n)return vy;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,f,p)=>(u.addEventListener(m,f,p),()=>u.removeEventListener(m,f,p)),c=t.watch(()=>[$y(n),Ht(a)],([u,m])=>{if(l(),!u)return;const f=wy(m)?{...m}:m;r.push(...o.flatMap(p=>i.map(y=>s(u,p,y,f))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return $o(d),d}function Ry(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Yc(...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=jc,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=Ry(n);return Kc(a,r,u=>{u.repeat&&Ht(s)||c(u)&&o(u)},l)}function Ay(e){return JSON.parse(JSON.stringify(e))}function Er(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:f}=i,p=t.getCurrentInstance(),y=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((l=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p==null?void 0:p.proxy));let g=d;n||(n="modelValue"),g=g||`update:${n.toString()}`;const _=h=>s?typeof s=="function"?s(h):Ay(h):h,b=()=>ky(e[n])?_(e[n]):m,N=h=>{f?f(h)&&y(g,h):y(g,h)};if(c){const h=b(),E=t.ref(h);let D=!1;return t.watch(()=>e[n],$=>{D||(D=!0,E.value=_($),t.nextTick(()=>D=!1))}),t.watch(E,$=>{!D&&($!==e[n]||u)&&N($)},{deep:u}),E}else return t.computed({get(){return b()},set(h){N(h)}})}var Ty={value:()=>{}};function Ti(){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 Vi(o)}function Vi(e){this._=e}function Vy(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}})}Vi.prototype=Ti.prototype={constructor:Vi,on:function(e,n){var o=this._,i=Vy(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=My(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]=Wc(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Wc(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 Vi(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 My(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Wc(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=Ty,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var kr="http://www.w3.org/1999/xhtml";const qc={svg:"http://www.w3.org/2000/svg",xhtml:kr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mi(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),qc.hasOwnProperty(n)?{space:qc[n],local:e}:e}function By(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===kr&&n.documentElement.namespaceURI===kr?n.createElement(e):n.createElementNS(o,e)}}function Dy(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Xc(e){var n=Mi(e);return(n.local?Dy:By)(n)}function Oy(){}function Nr(e){return e==null?Oy:function(){return this.querySelector(e)}}function Ly(e){typeof e!="function"&&(e=Nr(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 Et(i,this._parents)}function Py(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function zy(){return[]}function Jc(e){return e==null?zy:function(){return this.querySelectorAll(e)}}function Uy(e){return function(){return Py(e.apply(this,arguments))}}function Fy(e){typeof e=="function"?e=Uy(e):e=Jc(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 Et(i,a)}function Zc(e){return function(){return this.matches(e)}}function Qc(e){return function(n){return n.matches(e)}}var Hy=Array.prototype.find;function Gy(e){return function(){return Hy.call(this.children,e)}}function jy(){return this.firstElementChild}function Ky(e){return this.select(e==null?jy:Gy(typeof e=="function"?e:Qc(e)))}var Yy=Array.prototype.filter;function Wy(){return Array.from(this.children)}function qy(e){return function(){return Yy.call(this.children,e)}}function Xy(e){return this.selectAll(e==null?Wy:qy(typeof e=="function"?e:Qc(e)))}function Jy(e){typeof e!="function"&&(e=Zc(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 Et(i,this._parents)}function ed(e){return new Array(e.length)}function Zy(){return new Et(this._enter||this._groups.map(ed),this._parents)}function Bi(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Bi.prototype={constructor:Bi,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 Qy(e){return function(){return e}}function eg(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 Bi(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function tg(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,f=new Array(u),p;for(s=0;s<u;++s)(c=n[s])&&(f[s]=p=l.call(c,c.__data__,s,n)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new Bi(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(f[s])===c&&(a[s]=c)}function ng(e){return e.__data__}function og(e,n){if(!arguments.length)return Array.from(this,ng);var o=n?tg:eg,i=this._parents,a=this._groups;typeof e!="function"&&(e=Qy(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],f=m.length,p=ig(e.call(u,u&&u.__data__,d,i)),y=p.length,g=s[d]=new Array(y),_=l[d]=new Array(y),b=c[d]=new Array(f);o(u,m,g,_,b,p,n);for(var N=0,h=0,E,D;N<y;++N)if(E=g[N]){for(N>=h&&(h=N+1);!(D=_[h])&&++h<y;);E._next=D||null}}return l=new Et(l,i),l._enter=s,l._exit=c,l}function ig(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ag(){return new Et(this._exit||this._groups.map(ed),this._parents)}function rg(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 lg(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,f=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(f[y]=p);for(;c<a;++c)s[c]=o[c];return new Et(s,this._parents)}function sg(){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 cg(e){e||(e=dg);function n(m,f){return m&&f?e(m.__data__,f.__data__):!m-!f}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 Et(a,this._parents).order()}function dg(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function ug(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mg(){return Array.from(this)}function fg(){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 pg(){let e=0;for(const n of this)++e;return e}function hg(){return!this.node()}function yg(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 gg(e){return function(){this.removeAttribute(e)}}function bg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _g(e,n){return function(){this.setAttribute(e,n)}}function Eg(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function kg(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Ng(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 wg(e,n){var o=Mi(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?bg:gg:typeof n=="function"?o.local?Ng:kg:o.local?Eg:_g)(o,n))}function td(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function vg(e){return function(){this.style.removeProperty(e)}}function xg(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Ig(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Cg(e,n,o){return arguments.length>1?this.each((n==null?vg:typeof n=="function"?Ig:xg)(e,n,o??"")):Xn(this.node(),e)}function Xn(e,n){return e.style.getPropertyValue(n)||td(e).getComputedStyle(e,null).getPropertyValue(n)}function Sg(e){return function(){delete this[e]}}function $g(e,n){return function(){this[e]=n}}function Rg(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ag(e,n){return arguments.length>1?this.each((n==null?Sg:typeof n=="function"?Rg:$g)(e,n)):this.node()[e]}function nd(e){return e.trim().split(/^|\s+/)}function wr(e){return e.classList||new od(e)}function od(e){this._node=e,this._names=nd(e.getAttribute("class")||"")}od.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 id(e,n){for(var o=wr(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function ad(e,n){for(var o=wr(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Tg(e){return function(){id(this,e)}}function Vg(e){return function(){ad(this,e)}}function Mg(e,n){return function(){(n.apply(this,arguments)?id:ad)(this,e)}}function Bg(e,n){var o=nd(e+"");if(arguments.length<2){for(var i=wr(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Mg:n?Tg:Vg)(o,n))}function Dg(){this.textContent=""}function Og(e){return function(){this.textContent=e}}function Lg(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Pg(e){return arguments.length?this.each(e==null?Dg:(typeof e=="function"?Lg:Og)(e)):this.node().textContent}function zg(){this.innerHTML=""}function Ug(e){return function(){this.innerHTML=e}}function Fg(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Hg(e){return arguments.length?this.each(e==null?zg:(typeof e=="function"?Fg:Ug)(e)):this.node().innerHTML}function Gg(){this.nextSibling&&this.parentNode.appendChild(this)}function jg(){return this.each(Gg)}function Kg(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Yg(){return this.each(Kg)}function Wg(e){var n=typeof e=="function"?e:Xc(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function qg(){return null}function Xg(e,n){var o=typeof e=="function"?e:Xc(e),i=n==null?qg:typeof n=="function"?n:Nr(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Jg(){var e=this.parentNode;e&&e.removeChild(this)}function Zg(){return this.each(Jg)}function Qg(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function eb(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function tb(e){return this.select(e?eb:Qg)}function nb(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ob(e){return function(n){e.call(this,n,this.__data__)}}function ib(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 ab(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 rb(e,n,o){return function(){var i=this.__on,a,r=ob(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 lb(e,n,o){var i=ib(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?rb:ab,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function rd(e,n,o){var i=td(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 sb(e,n){return function(){return rd(this,e,n)}}function cb(e,n){return function(){return rd(this,e,n.apply(this,arguments))}}function db(e,n){return this.each((typeof n=="function"?cb:sb)(e,n))}function*ub(){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 ld=[null];function Et(e,n){this._groups=e,this._parents=n}function Ro(){return new Et([[document.documentElement]],ld)}function mb(){return this}Et.prototype=Ro.prototype={constructor:Et,select:Ly,selectAll:Fy,selectChild:Ky,selectChildren:Xy,filter:Jy,data:og,enter:Zy,exit:ag,join:rg,merge:lg,selection:mb,order:sg,sort:cg,call:ug,nodes:mg,node:fg,size:pg,empty:hg,each:yg,attr:wg,style:Cg,property:Ag,classed:Bg,text:Pg,html:Hg,raise:jg,lower:Yg,append:Wg,insert:Xg,remove:Zg,clone:tb,datum:nb,on:lb,dispatch:db,[Symbol.iterator]:ub};function vt(e){return typeof e=="string"?new Et([[document.querySelector(e)]],[document.documentElement]):new Et([[e]],ld)}function fb(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Bt(e,n){if(e=fb(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 pb={passive:!1},Ao={capture:!0,passive:!1};function vr(e){e.stopImmediatePropagation()}function Jn(e){e.preventDefault(),e.stopImmediatePropagation()}function sd(e){var n=e.document.documentElement,o=vt(e).on("dragstart.drag",Jn,Ao);"onselectstart"in n?o.on("selectstart.drag",Jn,Ao):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function cd(e,n){var o=e.document.documentElement,i=vt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Jn,Ao),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 Di=e=>()=>e;function xr(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}})}xr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function hb(e){return!e.ctrlKey&&!e.button}function yb(){return this.parentNode}function gb(e,n){return n??{x:e.x,y:e.y}}function bb(){return navigator.maxTouchPoints||"ontouchstart"in this}function _b(){var e=hb,n=yb,o=gb,i=bb,a={},r=Ti("start","drag","end"),l=0,s,c,d,u,m=0;function f(E){E.on("mousedown.drag",p).filter(i).on("touchstart.drag",_).on("touchmove.drag",b,pb).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(E,D){if(!(u||!e.call(this,E,D))){var $=h(this,n.call(this,E,D),E,D,"mouse");$&&(vt(E.view).on("mousemove.drag",y,Ao).on("mouseup.drag",g,Ao),sd(E.view),vr(E),d=!1,s=E.clientX,c=E.clientY,$("start",E))}}function y(E){if(Jn(E),!d){var D=E.clientX-s,$=E.clientY-c;d=D*D+$*$>m}a.mouse("drag",E)}function g(E){vt(E.view).on("mousemove.drag mouseup.drag",null),cd(E.view,d),Jn(E),a.mouse("end",E)}function _(E,D){if(e.call(this,E,D)){var $=E.changedTouches,H=n.call(this,E,D),j=$.length,v,T;for(v=0;v<j;++v)(T=h(this,H,E,D,$[v].identifier,$[v]))&&(vr(E),T("start",E,$[v]))}}function b(E){var D=E.changedTouches,$=D.length,H,j;for(H=0;H<$;++H)(j=a[D[H].identifier])&&(Jn(E),j("drag",E,D[H]))}function N(E){var D=E.changedTouches,$=D.length,H,j;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),H=0;H<$;++H)(j=a[D[H].identifier])&&(vr(E),j("end",E,D[H]))}function h(E,D,$,H,j,v){var T=r.copy(),F=Bt(v||$,D),I,le,k;if((k=o.call(E,new xr("beforestart",{sourceEvent:$,target:f,identifier:j,active:l,x:F[0],y:F[1],dx:0,dy:0,dispatch:T}),H))!=null)return I=k.x-F[0]||0,le=k.y-F[1]||0,function Y(C,W,ee){var ae=F,L;switch(C){case"start":a[j]=Y,L=l++;break;case"end":delete a[j],--l;case"drag":F=Bt(ee||W,D),L=l;break}T.call(C,E,new xr(C,{sourceEvent:W,subject:k,target:f,identifier:j,active:L,x:F[0]+I,y:F[1]+le,dx:F[0]-ae[0],dy:F[1]-ae[1],dispatch:T}),H)}}return f.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Di(!!E),f):e},f.container=function(E){return arguments.length?(n=typeof E=="function"?E:Di(E),f):n},f.subject=function(E){return arguments.length?(o=typeof E=="function"?E:Di(E),f):o},f.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:Di(!!E),f):i},f.on=function(){var E=r.on.apply(r,arguments);return E===r?f:E},f.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,f):Math.sqrt(m)},f}function Ir(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function dd(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function To(){}var Vo=.7,Oi=1/Vo,Zn="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Dt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Eb=/^#([0-9a-f]{3,8})$/,kb=new RegExp(`^rgb\\(${Zn},${Zn},${Zn}\\)$`),Nb=new RegExp(`^rgb\\(${Dt},${Dt},${Dt}\\)$`),wb=new RegExp(`^rgba\\(${Zn},${Zn},${Zn},${Mo}\\)$`),vb=new RegExp(`^rgba\\(${Dt},${Dt},${Dt},${Mo}\\)$`),xb=new RegExp(`^hsl\\(${Mo},${Dt},${Dt}\\)$`),Ib=new RegExp(`^hsla\\(${Mo},${Dt},${Dt},${Mo}\\)$`),ud={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};Ir(To,_n,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:md,formatHex:md,formatHex8:Cb,formatHsl:Sb,formatRgb:fd,toString:fd});function md(){return this.rgb().formatHex()}function Cb(){return this.rgb().formatHex8()}function Sb(){return bd(this).formatHsl()}function fd(){return this.rgb().formatRgb()}function _n(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Eb.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?pd(n):o===3?new ht(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Li(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Li(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=kb.exec(e))?new ht(n[1],n[2],n[3],1):(n=Nb.exec(e))?new ht(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=wb.exec(e))?Li(n[1],n[2],n[3],n[4]):(n=vb.exec(e))?Li(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=xb.exec(e))?gd(n[1],n[2]/100,n[3]/100,1):(n=Ib.exec(e))?gd(n[1],n[2]/100,n[3]/100,n[4]):ud.hasOwnProperty(e)?pd(ud[e]):e==="transparent"?new ht(NaN,NaN,NaN,0):null}function pd(e){return new ht(e>>16&255,e>>8&255,e&255,1)}function Li(e,n,o,i){return i<=0&&(e=n=o=NaN),new ht(e,n,o,i)}function $b(e){return e instanceof To||(e=_n(e)),e?(e=e.rgb(),new ht(e.r,e.g,e.b,e.opacity)):new ht}function Cr(e,n,o,i){return arguments.length===1?$b(e):new ht(e,n,o,i??1)}function ht(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Ir(ht,Cr,dd(To,{brighter(e){return e=e==null?Oi:Math.pow(Oi,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vo:Math.pow(Vo,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ht(En(this.r),En(this.g),En(this.b),Pi(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:hd,formatHex:hd,formatHex8:Rb,formatRgb:yd,toString:yd}));function hd(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}`}function Rb(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}${kn((isNaN(this.opacity)?1:this.opacity)*255)}`}function yd(){const e=Pi(this.opacity);return`${e===1?"rgb(":"rgba("}${En(this.r)}, ${En(this.g)}, ${En(this.b)}${e===1?")":`, ${e})`}`}function Pi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function En(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function kn(e){return e=En(e),(e<16?"0":"")+e.toString(16)}function gd(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new xt(e,n,o,i)}function bd(e){if(e instanceof xt)return new xt(e.h,e.s,e.l,e.opacity);if(e instanceof To||(e=_n(e)),!e)return new xt;if(e instanceof xt)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 xt(l,s,c,e.opacity)}function Ab(e,n,o,i){return arguments.length===1?bd(e):new xt(e,n,o,i??1)}function xt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Ir(xt,Ab,dd(To,{brighter(e){return e=e==null?Oi:Math.pow(Oi,e),new xt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vo:Math.pow(Vo,e),new xt(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 ht(Sr(e>=240?e-240:e+120,a,i),Sr(e,a,i),Sr(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new xt(_d(this.h),zi(this.s),zi(this.l),Pi(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=Pi(this.opacity);return`${e===1?"hsl(":"hsla("}${_d(this.h)}, ${zi(this.s)*100}%, ${zi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function _d(e){return e=(e||0)%360,e<0?e+360:e}function zi(e){return Math.max(0,Math.min(1,e||0))}function Sr(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 $r=e=>()=>e;function Tb(e,n){return function(o){return e+o*n}}function Vb(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 Mb(e){return(e=+e)==1?Ed:function(n,o){return o-n?Vb(n,o,e):$r(isNaN(n)?o:n)}}function Ed(e,n){var o=n-e;return o?Tb(e,o):$r(isNaN(e)?n:e)}const Ui=(function e(n){var o=Mb(n);function i(a,r){var l=o((a=Cr(a)).r,(r=Cr(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Ed(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 Bb(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 Db(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ob(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]=Bo(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 Lb(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function Ot(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function Pb(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]=Bo(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Rr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ar=new RegExp(Rr.source,"g");function zb(e){return function(){return e}}function Ub(e){return function(n){return e(n)+""}}function kd(e,n){var o=Rr.lastIndex=Ar.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Rr.exec(e))&&(a=Ar.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:Ot(i,a)})),o=Ar.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?Ub(c[0].x):zb(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 Bo(e,n){var o=typeof n,i;return n==null||o==="boolean"?$r(n):(o==="number"?Ot:o==="string"?(i=_n(n))?(n=i,Ui):kd:n instanceof _n?Ui:n instanceof Date?Lb:Db(n)?Bb:Array.isArray(n)?Ob:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?Pb:Ot)(e,n)}var Nd=180/Math.PI,Tr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wd(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)*Nd,skewX:Math.atan(c)*Nd,scaleX:l,scaleY:s}}var Fi;function Fb(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Tr:wd(n.a,n.b,n.c,n.d,n.e,n.f)}function Hb(e){return e==null||(Fi||(Fi=document.createElementNS("http://www.w3.org/2000/svg","g")),Fi.setAttribute("transform",e),!(e=Fi.transform.baseVal.consolidate()))?Tr:(e=e.matrix,wd(e.a,e.b,e.c,e.d,e.e,e.f))}function vd(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push("translate(",null,n,null,o);y.push({i:g-4,x:Ot(d,m)},{i:g-2,x:Ot(u,f)})}else(m||f)&&p.push("translate("+m+n+f+o)}function l(d,u,m,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Ot(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,f){d!==u?f.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Ot(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push(a(p)+"scale(",null,",",null,")");y.push({i:g-4,x:Ot(d,m)},{i:g-2,x:Ot(u,f)})}else(m!==1||f!==1)&&p.push(a(p)+"scale("+m+","+f+")")}return function(d,u){var m=[],f=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,f),l(d.rotate,u.rotate,m,f),s(d.skewX,u.skewX,m,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,f),d=u=null,function(p){for(var y=-1,g=f.length,_;++y<g;)m[(_=f[y]).i]=_.x(p);return m.join("")}}}var Gb=vd(Fb,"px, ","px)","deg)"),jb=vd(Hb,", ",")",")"),Kb=1e-12;function xd(e){return((e=Math.exp(e))+1/e)/2}function Yb(e){return((e=Math.exp(e))-1/e)/2}function Wb(e){return((e=Math.exp(2*e))-1)/(e+1)}const Hi=(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],f=l[2],p=u-s,y=m-c,g=p*p+y*y,_,b;if(g<Kb)b=Math.log(f/d)/n,_=function(H){return[s+H*p,c+H*y,d*Math.exp(n*H*b)]};else{var N=Math.sqrt(g),h=(f*f-d*d+i*g)/(2*d*o*N),E=(f*f-d*d-i*g)/(2*f*o*N),D=Math.log(Math.sqrt(h*h+1)-h),$=Math.log(Math.sqrt(E*E+1)-E);b=($-D)/n,_=function(H){var j=H*b,v=xd(D),T=d/(o*N)*(v*Wb(n*j+D)-Yb(D));return[s+T*p,c+T*y,d*v/xd(n*j+D)]}}return _.duration=b*1e3*n/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Qn=0,Do=0,Oo=0,Id=1e3,Gi,Lo,ji=0,Nn=0,Ki=0,Po=typeof performance=="object"&&performance.now?performance:Date,Cd=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vr(){return Nn||(Cd(qb),Nn=Po.now()+Ki)}function qb(){Nn=0}function Yi(){this._call=this._time=this._next=null}Yi.prototype=Sd.prototype={constructor:Yi,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Vr():+o)+(n==null?0:+n),!this._next&&Lo!==this&&(Lo?Lo._next=this:Gi=this,Lo=this),this._call=e,this._time=o,Mr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mr())}};function Sd(e,n,o){var i=new Yi;return i.restart(e,n,o),i}function Xb(){Vr(),++Qn;for(var e=Gi,n;e;)(n=Nn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Qn}function $d(){Nn=(ji=Po.now())+Ki,Qn=Do=0;try{Xb()}finally{Qn=0,Zb(),Nn=0}}function Jb(){var e=Po.now(),n=e-ji;n>Id&&(Ki-=n,ji=e)}function Zb(){for(var e,n=Gi,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:Gi=o);Lo=e,Mr(i)}function Mr(e){if(!Qn){Do&&(Do=clearTimeout(Do));var n=e-Nn;n>24?(e<1/0&&(Do=setTimeout($d,e-Po.now()-Ki)),Oo&&(Oo=clearInterval(Oo))):(Oo||(ji=Po.now(),Oo=setInterval(Jb,Id)),Qn=1,Cd($d))}}function Rd(e,n,o){var i=new Yi;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var Qb=Ti("start","end","cancel","interrupt"),e_=[],Ad=0,Td=1,Br=2,Wi=3,Vd=4,Dr=5,qi=6;function Xi(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;t_(e,o,{name:n,index:i,group:a,on:Qb,tween:e_,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Ad})}function Or(e,n){var o=It(e,n);if(o.state>Ad)throw new Error("too late; already scheduled");return o}function Lt(e,n){var o=It(e,n);if(o.state>Wi)throw new Error("too late; already running");return o}function It(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function t_(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Sd(r,0,o.time);function r(d){o.state=Td,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,f,p;if(o.state!==Td)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Wi)return Rd(l);p.state===Vd?(p.state=qi,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<n&&(p.state=qi,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Rd(function(){o.state===Wi&&(o.state=Vd,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Br,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Br){for(o.state=Wi,a=new Array(f=o.tween.length),u=0,m=-1;u<f;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Dr,1),m=-1,f=a.length;++m<f;)a[m].call(e,u);o.state===Dr&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=qi,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Ji(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>Br&&i.state<Dr,i.state=qi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function n_(e){return this.each(function(){Ji(this,e)})}function o_(e,n){var o,i;return function(){var a=Lt(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 i_(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Lt(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 a_(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=It(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?o_:i_)(o,e,n))}function Lr(e,n,o){var i=e._id;return e.each(function(){var a=Lt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return It(a,i).value[n]}}function Md(e,n){var o;return(typeof n=="number"?Ot:n instanceof _n?Ui:(o=_n(n))?(n=o,Ui):kd)(e,n)}function r_(e){return function(){this.removeAttribute(e)}}function l_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function s_(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 c_(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 d_(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 u_(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 m_(e,n){var o=Mi(e),i=o==="transform"?jb:Md;return this.attrTween(e,typeof n=="function"?(o.local?u_:d_)(o,i,Lr(this,"attr."+e,n)):n==null?(o.local?l_:r_)(o):(o.local?c_:s_)(o,i,n))}function f_(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function p_(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function h_(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&p_(e,r)),o}return a._value=n,a}function y_(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&f_(e,r)),o}return a._value=n,a}function g_(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=Mi(e);return this.tween(o,(i.local?h_:y_)(i,n))}function b_(e,n){return function(){Or(this,e).delay=+n.apply(this,arguments)}}function __(e,n){return n=+n,function(){Or(this,e).delay=n}}function E_(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?b_:__)(n,e)):It(this.node(),n).delay}function k_(e,n){return function(){Lt(this,e).duration=+n.apply(this,arguments)}}function N_(e,n){return n=+n,function(){Lt(this,e).duration=n}}function w_(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?k_:N_)(n,e)):It(this.node(),n).duration}function v_(e,n){if(typeof n!="function")throw new Error;return function(){Lt(this,e).ease=n}}function x_(e){var n=this._id;return arguments.length?this.each(v_(n,e)):It(this.node(),n).ease}function I_(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Lt(this,e).ease=o}}function C_(e){if(typeof e!="function")throw new Error;return this.each(I_(this._id,e))}function S_(e){typeof e!="function"&&(e=Zc(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 Gt(i,this._parents,this._name,this._id)}function $_(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),f,p=0;p<u;++p)(f=c[p]||d[p])&&(m[p]=f);for(;s<i;++s)l[s]=n[s];return new Gt(l,this._parents,this._name,this._id)}function R_(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 A_(e,n,o){var i,a,r=R_(n)?Or:Lt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function T_(e,n){var o=this._id;return arguments.length<2?It(this.node(),o).on.on(e):this.each(A_(o,e,n))}function V_(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function M_(){return this.on("end.remove",V_(this._id))}function B_(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Nr(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,f=0;f<c;++f)(u=s[f])&&(m=e.call(u,u.__data__,f,s))&&("__data__"in u&&(m.__data__=u.__data__),d[f]=m,Xi(d[f],n,o,f,d,It(u,o)));return new Gt(r,this._parents,n,o)}function D_(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Jc(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 f=e.call(u,u.__data__,m,c),p,y=It(u,o),g=0,_=f.length;g<_;++g)(p=f[g])&&Xi(p,n,o,g,f,y);r.push(f),l.push(u)}return new Gt(r,l,n,o)}var O_=Ro.prototype.constructor;function L_(){return new O_(this._groups,this._parents)}function P_(e,n){var o,i,a;return function(){var r=Xn(this,e),l=(this.style.removeProperty(e),Xn(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Bd(e){return function(){this.style.removeProperty(e)}}function z_(e,n,o){var i,a=o+"",r;return function(){var l=Xn(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function U_(e,n,o){var i,a,r;return function(){var l=Xn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Xn(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function F_(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Lt(this,e),d=c.on,u=c.value[r]==null?s||(s=Bd(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function H_(e,n,o){var i=(e+="")=="transform"?Gb:Md;return n==null?this.styleTween(e,P_(e,i)).on("end.style."+e,Bd(e)):typeof n=="function"?this.styleTween(e,U_(e,i,Lr(this,"style."+e,n))).each(F_(this._id,e)):this.styleTween(e,z_(e,i,n),o).on("end.style."+e,null)}function G_(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function j_(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&G_(e,l,o)),i}return r._value=n,r}function K_(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,j_(e,n,o??""))}function Y_(e){return function(){this.textContent=e}}function W_(e){return function(){var n=e(this);this.textContent=n??""}}function q_(e){return this.tween("text",typeof e=="function"?W_(Lr(this,"text",e)):Y_(e==null?"":e+""))}function X_(e){return function(n){this.textContent=e.call(this,n)}}function J_(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&X_(a)),n}return i._value=e,i}function Z_(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,J_(e))}function Q_(){for(var e=this._name,n=this._id,o=Dd(),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=It(c,n);Xi(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Gt(i,this._parents,e,o)}function e1(){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=Lt(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 t1=0;function Gt(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Dd(){return++t1}var jt=Ro.prototype;Gt.prototype={constructor:Gt,select:B_,selectAll:D_,selectChild:jt.selectChild,selectChildren:jt.selectChildren,filter:S_,merge:$_,selection:L_,transition:Q_,call:jt.call,nodes:jt.nodes,node:jt.node,size:jt.size,empty:jt.empty,each:jt.each,on:T_,attr:m_,attrTween:g_,style:H_,styleTween:K_,text:q_,textTween:Z_,remove:M_,tween:a_,delay:E_,duration:w_,ease:x_,easeVarying:C_,end:e1,[Symbol.iterator]:jt[Symbol.iterator]};function n1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var o1={time:null,delay:0,duration:250,ease:n1};function i1(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 a1(e){var n,o;e instanceof Gt?(n=e._id,e=e._name):(n=Dd(),(o=o1).time=Vr(),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])&&Xi(c,e,n,d,l,o||i1(c,n));return new Gt(i,this._parents,e,n)}Ro.prototype.interrupt=n_,Ro.prototype.transition=a1;const Zi=e=>()=>e;function r1(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 Kt(e,n,o){this.k=e,this.x=n,this.y=o}Kt.prototype={constructor:Kt,scale:function(e){return e===1?this:new Kt(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Kt(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 eo=new Kt(1,0,0);Kt.prototype;function Pr(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function l1(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function s1(){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 Od(){return this.__zoom||eo}function c1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function d1(){return navigator.maxTouchPoints||"ontouchstart"in this}function u1(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 m1(){var e=l1,n=s1,o=u1,i=c1,a=d1,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Hi,d=Ti("start","zoom","end"),u,m,f,p=500,y=150,g=0,_=10;function b(k){k.property("__zoom",Od).on("wheel.zoom",j,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",le).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(k,Y,C,W){var ee=k.selection?k.selection():k;ee.property("__zoom",Od),k!==ee?D(k,Y,C,W):ee.interrupt().each(function(){$(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(k,Y,C,W){b.scaleTo(k,function(){var ee=this.__zoom.k,ae=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*ae},C,W)},b.scaleTo=function(k,Y,C,W){b.transform(k,function(){var ee=n.apply(this,arguments),ae=this.__zoom,L=C==null?E(ee):typeof C=="function"?C.apply(this,arguments):C,U=ae.invert(L),ne=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(ae,ne),L,U),ee,l)},C,W)},b.translateBy=function(k,Y,C,W){b.transform(k,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof C=="function"?C.apply(this,arguments):C),n.apply(this,arguments),l)},null,W)},b.translateTo=function(k,Y,C,W,ee){b.transform(k,function(){var ae=n.apply(this,arguments),L=this.__zoom,U=W==null?E(ae):typeof W=="function"?W.apply(this,arguments):W;return o(eo.translate(U[0],U[1]).scale(L.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof C=="function"?-C.apply(this,arguments):-C),ae,l)},W,ee)};function N(k,Y){return Y=Math.max(r[0],Math.min(r[1],Y)),Y===k.k?k:new Kt(Y,k.x,k.y)}function h(k,Y,C){var W=Y[0]-C[0]*k.k,ee=Y[1]-C[1]*k.k;return W===k.x&&ee===k.y?k:new Kt(k.k,W,ee)}function E(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function D(k,Y,C,W){k.on("start.zoom",function(){$(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(W).end()}).tween("zoom",function(){var ee=this,ae=arguments,L=$(ee,ae).event(W),U=n.apply(ee,ae),ne=C==null?E(U):typeof C=="function"?C.apply(ee,ae):C,ue=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),Ne=ee.__zoom,se=typeof Y=="function"?Y.apply(ee,ae):Y,me=c(Ne.invert(ne).concat(ue/Ne.k),se.invert(ne).concat(ue/se.k));return function(_e){if(_e===1)_e=se;else{var Ie=me(_e),Ve=ue/Ie[2];_e=new Kt(Ve,ne[0]-Ie[0]*Ve,ne[1]-Ie[1]*Ve)}L.zoom(null,_e)}})}function $(k,Y,C){return!C&&k.__zooming||new H(k,Y)}function H(k,Y){this.that=k,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,Y),this.taps=0}H.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,Y){return this.mouse&&k!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var Y=vt(this.that).datum();d.call(k,this.that,new r1(k,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),Y)}};function j(k,...Y){if(!e.apply(this,arguments))return;var C=$(this,Y).event(k),W=this.__zoom,ee=Math.max(r[0],Math.min(r[1],W.k*Math.pow(2,i.apply(this,arguments)))),ae=Bt(k);if(C.wheel)(C.mouse[0][0]!==ae[0]||C.mouse[0][1]!==ae[1])&&(C.mouse[1]=W.invert(C.mouse[0]=ae)),clearTimeout(C.wheel);else{if(W.k===ee)return;C.mouse=[ae,W.invert(ae)],Ji(this),C.start()}zo(k),C.wheel=setTimeout(L,y),C.zoom("mouse",o(h(N(W,ee),C.mouse[0],C.mouse[1]),C.extent,l));function L(){C.wheel=null,C.end()}}function v(k,...Y){if(f||!e.apply(this,arguments))return;var C=k.currentTarget,W=$(this,Y,!0).event(k),ee=vt(k.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",ue,!0),ae=Bt(k,C),L=k.clientX,U=k.clientY;sd(k.view),Pr(k),W.mouse=[ae,this.__zoom.invert(ae)],Ji(this),W.start();function ne(Ne){if(zo(Ne),!W.moved){var se=Ne.clientX-L,me=Ne.clientY-U;W.moved=se*se+me*me>g}W.event(Ne).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=Bt(Ne,C),W.mouse[1]),W.extent,l))}function ue(Ne){ee.on("mousemove.zoom mouseup.zoom",null),cd(Ne.view,W.moved),zo(Ne),W.event(Ne).end()}}function T(k,...Y){if(e.apply(this,arguments)){var C=this.__zoom,W=Bt(k.changedTouches?k.changedTouches[0]:k,this),ee=C.invert(W),ae=C.k*(k.shiftKey?.5:2),L=o(h(N(C,ae),W,ee),n.apply(this,Y),l);zo(k),s>0?vt(this).transition().duration(s).call(D,L,W,k):vt(this).call(b.transform,L,W,k)}}function F(k,...Y){if(e.apply(this,arguments)){var C=k.touches,W=C.length,ee=$(this,Y,k.changedTouches.length===W).event(k),ae,L,U,ne;for(Pr(k),L=0;L<W;++L)U=C[L],ne=Bt(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==ne[2]&&(ee.touch1=ne,ee.taps=0):(ee.touch0=ne,ae=!0,ee.taps=1+!!u);u&&(u=clearTimeout(u)),ae&&(ee.taps<2&&(m=ne[0],u=setTimeout(function(){u=null},p)),Ji(this),ee.start())}}function I(k,...Y){if(this.__zooming){var C=$(this,Y).event(k),W=k.changedTouches,ee=W.length,ae,L,U,ne;for(zo(k),ae=0;ae<ee;++ae)L=W[ae],U=Bt(L,this),C.touch0&&C.touch0[2]===L.identifier?C.touch0[0]=U:C.touch1&&C.touch1[2]===L.identifier&&(C.touch1[0]=U);if(L=C.that.__zoom,C.touch1){var ue=C.touch0[0],Ne=C.touch0[1],se=C.touch1[0],me=C.touch1[1],_e=(_e=se[0]-ue[0])*_e+(_e=se[1]-ue[1])*_e,Ie=(Ie=me[0]-Ne[0])*Ie+(Ie=me[1]-Ne[1])*Ie;L=N(L,Math.sqrt(_e/Ie)),U=[(ue[0]+se[0])/2,(ue[1]+se[1])/2],ne=[(Ne[0]+me[0])/2,(Ne[1]+me[1])/2]}else if(C.touch0)U=C.touch0[0],ne=C.touch0[1];else return;C.zoom("touch",o(h(L,U,ne),C.extent,l))}}function le(k,...Y){if(this.__zooming){var C=$(this,Y).event(k),W=k.changedTouches,ee=W.length,ae,L;for(Pr(k),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),ae=0;ae<ee;++ae)L=W[ae],C.touch0&&C.touch0[2]===L.identifier?delete C.touch0:C.touch1&&C.touch1[2]===L.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(L=Bt(L,this),Math.hypot(m[0]-L[0],m[1]-L[1])<_)){var U=vt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Zi(+k),b):i},b.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Zi(!!k),b):e},b.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Zi(!!k),b):a},b.extent=function(k){return arguments.length?(n=typeof k=="function"?k:Zi([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),b):n},b.scaleExtent=function(k){return arguments.length?(r[0]=+k[0],r[1]=+k[1],b):[r[0],r[1]]},b.translateExtent=function(k){return arguments.length?(l[0][0]=+k[0][0],l[1][0]=+k[1][0],l[0][1]=+k[0][1],l[1][1]=+k[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(k){return arguments.length?(o=k,b):o},b.duration=function(k){return arguments.length?(s=+k,b):s},b.interpolate=function(k){return arguments.length?(c=k,b):c},b.on=function(){var k=d.on.apply(d,arguments);return k===d?b:k},b.clickDistance=function(k){return arguments.length?(g=(k=+k)*k,b):Math.sqrt(g)},b.tapDistance=function(k){return arguments.length?(_=+k,b):_},b}var Ae=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Ae||{}),zr=(e=>(e.Partial="partial",e.Full="full",e))(zr||{}),wn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(wn||{}),Yt=(e=>(e.Strict="strict",e.Loose="loose",e))(Yt||{}),Ur=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Ur||{}),Uo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Uo||{}),Ld=(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))(Ld||{});const f1=["INPUT","SELECT","TEXTAREA"],p1=typeof document<"u"?document:null;function Fr(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 f1.includes(i==null?void 0:i.nodeName)||a||!!r}function h1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Pd(e,n,o,i){const a=n.replace("+",`
|
|
24
24
|
`).replace(`
|
|
25
25
|
|
|
26
26
|
`,`
|
|
27
27
|
+`).split(`
|
|
28
|
-
`).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.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 s1(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=c1(o.code,e);return Array.isArray(e)?e.some(a=>Bd(o[i],a,t,o.type==="keyup")):Bd(o[i],e,t,o.type==="keyup")}}function c1(e,t){return t.includes(e)?"code":"key"}function Fo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??r1),i=n.shallowRef(n.toValue(e)===!0);let a=!1;const r=new Set;let l=c(n.toValue(e));n.watch(()=>n.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),Fc(["blur","contextmenu"],s),Hc((...d)=>l(...d),d=>{var u,m;const f=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,p=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=l1(d),(!a||a&&!f)&&zr(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,_=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!p&&(a||!_)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Hc((...d)=>l(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&zr(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=n.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"?s1(d,r):d}return i}const Dd="vue-flow__node-desc",Od="vue-flow__edge-desc",d1="vue-flow__aria-live",Ld=["Enter"," ","Escape"],to={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Qi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function ea(e,t){const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(o*i)}function ta(e){return{width:e.offsetWidth,height:e.offsetHeight}}function wn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Pd(e,t){return{x:wn(e.x,t[0][0],t[1][0]),y:wn(e.y,t[0][1],t[1][1])}}function zd(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function nn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function vn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!nn(e)}function Ho(e){return vn(e)&&"computedPosition"in e}function na(e){return!Number.isNaN(e)&&Number.isFinite(e)}function u1(e){return na(e.width)&&na(e.height)&&na(e.x)&&na(e.y)}function m1(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.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:tt(e.data)?e.data:{},events:n.markRaw(tt(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function Ud(e,t,o){var i,a;const r={id:e.id.toString(),type:e.type??(t==null?void 0:t.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:tt(e.data)?e.data:{},events:n.markRaw(tt(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Fd(e,t,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 t.filter(s=>r.has(s.id))}function f1(...e){if(e.length===3){const[r,l,s]=e;return Fd(r,l,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(r=>nn(r)&&r.source===i).map(r=>o.find(l=>vn(l)&&l.id===r.target))}function p1(...e){if(e.length===3){const[r,l,s]=e;return Fd(r,l,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(r=>nn(r)&&r.target===i).map(r=>o.find(l=>vn(l)&&l.id===r.source))}function Hd({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function h1(e,t){return t.some(o=>nn(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 Go({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function jo({x:e,y:t},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(t-i)/a};return r?ia(s,l):s}function Gd(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function oa({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function jd({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function y1(e,t){return jd(Gd(oa(e),oa(t)))}function Ur(e){let t={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];t=Gd(t,oa({...i.computedPosition,...i.dimensions}))}return jd(t)}function Kd(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...jo(t,o),width:t.width/o.zoom,height:t.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,f=c.height??s.height??null;if(a&&!d||u)continue;const p=ea(r,Qi(s)),y=m===null||f===null,g=i&&p>0,_=(m??0)*(f??0);(y||g||p>=_||s.dragging)&&l.push(s)}return l}function xn(e,t){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 t.filter(i=>o.has(i.source)||o.has(i.target))}function no(e,t){if(typeof e=="number")return Math.floor((t-t/(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(t*o*.01)}return Wo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function g1(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=no(e,o),a=no(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=no(e.top??e.y??0,o),a=no(e.bottom??e.y??0,o),r=no(e.left??e.x??0,t),l=no(e.right??e.x??0,t);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 b1(e,t,o,i,a,r){const{x:l,y:s}=Go(e,{x:t,y:o,zoom:i}),{x:c,y:d}=Go({x:e.x+e.width,y:e.y+e.height},{x:t,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 Yd(e,t,o,i,a,r=.1){const l=g1(r,t,o),s=(t-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=wn(d,i,a),m=e.x+e.width/2,f=e.y+e.height/2,p=t/2-m*u,y=o/2-f*u,g=b1(e,p,y,u,t,o),_={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:p-_.left+_.right,y:y-_.top+_.bottom,zoom:u}}function _1(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Wd(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Wd(o,t):!1}function Ko(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Fr(e){const t=e.ctrlKey&&Yo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function qd(e,t,o){return e<t?wn(Math.abs(e-t),1,t)/t:e>o?-wn(Math.abs(e-o),1,t)/t:0}function Xd(e,t,o=15,i=40){const a=qd(e.x,i,t.width-i)*o,r=qd(e.y,i,t.height-i)*o;return[a,r]}function Hr(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof t.style=="function"?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.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(t.position.x=t.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(t.position.y=t.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}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const l=t.style;return{...l(r),...a}}:t.style={...t.style,...a}}}}function Jd(e,t){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")t.findIndex(c=>c.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const s=t.findIndex(c=>c.id===l.id);s!==-1&&t.splice(s,1)}const r=t.map(l=>l.id);for(const l of t)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(Ho(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=t[r.indexOf(l.parentNode)];c&&Ho(c)&&Hr(l,c)}break;case"dimensions":if(Ho(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=t[r.indexOf(l.parentNode)];c&&Ho(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Hr(l,c):n.nextTick(()=>{Hr(l,c)}))}break}return t}function on(e,t){return{id:e,type:"select",selected:t}}function Zd(e){return{item:e,type:"add"}}function Qd(e){return{id:e,type:"remove"}}function eu(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function an(e,t=new Set,o=!1){const i=[];for(const[a,r]of e){const l=t.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(on(r.id,l)))}return i}const tu=()=>{};function Se(e){const t=new Set;let o=tu,i=()=>!1;const a=()=>t.size>0||i(),r=f=>{o=f},l=()=>{o=tu},s=f=>{i=f},c=()=>{i=()=>!1},d=f=>{t.delete(f)};return{on:f=>{t.add(f);const p=()=>d(f);return $o(p),{off:p}},off:d,trigger:f=>{const p=[o];return a()?p.push(...t):e&&p.push(e),Promise.allSettled(p.map(y=>y(f)))},hasListeners:a,listeners:t,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function nu(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function k1(e,t,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Wd(c,e))&&(c.draggable||t&&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 Gr({id:e,dragItems:t,findNode:o}){const i=[];for(const a of t){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function ou(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 E1(e,t,o){const[i,a,r,l]=typeof e!="string"?ou(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 N1(e,t,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=E1(a,e,i);r&&(a=r)}else t(new it(et.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]=ou(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 w1({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function jr(e,t,o,i,a){const r=w1(e.dimensions,N1(e,o,i,a)),l=Pd(t,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 oo(e,t,o=Re.Left,i=!1){const a=((t==null?void 0:t.x)??0)+e.computedPosition.x,r=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:l,height:s}=t??C1(e);if(i)return{x:a+l/2,y:r+s/2};switch((t==null?void 0:t.position)??o){case Re.Top:return{x:a+l/2,y:r};case Re.Right:return{x:a+l,y:r+s/2};case Re.Bottom:return{x:a+l/2,y:r+s};case Re.Left:return{x:a,y:r+s/2}}}function iu(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function v1({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.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)),f=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*f)>0}function x1(e,t,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var et=(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))(et||{});const au={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
|
|
28
|
+
`).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 y1(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=g1(o.code,e);return Array.isArray(e)?e.some(a=>Pd(o[i],a,n,o.type==="keyup")):Pd(o[i],e,n,o.type==="keyup")}}function g1(e,n){return n.includes(e)?"code":"key"}function Fo(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??p1),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}),Kc(["blur","contextmenu"],s),Yc((...d)=>l(...d),d=>{var u,m;const f=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,p=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=h1(d),(!a||a&&!f)&&Fr(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,_=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!p&&(a||!_)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Yc((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Fr(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"?y1(d,r):d}return i}const zd="vue-flow__node-desc",Ud="vue-flow__edge-desc",b1="vue-flow__aria-live",Fd=["Enter"," ","Escape"],to={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Qi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function ea(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 ta(e){return{width:e.offsetWidth,height:e.offsetHeight}}function vn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function Hd(e,n){return{x:vn(e.x,n[0][0],n[1][0]),y:vn(e.y,n[0][1],n[1][1])}}function Gd(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function nn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function xn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!nn(e)}function Ho(e){return xn(e)&&"computedPosition"in e}function na(e){return!Number.isNaN(e)&&Number.isFinite(e)}function _1(e){return na(e.width)&&na(e.height)&&na(e.x)&&na(e.y)}function E1(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:tt(e.data)?e.data:{},events:t.markRaw(tt(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function jd(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:tt(e.data)?e.data:{},events:t.markRaw(tt(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 Kd(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 k1(...e){if(e.length===3){const[r,l,s]=e;return Kd(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>nn(r)&&r.source===i).map(r=>o.find(l=>xn(l)&&l.id===r.target))}function N1(...e){if(e.length===3){const[r,l,s]=e;return Kd(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>nn(r)&&r.target===i).map(r=>o.find(l=>xn(l)&&l.id===r.source))}function Yd({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function w1(e,n){return n.some(o=>nn(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 Go({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function jo({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?ia(s,l):s}function Wd(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 qd({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function v1(e,n){return qd(Wd(oa(e),oa(n)))}function Hr(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=Wd(n,oa({...i.computedPosition,...i.dimensions}))}return qd(n)}function Xd(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...jo(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,f=c.height??s.height??null;if(a&&!d||u)continue;const p=ea(r,Qi(s)),y=m===null||f===null,g=i&&p>0,_=(m??0)*(f??0);(y||g||p>=_||s.dragging)&&l.push(s)}return l}function In(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 no(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 Wo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function x1(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=no(e,o),a=no(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=no(e.top??e.y??0,o),a=no(e.bottom??e.y??0,o),r=no(e.left??e.x??0,n),l=no(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 I1(e,n,o,i,a,r){const{x:l,y:s}=Go(e,{x:n,y:o,zoom:i}),{x:c,y:d}=Go({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 Jd(e,n,o,i,a,r=.1){const l=x1(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=vn(d,i,a),m=e.x+e.width/2,f=e.y+e.height/2,p=n/2-m*u,y=o/2-f*u,g=I1(e,p,y,u,n,o),_={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:p-_.left+_.right,y:y-_.top+_.bottom,zoom:u}}function C1(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Zd(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Zd(o,n):!1}function Ko(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Gr(e){const n=e.ctrlKey&&Yo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function Qd(e,n,o){return e<n?vn(Math.abs(e-n),1,n)/n:e>o?-vn(Math.abs(e-o),1,n)/n:0}function eu(e,n,o=15,i=40){const a=Qd(e.x,i,n.width-i)*o,r=Qd(e.y,i,n.height-i)*o;return[a,r]}function jr(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 tu(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(Ho(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&&Ho(c)&&jr(l,c)}break;case"dimensions":if(Ho(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&&Ho(c)&&(!!c.dimensions.width&&!!c.dimensions.height?jr(l,c):t.nextTick(()=>{jr(l,c)}))}break}return n}function on(e,n){return{id:e,type:"select",selected:n}}function nu(e){return{item:e,type:"add"}}function ou(e){return{id:e,type:"remove"}}function iu(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function an(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(on(r.id,l)))}return i}const au=()=>{};function Re(e){const n=new Set;let o=au,i=()=>!1;const a=()=>n.size>0||i(),r=f=>{o=f},l=()=>{o=au},s=f=>{i=f},c=()=>{i=()=>!1},d=f=>{n.delete(f)};return{on:f=>{n.add(f);const p=()=>d(f);return $o(p),{off:p}},off:d,trigger:f=>{const p=[o];return a()?p.push(...n):e&&p.push(e),Promise.allSettled(p.map(y=>y(f)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function ru(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 S1(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Zd(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 Kr({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 lu(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 $1(e,n,o){const[i,a,r,l]=typeof e!="string"?lu(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 R1(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=$1(a,e,i);r&&(a=r)}else n(new it(et.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]=lu(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 A1({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Yr(e,n,o,i,a){const r=A1(e.dimensions,R1(e,o,i,a)),l=Hd(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 oo(e,n,o=Ae.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??B1(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case Ae.Top:return{x:a+l/2,y:r};case Ae.Right:return{x:a+l,y:r+s/2};case Ae.Bottom:return{x:a+l/2,y:r+s};case Ae.Left:return{x:a,y:r+s/2}}}function su(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function T1({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)),f=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*f)>0}function V1(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 et=(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))(et||{});const cu={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
|
|
29
29
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
30
|
-
Node: ${e}`,NODE_MISSING_PARENT:(e,
|
|
30
|
+
Node: ${e}`,NODE_MISSING_PARENT:(e,n)=>`Node is missing a parent
|
|
31
31
|
Node: ${e}
|
|
32
|
-
Parent: ${
|
|
32
|
+
Parent: ${n}`,NODE_TYPE_MISSING:e=>`Node type is missing
|
|
33
33
|
Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
|
|
34
34
|
Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
|
|
35
|
-
Edge: ${e}`,EDGE_SOURCE_MISSING:(e,
|
|
35
|
+
Edge: ${e}`,EDGE_SOURCE_MISSING:(e,n)=>`Edge source is missing
|
|
36
36
|
Edge: ${e}
|
|
37
|
-
Source: ${
|
|
37
|
+
Source: ${n}`,EDGE_TARGET_MISSING:(e,n)=>`Edge target is missing
|
|
38
38
|
Edge: ${e}
|
|
39
|
-
Target: ${
|
|
40
|
-
Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,
|
|
39
|
+
Target: ${n}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
|
|
40
|
+
Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,n,o)=>`Edge source and target are the same
|
|
41
41
|
Edge: ${e}
|
|
42
|
-
Source: ${
|
|
43
|
-
Target: ${o}`,EDGE_SOURCE_TARGET_MISSING:(e,
|
|
42
|
+
Source: ${n}
|
|
43
|
+
Target: ${o}`,EDGE_SOURCE_TARGET_MISSING:(e,n,o)=>`Edge source or target is missing
|
|
44
44
|
Edge: ${e}
|
|
45
|
-
Source: ${
|
|
45
|
+
Source: ${n}
|
|
46
46
|
Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
47
47
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
48
|
-
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 it extends Error{constructor(t,...o){var i;super((i=au[t])==null?void 0:i.call(au,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function Kr(e){return"clientX"in e}function I1(e){return"sourceEvent"in e}function Ot(e,t){const o=Kr(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-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const Yo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function C1(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function ia(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const S1=()=>!0;function Yr(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function $1(e,t,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of t.values())ea(a,Qi(r))>0&&i.push(r);return i}const R1=250;function A1(e,t,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=$1(e,o,t+R1);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:f,y:p}=oo(d,m,m.position,!0),y=Math.sqrt((f-e.x)**2+(p-e.y)**2);y>t||(y<s?(l=[{...m,x:f,y:p}],s=y):y===s&&l.push({...m,x:f,y:p}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function ru(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=S1},u,m,f,p){const y=r==="target",g=t?l.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:_,y:b}=Ot(e),N=l.elementFromPoint(_,b),h=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:g,k={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const P=lu(void 0,h),A=h.getAttribute("data-nodeid"),G=h.getAttribute("data-handleid"),K=h.classList.contains("connectable"),v=h.classList.contains("connectableend");if(!A||!P)return k;const T={source:y?A:i,sourceHandle:y?G:a,target:y?i:A,targetHandle:y?a:G};k.connection=T;const C=K&&v&&(o===Kt.Strict?y&&P==="source"||!y&&P==="target":A!==i||G!==a);k.isValid=C&&d(T,{nodes:m,edges:u,sourceNode:f(T.source),targetNode:f(T.target)}),k.toHandle=su(A,P,G,p,o,!0)}return k}function lu(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function T1(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function V1(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function su(e,t,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===Kt.Strict?(l=d.handleBounds)==null?void 0:l[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(f=>f.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...oo(d,m,m.position,!0)}:m}const Wr={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top},M1=["production","prod"];function Wo(e,...t){cu()&&console.warn(`[Vue Flow]: ${e}`,...t)}function cu(){return!M1.includes(process.env.NODE_ENV||"")}function du(e,t,o,i,a){const r=t.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,...ta(l)}}):null}function qr(e,t,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&t)&&(i([e]),n.nextTick(()=>{l.blur()})):o([e])}function tt(e){return typeof n.unref(e)<"u"}function B1(e,t,o,i){if(!e||!e.source||!e.target)return o(new it(et.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return nn(e)?a=e:a={...e,id:Hd(e)},a=Ud(a,void 0,i),h1(a,t)?!1:a}function D1(e,t,o,i,a){if(!t.source||!t.target)return a(new it(et.EDGE_INVALID,e.id)),!1;if(!o)return a(new it(et.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Hd(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function uu(e,t,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!vn(l)){o(new it(et.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=m1(l,t(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=t(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new it(et.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 mu(e,t,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,t)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,t)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,t))}}function Xr(e,t,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}`;mu("source",c,u,e,a,l),mu("target",c,d,e,r,s)}}function fu(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function Jr(e,t,o,i,a,r,l,s){const c=[];for(const d of e){const u=nn(d)?d:B1(d,s,a,r);if(!u)continue;const m=o(u.source),f=o(u.target);if(!m||!f){a(new it(et.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new it(et.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!f){a(new it(et.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:l,sourceNode:m,targetNode:f})){a(new it(et.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...Ud(u,p,r),sourceNode:m,targetNode:f})}return c}const pu=Symbol("vueFlow"),hu=Symbol("nodeId"),yu=Symbol("nodeRef"),O1=Symbol("edgeId"),L1=Symbol("edgeRef"),aa=Symbol("slots");function gu(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:f,findNode:p,multiSelectionActive:y,nodesSelectionActive:g,selectNodesOnDrag:_,removeSelectedElements:b,addSelectedNodes:N,updateNodePositions:h,emits:k}=He(),{onStart:P,onDrag:A,onStop:G,onClick:K,el:v,disabled:T,id:H,selectable:C,dragHandle:ae}=e,E=n.shallowRef(!1);let Y=[],S,W=null,ee={x:void 0,y:void 0},ie={x:0,y:0},O=null,U=!1,ne=!1,ce=0,ge=!1;const se=U1(),pe=({x:ke,y:we})=>{ee={x:ke,y:we};let j=!1;if(Y=Y.map(L=>{const x={x:ke-L.distance.x,y:we-L.distance.y},{computedPosition:R}=jr(L,o.value?ia(x,i.value):x,k.error,l.value,L.parentNode?p(L.parentNode):void 0);return j=j||L.position.x!==R.x||L.position.y!==R.y,L.position=R,L}),ne=ne||j,!!j&&(h(Y,!0,!0),E.value=!0,O)){const[L,x]=Gr({id:H,dragItems:Y,findNode:p});A({event:O,node:L,nodes:x})}},be=()=>{if(!W)return;const[ke,we]=Xd(ie,W,u.value);if(ke!==0||we!==0){const j={x:(ee.x??0)-ke/c.value.zoom,y:(ee.y??0)-we/c.value.zoom};f({x:ke,y:we})&&pe(j)}ce=requestAnimationFrame(be)},xe=(ke,we)=>{U=!0;const j=p(H);!_.value&&!y.value&&j&&(j.selected||b()),j&&n.toValue(C)&&_.value&&qr(j,y.value,N,b,g,!1,we);const L=se(ke.sourceEvent);if(ee=L,Y=k1(r.value,m.value,L,H),Y.length){const[x,R]=Gr({id:H,dragItems:Y,findNode:p});P({event:ke.sourceEvent,node:x,nodes:R})}},Te=(ke,we)=>{var j;ke.sourceEvent.type==="touchmove"&&ke.sourceEvent.touches.length>1||(ne=!1,s.value===0&&xe(ke,we),ee=se(ke.sourceEvent),W=((j=t.value)==null?void 0:j.getBoundingClientRect())||null,ie=Ot(ke.sourceEvent,W))},Ae=(ke,we)=>{const j=se(ke.sourceEvent);if(!ge&&U&&d.value&&(ge=!0,be()),!U){const L=j.xSnapped-(ee.x??0),x=j.ySnapped-(ee.y??0);Math.sqrt(L*L+x*x)>s.value&&xe(ke,we)}(ee.x!==j.xSnapped||ee.y!==j.ySnapped)&&Y.length&&U&&(O=ke.sourceEvent,ie=Ot(ke.sourceEvent,W),pe(j))},fe=ke=>{let we=!1;if(!U&&!E.value&&!y.value){const j=ke.sourceEvent,L=se(j),x=L.xSnapped-(ee.x??0),R=L.ySnapped-(ee.y??0),V=Math.sqrt(x*x+R*R);V!==0&&V<=s.value&&(K==null||K(j),we=!0)}if(Y.length&&!we){ne&&(h(Y,!1,!1),ne=!1);const[j,L]=Gr({id:H,dragItems:Y,findNode:p});G({event:ke.sourceEvent,node:j,nodes:L})}Y=[],E.value=!1,ge=!1,U=!1,ee={x:void 0,y:void 0},cancelAnimationFrame(ce)};return n.watch([()=>n.toValue(T),v],([ke,we],j,L)=>{if(we){const x=vt(we);ke||(S=ub().on("start",R=>Te(R,we)).on("drag",R=>Ae(R,we)).on("end",R=>fe(R)).filter(R=>{const V=R.target,Q=n.toValue(ae);return!R.button&&(!a.value||!nu(V,`.${a.value}`,we)&&(!Q||nu(V,Q,we)))}),x.call(S)),L(()=>{x.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),E}function P1(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),updateStart:Se(),update:Se(),updateEnd:Se()}}function z1(e,t){const o=P1();return o.doubleClick.on(i=>{var a,r;t.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;t.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;t.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;t.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;t.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;t.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;t.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;t.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;t.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 U1(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=He();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=I1(a)?a.sourceEvent:a,{x:c,y:d}=Ot(s,l),u=jo({x:c,y:d},e.value),{x:m,y:f}=o.value?ia(u,t.value):u;return{xSnapped:m,ySnapped:f,...u}}}function ra(){return!0}function bu({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:f,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:g,findNode:_,panBy:b,startConnection:N,updateConnection:h,endConnection:k,emits:P,viewport:A,edges:G,nodes:K,isValidConnection:v,nodeLookup:T}=He();let H=null,C=!1,ae=null;function E(S){var W;const ee=n.toValue(o)==="target",ie=Kr(S),O=zd(S.target),U=S.currentTarget;if(U&&(ie&&S.button===0||!ie)){let ne=function(Ee){j=Ot(Ee,fe),pe=A1(jo(j,A.value,!1,[1,1]),u.value,T.value,R),L||(x(),L=!0);const $e=ru(Ee,{handle:pe,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:ee?"target":"source",isValidConnection:se,doc:O,lib:"vue",flowId:s,nodeLookup:T.value},G.value,K.value,_,T.value);ae=$e.handleDomNode,H=$e.connection,C=V1(!!pe,$e.isValid);const Me={...ve,isValid:C,to:$e.toHandle&&C?Go({x:$e.toHandle.x,y:$e.toHandle.y},A.value):j,toHandle:$e.toHandle,toPosition:C&&$e.toHandle?$e.toHandle.position:Wr[R.position],toNode:$e.toHandle?T.value.get($e.toHandle.nodeId):null};if(C&&pe&&(ve!=null&&ve.toHandle)&&Me.toHandle&&ve.toHandle.type===Me.toHandle.type&&ve.toHandle.nodeId===Me.toHandle.nodeId&&ve.toHandle.id===Me.toHandle.id&&ve.to.x===Me.to.x&&ve.to.y===Me.to.y)return;const Ue=pe??$e.toHandle;if(h(Ue&&C?Go({x:Ue.x,y:Ue.y},A.value):j,Ue,T1(!!Ue,C)),ve=Me,!pe&&!C&&!ae)return Yr(we);H&&H.source!==H.target&&ae&&(Yr(we),we=ae,ae.classList.add("connecting","vue-flow__handle-connecting"),ae.classList.toggle("valid",!!C),ae.classList.toggle("vue-flow__handle-valid",!!C))},ce=function(Ee){"touches"in Ee&&Ee.touches.length>0||((pe||ae)&&H&&C&&(r?r(Ee,H):P.connect(H)),P.connectEnd(Ee),a&&(l==null||l(Ee)),Yr(we),cancelAnimationFrame(be),k(Ee),L=!1,C=!1,H=null,ae=null,O.removeEventListener("mousemove",ne),O.removeEventListener("mouseup",ce),O.removeEventListener("touchmove",ne),O.removeEventListener("touchend",ce))};const ge=_(n.toValue(t));let se=n.toValue(i)||v.value||ra;!se&&ge&&(se=(ee?ge.isValidSourcePos:ge.isValidTargetPos)||ra);let pe,be=0;const{x:xe,y:Te}=Ot(S),Ae=lu(n.toValue(a),U),fe=(W=c.value)==null?void 0:W.getBoundingClientRect();if(!fe||!Ae)return;const ke=su(n.toValue(t),Ae,n.toValue(e),T.value,d.value);if(!ke)return;let we,j=Ot(S,fe),L=!1;const x=()=>{if(!y.value)return;const[Ee,$e]=Xd(j,fe,g.value);b({x:Ee,y:$e}),be=requestAnimationFrame(x)},R={...ke,nodeId:n.toValue(t),type:Ae,position:ke.position},V=T.value.get(n.toValue(t)),me={inProgress:!0,isValid:null,from:oo(V,R,Re.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:V,to:j,toHandle:null,toPosition:Wr[R.position],toNode:null};N({nodeId:n.toValue(t),id:n.toValue(e),type:Ae,position:(U==null?void 0:U.getAttribute("data-handlepos"))||Re.Top,...j},{x:xe-fe.left,y:Te-fe.top}),P.connectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ae});let ve=me;O.addEventListener("mousemove",ne),O.addEventListener("mouseup",ce),O.addEventListener("touchmove",ne),O.addEventListener("touchend",ce)}}function Y(S){var W,ee;if(!m.value)return;const ie=n.toValue(o)==="target";if(!f.value){P.clickConnectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e)}),N({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Re.Top,...Ot(S)},void 0,!0);return}let O=n.toValue(i)||v.value||ra;const U=_(n.toValue(t));if(!O&&U&&(O=(ie?U.isValidSourcePos:U.isValidTargetPos)||ra),U&&(typeof U.connectable>"u"?p.value:U.connectable)===!1)return;const ne=zd(S.target),ce=ru(S,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Re.Top,...Ot(S)},connectionMode:d.value,fromNodeId:f.value.nodeId,fromHandleId:f.value.id??null,fromType:f.value.type,isValidConnection:O,doc:ne,lib:"vue",flowId:s,nodeLookup:T.value},G.value,K.value,_,T.value),ge=((W=ce.connection)==null?void 0:W.source)===((ee=ce.connection)==null?void 0:ee.target);ce.isValid&&ce.connection&&!ge&&P.connect(ce.connection),P.clickConnectEnd(S),k(S,!0)}return{handlePointerDown:E,handleClick:Y}}function F1(){return n.inject(hu,"")}function _u(e){const t=e??F1()??"",o=n.inject(yu,n.ref(null)),{findNode:i,edges:a,emits:r}=He(),l=i(t);return l||r.error(new it(et.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:l,parentNode:n.computed(()=>i(l.parentNode)),connectedEdges:n.computed(()=>xn([l],a.value))}}function H1(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),dragStart:Se(),drag:Se(),dragStop:Se()}}function G1(e,t){const o=H1();return o.doubleClick.on(i=>{var a,r;t.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;t.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;t.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;t.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;t.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;t.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;t.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;t.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;t.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 ku(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=He();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,f=d?4:1,p=c.x*u*f,y=c.y*m*f,g=[];for(const _ of e.value)if(_.draggable||l&&typeof _.draggable>"u"){const b={x:_.computedPosition.x+p,y:_.computedPosition.y+y},{position:N}=jr(_,b,s.error,t.value,_.parentNode?i(_.parentNode):void 0);g.push({id:_.id,position:N,from:_.position,distance:{x:c.x,y:c.y},dimensions:_.dimensions})}o(g,!0,!1)}}const la=.1,j1=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function rn(){return Wo("Viewport not initialized yet."),Promise.resolve(!1)}const K1={zoomIn:rn,zoomOut:rn,zoomTo:rn,fitView:rn,setCenter:rn,fitBounds:rn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:rn,setTransform:rn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Y1(e){function t(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Bo:Hi).scaleBy(Zr(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}=Pd({x:-i,y:-a},e.translateExtent),m=eo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?Bo:Hi).transform(Zr(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>t(1.2,a),zoomOut:a=>t(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?Bo:Hi).scaleTo(Zr(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:la,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!f.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(f.id))&&s.push(f);if(!s.length)return Promise.resolve(!1);const c=Ur(s),{x:d,y:u,zoom:m}=Yd(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??la);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:la})=>{const{x:l,y:s,zoom:c}=Yd(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??la);return o(l,s,c,r)},project:a=>jo(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 jo(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 Go(s,e.viewport)}return{x:0,y:0}}}:K1)}function Zr(e,t=0,o=j1,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function W1(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,_,b=!!(o.nodes.value.length||o.edges.value.length);g=qn([e.modelValue,()=>{var N,h;return(h=(N=e.modelValue)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setElements(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,h])=>{var k;(k=e.modelValue)!=null&&k.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...N,...h],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},r=()=>{i.run(()=>{let g,_,b=!!o.nodes.value.length;g=qn([e.nodes,()=>{var N,h;return(h=(N=e.nodes)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setNodes(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.nodes,()=>o.nodes.value.length],([N])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},l=()=>{i.run(()=>{let g,_,b=!!o.edges.value.length;g=qn([e.edges,()=>{var N,h;return(h=(N=e.edges)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setEdges(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.edges,()=>o.edges.value.length],([N])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&tt(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&tt(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&tt(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&tt(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{tt(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},f=()=>{i.run(()=>{const g=async _=>{let b=_;typeof t.autoConnect=="function"&&(b=await t.autoConnect(_)),b!==!1&&o.addEdges([b])};n.watch(()=>t.autoConnect,()=>{tt(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(_,b,N)=>{_?o.onConnect(g):o.hooks.value.connect.off(g),N(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},p=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const _ of Object.keys(t)){const b=_;if(!g.includes(b)){const N=n.toRef(()=>t[b]),h=o[b];n.isRef(h)&&i.run(()=>{n.watch(N,k=>{tt(k)&&(h.value=k)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),f(),p()})()}),()=>i.stop()}function q1(){return{edgesChange:Se(),nodesChange:Se(),nodeDoubleClick:Se(),nodeClick:Se(),nodeMouseEnter:Se(),nodeMouseMove:Se(),nodeMouseLeave:Se(),nodeContextMenu:Se(),nodeDragStart:Se(),nodeDrag:Se(),nodeDragStop:Se(),nodesInitialized:Se(),miniMapNodeClick:Se(),miniMapNodeDoubleClick:Se(),miniMapNodeMouseEnter:Se(),miniMapNodeMouseMove:Se(),miniMapNodeMouseLeave:Se(),connect:Se(),connectStart:Se(),connectEnd:Se(),clickConnectStart:Se(),clickConnectEnd:Se(),paneReady:Se(),init:Se(),move:Se(),moveStart:Se(),moveEnd:Se(),selectionDragStart:Se(),selectionDrag:Se(),selectionDragStop:Se(),selectionContextMenu:Se(),selectionStart:Se(),selectionEnd:Se(),viewportChangeStart:Se(),viewportChange:Se(),viewportChangeEnd:Se(),paneScroll:Se(),paneClick:Se(),paneContextMenu:Se(),paneMouseEnter:Se(),paneMouseMove:Se(),paneMouseLeave:Se(),edgeContextMenu:Se(),edgeMouseEnter:Se(),edgeMouseMove:Se(),edgeMouseLeave:Se(),edgeDoubleClick:Se(),edgeClick:Se(),edgeUpdateStart:Se(),edgeUpdate:Se(),edgeUpdateEnd:Se(),updateNodeInternals:Se(),error:Se(e=>Wo(e.message))}}function X1(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[a,r]of Object.entries(t.value)){const l=s=>{e(a,s)};r.setEmitter(l),$o(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),$o(r.removeHasEmitListeners)}});function i(a){var r;const l=J1(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function J1(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Eu(){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:Lr.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Uo.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:Nn.Bezier,style:{}},connectionMode:Kt.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:Yo()?"Meta":"Control",zoomActivationKeyCode:Yo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:q1(),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 Z1=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Q1(e,t,o){const i=Y1(e),a=j=>{const L=j??[];e.hooks.updateNodeInternals.trigger(L)},r=j=>p1(j,e.nodes,e.edges),l=j=>f1(j,e.nodes,e.edges),s=j=>xn(j,e.edges),c=({id:j,type:L,nodeId:x})=>{var R;const V=j?`-${L}-${j}`:`-${L}`;return Array.from(((R=e.connectionLookup.get(`${x}${V}`))==null?void 0:R.values())??[])},d=j=>{if(j)return t.value.get(j)},u=j=>{if(j)return o.value.get(j)},m=(j,L,x)=>{var R,V;const Q=[];for(const me of j){const ve={id:me.id,type:"position",dragging:x,from:me.from};if(L&&(ve.position=me.position,me.parentNode)){const Ee=d(me.parentNode);ve.position={x:ve.position.x-(((R=Ee==null?void 0:Ee.computedPosition)==null?void 0:R.x)??0),y:ve.position.y-(((V=Ee==null?void 0:Ee.computedPosition)==null?void 0:V.y)??0)}}Q.push(ve)}Q!=null&&Q.length&&e.hooks.nodesChange.trigger(Q)},f=j=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const x=window.getComputedStyle(L),{m22:R}=new window.DOMMatrixReadOnly(x.transform),V=[];for(const Q of j){const me=Q,ve=d(me.id);if(ve){const Ee=ta(me.nodeElement);if(!!(Ee.width&&Ee.height&&(ve.dimensions.width!==Ee.width||ve.dimensions.height!==Ee.height||me.forceUpdate))){const Me=me.nodeElement.getBoundingClientRect();ve.dimensions=Ee,ve.handleBounds.source=du("source",me.nodeElement,Me,R,ve.id),ve.handleBounds.target=du("target",me.nodeElement,Me,R,ve.id),V.push({id:ve.id,type:"dimensions",dimensions:Ee})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),V.length&&e.hooks.nodesChange.trigger(V)},p=(j,L)=>{const x=new Set,R=new Set;for(const me of j)vn(me)?x.add(me.id):nn(me)&&R.add(me.id);const V=an(t.value,x,!0),Q=an(o.value,R);if(e.multiSelectionActive){for(const me of x)V.push(on(me,L));for(const me of R)Q.push(on(me,L))}V.length&&e.hooks.nodesChange.trigger(V),Q.length&&e.hooks.edgesChange.trigger(Q)},y=j=>{if(e.multiSelectionActive){const L=j.map(x=>on(x.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(an(t.value,new Set(j.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(an(o.value))},g=j=>{if(e.multiSelectionActive){const L=j.map(x=>on(x.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(an(o.value,new Set(j.map(L=>L.id)))),e.hooks.nodesChange.trigger(an(t.value,new Set,!0))},_=j=>{p(j,!0)},b=j=>{const x=(j||e.nodes).map(R=>(R.selected=!1,on(R.id,!1)));e.hooks.nodesChange.trigger(x)},N=j=>{const x=(j||e.edges).map(R=>(R.selected=!1,on(R.id,!1)));e.hooks.edgesChange.trigger(x)},h=j=>{if(!j||!j.length)return p([],!1);const L=j.reduce((x,R)=>{const V=on(R.id,!1);return vn(R)?x.nodes.push(V):x.edges.push(V),x},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},k=j=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([j,e.maxZoom]),e.minZoom=j},P=j=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,j]),e.maxZoom=j},A=j=>{var L;(L=e.d3Zoom)==null||L.translateExtent(j),e.translateExtent=j},G=j=>{e.nodeExtent=j,a()},K=j=>{var L;(L=e.d3Zoom)==null||L.clickDistance(j)},v=j=>{e.nodesDraggable=j,e.nodesConnectable=j,e.elementsSelectable=j},T=j=>{const L=j instanceof Function?j(e.nodes):j;!e.initialized&&!L.length||(e.nodes=uu(L,d,e.hooks.error.trigger))},H=j=>{const L=j instanceof Function?j(e.edges):j;if(!e.initialized&&!L.length)return;const x=Jr(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Xr(e.connectionLookup,o.value,x),e.edges=x},C=j=>{const L=j instanceof Function?j([...e.nodes,...e.edges]):j;!e.initialized&&!L.length||(T(L.filter(vn)),H(L.filter(nn)))},ae=j=>{let L=j instanceof Function?j(e.nodes):j;L=Array.isArray(L)?L:[L];const x=uu(L,d,e.hooks.error.trigger),R=[];for(const V of x)R.push(Zd(V));R.length&&e.hooks.nodesChange.trigger(R)},E=j=>{let L=j instanceof Function?j(e.edges):j;L=Array.isArray(L)?L:[L];const x=Jr(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),R=[];for(const V of x)R.push(Zd(V));R.length&&e.hooks.edgesChange.trigger(R)},Y=(j,L=!0,x=!1)=>{const R=j instanceof Function?j(e.nodes):j,V=Array.isArray(R)?R:[R],Q=[],me=[];function ve($e){const Me=s($e);for(const Ue of Me)(!tt(Ue.deletable)||Ue.deletable)&&me.push(eu(Ue.id,Ue.source,Ue.target,Ue.sourceHandle,Ue.targetHandle))}function Ee($e){const Me=[];for(const Ue of e.nodes)Ue.parentNode===$e&&Me.push(Ue);if(Me.length){for(const Ue of Me)Q.push(Qd(Ue.id));L&&ve(Me);for(const Ue of Me)Ee(Ue.id)}}for(const $e of V){const Me=typeof $e=="string"?d($e):$e;Me&&(tt(Me.deletable)&&!Me.deletable||(Q.push(Qd(Me.id)),L&&ve([Me]),x&&Ee(Me.id)))}me.length&&e.hooks.edgesChange.trigger(me),Q.length&&e.hooks.nodesChange.trigger(Q)},S=j=>{const L=j instanceof Function?j(e.edges):j,x=Array.isArray(L)?L:[L],R=[];for(const V of x){const Q=typeof V=="string"?u(V):V;Q&&(tt(Q.deletable)&&!Q.deletable||R.push(eu(typeof V=="string"?V:V.id,Q.source,Q.target,Q.sourceHandle,Q.targetHandle)))}e.hooks.edgesChange.trigger(R)},W=(j,L,x=!0)=>{const R=u(j.id);if(!R)return!1;const V=e.edges.indexOf(R),Q=D1(j,L,R,x,e.hooks.error.trigger);if(Q){const[me]=Jr([Q],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((ve,Ee)=>Ee===V?me:ve),Xr(e.connectionLookup,o.value,[me]),me}return!1},ee=(j,L,x={replace:!1})=>{const R=u(j);if(!R)return;const V=typeof L=="function"?L(R):L;R.data=x.replace?V:{...R.data,...V}},ie=j=>Jd(j,e.nodes),O=j=>{const L=Jd(j,e.edges);return Xr(e.connectionLookup,o.value,L),L},U=(j,L,x={replace:!1})=>{const R=d(j);if(!R)return;const V=typeof L=="function"?L(R):L;x.replace?e.nodes.splice(e.nodes.indexOf(R),1,V):Object.assign(R,V)},ne=(j,L,x={replace:!1})=>{const R=d(j);if(!R)return;const V=typeof L=="function"?L(R):L;R.data=x.replace?V:{...R.data,...V}},ce=(j,L,x=!1)=>{x?e.connectionClickStartHandle=j:e.connectionStartHandle=j,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},ge=(j,L=null,x=null)=>{e.connectionStartHandle&&(e.connectionPosition=j,e.connectionEndHandle=L,e.connectionStatus=x)},se=(j,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},pe=j=>{const L=u1(j),x=L?null:Ho(j)?j:d(j.id);return!L&&!x?[null,null,L]:[L?j:Qi(x),x,L]},be=(j,L=!0,x=e.nodes)=>{const[R,V,Q]=pe(j);if(!R)return[];const me=[];for(const ve of x||e.nodes){if(!Q&&(ve.id===V.id||!ve.computedPosition))continue;const Ee=Qi(ve),$e=ea(Ee,R);(L&&$e>0||$e>=Ee.width*Ee.height||$e>=Number(R.width)*Number(R.height))&&me.push(ve)}return me},xe=(j,L,x=!0)=>{const[R]=pe(j);if(!R)return!1;const V=ea(R,L);return x&&V>0||V>=Number(R.width)*Number(R.height)},Te=j=>{const{viewport:L,dimensions:x,d3Zoom:R,d3Selection:V,translateExtent:Q}=e;if(!R||!V||!j.x&&!j.y)return!1;const me=eo.translate(L.x+j.x,L.y+j.y).scale(L.zoom),ve=[[0,0],[x.width,x.height]],Ee=R.constrain()(me,ve,Q),$e=e.viewport.x!==Ee.x||e.viewport.y!==Ee.y||e.viewport.zoom!==Ee.k;return R.transform(V,Ee),$e},Ae=j=>{const L=j instanceof Function?j(e):j,x=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];tt(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const R=L.modelValue||L.nodes||L.edges?[]:void 0;R&&(L.modelValue&&R.push(...L.modelValue),L.nodes&&R.push(...L.nodes),L.edges&&R.push(...L.edges),C(R));const V=()=>{tt(L.maxZoom)&&P(L.maxZoom),tt(L.minZoom)&&k(L.minZoom),tt(L.translateExtent)&&A(L.translateExtent)};for(const Q of Object.keys(L)){const me=Q,ve=L[me];![...Z1,...x].includes(me)&&tt(ve)&&(e[me]=ve)}gr(()=>e.d3Zoom).not.toBeNull().then(V),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:f,setElements:C,setNodes:T,setEdges:H,addNodes:ae,addEdges:E,removeNodes:Y,removeEdges:S,findNode:d,findEdge:u,updateEdge:W,updateEdgeData:ee,updateNode:U,updateNodeData:ne,applyEdgeChanges:O,applyNodeChanges:ie,addSelectedElements:_,addSelectedNodes:y,addSelectedEdges:g,setMinZoom:k,setMaxZoom:P,setTranslateExtent:A,setNodeExtent:G,setPaneClickDistance:K,removeSelectedElements:h,removeSelectedNodes:b,removeSelectedEdges:N,startConnection:ce,updateConnection:ge,endConnection:se,setInteractive:v,setState:Ae,getIntersectingNodes:be,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:xe,panBy:Te,fitView:j=>i.value.fitView(j),zoomIn:j=>i.value.zoomIn(j),zoomOut:j=>i.value.zoomOut(j),zoomTo:(j,L)=>i.value.zoomTo(j,L),setViewport:(j,L)=>i.value.setViewport(j,L),setTransform:(j,L)=>i.value.setTransform(j,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(j,L,x)=>i.value.setCenter(j,L,x),fitBounds:(j,L)=>i.value.fitBounds(j,L),project:j=>i.value.project(j),screenToFlowCoordinate:j=>i.value.screenToFlowCoordinate(j),flowToScreenCoordinate:j=>i.value.flowToScreenCoordinate(j),toObject:()=>{const j=[],L=[];for(const x of e.nodes){const{computedPosition:R,handleBounds:V,selected:Q,dimensions:me,isParent:ve,resizing:Ee,dragging:$e,events:Me,...Ue}=x;j.push(Ue)}for(const x of e.edges){const{selected:R,sourceNode:V,targetNode:Q,events:me,...ve}=x;L.push(ve)}return JSON.parse(JSON.stringify({nodes:j,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:j=>new Promise(L=>{const{nodes:x,edges:R,position:V,zoom:Q,viewport:me}=j;x&&T(x),R&&H(R);const[ve,Ee]=me!=null&&me.x&&(me!=null&&me.y)?[me.x,me.y]:V??[null,null];if(ve&&Ee){const $e=(me==null?void 0:me.zoom)||Q||e.viewport.zoom;return gr(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:ve,y:Ee,zoom:$e}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const j=Eu();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=eo.translate(j.defaultViewport.x??0,j.defaultViewport.y??0).scale(wn(j.defaultViewport.zoom??1,j.minZoom,j.maxZoom)),x=e.viewportRef.getBoundingClientRect(),R=[[0,0],[x.width,x.height]],V=e.d3Zoom.constrain()(L,R,j.translateExtent);e.d3Zoom.transform(e.d3Selection,V)}Ae(j)},$destroy:()=>{}}}const e0=["data-id","data-handleid","data-nodeid","data-handlepos"],t0={name:"Handle",compatConfig:{MODE:3}},In=n.defineComponent({...t0,props:{id:{default:null},type:{},position:{default:()=>Re.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:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),a=n.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:f}=He(),{id:p,node:y,nodeEl:g,connectedEdges:_}=_u(),b=n.ref(),N=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),k=n.toRef(()=>{var H,C,ae,E,Y,S;return((H=l.value)==null?void 0:H.nodeId)===p&&((C=l.value)==null?void 0:C.id)===e.id&&((ae=l.value)==null?void 0:ae.type)===i.value||((E=c.value)==null?void 0:E.nodeId)===p&&((Y=c.value)==null?void 0:Y.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),P=n.toRef(()=>{var H,C,ae;return((H=s.value)==null?void 0:H.nodeId)===p&&((C=s.value)==null?void 0:C.id)===e.id&&((ae=s.value)==null?void 0:ae.type)===i.value}),{handlePointerDown:A,handleClick:G}=bu({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),K=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(H=>{const C=H[`${i.value}Handle`];return H[i.value]!==p?!1:C?C===e.id:!0}):typeof e.connectable=="number"?_.value.filter(H=>{const C=H[`${i.value}Handle`];return H[i.value]!==p?!1:C?C===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,_.value):tt(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var H;if(!y.dimensions.width||!y.dimensions.height)return;const C=(H=y.handleBounds[i.value])==null?void 0:H.find(ie=>ie.id===e.id);if(!d.value||C)return;const ae=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!b.value||!ae||!e.id)return;const E=g.value.getBoundingClientRect(),Y=b.value.getBoundingClientRect(),S=window.getComputedStyle(ae),{m22:W}=new window.DOMMatrixReadOnly(S.transform),ee={id:e.id,position:e.position,x:(Y.left-E.left)/W,y:(Y.top-E.top)/W,type:i.value,nodeId:p,...ta(b.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],ee]});function v(H){const C=Kr(H);K.value&&N.value&&(C&&H.button===0||!C)&&A(H)}function T(H){!p||!s.value&&!N.value||K.value&&G(H)}return t({handleClick:G,handlePointerDown:A,onClick:T,onPointerDown:v}),(H,C)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${n.unref(r)}-${n.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(p),"data-handlepos":H.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${H.position}`,`vue-flow__handle-${e.id}`,n.unref(m),n.unref(f),i.value,{connectable:K.value,connecting:P.value,connectablestart:N.value,connectableend:h.value,connectionindicator:K.value&&(N.value&&!k.value||h.value&&k.value)}]]),onMousedown:v,onTouchstartPassive:v,onClick:T},[n.renderSlot(H.$slots,"default",{id:H.id})],42,e0))}}),sa=function({sourcePosition:e=Re.Bottom,targetPosition:t=Re.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[n.h(In,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(In,{type:"source",position:e,connectable:i,isValidConnection:r})]};sa.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],sa.inheritAttrs=!1,sa.compatConfig={MODE:3};const n0=sa,ca=function({targetPosition:e=Re.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??t;return[n.h(In,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?n.h(r):n.h(n.Fragment,[r])]};ca.props=["targetPosition","label","isValidTargetPos","connectable","data"],ca.inheritAttrs=!1,ca.compatConfig={MODE:3};const o0=ca,da=function({sourcePosition:e=Re.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??t;return[typeof r!="string"&&r?n.h(r):n.h(n.Fragment,[r]),n.h(In,{type:"source",position:e,connectable:o,isValidConnection:i})]};da.props=["sourcePosition","label","isValidSourcePos","connectable","data"],da.inheritAttrs=!1,da.compatConfig={MODE:3};const i0=da,a0=["transform"],r0=["width","height","x","y","rx","ry"],l0=["y"],s0={name:"EdgeText",compatConfig:{MODE:3}},c0=n.defineComponent({...s0,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(a),n.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,l)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:n.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,r0)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[n.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(r.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(r.label),1)],64))])],16,l0)],8,a0))}}),d0=["id","d","marker-end","marker-start"],u0=["d","stroke-width"],m0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ua=n.defineComponent({...m0,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),a=n.ref(null),r=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.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,d0),l.interactionWidth?(n.openBlock(),n.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,u0)):n.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(n.openBlock(),n.createBlock(c0,{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"])):n.createCommentVNode("",!0)],64))}});function Nu({sourceX:e,sourceY:t,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-t)/2,s=i<t?i+l:i-l;return[r,s,a,l]}function wu({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=t*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-t);return[c,d,u,m]}function ma(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vu({pos:e,x1:t,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Re.Left:l=t-ma(t-i,r),s=o;break;case Re.Right:l=t+ma(i-t,r),s=o;break;case Re.Top:l=t,s=o-ma(o-a,r);break;case Re.Bottom:l=t,s=o+ma(a-o,r);break}return[l,s]}function xu(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top,curvature:s=.25}=e,[c,d]=vu({pos:i,x1:t,y1:o,x2:a,y2:r,c:s}),[u,m]=vu({pos:l,x1:a,y1:r,x2:t,y2:o,c:s}),[f,p,y,g]=wu({sourceX:t,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${t},${o} C${c},${d} ${u},${m} ${a},${r}`,f,p,y,g]}function Iu({pos:e,x1:t,y1:o,x2:i,y2:a}){let r,l;switch(e){case Re.Left:case Re.Right:r=.5*(t+i),l=o;break;case Re.Top:case Re.Bottom:r=t,l=.5*(o+a);break}return[r,l]}function Cu(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top}=e,[s,c]=Iu({pos:i,x1:t,y1:o,x2:a,y2:r}),[d,u]=Iu({pos:l,x1:a,y1:r,x2:t,y2:o}),[m,f,p,y]=wu({sourceX:t,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${r}`,m,f,p,y]}const Su={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}};function f0({source:e,sourcePosition:t=Re.Bottom,target:o}){return t===Re.Left||t===Re.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 $u(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function p0({source:e,sourcePosition:t=Re.Bottom,target:o,targetPosition:i=Re.Top,center:a,offset:r}){const l=Su[t],s=Su[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=f0({source:c,sourcePosition:t,target:d}),m=u.x!==0?"x":"y",f=u[m];let p,y,g;const _={x:0,y:0},b={x:0,y:0},[N,h,k,P]=Nu({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??N,g=a.y??h;const G=[{x:y,y:c.y},{x:y,y:d.y}],K=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===f?p=m==="x"?G:K:p=m==="x"?K:G}else{const G=[{x:c.x,y:d.y}],K=[{x:d.x,y:c.y}];if(m==="x"?p=l.x===f?K:G:p=l.y===f?G:K,t===i){const ae=Math.abs(e[m]-o[m]);if(ae<=r){const E=Math.min(r-1,r-ae);l[m]===f?_[m]=(c[m]>e[m]?-1:1)*E:b[m]=(d[m]>o[m]?-1:1)*E}}if(t!==i){const ae=m==="x"?"y":"x",E=l[m]===s[ae],Y=c[ae]>d[ae],S=c[ae]<d[ae];(l[m]===1&&(!E&&Y||E&&S)||l[m]!==1&&(!E&&S||E&&Y))&&(p=m==="x"?G:K)}const v={x:c.x+_.x,y:c.y+_.y},T={x:d.x+b.x,y:d.y+b.y},H=Math.max(Math.abs(v.x-p[0].x),Math.abs(T.x-p[0].x)),C=Math.max(Math.abs(v.y-p[0].y),Math.abs(T.y-p[0].y));H>=C?(y=(v.x+T.x)/2,g=p[0].y):(y=p[0].x,g=(v.y+T.y)/2)}return[[e,{x:c.x+_.x,y:c.y+_.y},...p,{x:d.x+b.x,y:d.y+b.y},o],y,g,k,P]}function h0(e,t,o,i){const a=Math.min($u(e,t)/2,$u(t,o)/2,i),{x:r,y:l}=t;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 Qr(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,f,p,y,g]=p0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((b,N,h)=>{let k;return h>0&&h<m.length-1?k=h0(m[h-1],N,m[h+1],s):k=`${h===0?"M":"L"}${N.x} ${N.y}`,b+=k,b},""),f,p,y,g]}function y0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Nu({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,r,l,s,c]}const g0=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=y0(e);return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),Ru=n.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:t}){return()=>{const[o,i,a]=Qr({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),b0=n.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>n.h(Ru,{...e,...t,borderRadius:0})}}),_0=n.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:t}){return()=>{const[o,i,a]=xu({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),k0=n.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:t}){return()=>{const[o,i,a]=Cu({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),E0={input:i0,default:n0,output:o0},N0={default:_0,straight:g0,step:b0,smoothstep:Ru,simplebezier:k0};function w0(e,t,o){const i=n.computed(()=>g=>t.value.get(g)),a=n.computed(()=>g=>o.value.get(g)),r=n.computed(()=>{const g={...N0,...e.edgeTypes},_=Object.keys(g);for(const b of e.edges)b.type&&!_.includes(b.type)&&(g[b.type]=b.type);return g}),l=n.computed(()=>{const g={...E0,...e.nodeTypes},_=Object.keys(g);for(const b of e.nodes)b.type&&!_.includes(b.type)&&(g[b.type]=b.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?Kd(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const _ of e.edges){const b=t.value.get(_.source),N=t.value.get(_.target);v1({sourcePos:b.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(_)}return g}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const g=[];for(const _ of e.nodes)_.selected&&g.push(_);return g}),m=n.computed(()=>{const g=[];for(const _ of e.edges)_.selected&&g.push(_);return g}),f=n.computed(()=>[...u.value,...m.value]),p=n.computed(()=>{const g=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&_.handleBounds!==void 0&&g.push(_);return g}),y=n.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:p,areNodesInitialized:y}}class Cn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Cn.instance;return Cn.instance=i??new Cn,o&&(o.config.globalProperties.$vueFlowStorage=Cn.instance),Cn.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=Eu(),a=n.reactive(i),r={};for(const[f,p]of Object.entries(a.hooks)){const y=`on${f.charAt(0).toUpperCase()+f.slice(1)}`;r[y]=p.on}const l={};for(const[f,p]of Object.entries(a.hooks))l[f]=p.trigger;const s=n.computed(()=>{const f=new Map;for(const p of a.nodes)f.set(p.id,p);return f}),c=n.computed(()=>{const f=new Map;for(const p of a.edges)f.set(p.id,p);return f}),d=w0(a,s,c),u=Q1(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...ky(a),nodeLookup:s,edgeLookup:c,emits:l,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,m),m}getId(){return`vue-flow-${this.currentId++}`}}function He(e){const t=Cn.getInstance(),o=n.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=n.inject(pu,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=t.get(l)),!s||l&&s.id!==l){const c=r??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(m,f,p)=>{const y=_=>{d.applyNodeChanges(_)},g=_=>{d.applyEdgeChanges(_)};m?(d.onNodesChange(y),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),$o(()=>{if(s){const m=t.get(s.id);m?m.$destroy():Wo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(pu,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new it(et.USEVUEFLOW_OPTIONS))}return s}function v0(e){const{emits:t,dimensions:o}=He();let i;n.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=ta(e.value);(s.width===0||s.height===0)&&t.error(new it(et.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)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const x0={name:"UserSelection",compatConfig:{MODE:3}},I0=n.defineComponent({...x0,props:{userSelectionRect:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:n.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),C0=["tabIndex"],S0={name:"NodesSelection",compatConfig:{MODE:3}},$0=n.defineComponent({...S0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=He(),s=ku(),c=n.ref(null),d=gu({el:c,onStart(y){t.selectionDragStart(y),t.nodeDragStart(y)},onDrag(y){t.selectionDrag(y),t.nodeDrag(y)},onStop(y){t.selectionDragStop(y),t.nodeDragStop(y)}});n.onMounted(()=>{var y;r.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=n.computed(()=>Ur(i.value)),m=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function f(y){t.selectionContextMenu({event:y,nodes:i.value})}function p(y){r.value||to[y.key]&&(y.preventDefault(),s({x:to[y.key].x,y:to[y.key].y},y.shiftKey))}return(y,g)=>!n.unref(l)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(m.value),tabIndex:n.unref(r)?void 0:-1,onContextmenu:f,onKeydown:p},null,46,C0)],6)):n.createCommentVNode("",!0)}});function R0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const A0={name:"Pane",compatConfig:{MODE:3}},T0=n.defineComponent({...A0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:f,removeEdges:p,selectionMode:y,deleteKeyCode:g,multiSelectionKeyCode:_,multiSelectionActive:b,edgeLookup:N,nodeLookup:h,connectionLookup:k,defaultEdgeOptions:P,connectionStartHandle:A,panOnDrag:G}=He(),K=n.shallowRef(null),v=n.shallowRef(new Set),T=n.shallowRef(new Set),H=n.shallowRef(null),C=n.toRef(()=>c.value&&(e.isSelecting||r.value)),ae=n.toRef(()=>A.value!==null);let E=!1,Y=!1;const S=Fo(g,{actInsideInputWithModifier:!1}),W=Fo(_);n.watch(S,se=>{se&&(f(m.value),p(u.value),d.value=!1)}),n.watch(W,se=>{b.value=se});function ee(se,pe){return be=>{be.target===pe&&(se==null||se(be))}}function ie(se){if(E||ae.value){E=!1;return}a.paneClick(se),l(),d.value=!1}function O(se){var pe;if(Array.isArray(G.value)&&((pe=G.value)!=null&&pe.includes(2))){se.preventDefault();return}a.paneContextMenu(se)}function U(se){a.paneScroll(se)}function ne(se){var pe,be,xe;if(H.value=((pe=t.value)==null?void 0:pe.getBoundingClientRect())??null,!c.value||!e.isSelecting||se.button!==0||se.target!==K.value||!H.value)return;(xe=(be=se.target)==null?void 0:be.setPointerCapture)==null||xe.call(be,se.pointerId);const{x:Te,y:Ae}=R0(se,H.value);Y=!0,E=!1,l(),s.value={width:0,height:0,startX:Te,startY:Ae,x:Te,y:Ae},a.selectionStart(se)}function ce(se){var pe;if(!H.value||!s.value)return;E=!0;const{x:be,y:xe}=Ot(se,H.value),{startX:Te=0,startY:Ae=0}=s.value,fe={startX:Te,startY:Ae,x:be<Te?be:Te,y:xe<Ae?xe:Ae,width:Math.abs(be-Te),height:Math.abs(xe-Ae)},ke=v.value,we=T.value;v.value=new Set(Kd(o.value,fe,i.value,y.value===Lr.Partial,!0).map(L=>L.id)),T.value=new Set;const j=((pe=P.value)==null?void 0:pe.selectable)??!0;for(const L of v.value){const x=k.value.get(L);if(x)for(const{edgeId:R}of x.values()){const V=N.value.get(R);V&&(V.selectable??j)&&T.value.add(R)}}if(!fu(ke,v.value)){const L=an(h.value,v.value,!0);a.nodesChange(L)}if(!fu(we,T.value)){const L=an(N.value,T.value);a.edgesChange(L)}s.value=fe,r.value=!0,d.value=!1}function ge(se){var pe;se.button!==0||!Y||((pe=se.target)==null||pe.releasePointerCapture(se.pointerId),!r.value&&s.value&&se.target===K.value&&ie(se),r.value=!1,s.value=null,d.value=v.value.size>0,a.selectionEnd(se),e.selectionKeyPressed&&(E=!1),Y=!1)}return(se,pe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:K,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:se.isSelecting}]),onClick:pe[0]||(pe[0]=be=>C.value?void 0:ee(ie,K.value)(be)),onContextmenu:pe[1]||(pe[1]=be=>ee(O,K.value)(be)),onWheelPassive:pe[2]||(pe[2]=be=>ee(U,K.value)(be)),onPointerenter:pe[3]||(pe[3]=be=>C.value?void 0:n.unref(a).paneMouseEnter(be)),onPointerdown:pe[4]||(pe[4]=be=>C.value?ne(be):n.unref(a).paneMouseMove(be)),onPointermove:pe[5]||(pe[5]=be=>C.value?ce(be):n.unref(a).paneMouseMove(be)),onPointerup:pe[6]||(pe[6]=be=>C.value?ge(be):void 0),onPointerleave:pe[7]||(pe[7]=be=>n.unref(a).paneMouseLeave(be))},[n.renderSlot(se.$slots,"default"),n.unref(r)&&n.unref(s)?(n.openBlock(),n.createBlock(I0,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(d)&&n.unref(m).length?(n.openBlock(),n.createBlock($0,{key:1})):n.createCommentVNode("",!0)],34))}}),V0={name:"Transform",compatConfig:{MODE:3}},M0=n.defineComponent({...V0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=He(),a=n.computed(()=>o.value?!i.value:!1),r=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(l,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[n.renderSlot(l.$slots,"default")],4))}}),B0={name:"Viewport",compatConfig:{MODE:3}},D0=n.defineComponent({...B0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:f,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:g,noWheelClassName:_,noPanClassName:b,emits:N,connectionStartHandle:h,userSelectionActive:k,paneDragging:P,d3Zoom:A,d3Selection:G,d3ZoomHandler:K,viewport:v,viewportRef:T,paneClickDistance:H}=He();v0(T);const C=n.shallowRef(!1),ae=n.shallowRef(!1);let E=null,Y=!1,S=0,W={x:0,y:0,zoom:0};const ee=Fo(s),ie=Fo(l),O=Fo(r),U=n.toRef(()=>(!ie.value||ie.value&&l.value===!0)&&(ee.value||m.value)),ne=n.toRef(()=>ee.value||c.value),ce=n.toRef(()=>l.value===!0&&U.value!==!0),ge=n.toRef(()=>ie.value&&l.value!==!0||k.value||ce.value),se=n.toRef(()=>h.value!==null);n.onMounted(()=>{if(!T.value){Wo("Viewport element is missing");return}const Ae=T.value,fe=Ae.getBoundingClientRect(),ke=i1().clickDistance(H.value).scaleExtent([t.value,o.value]).translateExtent(a.value),we=vt(Ae).call(ke),j=we.on("wheel.zoom"),L=eo.translate(i.value.x??0,i.value.y??0).scale(wn(i.value.zoom??1,t.value,o.value)),x=[[0,0],[fe.width,fe.height]],R=ke.constrain()(L,x,a.value);ke.transform(we,R),ke.wheelDelta(Fr),A.value=ke,G.value=we,K.value=j,v.value={x:R.x,y:R.y,zoom:R.k},ke.on("start",V=>{var Q;if(!V.sourceEvent)return null;S=V.sourceEvent.button,C.value=!0;const me=xe(V.transform);((Q=V.sourceEvent)==null?void 0:Q.type)==="mousedown"&&(P.value=!0),W=me,N.viewportChangeStart(me),N.moveStart({event:V,flowTransform:me})}),ke.on("end",V=>{if(!V.sourceEvent)return null;if(C.value=!1,P.value=!1,pe(U.value,S??0)&&!Y&&N.paneContextMenu(V.sourceEvent),Y=!1,be(W,V.transform)){const Q=xe(V.transform);W=Q,N.viewportChangeEnd(Q),N.moveEnd({event:V,flowTransform:Q})}}),ke.filter(V=>{var Q;const me=O.value||y.value,ve=p.value&&V.ctrlKey,Ee=V.button,$e=V.type==="wheel";if(Ee===1&&V.type==="mousedown"&&(Te(V,"vue-flow__node")||Te(V,"vue-flow__edge")))return!0;if(!U.value&&!me&&!ne.value&&!f.value&&!p.value||k.value||se.value&&!$e||!f.value&&V.type==="dblclick"||Te(V,_.value)&&$e||Te(V,b.value)&&(!$e||ne.value&&$e&&!O.value)||!p.value&&V.ctrlKey&&$e||!me&&!ne.value&&!ve&&$e)return!1;if(!p&&V.type==="touchstart"&&((Q=V.touches)==null?void 0:Q.length)>1)return V.preventDefault(),!1;if(!U.value&&(V.type==="mousedown"||V.type==="touchstart")||ce.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ee===0||Array.isArray(m.value)&&!m.value.includes(Ee)&&(V.type==="mousedown"||V.type==="touchstart"))return!1;const Me=Array.isArray(m.value)&&m.value.includes(Ee)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ee||Ee<=1;return(!V.ctrlKey||ee.value||$e)&&Me}),n.watch([k,U],()=>{k.value&&!C.value?ke.on("zoom",null):k.value||ke.on("zoom",V=>{v.value={x:V.transform.x,y:V.transform.y,zoom:V.transform.k};const Q=xe(V.transform);Y=pe(U.value,S??0),N.viewportChange(Q),N.move({event:V,flowTransform:Q})})},{immediate:!0}),n.watch([k,ne,d,O,p,g,_],()=>{ne.value&&!O.value&&!k.value?we.on("wheel.zoom",V=>{if(Te(V,_.value))return!1;const Q=O.value||y.value,me=p.value&&V.ctrlKey;if(!(!g.value||ne.value||Q||me))return!1;V.preventDefault(),V.stopImmediatePropagation();const Ee=we.property("__zoom").k||1,$e=Yo();if(!ee.value&&V.ctrlKey&&p.value&&$e){const gt=Vt(V),w=Fr(V),M=Ee*2**w;ke.scaleTo(we,M,gt,V);return}const Me=V.deltaMode===1?20:1;let Ue=d.value===Uo.Vertical?0:V.deltaX*Me,Ye=d.value===Uo.Horizontal?0:V.deltaY*Me;!$e&&V.shiftKey&&d.value!==Uo.Vertical&&!Ue&&Ye&&(Ue=Ye,Ye=0),ke.translateBy(we,-(Ue/Ee)*u.value,-(Ye/Ee)*u.value);const Fe=xe(we.property("__zoom"));E&&clearTimeout(E),ae.value?(N.move({event:V,flowTransform:Fe}),N.viewportChange(Fe),E=setTimeout(()=>{N.moveEnd({event:V,flowTransform:Fe}),N.viewportChangeEnd(Fe),ae.value=!1},150)):(ae.value=!0,N.moveStart({event:V,flowTransform:Fe}),N.viewportChangeStart(Fe))},{passive:!1}):typeof j<"u"&&we.on("wheel.zoom",function(V,Q){const me=!g.value&&V.type==="wheel"&&!V.ctrlKey,ve=O.value||y.value,Ee=p.value&&V.ctrlKey;if(!ve&&!c.value&&!Ee&&V.type==="wheel"||me||Te(V,_.value))return null;V.preventDefault(),j.call(this,V,Q)},{passive:!1})},{immediate:!0})});function pe(Ae,fe){return fe===2&&Array.isArray(Ae)&&Ae.includes(2)}function be(Ae,fe){return Ae.x!==fe.x&&!Number.isNaN(fe.x)||Ae.y!==fe.y&&!Number.isNaN(fe.y)||Ae.zoom!==fe.k&&!Number.isNaN(fe.k)}function xe(Ae){return{x:Ae.x,y:Ae.y,zoom:Ae.k}}function Te(Ae,fe){return Ae.target.closest(`.${fe}`)}return(Ae,fe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:T,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(T0,{"is-selecting":ge.value,"selection-key-pressed":n.unref(ie),class:n.normalizeClass({connecting:se.value,dragging:n.unref(P),draggable:n.unref(m)===!0||Array.isArray(n.unref(m))&&n.unref(m).includes(0)})},{default:n.withCtx(()=>[n.createVNode(M0,null,{default:n.withCtx(()=>[n.renderSlot(Ae.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),O0=["id"],L0=["id"],P0=["id"],z0={name:"A11yDescriptions",compatConfig:{MODE:3}},U0=n.defineComponent({...z0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=He();return(a,r)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Dd)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.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,O0),n.createElementVNode("div",{id:`${n.unref(Od)}-${n.unref(t)}`,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,L0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(d1)}-${n.unref(t)}`,"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%)"}},n.toDisplayString(n.unref(i)),9,P0))],64))}});function F0(){const e=He();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function H0(e,t,o){return o===Re.Left?e-t:o===Re.Right?e+t:e}function G0(e,t,o){return o===Re.Top?e-t:o===Re.Bottom?e+t:e}const el=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Re.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:H0(t,e,i),cy:G0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};el.props=["radius","centerX","centerY","position","type"],el.compatConfig={MODE:3};const Au=el,j0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:f,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:g,edgesUpdatable:_,edgesFocusable:b,hooks:N}=He(),h=n.computed(()=>u(e.id)),{emit:k,on:P}=z1(h.value,r),A=n.inject(aa),G=n.getCurrentInstance(),K=n.ref(!1),v=n.ref(!1),T=n.ref(""),H=n.ref(null),C=n.ref("source"),ae=n.ref(null),E=n.toRef(()=>typeof h.value.selectable>"u"?g.value:h.value.selectable),Y=n.toRef(()=>typeof h.value.updatable>"u"?_.value:h.value.updatable),S=n.toRef(()=>typeof h.value.focusable>"u"?b.value:h.value.focusable);n.provide(O1,e.id),n.provide(L1,ae);const W=n.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),ee=n.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),ie=n.computed(()=>{const L=h.value.type||"default",x=A==null?void 0:A[`edge-${L}`];if(x)return x;let R=h.value.template??c.value[L];if(typeof R=="string"&&G){const V=Object.keys(G.appContext.components);V&&V.includes(L)&&(R=n.resolveComponent(L,!1))}return R&&typeof R!="string"?R:(r.error(new it(et.EDGE_TYPE_MISSING,R)),!1)}),{handlePointerDown:O}=bu({nodeId:T,handleId:H,type:C,isValidConnection:f,edgeUpdaterType:C,onEdgeUpdate:ce,onEdgeUpdateEnd:ge});return()=>{const L=m(h.value.source),x=m(h.value.target),R="pathOptions"in h.value?h.value.pathOptions:{};if(!L&&!x)return r.error(new it(et.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!L)return r.error(new it(et.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!x)return r.error(new it(et.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||L.hidden||x.hidden)return null;let V;i.value===Kt.Strict?V=L.handleBounds.source:V=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const Q=iu(V,h.value.sourceHandle);let me;i.value===Kt.Strict?me=x.handleBounds.target:me=[...x.handleBounds.target||[],...x.handleBounds.source||[]];const ve=iu(me,h.value.targetHandle),Ee=(Q==null?void 0:Q.position)||Re.Bottom,$e=(ve==null?void 0:ve.position)||Re.Top,{x:Me,y:Ue}=oo(L,Q,Ee),{x:Ye,y:Fe}=oo(x,ve,$e);return h.value.sourceX=Me,h.value.sourceY=Ue,h.value.targetX=Ye,h.value.targetY=Fe,n.h("g",{ref:ae,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ie.value===!1?"default":h.value.type||"default"}`,s.value,W.value,{updating:K.value,selected:h.value.selected,animated:h.value.animated,inactive:!E.value&&!N.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":S.value?`${Od}-${t}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",...h.value.domAttributes,onClick:pe,onContextmenu:be,onDblclick:xe,onMouseenter:Te,onMousemove:Ae,onMouseleave:fe,onKeyDown:S.value?j:void 0},[v.value?null:n.h(ie.value===!1?c.value.default:ie.value,{id:e.id,sourceNode:L,targetNode:x,source:h.value.source,target:h.value.target,type:h.value.type,updatable:Y.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...P},style:ee.value,markerStart:`url('#${Ko(h.value.markerStart,t)}')`,markerEnd:`url('#${Ko(h.value.markerEnd,t)}')`,sourcePosition:Ee,targetPosition:$e,sourceX:Me,sourceY:Ue,targetX:Ye,targetY:Fe,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...R}),[Y.value==="source"||Y.value===!0?[n.h("g",{onMousedown:ke,onMouseenter:U,onMouseout:ne},n.h(Au,{position:Ee,centerX:Me,centerY:Ue,radius:a.value,type:"source","data-type":"source"}))]:null,Y.value==="target"||Y.value===!0?[n.h("g",{onMousedown:we,onMouseenter:U,onMouseout:ne},n.h(Au,{position:$e,centerX:Ye,centerY:Fe,radius:a.value,type:"target","data-type":"target"}))]:null]])};function U(){K.value=!0}function ne(){K.value=!1}function ce(L,x){k.update({event:L,edge:h.value,connection:x})}function ge(L){k.updateEnd({event:L,edge:h.value}),v.value=!1}function se(L,x){L.button===0&&(v.value=!0,T.value=x?h.value.target:h.value.source,H.value=(x?h.value.targetHandle:h.value.sourceHandle)??null,C.value=x?"target":"source",k.updateStart({event:L,edge:h.value}),O(L))}function pe(L){var x;const R={event:L,edge:h.value};E.value&&(l.value=!1,h.value.selected&&p.value?(d([h.value]),(x=ae.value)==null||x.blur()):o([h.value])),k.click(R)}function be(L){k.contextMenu({event:L,edge:h.value})}function xe(L){k.doubleClick({event:L,edge:h.value})}function Te(L){k.mouseEnter({event:L,edge:h.value})}function Ae(L){k.mouseMove({event:L,edge:h.value})}function fe(L){k.mouseLeave({event:L,edge:h.value})}function ke(L){se(L,!0)}function we(L){se(L,!1)}function j(L){var x;!y.value&&Ld.includes(L.key)&&E.value&&(L.key==="Escape"?((x=ae.value)==null||x.blur(),d([u(e.id)])):o([u(e.id)]))}}}),K0=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=He(),f=(e=n.inject(aa))==null?void 0:e["connection-line"],p=n.computed(()=>{var N;return m((N=i.value)==null?void 0:N.nodeId)}),y=n.computed(()=>{var N;return m((N=a.value)==null?void 0:N.nodeId)??null}),g=n.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),_=n.computed(()=>c.value.markerStart?`url(#${Ko(c.value.markerStart,t)})`:""),b=n.computed(()=>c.value.markerEnd?`url(#${Ko(c.value.markerEnd,t)})`:"");return()=>{var N,h,k;if(!p.value||!i.value)return null;const P=i.value.id,A=i.value.type,G=p.value.handleBounds;let K=(G==null?void 0:G[A])??[];if(o.value===Kt.Loose){const ee=(G==null?void 0:G[A==="source"?"target":"source"])??[];K=[...K,...ee]}if(!K)return null;const v=(P?K.find(ee=>ee.id===P):K[0])??null,T=(v==null?void 0:v.position)??Re.Top,{x:H,y:C}=oo(p.value,v,T);let ae=null;y.value&&(o.value===Kt.Strict?ae=((N=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:N.find(ee=>{var ie;return ee.id===((ie=a.value)==null?void 0:ie.id)}))||null:ae=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(ee=>{var ie;return ee.id===((ie=a.value)==null?void 0:ie.id)}))||null);const E=((k=a.value)==null?void 0:k.position)??(T?Wr[T]:null);if(!T||!E)return null;const Y=l.value??c.value.type??Nn.Bezier;let S="";const W={sourceX:H,sourceY:C,sourcePosition:T,targetX:g.value.x,targetY:g.value.y,targetPosition:E};return Y===Nn.Bezier?[S]=xu(W):Y===Nn.Step?[S]=Qr({...W,borderRadius:0}):Y===Nn.SmoothStep?[S]=Qr(W):Y===Nn.SimpleBezier?[S]=Cu(W):S=`M${H},${C} ${g.value.x},${g.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},f?n.h(f,{sourceX:H,sourceY:C,sourcePosition:T,targetX:g.value.x,targetY:g.value.y,targetPosition:E,sourceNode:p.value,sourceHandle:v,targetNode:y.value,targetHandle:ae,markerEnd:b.value,markerStart:_.value,connectionStatus:d.value}):n.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":_.value})))}}}),Y0=["id","markerWidth","markerHeight","markerUnits","orient"],W0={name:"MarkerType",compatConfig:{MODE:3}},q0=n.defineComponent({...W0,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(t,o)=>(n.openBlock(),n.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===n.unref(Pr).ArrowClosed?(n.openBlock(),n.createElementBlock("polyline",{key:0,style:n.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):n.createCommentVNode("",!0),t.type===n.unref(Pr).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,Y0))}}),X0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},J0={name:"MarkerDefinitions",compatConfig:{MODE:3}},Z0=n.defineComponent({...J0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=He(),r=n.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Ko(d,t);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)=>(n.openBlock(),n.createElementBlock("svg",X0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,c=>(n.openBlock(),n.createBlock(q0,{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))])]))}}),Q0={name:"Edges",compatConfig:{MODE:3}},ek=n.defineComponent({...Q0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=He();return(a,r)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(Z0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),l=>(n.openBlock(),n.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(x1)(l,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(j0),{id:l.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(K0))],64))}}),tk=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:f,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:g,snapToGrid:_,snapGrid:b,nodeDragThreshold:N,nodesDraggable:h,elementsSelectable:k,nodesConnectable:P,nodesFocusable:A,hooks:G}=He(),K=n.ref(null);n.provide(yu,K),n.provide(hu,e.id);const v=n.inject(aa),T=n.getCurrentInstance(),H=ku(),{node:C,parentNode:ae}=_u(e.id),{emit:E,on:Y}=G1(C,l),S=n.toRef(()=>typeof C.draggable>"u"?h.value:C.draggable),W=n.toRef(()=>typeof C.selectable>"u"?k.value:C.selectable),ee=n.toRef(()=>typeof C.connectable>"u"?P.value:C.connectable),ie=n.toRef(()=>typeof C.focusable>"u"?A.value:C.focusable),O=n.computed(()=>W.value||S.value||G.value.nodeClick.hasListeners()||G.value.nodeDoubleClick.hasListeners()||G.value.nodeMouseEnter.hasListeners()||G.value.nodeMouseMove.hasListeners()||G.value.nodeMouseLeave.hasListeners()),U=n.toRef(()=>!!C.dimensions.width&&!!C.dimensions.height),ne=n.computed(()=>{const x=C.type||"default",R=v==null?void 0:v[`node-${x}`];if(R)return R;let V=C.template||m.value[x];if(typeof V=="string"&&T){const Q=Object.keys(T.appContext.components);Q&&Q.includes(x)&&(V=n.resolveComponent(x,!1))}return V&&typeof V!="string"?V:(l.error(new it(et.NODE_TYPE_MISSING,V)),!1)}),ce=gu({id:e.id,el:K,disabled:()=>!S.value,selectable:W,dragHandle:()=>C.dragHandle,onStart(x){E.dragStart(x)},onDrag(x){E.drag(x)},onStop(x){E.dragStop(x)},onClick(x){j(x)}}),ge=n.computed(()=>C.class instanceof Function?C.class(C):C.class),se=n.computed(()=>{const x=(C.style instanceof Function?C.style(C):C.style)||{},R=C.width instanceof Function?C.width(C):C.width,V=C.height instanceof Function?C.height(C):C.height;return!x.width&&R&&(x.width=typeof R=="string"?R:`${R}px`),!x.height&&V&&(x.height=typeof V=="string"?V:`${V}px`),x}),pe=n.toRef(()=>Number(C.zIndex??se.value.zIndex??0));return u(x=>{(x.includes(e.id)||!x.length)&&xe()}),n.onMounted(()=>{n.watch(()=>C.hidden,(x=!1,R,V)=>{!x&&K.value&&(e.resizeObserver.observe(K.value),V(()=>{K.value&&e.resizeObserver.unobserve(K.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>C.type,()=>C.sourcePosition,()=>C.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:K.value,forceUpdate:!0}])})}),n.watch([()=>C.position.x,()=>C.position.y,()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.x},()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.y},()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.z},pe,()=>C.selected,()=>C.dimensions.height,()=>C.dimensions.width,()=>{var x;return(x=ae.value)==null?void 0:x.dimensions.height},()=>{var x;return(x=ae.value)==null?void 0:x.dimensions.width}],([x,R,V,Q,me,ve])=>{const Ee={x,y:R,z:ve+(p.value&&C.selected?1e3:0)};typeof V<"u"&&typeof Q<"u"?C.computedPosition=_1({x:V,y:Q,z:me},Ee):C.computedPosition=Ee},{flush:"post",immediate:!0}),n.watch([()=>C.extent,f],([x,R],[V,Q])=>{(x!==V||R!==Q)&&be()}),C.extent==="parent"||typeof C.extent=="object"&&"range"in C.extent&&C.extent.range==="parent"?gr(()=>U).toBe(!0).then(be):be(),()=>C.hidden?null:n.h("div",{ref:K,"data-id":C.id,class:["vue-flow__node",`vue-flow__node-${ne.value===!1?"default":C.type||"default"}`,{[o.value]:S.value,dragging:ce==null?void 0:ce.value,draggable:S.value,selected:C.selected,selectable:W.value,parent:C.isParent},ge.value],style:{visibility:U.value?"visible":"hidden",zIndex:C.computedPosition.z??pe.value,transform:`translate(${C.computedPosition.x}px,${C.computedPosition.y}px)`,pointerEvents:O.value?"all":"none",...se.value},tabIndex:ie.value?0:void 0,role:ie.value?"group":void 0,"aria-describedby":y.value?void 0:`${Dd}-${t}`,"aria-label":C.ariaLabel,"aria-roledescription":"node",...C.domAttributes,onMouseenter:Te,onMousemove:Ae,onMouseleave:fe,onContextmenu:ke,onClick:j,onDblclick:we,onKeydown:L},[n.h(ne.value===!1?m.value.default:ne.value,{id:C.id,type:C.type,data:C.data,events:{...C.events,...Y},selected:C.selected,resizing:C.resizing,dragging:ce.value,connectable:ee.value,position:C.computedPosition,dimensions:C.dimensions,isValidTargetPos:C.isValidTargetPos,isValidSourcePos:C.isValidSourcePos,parent:C.parentNode,parentNodeId:C.parentNode,zIndex:C.computedPosition.z??pe.value,targetPosition:C.targetPosition,sourcePosition:C.sourcePosition,label:C.label,dragHandle:C.dragHandle,onUpdateNodeInternals:xe})]);function be(){const x=C.computedPosition,{computedPosition:R,position:V}=jr(C,_.value?ia(x,b.value):x,l.error,f.value,ae.value);(C.computedPosition.x!==R.x||C.computedPosition.y!==R.y)&&(C.computedPosition={...C.computedPosition,...R}),(C.position.x!==V.x||C.position.y!==V.y)&&(C.position=V)}function xe(){K.value&&d([{id:e.id,nodeElement:K.value,forceUpdate:!0}])}function Te(x){ce!=null&&ce.value||E.mouseEnter({event:x,node:C})}function Ae(x){ce!=null&&ce.value||E.mouseMove({event:x,node:C})}function fe(x){ce!=null&&ce.value||E.mouseLeave({event:x,node:C})}function ke(x){return E.contextMenu({event:x,node:C})}function we(x){return E.doubleClick({event:x,node:C})}function j(x){W.value&&(!i.value||!S.value||N.value>0)&&qr(C,r.value,c,s,a,!1,K.value),E.click({event:x,node:C})}function L(x){if(!(zr(x)||y.value))if(Ld.includes(x.key)&&W.value){const R=x.key==="Escape";qr(C,r.value,c,s,a,R,K.value)}else S.value&&C.selected&&to[x.key]&&(x.preventDefault(),g.value=`Moved selected node ${x.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.position.x}, y: ${~~C.position.y}`,H({x:to[x.key].x,y:to[x.key].y},x.shiftKey))}}});function nk(e={includeHiddenNodes:!1}){const{nodes:t}=He();return n.computed(()=>{if(t.value.length===0)return!1;for(const o of t.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 ok={class:"vue-flow__nodes vue-flow__container"},ik={name:"Nodes",compatConfig:{MODE:3}},ak=n.defineComponent({...ik,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=He(),a=nk(),r=n.ref();return n.watch(a,l=>{l&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(n.openBlock(),n.createElementBlock("div",ok,[r.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,m)=>{const f=[c.id];if(m&&m.key===c.id&&n.isMemoSame(m,f))return m;const p=(n.openBlock(),n.createBlock(n.unref(tk),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=f,p},s,0),128)):n.createCommentVNode("",!0)]))}});function rk(){const{emits:e}=He();n.onMounted(()=>{if(cu()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new it(et.MISSING_STYLES))}})}const lk=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),sk={name:"VueFlow",compatConfig:{MODE:3}},ck=n.defineComponent({...sk,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:t,emit:o}){const i=e,a=n.useSlots(),r=br(i,"modelValue",o),l=br(i,"nodes",o),s=br(i,"edges",o),c=He(i),d=W1({modelValue:r,nodes:l,edges:s},i,c);return X1(o,c.hooks),F0(),rk(),n.provide(aa,a),n.onUnmounted(d),t(c),(u,m)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(D0,null,{default:n.withCtx(()=>[n.createVNode(ek),lk,n.createVNode(ak),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(U0)],512))}}),dk={name:"Panel",compatConfig:{MODE:3}},Tu=n.defineComponent({...dk,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=He(),i=n.computed(()=>`${t.position}`.split("-"));return(a,r)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(a.$slots,"default")],6))}}),Sn=["red","amber","green","teal","blue","indigo","violet","pink"],Vu={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function uk(e){return typeof e=="string"&&e in Vu}const mk={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},fk=.15;function pk(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[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 hk(e){if(typeof e!="string")return null;const t=pk(e);if(!t||t.s<fk)return null;let o=null,i=1/0;for(const a of Sn){const r=Math.abs(t.h-mk[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function ut(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(uk(t))return t;const o=e==null?void 0:e.properties;return hk((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function tl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const yk={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)"},gk={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 Mu(e,t=!1){return e?t?gk[e]:yk[e]:null}function io(e){return Vu[e]}function ao(e){return`var(--em-swatch-${e}-bar)`}const bk=["width","height","innerHTML"],_k=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={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"/>',"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)=>(n.openBlock(),n.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:t[e.name]??""},null,8,bk))}}),Ge=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ge(_k,[["__scopeId","data-v-92c1dba8"]]);function kk(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 Ek(e,t){const o=kk(t);return o?e(o):t.split("-")[1]??t}function Nk(e){const t=o=>e.params!=null&&o 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"em.check.name3";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-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 t("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-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-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 t("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";default:return e.ruleId}}function Bu(e,t){const o=Nk(t);if(t.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=t.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,t.params)}function wk(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const vk={class:"em-inline-issue__msgs"},$n=Ge(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o=t.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),r=n.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?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${r.value}`])},[n.createVNode(Ve,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",vk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,(c,d)=>(n.openBlock(),n.createElementBlock("span",{key:d},n.toDisplayString(n.unref(Bu)(n.unref(o).t,c)),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),xk={class:"em-mlang"},Ik={class:"em-mlang__tabs",role:"tablist"},Ck=["aria-selected","onClick"],Sk={key:0,class:"em-mlang__dot"},Rn=Ge(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const r=n.ref(a());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(r.value)||(r.value=a())});function l(d){var u,m;return!!((m=(u=o.modelValue)==null?void 0:u[d])!=null&&m.trim())}const s=n.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[r.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[r.value]:u[r.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",xk,[n.createElementVNode("div",Ik,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,m=>(n.openBlock(),n.createElementBlock("button",{key:m,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":r.value===m}]),role:"tab","aria-selected":r.value===m,onClick:f=>r.value=m},[n.createTextVNode(n.toDisplayString(m),1),l(m)?(n.openBlock(),n.createElementBlock("span",Sk,"•")):n.createCommentVNode("",!0)],10,Ck))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(oe.BSTextArea),{key:0,name:`${e.name}-${r.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:1,name:`${e.name}-${r.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),$k=["disabled"],Rk={class:"em-panel__sub-label"},Ak={class:"em-field"},Tk={class:"em-field"},Vk={class:"em-field"},Mk={class:"em-class"},Bk={class:"em-field"},Dk={class:"em-field"},Ok={class:"em-field"},Lk={class:"em-field"},Pk={class:"em-multilang"},zk={class:"em-multilang"},Uk={class:"em-jpa"},Fk={class:"em-field"},Hk={class:"em-field"},Gk={class:"em-field"},jk={class:"em-swatch"},Kk={class:"em-swatch__row"},Yk=["title"],Wk=["title","onClick"],Du=Ge(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.state.logical.entities.find(C=>C.modelId===o.entityId)??null),l=n.computed(()=>r.value?a.state.layout.entityLayouts.find(C=>C.entityRef===r.value.modelId)??null:null),s=n.computed(()=>{var C;return ut(((C=l.value)==null?void 0:C.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=C=>C;function f(C){return C==="inherit"?a.t("em.common.inherit"):C}function p(C){r.value&&a.updateEntity(r.value.modelId,C)}function y(C,ae,E){var S;const Y=((S=r.value)==null?void 0:S.table)??{physicalName:""};p(C==="physicalName"?{table:{...Y,physicalName:E}}:{table:{...Y,logicalName:{...Y.logicalName,[ae]:E}}})}function g(C){p({description:Object.keys(C).length?C:void 0})}function _(C,ae){var E;p({jpaAttrs:{...(E=r.value)==null?void 0:E.jpaAttrs,[C]:ae}})}function b(C,ae){_(C,ae)}const N=n.computed(()=>{var C,ae;return((ae=(C=r.value)==null?void 0:C.jpaAttrs)==null?void 0:ae.discriminatorType)??"inherit"}),h=n.computed(()=>{var C,ae;return!((ae=(C=r.value)==null?void 0:C.jpaAttrs)!=null&&ae.useDiscriminator)});function k(C){_("discriminatorType",C==="inherit"?void 0:C)}function P(C){p({hasPersonalInfo:C})}function A(C){p({superClass:C.trim()||void 0})}function G(C){p({schema:C.trim()||void 0})}function K(C){p({abstractClass:C})}const v=n.computed(()=>{var C,ae;return((ae=(C=r.value)==null?void 0:C.declarationOfInterfaces)==null?void 0:ae.join(", "))??""});function T(C){const ae=C.split(",").map(E=>E.trim()).filter(Boolean);p({declarationOfInterfaces:ae.length?ae:void 0})}function H(C){r.value&&a.setEntitySwatch(r.value.modelId,C)}return(C,ae)=>{var E,Y,S;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:ae[0]||(ae[0]=W=>i("toggle"))},[n.createElementVNode("span",Rk,[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||r.value.name||n.unref(a).t("em.entity.fallback")),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode($n,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",Ak,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.name")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":ae[1]||(ae[1]=W=>p({name:W}))},null,8,["model-value"])]),n.createElementVNode("label",Tk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.stereotype")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":ae[2]||(ae[2]=W=>p({stereotype:W}))},null,8,["model-value"])]),n.createElementVNode("label",Vk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.package")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":ae[3]||(ae[3]=W=>p({packageName:W}))},null,8,["model-value"])]),n.createElementVNode("fieldset",Mk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.classLegend")),1),n.createElementVNode("label",Bk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.superClass")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:n.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":ae[4]||(ae[4]=W=>A(W))},null,8,["placeholder","model-value"])]),n.createElementVNode("label",Dk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.interfaces")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:n.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":v.value,"onUpdate:modelValue":ae[5]||(ae[5]=W=>T(W))},null,8,["placeholder","model-value"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"ent-abstract",class:"em-check",label:n.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":ae[6]||(ae[6]=W=>K(W))},null,8,["label","model-value"])]),n.createElementVNode("label",Ok,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.tablePhysical")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-table",width:"100%","model-value":((E=r.value.table)==null?void 0:E.physicalName)??"","onUpdate:modelValue":ae[7]||(ae[7]=W=>y("physicalName",null,W))},null,8,["model-value"])]),n.createElementVNode("label",Lk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.schema")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-schema",width:"100%",placeholder:n.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":ae[8]||(ae[8]=W=>G(W))},null,8,["placeholder","model-value"])]),n.createElementVNode("fieldset",Pk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.tableLogicalLegend")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,W=>{var ee,ie;return n.openBlock(),n.createElementBlock("label",{key:W,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(W),1),n.createVNode(n.unref(oe.BSTextInput),{name:`ent-logical-${W}`,width:"100%","model-value":((ie=(ee=r.value.table)==null?void 0:ee.logicalName)==null?void 0:ie[W])??"","onUpdate:modelValue":O=>y("logicalName",W,O)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",zk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",Uk,[ae[13]||(ae[13]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,W=>{var ee;return n.createVNode(n.unref(oe.BSCheckbox),{key:W.key,name:`jpa-${W.key}`,class:"em-check",label:W.label,"model-value":!!((ee=r.value.jpaAttrs)!=null&&ee[W.key]),"onUpdate:modelValue":ie=>b(W.key,ie)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",Fk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discColumn")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"disc-col",width:"100%",placeholder:n.unref(a).t("em.entity.discColumnPlaceholder"),disabled:h.value,"model-value":((Y=r.value.jpaAttrs)==null?void 0:Y.discriminatorColumnName)??"","onUpdate:modelValue":ae[9]||(ae[9]=W=>_("discriminatorColumnName",W.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),n.createElementVNode("label",Hk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discType")),1),n.createVNode(n.unref(oe.BSSelect),{disabled:h.value,"model-value":N.value,items:u,"value-provider":m,"label-provider":f,"onUpdate:modelValue":ae[10]||(ae[10]=W=>W&&k(W))},null,8,["disabled","model-value"])]),n.createElementVNode("label",Gk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discLength")),1),n.createVNode(n.unref(oe.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:h.value,"model-value":(S=r.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":ae[11]||(ae[11]=W=>_("discriminatorLength",W||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:n.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":P},null,8,["label","model-value"]),n.createElementVNode("fieldset",jk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.headerColor")),1),n.createElementVNode("div",Kk,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:ae[12]||(ae[12]=W=>H(null))},"∅",10,Yk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),W=>(n.openBlock(),n.createElementBlock("button",{key:W,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===W}]),style:n.normalizeStyle({background:n.unref(ao)(W)}),title:n.unref(io)(W),onClick:ee=>H(W)},null,14,Wk))),128))])])],64)):n.createCommentVNode("",!0)],8,$k)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-92e146f7"]]),Ou={"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.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.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.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.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.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.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.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.descPlaceholderKo":"Description (ko)","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.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.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.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","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.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.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.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.name3":'Duplicate entity name: "{name}"',"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.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.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.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.unspecified":"unspecified"},Lu={"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.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.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.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.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.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.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.descPlaceholderKo":"説明(ko)","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.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.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.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","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.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.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.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3":'エンティティ名が重複しています: "{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.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.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.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.unspecified":"未指定"},Pu={"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.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.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.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.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.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.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.descPlaceholderKo":"설명(ko)","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.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.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.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","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.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.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.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3":'엔티티 이름이 중복됩니다: "{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.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.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.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.unspecified":"미지정"},qk=["ko","en","ja"],nl={ko:Pu,en:Ou,ja:Lu};function Ct(e,t,o){let a=(nl[e]??nl.ko)[t]??nl.ko[t]??t;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const zu=["ko","en","ja","zh"];function Xk(e){if(e)for(const t of zu){const o=e[t];if(o)return o}}function ol(e){const t=Xk(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function Jk(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:zu.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const Zk=["aria-expanded","placeholder"],Qk=["aria-selected","onClick","onMouseenter"],eE={key:0,class:"gcc__opt gcc__opt--empty"},Uu=Ge(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=(v,T)=>Ct(o.locale??"ko",v,T),r=n.ref(),l=n.ref(),s=n.ref(),c=n.ref(""),d=n.ref(!1),u=n.ref(-1),m=n.ref({}),f=n.computed(()=>o.items.find(v=>v.groupCode===o.modelValue)),p=n.computed(()=>f.value?ol(f.value):"");n.watch(p,v=>{d.value||(c.value=v)},{immediate:!0});const y=n.computed(()=>c.value===p.value?o.items:Jk(o.items,c.value));function g(){var T;const v=(T=r.value)==null?void 0:T.getBoundingClientRect();v&&(m.value={left:`${v.left}px`,top:`${v.bottom}px`,width:`${v.width}px`})}function _(){d.value=!0,g(),u.value=Math.max(0,y.value.findIndex(v=>v.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",K)}function b(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",K)}n.onBeforeUnmount(b);function N(){_(),n.nextTick(()=>{var v;return(v=l.value)==null?void 0:v.select()})}function h(){d.value||_(),u.value=0}function k(v){i("update:modelValue",v.groupCode),c.value=ol(v),b()}function P(){i("update:modelValue",void 0),c.value="",b()}function A(){c.value.trim()===""?P():(c.value=p.value,b())}function G(v){var T;if(v.key==="ArrowDown")d.value||_(),u.value=Math.min(u.value+1,y.value.length-1),v.preventDefault();else if(v.key==="ArrowUp")u.value=Math.max(u.value-1,0),v.preventDefault();else if(v.key==="Enter"){const H=y.value[u.value];H&&k(H),v.preventDefault()}else v.key==="Escape"&&(c.value=p.value,b(),(T=l.value)==null||T.blur())}function K(v){var H,C;const T=v.target;!((H=r.value)!=null&&H.contains(T))&&!((C=s.value)!=null&&C.contains(T))&&A()}return(v,T)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":T[0]||(T[0]=H=>c.value=H),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:N,onInput:h,onKeydown:G},null,40,Zk),[[n.vModelText,c.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[d.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:n.normalizeStyle(m.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:T[1]||(T[1]=n.withModifiers(()=>{},["prevent"])),onClick:P},n.toDisplayString(a("em.common.noneParen")),33),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,(H,C)=>(n.openBlock(),n.createElementBlock("li",{key:H.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":C===u.value,"is-selected":H.groupCode===e.modelValue}]),role:"option","aria-selected":H.groupCode===e.modelValue,onMousedown:T[2]||(T[2]=n.withModifiers(()=>{},["prevent"])),onClick:ae=>k(H),onMouseenter:ae=>u.value=C},n.toDisplayString(n.unref(ol)(H)),43,Qk))),128)),y.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",eE,n.toDisplayString(a("em.groupCode.noMatch")),1))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),tE=["disabled"],nE={class:"em-aw__toolbar"},oE={class:"em-aw__count"},iE={class:"em-aw__scroll"},aE={class:"em-aw__table"},rE={class:"c-name"},lE={class:"c-type"},sE={class:"c-logical"},cE={class:"c-col"},dE={class:"c-constraints"},uE={class:"c-del"},mE={class:"c-expand"},fE=["title","onClick","onKeydown"],pE={class:"c-constraints"},hE={class:"em-aw__cflags"},yE=["title"],gE={colspan:"8"},bE={class:"em-aw__detail"},_E={class:"em-aw__dgroup"},kE={class:"em-aw__df"},EE={class:"em-aw__df"},NE={class:"em-aw__df"},wE={class:"em-aw__dgroup"},vE={class:"em-aw__dgroup"},xE={class:"em-aw__df"},IE={key:0,class:"em-aw__df"},CE={class:"em-aw__df"},SE={class:"c-expand"},$E={class:"em-aw__caret is-static","aria-hidden":"true"},RE={class:"c-del"},AE={class:"c-expand"},TE=["title","onClick","onKeydown"],VE={class:"em-aw__embed-label"},ME={class:"em-aw__ro"},BE={class:"em-aw__ro"},DE={class:"c-constraints"},OE={class:"em-aw__ro"},LE={key:0,class:"em-aw__detail-row em-aw__embed-detail"},PE={colspan:"8"},zE={class:"em-aw__detail"},UE={class:"em-aw__dgroup"},FE={key:0,class:"em-aw__df"},HE={class:"em-aw__df"},GE={class:"em-aw__df"},jE={key:0},KE={colspan:"99",class:"em-aw__empty"},YE=6,WE=5,fa="__OWN__",qE=Ge(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(I=>I.modelId===t.entityId)??null),a=n.computed(()=>{var I;return((I=i.value)==null?void 0:I.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),l=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(D=>D.attrType!=="DIVIDER").length}),s=n.ref(new Set);function c(I){return s.value.has(I)}function d(I){const D=new Set(s.value);D.has(I)?D.delete(I):D.add(I),s.value=D}const u=["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 m(I){return I==="none"?o.t("em.common.noneParen"):I}const f=I=>I;function p(I,D){i.value&&o.updateAttribute(i.value.modelId,I.modelId,D)}function y(I){return!!i.value&&!!Ri(o.state.logical,i.value.modelId,I.modelId)}function g(I,D){p(I,{naturalId:D||void 0,naturalIdMutable:D?I.naturalIdMutable:void 0})}function _(){return{naturalId:void 0,naturalIdMutable:void 0}}function b(I,D){p(I,{identifier:D,...D?_():{}})}function N(I,D){p(I,{transient:D||void 0,...D?_():{}})}function h(I){return!!I.transient}const k=I=>I.value,P=I=>I.label;function A(I,D){if(!D)return;const B=ae.value.find(de=>de.type===D);if(B){const de=I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"};p(I,{type:D,customType:void 0,dbAttrs:[{...de,dataType:B.dataType,length:B.length,scale:B.scale}]});return}p(I,D===Rt?{type:D}:{type:D,customType:void 0})}function G(I,D){p(I,{customType:D.trim()===""?void 0:D})}function K(I,D){const de={...I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"},...D};D.dataType!==void 0&&!_o.has(de.dataType)&&(de.scale=void 0),p(I,{dbAttrs:[de]})}function v(I){var D;return _o.has(((D=I.dbAttrs[0])==null?void 0:D.dataType)??"")}function T(I,D){K(I,{logicalName:Object.keys(D).length?D:void 0})}function H(I){return I.personalInfoAttributeType??"none"}function C(I,D){p(I,{personalInfoAttributeType:D==="none"?void 0:D})}const ae=n.computed(()=>o.predefinedCustomTypeCatalog.value),E=n.computed(()=>o.embeddableCatalog.value);function Y(I){var D,B;return((D=I.label)==null?void 0:D.ko)??((B=I.label)==null?void 0:B.en)??I.type}function S(I){!I||!i.value||o.addPredefinedEmbed(i.value.modelId,I)}const W=n.computed(()=>o.groupCodeCatalog.value);function ee(I){var D;return((D=W.value.find(B=>B.groupCode===I.groupCode))==null?void 0:D.codes)??[]}function ie(I){return["none",...ee(I)]}function O(I){return I==="none"?"none":I.code}function U(I){var B,de;if(I==="none")return o.t("em.common.noneParen");const D=((B=I.label)==null?void 0:B.ko)??((de=I.label)==null?void 0:de.en);return D?`${I.code} (${D})`:I.code}function ne(I,D){i.value&&o.setAttributeGroupCode(i.value.modelId,I.modelId,D)}function ce(I,D){p(I,{defaultValue:D==="none"?void 0:D})}function ge(I,D){p(I,{defaultValue:D.trim()===""?void 0:D})}function se(I){return I.attrType.startsWith("EMBED")&&I.dbAttrs.length>0}function pe(I,D,B){const de=I.dbAttrs.map((J,X)=>{if(X!==D)return J;const te={...J,...B};for(const re of Object.keys(B))B[re]===void 0&&delete te[re];return te});i.value&&o.setEmbedColumns(i.value.modelId,I.modelId,de)}function be(I,D,B){pe(I,D,{logicalName:Object.keys(B).length?B:void 0})}function xe(I,D){var J,X,te;if(I.attrType==="EMBED_PREDEF"){const re=(J=o.embeddableCatalog.value.find(Ne=>Ne.type===I.type))==null?void 0:J.fields[D];return re?{name:re.name,physicalName:re.physicalName,dataType:re.dataType,length:re.length,shareable:re.shareable,logicalName:re.logicalName}:void 0}const B=(X=I.embedded)==null?void 0:X.embeddableRef;if(!B)return;const de=(te=o.state.logical.entities.find(re=>re.modelId===B))==null?void 0:te.attributes.flatMap(re=>re.dbAttrs)[D];return de?{physicalName:de.physicalName,dataType:de.dataType,length:de.length,scale:de.scale,logicalName:de.logicalName}:void 0}function Te(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.dataType)||((de=I.dbAttrs[D])==null?void 0:de.dataType)||""}function Ae(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.length)??((de=I.dbAttrs[D])==null?void 0:de.length)}function fe(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.scale)??((de=I.dbAttrs[D])==null?void 0:de.scale)}const ke=["inherit","true","false"];function we(I){return I==="inherit"?o.t("em.common.inherit"):I}function j(I){return(I==null?void 0:I.updatable)===void 0?"inherit":I.updatable?"true":"false"}function L(I,D,B){pe(I,D,{updatable:B==="inherit"?void 0:B==="true"})}function x(I,D){K(I,{updatable:D==="inherit"?void 0:D==="true"})}const R=["inherit","true","false"];function V(I){return I==="inherit"?o.t("em.common.inherit"):I}function Q(I){return(I==null?void 0:I.insertable)===void 0?"inherit":I.insertable?"true":"false"}function me(I,D,B){pe(I,D,{insertable:B==="inherit"?void 0:B==="true"})}function ve(I,D){K(I,{insertable:D==="inherit"?void 0:D==="true"})}const Ee=n.computed(()=>i.value?ui(i.value,o.state.logical.entities):[]),$e=n.computed(()=>mn(Ee.value.flatMap(I=>I.attributes.flatMap(D=>D.dbAttrs)))),Me=n.computed(()=>Ee.value.flatMap(I=>I.attributes.filter(D=>D.attrType==="NORMAL"&&D.dbAttrs.length===1&&D.dbAttrs[0]).map(D=>{var B;return{modelId:D.dbAttrs[0].modelId,physical:D.dbAttrs[0].physicalName||D.name,isCurrency:D.type==="Currency",ownerName:I.modelId===((B=i.value)==null?void 0:B.modelId)?void 0:I.name}})));function Ue(){const I=[...Me.value].sort((D,B)=>Number(B.isCurrency)-Number(D.isCurrency));return[fa,...I.map(D=>D.modelId)]}function Ye(I){if(I===fa)return o.t("em.attr.sharedOwn");const D=Me.value.find(de=>de.modelId===I);if(!D)return I;const B=D.ownerName?`${D.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:B,physical:D.physical,mode:D.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function Fe(I){return(I==null?void 0:I.sharedColumnRef)??fa}function gt(I,D,B){pe(I,D,{sharedColumnRef:B===fa?void 0:B})}function w(I){return(I==null?void 0:I.sharedColumnRef)!=null}function M(I){var D;return((D=zn(I,$e.value))==null?void 0:D.physicalName)??""}return(I,D)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",nE,[n.createElementVNode("span",oE,n.toDisplayString(n.unref(o).t("em.attr.section",{n:l.value})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:D[0]||(D[0]=B=>n.unref(o).addAttribute(i.value.modelId))},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.attr.addDivider"),onClick:D[1]||(D[1]=B=>n.unref(o).addDivider(i.value.modelId))},null,8,["caption"]),E.value.length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"140px",placeholder:n.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:E.value,"value-provider":B=>B.type,"label-provider":Y,"onUpdate:modelValue":S},null,8,["placeholder","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",iE,[n.createElementVNode("table",aE,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[D[2]||(D[2]=n.createElementVNode("th",{class:"c-expand"},null,-1)),n.createElementVNode("th",rE,n.toDisplayString(n.unref(o).t("em.attr.namePlaceholder")),1),n.createElementVNode("th",lE,n.toDisplayString(n.unref(o).t("em.attr.typePlaceholder")),1),n.createElementVNode("th",sE,n.toDisplayString(n.unref(o).t("em.attr.logicalPlaceholder")),1),n.createElementVNode("th",cE,n.toDisplayString(n.unref(o).t("em.attr.columnPhysical")),1),D[3]||(D[3]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),D[4]||(D[4]=n.createElementVNode("th",{class:"c-len"},"len",-1)),n.createElementVNode("th",dE,n.toDisplayString(n.unref(o).t("em.attr.constraints")),1),D[5]||(D[5]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,B=>{var de,J,X,te,re,Ne,$,Z,F,Ie;return n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":r.value.has(B.modelId)}])},[D[6]||(D[6]=n.createElementVNode("td",{class:"c-expand"},null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:YE,class:"em-aw__divider-note"},n.toDisplayString(n.unref(o).t("em.attr.dividerNote")),1),n.createElementVNode("td",uE,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2)):se(B)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":r.value.has(B.modelId)}])},[n.createElementVNode("td",SE,[n.createElementVNode("span",$E,[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:WE,class:"em-aw__embed-note"},n.toDisplayString(n.unref(o).t("em.attr.embedChildCols",{n:B.dbAttrs.length})),1),n.createElementVNode("td",RE,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(ye,ze)=>{var z,q,ue,Ce,Be,Oe;return n.openBlock(),n.createElementBlock(n.Fragment,{key:ye.modelId},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-col",{"em-aw__open":c(ye.modelId)}])},[n.createElementVNode("td",AE,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(ye.modelId)}]),role:"button",tabindex:"0",title:n.unref(o).t(c(ye.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:he=>d(ye.modelId),onKeydown:[n.withKeys(n.withModifiers(he=>d(ye.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(he=>d(ye.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,TE)]),n.createElementVNode("td",VE,"↳ "+n.toDisplayString(((z=xe(B,ze))==null?void 0:z.name)??((q=xe(B,ze))==null?void 0:q.physicalName)??n.unref(o).t("em.attr.colFallback",{n:ze+1})),1),D[13]||(D[13]=n.createElementVNode("td",null,null,-1)),n.createElementVNode("td",null,[n.createVNode(Rn,{name:`aw-embed-logical-${ye.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:((Ce=(ue=xe(B,ze))==null?void 0:ue.logicalName)==null?void 0:Ce.ko)??n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ye.logicalName,"onUpdate:modelValue":he=>be(B,ze,he)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-embed-col-${ye.modelId}`,width:"100%",disabled:w(ye),placeholder:((Be=xe(B,ze))==null?void 0:Be.physicalName)??n.unref(o).t("em.attr.columnPlaceholder"),"model-value":w(ye)?M(ye):ye.physicalName,"onUpdate:modelValue":he=>pe(B,ze,{physicalName:he})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode($n,{controller:n.unref(o),"ref-id":ye.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",ME,n.toDisplayString(Te(B,ze)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",BE,n.toDisplayString(Ae(B,ze)??""),1)]),n.createElementVNode("td",DE,[n.createElementVNode("span",OE,n.toDisplayString(fe(B,ze)!=null?`scale ${fe(B,ze)}`:""),1)]),D[14]||(D[14]=n.createElementVNode("td",null,null,-1))],2),c(ye.modelId)?(n.openBlock(),n.createElementBlock("tr",LE,[D[17]||(D[17]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",PE,[n.createElementVNode("div",zE,[n.createElementVNode("fieldset",UE,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.attr.overrideLegend")),1),(Oe=xe(B,ze))!=null&&Oe.shareable?(n.openBlock(),n.createElementBlock("label",FE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.currencyColumn")),1),n.createVNode(n.unref(oe.BSSelect),{width:"150px","model-value":Fe(ye),items:Ue(),"value-provider":f,"label-provider":Ye,"onUpdate:modelValue":he=>he&>(B,ze,he)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",HE,[D[15]||(D[15]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:w(ye),"model-value":w(ye)?"false":Q(ye),items:R,"value-provider":f,"label-provider":V,"onUpdate:modelValue":he=>he&&me(B,ze,he)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",GE,[D[16]||(D[16]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:w(ye),"model-value":w(ye)?"false":j(ye),items:ke,"value-provider":f,"label-provider":we,"onUpdate:modelValue":he=>he&&L(B,ze,he)},null,8,["disabled","model-value","onUpdate:modelValue"])])])])])])):n.createCommentVNode("",!0)],64)}),128))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("tr",{class:n.normalizeClass({"is-focused":r.value.has(B.modelId),"em-aw__open":c(B.modelId)})},[n.createElementVNode("td",mE,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(B.modelId)}]),role:"button",tabindex:"0",title:n.unref(o).t(c(B.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ye=>d(B.modelId),onKeydown:[n.withKeys(n.withModifiers(ye=>d(B.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ye=>d(B.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,fE)]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.typePlaceholder"),disabled:!!B.groupCode,items:n.unref(Ql)(B.type,ae.value),"value-provider":k,"label-provider":P,"model-value":B.type,"onUpdate:modelValue":ye=>A(B,ye)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),B.type===n.unref(Rt)?(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.customTypePlaceholder"),"model-value":B.customType??"","onUpdate:modelValue":ye=>G(B,ye)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(Rn,{name:`aw-logical-${B.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(de=B.dbAttrs[0])==null?void 0:de.logicalName,"onUpdate:modelValue":ye=>T(B,ye)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.columnPlaceholder"),disabled:h(B),"model-value":((J=B.dbAttrs[0])==null?void 0:J.physicalName)??"","onUpdate:modelValue":ye=>K(B,{physicalName:ye})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),n.createVNode($n,{controller:n.unref(o),"ref-id":(X=B.dbAttrs[0])==null?void 0:X.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:h(B),items:n.unref(Jl)(((te=B.dbAttrs[0])==null?void 0:te.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":f,"label-provider":n.unref(qa),"model-value":((re=B.dbAttrs[0])==null?void 0:re.dataType)??"","onUpdate:modelValue":ye=>ye&&K(B,{dataType:ye})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:h(B),"model-value":(Ne=B.dbAttrs[0])==null?void 0:Ne.length,"onUpdate:modelValue":ye=>K(B,{length:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",pE,[n.createElementVNode("div",hE,[n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-pk-${B.modelId}`,label:"PK","model-value":B.identifier,disabled:a.value||h(B),"onUpdate:modelValue":ye=>b(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-nn-${B.modelId}`,label:"NN","model-value":B.notNull,disabled:h(B),"onUpdate:modelValue":ye=>p(B,{notNull:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-uq-${B.modelId}`,label:"UQ","model-value":!!(($=B.dbAttrs[0])!=null&&$.unique),disabled:h(B),"onUpdate:modelValue":ye=>K(B,{unique:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])]),n.createElementVNode("td",{class:"c-del",title:y(B)?n.unref(o).t("em.attr.fkDeleteHint"):void 0},[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,yE)],2),c(B.modelId)?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__detail-row",{"is-focused":r.value.has(B.modelId)}])},[D[12]||(D[12]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",gE,[n.createElementVNode("div",bE,[n.createElementVNode("fieldset",_E,[D[10]||(D[10]=n.createElementVNode("legend",null,"DB",-1)),n.createElementVNode("label",kE,[D[7]||(D[7]=n.createElementVNode("span",null,"scale",-1)),n.createVNode(n.unref(oe.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"72px",placeholder:"scale",disabled:h(B)||!v(B),"model-value":(Z=B.dbAttrs[0])==null?void 0:Z.scale,"onUpdate:modelValue":ye=>K(B,{scale:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-ai-${B.modelId}`,label:"Auto Increment","model-value":!!((F=B.dbAttrs[0])!=null&&F.autoIncrement),disabled:h(B)||!B.identifier,"onUpdate:modelValue":ye=>K(B,{autoIncrement:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createElementVNode("label",EE,[D[8]||(D[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{name:`aw-ins-${B.modelId}`,width:"110px",disabled:h(B),"model-value":Q(B.dbAttrs[0]),items:R,"value-provider":f,"label-provider":V,"onUpdate:modelValue":ye=>ye&&ve(B,ye)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",NE,[D[9]||(D[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{name:`aw-upd-${B.modelId}`,width:"110px",disabled:h(B),"model-value":j(B.dbAttrs[0]),items:ke,"value-provider":f,"label-provider":we,"onUpdate:modelValue":ye=>ye&&x(B,ye)},null,8,["name","disabled","model-value","onUpdate:modelValue"])])]),n.createElementVNode("fieldset",wE,[D[11]||(D[11]=n.createElementVNode("legend",null,"JPA",-1)),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-tr-${B.modelId}`,label:"@Transient","model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":ye=>N(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-nid-${B.modelId}`,label:"@NaturalId","model-value":!!B.naturalId,disabled:B.identifier||h(B),"onUpdate:modelValue":ye=>g(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${B.modelId}`,label:"mutable","model-value":!!B.naturalIdMutable,disabled:h(B)||!B.naturalId,"onUpdate:modelValue":ye=>p(B,{naturalIdMutable:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-mv-${B.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ie=B.dbAttrs[0])!=null&&Ie.multiValue),disabled:h(B),"onUpdate:modelValue":ye=>K(B,{multiValue:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("fieldset",vE,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.attr.semanticLegend")),1),n.createElementVNode("label",xE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"150px","model-value":H(B),items:u,"value-provider":f,"label-provider":m,"onUpdate:modelValue":ye=>ye&&C(B,ye)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("label",IE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.codeGroup")),1),n.createVNode(Uu,{"model-value":B.groupCode,items:W.value,locale:n.unref(o).uiLocale.value,"onUpdate:modelValue":ye=>ne(B,ye)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",CE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.defaultValue")),1),ee(B).length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"150px","model-value":B.defaultValue??"none",items:ie(B),"value-provider":O,"label-provider":U,"onUpdate:modelValue":ye=>ye&&ce(B,ye)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"150px",placeholder:n.unref(o).t("em.attr.defaultValue"),"model-value":B.defaultValue??"","onUpdate:modelValue":ye=>ge(B,ye)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])])])],2)):n.createCommentVNode("",!0)],64))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",jE,[n.createElementVNode("td",KE,n.toDisplayString(n.unref(o).t("em.attr.empty")),1)]))])])])],8,tE)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-a64a6817"]]),XE=["disabled"],JE={class:"em-idxw__list"},ZE={class:"em-idxw__list-head"},QE=["onClick"],eN={class:"em-idxw__item-name"},tN={key:0,class:"em-idxw__badge"},nN={class:"em-idxw__item-cnt"},oN={key:0,class:"em-idxw__empty"},iN={key:0,class:"em-idxw__edit"},aN={class:"em-idxw__form"},rN={class:"em-field em-idxw__name"},lN={class:"em-field"},sN=["value","placeholder"],cN={class:"em-idxw__transfer"},dN={class:"em-idxw__pane"},uN={class:"em-idxw__pane-head"},mN={class:"em-idxw__cols"},fN=["onClick"],pN=["title"],hN={key:0,class:"em-idxw__empty"},yN={class:"em-idxw__arrows"},gN={class:"em-idxw__pane"},bN={class:"em-idxw__pane-head"},_N={class:"em-idxw__cols"},kN={class:"em-idxw__col-name"},EN=["title"],NN={class:"em-idxw__col-ops"},wN=["title","disabled","onClick"],vN=["title","disabled","onClick"],xN=["title","onClick"],IN={key:0,class:"em-idxw__empty"},CN={key:1,class:"em-idxw__edit em-idxw__edit--empty"},SN=Ge(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(v=>v.modelId===t.entityId)??null),a=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.indexes)??[]}),r=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.attributes)??[]}),l=n.ref(null);n.watch(a,v=>{var T;v.some(H=>H.modelId===l.value)||(l.value=((T=v[0])==null?void 0:T.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(v=>v.modelId===l.value)??null),c=n.computed(()=>i.value?go(i.value,o.superClassCatalog.value):[]),d=n.computed(()=>{var v;return new Set(((v=s.value)==null?void 0:v.columns.map(T=>T.columnRef))??[])}),u=n.computed(()=>[...r.value.filter(v=>!d.value.has(v.modelId)).map(v=>({ref:v.modelId,label:f(v),inherited:!1})),...c.value.filter(v=>!d.value.has(v.modelId)).map(v=>({ref:v.modelId,label:p(v),inherited:!0}))]),m=n.ref(new Set);n.watch(l,()=>m.value=new Set);function f(v){var H;const T=(H=v.dbAttrs[0])==null?void 0:H.physicalName;return T&&T!==v.name?`${v.name} (${T})`:v.name}function p(v){return v.physicalName&&v.physicalName!==v.field?`${v.field} (${v.physicalName})`:v.field}function y(v){const T=r.value.find(C=>C.modelId===v);if(T)return f(T);const H=c.value.find(C=>C.modelId===v);return H?p(H):v}function g(v){return yo(v)}function _(v,T){i.value&&o.updateIndex(i.value.modelId,v,T)}function b(){var T;if(!i.value)return;const v=De();o.addIndex(i.value.modelId,{modelId:v,name:`idx_${(((T=i.value.indexes)==null?void 0:T.length)??0)+1}`,unique:!1,columns:[]}),l.value=v}function N(v){i.value&&o.removeIndex(i.value.modelId,v)}function h(v){s.value&&_(s.value.modelId,{parameters:v.trim()===""?void 0:v})}function k(v){const T=new Set(m.value);T.has(v)?T.delete(v):T.add(v),m.value=T}function P(){const v=s.value;if(!v||!m.value.size)return;const T=[...m.value].map(H=>({columnRef:H,descending:!1}));_(v.modelId,{columns:[...v.columns,...T]}),m.value=new Set}function A(v){const T=s.value;T&&_(T.modelId,{columns:T.columns.filter((H,C)=>C!==v)})}function G(v,T){const H=s.value;H&&_(H.modelId,{columns:H.columns.map((C,ae)=>ae===v?{...C,descending:T}:C)})}function K(v,T){const H=s.value;if(!H)return;const C=v+T;if(C<0||C>=H.columns.length)return;const ae=[...H.columns];[ae[v],ae[C]]=[ae[C],ae[v]],_(H.modelId,{columns:ae})}return(v,T)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",JE,[n.createElementVNode("div",ZE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.section",{n:a.value.length})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:b},null,8,["caption"])]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,H=>(n.openBlock(),n.createElementBlock("li",{key:H.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":H.modelId===l.value}]),onClick:C=>l.value=H.modelId},[n.createElementVNode("span",eN,n.toDisplayString(H.name||n.unref(o).t("em.attr.nameless")),1),H.unique?(n.openBlock(),n.createElementBlock("span",tN,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",nN,n.toDisplayString(H.columns.length),1)],10,QE))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",oN,n.toDisplayString(n.unref(o).t("em.index.empty")),1))])]),s.value?(n.openBlock(),n.createElementBlock("section",iN,[n.createElementVNode("div",aN,[n.createElementVNode("label",rN,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.namePlaceholder")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":T[0]||(T[0]=H=>_(s.value.modelId,{name:H}))},null,8,["model-value"]),n.createVNode($n,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":T[1]||(T[1]=H=>_(s.value.modelId,{unique:H}))},null,8,["model-value"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:n.unref(o).t("em.index.delete"),onClick:T[2]||(T[2]=H=>N(s.value.modelId))},null,8,["caption"])]),n.createElementVNode("label",lN,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.condition")),1),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:n.unref(o).t("em.index.conditionPlaceholderWide"),onChange:T[3]||(T[3]=H=>h(H.target.value))},null,40,sN)]),n.createElementVNode("div",cN,[n.createElementVNode("div",dN,[n.createElementVNode("div",uN,n.toDisplayString(n.unref(o).t("em.index.availColumns",{n:u.value.length})),1),n.createElementVNode("ul",mN,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,H=>(n.openBlock(),n.createElementBlock("li",{key:H.ref,class:n.normalizeClass(["em-idxw__col",{"is-sel":m.value.has(H.ref)}]),onClick:C=>k(H.ref)},[n.createTextVNode(n.toDisplayString(H.label),1),H.inherited?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-idxw__inh",title:n.unref(o).t("em.index.inheritedColTitle")},n.toDisplayString(n.unref(o).t("em.index.inheritedBadge")),9,pN)):n.createCommentVNode("",!0)],10,fN))),128)),u.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",hN,n.toDisplayString(n.unref(o).t("em.index.allColumnsUsed")),1))])]),n.createElementVNode("div",yN,[n.createVNode(n.unref(oe.BSButton),{caption:n.unref(o).t("em.index.addArrow"),disabled:!m.value.size,onClick:P},null,8,["caption","disabled"])]),n.createElementVNode("div",gN,[n.createElementVNode("div",bN,n.toDisplayString(n.unref(o).t("em.index.indexColumns",{n:s.value.columns.length})),1),n.createElementVNode("ul",_N,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(H,C)=>(n.openBlock(),n.createElementBlock("li",{key:C,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",kN,[n.createTextVNode(n.toDisplayString(y(H.columnRef)),1),g(H.columnRef)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-idxw__inh",title:n.unref(o).t("em.index.inheritedColTitle")},n.toDisplayString(n.unref(o).t("em.index.inheritedBadge")),9,EN)):n.createCommentVNode("",!0)]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idxw-desc-${C}`,class:"em-check",label:"DESC","model-value":H.descending,"onUpdate:modelValue":ae=>G(C,ae)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",NN,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:n.unref(o).t("em.index.moveUp"),disabled:C===0,onClick:ae=>K(C,-1)},"↑",8,wN),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:n.unref(o).t("em.index.moveDown"),disabled:C===s.value.columns.length-1,onClick:ae=>K(C,1)},"↓",8,vN),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:n.unref(o).t("em.index.removeColumn"),onClick:ae=>A(C)},"✕",8,xN)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",IN,n.toDisplayString(n.unref(o).t("em.index.noColumns")),1))])])])])):(n.openBlock(),n.createElementBlock("section",CN,n.toDisplayString(n.unref(o).t("em.index.selectPrompt")),1))],8,XE)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-76de4c26"]]),$N={class:"em-op-src"},RN=["placeholder"],AN={class:"em-op-src__actions"},Fu=Ge(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(l,s)=>Ct(t.locale??"ko",l,s),a=n.ref(t.sourceCode);function r(){t.onSave(a.value),o.close()}return(l,s)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.opSource.title",{name:t.operationName})},{default:n.withCtx(()=>[n.createElementVNode("div",$N,[n.withDirectives(n.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,RN),[[n.vModelText,a.value]]),n.createElementVNode("div",AN,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),TN=["disabled"],VN={class:"em-ow__toolbar"},MN={class:"em-ow__count"},BN={class:"em-ow__scroll"},DN={class:"em-ow__table"},ON={class:"c-name"},LN={class:"c-desc"},PN={class:"c-pii"},zN={class:"c-src"},UN={class:"c-del"},FN={key:0},HN={colspan:"6",class:"em-ow__empty"},GN=Ge(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=oe.useModal(),a=n.computed(()=>o.state.logical.entities.find(y=>y.modelId===t.entityId)??null),r=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],l=["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 s(y){return y==="none"?o.t("em.common.noneParen"):y}const c=y=>y;function d(y,g){a.value&&o.updateOperation(a.value.modelId,y.modelId,g)}function u(y,g,_){d(y,{description:{...y.description,[g]:_}})}function m(y){return y.personalInfoAttributeType??"none"}function f(y,g){d(y,{personalInfoAttributeType:g==="none"?void 0:g})}function p(y){i.openModal({component:Fu,bind:{operationName:y.name,sourceCode:y.sourceCode??"",locale:o.uiLocale.value,onSave:g=>d(y,{sourceCode:g})}})}return(y,g)=>{var _,b;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",VN,[n.createElementVNode("span",MN,n.toDisplayString(n.unref(o).t("em.op.section",{n:((_=a.value.operations)==null?void 0:_.length)??0})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:g[0]||(g[0]=N=>n.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),n.createElementVNode("div",BN,[n.createElementVNode("table",DN,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",ON,n.toDisplayString(n.unref(o).t("em.attr.namePlaceholder")),1),g[1]||(g[1]=n.createElementVNode("th",{class:"c-vis"},"visibility",-1)),n.createElementVNode("th",LN,n.toDisplayString(n.unref(o).t("em.common.description")),1),n.createElementVNode("th",PN,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createElementVNode("th",zN,n.toDisplayString(n.unref(o).t("em.op.body")),1),g[2]||(g[2]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],N=>{var h;return n.openBlock(),n.createElementBlock("tr",{key:N.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:n.unref(o).t("em.op.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":k=>d(N,{name:k})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:r,"value-provider":c,"label-provider":c,"onUpdate:modelValue":k=>k&&d(N,{visibility:k})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`ow-desc-${N.modelId}`,width:"100%",placeholder:n.unref(o).t("em.op.descPlaceholderKo"),"model-value":((h=N.description)==null?void 0:h.ko)??"","onUpdate:modelValue":k=>u(N,"ko",k)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":m(N),items:l,"value-provider":c,"label-provider":s,"onUpdate:modelValue":k=>k&&f(N,k)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t(N.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:k=>p(N)},null,8,["caption","onClick"])]),n.createElementVNode("td",UN,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:k=>n.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])])}),128)),(b=a.value.operations)!=null&&b.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",FN,[n.createElementVNode("td",HN,n.toDisplayString(n.unref(o).t("em.op.empty")),1)]))])])])],8,TN)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1c255914"]]),jN={class:"em-detail__tabs"},KN=["onClick"],YN={key:0,class:"em-detail__narrow"},WN=Ge(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=oe.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const r=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],l=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:n.unref(o).t("em.detail.title",{name:((d=a.value)==null?void 0:d.name)??""})},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",jN,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(r,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":l.value===u.key}]),onClick:m=>l.value=u.key},n.toDisplayString(n.unref(o).t(u.labelKey)),11,KN)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[l.value==="basics"?(n.openBlock(),n.createElementBlock("div",YN,[n.createVNode(Du,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])])):l.value==="columns"?(n.openBlock(),n.createBlock(qE,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):l.value==="indexes"?(n.openBlock(),n.createBlock(SN,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(GN,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-785c4770"]]);function pa(e,t,o){e.openModal({component:WN,bind:{controller:n.markRaw(t),entityId:o}})}const Hu="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function qN(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=De(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const r=De();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=De()}for(const a of t.indexes??[]){a.modelId=De();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of t.operations??[]){const r=De();o.set(a.modelId,r),a.modelId=r}return{clone:t,idMap:o}}const XN=220;function JN(e,t){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||XN));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 t.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of t.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 il=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),An=Symbol("editorController");function Gu(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function ha(e,t){const o=[];for(const i of t.remove)o.push(Wn(e,i));for(const i of t.update)o.push(gn(e,i.attributeId,i.patch));for(const i of t.add)o.push(Ut(e,i));return o}function ro(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function lo(e,t){const o=[];for(const[i,a]of fh(e,t,De))o.push(...ha(i,a));return o}function ju(e,t,o){const i=new Set(o.remove);return ro(e,t,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 al(e,t){const o=So(e,t,De),i=ha(t,o),a=ju(e,t,o);return i.push(...lo(a,t)),i}function Ku(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:De()}))}function ZN(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((p,y)=>Math.max(p,y.order),-1)+1,m=new Set(o.attributes.map(p=>p.name));let f="id";for(let p=2;m.has(f);p++)f=`id${p}`;a={modelId:De(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:De(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(Ut(t,a))}const r=[];for(const u of e.entities)for(const m of u.attributes){if(((d=m.embedded)==null?void 0:d.embeddableRef)!==t)continue;const f=e.associations.find(_=>_.modelId===m.embedded.associationRef);if(!f)continue;const p=f.end1.entityRef===u.modelId,y=p?f.end1:f.end2,g=p?f.end2:f.end1;r.push({ownerId:u.modelId,dispId:m.modelId,assocId:f.modelId,end1:{entityRef:u.modelId,multiplicity:y.multiplicity,navigable:y.navigable,composition:!1},end2:{entityRef:t,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const l={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const m=new Set(r.filter(f=>f.ownerId===u.modelId).map(f=>f.dispId));return m.size?{...u,attributes:u.attributes.filter(f=>!m.has(f.modelId))}:u}),associations:e.associations.map(u=>{const m=r.find(f=>f.assocId===u.modelId);return m?{...u,end1:m.end1,end2:m.end2}:u})},s=So(l,t,De);for(const u of r){const m=s.add.find(f=>{var p;return((p=f.derivedFrom)==null?void 0:p.associationRef)===u.assocId});m&&(u.end2.attributeRef=m.modelId)}for(const u of r)i.push(Wn(u.ownerId,u.dispId)),i.push(Ii(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...ha(t,s));const c=ju(l,t,s);return i.push(...lo(c,t)),i}function QN(e,t){const o=e.entities.find(r=>r.modelId===t);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===t,s=r.end2.entityRef===t;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var k;return((k=h.embedded)==null?void 0:k.associationRef)===r.modelId}))continue;const u=De(),m=d.attributes.reduce((h,k)=>Math.max(h,k.order),-1)+1,f=new Set(d.attributes.map(h=>h.name)),p=a(o.name);let y=p;for(let h=2;f.has(y);h++)y=`${p}${h}`;const g=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:De()})),_={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:t}};i.push(Ut(c,_));const b=l?"end2":"end1",N=l?"end1":"end2";i.push(Ii(r.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:De()},[N]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function ew(e=Gu(),t={}){var Fe,gt;const o=n.reactive(e);let i=new mr(o);const a=n.ref(t.embeddableCatalog??[]),r=n.ref(t.groupCodeCatalog??[]),l=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.superClassCatalog??[]),c=n.ref(t.languages??["ko","en","ja","zh"]),d=n.ref(t.userLanguage??"ko"),u=n.ref(t.uiLocale??"ko"),m=(w,M)=>Ct(u.value,w,M),f=n.ref(t.reservedWords),p=n.ref(t.selectableDataTypes),y=n.ref(t.largeEntityThreshold),g=n.ref(t.flagEntitiesWithoutRelations??!1),_=n.ref(!1),b=n.ref(!1),N=n.ref(!1),h=n.ref(0),k=n.ref(null);let P=0;const A=w=>{if(t.onNotice){t.onNotice(w);return}k.value={text:w,id:++P}},G=n.ref(((Fe=t.meta)==null?void 0:Fe.schemaVersion)??1),K=n.ref(((gt=t.meta)==null?void 0:gt.opWriteEnabled)??!1),v=n.computed(()=>G.value>=2&&K.value),T=t.historyTransport,H=n.computed(()=>v.value&&T!==void 0),C=t.restoreTransport,ae=n.ref(0),E=n.computed(()=>v.value&&S.value&&C!==void 0);async function Y(w){if(!C||!S.value)return{ok:!1,reason:"unavailable"};const M=await C(w);return M.ok&&ae.value++,M}const S=n.ref(!(G.value>=2&&K.value===!1)),W=n.ref("LOGICAL_PHYSICAL"),ee=n.ref("straight"),ie=n.ref(!0),O=n.ref(!0),U=n.ref(null),ne=n.computed(()=>{var w;return((w=U.value)==null?void 0:w.kind)==="attribute"?{entityId:U.value.entityId,attrId:U.value.anchor}:null}),ce=n.computed(()=>{var w;return((w=U.value)==null?void 0:w.kind)==="attribute"?U.value.ids:[]}),ge=n.computed(()=>{var w,M;return((w=U.value)==null?void 0:w.kind)==="entity"?U.value.id:((M=U.value)==null?void 0:M.kind)==="attribute"?U.value.entityId:null}),se=n.ref(null);let pe=0;const be=n.ref(null),xe=n.ref(null);let Te=t.meta;function Ae(){i.onChange(()=>{_.value=i.canUndo,b.value=i.canRedo,N.value=i.isDirty,h.value++})}Ae();let fe=null,ke=null;function we(){ke==null||ke(),ke=null,fe=null}function j(){if(we(),!v.value||!t.opTransport)return;const w=new pc({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:M=>{S.value=!1,xe.value=M},onError:t.onOpError});w.seed((Te==null?void 0:Te.revSeed)??{}),ke=w.attach(i),fe=w}j();const L=n.computed(()=>Vl(o.logical,o.layout)),x=n.computed(()=>({reservedWords:f.value,selectableDataTypes:p.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),R=n.computed(()=>ts(o.logical,x.value)),V=n.computed(()=>{const w=new Map;for(const M of R.value){if(!M.targetRef)continue;const I=w.get(M.targetRef);I?I.push(M):w.set(M.targetRef,[M])}return w}),Q=w=>{S.value&&i.execute(w)},me=w=>o.layout.entityLayouts.some(M=>M.entityRef===w&&!!M.locked),ve=w=>o.layout.groupLayouts.some(M=>M.groupRef===w&&!!M.locked),Ee=w=>{const M=o.logical.associations.find(I=>I.modelId===w);return!!M&&(me(M.end1.entityRef)||me(M.end2.entityRef))},$e=(w,M,I)=>{if(me(w))return;const D=gn(w,M,I),B=ro(o.logical,w,J=>J.map(X=>X.modelId===M?{...X,...I}:X)),de=lo(B,w);Q(de.length?Je("속성 수정",[D,...de]):D)};function Me(w){const M=w.map(te=>o.layout.entityLayouts.find(re=>re.entityRef===te)).filter(te=>!!te);if(!M.length)return{location:{x:40,y:40},size:{width:400,height:300}};let I=1/0,D=1/0,B=-1/0,de=-1/0;for(const te of M){const re=te.geo.size.width||220,Ne=te.geo.size.height||140;I=Math.min(I,te.geo.location.x),D=Math.min(D,te.geo.location.y),B=Math.max(B,te.geo.location.x+re),de=Math.max(de,te.geo.location.y+Ne)}const J=40,X=28;return{location:{x:I-J,y:D-J-X},size:{width:B-I+J*2,height:de-D+J*2+X}}}function Ue(w,M,I){var te;const D=o.layout.groupLayouts.find(re=>re.groupRef===w),B=(D==null?void 0:D.geo.location)??M,de=M.x-B.x,J=M.y-B.y,X=[Ds(w,M),...I.map(re=>Yn(re.id,re.location))];if(de||J){const re=new Set(((te=o.logical.groups.find(Ne=>Ne.modelId===w))==null?void 0:te.memberEntityRefs)??[]);for(const Ne of o.logical.associations){if(!re.has(Ne.end1.entityRef)||!re.has(Ne.end2.entityRef))continue;const $=o.layout.associationLayouts.find(Z=>Z.associationRef===Ne.modelId);$&&$.waypoints.length&&X.push(Js(Ne.modelId,de,J))}for(const Ne of(D==null?void 0:D.memberNoteRefs)??[]){const $=o.layout.notes.find(Z=>Z.modelId===Ne);$&&X.push(Co(Ne,{x:$.geo.location.x+de,y:$.geo.location.y+J}))}}return X}const Ye={state:o,resolved:L,issues:R,issuesByRef:V,flagEntitiesWithoutRelations:g,canUndo:_,canRedo:b,dirty:N,revision:h,notice:k,editable:S,schemaVersion:G,opWriteEnabled:K,opMode:v,opConflict:xe,historyTransport:T,historyAvailable:H,restoreTransport:C,restoreAvailable:E,restoreToSeq:Y,reloadRequest:ae,displayMode:W,routingMode:ee,showGrid:ie,showMinimap:O,selection:U,selectedAttr:ne,selectedAttrIds:ce,inspectedEntityId:ge,focusRequest:se,clipboard:be,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,uiLocale:u,t:m,selectableDataTypes:p,setEditable(w){S.value=w&&v.value},setEmbeddableCatalog(w){a.value=w},setGroupCodeCatalog(w){r.value=w},setPredefinedCustomTypeCatalog(w){l.value=w},setSuperClassCatalog(w){s.value=w},selectAttribute(w,M,I="replace"){const D=U.value,B=(D==null?void 0:D.kind)==="attribute"&&D.entityId===w;if(I==="replace"||!B){U.value={kind:"attribute",entityId:w,ids:[M],anchor:M};return}if(I==="toggle"){const $=D.ids.includes(M),Z=$?D.ids.filter(Ie=>Ie!==M):[...D.ids,M];if(!Z.length){U.value=null;return}const F=$&&D.anchor===M?Z[Z.length-1]:$?D.anchor:M;U.value={kind:"attribute",entityId:w,ids:Z,anchor:F};return}const de=o.logical.entities.find($=>$.modelId===w),J=[...(de==null?void 0:de.attributes)??[]].sort(($,Z)=>$.order-Z.order).map($=>$.modelId),X=J.indexOf(D.anchor),te=J.indexOf(M);if(X<0||te<0){U.value={kind:"attribute",entityId:w,ids:[M],anchor:M};return}const[re,Ne]=X<=te?[X,te]:[te,X];U.value={kind:"attribute",entityId:w,ids:J.slice(re,Ne+1),anchor:D.anchor}},moveAttributeFocus(w){const M=U.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const I=o.logical.entities.find(J=>J.modelId===M.entityId);if(!I||!I.attributes.length)return!1;const D=I.attributes.findIndex(J=>J.modelId===M.anchor);if(D<0)return!1;const B=Math.min(Math.max(D+w,0),I.attributes.length-1);if(B===D)return!0;const de=I.attributes[B].modelId;return U.value={kind:"attribute",entityId:M.entityId,ids:[de],anchor:de},!0},nudgeSelectedAttributes(w){const M=U.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const I=o.logical.entities.find($=>$.modelId===M.entityId);if(!I)return!1;const D=I.attributes,B=new Set(M.ids),de=D.map(($,Z)=>B.has($.modelId)?Z:-1).filter($=>$>=0);if(!de.length)return!1;const J=Math.min(...de),X=D.filter($=>!B.has($.modelId)),te=D.slice(0,J).filter($=>!B.has($.modelId)).length;let re;if(w<0){if(te<=0)return!0;re=te-1}else{if(X.length-te<=0)return!0;re=te+1}if(me(M.entityId))return!0;const Ne=D.filter($=>B.has($.modelId)).map($=>$.modelId);return Q(pr(M.entityId,Ne,re)),!0},deleteSelection(){if(!S.value)return!1;const w=U.value;if(!w)return!1;if(w.kind==="attribute"){if(me(w.entityId))return!1;const M=w.ids;if(!M.length)return!1;M.length===1?Ye.removeAttribute(w.entityId,M[0]):Ye.removeAttributes(w.entityId,M)}else if(w.kind==="entity"){if(me(w.id))return!1;Ye.removeEntity(w.id)}else if(w.kind==="note")Ye.removeNote(w.id);else if(w.kind==="group"){if(ve(w.id))return!1;Ye.removeGroup(w.id)}else Ye.removeAssociation(w.id);return U.value=null,!0},nudgeNodes(w,M,I){if(!w.length||M===0&&I===0)return!1;const D=new Set(o.logical.entities.map(re=>re.modelId)),B=new Set(o.logical.groups.map(re=>re.modelId)),de=new Set(o.layout.notes.map(re=>re.modelId)),J=new Set;for(const re of w){if(!B.has(re))continue;const Ne=o.logical.groups.find($=>$.modelId===re);for(const $ of(Ne==null?void 0:Ne.memberEntityRefs)??[])J.add($)}const X=[],te=[];for(const re of w)if(B.has(re)){if(ve(re))continue;const Ne=o.layout.groupLayouts.find(Ie=>Ie.groupRef===re);if(!Ne)continue;const $=o.logical.groups.find(Ie=>Ie.modelId===re),Z=(($==null?void 0:$.memberEntityRefs)??[]).map(Ie=>{var ze;const ye=((ze=o.layout.entityLayouts.find(z=>z.entityRef===Ie))==null?void 0:ze.geo.location)??{x:0,y:0};return{id:Ie,location:{x:ye.x+M,y:ye.y+I}}}),F={x:Ne.geo.location.x+M,y:Ne.geo.location.y+I};X.push(Je("그룹 이동",Ue(re,F,Z))),te.push("g:"+re)}else if(D.has(re)){if(J.has(re)||me(re))continue;const Ne=o.layout.entityLayouts.find($=>$.entityRef===re);if(!Ne)continue;X.push(Yn(re,{x:Ne.geo.location.x+M,y:Ne.geo.location.y+I})),te.push("e:"+re)}else if(de.has(re)){const Ne=o.layout.notes.find($=>$.modelId===re);if(!Ne)continue;X.push(Co(re,{x:Ne.geo.location.x+M,y:Ne.geo.location.y+I})),te.push("n:"+re)}return X.length?(Q(Je("이동",X,"nudge:"+te.sort().join(","))),!0):!1},requestFocus(w){se.value={id:w,nonce:++pe}},undo:()=>{S.value&&i.undo()},redo:()=>{S.value&&i.redo()},markSaved:()=>{S.value&&(fe==null||fe.flush(),i.markSavePoint())},loadDiagram(w,M){we(),o.logical=w.logical,o.layout=w.layout,i=new mr(o),Ae(),G.value=(M==null?void 0:M.schemaVersion)??1,K.value=(M==null?void 0:M.opWriteEnabled)??!1,S.value=!(G.value>=2&&K.value===!1),Te=M,xe.value=null,U.value=null,_.value=i.canUndo,b.value=i.canRedo,N.value=i.isDirty,j()},flush(){fe==null||fe.flush()},whenOpsSettled(){return(fe==null?void 0:fe.whenSettled())??Promise.resolve()},addEntity(w="NewEntity",M={x:80,y:80}){const I=De(),D={modelId:I,name:w,stereotype:"JPA_ENTITY",table:{physicalName:w.toLowerCase()},attributes:[{modelId:De(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:De(),physicalName:"id",dataType:"BIGINT"}]}]};return Q(Ei(D,{location:{...M},size:{width:220,height:140}})),I},renameEntity(w,M){me(w)||Q(Ss(w,M))},updateEntity(w,M){if(me(w))return;const I=Cs(w,M),D=o.logical.entities.find(J=>J.modelId===w),B=M.stereotype==="JPA_EMBEDDABLE"&&!!D&&D.stereotype!=="JPA_EMBEDDABLE",de=!!M.stereotype&&M.stereotype!=="JPA_EMBEDDABLE"&&!!D&&D.stereotype==="JPA_EMBEDDABLE";if(B&&D){const J=D.attributes.filter($=>$.identifier&&!$.derivedFrom).map($=>gn(w,$.modelId,{identifier:!1})),X=ro({...o.logical,entities:o.logical.entities.map($=>$.modelId===w?{...$,stereotype:"JPA_EMBEDDABLE"}:$)},w,$=>$.map(Z=>Z.identifier&&!Z.derivedFrom?{...Z,identifier:!1}:Z)),te=al(X,w),re=QN(o.logical,w),Ne=[I,...J,...te,...re];Q(Ne.length>1?Je("임베더블 변환",Ne):I);return}if(de){const J=ZN(o.logical,w),X=[I,...J];Q(X.length>1?Je("엔터티 전환",X):I);return}Q(I)},moveEntity(w,M){me(w)||Q(Yn(w,M))},resizeEntity(w,M){me(w)||Q($s(w,M))},removeEntity(w){me(w)||Q(Is(w))},setEntitySwatch(w,M){Q(Rs(w,M))},setEntityCollapsed(w,M){Q(As(w,M))},setEntityLocked(w,M){Q(Ts(w,M))},isEntityLocked(w){return me(w)},collapseAll(){Q(fr(!0))},expandAll(){Q(fr(!1))},setAttributeSwatch(w,M,I){Q(Ni(w,M,I))},dragGroup(w,M,I){ve(w)||Q(Je("그룹 이동",Ue(w,M,I)))},resizeGroup(w,M){ve(w)||Q(Os(w,M))},setGroupSwatch(w,M){Q(Ls(w,M))},setGroupLocked(w,M){Q(Ps(w,M))},isGroupLocked(w){return ve(w)},updateGroup(w,M){ve(w)||Q(Vs(w,M))},createGroup(w,M){if(!w.length)return null;const I=[];for(const de of o.logical.groups)for(const J of w)de.memberEntityRefs.includes(J)&&I.push(vi(de.modelId,J));const D=De(),B={modelId:D,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...w]};return I.push(wi(B,Me(w))),Q(Je("그룹 생성",I)),U.value=null,D},addEmptyGroup(w,M){const I=De();return Q(wi({modelId:I,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...w},size:{width:360,height:260}})),I},removeGroup(w){ve(w)||Q(Ms(w))},dropEntity(w,M,I){var de;if(me(w))return;const D=((de=o.logical.groups.find(J=>J.memberEntityRefs.includes(w)))==null?void 0:de.modelId)??null,B=[Yn(w,M)];D!==I&&(D&&B.push(vi(D,w)),I&&B.push(Bs(I,w))),Q(Je("이동",B))},ungroupEntity(w){const M=o.logical.groups.find(I=>I.memberEntityRefs.includes(w));M&&Q(vi(M.modelId,w))},dropNote(w,M,I){var de;const D=((de=o.layout.groupLayouts.find(J=>{var X;return(X=J.memberNoteRefs)==null?void 0:X.includes(w)}))==null?void 0:de.groupRef)??null,B=[Co(w,M)];D!==I&&(D&&B.push(rc(D,w)),I&&B.push(ac(I,w))),Q(Je("이동",B))},addPredefinedEmbed(w,M){if(me(w))return;const I=a.value.find(te=>te.type===M),D=o.logical.entities.find(te=>te.modelId===w);if(!I||!D)return;const B=D.attributes.reduce((te,re)=>Math.max(te,re.order),-1)+1,de=De(),J=I.fields.map(()=>({modelId:De(),physicalName:"",dataType:""})),X={modelId:de,name:I.defaultName,type:I.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:B,dbAttrs:J};return Q(Ut(w,X)),de},addAttribute(w,M={}){if(me(w))return M.modelId??"";const I=o.logical.entities.find(Ne=>Ne.modelId===w),D=I?I.attributes.length:0,B=M.modelId??De(),de=M.name??`field${D}`,J={modelId:B,name:de,type:M.type??Xa,attrType:M.attrType??"NORMAL",identifier:M.identifier??!1,notNull:M.notNull??!1,order:D,dbAttrs:M.dbAttrs??[{modelId:De(),physicalName:de,dataType:"VARCHAR",length:255}],...M},X=Ut(w,J),te=ro(o.logical,w,Ne=>[...Ne,J]),re=lo(te,w);return Q(re.length?Je("속성 추가",[X,...re]):X),B},addDivider(w){if(me(w))return"";const M=o.logical.entities.find(de=>de.modelId===w),I=M?M.attributes.length:0,D=De();return Q(Ut(w,{modelId:D,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:I,dbAttrs:[]})),D},updateAttribute(w,M,I){$e(w,M,I)},setAttributeGroupCode(w,M,I){$e(w,M,{groupCode:I,type:I?Ln:Xa})},setEmbedColumns(w,M,I){var te,re;if(me(w))return;const D=gn(w,M,{dbAttrs:I}),B=(te=o.logical.entities.find(Ne=>Ne.modelId===w))==null?void 0:te.attributes.find(Ne=>Ne.modelId===M),de=(re=B==null?void 0:B.embedded)==null?void 0:re.associationRef,J=de?o.logical.associations.find(Ne=>Ne.modelId===de):void 0,X=[];J&&de&&(J.end1.legacyEmbedRaw&&X.push(Qt(de,"end1",{legacyEmbedRaw:void 0})),J.end2.legacyEmbedRaw&&X.push(Qt(de,"end2",{legacyEmbedRaw:void 0}))),Q(X.length?Je("임베드 컬럼 수정",[D,...X]):D)},removeAttribute(w,M){if(me(w))return;if(Ri(o.logical,w,M)){A(Hu);return}const I=Wn(w,M),D=ro(o.logical,w,de=>de.filter(J=>J.modelId!==M)),B=lo(D,w);Q(B.length?Je("속성 삭제",[I,...B]):I)},removeAttributes(w,M){var X;if(!M.length||me(w))return;const I=M.filter(te=>!Ri(o.logical,w,te));if(I.length<M.length&&A(Hu),!I.length)return;const D=I.map(te=>Wn(w,te)),B=new Set(I),de=ro(o.logical,w,te=>te.filter(re=>!B.has(re.modelId))),J=[...D,...lo(de,w)];Q(J.length===1?J[0]:Je("속성 삭제",J)),((X=U.value)==null?void 0:X.kind)==="attribute"&&U.value.entityId===w&&(U.value=null)},setAttributeSwatches(w,M,I){M.length&&(M.length===1?Q(Ni(w,M[0],I)):Q(Je("속성 색상",M.map(D=>Ni(w,D,I)))))},reorderAttributes(w,M,I){!M.length||me(w)||Q(pr(w,M,I))},addIndex(w,M){me(w)||Q(Ks(w,M))},updateIndex(w,M,I){me(w)||Q(Ys(w,M,I))},removeIndex(w,M){me(w)||Q(Ws(w,M))},addOperation(w,M={}){var J;if(me(w))return M.modelId??"";const I=o.logical.entities.find(X=>X.modelId===w),D=((J=I==null?void 0:I.operations)==null?void 0:J.length)??0,B=M.modelId??De(),de={modelId:B,name:M.name??`method${D}`,visibility:M.visibility??"PACKAGE",order:D,...M};return Q(zs(w,de)),B},updateOperation(w,M,I){me(w)||Q(Us(w,M,I))},removeOperation(w,M){me(w)||Q(Fs(w,M))},reorderOperations(w,M,I){!M.length||me(w)||Q(Hs(w,M,I))},setOperationSwatch(w,M,I){Q(Gs(w,M,I))},addAssociation(w,M,I,D){if(me(w)||me(M))return"";const B=De(),de={modelId:B,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:I},end2:{entityRef:M,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},J={...o.logical,associations:[...o.logical.associations,de]},X=So(J,M,De),te=X.add[0];te&&(de.end2.attributeRef=te.modelId);const re={associationRef:B,waypoints:[],sourceColumnRef:I,targetColumnRef:(te==null?void 0:te.modelId)??D},Ne=xi(de,re),$=ha(M,X);return Q($.length?Je("관계 추가",[Ne,...$]):Ne),B},addEmbedAssociation(w,M){if(me(w))return;const I=o.logical.entities.find(ze=>ze.modelId===w),D=o.logical.entities.find(ze=>ze.modelId===M);if(!I||!D||D.stereotype!=="JPA_EMBEDDABLE")return;const B=De(),de=De(),J=De(),X=I.attributes.reduce((ze,z)=>Math.max(ze,z.order),-1)+1,te=Ku(D),re=ze=>ze&&ze.charAt(0).toLowerCase()+ze.slice(1),Ne=new Set(I.attributes.map(ze=>ze.name)),$=re(D.name);let Z=$;for(let ze=2;Ne.has(Z);ze++)Z=`${$}${ze}`;const F={modelId:de,name:Z,type:D.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:X,dbAttrs:te,embedded:{associationRef:B,embeddableRef:M}},Ie={modelId:B,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:J},end2:{entityRef:M,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:de}},ye={associationRef:B,waypoints:[],sourceColumnRef:de,targetColumnRef:void 0};return Q(Je("임베드 추가",[Ut(w,F),xi(Ie,ye)])),B},setEmbedCardinality(w,M){var $;if(Ee(w))return;const I=o.logical.associations.find(Z=>Z.modelId===w);if(!I)return;let D,B;for(const Z of o.logical.entities){const F=Z.attributes.find(Ie=>{var ye;return((ye=Ie.embedded)==null?void 0:ye.associationRef)===w&&Ie.attrType==="EMBED_OWN"});if(F){D=Z.modelId,B=F;break}}if(!D||!B)return;const de=B.embedded.embeddableRef,J=I.end2.entityRef===de?"end2":"end1",X=I[J];if(X.multiplicity===M)return;const te=Z=>Z==="ZERO_OR_MORE_INSTANCES"||Z==="ONE_OR_MORE_INSTANCES",re=te(X.multiplicity),Ne=te(M);if(re===Ne){Q(Qt(w,J,{multiplicity:M}));return}if(Ne)Q(Je("임베드 컬렉션 전환",[gn(D,B.modelId,{dbAttrs:[]}),Qt(w,J,{multiplicity:M,jpa:{...X.jpa,collectionType:(($=X.jpa)==null?void 0:$.collectionType)??"LIST"}})]));else{const Z=o.logical.entities.find(F=>F.modelId===de);if(!Z)return;Q(Je("임베드 단일 전환",[gn(D,B.modelId,{dbAttrs:Ku(Z)}),Qt(w,J,{multiplicity:M,jpa:{...X.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(w){if(Ee(w))return;const M=o.logical.associations.find(J=>J.modelId===w),I=js(w);if(!M){Q(I);return}for(const J of o.logical.entities){const X=J.attributes.find(te=>{var re;return((re=te.embedded)==null?void 0:re.associationRef)===w});if(X){Q(Je("임베드 삭제",[I,Wn(J.modelId,X.modelId)]));return}}const D=M.end2.entityRef,B={...o.logical,associations:o.logical.associations.filter(J=>J.modelId!==w)},de=al(B,D);Q(de.length?Je("관계 삭제",[I,...de]):I)},setAssociationIdentifying(w,M){if(Ee(w))return;const I=o.logical.associations.find(X=>X.modelId===w),D=Ii(w,{identifying:M});if(!I||I.identifying===M){Q(D);return}const B=I.end2.entityRef,de={...o.logical,associations:o.logical.associations.map(X=>X.modelId===w?{...X,identifying:M}:X)},J=al(de,B);Q(J.length?Je("식별 관계 변경",[D,...J]):D)},updateAssociationEnd(w,M,I){Ee(w)||Q(Qt(w,M,I))},hasQuickFix(w){return S.value?ir(w,o.logical)!=null:!1},applyQuickFix(w){if(!S.value)return!1;const M=ir(w,o.logical);if(!M||Ee(M.assocRef))return!1;const I=o.logical.associations.find(D=>D.modelId===M.assocRef);return I?(Q(Qt(M.assocRef,M.which,{jpa:{...I[M.which].jpa,cascadeTypes:M.cascades}})),!0):!1},moveWaypoint(w,M,I){Q(qs(w,M,I))},addWaypoint(w,M,I){Q(Qs(w,M,I))},removeWaypoint(w,M){Q(Xs(w,M))},clearWaypoints(w){Q(Zs(w))},addNote(w="메모",M={x:80,y:80}){const I=De();return Q(ec({modelId:I,memo:w,geo:{location:{...M},size:{width:200,height:120}}})),I},removeNote(w){Q(tc(w))},moveNote(w,M){Q(Co(w,M))},resizeNote(w,M){Q(nc(w,M))},setNoteMemo(w,M){Q(oc(w,M))},setNoteSwatch(w,M){Q(ic(w,M))},addNoteConnection(w,M){Q(lc(w,M))},removeNoteConnection(w,M){Q(sc(w,M))},moveNoteConnectionWaypoint(w,M,I,D){Q(cc(w,M,I,D))},addNoteConnectionWaypoint(w,M,I,D){Q(dc(w,M,I,D))},removeNoteConnectionWaypoint(w,M,I){Q(uc(w,M,I))},clearNoteConnectionWaypoints(w,M){Q(mc(w,M))},autoLayout(){const w=Dl(o.logical,o.layout);w.length&&Q(Je("자동 배치",w.map(M=>Yn(M.id,M.location))))},copy(w){if(w&&w.length){const X=w.filter(te=>o.logical.entities.some(re=>re.modelId===te));if(X.length){be.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:o.logical,layout:o.layout},selectedIds:X}));return}}const M=U.value;if((M==null?void 0:M.kind)==="attribute"){const X=o.logical.entities.find(re=>re.modelId===M.entityId);if(!X)return;const te=[...X.attributes].sort((re,Ne)=>re.order-Ne.order).filter(re=>M.ids.includes(re.modelId));if(!te.length)return;be.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:te}));return}const I=ge.value;if(!I)return;const D=o.logical.entities.find(X=>X.modelId===I),B=o.layout.entityLayouts.find(X=>X.entityRef===I);if(!D)return;const de=(B==null?void 0:B.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let J;if(B){const{entityRef:X,geo:te,locked:re,...Ne}=B;Object.keys(Ne).length&&(J=Ne)}be.value=JSON.parse(JSON.stringify({kind:"entity",entity:D,geo:de,layoutExtras:J}))},paste(){if(!S.value)return[];const w=be.value;if(!w)return[];if(w.kind==="entities")return Ye.importEntities(w.source,w.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(w.kind==="attribute"){const de=ge.value;if(!de)return[];const J=o.logical.entities.find(Z=>Z.modelId===de);if(!J)return[];const X=new Set(J.attributes.map(Z=>Z.name)),te=new Set(J.attributes.flatMap(Z=>Z.dbAttrs.map(F=>F.physicalName))),re=J.attributes.length,Ne=[],$=w.attributes.map((Z,F)=>{const Ie=JSON.parse(JSON.stringify(Z));Ie.modelId=De();for(const ye of Ie.dbAttrs)ye.modelId=De();X.has(Ie.name)&&(Ie.name=`${Ie.name}_copy`);for(const ye of Ie.dbAttrs)ye.physicalName&&te.has(ye.physicalName)&&(ye.physicalName=`${ye.physicalName}_copy`);return Ie.order=re+F,Ne.push(Ie.modelId),Ut(de,Ie)});return Q($.length===1?$[0]:Je("속성 붙여넣기",$)),U.value={kind:"attribute",entityId:de,ids:Ne,anchor:Ne[Ne.length-1]},[]}const{clone:M,idMap:I}=qN(w.entity),D={location:{x:w.geo.location.x+40,y:w.geo.location.y+40},size:{...w.geo.size}};let B;if(w.layoutExtras){const de={...w.layoutExtras},J=X=>I.get(X);de.attributeStyles&&(de.attributeStyles=bi(de.attributeStyles,J)),de.operationStyles&&(de.operationStyles=bi(de.operationStyles,J)),B=de}return Q(Ei(M,D,B)),U.value={kind:"entity",id:M.modelId},[M.modelId]},importEntities(w,M,I){if(!S.value)return[];const D=_s(w,M,{existing:o.logical,includeRelated:I==null?void 0:I.includeRelated,collisionSuffix:I==null?void 0:I.collisionSuffix});if(D.logical.entities.length===0)return[];const B=(I==null?void 0:I.placement)??"append-right",de=B==="append-right"?JN(o.layout,D.layout):B.offset,J=new Map(D.layout.entityLayouts.map($=>[$.entityRef,$])),X=new Map(D.layout.associationLayouts.map($=>[$.associationRef,$])),te=new Map(D.layout.groupLayouts.map($=>[$.groupRef,$])),re=[];let Ne=80;for(const $ of D.logical.entities){const Z=J.get($.modelId),F=Z?{location:il(Z.geo.location,de),size:{...Z.geo.size}}:{location:{x:Ne+=40,y:80},size:{width:220,height:140}};let Ie;if(Z){const{entityRef:ye,geo:ze,locked:z,...q}=Z;Ie=q}re.push(Ei($,F,Ie))}for(const $ of D.logical.associations){const Z=X.get($.modelId),F=Z?{...Z,waypoints:Z.waypoints.map(Ie=>il(Ie,de))}:{associationRef:$.modelId,waypoints:[]};re.push(xi($,F))}for(const $ of D.logical.groups){const Z=te.get($.modelId),F=Z?{location:il(Z.geo.location,de),size:{...Z.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let Ie;if(Z){const{groupRef:ye,geo:ze,locked:z,memberNoteRefs:q,...ue}=Z;Ie=ue}re.push(wi($,F,Ie))}return Q(Je("다이어그램 가져오기",re)),U.value={kind:"entity",id:D.logical.entities[0].modelId},D.logical.entities.map($=>$.modelId)}};return Ye}const ya=Symbol("groupHover"),Yu=Symbol("groupDrag"),so=Symbol("relationHighlight"),tw={key:0,class:"em-sel","aria-hidden":"true"},nw=["title","aria-expanded","disabled"],ow={class:"em-entity__stereotype"},iw={key:1,class:"em-entity__name"},aw=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],rw=["onPointerdown"],lw={key:1,class:"em-entity__divider-label"},sw=["title"],cw={class:"em-key-slot"},dw={class:"em-key-slot"},uw={key:0,class:"em-entity__type"},mw=["onClick"],fw={class:"em-entity__attrname"},pw={class:"em-entity__type"},hw=["data-op"],yw=["onPointerdown"],gw={class:"em-entity__op-vis","aria-hidden":"true"},bw=["title"],_w={key:4,class:"em-entity__footer"},Wu=Ge(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(An,null),i=(J,X)=>o?o.t(J,X):Ct("ko",J,X),a=n.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=oe.useModal();function l(){o&&pa(r,o,t.id)}const s=n.inject(ya,null),c=n.inject(so,null),d=n.computed(()=>!!o&&o.editable.value);function u(){s&&(s.value=t.data.groupRef??null)}function m(){c==null||c.setEntityHover(t.id)}function f(){c==null||c.setEntityHover(null)}const p=n.computed(()=>!!c&&c.primaryEntityIds.value.has(t.id)),y=n.computed(()=>!!c&&c.relatedEntityIds.value.has(t.id)&&!p.value),g=n.computed(()=>{var J;return((J=o==null?void 0:o.selection.value)==null?void 0:J.kind)==="entity"&&o.selection.value.id===t.id}),_=n.computed(()=>!!t.selected&&!g.value),b=n.computed(()=>{var J;return o&&((J=o.selectedAttr.value)==null?void 0:J.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),N=n.computed(()=>b.value.size>0);function h(J,X){const te=X.shiftKey?"range":X.metaKey||X.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,J.modelId,te)}const k=n.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(t.id)&&!g.value),P=n.computed(()=>t.data.entity),A=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),G=n.computed(()=>t.data.collapsed??!1),K=n.computed(()=>t.data.locked??!1);function v(){d.value&&(o==null||o.setEntityCollapsed(t.id,!G.value))}const T=n.computed(()=>A.value==="PHYSICAL"||A.value==="LOGICAL_PHYSICAL"),H=n.computed(()=>{const J=A.value==="PHYSICAL"||A.value==="LOGICAL_PHYSICAL",X={};for(const te of P.value.attributes){const re=te.attrType.startsWith("RELATION")&&te.dbAttrs.length>0;X[te.modelId]={pk:te.identifier,fk:re&&J,required:te.notNull&&!te.identifier}}return X});function C(J){if(!J)return"";const X=[];return J.pk&&J.fk?X.push(i("em.node.keyPfk")):J.pk?X.push(i("em.node.keyPk")):J.fk&&X.push(i("em.node.keyFk")),J.required&&X.push(i("em.node.required")),X.join(" · ")}const ae=n.computed(()=>{const J=tl(ut(t.data.style)),X={};return J&&(X["--em-header-bg"]=J.bar,X["--em-header-fg"]=J.barOn),X});function E(J){var X,te;return(te=tl(ut((X=t.data.attributeStyles)==null?void 0:X[J.modelId])))==null?void 0:te.text}const Y=n.computed(()=>[...P.value.operations??[]].sort((J,X)=>J.order-X.order)),S=n.computed(()=>A.value==="CLASS"&&Y.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ee(J){return J?W[J]:"~"}function ie(J){var X,te;return(te=tl(ut((X=t.data.operationStyles)==null?void 0:X[J.modelId])))==null?void 0:te.text}function O(J,X,te){switch(A.value){case"CLASS":return[{text:J}];case"PHYSICAL":return[{text:te||J}];case"LOGICAL":return[X?{text:X}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=X?{text:X}:{text:i("em.node.logicalMissing"),missing:!0};return te?[re,{text:` · ${te}`}]:[re]}}}function U(J){var X,te,re;return ne(J)?[{text:J.name}]:O(J.name,(te=(X=J.dbAttrs[0])==null?void 0:X.logicalName)==null?void 0:te[a.value],((re=J.dbAttrs[0])==null?void 0:re.physicalName)??"")}function ne(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}function ce(J){return J.attrType==="DIVIDER"}function ge(J){if(J.attrType!=="EMBED_PREDEF")return J.dbAttrs;const X=o==null?void 0:o.embeddableCatalog.value.find(re=>re.type===J.type);if(!X)return J.dbAttrs;const te=mn(un(P.value,(o==null?void 0:o.state.logical.entities)??[]));return J.dbAttrs.map((re,Ne)=>{const $=X.fields[Ne],Z=zn(re,te);return Z?{...re,physicalName:Z.physicalName,logicalName:re.logicalName??($==null?void 0:$.logicalName),dataType:re.dataType||($==null?void 0:$.dataType)||""}:$?{...re,physicalName:re.physicalName||$.physicalName,logicalName:re.logicalName??$.logicalName,dataType:re.dataType||$.dataType,length:re.length??$.length}:re})}function se(J){var X;return O(J.physicalName,(X=J.logicalName)==null?void 0:X[a.value],J.physicalName)}function pe(J){const X=Ja(J,(o==null?void 0:o.state.logical.associations)??[]);return Za(A.value,J,X)}const be=n.computed(()=>{var J,X,te;return O(P.value.name,(X=(J=P.value.table)==null?void 0:J.logicalName)==null?void 0:X[a.value],((te=P.value.table)==null?void 0:te.physicalName)??"")}),xe=n.ref(!1),Te=n.ref(""),Ae=n.ref(null);async function fe(){var J,X;d.value&&(Te.value=P.value.name,xe.value=!0,await n.nextTick(),(J=Ae.value)==null||J.focus(),(X=Ae.value)==null||X.select())}function ke(){if(!xe.value)return;xe.value=!1;const J=Te.value.trim();J&&J!==P.value.name&&(o==null||o.renameEntity(t.id,J))}function we(){o==null||o.addAttribute(t.id)}function j(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:L,findNode:x}=He(),R=n.ref(null),V=n.computed(()=>{const J=R.value??t.data.size;return J?{width:`${J.width}px`,minHeight:`${J.height}px`}:void 0});let Q=null;function me(J){var re,Ne,$;if(!d.value)return;J.stopPropagation();const X=(re=x(t.id))==null?void 0:re.dimensions,te=L({x:J.clientX,y:J.clientY});Q={fx:te.x,fy:te.y,w:(X==null?void 0:X.width)??((Ne=t.data.size)==null?void 0:Ne.width)??200,h:(X==null?void 0:X.height)??(($=t.data.size)==null?void 0:$.height)??120},J.target.setPointerCapture(J.pointerId)}function ve(J){if(!Q)return;const X=L({x:J.clientX,y:J.clientY});R.value={width:Math.max(40,Q.w+(X.x-Q.fx)),height:Math.max(40,Q.h+(X.y-Q.fy))}}function Ee(J){var X,te,re;if(Q&&R.value&&o){const Ne=(X=x(t.id))==null?void 0:X.dimensions;o.resizeEntity(t.id,{width:Math.round((Ne==null?void 0:Ne.width)??R.value.width),height:Math.round((Ne==null?void 0:Ne.height)??R.value.height)})}Q=null,R.value=null,(re=(te=J.target).releasePointerCapture)==null||re.call(te,J.pointerId)}const $e=n.ref(null),Me=n.ref(null);function Ue(J,X){if(!d.value)return;X.stopPropagation(),X.preventDefault();const te=b.value,re=te.has(J.modelId)?new Set(te):new Set([J.modelId]);Me.value={ids:re,dropIndex:-1,lineY:0},X.target.setPointerCapture(X.pointerId)}function Ye(J){if(!Me.value||!$e.value)return;const X=Array.from($e.value.querySelectorAll(".em-entity__row"));if(!X.length)return;let te=X.length;for(let $=0;$<X.length;$++){const Z=X[$].getBoundingClientRect();if(J.clientY<Z.top+Z.height/2){te=$;break}}const re=X[X.length-1],Ne=te<X.length?X[te].offsetTop:re.offsetTop+re.offsetHeight;Me.value={...Me.value,dropIndex:te,lineY:Ne}}function Fe(){const J=Me.value;if(Me.value=null,!J||J.dropIndex<0)return;const X=P.value.attributes,te=X.filter(F=>J.ids.has(F.modelId)).map(F=>F.modelId),re=X.filter((F,Ie)=>J.ids.has(F.modelId)&&Ie<J.dropIndex).length,Ne=J.dropIndex-re,$=X.filter(F=>!J.ids.has(F.modelId)).map(F=>F.modelId);[...$.slice(0,Ne),...te,...$.slice(Ne)].join(",")!==X.map(F=>F.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,te,Ne))}function gt(){Me.value=null}const w=n.ref(null),M=n.ref(null);function I(J,X){d.value&&(X.stopPropagation(),X.preventDefault(),M.value={id:J.modelId,dropIndex:-1,lineY:0},X.target.setPointerCapture(X.pointerId))}function D(J){if(!M.value||!w.value)return;const X=Array.from(w.value.querySelectorAll(".em-entity__op-row"));if(!X.length)return;let te=X.length;for(let $=0;$<X.length;$++){const Z=X[$].getBoundingClientRect();if(J.clientY<Z.top+Z.height/2){te=$;break}}const re=X[X.length-1],Ne=te<X.length?X[te].offsetTop:re.offsetTop+re.offsetHeight;M.value={...M.value,dropIndex:te,lineY:Ne}}function B(){const J=M.value;if(M.value=null,!J||J.dropIndex<0)return;const te=Y.value.findIndex(Ne=>Ne.modelId===J.id);if(te<0)return;const re=J.dropIndex-(te<J.dropIndex?1:0);re!==te&&(o==null||o.reorderOperations(t.id,[J.id],re))}function de(){M.value=null}return(J,X)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":p.value,"is-related":y.value,"is-dimmed":k.value,"is-selected":g.value,"is-multi-selected":_.value,"has-focused-attr":N.value,"is-locked":K.value}]),style:n.normalizeStyle(V.value),onPointerdown:u,onMouseenter:m,onMouseleave:f,onDblclick:l},[g.value?(n.openBlock(),n.createElementBlock("div",tw,[...X[7]||(X[7]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("header",{class:"em-entity__header",style:n.normalizeStyle(ae.value),onDblclick:n.withModifiers(fe,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:i(G.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!G.value,disabled:!d.value,onClick:n.withModifiers(v,["stop"]),onPointerdown:X[0]||(X[0]=n.withModifiers(()=>{},["stop"])),onDblclick:X[1]||(X[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(G.value?"▸":"▾"),41,nw),n.createElementVNode("span",ow,"«"+n.toDisplayString(P.value.stereotype)+"»",1),xe.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ae,"onUpdate:modelValue":X[2]||(X[2]=te=>Te.value=te),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(ke,["enter"]),X[3]||(X[3]=n.withKeys(te=>xe.value=!1,["esc"]))],onBlur:ke,onPointerdown:X[4]||(X[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,Te.value]]):(n.openBlock(),n.createElementBlock("span",iw,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(te,re)=>(n.openBlock(),n.createElementBlock("span",{key:re,class:n.normalizeClass({"em-entity__missing":te.missing})},n.toDisplayString(te.text),3))),128))])),K.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):n.createCommentVNode("",!0)],36),G.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$e,class:"em-entity__attrs"},[Me.value&&Me.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${Me.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.value.attributes,te=>{var re,Ne,$,Z;return n.openBlock(),n.createElementBlock(n.Fragment,{key:te.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(te.modelId),"is-dragging":(re=Me.value)==null?void 0:re.ids.has(te.modelId),"is-embed":ne(te),"is-divider":ce(te),nodrag:ce(te)&&d.value}]),"data-attr":te.modelId,onClick:n.withModifiers(F=>h(te,F),["stop"]),onPointerdown:F=>ce(te)?Ue(te,F):void 0,onPointermove:F=>ce(te)?Ye(F):void 0,onPointerup:F=>ce(te)?Fe():void 0,onPointercancel:F=>ce(te)?gt():void 0},[d.value&&!ce(te)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:F=>Ue(te,F),onPointermove:Ye,onPointerup:Fe,onPointercancel:gt,onClick:X[5]||(X[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,rw)):n.createCommentVNode("",!0),ce(te)?(n.openBlock(),n.createElementBlock("span",lw,n.toDisplayString(te.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(In),{id:`l:${te.modelId}`,type:"target",position:n.unref(Re).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:C(H.value[te.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",cw,[(Ne=H.value[te.modelId])!=null&&Ne.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):($=H.value[te.modelId])!=null&&$.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",dw,[ne(te)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(Z=H.value[te.modelId])!=null&&Z.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,sw),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:E(te)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(U(te),(F,Ie)=>(n.openBlock(),n.createElementBlock("span",{key:Ie,class:n.normalizeClass({"em-entity__missing":F.missing})},n.toDisplayString(F.text),3))),128))],4),pe(te)?(n.openBlock(),n.createElementBlock("span",uw,n.toDisplayString(pe(te)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(In),{id:`r:${te.modelId}`,type:"source",position:n.unref(Re).Right,class:"em-handle"},null,8,["id","position"])],64))],42,aw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne(te)&&T.value?ge(te):[],F=>(n.openBlock(),n.createElementBlock("li",{key:`${te.modelId}:${F.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(te.modelId)}]),onClick:n.withModifiers(Ie=>h(te,Ie),["stop"])},[X[8]||(X[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",fw,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se(F),(Ie,ye)=>(n.openBlock(),n.createElementBlock("span",{key:ye,class:n.normalizeClass({"em-entity__missing":Ie.missing})},n.toDisplayString(Ie.text),3))),128))]),n.createElementVNode("span",pw,n.toDisplayString(F.dataType),1)],10,mw))),128))],64)}),128))],512)),!G.value&&S.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:w,class:"em-entity__ops"},[M.value&&M.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${M.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Y.value,te=>{var re;return n.openBlock(),n.createElementBlock("li",{key:te.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((re=M.value)==null?void 0:re.id)===te.modelId}]),"data-op":te.modelId},[d.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ne=>I(te,Ne),onPointermove:D,onPointerup:B,onPointercancel:de,onClick:X[6]||(X[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,yw)):n.createCommentVNode("",!0),n.createElementVNode("span",gw,n.toDisplayString(ee(te.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:ie(te)})},n.toDisplayString(te.name)+"()",5)],10,hw)}),128))],512)):Y.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:Y.value.length})},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,n.toDisplayString(i("em.node.opsSummary",{n:Y.value.length})),1)],8,bw)):n.createCommentVNode("",!0),d.value?(n.openBlock(),n.createElementBlock("footer",_w,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:we},n.toDisplayString(i("em.node.addAttr")),1),X[9]||(X[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:j},n.toDisplayString(i("em.node.addDivider")),1)])):n.createCommentVNode("",!0),d.value&&!xe.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:me,onPointermove:ve,onPointerup:Ee},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3ffbbf24"]]),kw={key:0,class:"em-sel","aria-hidden":"true"},Ew={class:"em-group__label"},Nw={class:"em-group__name"},ww={key:0,class:"em-group__pkg"},vw={key:1,class:"em-group__flag"},qu=Ge(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>t.data.locked??!1),a=n.computed(()=>ut(t.data.style)),r=n.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=n.inject(An,null),s=(T,H)=>l?l.t(T,H):Ct("ko",T,H),c=n.computed(()=>!!l&&l.editable.value),d=n.computed(()=>{var T;return!!t.id&&((T=l==null?void 0:l.selection.value)==null?void 0:T.kind)==="group"&&l.selection.value.id===t.id}),u=n.computed(()=>!!t.selected&&!d.value),m=n.inject(ya,null),f=n.computed(()=>!!t.id&&(m==null?void 0:m.value)===t.id),p=n.inject(so,null);function y(){t.id&&(p==null||p.setGroupHover(t.id))}function g(){p==null||p.setGroupHover(null)}const _=n.computed(()=>!!p&&p.hoverGroupId.value===t.id),b=n.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==t.id),{screenToFlowCoordinate:N,findNode:h}=He();let k=null,P=null;function A(T){var ae;if(!t.id||!c.value)return;T.stopPropagation();const H=((ae=h(t.id))==null?void 0:ae.dimensions)??{width:400,height:300},C=N({x:T.clientX,y:T.clientY});k={fx:C.x,fy:C.y,w:H.width,h:H.height},T.target.setPointerCapture(T.pointerId)}function G(T){if(!k||!t.id)return;const H=N({x:T.clientX,y:T.clientY});P={width:Math.max(160,k.w+(H.x-k.fx)),height:Math.max(120,k.h+(H.y-k.fy))};const C=h(t.id);C&&(C.style={width:`${P.width}px`,height:`${P.height}px`})}function K(T){var H,C;k&&P&&t.id&&l&&l.resizeGroup(t.id,P),k=null,P=null,(C=(H=T.target).releasePointerCapture)==null||C.call(H,T.pointerId)}const v=n.computed(()=>{const T=o.value.name;return(T==null?void 0:T.ko)||(T==null?void 0:T.en)||(T==null?void 0:T.ja)||(T==null?void 0:T.zh)||o.value.packageName||s("em.group.fallback")});return(T,H)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":_.value,"is-dimmed":b.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),style:n.normalizeStyle(r.value),onMouseenter:y,onMouseleave:g},[d.value?(n.openBlock(),n.createElementBlock("div",kw,[...H[0]||(H[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",Ew,[n.createElementVNode("span",Nw,n.toDisplayString(v.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",ww,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",vw,n.toDisplayString(s("em.group.ddlExcludeBadge")),1)):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):n.createCommentVNode("",!0)]),c.value&&!i.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:G,onPointerup:K},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-9b95a9b6"]]),xw={key:0,class:"em-sel","aria-hidden":"true"},Iw={key:2,class:"em-note__text"},Xu=Ge(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(An,null),i=n.inject(ya,null),a=n.inject(so,null),r=n.computed(()=>t.data.note),l=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>ut(r.value.style)),c=n.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=t.data.groupRef??null)}function u(){a==null||a.setNoteHover(t.id)}function m(){a==null||a.setNoteHover(null)}const f=n.computed(()=>{var E;return((E=a==null?void 0:a.source.value)==null?void 0:E.kind)==="note"&&a.source.value.id===t.id}),p=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!f.value),y=n.computed(()=>{var E;return((E=o==null?void 0:o.selection.value)==null?void 0:E.kind)==="note"&&o.selection.value.id===t.id}),g=n.computed(()=>!!t.selected&&!y.value),_=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!y.value),b=[{id:"n-top",pos:Re.Top},{id:"n-right",pos:Re.Right},{id:"n-bottom",pos:Re.Bottom},{id:"n-left",pos:Re.Left}],N=n.ref(!1),h=n.ref(""),k=n.ref(null);async function P(){var E;l.value&&(h.value=r.value.memo,N.value=!0,await n.nextTick(),(E=k.value)==null||E.focus())}function A(){N.value&&(N.value=!1,h.value!==r.value.memo&&(o==null||o.setNoteMemo(t.id,h.value)))}const{screenToFlowCoordinate:G,findNode:K}=He();let v=null,T=null;function H(E){var W;if(!l.value)return;E.stopPropagation();const Y=((W=K(t.id))==null?void 0:W.dimensions)??r.value.geo.size,S=G({x:E.clientX,y:E.clientY});v={fx:S.x,fy:S.y,w:Y.width,h:Y.height},E.target.setPointerCapture(E.pointerId)}function C(E){if(!v)return;const Y=G({x:E.clientX,y:E.clientY});T={width:Math.max(140,v.w+(Y.x-v.fx)),height:Math.max(60,v.h+(Y.y-v.fy))};const S=K(t.id);S&&(S.style={width:`${T.width}px`,height:`${T.height}px`})}function ae(E){var Y,S;v&&T&&o&&o.resizeNote(t.id,T),v=null,T=null,(S=(Y=E.target).releasePointerCapture)==null||S.call(Y,E.pointerId)}return(E,Y)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":_.value,"is-selected":y.value,"is-multi-selected":g.value}]),style:n.normalizeStyle(c.value),onDblclick:P,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(n.openBlock(),n.createElementBlock("div",xw,[...Y[4]||(Y[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),N.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:k,"onUpdate:modelValue":Y[0]||(Y[0]=S=>h.value=S),class:"em-note__edit nodrag",onBlur:A,onKeydown:Y[1]||(Y[1]=n.withKeys(S=>N.value=!1,["esc"])),onPointerdown:Y[2]||(Y[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,h.value]]):(n.openBlock(),n.createElementBlock("div",Iw,n.toDisplayString(r.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(b,S=>n.createVNode(n.unref(In),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:Y[3]||(Y[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!N.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:H,onPointermove:C,onPointerup:ae},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Cw=20,Sw=22,$w=7,Rw=22,Ju=31,Zu=7,Aw=20,Qu=11,em=11,Tw=Ju+Zu;function Vw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Mw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function ga(e,t,o){const i=t.x-e.x,a=t.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function tm(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function ba(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function nm(e,t,o,i){const a=i/2,r=e.x===t.x&&e.y===t.y?Math.PI/2:tm(e,t);return[ba(o,a,r-Math.PI/2),ba(o,a,r+Math.PI/2)]}function om(e,t,o,i){const a=t*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 im(e,t,o,i){const a=[],r=[],l=[];if(e.x===t.x&&e.y===t.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=ga(e,t,Cw),[d,u]=nm(e,t,c,Sw);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}),Vw(o.multiplicity)){const m=ga(e,t,Ju);r.push({cx:m.x,cy:m.y,r:Zu})}if(Mw(o.multiplicity)){const m=ga(e,t,$w),[f,p]=nm(e,t,m,Rw);a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=ga(e,t,Aw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=tm(e,t),m=ba(d,Qu/2,u-Math.PI/2),f=ba(d,Qu/2,u+Math.PI/2);l.push({points:[e,m,c,f]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=om(s,c,em,!0),u=om(s,c,em,!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 am=200,rm=120,rl=24;function lm(e){var a,r;if(!e)return{x:0,y:0,width:am,height:rm};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||am,i=((r=e.dimensions)==null?void 0:r.height)||rm;return{x:t.x,y:t.y,width:o,height:i}}function sm(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function cm(e){const t=n.computed(()=>lm(e.sourceNode())),o=n.computed(()=>lm(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var p,y;const d=t.value,u=d.x+d.width;let m=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,f=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(f-m)<rl){const g=(m+f)/2;m=g-rl/2,f=g+rl/2}return{source:{x:u,y:m},target:{x:u,y:f}}}),r=n.computed(()=>e.waypoints()[0]??sm(o.value)),l=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??sm(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Fa(t.value,d,r.value.x):Ua(t.value,r.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Fa(o.value,d,l.value.x):Ua(o.value,l.value)});return{source:n.computed(()=>i.value?a.value.source:s.value.point),target:n.computed(()=>i.value?a.value.target:c.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":c.value.side),isSelf:i}}const ll=Symbol("waypointController"),Bw=["d"],Dw=["d"],Ow=["d"],Lw=["x1","y1","x2","y2"],Pw=["cx","cy","r"],zw=["x","y"],Uw=["x","y"],Fw=["cx","cy","onDblclick"],Hw=["x","y","onPointerdown","onDblclick"],dm=Ge(n.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=He(),i=n.inject(ll),a=n.inject(An,null),r=n.computed(()=>!!a&&a.editable.value),l=n.inject(Yu,null),s=n.inject(so,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var fe;return((fe=a==null?void 0:a.selection.value)==null?void 0:fe.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),m=n.computed(()=>{const fe=l==null?void 0:l.value;if(!fe||!a)return null;const ke=a.resolved.value.entities,we=L=>{var x;return(x=ke.find(R=>R.entity.modelId===L))==null?void 0:x.groupRef},j=t.data.association;return we(j.end1.entityRef)===fe.groupId&&we(j.end2.entityRef)===fe.groupId?{dx:fe.dx,dy:fe.dy}:null}),f=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),p=n.ref(-1),y=n.ref({x:0,y:0}),g=n.computed(()=>{const fe=m.value;return f.value.map((ke,we)=>we===p.value?y.value:fe?{x:ke.x+fe.dx,y:ke.y+fe.dy}:ke)}),_=n.computed(()=>{var fe;return!!((fe=t.sourceNode.data)!=null&&fe.collapsed)}),b=n.computed(()=>{var fe;return!!((fe=t.targetNode.data)!=null&&fe.collapsed)}),{source:N,target:h,sourceSide:k,targetSide:P,isSelf:A}=cm({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!_.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!b.value?t.targetY:void 0}),G=Tw+4,K=n.computed(()=>A.value?Bl(N.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?La(N.value,k.value,g.value,h.value,P.value,G):za(N.value,g.value,h.value)),v=n.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Pa(N.value,k.value,g.value,h.value,P.value,G):Ha(N.value,g.value,h.value).map((fe,ke)=>({point:fe,segIndex:ke}))),T=n.computed(()=>A.value||!r.value?[]:g.value);function H(fe){switch(fe){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 C(fe,ke){p.value=fe,y.value={...f.value[fe]},ke.target.setPointerCapture(ke.pointerId),ke.stopPropagation()}function ae(fe){if(p.value<0)return;const ke=o({x:fe.clientX,y:fe.clientY});y.value={x:ke.x,y:ke.y}}function E(fe){var ke,we;p.value>=0&&i&&i.movePoint(t.id,p.value,{...y.value}),p.value=-1,(we=(ke=fe.target).releasePointerCapture)==null||we.call(ke,fe.pointerId)}function Y(fe,ke){ke.stopPropagation(),i==null||i.removePoint(t.id,fe)}function S(fe,ke){if(!i)return;const we=o({x:ke.clientX,y:ke.clientY});i.insertPoint(t.id,fe,{x:we.x,y:we.y})}const W=n.computed(()=>H(t.data.association.end1.multiplicity)),ee=n.computed(()=>H(t.data.association.end2.multiplicity)),ie=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),O=n.computed(()=>ie.value==="class"),U=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const fe=ho(k.value);return{x:N.value.x+fe.x*10,y:N.value.y+fe.y*10}}return g.value[0]??h.value}),ne=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ke=ho(P.value);return{x:h.value.x+ke.x*10,y:h.value.y+ke.y*10}}const fe=g.value;return fe[fe.length-1]??N.value}),ce=n.computed(()=>{const fe=t.data.association;return{multiplicity:fe.end1.multiplicity,navigable:fe.end1.navigable,composition:fe.end1.composition,otherNavigable:fe.end2.navigable}}),ge=n.computed(()=>{const fe=t.data.association;return{multiplicity:fe.end2.multiplicity,navigable:fe.end2.navigable,composition:fe.end2.composition,otherNavigable:fe.end1.navigable}}),se=n.computed(()=>im(N.value,U.value,ce.value,ie.value)),pe=n.computed(()=>im(h.value,ne.value,ge.value,ie.value)),be=n.computed(()=>[...se.value.lines,...pe.value.lines]),xe=n.computed(()=>[...se.value.circles,...pe.value.circles]),Te=n.computed(()=>[...se.value.polygons,...pe.value.polygons].map(fe=>`M${fe.points.map(ke=>`${ke.x},${ke.y}`).join(" L")} Z`)),Ae=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(fe,ke)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:K.value,fill:"none",class:"em-edge__hit"},null,8,Bw),n.createElementVNode("path",{d:K.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,Dw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Te.value,(we,j)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${j}`,d:we,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ae.value])},null,10,Ow))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(we,j)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${j}`,x1:we.x1,y1:we.y1,x2:we.x2,y2:we.y2,class:n.normalizeClass(["em-edge__marker",Ae.value])},null,10,Lw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(xe.value,(we,j)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${j}`,cx:we.cx,cy:we.cy,r:we.r,class:n.normalizeClass(["em-edge__marker",Ae.value])},null,10,Pw))),128)),O.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(N).x+8,y:n.unref(N).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(W.value),11,zw),n.createElementVNode("text",{x:n.unref(h).x-8,y:n.unref(h).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(ee.value),11,Uw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(v.value,(we,j)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${j}`,cx:we.point.x,cy:we.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(L=>S(we.segIndex,L),["stop"])},null,42,Fw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T.value,(we,j)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${j}`,x:we.x-5,y:we.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>C(j,L),onPointermove:ae,onPointerup:E,onDblclick:L=>Y(j,L)},null,42,Hw))),128))],64))}}),[["__scopeId","data-v-208ecd02"]]);var Yt=(e=>(e.Lines="lines",e.Dots="dots",e))(Yt||{});const um=function({dimensions:e,size:t,color:o}){return n.h("path",{stroke:o,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},mm=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Yt.Lines+"",Yt.Dots+"";const Gw={[Yt.Dots]:"#81818a",[Yt.Lines]:"#eee"},jw=["id","x","y","width","height","patternTransform"],Kw={key:2,height:"100",width:"100"},Yw=["fill"],Ww=["x","y","fill"],qw={name:"Background",compatConfig:{MODE:3}},Xw=n.defineComponent({...qw,props:{id:{},variant:{default:()=>Yt.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:t,viewport:o}=He(),i=n.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,f]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[m*l||1+d[0]/2,f*l||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),r=n.toRef(()=>e.color||e.patternColor||Gw[e.variant||Yt.Dots]);return(l,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[n.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[n.createElementVNode("pattern",{id:a.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.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"},[n.renderSlot(l.$slots,"pattern",{},()=>[l.variant===n.unref(Yt).Lines?(n.openBlock(),n.createBlock(n.unref(um),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===n.unref(Yt).Dots?(n.openBlock(),n.createBlock(n.unref(mm),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),l.bgColor?(n.openBlock(),n.createElementBlock("svg",Kw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Yw)])):n.createCommentVNode("",!0)])],8,jw)]),n.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Ww),n.renderSlot(l.$slots,"default",{id:a.value})],4))}}),Jw={name:"ControlButton",compatConfig:{MODE:3}},Zw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Qw={type:"button",class:"vue-flow__controls-button"};function ev(e,t,o,i,a,r){return n.openBlock(),n.createElementBlock("button",Qw,[n.renderSlot(e.$slots,"default")])}const Tn=Zw(Jw,[["render",ev]]),tv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},nv=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function ov(e,t){return n.openBlock(),n.createElementBlock("svg",tv,nv)}const iv={render:ov},av={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},rv=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function lv(e,t){return n.openBlock(),n.createElementBlock("svg",av,rv)}const sv={render:lv},cv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},dv=[n.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 uv(e,t){return n.openBlock(),n.createElementBlock("svg",cv,dv)}const mv={render:uv},fv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pv=[n.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 hv(e,t){return n.openBlock(),n.createElementBlock("svg",fv,pv)}const yv={render:hv},gv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},bv=[n.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 _v(e,t){return n.openBlock(),n.createElementBlock("svg",gv,bv)}const kv={render:_v},Ev={name:"Controls",compatConfig:{MODE:3}},Nv=n.defineComponent({...Ev,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Md.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=He(),f=n.toRef(()=>o.value||i.value||a.value),p=n.toRef(()=>d.value.zoom<=u.value),y=n.toRef(()=>d.value.zoom>=m.value);function g(){l(),t("zoomIn")}function _(){s(),t("zoomOut")}function b(){c(e.fitViewParams),t("fitView")}function N(){r(!f.value),t("interactionChange",!f.value)}return(h,k)=>(n.openBlock(),n.createBlock(n.unref(Tu),{class:"vue-flow__controls",position:h.position},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"top"),h.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(h.$slots,"control-zoom-in",{},()=>[n.createVNode(Tn,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(iv))))])]),_:3},8,["disabled"])]),n.renderSlot(h.$slots,"control-zoom-out",{},()=>[n.createVNode(Tn,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:_},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(sv))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),h.showFitView?n.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[n.createVNode(Tn,{class:"vue-flow__controls-fitview",onClick:b},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(mv))))])]),_:3})]):n.createCommentVNode("",!0),h.showInteractive?n.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(n.openBlock(),n.createBlock(Tn,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:n.withCtx(()=>[f.value?n.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(kv))))]):n.createCommentVNode("",!0),f.value?n.createCommentVNode("",!0):n.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(yv))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var wv={value:()=>{}};function sl(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new _a(o)}function _a(e){this._=e}function vv(e,t){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&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}_a.prototype=sl.prototype={constructor:_a,on:function(e,t){var o=this._,i=vv(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=xv(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(a=(e=i[r]).type)o[a]=fm(o[a],e.name,t);else if(t==null)for(a in o)o[a]=fm(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new _a(e)},call:function(e,t){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(t,o)},apply:function(e,t,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(t,o)}};function xv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function fm(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=wv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var cl="http://www.w3.org/1999/xhtml";const pm={svg:"http://www.w3.org/2000/svg",xhtml:cl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ka(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),pm.hasOwnProperty(t)?{space:pm[t],local:e}:e}function Iv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===cl&&t.documentElement.namespaceURI===cl?t.createElement(e):t.createElementNS(o,e)}}function Cv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hm(e){var t=ka(e);return(t.local?Cv:Iv)(t)}function Sv(){}function dl(e){return e==null?Sv:function(){return this.querySelector(e)}}function $v(e){typeof e!="function"&&(e=dl(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[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 Et(i,this._parents)}function Rv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Av(){return[]}function ym(e){return e==null?Av:function(){return this.querySelectorAll(e)}}function Tv(e){return function(){return Rv(e.apply(this,arguments))}}function Vv(e){typeof e=="function"?e=Tv(e):e=ym(e);for(var t=this._groups,o=t.length,i=[],a=[],r=0;r<o;++r)for(var l=t[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 Et(i,a)}function gm(e){return function(){return this.matches(e)}}function bm(e){return function(t){return t.matches(e)}}var Mv=Array.prototype.find;function Bv(e){return function(){return Mv.call(this.children,e)}}function Dv(){return this.firstElementChild}function Ov(e){return this.select(e==null?Dv:Bv(typeof e=="function"?e:bm(e)))}var Lv=Array.prototype.filter;function Pv(){return Array.from(this.children)}function zv(e){return function(){return Lv.call(this.children,e)}}function Uv(e){return this.selectAll(e==null?Pv:zv(typeof e=="function"?e:bm(e)))}function Fv(e){typeof e!="function"&&(e=gm(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[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 Et(i,this._parents)}function _m(e){return new Array(e.length)}function Hv(){return new Et(this._enter||this._groups.map(_m),this._parents)}function Ea(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ea.prototype={constructor:Ea,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Gv(e){return function(){return e}}function jv(e,t,o,i,a,r){for(var l=0,s,c=t.length,d=r.length;l<d;++l)(s=t[l])?(s.__data__=r[l],i[l]=s):o[l]=new Ea(e,r[l]);for(;l<c;++l)(s=t[l])&&(a[l]=s)}function Kv(e,t,o,i,a,r,l){var s,c,d=new Map,u=t.length,m=r.length,f=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=l.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new Ea(e,r[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(f[s])===c&&(a[s]=c)}function Yv(e){return e.__data__}function Wv(e,t){if(!arguments.length)return Array.from(this,Yv);var o=t?Kv:jv,i=this._parents,a=this._groups;typeof e!="function"&&(e=Gv(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],f=m.length,p=qv(e.call(u,u&&u.__data__,d,i)),y=p.length,g=s[d]=new Array(y),_=l[d]=new Array(y),b=c[d]=new Array(f);o(u,m,g,_,b,p,t);for(var N=0,h=0,k,P;N<y;++N)if(k=g[N]){for(N>=h&&(h=N+1);!(P=_[h])&&++h<y;);k._next=P||null}}return l=new Et(l,i),l._enter=s,l._exit=c,l}function qv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xv(){return new Et(this._exit||this._groups.map(_m),this._parents)}function Jv(e,t,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+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function Zv(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._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,f=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(f[y]=p);for(;c<a;++c)s[c]=o[c];return new Et(s,this._parents)}function Qv(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],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 ex(e){e||(e=tx);function t(m,f){return m&&f?e(m.__data__,f.__data__):!m-!f}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(t)}return new Et(a,this._parents).order()}function tx(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ox(){return Array.from(this)}function ix(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function ax(){let e=0;for(const t of this)++e;return e}function rx(){return!this.node()}function lx(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function sx(e){return function(){this.removeAttribute(e)}}function cx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dx(e,t){return function(){this.setAttribute(e,t)}}function ux(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function mx(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function fx(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function px(e,t){var o=ka(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?cx:sx:typeof t=="function"?o.local?fx:mx:o.local?ux:dx)(o,t))}function km(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hx(e){return function(){this.style.removeProperty(e)}}function yx(e,t,o){return function(){this.style.setProperty(e,t,o)}}function gx(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function bx(e,t,o){return arguments.length>1?this.each((t==null?hx:typeof t=="function"?gx:yx)(e,t,o??"")):co(this.node(),e)}function co(e,t){return e.style.getPropertyValue(t)||km(e).getComputedStyle(e,null).getPropertyValue(t)}function _x(e){return function(){delete this[e]}}function kx(e,t){return function(){this[e]=t}}function Ex(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Nx(e,t){return arguments.length>1?this.each((t==null?_x:typeof t=="function"?Ex:kx)(e,t)):this.node()[e]}function Em(e){return e.trim().split(/^|\s+/)}function ul(e){return e.classList||new Nm(e)}function Nm(e){this._node=e,this._names=Em(e.getAttribute("class")||"")}Nm.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function wm(e,t){for(var o=ul(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function vm(e,t){for(var o=ul(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function wx(e){return function(){wm(this,e)}}function vx(e){return function(){vm(this,e)}}function xx(e,t){return function(){(t.apply(this,arguments)?wm:vm)(this,e)}}function Ix(e,t){var o=Em(e+"");if(arguments.length<2){for(var i=ul(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?xx:t?wx:vx)(o,t))}function Cx(){this.textContent=""}function Sx(e){return function(){this.textContent=e}}function $x(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Rx(e){return arguments.length?this.each(e==null?Cx:(typeof e=="function"?$x:Sx)(e)):this.node().textContent}function Ax(){this.innerHTML=""}function Tx(e){return function(){this.innerHTML=e}}function Vx(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Mx(e){return arguments.length?this.each(e==null?Ax:(typeof e=="function"?Vx:Tx)(e)):this.node().innerHTML}function Bx(){this.nextSibling&&this.parentNode.appendChild(this)}function Dx(){return this.each(Bx)}function Ox(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Lx(){return this.each(Ox)}function Px(e){var t=typeof e=="function"?e:hm(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zx(){return null}function Ux(e,t){var o=typeof e=="function"?e:hm(e),i=t==null?zx:typeof t=="function"?t:dl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Fx(){var e=this.parentNode;e&&e.removeChild(this)}function Hx(){return this.each(Fx)}function Gx(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jx(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kx(e){return this.select(e?jx:Gx)}function Yx(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Wx(e){return function(t){e.call(this,t,this.__data__)}}function qx(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Xx(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,r;o<a;++o)r=t[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++i]=r;++i?t.length=i:delete this.__on}}}function Jx(e,t,o){return function(){var i=this.__on,a,r=Wx(t);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=t;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:t,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Zx(e,t,o){var i=qx(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=t?Jx:Xx,a=0;a<r;++a)this.each(s(i[a],t,o));return this}function xm(e,t,o){var i=km(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Qx(e,t){return function(){return xm(this,e,t)}}function eI(e,t){return function(){return xm(this,e,t.apply(this,arguments))}}function tI(e,t){return this.each((typeof t=="function"?eI:Qx)(e,t))}function*nI(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Im=[null];function Et(e,t){this._groups=e,this._parents=t}function qo(){return new Et([[document.documentElement]],Im)}function oI(){return this}Et.prototype=qo.prototype={constructor:Et,select:$v,selectAll:Vv,selectChild:Ov,selectChildren:Uv,filter:Fv,data:Wv,enter:Hv,exit:Xv,join:Jv,merge:Zv,selection:oI,order:Qv,sort:ex,call:nx,nodes:ox,node:ix,size:ax,empty:rx,each:lx,attr:px,style:bx,property:Nx,classed:Ix,text:Rx,html:Mx,raise:Dx,lower:Lx,append:Px,insert:Ux,remove:Hx,clone:Kx,datum:Yx,on:Zx,dispatch:tI,[Symbol.iterator]:nI};function ln(e){return typeof e=="string"?new Et([[document.querySelector(e)]],[document.documentElement]):new Et([[e]],Im)}function iI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function sn(e,t){if(e=iI(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const ml={capture:!0,passive:!1};function fl(e){e.preventDefault(),e.stopImmediatePropagation()}function aI(e){var t=e.document.documentElement,o=ln(e).on("dragstart.drag",fl,ml);"onselectstart"in t?o.on("selectstart.drag",fl,ml):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function rI(e,t){var o=e.document.documentElement,i=ln(e).on("dragstart.drag",null);t&&(i.on("click.drag",fl,ml),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 pl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Cm(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Xo(){}var Jo=.7,Na=1/Jo,uo="\\s*([+-]?\\d+)\\s*",Zo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Lt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lI=/^#([0-9a-f]{3,8})$/,sI=new RegExp(`^rgb\\(${uo},${uo},${uo}\\)$`),cI=new RegExp(`^rgb\\(${Lt},${Lt},${Lt}\\)$`),dI=new RegExp(`^rgba\\(${uo},${uo},${uo},${Zo}\\)$`),uI=new RegExp(`^rgba\\(${Lt},${Lt},${Lt},${Zo}\\)$`),mI=new RegExp(`^hsl\\(${Zo},${Lt},${Lt}\\)$`),fI=new RegExp(`^hsla\\(${Zo},${Lt},${Lt},${Zo}\\)$`),Sm={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};pl(Xo,Qo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$m,formatHex:$m,formatHex8:pI,formatHsl:hI,formatRgb:Rm,toString:Rm});function $m(){return this.rgb().formatHex()}function pI(){return this.rgb().formatHex8()}function hI(){return Bm(this).formatHsl()}function Rm(){return this.rgb().formatRgb()}function Qo(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=lI.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Am(t):o===3?new yt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?wa(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?wa(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=sI.exec(e))?new yt(t[1],t[2],t[3],1):(t=cI.exec(e))?new yt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dI.exec(e))?wa(t[1],t[2],t[3],t[4]):(t=uI.exec(e))?wa(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mI.exec(e))?Mm(t[1],t[2]/100,t[3]/100,1):(t=fI.exec(e))?Mm(t[1],t[2]/100,t[3]/100,t[4]):Sm.hasOwnProperty(e)?Am(Sm[e]):e==="transparent"?new yt(NaN,NaN,NaN,0):null}function Am(e){return new yt(e>>16&255,e>>8&255,e&255,1)}function wa(e,t,o,i){return i<=0&&(e=t=o=NaN),new yt(e,t,o,i)}function yI(e){return e instanceof Xo||(e=Qo(e)),e?(e=e.rgb(),new yt(e.r,e.g,e.b,e.opacity)):new yt}function hl(e,t,o,i){return arguments.length===1?yI(e):new yt(e,t,o,i??1)}function yt(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}pl(yt,hl,Cm(Xo,{brighter(e){return e=e==null?Na:Math.pow(Na,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Jo:Math.pow(Jo,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yt(Vn(this.r),Vn(this.g),Vn(this.b),va(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:Tm,formatHex:Tm,formatHex8:gI,formatRgb:Vm,toString:Vm}));function Tm(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}`}function gI(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}${Mn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Vm(){const e=va(this.opacity);return`${e===1?"rgb(":"rgba("}${Vn(this.r)}, ${Vn(this.g)}, ${Vn(this.b)}${e===1?")":`, ${e})`}`}function va(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mn(e){return e=Vn(e),(e<16?"0":"")+e.toString(16)}function Mm(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new St(e,t,o,i)}function Bm(e){if(e instanceof St)return new St(e.h,e.s,e.l,e.opacity);if(e instanceof Xo||(e=Qo(e)),!e)return new St;if(e instanceof St)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),r=Math.max(t,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(t===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-t)/s+2:l=(t-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new St(l,s,c,e.opacity)}function bI(e,t,o,i){return arguments.length===1?Bm(e):new St(e,t,o,i??1)}function St(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}pl(St,bI,Cm(Xo,{brighter(e){return e=e==null?Na:Math.pow(Na,e),new St(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Jo:Math.pow(Jo,e),new St(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new yt(yl(e>=240?e-240:e+120,a,i),yl(e,a,i),yl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new St(Dm(this.h),xa(this.s),xa(this.l),va(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=va(this.opacity);return`${e===1?"hsl(":"hsla("}${Dm(this.h)}, ${xa(this.s)*100}%, ${xa(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dm(e){return e=(e||0)%360,e<0?e+360:e}function xa(e){return Math.max(0,Math.min(1,e||0))}function yl(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Om=e=>()=>e;function _I(e,t){return function(o){return e+o*t}}function kI(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function EI(e){return(e=+e)==1?Lm:function(t,o){return o-t?kI(t,o,e):Om(isNaN(t)?o:t)}}function Lm(e,t){var o=t-e;return o?_I(e,o):Om(isNaN(e)?t:e)}const Pm=(function e(t){var o=EI(t);function i(a,r){var l=o((a=hl(a)).r,(r=hl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Lm(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 cn(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var gl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,bl=new RegExp(gl.source,"g");function NI(e){return function(){return e}}function wI(e){return function(t){return e(t)+""}}function vI(e,t){var o=gl.lastIndex=bl.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",t=t+"";(i=gl.exec(e))&&(a=bl.exec(t));)(r=a.index)>o&&(r=t.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:cn(i,a)})),o=bl.lastIndex;return o<t.length&&(r=t.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?wI(c[0].x):NI(t):(t=c.length,function(d){for(var u=0,m;u<t;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var zm=180/Math.PI,_l={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Um(e,t,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(t,e)*zm,skewX:Math.atan(c)*zm,scaleX:l,scaleY:s}}var Ia;function xI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?_l:Um(t.a,t.b,t.c,t.d,t.e,t.f)}function II(e){return e==null||(Ia||(Ia=document.createElementNS("http://www.w3.org/2000/svg","g")),Ia.setAttribute("transform",e),!(e=Ia.transform.baseVal.consolidate()))?_l:(e=e.matrix,Um(e.a,e.b,e.c,e.d,e.e,e.f))}function Fm(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push("translate(",null,t,null,o);y.push({i:g-4,x:cn(d,m)},{i:g-2,x:cn(u,f)})}else(m||f)&&p.push("translate("+m+t+f+o)}function l(d,u,m,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:m.push(a(m)+"rotate(",null,i)-2,x:cn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,f){d!==u?f.push({i:m.push(a(m)+"skewX(",null,i)-2,x:cn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push(a(p)+"scale(",null,",",null,")");y.push({i:g-4,x:cn(d,m)},{i:g-2,x:cn(u,f)})}else(m!==1||f!==1)&&p.push(a(p)+"scale("+m+","+f+")")}return function(d,u){var m=[],f=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,f),l(d.rotate,u.rotate,m,f),s(d.skewX,u.skewX,m,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,f),d=u=null,function(p){for(var y=-1,g=f.length,_;++y<g;)m[(_=f[y]).i]=_.x(p);return m.join("")}}}var CI=Fm(xI,"px, ","px)","deg)"),SI=Fm(II,", ",")",")"),$I=1e-12;function Hm(e){return((e=Math.exp(e))+1/e)/2}function RI(e){return((e=Math.exp(e))-1/e)/2}function AI(e){return((e=Math.exp(2*e))-1)/(e+1)}const TI=(function e(t,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],f=l[2],p=u-s,y=m-c,g=p*p+y*y,_,b;if(g<$I)b=Math.log(f/d)/t,_=function(G){return[s+G*p,c+G*y,d*Math.exp(t*G*b)]};else{var N=Math.sqrt(g),h=(f*f-d*d+i*g)/(2*d*o*N),k=(f*f-d*d-i*g)/(2*f*o*N),P=Math.log(Math.sqrt(h*h+1)-h),A=Math.log(Math.sqrt(k*k+1)-k);b=(A-P)/t,_=function(G){var K=G*b,v=Hm(P),T=d/(o*N)*(v*AI(t*K+P)-RI(P));return[s+T*p,c+T*y,d*v/Hm(t*K+P)]}}return _.duration=b*1e3*t/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var mo=0,ei=0,ti=0,Gm=1e3,Ca,ni,Sa=0,Bn=0,$a=0,oi=typeof performance=="object"&&performance.now?performance:Date,jm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function kl(){return Bn||(jm(VI),Bn=oi.now()+$a)}function VI(){Bn=0}function Ra(){this._call=this._time=this._next=null}Ra.prototype=Km.prototype={constructor:Ra,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?kl():+o)+(t==null?0:+t),!this._next&&ni!==this&&(ni?ni._next=this:Ca=this,ni=this),this._call=e,this._time=o,El()},stop:function(){this._call&&(this._call=null,this._time=1/0,El())}};function Km(e,t,o){var i=new Ra;return i.restart(e,t,o),i}function MI(){kl(),++mo;for(var e=Ca,t;e;)(t=Bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--mo}function Ym(){Bn=(Sa=oi.now())+$a,mo=ei=0;try{MI()}finally{mo=0,DI(),Bn=0}}function BI(){var e=oi.now(),t=e-Sa;t>Gm&&($a-=t,Sa=e)}function DI(){for(var e,t=Ca,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Ca=o);ni=e,El(i)}function El(e){if(!mo){ei&&(ei=clearTimeout(ei));var t=e-Bn;t>24?(e<1/0&&(ei=setTimeout(Ym,e-oi.now()-$a)),ti&&(ti=clearInterval(ti))):(ti||(Sa=oi.now(),ti=setInterval(BI,Gm)),mo=1,jm(Ym))}}function Wm(e,t,o){var i=new Ra;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var OI=sl("start","end","cancel","interrupt"),LI=[],qm=0,Xm=1,Nl=2,Aa=3,Jm=4,wl=5,Ta=6;function Va(e,t,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;PI(e,o,{name:t,index:i,group:a,on:OI,tween:LI,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:qm})}function vl(e,t){var o=$t(e,t);if(o.state>qm)throw new Error("too late; already scheduled");return o}function Pt(e,t){var o=$t(e,t);if(o.state>Aa)throw new Error("too late; already running");return o}function $t(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function PI(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Km(r,0,o.time);function r(d){o.state=Xm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,f,p;if(o.state!==Xm)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Aa)return Wm(l);p.state===Jm?(p.state=Ta,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=Ta,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Wm(function(){o.state===Aa&&(o.state=Jm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Nl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Nl){for(o.state=Aa,a=new Array(f=o.tween.length),u=0,m=-1;u<f;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=wl,1),m=-1,f=a.length;++m<f;)a[m].call(e,u);o.state===wl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ta,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ma(e,t){var o=e.__transition,i,a,r=!0,l;if(o){t=t==null?null:t+"";for(l in o){if((i=o[l]).name!==t){r=!1;continue}a=i.state>Nl&&i.state<wl,i.state=Ta,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function zI(e){return this.each(function(){Ma(this,e)})}function UI(e,t){var o,i;return function(){var a=Pt(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===t){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function FI(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Pt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function HI(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=$t(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((t==null?UI:FI)(o,e,t))}function xl(e,t,o){var i=e._id;return e.each(function(){var a=Pt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return $t(a,i).value[t]}}function Zm(e,t){var o;return(typeof t=="number"?cn:t instanceof Qo?Pm:(o=Qo(t))?(t=o,Pm):vI)(e,t)}function GI(e){return function(){this.removeAttribute(e)}}function jI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function KI(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=t(i=l,o)}}function YI(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=t(i=l,o)}}function WI(e,t,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=t(i=l,s)))}}function qI(e,t,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=t(i=l,s)))}}function XI(e,t){var o=ka(e),i=o==="transform"?SI:Zm;return this.attrTween(e,typeof t=="function"?(o.local?qI:WI)(o,i,xl(this,"attr."+e,t)):t==null?(o.local?jI:GI)(o):(o.local?YI:KI)(o,i,t))}function JI(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function ZI(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function QI(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&ZI(e,r)),o}return a._value=t,a}function eC(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&JI(e,r)),o}return a._value=t,a}function tC(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=ka(e);return this.tween(o,(i.local?QI:eC)(i,t))}function nC(e,t){return function(){vl(this,e).delay=+t.apply(this,arguments)}}function oC(e,t){return t=+t,function(){vl(this,e).delay=t}}function iC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nC:oC)(t,e)):$t(this.node(),t).delay}function aC(e,t){return function(){Pt(this,e).duration=+t.apply(this,arguments)}}function rC(e,t){return t=+t,function(){Pt(this,e).duration=t}}function lC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?aC:rC)(t,e)):$t(this.node(),t).duration}function sC(e,t){if(typeof t!="function")throw new Error;return function(){Pt(this,e).ease=t}}function cC(e){var t=this._id;return arguments.length?this.each(sC(t,e)):$t(this.node(),t).ease}function dC(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Pt(this,e).ease=o}}function uC(e){if(typeof e!="function")throw new Error;return this.each(dC(this._id,e))}function mC(e){typeof e!="function"&&(e=gm(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[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 Wt(i,this._parents,this._name,this._id)}function fC(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=t[s],d=o[s],u=c.length,m=l[s]=new Array(u),f,p=0;p<u;++p)(f=c[p]||d[p])&&(m[p]=f);for(;s<i;++s)l[s]=t[s];return new Wt(l,this._parents,this._name,this._id)}function pC(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function hC(e,t,o){var i,a,r=pC(t)?vl:Pt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(t,o),l.on=a}}function yC(e,t){var o=this._id;return arguments.length<2?$t(this.node(),o).on.on(e):this.each(hC(o,e,t))}function gC(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function bC(){return this.on("end.remove",gC(this._id))}function _C(e){var t=this._name,o=this._id;typeof e!="function"&&(e=dl(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,f=0;f<c;++f)(u=s[f])&&(m=e.call(u,u.__data__,f,s))&&("__data__"in u&&(m.__data__=u.__data__),d[f]=m,Va(d[f],t,o,f,d,$t(u,o)));return new Wt(r,this._parents,t,o)}function kC(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ym(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 f=e.call(u,u.__data__,m,c),p,y=$t(u,o),g=0,_=f.length;g<_;++g)(p=f[g])&&Va(p,t,o,g,f,y);r.push(f),l.push(u)}return new Wt(r,l,t,o)}var EC=qo.prototype.constructor;function NC(){return new EC(this._groups,this._parents)}function wC(e,t){var o,i,a;return function(){var r=co(this,e),l=(this.style.removeProperty(e),co(this,e));return r===l?null:r===o&&l===i?a:a=t(o=r,i=l)}}function Qm(e){return function(){this.style.removeProperty(e)}}function vC(e,t,o){var i,a=o+"",r;return function(){var l=co(this,e);return l===a?null:l===i?r:r=t(i=l,o)}}function xC(e,t,o){var i,a,r;return function(){var l=co(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),co(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s))}}function IC(e,t){var o,i,a,r="style."+t,l="end."+r,s;return function(){var c=Pt(this,e),d=c.on,u=c.value[r]==null?s||(s=Qm(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function CC(e,t,o){var i=(e+="")=="transform"?CI:Zm;return t==null?this.styleTween(e,wC(e,i)).on("end.style."+e,Qm(e)):typeof t=="function"?this.styleTween(e,xC(e,i,xl(this,"style."+e,t))).each(IC(this._id,e)):this.styleTween(e,vC(e,i,t),o).on("end.style."+e,null)}function SC(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function $C(e,t,o){var i,a;function r(){var l=t.apply(this,arguments);return l!==a&&(i=(a=l)&&SC(e,l,o)),i}return r._value=t,r}function RC(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,$C(e,t,o??""))}function AC(e){return function(){this.textContent=e}}function TC(e){return function(){var t=e(this);this.textContent=t??""}}function VC(e){return this.tween("text",typeof e=="function"?TC(xl(this,"text",e)):AC(e==null?"":e+""))}function MC(e){return function(t){this.textContent=e.call(this,t)}}function BC(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&MC(a)),t}return i._value=e,i}function DC(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,BC(e))}function OC(){for(var e=this._name,t=this._id,o=ef(),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=$t(c,t);Va(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Wt(i,this._parents,e,o)}function LC(){var e,t,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=Pt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&r()})}var PC=0;function Wt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function ef(){return++PC}var qt=qo.prototype;Wt.prototype={constructor:Wt,select:_C,selectAll:kC,selectChild:qt.selectChild,selectChildren:qt.selectChildren,filter:mC,merge:fC,selection:NC,transition:OC,call:qt.call,nodes:qt.nodes,node:qt.node,size:qt.size,empty:qt.empty,each:qt.each,on:yC,attr:XI,attrTween:tC,style:CC,styleTween:RC,text:VC,textTween:DC,remove:bC,tween:HI,delay:iC,duration:lC,ease:cC,easeVarying:uC,end:LC,[Symbol.iterator]:qt[Symbol.iterator]};function zC(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var UC={time:null,delay:0,duration:250,ease:zC};function FC(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function HC(e){var t,o;e instanceof Wt?(t=e._id,e=e._name):(t=ef(),(o=UC).time=kl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Va(c,e,t,d,l,o||FC(c,t));return new Wt(i,this._parents,e,t)}qo.prototype.interrupt=zI,qo.prototype.transition=HC;const Ba=e=>()=>e;function GC(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Xt(e,t,o){this.k=e,this.x=t,this.y=o}Xt.prototype={constructor:Xt,scale:function(e){return e===1?this:new Xt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Xt(this.k,this.x+this.k*e,this.y+this.k*t)},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 Il=new Xt(1,0,0);Xt.prototype;function Cl(e){e.stopImmediatePropagation()}function ii(e){e.preventDefault(),e.stopImmediatePropagation()}function jC(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function KC(){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 tf(){return this.__zoom||Il}function YC(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function WC(){return navigator.maxTouchPoints||"ontouchstart"in this}function qC(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],r=e.invertY(t[0][1])-o[0][1],l=e.invertY(t[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 XC(){var e=jC,t=KC,o=qC,i=YC,a=WC,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=TI,d=sl("start","zoom","end"),u,m,f,p=500,y=150,g=0,_=10;function b(E){E.property("__zoom",tf).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,Y,S,W){var ee=E.selection?E.selection():E;ee.property("__zoom",tf),E!==ee?P(E,Y,S,W):ee.interrupt().each(function(){A(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(E,Y,S,W){b.scaleTo(E,function(){var ee=this.__zoom.k,ie=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*ie},S,W)},b.scaleTo=function(E,Y,S,W){b.transform(E,function(){var ee=t.apply(this,arguments),ie=this.__zoom,O=S==null?k(ee):typeof S=="function"?S.apply(this,arguments):S,U=ie.invert(O),ne=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(ie,ne),O,U),ee,l)},S,W)},b.translateBy=function(E,Y,S,W){b.transform(E,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,W)},b.translateTo=function(E,Y,S,W,ee){b.transform(E,function(){var ie=t.apply(this,arguments),O=this.__zoom,U=W==null?k(ie):typeof W=="function"?W.apply(this,arguments):W;return o(Il.translate(U[0],U[1]).scale(O.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),ie,l)},W,ee)};function N(E,Y){return Y=Math.max(r[0],Math.min(r[1],Y)),Y===E.k?E:new Xt(Y,E.x,E.y)}function h(E,Y,S){var W=Y[0]-S[0]*E.k,ee=Y[1]-S[1]*E.k;return W===E.x&&ee===E.y?E:new Xt(E.k,W,ee)}function k(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function P(E,Y,S,W){E.on("start.zoom",function(){A(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(W).end()}).tween("zoom",function(){var ee=this,ie=arguments,O=A(ee,ie).event(W),U=t.apply(ee,ie),ne=S==null?k(U):typeof S=="function"?S.apply(ee,ie):S,ce=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ge=ee.__zoom,se=typeof Y=="function"?Y.apply(ee,ie):Y,pe=c(ge.invert(ne).concat(ce/ge.k),se.invert(ne).concat(ce/se.k));return function(be){if(be===1)be=se;else{var xe=pe(be),Te=ce/xe[2];be=new Xt(Te,ne[0]-xe[0]*Te,ne[1]-xe[1]*Te)}O.zoom(null,be)}})}function A(E,Y,S){return!S&&E.__zooming||new G(E,Y)}function G(E,Y){this.that=E,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,Y),this.taps=0}G.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,Y){return this.mouse&&E!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var Y=ln(this.that).datum();d.call(E,this.that,new GC(E,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),Y)}};function K(E,...Y){if(!e.apply(this,arguments))return;var S=A(this,Y).event(E),W=this.__zoom,ee=Math.max(r[0],Math.min(r[1],W.k*Math.pow(2,i.apply(this,arguments)))),ie=sn(E);if(S.wheel)(S.mouse[0][0]!==ie[0]||S.mouse[0][1]!==ie[1])&&(S.mouse[1]=W.invert(S.mouse[0]=ie)),clearTimeout(S.wheel);else{if(W.k===ee)return;S.mouse=[ie,W.invert(ie)],Ma(this),S.start()}ii(E),S.wheel=setTimeout(O,y),S.zoom("mouse",o(h(N(W,ee),S.mouse[0],S.mouse[1]),S.extent,l));function O(){S.wheel=null,S.end()}}function v(E,...Y){if(f||!e.apply(this,arguments))return;var S=E.currentTarget,W=A(this,Y,!0).event(E),ee=ln(E.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",ce,!0),ie=sn(E,S),O=E.clientX,U=E.clientY;aI(E.view),Cl(E),W.mouse=[ie,this.__zoom.invert(ie)],Ma(this),W.start();function ne(ge){if(ii(ge),!W.moved){var se=ge.clientX-O,pe=ge.clientY-U;W.moved=se*se+pe*pe>g}W.event(ge).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=sn(ge,S),W.mouse[1]),W.extent,l))}function ce(ge){ee.on("mousemove.zoom mouseup.zoom",null),rI(ge.view,W.moved),ii(ge),W.event(ge).end()}}function T(E,...Y){if(e.apply(this,arguments)){var S=this.__zoom,W=sn(E.changedTouches?E.changedTouches[0]:E,this),ee=S.invert(W),ie=S.k*(E.shiftKey?.5:2),O=o(h(N(S,ie),W,ee),t.apply(this,Y),l);ii(E),s>0?ln(this).transition().duration(s).call(P,O,W,E):ln(this).call(b.transform,O,W,E)}}function H(E,...Y){if(e.apply(this,arguments)){var S=E.touches,W=S.length,ee=A(this,Y,E.changedTouches.length===W).event(E),ie,O,U,ne;for(Cl(E),O=0;O<W;++O)U=S[O],ne=sn(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==ne[2]&&(ee.touch1=ne,ee.taps=0):(ee.touch0=ne,ie=!0,ee.taps=1+!!u);u&&(u=clearTimeout(u)),ie&&(ee.taps<2&&(m=ne[0],u=setTimeout(function(){u=null},p)),Ma(this),ee.start())}}function C(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O,U,ne;for(ii(E),ie=0;ie<ee;++ie)O=W[ie],U=sn(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=U:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=U);if(O=S.that.__zoom,S.touch1){var ce=S.touch0[0],ge=S.touch0[1],se=S.touch1[0],pe=S.touch1[1],be=(be=se[0]-ce[0])*be+(be=se[1]-ce[1])*be,xe=(xe=pe[0]-ge[0])*xe+(xe=pe[1]-ge[1])*xe;O=N(O,Math.sqrt(be/xe)),U=[(ce[0]+se[0])/2,(ce[1]+se[1])/2],ne=[(ge[0]+pe[0])/2,(ge[1]+pe[1])/2]}else if(S.touch0)U=S.touch0[0],ne=S.touch0[1];else return;S.zoom("touch",o(h(O,U,ne),S.extent,l))}}function ae(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O;for(Cl(E),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),ie=0;ie<ee;++ie)O=W[ie],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=sn(O,this),Math.hypot(m[0]-O[0],m[1]-O[1])<_)){var U=ln(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Ba(+E),b):i},b.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Ba(!!E),b):e},b.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Ba(!!E),b):a},b.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Ba([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),b):t},b.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],b):[r[0],r[1]]},b.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(E){return arguments.length?(o=E,b):o},b.duration=function(E){return arguments.length?(s=+E,b):s},b.interpolate=function(E){return arguments.length?(c=E,b):c},b.on=function(){var E=d.on.apply(d,arguments);return E===d?b:E},b.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,b):Math.sqrt(g)},b.tapDistance=function(E){return arguments.length?(_=+E,b):_},b}const nf=Symbol("MiniMapSlots"),JC=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],ZC={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},QC=n.defineComponent({...ZC,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:t}){const o=e,i=n.inject(nf),a=n.useAttrs(),r=n.toRef(()=>a.style??{});function l(m){t("click",m)}function s(m){t("dblclick",m)}function c(m){t("mouseenter",m)}function d(m){t("mousemove",m)}function u(m){t("mouseleave",m)}return(m,f)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.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,JC))],64)):n.createCommentVNode("",!0)}}),eS=["width","height","viewBox","aria-labelledby"],tS=["id"],nS=["d","fill","stroke","stroke-width"],oS={name:"MiniMap",compatConfig:{MODE:3}},iS=n.defineComponent({...oS,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:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:f,d3Zoom:p,getNodesInitialized:y}=He(),g=n.ref();n.provide(nf,o);const _=n.toRef(()=>{var ee;return e.width??((ee=i.style)==null?void 0:ee.width)??a}),b=n.toRef(()=>{var ee;return e.height??((ee=i.style)==null?void 0:ee.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),k=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),P=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=n.computed(()=>Ur(y.value.filter(ee=>!ee.hidden))),G=n.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})),K=n.computed(()=>y.value&&y.value.length?y1(A.value,G.value):G.value),v=n.computed(()=>{const ee=K.value.width/_.value,ie=K.value.height/b.value;return Math.max(ee,ie)}),T=n.computed(()=>{const ee=v.value*_.value,ie=v.value*b.value,O=e.offsetScale*v.value;return{offset:O,x:K.value.x-(ee-K.value.width)/2-O,y:K.value.y-(ie-K.value.height)/2-O,width:ee+O*2,height:ie+O*2}}),H=n.computed(()=>!T.value.x||!T.value.y?"":`
|
|
48
|
+
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 it extends Error{constructor(n,...o){var i;super((i=cu[n])==null?void 0:i.call(cu,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Wr(e){return"clientX"in e}function M1(e){return"sourceEvent"in e}function Pt(e,n){const o=Wr(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 Yo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function B1(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 ia(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const D1=()=>!0;function qr(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function O1(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())ea(a,Qi(r))>0&&i.push(r);return i}const L1=250;function P1(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=O1(e,o,n+L1);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:f,y:p}=oo(d,m,m.position,!0),y=Math.sqrt((f-e.x)**2+(p-e.y)**2);y>n||(y<s?(l=[{...m,x:f,y:p}],s=y):y===s&&l.push({...m,x:f,y:p}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function du(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=D1},u,m,f,p){const y=r==="target",g=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:_,y:b}=Pt(e),N=l.elementFromPoint(_,b),h=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:g,E={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const D=uu(void 0,h),$=h.getAttribute("data-nodeid"),H=h.getAttribute("data-handleid"),j=h.classList.contains("connectable"),v=h.classList.contains("connectableend");if(!$||!D)return E;const T={source:y?$:i,sourceHandle:y?H:a,target:y?i:$,targetHandle:y?a:H};E.connection=T;const I=j&&v&&(o===Yt.Strict?y&&D==="source"||!y&&D==="target":$!==i||H!==a);E.isValid=I&&d(T,{nodes:m,edges:u,sourceNode:f(T.source),targetNode:f(T.target)}),E.toHandle=mu($,D,H,p,o,!0)}return E}function uu(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function z1(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function U1(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function mu(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===Yt.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(f=>f.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...oo(d,m,m.position,!0)}:m}const Xr={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},F1=["production","prod"];function Wo(e,...n){fu()&&console.warn(`[Vue Flow]: ${e}`,...n)}function fu(){return!F1.includes(process.env.NODE_ENV||"")}function pu(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,...ta(l)}}):null}function Jr(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 tt(e){return typeof t.unref(e)<"u"}function H1(e,n,o,i){if(!e||!e.source||!e.target)return o(new it(et.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return nn(e)?a=e:a={...e,id:Yd(e)},a=jd(a,void 0,i),w1(a,n)?!1:a}function G1(e,n,o,i,a){if(!n.source||!n.target)return a(new it(et.EDGE_INVALID,e.id)),!1;if(!o)return a(new it(et.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Yd(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function hu(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!xn(l)){o(new it(et.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=E1(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 it(et.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 yu(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 Zr(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}`;yu("source",c,u,e,a,l),yu("target",c,d,e,r,s)}}function gu(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Qr(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=nn(d)?d:H1(d,s,a,r);if(!u)continue;const m=o(u.source),f=o(u.target);if(!m||!f){a(new it(et.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new it(et.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!f){a(new it(et.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:f})){a(new it(et.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...jd(u,p,r),sourceNode:m,targetNode:f})}return c}const bu=Symbol("vueFlow"),_u=Symbol("nodeId"),Eu=Symbol("nodeRef"),j1=Symbol("edgeId"),K1=Symbol("edgeRef"),aa=Symbol("slots");function ku(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:f,findNode:p,multiSelectionActive:y,nodesSelectionActive:g,selectNodesOnDrag:_,removeSelectedElements:b,addSelectedNodes:N,updateNodePositions:h,emits:E}=He(),{onStart:D,onDrag:$,onStop:H,onClick:j,el:v,disabled:T,id:F,selectable:I,dragHandle:le}=e,k=t.shallowRef(!1);let Y=[],C,W=null,ee={x:void 0,y:void 0},ae={x:0,y:0},L=null,U=!1,ne=!1,ue=0,Ne=!1;const se=q1(),me=({x:ke,y:ve})=>{ee={x:ke,y:ve};let G=!1;if(Y=Y.map(O=>{const Z={x:ke-O.distance.x,y:ve-O.distance.y},{computedPosition:oe}=Yr(O,o.value?ia(Z,i.value):Z,E.error,l.value,O.parentNode?p(O.parentNode):void 0);return G=G||O.position.x!==oe.x||O.position.y!==oe.y,O.position=oe,O}),ne=ne||G,!!G&&(h(Y,!0,!0),k.value=!0,L)){const[O,Z]=Kr({id:F,dragItems:Y,findNode:p});$({event:L,node:O,nodes:Z})}},_e=()=>{if(!W)return;const[ke,ve]=eu(ae,W,u.value);if(ke!==0||ve!==0){const G={x:(ee.x??0)-ke/c.value.zoom,y:(ee.y??0)-ve/c.value.zoom};f({x:ke,y:ve})&&me(G)}ue=requestAnimationFrame(_e)},Ie=(ke,ve)=>{U=!0;const G=p(F);!_.value&&!y.value&&G&&(G.selected||b()),G&&t.toValue(I)&&_.value&&Jr(G,y.value,N,b,g,!1,ve);const O=se(ke.sourceEvent);if(ee=O,Y=S1(r.value,m.value,O,F),Y.length){const[Z,oe]=Kr({id:F,dragItems:Y,findNode:p});D({event:ke.sourceEvent,node:Z,nodes:oe})}},Ve=(ke,ve)=>{var G;ke.sourceEvent.type==="touchmove"&&ke.sourceEvent.touches.length>1||(ne=!1,s.value===0&&Ie(ke,ve),ee=se(ke.sourceEvent),W=((G=n.value)==null?void 0:G.getBoundingClientRect())||null,ae=Pt(ke.sourceEvent,W))},Te=(ke,ve)=>{const G=se(ke.sourceEvent);if(!Ne&&U&&d.value&&(Ne=!0,_e()),!U){const O=G.xSnapped-(ee.x??0),Z=G.ySnapped-(ee.y??0);Math.sqrt(O*O+Z*Z)>s.value&&Ie(ke,ve)}(ee.x!==G.xSnapped||ee.y!==G.ySnapped)&&Y.length&&U&&(L=ke.sourceEvent,ae=Pt(ke.sourceEvent,W),me(G))},pe=ke=>{let ve=!1;if(!U&&!k.value&&!y.value){const G=ke.sourceEvent,O=se(G),Z=O.xSnapped-(ee.x??0),oe=O.ySnapped-(ee.y??0),R=Math.sqrt(Z*Z+oe*oe);R!==0&&R<=s.value&&(j==null||j(G),ve=!0)}if(Y.length&&!ve){ne&&(h(Y,!1,!1),ne=!1);const[G,O]=Kr({id:F,dragItems:Y,findNode:p});H({event:ke.sourceEvent,node:G,nodes:O})}Y=[],k.value=!1,Ne=!1,U=!1,ee={x:void 0,y:void 0},cancelAnimationFrame(ue)};return t.watch([()=>t.toValue(T),v],([ke,ve],G,O)=>{if(ve){const Z=vt(ve);ke||(C=_b().on("start",oe=>Ve(oe,ve)).on("drag",oe=>Te(oe,ve)).on("end",oe=>pe(oe)).filter(oe=>{const R=oe.target,A=t.toValue(le);return!oe.button&&(!a.value||!ru(R,`.${a.value}`,ve)&&(!A||ru(R,A,ve)))}),Z.call(C)),O(()=>{Z.on(".drag",null),C&&(C.on("start",null),C.on("drag",null),C.on("end",null))})}}),k}function Y1(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),updateStart:Re(),update:Re(),updateEnd:Re()}}function W1(e,n){const o=Y1();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 q1(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=He();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=M1(a)?a.sourceEvent:a,{x:c,y:d}=Pt(s,l),u=jo({x:c,y:d},e.value),{x:m,y:f}=o.value?ia(u,n.value):u;return{xSnapped:m,ySnapped:f,...u}}}function ra(){return!0}function Nu({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:f,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:g,findNode:_,panBy:b,startConnection:N,updateConnection:h,endConnection:E,emits:D,viewport:$,edges:H,nodes:j,isValidConnection:v,nodeLookup:T}=He();let F=null,I=!1,le=null;function k(C){var W;const ee=t.toValue(o)==="target",ae=Wr(C),L=Gd(C.target),U=C.currentTarget;if(U&&(ae&&C.button===0||!ae)){let ne=function(we){G=Pt(we,pe),me=P1(jo(G,$.value,!1,[1,1]),u.value,T.value,oe),O||(Z(),O=!0);const Se=du(we,{handle:me,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:ee?"target":"source",isValidConnection:se,doc:L,lib:"vue",flowId:s,nodeLookup:T.value},H.value,j.value,_,T.value);le=Se.handleDomNode,F=Se.connection,I=U1(!!me,Se.isValid);const Ce={...he,isValid:I,to:Se.toHandle&&I?Go({x:Se.toHandle.x,y:Se.toHandle.y},$.value):G,toHandle:Se.toHandle,toPosition:I&&Se.toHandle?Se.toHandle.position:Xr[oe.position],toNode:Se.toHandle?T.value.get(Se.toHandle.nodeId):null};if(I&&me&&(he!=null&&he.toHandle)&&Ce.toHandle&&he.toHandle.type===Ce.toHandle.type&&he.toHandle.nodeId===Ce.toHandle.nodeId&&he.toHandle.id===Ce.toHandle.id&&he.to.x===Ce.to.x&&he.to.y===Ce.to.y)return;const Pe=me??Se.toHandle;if(h(Pe&&I?Go({x:Pe.x,y:Pe.y},$.value):G,Pe,z1(!!Pe,I)),he=Ce,!me&&!I&&!le)return qr(ve);F&&F.source!==F.target&&le&&(qr(ve),ve=le,le.classList.add("connecting","vue-flow__handle-connecting"),le.classList.toggle("valid",!!I),le.classList.toggle("vue-flow__handle-valid",!!I))},ue=function(we){"touches"in we&&we.touches.length>0||((me||le)&&F&&I&&(r?r(we,F):D.connect(F)),D.connectEnd(we),a&&(l==null||l(we)),qr(ve),cancelAnimationFrame(_e),E(we),O=!1,I=!1,F=null,le=null,L.removeEventListener("mousemove",ne),L.removeEventListener("mouseup",ue),L.removeEventListener("touchmove",ne),L.removeEventListener("touchend",ue))};const Ne=_(t.toValue(n));let se=t.toValue(i)||v.value||ra;!se&&Ne&&(se=(ee?Ne.isValidSourcePos:Ne.isValidTargetPos)||ra);let me,_e=0;const{x:Ie,y:Ve}=Pt(C),Te=uu(t.toValue(a),U),pe=(W=c.value)==null?void 0:W.getBoundingClientRect();if(!pe||!Te)return;const ke=mu(t.toValue(n),Te,t.toValue(e),T.value,d.value);if(!ke)return;let ve,G=Pt(C,pe),O=!1;const Z=()=>{if(!y.value)return;const[we,Se]=eu(G,pe,g.value);b({x:we,y:Se}),_e=requestAnimationFrame(Z)},oe={...ke,nodeId:t.toValue(n),type:Te,position:ke.position},R=T.value.get(t.toValue(n)),K={inProgress:!0,isValid:null,from:oo(R,oe,Ae.Left,!0),fromHandle:oe,fromPosition:oe.position,fromNode:R,to:G,toHandle:null,toPosition:Xr[oe.position],toNode:null};N({nodeId:t.toValue(n),id:t.toValue(e),type:Te,position:(U==null?void 0:U.getAttribute("data-handlepos"))||Ae.Top,...G},{x:Ie-pe.left,y:Ve-pe.top}),D.connectStart({event:C,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:Te});let he=K;L.addEventListener("mousemove",ne),L.addEventListener("mouseup",ue),L.addEventListener("touchmove",ne),L.addEventListener("touchend",ue)}}function Y(C){var W,ee;if(!m.value)return;const ae=t.toValue(o)==="target";if(!f.value){D.clickConnectStart({event:C,nodeId:t.toValue(n),handleId:t.toValue(e)}),N({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Ae.Top,...Pt(C)},void 0,!0);return}let L=t.toValue(i)||v.value||ra;const U=_(t.toValue(n));if(!L&&U&&(L=(ae?U.isValidSourcePos:U.isValidTargetPos)||ra),U&&(typeof U.connectable>"u"?p.value:U.connectable)===!1)return;const ne=Gd(C.target),ue=du(C,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Ae.Top,...Pt(C)},connectionMode:d.value,fromNodeId:f.value.nodeId,fromHandleId:f.value.id??null,fromType:f.value.type,isValidConnection:L,doc:ne,lib:"vue",flowId:s,nodeLookup:T.value},H.value,j.value,_,T.value),Ne=((W=ue.connection)==null?void 0:W.source)===((ee=ue.connection)==null?void 0:ee.target);ue.isValid&&ue.connection&&!Ne&&D.connect(ue.connection),D.clickConnectEnd(C),E(C,!0)}return{handlePointerDown:k,handleClick:Y}}function X1(){return t.inject(_u,"")}function wu(e){const n=e??X1()??"",o=t.inject(Eu,t.ref(null)),{findNode:i,edges:a,emits:r}=He(),l=i(n);return l||r.error(new it(et.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>In([l],a.value))}}function J1(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),dragStart:Re(),drag:Re(),dragStop:Re()}}function Z1(e,n){const o=J1();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 vu(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=He();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,f=d?4:1,p=c.x*u*f,y=c.y*m*f,g=[];for(const _ of e.value)if(_.draggable||l&&typeof _.draggable>"u"){const b={x:_.computedPosition.x+p,y:_.computedPosition.y+y},{position:N}=Yr(_,b,s.error,n.value,_.parentNode?i(_.parentNode):void 0);g.push({id:_.id,position:N,from:_.position,distance:{x:c.x,y:c.y},dimensions:_.dimensions})}o(g,!0,!1)}}const la=.1,Q1=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function rn(){return Wo("Viewport not initialized yet."),Promise.resolve(!1)}const e0={zoomIn:rn,zoomOut:rn,zoomTo:rn,fitView:rn,setCenter:rn,fitBounds:rn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:rn,setTransform:rn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function t0(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Bo:Hi).scaleBy(el(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}=Hd({x:-i,y:-a},e.translateExtent),m=eo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?Bo:Hi).transform(el(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"?Bo:Hi).scaleTo(el(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:la,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!f.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(f.id))&&s.push(f);if(!s.length)return Promise.resolve(!1);const c=Hr(s),{x:d,y:u,zoom:m}=Jd(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??la);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:la})=>{const{x:l,y:s,zoom:c}=Jd(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??la);return o(l,s,c,r)},project:a=>jo(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 jo(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 Go(s,e.viewport)}return{x:0,y:0}}}:e0)}function el(e,n=0,o=Q1,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function n0(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,_,b=!!(o.nodes.value.length||o.edges.value.length);g=qn([e.modelValue,()=>{var N,h;return(h=(N=e.modelValue)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setElements(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,h])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...N,...h],t.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},r=()=>{i.run(()=>{let g,_,b=!!o.nodes.value.length;g=qn([e.nodes,()=>{var N,h;return(h=(N=e.nodes)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setNodes(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.nodes,()=>o.nodes.value.length],([N])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...N],t.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},l=()=>{i.run(()=>{let g,_,b=!!o.edges.value.length;g=qn([e.edges,()=>{var N,h;return(h=(N=e.edges)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setEdges(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.edges,()=>o.edges.value.length],([N])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...N],t.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&tt(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&tt(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&tt(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&tt(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{tt(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},f=()=>{i.run(()=>{const g=async _=>{let b=_;typeof n.autoConnect=="function"&&(b=await n.autoConnect(_)),b!==!1&&o.addEdges([b])};t.watch(()=>n.autoConnect,()=>{tt(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(_,b,N)=>{_?o.onConnect(g):o.hooks.value.connect.off(g),N(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},p=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const _ of Object.keys(n)){const b=_;if(!g.includes(b)){const N=t.toRef(()=>n[b]),h=o[b];t.isRef(h)&&i.run(()=>{t.watch(N,E=>{tt(E)&&(h.value=E)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),f(),p()})()}),()=>i.stop()}function o0(){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=>Wo(e.message))}}function i0(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),$o(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),$o(r.removeHasEmitListeners)}});function i(a){var r;const l=a0(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function a0(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function xu(){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:zr.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Uo.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:wn.Bezier,style:{}},connectionMode:Yt.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:Yo()?"Meta":"Control",zoomActivationKeyCode:Yo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:o0(),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 r0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function l0(e,n,o){const i=t0(e),a=G=>{const O=G??[];e.hooks.updateNodeInternals.trigger(O)},r=G=>N1(G,e.nodes,e.edges),l=G=>k1(G,e.nodes,e.edges),s=G=>In(G,e.edges),c=({id:G,type:O,nodeId:Z})=>{var oe;const R=G?`-${O}-${G}`:`-${O}`;return Array.from(((oe=e.connectionLookup.get(`${Z}${R}`))==null?void 0:oe.values())??[])},d=G=>{if(G)return n.value.get(G)},u=G=>{if(G)return o.value.get(G)},m=(G,O,Z)=>{var oe,R;const A=[];for(const K of G){const he={id:K.id,type:"position",dragging:Z,from:K.from};if(O&&(he.position=K.position,K.parentNode)){const we=d(K.parentNode);he.position={x:he.position.x-(((oe=we==null?void 0:we.computedPosition)==null?void 0:oe.x)??0),y:he.position.y-(((R=we==null?void 0:we.computedPosition)==null?void 0:R.y)??0)}}A.push(he)}A!=null&&A.length&&e.hooks.nodesChange.trigger(A)},f=G=>{if(!e.vueFlowRef)return;const O=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!O)return;const Z=window.getComputedStyle(O),{m22:oe}=new window.DOMMatrixReadOnly(Z.transform),R=[];for(const A of G){const K=A,he=d(K.id);if(he){const we=ta(K.nodeElement);if(!!(we.width&&we.height&&(he.dimensions.width!==we.width||he.dimensions.height!==we.height||K.forceUpdate))){const Ce=K.nodeElement.getBoundingClientRect();he.dimensions=we,he.handleBounds.source=pu("source",K.nodeElement,Ce,oe,he.id),he.handleBounds.target=pu("target",K.nodeElement,Ce,oe,he.id),R.push({id:he.id,type:"dimensions",dimensions:we})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),R.length&&e.hooks.nodesChange.trigger(R)},p=(G,O)=>{const Z=new Set,oe=new Set;for(const K of G)xn(K)?Z.add(K.id):nn(K)&&oe.add(K.id);const R=an(n.value,Z,!0),A=an(o.value,oe);if(e.multiSelectionActive){for(const K of Z)R.push(on(K,O));for(const K of oe)A.push(on(K,O))}R.length&&e.hooks.nodesChange.trigger(R),A.length&&e.hooks.edgesChange.trigger(A)},y=G=>{if(e.multiSelectionActive){const O=G.map(Z=>on(Z.id,!0));e.hooks.nodesChange.trigger(O);return}e.hooks.nodesChange.trigger(an(n.value,new Set(G.map(O=>O.id)),!0)),e.hooks.edgesChange.trigger(an(o.value))},g=G=>{if(e.multiSelectionActive){const O=G.map(Z=>on(Z.id,!0));e.hooks.edgesChange.trigger(O);return}e.hooks.edgesChange.trigger(an(o.value,new Set(G.map(O=>O.id)))),e.hooks.nodesChange.trigger(an(n.value,new Set,!0))},_=G=>{p(G,!0)},b=G=>{const Z=(G||e.nodes).map(oe=>(oe.selected=!1,on(oe.id,!1)));e.hooks.nodesChange.trigger(Z)},N=G=>{const Z=(G||e.edges).map(oe=>(oe.selected=!1,on(oe.id,!1)));e.hooks.edgesChange.trigger(Z)},h=G=>{if(!G||!G.length)return p([],!1);const O=G.reduce((Z,oe)=>{const R=on(oe.id,!1);return xn(oe)?Z.nodes.push(R):Z.edges.push(R),Z},{nodes:[],edges:[]});O.nodes.length&&e.hooks.nodesChange.trigger(O.nodes),O.edges.length&&e.hooks.edgesChange.trigger(O.edges)},E=G=>{var O;(O=e.d3Zoom)==null||O.scaleExtent([G,e.maxZoom]),e.minZoom=G},D=G=>{var O;(O=e.d3Zoom)==null||O.scaleExtent([e.minZoom,G]),e.maxZoom=G},$=G=>{var O;(O=e.d3Zoom)==null||O.translateExtent(G),e.translateExtent=G},H=G=>{e.nodeExtent=G,a()},j=G=>{var O;(O=e.d3Zoom)==null||O.clickDistance(G)},v=G=>{e.nodesDraggable=G,e.nodesConnectable=G,e.elementsSelectable=G},T=G=>{const O=G instanceof Function?G(e.nodes):G;!e.initialized&&!O.length||(e.nodes=hu(O,d,e.hooks.error.trigger))},F=G=>{const O=G instanceof Function?G(e.edges):G;if(!e.initialized&&!O.length)return;const Z=Qr(O,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Zr(e.connectionLookup,o.value,Z),e.edges=Z},I=G=>{const O=G instanceof Function?G([...e.nodes,...e.edges]):G;!e.initialized&&!O.length||(T(O.filter(xn)),F(O.filter(nn)))},le=G=>{let O=G instanceof Function?G(e.nodes):G;O=Array.isArray(O)?O:[O];const Z=hu(O,d,e.hooks.error.trigger),oe=[];for(const R of Z)oe.push(nu(R));oe.length&&e.hooks.nodesChange.trigger(oe)},k=G=>{let O=G instanceof Function?G(e.edges):G;O=Array.isArray(O)?O:[O];const Z=Qr(O,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),oe=[];for(const R of Z)oe.push(nu(R));oe.length&&e.hooks.edgesChange.trigger(oe)},Y=(G,O=!0,Z=!1)=>{const oe=G instanceof Function?G(e.nodes):G,R=Array.isArray(oe)?oe:[oe],A=[],K=[];function he(Se){const Ce=s(Se);for(const Pe of Ce)(!tt(Pe.deletable)||Pe.deletable)&&K.push(iu(Pe.id,Pe.source,Pe.target,Pe.sourceHandle,Pe.targetHandle))}function we(Se){const Ce=[];for(const Pe of e.nodes)Pe.parentNode===Se&&Ce.push(Pe);if(Ce.length){for(const Pe of Ce)A.push(ou(Pe.id));O&&he(Ce);for(const Pe of Ce)we(Pe.id)}}for(const Se of R){const Ce=typeof Se=="string"?d(Se):Se;Ce&&(tt(Ce.deletable)&&!Ce.deletable||(A.push(ou(Ce.id)),O&&he([Ce]),Z&&we(Ce.id)))}K.length&&e.hooks.edgesChange.trigger(K),A.length&&e.hooks.nodesChange.trigger(A)},C=G=>{const O=G instanceof Function?G(e.edges):G,Z=Array.isArray(O)?O:[O],oe=[];for(const R of Z){const A=typeof R=="string"?u(R):R;A&&(tt(A.deletable)&&!A.deletable||oe.push(iu(typeof R=="string"?R:R.id,A.source,A.target,A.sourceHandle,A.targetHandle)))}e.hooks.edgesChange.trigger(oe)},W=(G,O,Z=!0)=>{const oe=u(G.id);if(!oe)return!1;const R=e.edges.indexOf(oe),A=G1(G,O,oe,Z,e.hooks.error.trigger);if(A){const[K]=Qr([A],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((he,we)=>we===R?K:he),Zr(e.connectionLookup,o.value,[K]),K}return!1},ee=(G,O,Z={replace:!1})=>{const oe=u(G);if(!oe)return;const R=typeof O=="function"?O(oe):O;oe.data=Z.replace?R:{...oe.data,...R}},ae=G=>tu(G,e.nodes),L=G=>{const O=tu(G,e.edges);return Zr(e.connectionLookup,o.value,O),O},U=(G,O,Z={replace:!1})=>{const oe=d(G);if(!oe)return;const R=typeof O=="function"?O(oe):O;Z.replace?e.nodes.splice(e.nodes.indexOf(oe),1,R):Object.assign(oe,R)},ne=(G,O,Z={replace:!1})=>{const oe=d(G);if(!oe)return;const R=typeof O=="function"?O(oe):O;oe.data=Z.replace?R:{...oe.data,...R}},ue=(G,O,Z=!1)=>{Z?e.connectionClickStartHandle=G:e.connectionStartHandle=G,e.connectionEndHandle=null,e.connectionStatus=null,O&&(e.connectionPosition=O)},Ne=(G,O=null,Z=null)=>{e.connectionStartHandle&&(e.connectionPosition=G,e.connectionEndHandle=O,e.connectionStatus=Z)},se=(G,O)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,O?e.connectionClickStartHandle=null:e.connectionStartHandle=null},me=G=>{const O=_1(G),Z=O?null:Ho(G)?G:d(G.id);return!O&&!Z?[null,null,O]:[O?G:Qi(Z),Z,O]},_e=(G,O=!0,Z=e.nodes)=>{const[oe,R,A]=me(G);if(!oe)return[];const K=[];for(const he of Z||e.nodes){if(!A&&(he.id===R.id||!he.computedPosition))continue;const we=Qi(he),Se=ea(we,oe);(O&&Se>0||Se>=we.width*we.height||Se>=Number(oe.width)*Number(oe.height))&&K.push(he)}return K},Ie=(G,O,Z=!0)=>{const[oe]=me(G);if(!oe)return!1;const R=ea(oe,O);return Z&&R>0||R>=Number(oe.width)*Number(oe.height)},Ve=G=>{const{viewport:O,dimensions:Z,d3Zoom:oe,d3Selection:R,translateExtent:A}=e;if(!oe||!R||!G.x&&!G.y)return!1;const K=eo.translate(O.x+G.x,O.y+G.y).scale(O.zoom),he=[[0,0],[Z.width,Z.height]],we=oe.constrain()(K,he,A),Se=e.viewport.x!==we.x||e.viewport.y!==we.y||e.viewport.zoom!==we.k;return oe.transform(R,we),Se},Te=G=>{const O=G instanceof Function?G(e):G,Z=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];tt(O.defaultEdgeOptions)&&(e.defaultEdgeOptions=O.defaultEdgeOptions);const oe=O.modelValue||O.nodes||O.edges?[]:void 0;oe&&(O.modelValue&&oe.push(...O.modelValue),O.nodes&&oe.push(...O.nodes),O.edges&&oe.push(...O.edges),I(oe));const R=()=>{tt(O.maxZoom)&&D(O.maxZoom),tt(O.minZoom)&&E(O.minZoom),tt(O.translateExtent)&&$(O.translateExtent)};for(const A of Object.keys(O)){const K=A,he=O[K];![...r0,...Z].includes(K)&&tt(he)&&(e[K]=he)}_r(()=>e.d3Zoom).not.toBeNull().then(R),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:f,setElements:I,setNodes:T,setEdges:F,addNodes:le,addEdges:k,removeNodes:Y,removeEdges:C,findNode:d,findEdge:u,updateEdge:W,updateEdgeData:ee,updateNode:U,updateNodeData:ne,applyEdgeChanges:L,applyNodeChanges:ae,addSelectedElements:_,addSelectedNodes:y,addSelectedEdges:g,setMinZoom:E,setMaxZoom:D,setTranslateExtent:$,setNodeExtent:H,setPaneClickDistance:j,removeSelectedElements:h,removeSelectedNodes:b,removeSelectedEdges:N,startConnection:ue,updateConnection:Ne,endConnection:se,setInteractive:v,setState:Te,getIntersectingNodes:_e,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ie,panBy:Ve,fitView:G=>i.value.fitView(G),zoomIn:G=>i.value.zoomIn(G),zoomOut:G=>i.value.zoomOut(G),zoomTo:(G,O)=>i.value.zoomTo(G,O),setViewport:(G,O)=>i.value.setViewport(G,O),setTransform:(G,O)=>i.value.setTransform(G,O),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(G,O,Z)=>i.value.setCenter(G,O,Z),fitBounds:(G,O)=>i.value.fitBounds(G,O),project:G=>i.value.project(G),screenToFlowCoordinate:G=>i.value.screenToFlowCoordinate(G),flowToScreenCoordinate:G=>i.value.flowToScreenCoordinate(G),toObject:()=>{const G=[],O=[];for(const Z of e.nodes){const{computedPosition:oe,handleBounds:R,selected:A,dimensions:K,isParent:he,resizing:we,dragging:Se,events:Ce,...Pe}=Z;G.push(Pe)}for(const Z of e.edges){const{selected:oe,sourceNode:R,targetNode:A,events:K,...he}=Z;O.push(he)}return JSON.parse(JSON.stringify({nodes:G,edges:O,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:G=>new Promise(O=>{const{nodes:Z,edges:oe,position:R,zoom:A,viewport:K}=G;Z&&T(Z),oe&&F(oe);const[he,we]=K!=null&&K.x&&(K!=null&&K.y)?[K.x,K.y]:R??[null,null];if(he&&we){const Se=(K==null?void 0:K.zoom)||A||e.viewport.zoom;return _r(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:he,y:we,zoom:Se}).then(()=>{O(!0)})})}else O(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const G=xu();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const O=eo.translate(G.defaultViewport.x??0,G.defaultViewport.y??0).scale(vn(G.defaultViewport.zoom??1,G.minZoom,G.maxZoom)),Z=e.viewportRef.getBoundingClientRect(),oe=[[0,0],[Z.width,Z.height]],R=e.d3Zoom.constrain()(O,oe,G.translateExtent);e.d3Zoom.transform(e.d3Selection,R)}Te(G)},$destroy:()=>{}}}const s0=["data-id","data-handleid","data-nodeid","data-handlepos"],c0={name:"Handle",compatConfig:{MODE:3}},Cn=t.defineComponent({...c0,props:{id:{default:null},type:{},position:{default:()=>Ae.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:f}=He(),{id:p,node:y,nodeEl:g,connectedEdges:_}=wu(),b=t.ref(),N=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),E=t.toRef(()=>{var F,I,le,k,Y,C;return((F=l.value)==null?void 0:F.nodeId)===p&&((I=l.value)==null?void 0:I.id)===e.id&&((le=l.value)==null?void 0:le.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===p&&((Y=c.value)==null?void 0:Y.id)===e.id&&((C=c.value)==null?void 0:C.type)===i.value}),D=t.toRef(()=>{var F,I,le;return((F=s.value)==null?void 0:F.nodeId)===p&&((I=s.value)==null?void 0:I.id)===e.id&&((le=s.value)==null?void 0:le.type)===i.value}),{handlePointerDown:$,handleClick:H}=Nu({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),j=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(F=>{const I=F[`${i.value}Handle`];return F[i.value]!==p?!1:I?I===e.id:!0}):typeof e.connectable=="number"?_.value.filter(F=>{const I=F[`${i.value}Handle`];return F[i.value]!==p?!1:I?I===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,_.value):tt(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var F;if(!y.dimensions.width||!y.dimensions.height)return;const I=(F=y.handleBounds[i.value])==null?void 0:F.find(ae=>ae.id===e.id);if(!d.value||I)return;const le=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!b.value||!le||!e.id)return;const k=g.value.getBoundingClientRect(),Y=b.value.getBoundingClientRect(),C=window.getComputedStyle(le),{m22:W}=new window.DOMMatrixReadOnly(C.transform),ee={id:e.id,position:e.position,x:(Y.left-k.left)/W,y:(Y.top-k.top)/W,type:i.value,nodeId:p,...ta(b.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],ee]});function v(F){const I=Wr(F);j.value&&N.value&&(I&&F.button===0||!I)&&$(F)}function T(F){!p||!s.value&&!N.value||j.value&&H(F)}return n({handleClick:H,handlePointerDown:$,onClick:T,onPointerDown:v}),(F,I)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${t.unref(r)}-${t.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(p),"data-handlepos":F.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${F.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(f),i.value,{connectable:j.value,connecting:D.value,connectablestart:N.value,connectableend:h.value,connectionindicator:j.value&&(N.value&&!E.value||h.value&&E.value)}]]),onMousedown:v,onTouchstartPassive:v,onClick:T},[t.renderSlot(F.$slots,"default",{id:F.id})],42,s0))}}),sa=function({sourcePosition:e=Ae.Bottom,targetPosition:n=Ae.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Cn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Cn,{type:"source",position:e,connectable:i,isValidConnection:r})]};sa.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],sa.inheritAttrs=!1,sa.compatConfig={MODE:3};const d0=sa,ca=function({targetPosition:e=Ae.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Cn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};ca.props=["targetPosition","label","isValidTargetPos","connectable","data"],ca.inheritAttrs=!1,ca.compatConfig={MODE:3};const u0=ca,da=function({sourcePosition:e=Ae.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(Cn,{type:"source",position:e,connectable:o,isValidConnection:i})]};da.props=["sourcePosition","label","isValidSourcePos","connectable","data"],da.inheritAttrs=!1,da.compatConfig={MODE:3};const m0=da,f0=["transform"],p0=["width","height","x","y","rx","ry"],h0=["y"],y0={name:"EdgeText",compatConfig:{MODE:3}},g0=t.defineComponent({...y0,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,p0)):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,h0)],8,f0))}}),b0=["id","d","marker-end","marker-start"],_0=["d","stroke-width"],E0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ua=t.defineComponent({...E0,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,b0),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,_0)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(g0,{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 Iu({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 Cu({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 ma(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Su({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Ae.Left:l=n-ma(n-i,r),s=o;break;case Ae.Right:l=n+ma(i-n,r),s=o;break;case Ae.Top:l=n,s=o-ma(o-a,r);break;case Ae.Bottom:l=n,s=o+ma(a-o,r);break}return[l,s]}function $u(e){const{sourceX:n,sourceY:o,sourcePosition:i=Ae.Bottom,targetX:a,targetY:r,targetPosition:l=Ae.Top,curvature:s=.25}=e,[c,d]=Su({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=Su({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[f,p,y,g]=Cu({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}`,f,p,y,g]}function Ru({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Ae.Left:case Ae.Right:r=.5*(n+i),l=o;break;case Ae.Top:case Ae.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Au(e){const{sourceX:n,sourceY:o,sourcePosition:i=Ae.Bottom,targetX:a,targetY:r,targetPosition:l=Ae.Top}=e,[s,c]=Ru({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=Ru({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,f,p,y]=Cu({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,f,p,y]}const Tu={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}};function k0({source:e,sourcePosition:n=Ae.Bottom,target:o}){return n===Ae.Left||n===Ae.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 Vu(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function N0({source:e,sourcePosition:n=Ae.Bottom,target:o,targetPosition:i=Ae.Top,center:a,offset:r}){const l=Tu[n],s=Tu[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=k0({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",f=u[m];let p,y,g;const _={x:0,y:0},b={x:0,y:0},[N,h,E,D]=Iu({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??N,g=a.y??h;const H=[{x:y,y:c.y},{x:y,y:d.y}],j=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===f?p=m==="x"?H:j:p=m==="x"?j:H}else{const H=[{x:c.x,y:d.y}],j=[{x:d.x,y:c.y}];if(m==="x"?p=l.x===f?j:H:p=l.y===f?H:j,n===i){const le=Math.abs(e[m]-o[m]);if(le<=r){const k=Math.min(r-1,r-le);l[m]===f?_[m]=(c[m]>e[m]?-1:1)*k:b[m]=(d[m]>o[m]?-1:1)*k}}if(n!==i){const le=m==="x"?"y":"x",k=l[m]===s[le],Y=c[le]>d[le],C=c[le]<d[le];(l[m]===1&&(!k&&Y||k&&C)||l[m]!==1&&(!k&&C||k&&Y))&&(p=m==="x"?H:j)}const v={x:c.x+_.x,y:c.y+_.y},T={x:d.x+b.x,y:d.y+b.y},F=Math.max(Math.abs(v.x-p[0].x),Math.abs(T.x-p[0].x)),I=Math.max(Math.abs(v.y-p[0].y),Math.abs(T.y-p[0].y));F>=I?(y=(v.x+T.x)/2,g=p[0].y):(y=p[0].x,g=(v.y+T.y)/2)}return[[e,{x:c.x+_.x,y:c.y+_.y},...p,{x:d.x+b.x,y:d.y+b.y},o],y,g,E,D]}function w0(e,n,o,i){const a=Math.min(Vu(e,n)/2,Vu(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 tl(e){const{sourceX:n,sourceY:o,sourcePosition:i=Ae.Bottom,targetX:a,targetY:r,targetPosition:l=Ae.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,f,p,y,g]=N0({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((b,N,h)=>{let E;return h>0&&h<m.length-1?E=w0(m[h-1],N,m[h+1],s):E=`${h===0?"M":"L"}${N.x} ${N.y}`,b+=E,b},""),f,p,y,g]}function v0(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Iu({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const x0=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]=v0(e);return t.h(ua,{path:o,labelX:i,labelY:a,...n,...e})}}}),Mu=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]=tl({...e,sourcePosition:e.sourcePosition??Ae.Bottom,targetPosition:e.targetPosition??Ae.Top});return t.h(ua,{path:o,labelX:i,labelY:a,...n,...e})}}}),I0=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(Mu,{...e,...n,borderRadius:0})}}),C0=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]=$u({...e,sourcePosition:e.sourcePosition??Ae.Bottom,targetPosition:e.targetPosition??Ae.Top});return t.h(ua,{path:o,labelX:i,labelY:a,...n,...e})}}}),S0=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]=Au({...e,sourcePosition:e.sourcePosition??Ae.Bottom,targetPosition:e.targetPosition??Ae.Top});return t.h(ua,{path:o,labelX:i,labelY:a,...n,...e})}}}),$0={input:m0,default:d0,output:u0},R0={default:C0,straight:x0,step:I0,smoothstep:Mu,simplebezier:S0};function A0(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={...R0,...e.edgeTypes},_=Object.keys(g);for(const b of e.edges)b.type&&!_.includes(b.type)&&(g[b.type]=b.type);return g}),l=t.computed(()=>{const g={...$0,...e.nodeTypes},_=Object.keys(g);for(const b of e.nodes)b.type&&!_.includes(b.type)&&(g[b.type]=b.type);return g}),s=t.computed(()=>e.onlyRenderVisibleElements?Xd(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const _ of e.edges){const b=n.value.get(_.source),N=n.value.get(_.target);T1({sourcePos:b.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(_)}return g}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const g=[];for(const _ of e.nodes)_.selected&&g.push(_);return g}),m=t.computed(()=>{const g=[];for(const _ of e.edges)_.selected&&g.push(_);return g}),f=t.computed(()=>[...u.value,...m.value]),p=t.computed(()=>{const g=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&_.handleBounds!==void 0&&g.push(_);return g}),y=t.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:p,areNodesInitialized:y}}class Sn{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)??Sn.instance;return Sn.instance=i??new Sn,o&&(o.config.globalProperties.$vueFlowStorage=Sn.instance),Sn.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=xu(),a=t.reactive(i),r={};for(const[f,p]of Object.entries(a.hooks)){const y=`on${f.charAt(0).toUpperCase()+f.slice(1)}`;r[y]=p.on}const l={};for(const[f,p]of Object.entries(a.hooks))l[f]=p.trigger;const s=t.computed(()=>{const f=new Map;for(const p of a.nodes)f.set(p.id,p);return f}),c=t.computed(()=>{const f=new Map;for(const p of a.edges)f.set(p.id,p);return f}),d=A0(a,s,c),u=l0(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...Sy(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 He(e){const n=Sn.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(bu,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,f,p)=>{const y=_=>{d.applyNodeChanges(_)},g=_=>{d.applyEdgeChanges(_)};m?(d.onNodesChange(y),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),$o(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Wo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(bu,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new it(et.USEVUEFLOW_OPTIONS))}return s}function T0(e){const{emits:n,dimensions:o}=He();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=ta(e.value);(s.width===0||s.height===0)&&n.error(new it(et.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 V0={name:"UserSelection",compatConfig:{MODE:3}},M0=t.defineComponent({...V0,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))}}),B0=["tabIndex"],D0={name:"NodesSelection",compatConfig:{MODE:3}},O0=t.defineComponent({...D0,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=He(),s=vu(),c=t.ref(null),d=ku({el:c,onStart(y){n.selectionDragStart(y),n.nodeDragStart(y)},onDrag(y){n.selectionDrag(y),n.nodeDrag(y)},onStop(y){n.selectionDragStop(y),n.nodeDragStop(y)}});t.onMounted(()=>{var y;r.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=t.computed(()=>Hr(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 f(y){n.selectionContextMenu({event:y,nodes:i.value})}function p(y){r.value||to[y.key]&&(y.preventDefault(),s({x:to[y.key].x,y:to[y.key].y},y.shiftKey))}return(y,g)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:f,onKeydown:p},null,46,B0)],6)):t.createCommentVNode("",!0)}});function L0(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const P0={name:"Pane",compatConfig:{MODE:3}},z0=t.defineComponent({...P0,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:f,removeEdges:p,selectionMode:y,deleteKeyCode:g,multiSelectionKeyCode:_,multiSelectionActive:b,edgeLookup:N,nodeLookup:h,connectionLookup:E,defaultEdgeOptions:D,connectionStartHandle:$,panOnDrag:H}=He(),j=t.shallowRef(null),v=t.shallowRef(new Set),T=t.shallowRef(new Set),F=t.shallowRef(null),I=t.toRef(()=>c.value&&(e.isSelecting||r.value)),le=t.toRef(()=>$.value!==null);let k=!1,Y=!1;const C=Fo(g,{actInsideInputWithModifier:!1}),W=Fo(_);t.watch(C,se=>{se&&(f(m.value),p(u.value),d.value=!1)}),t.watch(W,se=>{b.value=se});function ee(se,me){return _e=>{_e.target===me&&(se==null||se(_e))}}function ae(se){if(k||le.value){k=!1;return}a.paneClick(se),l(),d.value=!1}function L(se){var me;if(Array.isArray(H.value)&&((me=H.value)!=null&&me.includes(2))){se.preventDefault();return}a.paneContextMenu(se)}function U(se){a.paneScroll(se)}function ne(se){var me,_e,Ie;if(F.value=((me=n.value)==null?void 0:me.getBoundingClientRect())??null,!c.value||!e.isSelecting||se.button!==0||se.target!==j.value||!F.value)return;(Ie=(_e=se.target)==null?void 0:_e.setPointerCapture)==null||Ie.call(_e,se.pointerId);const{x:Ve,y:Te}=L0(se,F.value);Y=!0,k=!1,l(),s.value={width:0,height:0,startX:Ve,startY:Te,x:Ve,y:Te},a.selectionStart(se)}function ue(se){var me;if(!F.value||!s.value)return;k=!0;const{x:_e,y:Ie}=Pt(se,F.value),{startX:Ve=0,startY:Te=0}=s.value,pe={startX:Ve,startY:Te,x:_e<Ve?_e:Ve,y:Ie<Te?Ie:Te,width:Math.abs(_e-Ve),height:Math.abs(Ie-Te)},ke=v.value,ve=T.value;v.value=new Set(Xd(o.value,pe,i.value,y.value===zr.Partial,!0).map(O=>O.id)),T.value=new Set;const G=((me=D.value)==null?void 0:me.selectable)??!0;for(const O of v.value){const Z=E.value.get(O);if(Z)for(const{edgeId:oe}of Z.values()){const R=N.value.get(oe);R&&(R.selectable??G)&&T.value.add(oe)}}if(!gu(ke,v.value)){const O=an(h.value,v.value,!0);a.nodesChange(O)}if(!gu(ve,T.value)){const O=an(N.value,T.value);a.edgesChange(O)}s.value=pe,r.value=!0,d.value=!1}function Ne(se){var me;se.button!==0||!Y||((me=se.target)==null||me.releasePointerCapture(se.pointerId),!r.value&&s.value&&se.target===j.value&&ae(se),r.value=!1,s.value=null,d.value=v.value.size>0,a.selectionEnd(se),e.selectionKeyPressed&&(k=!1),Y=!1)}return(se,me)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:j,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:se.isSelecting}]),onClick:me[0]||(me[0]=_e=>I.value?void 0:ee(ae,j.value)(_e)),onContextmenu:me[1]||(me[1]=_e=>ee(L,j.value)(_e)),onWheelPassive:me[2]||(me[2]=_e=>ee(U,j.value)(_e)),onPointerenter:me[3]||(me[3]=_e=>I.value?void 0:t.unref(a).paneMouseEnter(_e)),onPointerdown:me[4]||(me[4]=_e=>I.value?ne(_e):t.unref(a).paneMouseMove(_e)),onPointermove:me[5]||(me[5]=_e=>I.value?ue(_e):t.unref(a).paneMouseMove(_e)),onPointerup:me[6]||(me[6]=_e=>I.value?Ne(_e):void 0),onPointerleave:me[7]||(me[7]=_e=>t.unref(a).paneMouseLeave(_e))},[t.renderSlot(se.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(M0,{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(O0,{key:1})):t.createCommentVNode("",!0)],34))}}),U0={name:"Transform",compatConfig:{MODE:3}},F0=t.defineComponent({...U0,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=He(),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))}}),H0={name:"Viewport",compatConfig:{MODE:3}},G0=t.defineComponent({...H0,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:f,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:g,noWheelClassName:_,noPanClassName:b,emits:N,connectionStartHandle:h,userSelectionActive:E,paneDragging:D,d3Zoom:$,d3Selection:H,d3ZoomHandler:j,viewport:v,viewportRef:T,paneClickDistance:F}=He();T0(T);const I=t.shallowRef(!1),le=t.shallowRef(!1);let k=null,Y=!1,C=0,W={x:0,y:0,zoom:0};const ee=Fo(s),ae=Fo(l),L=Fo(r),U=t.toRef(()=>(!ae.value||ae.value&&l.value===!0)&&(ee.value||m.value)),ne=t.toRef(()=>ee.value||c.value),ue=t.toRef(()=>l.value===!0&&U.value!==!0),Ne=t.toRef(()=>ae.value&&l.value!==!0||E.value||ue.value),se=t.toRef(()=>h.value!==null);t.onMounted(()=>{if(!T.value){Wo("Viewport element is missing");return}const Te=T.value,pe=Te.getBoundingClientRect(),ke=m1().clickDistance(F.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ve=vt(Te).call(ke),G=ve.on("wheel.zoom"),O=eo.translate(i.value.x??0,i.value.y??0).scale(vn(i.value.zoom??1,n.value,o.value)),Z=[[0,0],[pe.width,pe.height]],oe=ke.constrain()(O,Z,a.value);ke.transform(ve,oe),ke.wheelDelta(Gr),$.value=ke,H.value=ve,j.value=G,v.value={x:oe.x,y:oe.y,zoom:oe.k},ke.on("start",R=>{var A;if(!R.sourceEvent)return null;C=R.sourceEvent.button,I.value=!0;const K=Ie(R.transform);((A=R.sourceEvent)==null?void 0:A.type)==="mousedown"&&(D.value=!0),W=K,N.viewportChangeStart(K),N.moveStart({event:R,flowTransform:K})}),ke.on("end",R=>{if(!R.sourceEvent)return null;if(I.value=!1,D.value=!1,me(U.value,C??0)&&!Y&&N.paneContextMenu(R.sourceEvent),Y=!1,_e(W,R.transform)){const A=Ie(R.transform);W=A,N.viewportChangeEnd(A),N.moveEnd({event:R,flowTransform:A})}}),ke.filter(R=>{var A;const K=L.value||y.value,he=p.value&&R.ctrlKey,we=R.button,Se=R.type==="wheel";if(we===1&&R.type==="mousedown"&&(Ve(R,"vue-flow__node")||Ve(R,"vue-flow__edge")))return!0;if(!U.value&&!K&&!ne.value&&!f.value&&!p.value||E.value||se.value&&!Se||!f.value&&R.type==="dblclick"||Ve(R,_.value)&&Se||Ve(R,b.value)&&(!Se||ne.value&&Se&&!L.value)||!p.value&&R.ctrlKey&&Se||!K&&!ne.value&&!he&&Se)return!1;if(!p&&R.type==="touchstart"&&((A=R.touches)==null?void 0:A.length)>1)return R.preventDefault(),!1;if(!U.value&&(R.type==="mousedown"||R.type==="touchstart")||ue.value&&Array.isArray(m.value)&&m.value.includes(0)&&we===0||Array.isArray(m.value)&&!m.value.includes(we)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const Ce=Array.isArray(m.value)&&m.value.includes(we)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!we||we<=1;return(!R.ctrlKey||ee.value||Se)&&Ce}),t.watch([E,U],()=>{E.value&&!I.value?ke.on("zoom",null):E.value||ke.on("zoom",R=>{v.value={x:R.transform.x,y:R.transform.y,zoom:R.transform.k};const A=Ie(R.transform);Y=me(U.value,C??0),N.viewportChange(A),N.move({event:R,flowTransform:A})})},{immediate:!0}),t.watch([E,ne,d,L,p,g,_],()=>{ne.value&&!L.value&&!E.value?ve.on("wheel.zoom",R=>{if(Ve(R,_.value))return!1;const A=L.value||y.value,K=p.value&&R.ctrlKey;if(!(!g.value||ne.value||A||K))return!1;R.preventDefault(),R.stopImmediatePropagation();const we=ve.property("__zoom").k||1,Se=Yo();if(!ee.value&&R.ctrlKey&&p.value&&Se){const gt=Bt(R),w=Gr(R),B=we*2**w;ke.scaleTo(ve,B,gt,R);return}const Ce=R.deltaMode===1?20:1;let Pe=d.value===Uo.Vertical?0:R.deltaX*Ce,Ke=d.value===Uo.Horizontal?0:R.deltaY*Ce;!Se&&R.shiftKey&&d.value!==Uo.Vertical&&!Pe&&Ke&&(Pe=Ke,Ke=0),ke.translateBy(ve,-(Pe/we)*u.value,-(Ke/we)*u.value);const Fe=Ie(ve.property("__zoom"));k&&clearTimeout(k),le.value?(N.move({event:R,flowTransform:Fe}),N.viewportChange(Fe),k=setTimeout(()=>{N.moveEnd({event:R,flowTransform:Fe}),N.viewportChangeEnd(Fe),le.value=!1},150)):(le.value=!0,N.moveStart({event:R,flowTransform:Fe}),N.viewportChangeStart(Fe))},{passive:!1}):typeof G<"u"&&ve.on("wheel.zoom",function(R,A){const K=!g.value&&R.type==="wheel"&&!R.ctrlKey,he=L.value||y.value,we=p.value&&R.ctrlKey;if(!he&&!c.value&&!we&&R.type==="wheel"||K||Ve(R,_.value))return null;R.preventDefault(),G.call(this,R,A)},{passive:!1})},{immediate:!0})});function me(Te,pe){return pe===2&&Array.isArray(Te)&&Te.includes(2)}function _e(Te,pe){return Te.x!==pe.x&&!Number.isNaN(pe.x)||Te.y!==pe.y&&!Number.isNaN(pe.y)||Te.zoom!==pe.k&&!Number.isNaN(pe.k)}function Ie(Te){return{x:Te.x,y:Te.y,zoom:Te.k}}function Ve(Te,pe){return Te.target.closest(`.${pe}`)}return(Te,pe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:T,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(z0,{"is-selecting":Ne.value,"selection-key-pressed":t.unref(ae),class:t.normalizeClass({connecting:se.value,dragging:t.unref(D),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(F0,null,{default:t.withCtx(()=>[t.renderSlot(Te.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),j0=["id"],K0=["id"],Y0=["id"],W0={name:"A11yDescriptions",compatConfig:{MODE:3}},q0=t.defineComponent({...W0,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=He();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(zd)}-${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,j0),t.createElementVNode("div",{id:`${t.unref(Ud)}-${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,K0),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(b1)}-${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,Y0))],64))}});function X0(){const e=He();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function J0(e,n,o){return o===Ae.Left?e-n:o===Ae.Right?e+n:e}function Z0(e,n,o){return o===Ae.Top?e-n:o===Ae.Bottom?e+n:e}const nl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Ae.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:J0(n,e,i),cy:Z0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};nl.props=["radius","centerX","centerY","position","type"],nl.compatConfig={MODE:3};const Bu=nl,Q0=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:f,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:g,edgesUpdatable:_,edgesFocusable:b,hooks:N}=He(),h=t.computed(()=>u(e.id)),{emit:E,on:D}=W1(h.value,r),$=t.inject(aa),H=t.getCurrentInstance(),j=t.ref(!1),v=t.ref(!1),T=t.ref(""),F=t.ref(null),I=t.ref("source"),le=t.ref(null),k=t.toRef(()=>typeof h.value.selectable>"u"?g.value:h.value.selectable),Y=t.toRef(()=>typeof h.value.updatable>"u"?_.value:h.value.updatable),C=t.toRef(()=>typeof h.value.focusable>"u"?b.value:h.value.focusable);t.provide(j1,e.id),t.provide(K1,le);const W=t.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),ee=t.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),ae=t.computed(()=>{const O=h.value.type||"default",Z=$==null?void 0:$[`edge-${O}`];if(Z)return Z;let oe=h.value.template??c.value[O];if(typeof oe=="string"&&H){const R=Object.keys(H.appContext.components);R&&R.includes(O)&&(oe=t.resolveComponent(O,!1))}return oe&&typeof oe!="string"?oe:(r.error(new it(et.EDGE_TYPE_MISSING,oe)),!1)}),{handlePointerDown:L}=Nu({nodeId:T,handleId:F,type:I,isValidConnection:f,edgeUpdaterType:I,onEdgeUpdate:ue,onEdgeUpdateEnd:Ne});return()=>{const O=m(h.value.source),Z=m(h.value.target),oe="pathOptions"in h.value?h.value.pathOptions:{};if(!O&&!Z)return r.error(new it(et.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!O)return r.error(new it(et.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!Z)return r.error(new it(et.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||O.hidden||Z.hidden)return null;let R;i.value===Yt.Strict?R=O.handleBounds.source:R=[...O.handleBounds.source||[],...O.handleBounds.target||[]];const A=su(R,h.value.sourceHandle);let K;i.value===Yt.Strict?K=Z.handleBounds.target:K=[...Z.handleBounds.target||[],...Z.handleBounds.source||[]];const he=su(K,h.value.targetHandle),we=(A==null?void 0:A.position)||Ae.Bottom,Se=(he==null?void 0:he.position)||Ae.Top,{x:Ce,y:Pe}=oo(O,A,we),{x:Ke,y:Fe}=oo(Z,he,Se);return h.value.sourceX=Ce,h.value.sourceY=Pe,h.value.targetX=Ke,h.value.targetY=Fe,t.h("g",{ref:le,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ae.value===!1?"default":h.value.type||"default"}`,s.value,W.value,{updating:j.value,selected:h.value.selected,animated:h.value.animated,inactive:!k.value&&!N.value.edgeClick.hasListeners()}],tabIndex:C.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":C.value?`${Ud}-${n}`:void 0,"aria-roledescription":"edge",role:C.value?"group":"img",...h.value.domAttributes,onClick:me,onContextmenu:_e,onDblclick:Ie,onMouseenter:Ve,onMousemove:Te,onMouseleave:pe,onKeyDown:C.value?G:void 0},[v.value?null:t.h(ae.value===!1?c.value.default:ae.value,{id:e.id,sourceNode:O,targetNode:Z,source:h.value.source,target:h.value.target,type:h.value.type,updatable:Y.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...D},style:ee.value,markerStart:`url('#${Ko(h.value.markerStart,n)}')`,markerEnd:`url('#${Ko(h.value.markerEnd,n)}')`,sourcePosition:we,targetPosition:Se,sourceX:Ce,sourceY:Pe,targetX:Ke,targetY:Fe,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...oe}),[Y.value==="source"||Y.value===!0?[t.h("g",{onMousedown:ke,onMouseenter:U,onMouseout:ne},t.h(Bu,{position:we,centerX:Ce,centerY:Pe,radius:a.value,type:"source","data-type":"source"}))]:null,Y.value==="target"||Y.value===!0?[t.h("g",{onMousedown:ve,onMouseenter:U,onMouseout:ne},t.h(Bu,{position:Se,centerX:Ke,centerY:Fe,radius:a.value,type:"target","data-type":"target"}))]:null]])};function U(){j.value=!0}function ne(){j.value=!1}function ue(O,Z){E.update({event:O,edge:h.value,connection:Z})}function Ne(O){E.updateEnd({event:O,edge:h.value}),v.value=!1}function se(O,Z){O.button===0&&(v.value=!0,T.value=Z?h.value.target:h.value.source,F.value=(Z?h.value.targetHandle:h.value.sourceHandle)??null,I.value=Z?"target":"source",E.updateStart({event:O,edge:h.value}),L(O))}function me(O){var Z;const oe={event:O,edge:h.value};k.value&&(l.value=!1,h.value.selected&&p.value?(d([h.value]),(Z=le.value)==null||Z.blur()):o([h.value])),E.click(oe)}function _e(O){E.contextMenu({event:O,edge:h.value})}function Ie(O){E.doubleClick({event:O,edge:h.value})}function Ve(O){E.mouseEnter({event:O,edge:h.value})}function Te(O){E.mouseMove({event:O,edge:h.value})}function pe(O){E.mouseLeave({event:O,edge:h.value})}function ke(O){se(O,!0)}function ve(O){se(O,!1)}function G(O){var Z;!y.value&&Fd.includes(O.key)&&k.value&&(O.key==="Escape"?((Z=le.value)==null||Z.blur(),d([u(e.id)])):o([u(e.id)]))}}}),eE=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}=He(),f=(e=t.inject(aa))==null?void 0:e["connection-line"],p=t.computed(()=>{var N;return m((N=i.value)==null?void 0:N.nodeId)}),y=t.computed(()=>{var N;return m((N=a.value)==null?void 0:N.nodeId)??null}),g=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),_=t.computed(()=>c.value.markerStart?`url(#${Ko(c.value.markerStart,n)})`:""),b=t.computed(()=>c.value.markerEnd?`url(#${Ko(c.value.markerEnd,n)})`:"");return()=>{var N,h,E;if(!p.value||!i.value)return null;const D=i.value.id,$=i.value.type,H=p.value.handleBounds;let j=(H==null?void 0:H[$])??[];if(o.value===Yt.Loose){const ee=(H==null?void 0:H[$==="source"?"target":"source"])??[];j=[...j,...ee]}if(!j)return null;const v=(D?j.find(ee=>ee.id===D):j[0])??null,T=(v==null?void 0:v.position)??Ae.Top,{x:F,y:I}=oo(p.value,v,T);let le=null;y.value&&(o.value===Yt.Strict?le=((N=y.value.handleBounds[$==="source"?"target":"source"])==null?void 0:N.find(ee=>{var ae;return ee.id===((ae=a.value)==null?void 0:ae.id)}))||null:le=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(ee=>{var ae;return ee.id===((ae=a.value)==null?void 0:ae.id)}))||null);const k=((E=a.value)==null?void 0:E.position)??(T?Xr[T]:null);if(!T||!k)return null;const Y=l.value??c.value.type??wn.Bezier;let C="";const W={sourceX:F,sourceY:I,sourcePosition:T,targetX:g.value.x,targetY:g.value.y,targetPosition:k};return Y===wn.Bezier?[C]=$u(W):Y===wn.Step?[C]=tl({...W,borderRadius:0}):Y===wn.SmoothStep?[C]=tl(W):Y===wn.SimpleBezier?[C]=Au(W):C=`M${F},${I} ${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"},f?t.h(f,{sourceX:F,sourceY:I,sourcePosition:T,targetX:g.value.x,targetY:g.value.y,targetPosition:k,sourceNode:p.value,sourceHandle:v,targetNode:y.value,targetHandle:le,markerEnd:b.value,markerStart:_.value,connectionStatus:d.value}):t.h("path",{d:C,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":_.value})))}}}),tE=["id","markerWidth","markerHeight","markerUnits","orient"],nE={name:"MarkerType",compatConfig:{MODE:3}},oE=t.defineComponent({...nE,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(Ur).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(Ur).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,tE))}}),iE={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},aE={name:"MarkerDefinitions",compatConfig:{MODE:3}},rE=t.defineComponent({...aE,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=He(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Ko(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",iE,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(oE,{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))])]))}}),lE={name:"Edges",compatConfig:{MODE:3}},sE=t.defineComponent({...lE,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=He();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(rE),(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(V1)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(Q0),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(eE))],64))}}),cE=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:f,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:g,snapToGrid:_,snapGrid:b,nodeDragThreshold:N,nodesDraggable:h,elementsSelectable:E,nodesConnectable:D,nodesFocusable:$,hooks:H}=He(),j=t.ref(null);t.provide(Eu,j),t.provide(_u,e.id);const v=t.inject(aa),T=t.getCurrentInstance(),F=vu(),{node:I,parentNode:le}=wu(e.id),{emit:k,on:Y}=Z1(I,l),C=t.toRef(()=>typeof I.draggable>"u"?h.value:I.draggable),W=t.toRef(()=>typeof I.selectable>"u"?E.value:I.selectable),ee=t.toRef(()=>typeof I.connectable>"u"?D.value:I.connectable),ae=t.toRef(()=>typeof I.focusable>"u"?$.value:I.focusable),L=t.computed(()=>W.value||C.value||H.value.nodeClick.hasListeners()||H.value.nodeDoubleClick.hasListeners()||H.value.nodeMouseEnter.hasListeners()||H.value.nodeMouseMove.hasListeners()||H.value.nodeMouseLeave.hasListeners()),U=t.toRef(()=>!!I.dimensions.width&&!!I.dimensions.height),ne=t.computed(()=>{const Z=I.type||"default",oe=v==null?void 0:v[`node-${Z}`];if(oe)return oe;let R=I.template||m.value[Z];if(typeof R=="string"&&T){const A=Object.keys(T.appContext.components);A&&A.includes(Z)&&(R=t.resolveComponent(Z,!1))}return R&&typeof R!="string"?R:(l.error(new it(et.NODE_TYPE_MISSING,R)),!1)}),ue=ku({id:e.id,el:j,disabled:()=>!C.value,selectable:W,dragHandle:()=>I.dragHandle,onStart(Z){k.dragStart(Z)},onDrag(Z){k.drag(Z)},onStop(Z){k.dragStop(Z)},onClick(Z){G(Z)}}),Ne=t.computed(()=>I.class instanceof Function?I.class(I):I.class),se=t.computed(()=>{const Z=(I.style instanceof Function?I.style(I):I.style)||{},oe=I.width instanceof Function?I.width(I):I.width,R=I.height instanceof Function?I.height(I):I.height;return!Z.width&&oe&&(Z.width=typeof oe=="string"?oe:`${oe}px`),!Z.height&&R&&(Z.height=typeof R=="string"?R:`${R}px`),Z}),me=t.toRef(()=>Number(I.zIndex??se.value.zIndex??0));return u(Z=>{(Z.includes(e.id)||!Z.length)&&Ie()}),t.onMounted(()=>{t.watch(()=>I.hidden,(Z=!1,oe,R)=>{!Z&&j.value&&(e.resizeObserver.observe(j.value),R(()=>{j.value&&e.resizeObserver.unobserve(j.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>I.type,()=>I.sourcePosition,()=>I.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:j.value,forceUpdate:!0}])})}),t.watch([()=>I.position.x,()=>I.position.y,()=>{var Z;return(Z=le.value)==null?void 0:Z.computedPosition.x},()=>{var Z;return(Z=le.value)==null?void 0:Z.computedPosition.y},()=>{var Z;return(Z=le.value)==null?void 0:Z.computedPosition.z},me,()=>I.selected,()=>I.dimensions.height,()=>I.dimensions.width,()=>{var Z;return(Z=le.value)==null?void 0:Z.dimensions.height},()=>{var Z;return(Z=le.value)==null?void 0:Z.dimensions.width}],([Z,oe,R,A,K,he])=>{const we={x:Z,y:oe,z:he+(p.value&&I.selected?1e3:0)};typeof R<"u"&&typeof A<"u"?I.computedPosition=C1({x:R,y:A,z:K},we):I.computedPosition=we},{flush:"post",immediate:!0}),t.watch([()=>I.extent,f],([Z,oe],[R,A])=>{(Z!==R||oe!==A)&&_e()}),I.extent==="parent"||typeof I.extent=="object"&&"range"in I.extent&&I.extent.range==="parent"?_r(()=>U).toBe(!0).then(_e):_e(),()=>I.hidden?null:t.h("div",{ref:j,"data-id":I.id,class:["vue-flow__node",`vue-flow__node-${ne.value===!1?"default":I.type||"default"}`,{[o.value]:C.value,dragging:ue==null?void 0:ue.value,draggable:C.value,selected:I.selected,selectable:W.value,parent:I.isParent},Ne.value],style:{visibility:U.value?"visible":"hidden",zIndex:I.computedPosition.z??me.value,transform:`translate(${I.computedPosition.x}px,${I.computedPosition.y}px)`,pointerEvents:L.value?"all":"none",...se.value},tabIndex:ae.value?0:void 0,role:ae.value?"group":void 0,"aria-describedby":y.value?void 0:`${zd}-${n}`,"aria-label":I.ariaLabel,"aria-roledescription":"node",...I.domAttributes,onMouseenter:Ve,onMousemove:Te,onMouseleave:pe,onContextmenu:ke,onClick:G,onDblclick:ve,onKeydown:O},[t.h(ne.value===!1?m.value.default:ne.value,{id:I.id,type:I.type,data:I.data,events:{...I.events,...Y},selected:I.selected,resizing:I.resizing,dragging:ue.value,connectable:ee.value,position:I.computedPosition,dimensions:I.dimensions,isValidTargetPos:I.isValidTargetPos,isValidSourcePos:I.isValidSourcePos,parent:I.parentNode,parentNodeId:I.parentNode,zIndex:I.computedPosition.z??me.value,targetPosition:I.targetPosition,sourcePosition:I.sourcePosition,label:I.label,dragHandle:I.dragHandle,onUpdateNodeInternals:Ie})]);function _e(){const Z=I.computedPosition,{computedPosition:oe,position:R}=Yr(I,_.value?ia(Z,b.value):Z,l.error,f.value,le.value);(I.computedPosition.x!==oe.x||I.computedPosition.y!==oe.y)&&(I.computedPosition={...I.computedPosition,...oe}),(I.position.x!==R.x||I.position.y!==R.y)&&(I.position=R)}function Ie(){j.value&&d([{id:e.id,nodeElement:j.value,forceUpdate:!0}])}function Ve(Z){ue!=null&&ue.value||k.mouseEnter({event:Z,node:I})}function Te(Z){ue!=null&&ue.value||k.mouseMove({event:Z,node:I})}function pe(Z){ue!=null&&ue.value||k.mouseLeave({event:Z,node:I})}function ke(Z){return k.contextMenu({event:Z,node:I})}function ve(Z){return k.doubleClick({event:Z,node:I})}function G(Z){W.value&&(!i.value||!C.value||N.value>0)&&Jr(I,r.value,c,s,a,!1,j.value),k.click({event:Z,node:I})}function O(Z){if(!(Fr(Z)||y.value))if(Fd.includes(Z.key)&&W.value){const oe=Z.key==="Escape";Jr(I,r.value,c,s,a,oe,j.value)}else C.value&&I.selected&&to[Z.key]&&(Z.preventDefault(),g.value=`Moved selected node ${Z.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~I.position.x}, y: ${~~I.position.y}`,F({x:to[Z.key].x,y:to[Z.key].y},Z.shiftKey))}}});function dE(e={includeHiddenNodes:!1}){const{nodes:n}=He();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 uE={class:"vue-flow__nodes vue-flow__container"},mE={name:"Nodes",compatConfig:{MODE:3}},fE=t.defineComponent({...mE,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=He(),a=dE(),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",uE,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const f=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,f))return m;const p=(t.openBlock(),t.createBlock(t.unref(cE),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=f,p},s,0),128)):t.createCommentVNode("",!0)]))}});function pE(){const{emits:e}=He();t.onMounted(()=>{if(fu()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new it(et.MISSING_STYLES))}})}const hE=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),yE={name:"VueFlow",compatConfig:{MODE:3}},gE=t.defineComponent({...yE,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=Er(i,"modelValue",o),l=Er(i,"nodes",o),s=Er(i,"edges",o),c=He(i),d=n0({modelValue:r,nodes:l,edges:s},i,c);return i0(o,c.hooks),X0(),pE(),t.provide(aa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(G0,null,{default:t.withCtx(()=>[t.createVNode(sE),hE,t.createVNode(fE),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(q0)],512))}}),bE={name:"Panel",compatConfig:{MODE:3}},Du=t.defineComponent({...bE,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=He(),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))}}),$n=["red","amber","green","teal","blue","indigo","violet","pink"],Ou={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function _E(e){return typeof e=="string"&&e in Ou}const EE={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},kE=.15;function NE(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 wE(e){if(typeof e!="string")return null;const n=NE(e);if(!n||n.s<kE)return null;let o=null,i=1/0;for(const a of $n){const r=Math.abs(n.h-EE[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function ut(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(_E(n))return n;const o=e==null?void 0:e.properties;return wE((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function ol(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const vE={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)"},xE={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 Lu(e,n=!1){return e?n?xE[e]:vE[e]:null}function io(e){return Ou[e]}function ao(e){return`var(--em-swatch-${e}-bar)`}const IE=["width","height","innerHTML"],CE=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"/>',"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,IE))}}),Ge=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Me=Ge(CE,[["__scopeId","data-v-92c1dba8"]]);function SE(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 $E(e,n){const o=SE(n);return o?e(o):n.split("-")[1]??n}function RE(e){const n=o=>e.params!=null&&o 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"em.check.name3";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-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-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-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";default:return e.ruleId}}function Pu(e,n){const o=RE(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 AE(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const TE={class:"em-inline-issue__msgs"},Rn=Ge(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(Me,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",TE,[(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(Pu)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),VE={class:"em-mlang"},ME={class:"em-mlang__tabs",role:"tablist"},BE=["aria-selected","onClick"],DE={key:0,class:"em-mlang__dot"},An=Ge(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const r=t.ref(a());t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(r.value)||(r.value=a())});function l(d){var u,m;return!!((m=(u=o.modelValue)==null?void 0:u[d])!=null&&m.trim())}const s=t.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[r.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[r.value]:u[r.value]=d,i("update:modelValue",u)}return(d,u)=>(t.openBlock(),t.createElementBlock("div",VE,[t.createElementVNode("div",ME,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,m=>(t.openBlock(),t.createElementBlock("button",{key:m,type:"button",class:t.normalizeClass(["em-mlang__tab",{"is-active":r.value===m}]),role:"tab","aria-selected":r.value===m,onClick:f=>r.value=m},[t.createTextVNode(t.toDisplayString(m),1),l(m)?(t.openBlock(),t.createElementBlock("span",DE,"•")):t.createCommentVNode("",!0)],10,BE))),128))]),e.multiline?(t.openBlock(),t.createBlock(t.unref(ie.BSTextArea),{key:0,name:`${e.name}-${r.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(ie.BSTextInput),{key:1,name:`${e.name}-${r.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),OE=["disabled"],LE={class:"em-panel__sub-label"},PE={class:"em-field"},zE={class:"em-field"},UE={class:"em-field"},FE={class:"em-class"},HE={class:"em-field"},GE={class:"em-field"},jE={class:"em-field"},KE={class:"em-field"},YE={class:"em-multilang"},WE={class:"em-multilang"},qE={class:"em-jpa"},XE={class:"em-field"},JE={class:"em-field"},ZE={class:"em-field"},QE={class:"em-swatch"},ek={class:"em-swatch__row"},tk=["title"],nk=["title","onClick"],zu=Ge(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(I=>I.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(I=>I.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var I;return ut(((I=l.value)==null?void 0:I.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=I=>I;function f(I){return I==="inherit"?a.t("em.common.inherit"):I}function p(I){r.value&&a.updateEntity(r.value.modelId,I)}function y(I,le,k){var C;const Y=((C=r.value)==null?void 0:C.table)??{physicalName:""};p(I==="physicalName"?{table:{...Y,physicalName:k}}:{table:{...Y,logicalName:{...Y.logicalName,[le]:k}}})}function g(I){p({description:Object.keys(I).length?I:void 0})}function _(I,le){var k;p({jpaAttrs:{...(k=r.value)==null?void 0:k.jpaAttrs,[I]:le}})}function b(I,le){_(I,le)}const N=t.computed(()=>{var I,le;return((le=(I=r.value)==null?void 0:I.jpaAttrs)==null?void 0:le.discriminatorType)??"inherit"}),h=t.computed(()=>{var I,le;return!((le=(I=r.value)==null?void 0:I.jpaAttrs)!=null&&le.useDiscriminator)});function E(I){_("discriminatorType",I==="inherit"?void 0:I)}function D(I){p({hasPersonalInfo:I})}function $(I){p({superClass:I.trim()||void 0})}function H(I){p({schema:I.trim()||void 0})}function j(I){p({abstractClass:I})}const v=t.computed(()=>{var I,le;return((le=(I=r.value)==null?void 0:I.declarationOfInterfaces)==null?void 0:le.join(", "))??""});function T(I){const le=I.split(",").map(k=>k.trim()).filter(Boolean);p({declarationOfInterfaces:le.length?le:void 0})}function F(I){r.value&&a.setEntitySwatch(r.value.modelId,I)}return(I,le)=>{var k,Y,C;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:le[0]||(le[0]=W=>i("toggle"))},[t.createElementVNode("span",LE,[t.createVNode(Me,{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(Rn,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",PE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":le[1]||(le[1]=W=>p({name:W}))},null,8,["model-value"])]),t.createElementVNode("label",zE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(ie.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":le[2]||(le[2]=W=>p({stereotype:W}))},null,8,["model-value"])]),t.createElementVNode("label",UE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":le[3]||(le[3]=W=>p({packageName:W}))},null,8,["model-value"])]),t.createElementVNode("fieldset",FE,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",HE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":le[4]||(le[4]=W=>$(W))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",GE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":v.value,"onUpdate:modelValue":le[5]||(le[5]=W=>T(W))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(ie.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":le[6]||(le[6]=W=>j(W))},null,8,["label","model-value"])]),t.createElementVNode("label",jE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"ent-table",width:"100%","model-value":((k=r.value.table)==null?void 0:k.physicalName)??"","onUpdate:modelValue":le[7]||(le[7]=W=>y("physicalName",null,W))},null,8,["model-value"])]),t.createElementVNode("label",KE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":le[8]||(le[8]=W=>H(W))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",YE,[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,W=>{var ee,ae;return t.openBlock(),t.createElementBlock("label",{key:W,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(W),1),t.createVNode(t.unref(ie.BSTextInput),{name:`ent-logical-${W}`,width:"100%","model-value":((ae=(ee=r.value.table)==null?void 0:ee.logicalName)==null?void 0:ae[W])??"","onUpdate:modelValue":L=>y("logicalName",W,L)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",WE,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(An,{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",qE,[le[13]||(le[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,W=>{var ee;return t.createVNode(t.unref(ie.BSCheckbox),{key:W.key,name:`jpa-${W.key}`,class:"em-check",label:W.label,"model-value":!!((ee=r.value.jpaAttrs)!=null&&ee[W.key]),"onUpdate:modelValue":ae=>b(W.key,ae)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",XE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:h.value,"model-value":((Y=r.value.jpaAttrs)==null?void 0:Y.discriminatorColumnName)??"","onUpdate:modelValue":le[9]||(le[9]=W=>_("discriminatorColumnName",W.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",JE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(ie.BSSelect),{disabled:h.value,"model-value":N.value,items:u,"value-provider":m,"label-provider":f,"onUpdate:modelValue":le[10]||(le[10]=W=>W&&E(W))},null,8,["disabled","model-value"])]),t.createElementVNode("label",ZE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(ie.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:h.value,"model-value":(C=r.value.jpaAttrs)==null?void 0:C.discriminatorLength,"onUpdate:modelValue":le[11]||(le[11]=W=>_("discriminatorLength",W||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(ie.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":D},null,8,["label","model-value"]),t.createElementVNode("fieldset",QE,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",ek,[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:le[12]||(le[12]=W=>F(null))},"∅",10,tk),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref($n),W=>(t.openBlock(),t.createElementBlock("button",{key:W,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===W}]),style:t.normalizeStyle({background:t.unref(ao)(W)}),title:t.unref(io)(W),onClick:ee=>F(W)},null,14,nk))),128))])])],64)):t.createCommentVNode("",!0)],8,OE)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-92e146f7"]]),Uu={"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.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.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.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.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.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.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.descPlaceholderKo":"Description (ko)","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.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.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.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","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.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.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.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.name3":'Duplicate entity name: "{name}"',"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.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.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.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.unspecified":"unspecified"},Fu={"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.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.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.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.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.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.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.descPlaceholderKo":"説明(ko)","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.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.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.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","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.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.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.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3":'エンティティ名が重複しています: "{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.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.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.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.unspecified":"未指定"},Hu={"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.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.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.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.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.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.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.descPlaceholderKo":"설명(ko)","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.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.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.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","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.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.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.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3":'엔티티 이름이 중복됩니다: "{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.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.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.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.unspecified":"미지정"},ok=["ko","en","ja"],il={ko:Hu,en:Uu,ja:Fu};function Ct(e,n,o){let a=(il[e]??il.ko)[n]??il.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const Gu=["ko","en","ja","zh"];function ik(e){if(e)for(const n of Gu){const o=e[n];if(o)return o}}function al(e){const n=ik(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function ak(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Gu.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const rk=["aria-expanded","placeholder"],lk=["aria-selected","onClick","onMouseenter"],sk={key:0,class:"gcc__opt gcc__opt--empty"},ju=Ge(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(v,T)=>Ct(o.locale??"ko",v,T),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),f=t.computed(()=>o.items.find(v=>v.groupCode===o.modelValue)),p=t.computed(()=>f.value?al(f.value):"");t.watch(p,v=>{d.value||(c.value=v)},{immediate:!0});const y=t.computed(()=>c.value===p.value?o.items:ak(o.items,c.value));function g(){var T;const v=(T=r.value)==null?void 0:T.getBoundingClientRect();v&&(m.value={left:`${v.left}px`,top:`${v.bottom}px`,width:`${v.width}px`})}function _(){d.value=!0,g(),u.value=Math.max(0,y.value.findIndex(v=>v.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",j)}function b(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",j)}t.onBeforeUnmount(b);function N(){_(),t.nextTick(()=>{var v;return(v=l.value)==null?void 0:v.select()})}function h(){d.value||_(),u.value=0}function E(v){i("update:modelValue",v.groupCode),c.value=al(v),b()}function D(){i("update:modelValue",void 0),c.value="",b()}function $(){c.value.trim()===""?D():(c.value=p.value,b())}function H(v){var T;if(v.key==="ArrowDown")d.value||_(),u.value=Math.min(u.value+1,y.value.length-1),v.preventDefault();else if(v.key==="ArrowUp")u.value=Math.max(u.value-1,0),v.preventDefault();else if(v.key==="Enter"){const F=y.value[u.value];F&&E(F),v.preventDefault()}else v.key==="Escape"&&(c.value=p.value,b(),(T=l.value)==null||T.blur())}function j(v){var F,I;const T=v.target;!((F=r.value)!=null&&F.contains(T))&&!((I=s.value)!=null&&I.contains(T))&&$()}return(v,T)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":T[0]||(T[0]=F=>c.value=F),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:N,onInput:h,onKeydown:H},null,40,rk),[[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:T[1]||(T[1]=t.withModifiers(()=>{},["prevent"])),onClick:D},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(F,I)=>(t.openBlock(),t.createElementBlock("li",{key:F.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":I===u.value,"is-selected":F.groupCode===e.modelValue}]),role:"option","aria-selected":F.groupCode===e.modelValue,onMousedown:T[2]||(T[2]=t.withModifiers(()=>{},["prevent"])),onClick:le=>E(F),onMouseenter:le=>u.value=I},t.toDisplayString(t.unref(al)(F)),43,lk))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",sk,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),ck=["disabled"],dk={class:"em-aw__toolbar"},uk={class:"em-aw__count"},mk={class:"em-aw__scroll"},fk={class:"em-aw__table"},pk={class:"c-name"},hk={class:"c-type"},yk={class:"c-logical"},gk={class:"c-col"},bk={class:"c-constraints"},_k={class:"c-del"},Ek={class:"c-expand"},kk=["title","onClick","onKeydown"],Nk={key:1,class:"em-aw__muted"},wk={class:"c-constraints"},vk={class:"em-aw__cflags"},xk=["title"],Ik={colspan:"8"},Ck={class:"em-aw__detail"},Sk={class:"em-aw__dgroup"},$k={class:"em-aw__df"},Rk={class:"em-aw__df"},Ak={class:"em-aw__df"},Tk={class:"em-aw__dgroup"},Vk={class:"em-aw__dgroup"},Mk={class:"em-aw__df"},Bk={key:0,class:"em-aw__df"},Dk={class:"em-aw__df"},Ok={class:"c-expand"},Lk={class:"em-aw__caret is-static","aria-hidden":"true"},Pk={class:"c-del"},zk={class:"c-expand"},Uk=["title","onClick","onKeydown"],Fk={class:"em-aw__embed-label"},Hk={class:"em-aw__ro"},Gk={class:"em-aw__ro"},jk={class:"c-constraints"},Kk={class:"em-aw__ro"},Yk={key:0,class:"em-aw__detail-row em-aw__embed-detail"},Wk={colspan:"8"},qk={class:"em-aw__detail"},Xk={class:"em-aw__dgroup"},Jk={key:0,class:"em-aw__df"},Zk={class:"em-aw__df"},Qk={class:"em-aw__df"},eN={key:0},tN={colspan:"99",class:"em-aw__empty"},nN=6,oN=5,fa="__OWN__",iN=Ge(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(x=>x.modelId===n.entityId)??null),a=t.computed(()=>{var x;return((x=i.value)==null?void 0:x.stereotype)==="JPA_EMBEDDABLE"}),r=t.computed(()=>new Set(o.selectedAttrIds.value)),l=t.computed(()=>{var x;return(((x=i.value)==null?void 0:x.attributes)??[]).filter(M=>M.attrType!=="DIVIDER").length}),s=t.ref(new Set);function c(x){return s.value.has(x)}function d(x){const M=new Set(s.value);M.has(x)?M.delete(x):M.add(x),s.value=M}const u=["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 m(x){return x==="none"?o.t("em.common.noneParen"):x}const f=x=>x;function p(x,M){i.value&&o.updateAttribute(i.value.modelId,x.modelId,M)}function y(x){return!!i.value&&!!Ri(o.state.logical,i.value.modelId,x.modelId)}function g(x,M){p(x,{naturalId:M||void 0,naturalIdMutable:M?x.naturalIdMutable:void 0})}function _(){return{naturalId:void 0,naturalIdMutable:void 0}}function b(x,M){p(x,{identifier:M,...M?_():{}})}function N(x,M){p(x,{transient:M||void 0,...M?_():{}})}function h(x){return!!x.transient||x.attrType==="RELATION_REF"}const E=x=>x.value,D=x=>x.label;function $(x,M){if(!M)return;const V=le.value.find(ce=>ce.type===M);if(V){const ce=x.dbAttrs[0]??{modelId:x.modelId+".c",physicalName:x.name,dataType:"VARCHAR"};p(x,{type:M,customType:void 0,dbAttrs:[{...ce,dataType:V.dataType,length:V.length,scale:V.scale}]});return}p(x,M===Rt?{type:M}:{type:M,customType:void 0})}function H(x,M){p(x,{customType:M.trim()===""?void 0:M})}function j(x,M){if(x.attrType==="RELATION_REF")return;const ce={...x.dbAttrs[0]??{modelId:x.modelId+".c",physicalName:x.name,dataType:"VARCHAR"},...M};M.dataType!==void 0&&!_o.has(ce.dataType)&&(ce.scale=void 0),p(x,{dbAttrs:[ce]})}function v(x){var M;return _o.has(((M=x.dbAttrs[0])==null?void 0:M.dataType)??"")}function T(x,M){j(x,{logicalName:Object.keys(M).length?M:void 0})}function F(x){return x.personalInfoAttributeType??"none"}function I(x,M){p(x,{personalInfoAttributeType:M==="none"?void 0:M})}const le=t.computed(()=>o.predefinedCustomTypeCatalog.value),k=t.computed(()=>o.embeddableCatalog.value);function Y(x){var M,V;return((M=x.label)==null?void 0:M.ko)??((V=x.label)==null?void 0:V.en)??x.type}function C(x){!x||!i.value||o.addPredefinedEmbed(i.value.modelId,x)}const W=t.computed(()=>o.groupCodeCatalog.value);function ee(x){var M;return((M=W.value.find(V=>V.groupCode===x.groupCode))==null?void 0:M.codes)??[]}function ae(x){return["none",...ee(x)]}function L(x){return x==="none"?"none":x.code}function U(x){var V,ce;if(x==="none")return o.t("em.common.noneParen");const M=((V=x.label)==null?void 0:V.ko)??((ce=x.label)==null?void 0:ce.en);return M?`${x.code} (${M})`:x.code}function ne(x,M){i.value&&o.setAttributeGroupCode(i.value.modelId,x.modelId,M)}function ue(x,M){p(x,{defaultValue:M==="none"?void 0:M})}function Ne(x,M){p(x,{defaultValue:M.trim()===""?void 0:M})}function se(x){return x.attrType.startsWith("EMBED")&&x.dbAttrs.length>0}function me(x,M,V){const ce=x.dbAttrs.map((J,q)=>{if(q!==M)return J;const te={...J,...V};for(const re of Object.keys(V))V[re]===void 0&&delete te[re];return te});i.value&&o.setEmbedColumns(i.value.modelId,x.modelId,ce)}function _e(x,M,V){me(x,M,{logicalName:Object.keys(V).length?V:void 0})}function Ie(x,M){var J,q,te;if(x.attrType==="EMBED_PREDEF"){const re=(J=o.embeddableCatalog.value.find(be=>be.type===x.type))==null?void 0:J.fields[M];return re?{name:re.name,physicalName:re.physicalName,dataType:re.dataType,length:re.length,shareable:re.shareable,logicalName:re.logicalName}:void 0}const V=(q=x.embedded)==null?void 0:q.embeddableRef;if(!V)return;const ce=(te=o.state.logical.entities.find(re=>re.modelId===V))==null?void 0:te.attributes.flatMap(re=>re.dbAttrs)[M];return ce?{physicalName:ce.physicalName,dataType:ce.dataType,length:ce.length,scale:ce.scale,logicalName:ce.logicalName}:void 0}function Ve(x,M){var V,ce;return((V=Ie(x,M))==null?void 0:V.dataType)||((ce=x.dbAttrs[M])==null?void 0:ce.dataType)||""}function Te(x,M){var V,ce;return((V=Ie(x,M))==null?void 0:V.length)??((ce=x.dbAttrs[M])==null?void 0:ce.length)}function pe(x,M){var V,ce;return((V=Ie(x,M))==null?void 0:V.scale)??((ce=x.dbAttrs[M])==null?void 0:ce.scale)}const ke=["inherit","true","false"];function ve(x){return x==="inherit"?o.t("em.common.inherit"):x}function G(x){return(x==null?void 0:x.updatable)===void 0?"inherit":x.updatable?"true":"false"}function O(x,M,V){me(x,M,{updatable:V==="inherit"?void 0:V==="true"})}function Z(x,M){j(x,{updatable:M==="inherit"?void 0:M==="true"})}const oe=["inherit","true","false"];function R(x){return x==="inherit"?o.t("em.common.inherit"):x}function A(x){return(x==null?void 0:x.insertable)===void 0?"inherit":x.insertable?"true":"false"}function K(x,M,V){me(x,M,{insertable:V==="inherit"?void 0:V==="true"})}function he(x,M){j(x,{insertable:M==="inherit"?void 0:M==="true"})}const we=t.computed(()=>i.value?ui(i.value,o.state.logical.entities):[]),Se=t.computed(()=>mn(we.value.flatMap(x=>x.attributes.flatMap(M=>M.dbAttrs)))),Ce=t.computed(()=>we.value.flatMap(x=>x.attributes.filter(M=>M.attrType==="NORMAL"&&M.dbAttrs.length===1&&M.dbAttrs[0]).map(M=>{var V;return{modelId:M.dbAttrs[0].modelId,physical:M.dbAttrs[0].physicalName||M.name,isCurrency:M.type==="Currency",ownerName:x.modelId===((V=i.value)==null?void 0:V.modelId)?void 0:x.name}})));function Pe(){const x=[...Ce.value].sort((M,V)=>Number(V.isCurrency)-Number(M.isCurrency));return[fa,...x.map(M=>M.modelId)]}function Ke(x){if(x===fa)return o.t("em.attr.sharedOwn");const M=Ce.value.find(ce=>ce.modelId===x);if(!M)return x;const V=M.ownerName?`${M.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:V,physical:M.physical,mode:M.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function Fe(x){return(x==null?void 0:x.sharedColumnRef)??fa}function gt(x,M,V){me(x,M,{sharedColumnRef:V===fa?void 0:V})}function w(x){return(x==null?void 0:x.sharedColumnRef)!=null}function B(x){var M;return((M=Un(x,Se.value))==null?void 0:M.physicalName)??""}return(x,M)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",dk,[t.createElementVNode("span",uk,t.toDisplayString(t.unref(o).t("em.attr.section",{n:l.value})),1),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:M[0]||(M[0]=V=>t.unref(o).addAttribute(i.value.modelId))},null,8,["caption"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:M[1]||(M[1]=V=>t.unref(o).addDivider(i.value.modelId))},null,8,["caption"]),k.value.length?(t.openBlock(),t.createBlock(t.unref(ie.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:k.value,"value-provider":V=>V.type,"label-provider":Y,"onUpdate:modelValue":C},null,8,["placeholder","items","value-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",mk,[t.createElementVNode("table",fk,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[M[2]||(M[2]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",pk,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",hk,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",yk,t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),1),t.createElementVNode("th",gk,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),M[3]||(M[3]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),M[4]||(M[4]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",bk,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),M[5]||(M[5]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value.attributes,V=>{var ce,J,q,te,re,be,S,Q,P,xe;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":r.value.has(V.modelId)}])},[M[6]||(M[6]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSTextInput),{name:`aw-divlabel-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":V.name,"onUpdate:modelValue":ge=>p(V,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:nN,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",_k,[t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(i.value.modelId,V.modelId)},null,8,["onClick"])])],2)):se(V)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":r.value.has(V.modelId)}])},[t.createElementVNode("td",Ok,[t.createElementVNode("span",Lk,[t.createVNode(Me,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":ge=>p(V,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSTextInput),{name:`aw-type-${V.modelId}`,width:"100%",disabled:"","model-value":V.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:oN,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:V.dbAttrs.length})),1),t.createElementVNode("td",Pk,[t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(i.value.modelId,V.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.dbAttrs,(ge,Ue)=>{var z,X,fe,$e,Be,Oe;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ge.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":c(ge.modelId)}])},[t.createElementVNode("td",zk,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":c(ge.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(c(ge.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:ye=>d(ge.modelId),onKeydown:[t.withKeys(t.withModifiers(ye=>d(ge.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ye=>d(ge.modelId),["prevent"]),["space"])]},[t.createVNode(Me,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,Uk)]),t.createElementVNode("td",Fk,"↳ "+t.toDisplayString(((z=Ie(V,Ue))==null?void 0:z.name)??((X=Ie(V,Ue))==null?void 0:X.physicalName)??t.unref(o).t("em.attr.colFallback",{n:Ue+1})),1),M[13]||(M[13]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(An,{name:`aw-embed-logical-${ge.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:(($e=(fe=Ie(V,Ue))==null?void 0:fe.logicalName)==null?void 0:$e.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ge.logicalName,"onUpdate:modelValue":ye=>_e(V,Ue,ye)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSTextInput),{name:`aw-embed-col-${ge.modelId}`,width:"100%",disabled:w(ge),placeholder:((Be=Ie(V,Ue))==null?void 0:Be.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":w(ge)?B(ge):ge.physicalName,"onUpdate:modelValue":ye=>me(V,Ue,{physicalName:ye})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(Rn,{controller:t.unref(o),"ref-id":ge.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",null,[t.createElementVNode("span",Hk,t.toDisplayString(Ve(V,Ue)),1)]),t.createElementVNode("td",null,[t.createElementVNode("span",Gk,t.toDisplayString(Te(V,Ue)??""),1)]),t.createElementVNode("td",jk,[t.createElementVNode("span",Kk,t.toDisplayString(pe(V,Ue)!=null?`scale ${pe(V,Ue)}`:""),1)]),M[14]||(M[14]=t.createElementVNode("td",null,null,-1))],2),c(ge.modelId)?(t.openBlock(),t.createElementBlock("tr",Yk,[M[17]||(M[17]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",Wk,[t.createElementVNode("div",qk,[t.createElementVNode("fieldset",Xk,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(Oe=Ie(V,Ue))!=null&&Oe.shareable?(t.openBlock(),t.createElementBlock("label",Jk,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ie.BSSelect),{width:"150px","model-value":Fe(ge),items:Pe(),"value-provider":f,"label-provider":Ke,"onUpdate:modelValue":ye=>ye&>(V,Ue,ye)},null,8,["model-value","items","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",Zk,[M[15]||(M[15]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ie.BSSelect),{width:"110px",disabled:w(ge),"model-value":w(ge)?"false":A(ge),items:oe,"value-provider":f,"label-provider":R,"onUpdate:modelValue":ye=>ye&&K(V,Ue,ye)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",Qk,[M[16]||(M[16]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ie.BSSelect),{width:"110px",disabled:w(ge),"model-value":w(ge)?"false":G(ge),items:ke,"value-provider":f,"label-provider":ve,"onUpdate:modelValue":ye=>ye&&O(V,Ue,ye)},null,8,["disabled","model-value","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":r.value.has(V.modelId),"em-aw__open":c(V.modelId)})},[t.createElementVNode("td",Ek,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":c(V.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(c(V.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>d(V.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>d(V.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>d(V.modelId),["prevent"]),["space"])]},[t.createVNode(Me,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,kk)]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":ge=>p(V,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSSelect),{name:`aw-type-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!V.groupCode||V.attrType==="RELATION_REF",items:t.unref(ts)(V.type,le.value),"value-provider":E,"label-provider":D,"model-value":V.type,"onUpdate:modelValue":ge=>$(V,ge)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),V.type===t.unref(Rt)?(t.openBlock(),t.createBlock(t.unref(ie.BSTextInput),{key:0,name:`aw-customtype-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":V.customType??"","onUpdate:modelValue":ge=>H(V,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)]),t.createElementVNode("td",null,[V.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(An,{key:0,name:`aw-logical-${V.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(ce=V.dbAttrs[0])==null?void 0:ce.logicalName,"onUpdate:modelValue":ge=>T(V,ge)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",Nk,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSTextInput),{name:`aw-col-${V.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.columnPlaceholder"),disabled:h(V),"model-value":((J=V.dbAttrs[0])==null?void 0:J.physicalName)??"","onUpdate:modelValue":ge=>j(V,{physicalName:ge})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(Rn,{controller:t.unref(o),"ref-id":(q=V.dbAttrs[0])==null?void 0:q.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSSelect),{name:`aw-dtype-${V.modelId}`,width:"100%",placeholder:"dataType",disabled:h(V),items:t.unref(Ql)(((te=V.dbAttrs[0])==null?void 0:te.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":f,"label-provider":t.unref(qa),"model-value":((re=V.dbAttrs[0])==null?void 0:re.dataType)??"","onUpdate:modelValue":ge=>ge&&j(V,{dataType:ge})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSNumberInput),{name:`aw-len-${V.modelId}`,width:"100%",placeholder:"len",disabled:h(V),"model-value":(be=V.dbAttrs[0])==null?void 0:be.length,"onUpdate:modelValue":ge=>j(V,{length:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",wk,[t.createElementVNode("div",vk,[t.createVNode(t.unref(ie.BSCheckbox),{name:`aw-pk-${V.modelId}`,label:"PK","model-value":V.identifier,disabled:a.value||h(V),"onUpdate:modelValue":ge=>b(V,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`aw-nn-${V.modelId}`,label:"NN","model-value":V.notNull,disabled:h(V),"onUpdate:modelValue":ge=>p(V,{notNull:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`aw-uq-${V.modelId}`,label:"UQ","model-value":!!((S=V.dbAttrs[0])!=null&&S.unique),disabled:h(V),"onUpdate:modelValue":ge=>j(V,{unique:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])]),t.createElementVNode("td",{class:"c-del",title:y(V)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(i.value.modelId,V.modelId)},null,8,["onClick"])],8,xk)],2),c(V.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":r.value.has(V.modelId)}])},[M[12]||(M[12]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",Ik,[t.createElementVNode("div",Ck,[t.createElementVNode("fieldset",Sk,[M[10]||(M[10]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",$k,[M[7]||(M[7]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(ie.BSNumberInput),{name:`aw-scale-${V.modelId}`,width:"72px",placeholder:"scale",disabled:h(V)||!v(V),"model-value":(Q=V.dbAttrs[0])==null?void 0:Q.scale,"onUpdate:modelValue":ge=>j(V,{scale:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ie.BSCheckbox),{name:`aw-ai-${V.modelId}`,label:"Auto Increment","model-value":!!((P=V.dbAttrs[0])!=null&&P.autoIncrement),disabled:h(V)||!V.identifier,"onUpdate:modelValue":ge=>j(V,{autoIncrement:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",Rk,[M[8]||(M[8]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ie.BSSelect),{name:`aw-ins-${V.modelId}`,width:"110px",disabled:h(V),"model-value":A(V.dbAttrs[0]),items:oe,"value-provider":f,"label-provider":R,"onUpdate:modelValue":ge=>ge&&he(V,ge)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",Ak,[M[9]||(M[9]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ie.BSSelect),{name:`aw-upd-${V.modelId}`,width:"110px",disabled:h(V),"model-value":G(V.dbAttrs[0]),items:ke,"value-provider":f,"label-provider":ve,"onUpdate:modelValue":ge=>ge&&Z(V,ge)},null,8,["name","disabled","model-value","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",Tk,[M[11]||(M[11]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(ie.BSCheckbox),{name:`aw-tr-${V.modelId}`,label:"@Transient","model-value":!!V.transient,disabled:V.identifier,"onUpdate:modelValue":ge=>N(V,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`aw-nid-${V.modelId}`,label:"@NaturalId","model-value":!!V.naturalId,disabled:V.identifier||h(V),"onUpdate:modelValue":ge=>g(V,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${V.modelId}`,label:"mutable","model-value":!!V.naturalIdMutable,disabled:h(V)||!V.naturalId,"onUpdate:modelValue":ge=>p(V,{naturalIdMutable:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`aw-mv-${V.modelId}`,label:"Multi-Value (Set)","model-value":!!((xe=V.dbAttrs[0])!=null&&xe.multiValue),disabled:h(V),"onUpdate:modelValue":ge=>j(V,{multiValue:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("fieldset",Vk,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",Mk,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ie.BSSelect),{width:"150px","model-value":F(V),items:u,"value-provider":f,"label-provider":m,"onUpdate:modelValue":ge=>ge&&I(V,ge)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(t.openBlock(),t.createElementBlock("label",Bk,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(ju,{"model-value":V.groupCode,items:W.value,locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ge=>ne(V,ge)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",Dk,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),ee(V).length?(t.openBlock(),t.createBlock(t.unref(ie.BSSelect),{key:0,width:"150px","model-value":V.defaultValue??"none",items:ae(V),"value-provider":L,"label-provider":U,"onUpdate:modelValue":ge=>ge&&ue(V,ge)},null,8,["model-value","items","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ie.BSTextInput),{key:1,name:`aw-default-${V.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":V.defaultValue??"","onUpdate:modelValue":ge=>Ne(V,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),i.value.attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",eN,[t.createElementVNode("td",tN,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,ck)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-239d9c39"]]),aN=["disabled"],rN={class:"em-idxw__list"},lN={class:"em-idxw__list-head"},sN=["onClick"],cN={class:"em-idxw__item-name"},dN={key:0,class:"em-idxw__badge"},uN={class:"em-idxw__item-cnt"},mN={key:0,class:"em-idxw__empty"},fN={key:0,class:"em-idxw__edit"},pN={class:"em-idxw__form"},hN={class:"em-field em-idxw__name"},yN={class:"em-field"},gN=["value","placeholder"],bN={class:"em-idxw__transfer"},_N={class:"em-idxw__pane"},EN={class:"em-idxw__pane-head"},kN={class:"em-idxw__cols"},NN=["onClick"],wN=["title"],vN={key:0,class:"em-idxw__empty"},xN={class:"em-idxw__arrows"},IN={class:"em-idxw__pane"},CN={class:"em-idxw__pane-head"},SN={class:"em-idxw__cols"},$N={class:"em-idxw__col-name"},RN=["title"],AN={class:"em-idxw__col-ops"},TN=["title","disabled","onClick"],VN=["title","disabled","onClick"],MN=["title","onClick"],BN={key:0,class:"em-idxw__empty"},DN={key:1,class:"em-idxw__edit em-idxw__edit--empty"},ON=Ge(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(v=>v.modelId===n.entityId)??null),a=t.computed(()=>{var v;return((v=i.value)==null?void 0:v.indexes)??[]}),r=t.computed(()=>{var v;return((v=i.value)==null?void 0:v.attributes)??[]}),l=t.ref(null);t.watch(a,v=>{var T;v.some(F=>F.modelId===l.value)||(l.value=((T=v[0])==null?void 0:T.modelId)??null)},{immediate:!0});const s=t.computed(()=>a.value.find(v=>v.modelId===l.value)??null),c=t.computed(()=>i.value?go(i.value,o.superClassCatalog.value):[]),d=t.computed(()=>{var v;return new Set(((v=s.value)==null?void 0:v.columns.map(T=>T.columnRef))??[])}),u=t.computed(()=>[...r.value.filter(v=>!d.value.has(v.modelId)).map(v=>({ref:v.modelId,label:f(v),inherited:!1})),...c.value.filter(v=>!d.value.has(v.modelId)).map(v=>({ref:v.modelId,label:p(v),inherited:!0}))]),m=t.ref(new Set);t.watch(l,()=>m.value=new Set);function f(v){var F;const T=(F=v.dbAttrs[0])==null?void 0:F.physicalName;return T&&T!==v.name?`${v.name} (${T})`:v.name}function p(v){return v.physicalName&&v.physicalName!==v.field?`${v.field} (${v.physicalName})`:v.field}function y(v){const T=r.value.find(I=>I.modelId===v);if(T)return f(T);const F=c.value.find(I=>I.modelId===v);return F?p(F):v}function g(v){return yo(v)}function _(v,T){i.value&&o.updateIndex(i.value.modelId,v,T)}function b(){var T;if(!i.value)return;const v=De();o.addIndex(i.value.modelId,{modelId:v,name:`idx_${(((T=i.value.indexes)==null?void 0:T.length)??0)+1}`,unique:!1,columns:[]}),l.value=v}function N(v){i.value&&o.removeIndex(i.value.modelId,v)}function h(v){s.value&&_(s.value.modelId,{parameters:v.trim()===""?void 0:v})}function E(v){const T=new Set(m.value);T.has(v)?T.delete(v):T.add(v),m.value=T}function D(){const v=s.value;if(!v||!m.value.size)return;const T=[...m.value].map(F=>({columnRef:F,descending:!1}));_(v.modelId,{columns:[...v.columns,...T]}),m.value=new Set}function $(v){const T=s.value;T&&_(T.modelId,{columns:T.columns.filter((F,I)=>I!==v)})}function H(v,T){const F=s.value;F&&_(F.modelId,{columns:F.columns.map((I,le)=>le===v?{...I,descending:T}:I)})}function j(v,T){const F=s.value;if(!F)return;const I=v+T;if(I<0||I>=F.columns.length)return;const le=[...F.columns];[le[v],le[I]]=[le[I],le[v]],_(F.modelId,{columns:le})}return(v,T)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",rN,[t.createElementVNode("div",lN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:b},null,8,["caption"])]),t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,F=>(t.openBlock(),t.createElementBlock("li",{key:F.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":F.modelId===l.value}]),onClick:I=>l.value=F.modelId},[t.createElementVNode("span",cN,t.toDisplayString(F.name||t.unref(o).t("em.attr.nameless")),1),F.unique?(t.openBlock(),t.createElementBlock("span",dN,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",uN,t.toDisplayString(F.columns.length),1)],10,sN))),128)),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",mN,t.toDisplayString(t.unref(o).t("em.index.empty")),1))])]),s.value?(t.openBlock(),t.createElementBlock("section",fN,[t.createElementVNode("div",pN,[t.createElementVNode("label",hN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":T[0]||(T[0]=F=>_(s.value.modelId,{name:F}))},null,8,["model-value"]),t.createVNode(Rn,{controller:t.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(ie.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":T[1]||(T[1]=F=>_(s.value.modelId,{unique:F}))},null,8,["model-value"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:T[2]||(T[2]=F=>N(s.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",yN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:T[3]||(T[3]=F=>h(F.target.value))},null,40,gN)]),t.createElementVNode("div",bN,[t.createElementVNode("div",_N,[t.createElementVNode("div",EN,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:u.value.length})),1),t.createElementVNode("ul",kN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,F=>(t.openBlock(),t.createElementBlock("li",{key:F.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":m.value.has(F.ref)}]),onClick:I=>E(F.ref)},[t.createTextVNode(t.toDisplayString(F.label),1),F.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,wN)):t.createCommentVNode("",!0)],10,NN))),128)),u.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",vN,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))])]),t.createElementVNode("div",xN,[t.createVNode(t.unref(ie.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!m.value.size,onClick:D},null,8,["caption","disabled"])]),t.createElementVNode("div",IN,[t.createElementVNode("div",CN,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:s.value.columns.length})),1),t.createElementVNode("ul",SN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value.columns,(F,I)=>(t.openBlock(),t.createElementBlock("li",{key:I,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",$N,[t.createTextVNode(t.toDisplayString(y(F.columnRef)),1),g(F.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,RN)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(ie.BSCheckbox),{name:`idxw-desc-${I}`,class:"em-check",label:"DESC","model-value":F.descending,"onUpdate:modelValue":le=>H(I,le)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",AN,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:t.unref(o).t("em.index.moveUp"),disabled:I===0,onClick:le=>j(I,-1)},"↑",8,TN),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:t.unref(o).t("em.index.moveDown"),disabled:I===s.value.columns.length-1,onClick:le=>j(I,1)},"↓",8,VN),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:le=>$(I)},"✕",8,MN)])]))),128)),s.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",BN,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))])])])])):(t.openBlock(),t.createElementBlock("section",DN,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,aN)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-76de4c26"]]),LN={class:"em-op-src"},PN=["placeholder"],zN={class:"em-op-src__actions"},Ku=Ge(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=ie.useModalHandle(),i=(l,s)=>Ct(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(ie.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",LN,[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,PN),[[t.vModelText,a.value]]),t.createElementVNode("div",zN,[t.createVNode(t.unref(ie.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(ie.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"]]),UN=["disabled"],FN={class:"em-ow__toolbar"},HN={class:"em-ow__count"},GN={class:"em-ow__scroll"},jN={class:"em-ow__table"},KN={class:"c-name"},YN={class:"c-desc"},WN={class:"c-pii"},qN={class:"c-src"},XN={class:"c-del"},JN={key:0},ZN={colspan:"6",class:"em-ow__empty"},QN=Ge(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ie.useModal(),a=t.computed(()=>o.state.logical.entities.find(y=>y.modelId===n.entityId)??null),r=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],l=["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 s(y){return y==="none"?o.t("em.common.noneParen"):y}const c=y=>y;function d(y,g){a.value&&o.updateOperation(a.value.modelId,y.modelId,g)}function u(y,g,_){d(y,{description:{...y.description,[g]:_}})}function m(y){return y.personalInfoAttributeType??"none"}function f(y,g){d(y,{personalInfoAttributeType:g==="none"?void 0:g})}function p(y){i.openModal({component:Ku,bind:{operationName:y.name,sourceCode:y.sourceCode??"",locale:o.uiLocale.value,onSave:g=>d(y,{sourceCode:g})}})}return(y,g)=>{var _,b;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",FN,[t.createElementVNode("span",HN,t.toDisplayString(t.unref(o).t("em.op.section",{n:((_=a.value.operations)==null?void 0:_.length)??0})),1),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:g[0]||(g[0]=N=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",GN,[t.createElementVNode("table",jN,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",KN,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),g[1]||(g[1]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",YN,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createElementVNode("th",WN,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",qN,t.toDisplayString(t.unref(o).t("em.op.body")),1),g[2]||(g[2]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.operations??[],N=>{var h;return t.openBlock(),t.createElementBlock("tr",{key:N.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":E=>d(N,{name:E})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:r,"value-provider":c,"label-provider":c,"onUpdate:modelValue":E=>E&&d(N,{visibility:E})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSTextInput),{name:`ow-desc-${N.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.descPlaceholderKo"),"model-value":((h=N.description)==null?void 0:h.ko)??"","onUpdate:modelValue":E=>u(N,"ko",E)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSSelect),{width:"100%","model-value":m(N),items:l,"value-provider":c,"label-provider":s,"onUpdate:modelValue":E=>E&&f(N,E)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(o).t(N.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:E=>p(N)},null,8,["caption","onClick"])]),t.createElementVNode("td",XN,[t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:E=>t.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])])}),128)),(b=a.value.operations)!=null&&b.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",JN,[t.createElementVNode("td",ZN,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,UN)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1c255914"]]),ew={class:"em-detail__tabs"},tw=["onClick"],nw={key:0,class:"em-detail__narrow"},ow=Ge(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ie.useModalHandle(),a=t.computed(()=>o.state.logical.entities.find(s=>s.modelId===n.entityId)??null);t.watch(a,s=>{s||i.close()});const r=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],l=t.ref("basics");return(s,c)=>{var d;return t.openBlock(),t.createBlock(t.unref(ie.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((d=a.value)==null?void 0:d.name)??""})},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",ew,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,u=>t.createElementVNode("button",{key:u.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":l.value===u.key}]),onClick:m=>l.value=u.key},t.toDisplayString(t.unref(o).t(u.labelKey)),11,tw)),64))]),t.createElementVNode("div",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value}])},[l.value==="basics"?(t.openBlock(),t.createElementBlock("div",nw,[t.createVNode(zu,{controller:t.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])])):l.value==="columns"?(t.openBlock(),t.createBlock(iN,{key:1,controller:t.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):l.value==="indexes"?(t.openBlock(),t.createBlock(ON,{key:2,controller:t.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(QN,{key:3,controller:t.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-785c4770"]]);function pa(e,n,o){e.openModal({component:ow,bind:{controller:t.markRaw(n),entityId:o}})}const Yu="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function iw(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=De(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=De();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=De()}for(const a of n.indexes??[]){a.modelId=De();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=De();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const aw=220;function rw(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||aw));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 rl=(e,n)=>({x:e.x+n.x,y:e.y+n.y}),Tn=Symbol("editorController");function Wu(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function ha(e,n){const o=[];for(const i of n.remove)o.push(bn(e,i));for(const i of n.update)o.push(gn(e,i.attributeId,i.patch));for(const i of n.add)o.push(Tt(e,i));return o}function ro(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function lo(e,n){const o=[];for(const[i,a]of gh(e,n,De))o.push(...ha(i,a));return o}function qu(e,n,o){const i=new Set(o.remove);return ro(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 ll(e,n){const o=So(e,n,De),i=ha(n,o),a=qu(e,n,o);return i.push(...lo(a,n)),i}function Xu(e){return e.attributes.flatMap(n=>n.dbAttrs).map(n=>({...n,modelId:De()}))}function lw(e,n){var d;const o=e.entities.find(u=>u.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((p,y)=>Math.max(p,y.order),-1)+1,m=new Set(o.attributes.map(p=>p.name));let f="id";for(let p=2;m.has(f);p++)f=`id${p}`;a={modelId:De(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:De(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(Tt(n,a))}const r=[];for(const u of e.entities)for(const m of u.attributes){if(((d=m.embedded)==null?void 0:d.embeddableRef)!==n)continue;const f=e.associations.find(_=>_.modelId===m.embedded.associationRef);if(!f)continue;const p=f.end1.entityRef===u.modelId,y=p?f.end1:f.end2,g=p?f.end2:f.end1;r.push({ownerId:u.modelId,dispId:m.modelId,assocId:f.modelId,end1:{entityRef:u.modelId,multiplicity:y.multiplicity,navigable:y.navigable,composition:!1},end2:{entityRef:n,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const l={...e,entities:e.entities.map(u=>{if(u.modelId===n)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const m=new Set(r.filter(f=>f.ownerId===u.modelId).map(f=>f.dispId));return m.size?{...u,attributes:u.attributes.filter(f=>!m.has(f.modelId))}:u}),associations:e.associations.map(u=>{const m=r.find(f=>f.assocId===u.modelId);return m?{...u,end1:m.end1,end2:m.end2}:u})},s=So(l,n,De);for(const u of r){const m=s.add.find(f=>{var p;return((p=f.derivedFrom)==null?void 0:p.associationRef)===u.assocId});m&&(u.end2.attributeRef=m.modelId)}for(const u of r)i.push(bn(u.ownerId,u.dispId)),i.push(Ii(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...ha(n,s));const c=qu(l,n,s);return i.push(...lo(c,n)),i}function sw(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var E;return((E=h.embedded)==null?void 0:E.associationRef)===r.modelId}))continue;const u=De(),m=d.attributes.reduce((h,E)=>Math.max(h,E.order),-1)+1,f=new Set(d.attributes.map(h=>h.name)),p=a(o.name);let y=p;for(let h=2;f.has(y);h++)y=`${p}${h}`;const g=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:De()})),_={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(Tt(c,_));const b=l?"end2":"end1",N=l?"end1":"end2";i.push(Ii(r.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:De()},[N]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function cw(e=Wu(),n={}){var Fe,gt;const o=t.reactive(e);let i=new mr(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=(w,B)=>Ct(u.value,w,B),f=t.ref(n.reservedWords),p=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),g=t.ref(n.flagEntitiesWithoutRelations??!1),_=t.ref(!1),b=t.ref(!1),N=t.ref(!1),h=t.ref(0),E=t.ref(null);let D=0;const $=w=>{if(n.onNotice){n.onNotice(w);return}E.value={text:w,id:++D}},H=t.ref(((Fe=n.meta)==null?void 0:Fe.schemaVersion)??1),j=t.ref(((gt=n.meta)==null?void 0:gt.opWriteEnabled)??!1),v=t.computed(()=>H.value>=2&&j.value),T=n.historyTransport,F=t.computed(()=>v.value&&T!==void 0),I=n.restoreTransport,le=t.ref(0),k=t.computed(()=>v.value&&C.value&&I!==void 0);async function Y(w){if(!I||!C.value)return{ok:!1,reason:"unavailable"};const B=await I(w);return B.ok&&le.value++,B}const C=t.ref(!(H.value>=2&&j.value===!1)),W=t.ref("LOGICAL_PHYSICAL"),ee=t.ref("straight"),ae=t.ref(!0),L=t.ref(!0),U=t.ref(null),ne=t.computed(()=>{var w;return((w=U.value)==null?void 0:w.kind)==="attribute"?{entityId:U.value.entityId,attrId:U.value.anchor}:null}),ue=t.computed(()=>{var w;return((w=U.value)==null?void 0:w.kind)==="attribute"?U.value.ids:[]}),Ne=t.computed(()=>{var w,B;return((w=U.value)==null?void 0:w.kind)==="entity"?U.value.id:((B=U.value)==null?void 0:B.kind)==="attribute"?U.value.entityId:null}),se=t.ref(null);let me=0;const _e=t.ref(null),Ie=t.ref(null);let Ve=n.meta;function Te(){i.onChange(()=>{_.value=i.canUndo,b.value=i.canRedo,N.value=i.isDirty,h.value++})}Te();let pe=null,ke=null;function ve(){ke==null||ke(),ke=null,pe=null}function G(){if(ve(),!v.value||!n.opTransport)return;const w=new yc({diagramId:o.layout.diagramId,state:o,transport:n.opTransport,origin:"gui",onFreeze:B=>{C.value=!1,Ie.value=B},onError:n.onOpError});w.seed((Ve==null?void 0:Ve.revSeed)??{}),ke=w.attach(i),pe=w}G();const O=t.computed(()=>Bl(o.logical,o.layout)),Z=t.computed(()=>({reservedWords:f.value,selectableDataTypes:p.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),oe=t.computed(()=>os(o.logical,Z.value)),R=t.computed(()=>{const w=new Map;for(const B of oe.value){if(!B.targetRef)continue;const x=w.get(B.targetRef);x?x.push(B):w.set(B.targetRef,[B])}return w}),A=w=>{C.value&&i.execute(w)},K=w=>o.layout.entityLayouts.some(B=>B.entityRef===w&&!!B.locked),he=w=>o.layout.groupLayouts.some(B=>B.groupRef===w&&!!B.locked),we=w=>{const B=o.logical.associations.find(x=>x.modelId===w);return!!B&&(K(B.end1.entityRef)||K(B.end2.entityRef))},Se=(w,B,x)=>{if(K(w))return;const M=gn(w,B,x),V=ro(o.logical,w,J=>J.map(q=>q.modelId===B?{...q,...x}:q)),ce=lo(V,w);A(ce.length?We("속성 수정",[M,...ce]):M)};function Ce(w){const B=w.map(te=>o.layout.entityLayouts.find(re=>re.entityRef===te)).filter(te=>!!te);if(!B.length)return{location:{x:40,y:40},size:{width:400,height:300}};let x=1/0,M=1/0,V=-1/0,ce=-1/0;for(const te of B){const re=te.geo.size.width||220,be=te.geo.size.height||140;x=Math.min(x,te.geo.location.x),M=Math.min(M,te.geo.location.y),V=Math.max(V,te.geo.location.x+re),ce=Math.max(ce,te.geo.location.y+be)}const J=40,q=28;return{location:{x:x-J,y:M-J-q},size:{width:V-x+J*2,height:ce-M+J*2+q}}}function Pe(w,B,x){var te;const M=o.layout.groupLayouts.find(re=>re.groupRef===w),V=(M==null?void 0:M.geo.location)??B,ce=B.x-V.x,J=B.y-V.y,q=[Ls(w,B),...x.map(re=>Wn(re.id,re.location))];if(ce||J){const re=new Set(((te=o.logical.groups.find(be=>be.modelId===w))==null?void 0:te.memberEntityRefs)??[]);for(const be of o.logical.associations){if(!re.has(be.end1.entityRef)||!re.has(be.end2.entityRef))continue;const S=o.layout.associationLayouts.find(Q=>Q.associationRef===be.modelId);S&&S.waypoints.length&&q.push(Qs(be.modelId,ce,J))}for(const be of(M==null?void 0:M.memberNoteRefs)??[]){const S=o.layout.notes.find(Q=>Q.modelId===be);S&&q.push(Co(be,{x:S.geo.location.x+ce,y:S.geo.location.y+J}))}}return q}const Ke={state:o,resolved:O,issues:oe,issuesByRef:R,flagEntitiesWithoutRelations:g,canUndo:_,canRedo:b,dirty:N,revision:h,notice:E,editable:C,schemaVersion:H,opWriteEnabled:j,opMode:v,opConflict:Ie,historyTransport:T,historyAvailable:F,restoreTransport:I,restoreAvailable:k,restoreToSeq:Y,reloadRequest:le,displayMode:W,routingMode:ee,showGrid:ae,showMinimap:L,selection:U,selectedAttr:ne,selectedAttrIds:ue,inspectedEntityId:Ne,focusRequest:se,clipboard:_e,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,uiLocale:u,t:m,selectableDataTypes:p,setEditable(w){C.value=w&&v.value},setEmbeddableCatalog(w){a.value=w},setGroupCodeCatalog(w){r.value=w},setPredefinedCustomTypeCatalog(w){l.value=w},setSuperClassCatalog(w){s.value=w},selectAttribute(w,B,x="replace"){const M=U.value,V=(M==null?void 0:M.kind)==="attribute"&&M.entityId===w;if(x==="replace"||!V){U.value={kind:"attribute",entityId:w,ids:[B],anchor:B};return}if(x==="toggle"){const S=M.ids.includes(B),Q=S?M.ids.filter(xe=>xe!==B):[...M.ids,B];if(!Q.length){U.value=null;return}const P=S&&M.anchor===B?Q[Q.length-1]:S?M.anchor:B;U.value={kind:"attribute",entityId:w,ids:Q,anchor:P};return}const ce=o.logical.entities.find(S=>S.modelId===w),J=[...(ce==null?void 0:ce.attributes)??[]].sort((S,Q)=>S.order-Q.order).map(S=>S.modelId),q=J.indexOf(M.anchor),te=J.indexOf(B);if(q<0||te<0){U.value={kind:"attribute",entityId:w,ids:[B],anchor:B};return}const[re,be]=q<=te?[q,te]:[te,q];U.value={kind:"attribute",entityId:w,ids:J.slice(re,be+1),anchor:M.anchor}},moveAttributeFocus(w){const B=U.value;if((B==null?void 0:B.kind)!=="attribute")return!1;const x=o.logical.entities.find(J=>J.modelId===B.entityId);if(!x||!x.attributes.length)return!1;const M=x.attributes.findIndex(J=>J.modelId===B.anchor);if(M<0)return!1;const V=Math.min(Math.max(M+w,0),x.attributes.length-1);if(V===M)return!0;const ce=x.attributes[V].modelId;return U.value={kind:"attribute",entityId:B.entityId,ids:[ce],anchor:ce},!0},nudgeSelectedAttributes(w){const B=U.value;if((B==null?void 0:B.kind)!=="attribute")return!1;const x=o.logical.entities.find(S=>S.modelId===B.entityId);if(!x)return!1;const M=x.attributes,V=new Set(B.ids),ce=M.map((S,Q)=>V.has(S.modelId)?Q:-1).filter(S=>S>=0);if(!ce.length)return!1;const J=Math.min(...ce),q=M.filter(S=>!V.has(S.modelId)),te=M.slice(0,J).filter(S=>!V.has(S.modelId)).length;let re;if(w<0){if(te<=0)return!0;re=te-1}else{if(q.length-te<=0)return!0;re=te+1}if(K(B.entityId))return!0;const be=M.filter(S=>V.has(S.modelId)).map(S=>S.modelId);return A(pr(B.entityId,be,re)),!0},deleteSelection(){if(!C.value)return!1;const w=U.value;if(!w)return!1;if(w.kind==="attribute"){if(K(w.entityId))return!1;const B=w.ids;if(!B.length)return!1;B.length===1?Ke.removeAttribute(w.entityId,B[0]):Ke.removeAttributes(w.entityId,B)}else if(w.kind==="entity"){if(K(w.id))return!1;Ke.removeEntity(w.id)}else if(w.kind==="note")Ke.removeNote(w.id);else if(w.kind==="group"){if(he(w.id))return!1;Ke.removeGroup(w.id)}else Ke.removeAssociation(w.id);return U.value=null,!0},nudgeNodes(w,B,x){if(!w.length||B===0&&x===0)return!1;const M=new Set(o.logical.entities.map(re=>re.modelId)),V=new Set(o.logical.groups.map(re=>re.modelId)),ce=new Set(o.layout.notes.map(re=>re.modelId)),J=new Set;for(const re of w){if(!V.has(re))continue;const be=o.logical.groups.find(S=>S.modelId===re);for(const S of(be==null?void 0:be.memberEntityRefs)??[])J.add(S)}const q=[],te=[];for(const re of w)if(V.has(re)){if(he(re))continue;const be=o.layout.groupLayouts.find(xe=>xe.groupRef===re);if(!be)continue;const S=o.logical.groups.find(xe=>xe.modelId===re),Q=((S==null?void 0:S.memberEntityRefs)??[]).map(xe=>{var Ue;const ge=((Ue=o.layout.entityLayouts.find(z=>z.entityRef===xe))==null?void 0:Ue.geo.location)??{x:0,y:0};return{id:xe,location:{x:ge.x+B,y:ge.y+x}}}),P={x:be.geo.location.x+B,y:be.geo.location.y+x};q.push(We("그룹 이동",Pe(re,P,Q))),te.push("g:"+re)}else if(M.has(re)){if(J.has(re)||K(re))continue;const be=o.layout.entityLayouts.find(S=>S.entityRef===re);if(!be)continue;q.push(Wn(re,{x:be.geo.location.x+B,y:be.geo.location.y+x})),te.push("e:"+re)}else if(ce.has(re)){const be=o.layout.notes.find(S=>S.modelId===re);if(!be)continue;q.push(Co(re,{x:be.geo.location.x+B,y:be.geo.location.y+x})),te.push("n:"+re)}return q.length?(A(We("이동",q,"nudge:"+te.sort().join(","))),!0):!1},requestFocus(w){se.value={id:w,nonce:++me}},undo:()=>{C.value&&i.undo()},redo:()=>{C.value&&i.redo()},markSaved:()=>{C.value&&(pe==null||pe.flush(),i.markSavePoint())},loadDiagram(w,B){ve(),o.logical=w.logical,o.layout=w.layout,i=new mr(o),Te(),H.value=(B==null?void 0:B.schemaVersion)??1,j.value=(B==null?void 0:B.opWriteEnabled)??!1,C.value=!(H.value>=2&&j.value===!1),Ve=B,Ie.value=null,U.value=null,_.value=i.canUndo,b.value=i.canRedo,N.value=i.isDirty,G()},flush(){pe==null||pe.flush()},whenOpsSettled(){return(pe==null?void 0:pe.whenSettled())??Promise.resolve()},addEntity(w="NewEntity",B={x:80,y:80}){const x=De(),M={modelId:x,name:w,stereotype:"JPA_ENTITY",table:{physicalName:w.toLowerCase()},attributes:[{modelId:De(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:De(),physicalName:"id",dataType:"BIGINT"}]}]};return A(ki(M,{location:{...B},size:{width:220,height:140}})),x},renameEntity(w,B){K(w)||A(Rs(w,B))},updateEntity(w,B){if(K(w))return;const x=$s(w,B),M=o.logical.entities.find(J=>J.modelId===w),V=B.stereotype==="JPA_EMBEDDABLE"&&!!M&&M.stereotype!=="JPA_EMBEDDABLE",ce=!!B.stereotype&&B.stereotype!=="JPA_EMBEDDABLE"&&!!M&&M.stereotype==="JPA_EMBEDDABLE";if(V&&M){const J=M.attributes.filter(S=>S.identifier&&!S.derivedFrom).map(S=>gn(w,S.modelId,{identifier:!1})),q=ro({...o.logical,entities:o.logical.entities.map(S=>S.modelId===w?{...S,stereotype:"JPA_EMBEDDABLE"}:S)},w,S=>S.map(Q=>Q.identifier&&!Q.derivedFrom?{...Q,identifier:!1}:Q)),te=ll(q,w),re=sw(o.logical,w),be=[x,...J,...te,...re];A(be.length>1?We("임베더블 변환",be):x);return}if(ce){const J=lw(o.logical,w),q=[x,...J];A(q.length>1?We("엔터티 전환",q):x);return}A(x)},moveEntity(w,B){K(w)||A(Wn(w,B))},resizeEntity(w,B){K(w)||A(As(w,B))},removeEntity(w){K(w)||A(Ss(w))},setEntitySwatch(w,B){A(Ts(w,B))},setEntityCollapsed(w,B){A(Vs(w,B))},setEntityLocked(w,B){A(Ms(w,B))},isEntityLocked(w){return K(w)},collapseAll(){A(fr(!0))},expandAll(){A(fr(!1))},setAttributeSwatch(w,B,x){A(Ni(w,B,x))},dragGroup(w,B,x){he(w)||A(We("그룹 이동",Pe(w,B,x)))},resizeGroup(w,B){he(w)||A(Ps(w,B))},setGroupSwatch(w,B){A(zs(w,B))},setGroupLocked(w,B){A(Us(w,B))},isGroupLocked(w){return he(w)},updateGroup(w,B){he(w)||A(Bs(w,B))},createGroup(w,B){if(!w.length)return null;const x=[];for(const ce of o.logical.groups)for(const J of w)ce.memberEntityRefs.includes(J)&&x.push(vi(ce.modelId,J));const M=De(),V={modelId:M,name:B?{ko:B}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...w]};return x.push(wi(V,Ce(w))),A(We("그룹 생성",x)),U.value=null,M},addEmptyGroup(w,B){const x=De();return A(wi({modelId:x,name:B?{ko:B}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...w},size:{width:360,height:260}})),x},removeGroup(w){he(w)||A(Ds(w))},dropEntity(w,B,x){var ce;if(K(w))return;const M=((ce=o.logical.groups.find(J=>J.memberEntityRefs.includes(w)))==null?void 0:ce.modelId)??null,V=[Wn(w,B)];M!==x&&(M&&V.push(vi(M,w)),x&&V.push(Os(x,w))),A(We("이동",V))},ungroupEntity(w){const B=o.logical.groups.find(x=>x.memberEntityRefs.includes(w));B&&A(vi(B.modelId,w))},dropNote(w,B,x){var ce;const M=((ce=o.layout.groupLayouts.find(J=>{var q;return(q=J.memberNoteRefs)==null?void 0:q.includes(w)}))==null?void 0:ce.groupRef)??null,V=[Co(w,B)];M!==x&&(M&&V.push(sc(M,w)),x&&V.push(lc(x,w))),A(We("이동",V))},addPredefinedEmbed(w,B){if(K(w))return;const x=a.value.find(te=>te.type===B),M=o.logical.entities.find(te=>te.modelId===w);if(!x||!M)return;const V=M.attributes.reduce((te,re)=>Math.max(te,re.order),-1)+1,ce=De(),J=x.fields.map(()=>({modelId:De(),physicalName:"",dataType:""})),q={modelId:ce,name:x.defaultName,type:x.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:V,dbAttrs:J};return A(Tt(w,q)),ce},addAttribute(w,B={}){if(K(w))return B.modelId??"";const x=o.logical.entities.find(be=>be.modelId===w),M=x?x.attributes.length:0,V=B.modelId??De(),ce=B.name??`field${M}`,J={modelId:V,name:ce,type:B.type??Xa,attrType:B.attrType??"NORMAL",identifier:B.identifier??!1,notNull:B.notNull??!1,order:M,dbAttrs:B.dbAttrs??[{modelId:De(),physicalName:ce,dataType:"VARCHAR",length:255}],...B},q=Tt(w,J),te=ro(o.logical,w,be=>[...be,J]),re=lo(te,w);return A(re.length?We("속성 추가",[q,...re]):q),V},addDivider(w){if(K(w))return"";const B=o.logical.entities.find(ce=>ce.modelId===w),x=B?B.attributes.length:0,M=De();return A(Tt(w,{modelId:M,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:x,dbAttrs:[]})),M},updateAttribute(w,B,x){Se(w,B,x)},setAttributeGroupCode(w,B,x){Se(w,B,{groupCode:x,type:x?Pn:Xa})},setEmbedColumns(w,B,x){var te,re;if(K(w))return;const M=gn(w,B,{dbAttrs:x}),V=(te=o.logical.entities.find(be=>be.modelId===w))==null?void 0:te.attributes.find(be=>be.modelId===B),ce=(re=V==null?void 0:V.embedded)==null?void 0:re.associationRef,J=ce?o.logical.associations.find(be=>be.modelId===ce):void 0,q=[];J&&ce&&(J.end1.legacyEmbedRaw&&q.push(Vt(ce,"end1",{legacyEmbedRaw:void 0})),J.end2.legacyEmbedRaw&&q.push(Vt(ce,"end2",{legacyEmbedRaw:void 0}))),A(q.length?We("임베드 컬럼 수정",[M,...q]):M)},removeAttribute(w,B){if(K(w))return;if(Ri(o.logical,w,B)){$(Yu);return}const x=bn(w,B),M=ro(o.logical,w,ce=>ce.filter(J=>J.modelId!==B)),V=lo(M,w);A(V.length?We("속성 삭제",[x,...V]):x)},removeAttributes(w,B){var q;if(!B.length||K(w))return;const x=B.filter(te=>!Ri(o.logical,w,te));if(x.length<B.length&&$(Yu),!x.length)return;const M=x.map(te=>bn(w,te)),V=new Set(x),ce=ro(o.logical,w,te=>te.filter(re=>!V.has(re.modelId))),J=[...M,...lo(ce,w)];A(J.length===1?J[0]:We("속성 삭제",J)),((q=U.value)==null?void 0:q.kind)==="attribute"&&U.value.entityId===w&&(U.value=null)},setAttributeSwatches(w,B,x){B.length&&(B.length===1?A(Ni(w,B[0],x)):A(We("속성 색상",B.map(M=>Ni(w,M,x)))))},reorderAttributes(w,B,x){!B.length||K(w)||A(pr(w,B,x))},addIndex(w,B){K(w)||A(Ws(w,B))},updateIndex(w,B,x){K(w)||A(qs(w,B,x))},removeIndex(w,B){K(w)||A(Xs(w,B))},addOperation(w,B={}){var J;if(K(w))return B.modelId??"";const x=o.logical.entities.find(q=>q.modelId===w),M=((J=x==null?void 0:x.operations)==null?void 0:J.length)??0,V=B.modelId??De(),ce={modelId:V,name:B.name??`method${M}`,visibility:B.visibility??"PACKAGE",order:M,...B};return A(Fs(w,ce)),V},updateOperation(w,B,x){K(w)||A(Hs(w,B,x))},removeOperation(w,B){K(w)||A(Gs(w,B))},reorderOperations(w,B,x){!B.length||K(w)||A(js(w,B,x))},setOperationSwatch(w,B,x){A(Ks(w,B,x))},addAssociation(w,B,x,M){if(K(w)||K(B))return"";const V=De(),ce={modelId:V,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:B,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},J={...o.logical,associations:[...o.logical.associations,ce]},q=So(J,B,De),te=q.add[0];te&&(ce.end2.attributeRef=te.modelId);const re={associationRef:V,waypoints:[],sourceColumnRef:x,targetColumnRef:(te==null?void 0:te.modelId)??M},be=xi(ce,re),S=ha(B,q);return A(S.length?We("관계 추가",[be,...S]):be),V},addEmbedAssociation(w,B){if(K(w))return;const x=o.logical.entities.find(Ue=>Ue.modelId===w),M=o.logical.entities.find(Ue=>Ue.modelId===B);if(!x||!M||M.stereotype!=="JPA_EMBEDDABLE")return;const V=De(),ce=De(),J=De(),q=x.attributes.reduce((Ue,z)=>Math.max(Ue,z.order),-1)+1,te=Xu(M),re=Ue=>Ue&&Ue.charAt(0).toLowerCase()+Ue.slice(1),be=new Set(x.attributes.map(Ue=>Ue.name)),S=re(M.name);let Q=S;for(let Ue=2;be.has(Q);Ue++)Q=`${S}${Ue}`;const P={modelId:ce,name:Q,type:M.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:q,dbAttrs:te,embedded:{associationRef:V,embeddableRef:B}},xe={modelId:V,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:J},end2:{entityRef:B,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:ce}},ge={associationRef:V,waypoints:[],sourceColumnRef:ce,targetColumnRef:void 0};return A(We("임베드 추가",[Tt(w,P),xi(xe,ge)])),V},setEmbedCardinality(w,B){var S;if(we(w))return;const x=o.logical.associations.find(Q=>Q.modelId===w);if(!x)return;let M,V;for(const Q of o.logical.entities){const P=Q.attributes.find(xe=>{var ge;return((ge=xe.embedded)==null?void 0:ge.associationRef)===w&&xe.attrType==="EMBED_OWN"});if(P){M=Q.modelId,V=P;break}}if(!M||!V)return;const ce=V.embedded.embeddableRef,J=x.end2.entityRef===ce?"end2":"end1",q=x[J];if(q.multiplicity===B)return;const te=Q=>Q==="ZERO_OR_MORE_INSTANCES"||Q==="ONE_OR_MORE_INSTANCES",re=te(q.multiplicity),be=te(B);if(re===be){A(Vt(w,J,{multiplicity:B}));return}if(be)A(We("임베드 컬렉션 전환",[gn(M,V.modelId,{dbAttrs:[]}),Vt(w,J,{multiplicity:B,jpa:{...q.jpa,collectionType:((S=q.jpa)==null?void 0:S.collectionType)??"LIST"}})]));else{const Q=o.logical.entities.find(P=>P.modelId===ce);if(!Q)return;A(We("임베드 단일 전환",[gn(M,V.modelId,{dbAttrs:Xu(Q)}),Vt(w,J,{multiplicity:B,jpa:{...q.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(w){if(we(w))return;const B=o.logical.associations.find(J=>J.modelId===w),x=Ys(w);if(!B){A(x);return}for(const J of o.logical.entities){const q=J.attributes.find(te=>{var re;return((re=te.embedded)==null?void 0:re.associationRef)===w});if(q){A(We("임베드 삭제",[x,bn(J.modelId,q.modelId)]));return}}const M=B.end2.entityRef,V={...o.logical,associations:o.logical.associations.filter(J=>J.modelId!==w)},ce=ll(V,M);A(ce.length?We("관계 삭제",[x,...ce]):x)},setAssociationIdentifying(w,B){if(we(w))return;const x=o.logical.associations.find(q=>q.modelId===w),M=Ii(w,{identifying:B});if(!x||x.identifying===B){A(M);return}const V=x.end2.entityRef,ce={...o.logical,associations:o.logical.associations.map(q=>q.modelId===w?{...q,identifying:B}:q)},J=ll(ce,V);A(J.length?We("식별 관계 변경",[M,...J]):M)},updateAssociationEnd(w,B,x){if(we(w))return;const M=o.logical.associations.find(V=>V.modelId===w);if(M&&B==="end1"&&"navigable"in x&&x.navigable!==M.end1.navigable){const V=o.logical.entities.find(q=>q.modelId===M.end1.entityRef),ce=o.logical.entities.find(q=>q.modelId===M.end2.entityRef),J=(V==null?void 0:V.stereotype)==="JPA_EMBEDDABLE"||(ce==null?void 0:ce.stereotype)==="JPA_EMBEDDABLE";if(V&&ce&&!J){if(x.navigable===!0&&!M.end1.attributeRef){const q=hr(M.end2.multiplicity),te=yr(ce.name,q),re=$c(te,new Set(V.attributes.map(P=>P.name))),be=De(),S=V.attributes.reduce((P,xe)=>Math.max(P,xe.order),-1)+1,Q={modelId:be,name:re,type:ce.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:S,dbAttrs:[]};A(We("inverse nav 추가",[Tt(M.end1.entityRef,Q),Vt(w,"end1",{...x,attributeRef:be})]));return}if(x.navigable===!1&&M.end1.attributeRef){const q=M.end1.attributeRef,te=V.attributes.find(be=>be.modelId===q&&be.attrType==="RELATION_REF"),re=Vt(w,"end1",{...x,attributeRef:void 0});A(te?We("inverse nav 제거",[bn(M.end1.entityRef,q),re]):re);return}}}A(Vt(w,B,x))},hasQuickFix(w){return C.value?ir(w,o.logical)!=null:!1},applyQuickFix(w){if(!C.value)return!1;const B=ir(w,o.logical);if(!B||we(B.assocRef))return!1;const x=o.logical.associations.find(M=>M.modelId===B.assocRef);return x?(A(Vt(B.assocRef,B.which,{jpa:{...x[B.which].jpa,cascadeTypes:B.cascades}})),!0):!1},moveWaypoint(w,B,x){A(Js(w,B,x))},addWaypoint(w,B,x){A(tc(w,B,x))},removeWaypoint(w,B){A(Zs(w,B))},clearWaypoints(w){A(ec(w))},addNote(w="메모",B={x:80,y:80}){const x=De();return A(nc({modelId:x,memo:w,geo:{location:{...B},size:{width:200,height:120}}})),x},removeNote(w){A(oc(w))},moveNote(w,B){A(Co(w,B))},resizeNote(w,B){A(ic(w,B))},setNoteMemo(w,B){A(ac(w,B))},setNoteSwatch(w,B){A(rc(w,B))},addNoteConnection(w,B){A(cc(w,B))},removeNoteConnection(w,B){A(dc(w,B))},moveNoteConnectionWaypoint(w,B,x,M){A(uc(w,B,x,M))},addNoteConnectionWaypoint(w,B,x,M){A(mc(w,B,x,M))},removeNoteConnectionWaypoint(w,B,x){A(fc(w,B,x))},clearNoteConnectionWaypoints(w,B){A(pc(w,B))},autoLayout(){const w=Ll(o.logical,o.layout);w.length&&A(We("자동 배치",w.map(B=>Wn(B.id,B.location))))},copy(w){if(w&&w.length){const q=w.filter(te=>o.logical.entities.some(re=>re.modelId===te));if(q.length){_e.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:o.logical,layout:o.layout},selectedIds:q}));return}}const B=U.value;if((B==null?void 0:B.kind)==="attribute"){const q=o.logical.entities.find(re=>re.modelId===B.entityId);if(!q)return;const te=[...q.attributes].sort((re,be)=>re.order-be.order).filter(re=>B.ids.includes(re.modelId));if(!te.length)return;_e.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:te}));return}const x=Ne.value;if(!x)return;const M=o.logical.entities.find(q=>q.modelId===x),V=o.layout.entityLayouts.find(q=>q.entityRef===x);if(!M)return;const ce=(V==null?void 0:V.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let J;if(V){const{entityRef:q,geo:te,locked:re,...be}=V;Object.keys(be).length&&(J=be)}_e.value=JSON.parse(JSON.stringify({kind:"entity",entity:M,geo:ce,layoutExtras:J}))},paste(){if(!C.value)return[];const w=_e.value;if(!w)return[];if(w.kind==="entities")return Ke.importEntities(w.source,w.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(w.kind==="attribute"){const ce=Ne.value;if(!ce)return[];const J=o.logical.entities.find(Q=>Q.modelId===ce);if(!J)return[];const q=new Set(J.attributes.map(Q=>Q.name)),te=new Set(J.attributes.flatMap(Q=>Q.dbAttrs.map(P=>P.physicalName))),re=J.attributes.length,be=[],S=w.attributes.map((Q,P)=>{const xe=JSON.parse(JSON.stringify(Q));xe.modelId=De();for(const ge of xe.dbAttrs)ge.modelId=De();q.has(xe.name)&&(xe.name=`${xe.name}_copy`);for(const ge of xe.dbAttrs)ge.physicalName&&te.has(ge.physicalName)&&(ge.physicalName=`${ge.physicalName}_copy`);return xe.order=re+P,be.push(xe.modelId),Tt(ce,xe)});return A(S.length===1?S[0]:We("속성 붙여넣기",S)),U.value={kind:"attribute",entityId:ce,ids:be,anchor:be[be.length-1]},[]}const{clone:B,idMap:x}=iw(w.entity),M={location:{x:w.geo.location.x+40,y:w.geo.location.y+40},size:{...w.geo.size}};let V;if(w.layoutExtras){const ce={...w.layoutExtras},J=q=>x.get(q);ce.attributeStyles&&(ce.attributeStyles=bi(ce.attributeStyles,J)),ce.operationStyles&&(ce.operationStyles=bi(ce.operationStyles,J)),V=ce}return A(ki(B,M,V)),U.value={kind:"entity",id:B.modelId},[B.modelId]},importEntities(w,B,x){if(!C.value)return[];const M=ks(w,B,{existing:o.logical,includeRelated:x==null?void 0:x.includeRelated,collisionSuffix:x==null?void 0:x.collisionSuffix});if(M.logical.entities.length===0)return[];const V=(x==null?void 0:x.placement)??"append-right",ce=V==="append-right"?rw(o.layout,M.layout):V.offset,J=new Map(M.layout.entityLayouts.map(S=>[S.entityRef,S])),q=new Map(M.layout.associationLayouts.map(S=>[S.associationRef,S])),te=new Map(M.layout.groupLayouts.map(S=>[S.groupRef,S])),re=[];let be=80;for(const S of M.logical.entities){const Q=J.get(S.modelId),P=Q?{location:rl(Q.geo.location,ce),size:{...Q.geo.size}}:{location:{x:be+=40,y:80},size:{width:220,height:140}};let xe;if(Q){const{entityRef:ge,geo:Ue,locked:z,...X}=Q;xe=X}re.push(ki(S,P,xe))}for(const S of M.logical.associations){const Q=q.get(S.modelId),P=Q?{...Q,waypoints:Q.waypoints.map(xe=>rl(xe,ce))}:{associationRef:S.modelId,waypoints:[]};re.push(xi(S,P))}for(const S of M.logical.groups){const Q=te.get(S.modelId),P=Q?{location:rl(Q.geo.location,ce),size:{...Q.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let xe;if(Q){const{groupRef:ge,geo:Ue,locked:z,memberNoteRefs:X,...fe}=Q;xe=fe}re.push(wi(S,P,xe))}return A(We("다이어그램 가져오기",re)),U.value={kind:"entity",id:M.logical.entities[0].modelId},M.logical.entities.map(S=>S.modelId)}};return Ke}const ya=Symbol("groupHover"),Ju=Symbol("groupDrag"),so=Symbol("relationHighlight"),dw={key:0,class:"em-sel","aria-hidden":"true"},uw=["title","aria-expanded","disabled"],mw={class:"em-entity__stereotype"},fw={key:1,class:"em-entity__name"},pw=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],hw=["onPointerdown"],yw={key:1,class:"em-entity__divider-label"},gw=["title"],bw={class:"em-key-slot"},_w={class:"em-key-slot"},Ew={key:0,class:"em-entity__type"},kw=["onClick"],Nw={class:"em-entity__attrname"},ww={class:"em-entity__type"},vw=["data-op"],xw=["onPointerdown"],Iw={class:"em-entity__op-vis","aria-hidden":"true"},Cw=["title"],Sw={key:4,class:"em-entity__footer"},Zu=Ge(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(Tn,null),i=(J,q)=>o?o.t(J,q):Ct("ko",J,q),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=ie.useModal();function l(){o&&pa(r,o,n.id)}const s=t.inject(ya,null),c=t.inject(so,null),d=t.computed(()=>!!o&&o.editable.value);function u(){s&&(s.value=n.data.groupRef??null)}function m(){c==null||c.setEntityHover(n.id)}function f(){c==null||c.setEntityHover(null)}const p=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),y=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!p.value),g=t.computed(()=>{var J;return((J=o==null?void 0:o.selection.value)==null?void 0:J.kind)==="entity"&&o.selection.value.id===n.id}),_=t.computed(()=>!!n.selected&&!g.value),b=t.computed(()=>{var J;return o&&((J=o.selectedAttr.value)==null?void 0:J.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),N=t.computed(()=>b.value.size>0);function h(J,q){const te=q.shiftKey?"range":q.metaKey||q.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,J.modelId,te)}const E=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!g.value),D=t.computed(()=>n.data.entity),$=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),H=t.computed(()=>n.data.collapsed??!1),j=t.computed(()=>n.data.locked??!1);function v(){d.value&&(o==null||o.setEntityCollapsed(n.id,!H.value))}const T=t.computed(()=>$.value==="PHYSICAL"||$.value==="LOGICAL_PHYSICAL"),F=t.computed(()=>{const J=$.value==="PHYSICAL"||$.value==="LOGICAL_PHYSICAL",q={};for(const te of D.value.attributes){const re=te.attrType.startsWith("RELATION")&&te.dbAttrs.length>0;q[te.modelId]={pk:te.identifier,fk:re&&J,required:te.notNull&&!te.identifier}}return q});function I(J){if(!J)return"";const q=[];return J.pk&&J.fk?q.push(i("em.node.keyPfk")):J.pk?q.push(i("em.node.keyPk")):J.fk&&q.push(i("em.node.keyFk")),J.required&&q.push(i("em.node.required")),q.join(" · ")}const le=t.computed(()=>{const J=ol(ut(n.data.style)),q={};return J&&(q["--em-header-bg"]=J.bar,q["--em-header-fg"]=J.barOn),q});function k(J){var q,te;return(te=ol(ut((q=n.data.attributeStyles)==null?void 0:q[J.modelId])))==null?void 0:te.text}const Y=t.computed(()=>[...D.value.operations??[]].sort((J,q)=>J.order-q.order)),C=t.computed(()=>$.value==="CLASS"&&Y.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ee(J){return J?W[J]:"~"}function ae(J){var q,te;return(te=ol(ut((q=n.data.operationStyles)==null?void 0:q[J.modelId])))==null?void 0:te.text}function L(J,q,te){switch($.value){case"CLASS":return[{text:J}];case"PHYSICAL":return[{text:te||J}];case"LOGICAL":return[q?{text:q}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=q?{text:q}:{text:i("em.node.logicalMissing"),missing:!0};return te?[re,{text:` · ${te}`}]:[re]}}}function U(J){var q,te,re;return ne(J)?[{text:J.name}]:L(J.name,(te=(q=J.dbAttrs[0])==null?void 0:q.logicalName)==null?void 0:te[a.value],((re=J.dbAttrs[0])==null?void 0:re.physicalName)??"")}function ne(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}function ue(J){return J.attrType==="DIVIDER"}function Ne(J){if(J.attrType!=="EMBED_PREDEF")return J.dbAttrs;const q=o==null?void 0:o.embeddableCatalog.value.find(re=>re.type===J.type);if(!q)return J.dbAttrs;const te=mn(un(D.value,(o==null?void 0:o.state.logical.entities)??[]));return J.dbAttrs.map((re,be)=>{const S=q.fields[be],Q=Un(re,te);return Q?{...re,physicalName:Q.physicalName,logicalName:re.logicalName??(S==null?void 0:S.logicalName),dataType:re.dataType||(S==null?void 0:S.dataType)||""}:S?{...re,physicalName:re.physicalName||S.physicalName,logicalName:re.logicalName??S.logicalName,dataType:re.dataType||S.dataType,length:re.length??S.length}:re})}function se(J){var q;return L(J.physicalName,(q=J.logicalName)==null?void 0:q[a.value],J.physicalName)}function me(J){const q=Ja(J,(o==null?void 0:o.state.logical.associations)??[]);return Za($.value,J,q)}const _e=t.computed(()=>{var J,q,te;return L(D.value.name,(q=(J=D.value.table)==null?void 0:J.logicalName)==null?void 0:q[a.value],((te=D.value.table)==null?void 0:te.physicalName)??"")}),Ie=t.ref(!1),Ve=t.ref(""),Te=t.ref(null);async function pe(){var J,q;d.value&&(Ve.value=D.value.name,Ie.value=!0,await t.nextTick(),(J=Te.value)==null||J.focus(),(q=Te.value)==null||q.select())}function ke(){if(!Ie.value)return;Ie.value=!1;const J=Ve.value.trim();J&&J!==D.value.name&&(o==null||o.renameEntity(n.id,J))}function ve(){o==null||o.addAttribute(n.id)}function G(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:O,findNode:Z}=He(),oe=t.ref(null),R=t.computed(()=>{const J=oe.value??n.data.size;return J?{width:`${J.width}px`,minHeight:`${J.height}px`}:void 0});let A=null;function K(J){var re,be,S;if(!d.value)return;J.stopPropagation();const q=(re=Z(n.id))==null?void 0:re.dimensions,te=O({x:J.clientX,y:J.clientY});A={fx:te.x,fy:te.y,w:(q==null?void 0:q.width)??((be=n.data.size)==null?void 0:be.width)??200,h:(q==null?void 0:q.height)??((S=n.data.size)==null?void 0:S.height)??120},J.target.setPointerCapture(J.pointerId)}function he(J){if(!A)return;const q=O({x:J.clientX,y:J.clientY});oe.value={width:Math.max(40,A.w+(q.x-A.fx)),height:Math.max(40,A.h+(q.y-A.fy))}}function we(J){var q,te,re;if(A&&oe.value&&o){const be=(q=Z(n.id))==null?void 0:q.dimensions;o.resizeEntity(n.id,{width:Math.round((be==null?void 0:be.width)??oe.value.width),height:Math.round((be==null?void 0:be.height)??oe.value.height)})}A=null,oe.value=null,(re=(te=J.target).releasePointerCapture)==null||re.call(te,J.pointerId)}const Se=t.ref(null),Ce=t.ref(null);function Pe(J,q){if(!d.value)return;q.stopPropagation(),q.preventDefault();const te=b.value,re=te.has(J.modelId)?new Set(te):new Set([J.modelId]);Ce.value={ids:re,dropIndex:-1,lineY:0},q.target.setPointerCapture(q.pointerId)}function Ke(J){if(!Ce.value||!Se.value)return;const q=Array.from(Se.value.querySelectorAll(".em-entity__row"));if(!q.length)return;let te=q.length;for(let S=0;S<q.length;S++){const Q=q[S].getBoundingClientRect();if(J.clientY<Q.top+Q.height/2){te=S;break}}const re=q[q.length-1],be=te<q.length?q[te].offsetTop:re.offsetTop+re.offsetHeight;Ce.value={...Ce.value,dropIndex:te,lineY:be}}function Fe(){const J=Ce.value;if(Ce.value=null,!J||J.dropIndex<0)return;const q=D.value.attributes,te=q.filter(P=>J.ids.has(P.modelId)).map(P=>P.modelId),re=q.filter((P,xe)=>J.ids.has(P.modelId)&&xe<J.dropIndex).length,be=J.dropIndex-re,S=q.filter(P=>!J.ids.has(P.modelId)).map(P=>P.modelId);[...S.slice(0,be),...te,...S.slice(be)].join(",")!==q.map(P=>P.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,te,be))}function gt(){Ce.value=null}const w=t.ref(null),B=t.ref(null);function x(J,q){d.value&&(q.stopPropagation(),q.preventDefault(),B.value={id:J.modelId,dropIndex:-1,lineY:0},q.target.setPointerCapture(q.pointerId))}function M(J){if(!B.value||!w.value)return;const q=Array.from(w.value.querySelectorAll(".em-entity__op-row"));if(!q.length)return;let te=q.length;for(let S=0;S<q.length;S++){const Q=q[S].getBoundingClientRect();if(J.clientY<Q.top+Q.height/2){te=S;break}}const re=q[q.length-1],be=te<q.length?q[te].offsetTop:re.offsetTop+re.offsetHeight;B.value={...B.value,dropIndex:te,lineY:be}}function V(){const J=B.value;if(B.value=null,!J||J.dropIndex<0)return;const te=Y.value.findIndex(be=>be.modelId===J.id);if(te<0)return;const re=J.dropIndex-(te<J.dropIndex?1:0);re!==te&&(o==null||o.reorderOperations(n.id,[J.id],re))}function ce(){B.value=null}return(J,q)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":p.value,"is-related":y.value,"is-dimmed":E.value,"is-selected":g.value,"is-multi-selected":_.value,"has-focused-attr":N.value,"is-locked":j.value}]),style:t.normalizeStyle(R.value),onPointerdown:u,onMouseenter:m,onMouseleave:f,onDblclick:l},[g.value?(t.openBlock(),t.createElementBlock("div",dw,[...q[7]||(q[7]=[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(le.value),onDblclick:t.withModifiers(pe,["stop"])},[t.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:i(H.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!H.value,disabled:!d.value,onClick:t.withModifiers(v,["stop"]),onPointerdown:q[0]||(q[0]=t.withModifiers(()=>{},["stop"])),onDblclick:q[1]||(q[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(H.value?"▸":"▾"),41,uw),t.createElementVNode("span",mw,"«"+t.toDisplayString(D.value.stereotype)+"»",1),Ie.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Te,"onUpdate:modelValue":q[2]||(q[2]=te=>Ve.value=te),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(ke,["enter"]),q[3]||(q[3]=t.withKeys(te=>Ie.value=!1,["esc"]))],onBlur:ke,onPointerdown:q[4]||(q[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,Ve.value]]):(t.openBlock(),t.createElementBlock("span",fw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,(te,re)=>(t.openBlock(),t.createElementBlock("span",{key:re,class:t.normalizeClass({"em-entity__missing":te.missing})},t.toDisplayString(te.text),3))),128))])),j.value?(t.openBlock(),t.createBlock(Me,{key:2,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)],36),H.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:Se,class:"em-entity__attrs"},[Ce.value&&Ce.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${Ce.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.value.attributes,te=>{var re,be,S,Q;return t.openBlock(),t.createElementBlock(t.Fragment,{key:te.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(te.modelId),"is-dragging":(re=Ce.value)==null?void 0:re.ids.has(te.modelId),"is-embed":ne(te),"is-divider":ue(te),nodrag:ue(te)&&d.value}]),"data-attr":te.modelId,onClick:t.withModifiers(P=>h(te,P),["stop"]),onPointerdown:P=>ue(te)?Pe(te,P):void 0,onPointermove:P=>ue(te)?Ke(P):void 0,onPointerup:P=>ue(te)?Fe():void 0,onPointercancel:P=>ue(te)?gt():void 0},[d.value&&!ue(te)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:P=>Pe(te,P),onPointermove:Ke,onPointerup:Fe,onPointercancel:gt,onClick:q[5]||(q[5]=t.withModifiers(()=>{},["stop"]))},"⠿",40,hw)):t.createCommentVNode("",!0),ue(te)?(t.openBlock(),t.createElementBlock("span",yw,t.toDisplayString(te.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Cn),{id:`l:${te.modelId}`,type:"target",position:t.unref(Ae).Left,class:"em-handle"},null,8,["id","position"]),t.createElementVNode("span",{class:"em-entity__keys",title:I(F.value[te.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",bw,[(be=F.value[te.modelId])!=null&&be.pk?(t.openBlock(),t.createBlock(Me,{key:0,name:"key",size:12,class:"em-key is-pk"})):(S=F.value[te.modelId])!=null&&S.required?(t.openBlock(),t.createBlock(Me,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",_w,[ne(te)?(t.openBlock(),t.createBlock(Me,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(Q=F.value[te.modelId])!=null&&Q.fk?(t.openBlock(),t.createBlock(Me,{key:1,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,gw),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:k(te)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(U(te),(P,xe)=>(t.openBlock(),t.createElementBlock("span",{key:xe,class:t.normalizeClass({"em-entity__missing":P.missing})},t.toDisplayString(P.text),3))),128))],4),me(te)?(t.openBlock(),t.createElementBlock("span",Ew,t.toDisplayString(me(te)),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Cn),{id:`r:${te.modelId}`,type:"source",position:t.unref(Ae).Right,class:"em-handle"},null,8,["id","position"])],64))],42,pw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ne(te)&&T.value?Ne(te):[],P=>(t.openBlock(),t.createElementBlock("li",{key:`${te.modelId}:${P.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(te.modelId)}]),onClick:t.withModifiers(xe=>h(te,xe),["stop"])},[q[8]||(q[8]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",Nw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se(P),(xe,ge)=>(t.openBlock(),t.createElementBlock("span",{key:ge,class:t.normalizeClass({"em-entity__missing":xe.missing})},t.toDisplayString(xe.text),3))),128))]),t.createElementVNode("span",ww,t.toDisplayString(P.dataType),1)],10,kw))),128))],64)}),128))],512)),!H.value&&C.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:w,class:"em-entity__ops"},[B.value&&B.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${B.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Y.value,te=>{var re;return t.openBlock(),t.createElementBlock("li",{key:te.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((re=B.value)==null?void 0:re.id)===te.modelId}]),"data-op":te.modelId},[d.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:be=>x(te,be),onPointermove:M,onPointerup:V,onPointercancel:ce,onClick:q[6]||(q[6]=t.withModifiers(()=>{},["stop"]))},"⠿",40,xw)):t.createCommentVNode("",!0),t.createElementVNode("span",Iw,t.toDisplayString(ee(te.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:ae(te)})},t.toDisplayString(te.name)+"()",5)],10,vw)}),128))],512)):Y.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:Y.value.length})},[t.createVNode(Me,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:Y.value.length})),1)],8,Cw)):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createElementBlock("footer",Sw,[t.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:ve},t.toDisplayString(i("em.node.addAttr")),1),q[9]||(q[9]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:G},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),d.value&&!Ie.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:K,onPointermove:he,onPointerup:we},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3ffbbf24"]]),$w={key:0,class:"em-sel","aria-hidden":"true"},Rw={class:"em-group__label"},Aw={class:"em-group__name"},Tw={key:0,class:"em-group__pkg"},Vw={key:1,class:"em-group__flag"},Qu=Ge(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(()=>ut(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(Tn,null),s=(T,F)=>l?l.t(T,F):Ct("ko",T,F),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var T;return!!n.id&&((T=l==null?void 0:l.selection.value)==null?void 0:T.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(ya,null),f=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),p=t.inject(so,null);function y(){n.id&&(p==null||p.setGroupHover(n.id))}function g(){p==null||p.setGroupHover(null)}const _=t.computed(()=>!!p&&p.hoverGroupId.value===n.id),b=t.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==n.id),{screenToFlowCoordinate:N,findNode:h}=He();let E=null,D=null;function $(T){var le;if(!n.id||!c.value)return;T.stopPropagation();const F=((le=h(n.id))==null?void 0:le.dimensions)??{width:400,height:300},I=N({x:T.clientX,y:T.clientY});E={fx:I.x,fy:I.y,w:F.width,h:F.height},T.target.setPointerCapture(T.pointerId)}function H(T){if(!E||!n.id)return;const F=N({x:T.clientX,y:T.clientY});D={width:Math.max(160,E.w+(F.x-E.fx)),height:Math.max(120,E.h+(F.y-E.fy))};const I=h(n.id);I&&(I.style={width:`${D.width}px`,height:`${D.height}px`})}function j(T){var F,I;E&&D&&n.id&&l&&l.resizeGroup(n.id,D),E=null,D=null,(I=(F=T.target).releasePointerCapture)==null||I.call(F,T.pointerId)}const v=t.computed(()=>{const T=o.value.name;return(T==null?void 0:T.ko)||(T==null?void 0:T.en)||(T==null?void 0:T.ja)||(T==null?void 0:T.zh)||o.value.packageName||s("em.group.fallback")});return(T,F)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":_.value,"is-dimmed":b.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:g},[d.value?(t.openBlock(),t.createElementBlock("div",$w,[...F[0]||(F[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",Rw,[t.createElementVNode("span",Aw,t.toDisplayString(v.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Tw,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",Vw,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Me,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:$,onPointermove:H,onPointerup:j},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-9b95a9b6"]]),Mw={key:0,class:"em-sel","aria-hidden":"true"},Bw={key:2,class:"em-note__text"},em=Ge(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(Tn,null),i=t.inject(ya,null),a=t.inject(so,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>ut(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 f=t.computed(()=>{var k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===n.id}),p=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!f.value),y=t.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===n.id}),g=t.computed(()=>!!n.selected&&!y.value),_=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),b=[{id:"n-top",pos:Ae.Top},{id:"n-right",pos:Ae.Right},{id:"n-bottom",pos:Ae.Bottom},{id:"n-left",pos:Ae.Left}],N=t.ref(!1),h=t.ref(""),E=t.ref(null);async function D(){var k;l.value&&(h.value=r.value.memo,N.value=!0,await t.nextTick(),(k=E.value)==null||k.focus())}function $(){N.value&&(N.value=!1,h.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,h.value)))}const{screenToFlowCoordinate:H,findNode:j}=He();let v=null,T=null;function F(k){var W;if(!l.value)return;k.stopPropagation();const Y=((W=j(n.id))==null?void 0:W.dimensions)??r.value.geo.size,C=H({x:k.clientX,y:k.clientY});v={fx:C.x,fy:C.y,w:Y.width,h:Y.height},k.target.setPointerCapture(k.pointerId)}function I(k){if(!v)return;const Y=H({x:k.clientX,y:k.clientY});T={width:Math.max(140,v.w+(Y.x-v.fx)),height:Math.max(60,v.h+(Y.y-v.fy))};const C=j(n.id);C&&(C.style={width:`${T.width}px`,height:`${T.height}px`})}function le(k){var Y,C;v&&T&&o&&o.resizeNote(n.id,T),v=null,T=null,(C=(Y=k.target).releasePointerCapture)==null||C.call(Y,k.pointerId)}return(k,Y)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":_.value,"is-selected":y.value,"is-multi-selected":g.value}]),style:t.normalizeStyle(c.value),onDblclick:D,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",Mw,[...Y[4]||(Y[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),N.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:E,"onUpdate:modelValue":Y[0]||(Y[0]=C=>h.value=C),class:"em-note__edit nodrag",onBlur:$,onKeydown:Y[1]||(Y[1]=t.withKeys(C=>N.value=!1,["esc"])),onPointerdown:Y[2]||(Y[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,h.value]]):(t.openBlock(),t.createElementBlock("div",Bw,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(b,C=>t.createVNode(t.unref(Cn),{id:C.id,key:C.id,type:"source",position:C.pos,class:"em-note-handle",onPointerdown:Y[3]||(Y[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!N.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:F,onPointermove:I,onPointerup:le},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Dw=20,Ow=22,Lw=7,Pw=22,tm=31,nm=7,zw=20,om=11,im=11,Uw=tm+nm;function Fw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Hw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function ga(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 am(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function ba(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function rm(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:am(e,n);return[ba(o,a,r-Math.PI/2),ba(o,a,r+Math.PI/2)]}function lm(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 sm(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=ga(e,n,Dw),[d,u]=rm(e,n,c,Ow);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}),Fw(o.multiplicity)){const m=ga(e,n,tm);r.push({cx:m.x,cy:m.y,r:nm})}if(Hw(o.multiplicity)){const m=ga(e,n,Lw),[f,p]=rm(e,n,m,Pw);a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=ga(e,n,zw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=am(e,n),m=ba(d,om/2,u-Math.PI/2),f=ba(d,om/2,u+Math.PI/2);l.push({points:[e,m,c,f]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=lm(s,c,im,!0),u=lm(s,c,im,!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 cm=200,dm=120,sl=24;function um(e){var a,r;if(!e)return{x:0,y:0,width:cm,height:dm};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||cm,i=((r=e.dimensions)==null?void 0:r.height)||dm;return{x:n.x,y:n.y,width:o,height:i}}function mm(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function fm(e){const n=t.computed(()=>um(e.sourceNode())),o=t.computed(()=>um(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var p,y;const d=n.value,u=d.x+d.width;let m=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,f=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(f-m)<sl){const g=(m+f)/2;m=g-sl/2,f=g+sl/2}return{source:{x:u,y:m},target:{x:u,y:f}}}),r=t.computed(()=>e.waypoints()[0]??mm(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??mm(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Fa(n.value,d,r.value.x):Ua(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Fa(o.value,d,l.value.x):Ua(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 cl=Symbol("waypointController"),Gw=["d"],jw=["d"],Kw=["d"],Yw=["x1","y1","x2","y2"],Ww=["cx","cy","r"],qw=["x","y"],Xw=["x","y"],Jw=["cx","cy","onDblclick"],Zw=["x","y","onPointerdown","onDblclick"],pm=Ge(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=He(),i=t.inject(cl),a=t.inject(Tn,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Ju,null),s=t.inject(so,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var pe;return((pe=a==null?void 0:a.selection.value)==null?void 0:pe.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 pe=l==null?void 0:l.value;if(!pe||!a)return null;const ke=a.resolved.value.entities,ve=O=>{var Z;return(Z=ke.find(oe=>oe.entity.modelId===O))==null?void 0:Z.groupRef},G=n.data.association;return ve(G.end1.entityRef)===pe.groupId&&ve(G.end2.entityRef)===pe.groupId?{dx:pe.dx,dy:pe.dy}:null}),f=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),p=t.ref(-1),y=t.ref({x:0,y:0}),g=t.computed(()=>{const pe=m.value;return f.value.map((ke,ve)=>ve===p.value?y.value:pe?{x:ke.x+pe.dx,y:ke.y+pe.dy}:ke)}),_=t.computed(()=>{var pe;return!!((pe=n.sourceNode.data)!=null&&pe.collapsed)}),b=t.computed(()=>{var pe;return!!((pe=n.targetNode.data)!=null&&pe.collapsed)}),{source:N,target:h,sourceSide:E,targetSide:D,isSelf:$}=fm({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>g.value,sourceRowY:()=>n.data.sourceColumnRef&&!_.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!b.value?n.targetY:void 0}),H=Uw+4,j=t.computed(()=>$.value?Ol(N.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?La(N.value,E.value,g.value,h.value,D.value,H):za(N.value,g.value,h.value)),v=t.computed(()=>$.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Pa(N.value,E.value,g.value,h.value,D.value,H):Ha(N.value,g.value,h.value).map((pe,ke)=>({point:pe,segIndex:ke}))),T=t.computed(()=>$.value||!r.value?[]:g.value);function F(pe){switch(pe){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 I(pe,ke){p.value=pe,y.value={...f.value[pe]},ke.target.setPointerCapture(ke.pointerId),ke.stopPropagation()}function le(pe){if(p.value<0)return;const ke=o({x:pe.clientX,y:pe.clientY});y.value={x:ke.x,y:ke.y}}function k(pe){var ke,ve;p.value>=0&&i&&i.movePoint(n.id,p.value,{...y.value}),p.value=-1,(ve=(ke=pe.target).releasePointerCapture)==null||ve.call(ke,pe.pointerId)}function Y(pe,ke){ke.stopPropagation(),i==null||i.removePoint(n.id,pe)}function C(pe,ke){if(!i)return;const ve=o({x:ke.clientX,y:ke.clientY});i.insertPoint(n.id,pe,{x:ve.x,y:ve.y})}const W=t.computed(()=>F(n.data.association.end1.multiplicity)),ee=t.computed(()=>F(n.data.association.end2.multiplicity)),ae=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),L=t.computed(()=>ae.value==="class"),U=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const pe=ho(E.value);return{x:N.value.x+pe.x*10,y:N.value.y+pe.y*10}}return g.value[0]??h.value}),ne=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ke=ho(D.value);return{x:h.value.x+ke.x*10,y:h.value.y+ke.y*10}}const pe=g.value;return pe[pe.length-1]??N.value}),ue=t.computed(()=>{const pe=n.data.association;return{multiplicity:pe.end1.multiplicity,navigable:pe.end1.navigable,composition:pe.end1.composition,otherNavigable:pe.end2.navigable}}),Ne=t.computed(()=>{const pe=n.data.association;return{multiplicity:pe.end2.multiplicity,navigable:pe.end2.navigable,composition:pe.end2.composition,otherNavigable:pe.end1.navigable}}),se=t.computed(()=>sm(N.value,U.value,ue.value,ae.value)),me=t.computed(()=>sm(h.value,ne.value,Ne.value,ae.value)),_e=t.computed(()=>[...se.value.lines,...me.value.lines]),Ie=t.computed(()=>[...se.value.circles,...me.value.circles]),Ve=t.computed(()=>[...se.value.polygons,...me.value.polygons].map(pe=>`M${pe.points.map(ke=>`${ke.x},${ke.y}`).join(" L")} Z`)),Te=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(pe,ke)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:j.value,fill:"none",class:"em-edge__hit"},null,8,Gw),t.createElementVNode("path",{d:j.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,jw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ve.value,(ve,G)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${G}`,d:ve,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",Te.value])},null,10,Kw))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,(ve,G)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${G}`,x1:ve.x1,y1:ve.y1,x2:ve.x2,y2:ve.y2,class:t.normalizeClass(["em-edge__marker",Te.value])},null,10,Yw))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.value,(ve,G)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${G}`,cx:ve.cx,cy:ve.cy,r:ve.r,class:t.normalizeClass(["em-edge__marker",Te.value])},null,10,Ww))),128)),L.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(N).x+8,y:t.unref(N).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(W.value),11,qw),t.createElementVNode("text",{x:t.unref(h).x-8,y:t.unref(h).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(ee.value),11,Xw)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.value,(ve,G)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${G}`,cx:ve.point.x,cy:ve.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(O=>C(ve.segIndex,O),["stop"])},null,42,Jw))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(ve,G)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${G}`,x:ve.x-5,y:ve.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:O=>I(G,O),onPointermove:le,onPointerup:k,onDblclick:O=>Y(G,O)},null,42,Zw))),128))],64))}}),[["__scopeId","data-v-208ecd02"]]);var Wt=(e=>(e.Lines="lines",e.Dots="dots",e))(Wt||{});const hm=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]}`})},ym=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};Wt.Lines+"",Wt.Dots+"";const Qw={[Wt.Dots]:"#81818a",[Wt.Lines]:"#eee"},ev=["id","x","y","width","height","patternTransform"],tv={key:2,height:"100",width:"100"},nv=["fill"],ov=["x","y","fill"],iv={name:"Background",compatConfig:{MODE:3}},av=t.defineComponent({...iv,props:{id:{},variant:{default:()=>Wt.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}=He(),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,f]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[m*l||1+d[0]/2,f*l||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||Qw[e.variant||Wt.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(Wt).Lines?(t.openBlock(),t.createBlock(t.unref(hm),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(Wt).Dots?(t.openBlock(),t.createBlock(t.unref(ym),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",tv,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,nv)])):t.createCommentVNode("",!0)])],8,ev)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,ov),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),rv={name:"ControlButton",compatConfig:{MODE:3}},lv=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},sv={type:"button",class:"vue-flow__controls-button"};function cv(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",sv,[t.renderSlot(e.$slots,"default")])}const Vn=lv(rv,[["render",cv]]),dv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},uv=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function mv(e,n){return t.openBlock(),t.createElementBlock("svg",dv,uv)}const fv={render:mv},pv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},hv=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function yv(e,n){return t.openBlock(),t.createElementBlock("svg",pv,hv)}const gv={render:yv},bv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},_v=[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 Ev(e,n){return t.openBlock(),t.createElementBlock("svg",bv,_v)}const kv={render:Ev},Nv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},wv=[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 vv(e,n){return t.openBlock(),t.createElementBlock("svg",Nv,wv)}const xv={render:vv},Iv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Cv=[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 Sv(e,n){return t.openBlock(),t.createElementBlock("svg",Iv,Cv)}const $v={render:Sv},Rv={name:"Controls",compatConfig:{MODE:3}},Av=t.defineComponent({...Rv,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Ld.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}=He(),f=t.toRef(()=>o.value||i.value||a.value),p=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function g(){l(),n("zoomIn")}function _(){s(),n("zoomOut")}function b(){c(e.fitViewParams),n("fitView")}function N(){r(!f.value),n("interactionChange",!f.value)}return(h,E)=>(t.openBlock(),t.createBlock(t.unref(Du),{class:"vue-flow__controls",position:h.position},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"top"),h.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(h.$slots,"control-zoom-in",{},()=>[t.createVNode(Vn,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(fv))))])]),_:3},8,["disabled"])]),t.renderSlot(h.$slots,"control-zoom-out",{},()=>[t.createVNode(Vn,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(gv))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),h.showFitView?t.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[t.createVNode(Vn,{class:"vue-flow__controls-fitview",onClick:b},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(kv))))])]),_:3})]):t.createCommentVNode("",!0),h.showInteractive?t.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(t.openBlock(),t.createBlock(Vn,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:t.withCtx(()=>[f.value?t.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref($v))))]):t.createCommentVNode("",!0),f.value?t.createCommentVNode("",!0):t.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(xv))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var Tv={value:()=>{}};function dl(){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 _a(o)}function _a(e){this._=e}function Vv(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}})}_a.prototype=dl.prototype={constructor:_a,on:function(e,n){var o=this._,i=Vv(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Mv(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]=gm(o[a],e.name,n);else if(n==null)for(a in o)o[a]=gm(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 _a(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 Mv(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function gm(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=Tv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ul="http://www.w3.org/1999/xhtml";const bm={svg:"http://www.w3.org/2000/svg",xhtml:ul,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ea(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),bm.hasOwnProperty(n)?{space:bm[n],local:e}:e}function Bv(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ul&&n.documentElement.namespaceURI===ul?n.createElement(e):n.createElementNS(o,e)}}function Dv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _m(e){var n=Ea(e);return(n.local?Dv:Bv)(n)}function Ov(){}function ml(e){return e==null?Ov:function(){return this.querySelector(e)}}function Lv(e){typeof e!="function"&&(e=ml(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new kt(i,this._parents)}function Pv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function zv(){return[]}function Em(e){return e==null?zv:function(){return this.querySelectorAll(e)}}function Uv(e){return function(){return Pv(e.apply(this,arguments))}}function Fv(e){typeof e=="function"?e=Uv(e):e=Em(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 kt(i,a)}function km(e){return function(){return this.matches(e)}}function Nm(e){return function(n){return n.matches(e)}}var Hv=Array.prototype.find;function Gv(e){return function(){return Hv.call(this.children,e)}}function jv(){return this.firstElementChild}function Kv(e){return this.select(e==null?jv:Gv(typeof e=="function"?e:Nm(e)))}var Yv=Array.prototype.filter;function Wv(){return Array.from(this.children)}function qv(e){return function(){return Yv.call(this.children,e)}}function Xv(e){return this.selectAll(e==null?Wv:qv(typeof e=="function"?e:Nm(e)))}function Jv(e){typeof e!="function"&&(e=km(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 kt(i,this._parents)}function wm(e){return new Array(e.length)}function Zv(){return new kt(this._enter||this._groups.map(wm),this._parents)}function ka(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ka.prototype={constructor:ka,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 Qv(e){return function(){return e}}function ex(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 ka(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function tx(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,f=new Array(u),p;for(s=0;s<u;++s)(c=n[s])&&(f[s]=p=l.call(c,c.__data__,s,n)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new ka(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(f[s])===c&&(a[s]=c)}function nx(e){return e.__data__}function ox(e,n){if(!arguments.length)return Array.from(this,nx);var o=n?tx:ex,i=this._parents,a=this._groups;typeof e!="function"&&(e=Qv(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],f=m.length,p=ix(e.call(u,u&&u.__data__,d,i)),y=p.length,g=s[d]=new Array(y),_=l[d]=new Array(y),b=c[d]=new Array(f);o(u,m,g,_,b,p,n);for(var N=0,h=0,E,D;N<y;++N)if(E=g[N]){for(N>=h&&(h=N+1);!(D=_[h])&&++h<y;);E._next=D||null}}return l=new kt(l,i),l._enter=s,l._exit=c,l}function ix(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ax(){return new kt(this._exit||this._groups.map(wm),this._parents)}function rx(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 lx(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,f=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(f[y]=p);for(;c<a;++c)s[c]=o[c];return new kt(s,this._parents)}function sx(){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 cx(e){e||(e=dx);function n(m,f){return m&&f?e(m.__data__,f.__data__):!m-!f}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 kt(a,this._parents).order()}function dx(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function ux(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mx(){return Array.from(this)}function fx(){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 px(){let e=0;for(const n of this)++e;return e}function hx(){return!this.node()}function yx(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 gx(e){return function(){this.removeAttribute(e)}}function bx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _x(e,n){return function(){this.setAttribute(e,n)}}function Ex(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function kx(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Nx(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 wx(e,n){var o=Ea(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?bx:gx:typeof n=="function"?o.local?Nx:kx:o.local?Ex:_x)(o,n))}function vm(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function vx(e){return function(){this.style.removeProperty(e)}}function xx(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Ix(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Cx(e,n,o){return arguments.length>1?this.each((n==null?vx:typeof n=="function"?Ix:xx)(e,n,o??"")):co(this.node(),e)}function co(e,n){return e.style.getPropertyValue(n)||vm(e).getComputedStyle(e,null).getPropertyValue(n)}function Sx(e){return function(){delete this[e]}}function $x(e,n){return function(){this[e]=n}}function Rx(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ax(e,n){return arguments.length>1?this.each((n==null?Sx:typeof n=="function"?Rx:$x)(e,n)):this.node()[e]}function xm(e){return e.trim().split(/^|\s+/)}function fl(e){return e.classList||new Im(e)}function Im(e){this._node=e,this._names=xm(e.getAttribute("class")||"")}Im.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 Cm(e,n){for(var o=fl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Sm(e,n){for(var o=fl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Tx(e){return function(){Cm(this,e)}}function Vx(e){return function(){Sm(this,e)}}function Mx(e,n){return function(){(n.apply(this,arguments)?Cm:Sm)(this,e)}}function Bx(e,n){var o=xm(e+"");if(arguments.length<2){for(var i=fl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Mx:n?Tx:Vx)(o,n))}function Dx(){this.textContent=""}function Ox(e){return function(){this.textContent=e}}function Lx(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Px(e){return arguments.length?this.each(e==null?Dx:(typeof e=="function"?Lx:Ox)(e)):this.node().textContent}function zx(){this.innerHTML=""}function Ux(e){return function(){this.innerHTML=e}}function Fx(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Hx(e){return arguments.length?this.each(e==null?zx:(typeof e=="function"?Fx:Ux)(e)):this.node().innerHTML}function Gx(){this.nextSibling&&this.parentNode.appendChild(this)}function jx(){return this.each(Gx)}function Kx(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Yx(){return this.each(Kx)}function Wx(e){var n=typeof e=="function"?e:_m(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function qx(){return null}function Xx(e,n){var o=typeof e=="function"?e:_m(e),i=n==null?qx:typeof n=="function"?n:ml(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Jx(){var e=this.parentNode;e&&e.removeChild(this)}function Zx(){return this.each(Jx)}function Qx(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function eI(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function tI(e){return this.select(e?eI:Qx)}function nI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function oI(e){return function(n){e.call(this,n,this.__data__)}}function iI(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 aI(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 rI(e,n,o){return function(){var i=this.__on,a,r=oI(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 lI(e,n,o){var i=iI(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?rI:aI,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function $m(e,n,o){var i=vm(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 sI(e,n){return function(){return $m(this,e,n)}}function cI(e,n){return function(){return $m(this,e,n.apply(this,arguments))}}function dI(e,n){return this.each((typeof n=="function"?cI:sI)(e,n))}function*uI(){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 Rm=[null];function kt(e,n){this._groups=e,this._parents=n}function qo(){return new kt([[document.documentElement]],Rm)}function mI(){return this}kt.prototype=qo.prototype={constructor:kt,select:Lv,selectAll:Fv,selectChild:Kv,selectChildren:Xv,filter:Jv,data:ox,enter:Zv,exit:ax,join:rx,merge:lx,selection:mI,order:sx,sort:cx,call:ux,nodes:mx,node:fx,size:px,empty:hx,each:yx,attr:wx,style:Cx,property:Ax,classed:Bx,text:Px,html:Hx,raise:jx,lower:Yx,append:Wx,insert:Xx,remove:Zx,clone:tI,datum:nI,on:lI,dispatch:dI,[Symbol.iterator]:uI};function ln(e){return typeof e=="string"?new kt([[document.querySelector(e)]],[document.documentElement]):new kt([[e]],Rm)}function fI(e){let n;for(;n=e.sourceEvent;)e=n;return e}function sn(e,n){if(e=fI(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 pl={capture:!0,passive:!1};function hl(e){e.preventDefault(),e.stopImmediatePropagation()}function pI(e){var n=e.document.documentElement,o=ln(e).on("dragstart.drag",hl,pl);"onselectstart"in n?o.on("selectstart.drag",hl,pl):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function hI(e,n){var o=e.document.documentElement,i=ln(e).on("dragstart.drag",null);n&&(i.on("click.drag",hl,pl),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 yl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Am(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Xo(){}var Jo=.7,Na=1/Jo,uo="\\s*([+-]?\\d+)\\s*",Zo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yI=/^#([0-9a-f]{3,8})$/,gI=new RegExp(`^rgb\\(${uo},${uo},${uo}\\)$`),bI=new RegExp(`^rgb\\(${zt},${zt},${zt}\\)$`),_I=new RegExp(`^rgba\\(${uo},${uo},${uo},${Zo}\\)$`),EI=new RegExp(`^rgba\\(${zt},${zt},${zt},${Zo}\\)$`),kI=new RegExp(`^hsl\\(${Zo},${zt},${zt}\\)$`),NI=new RegExp(`^hsla\\(${Zo},${zt},${zt},${Zo}\\)$`),Tm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};yl(Xo,Qo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vm,formatHex:Vm,formatHex8:wI,formatHsl:vI,formatRgb:Mm,toString:Mm});function Vm(){return this.rgb().formatHex()}function wI(){return this.rgb().formatHex8()}function vI(){return Pm(this).formatHsl()}function Mm(){return this.rgb().formatRgb()}function Qo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=yI.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Bm(n):o===3?new yt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?wa(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?wa(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=gI.exec(e))?new yt(n[1],n[2],n[3],1):(n=bI.exec(e))?new yt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=_I.exec(e))?wa(n[1],n[2],n[3],n[4]):(n=EI.exec(e))?wa(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=kI.exec(e))?Lm(n[1],n[2]/100,n[3]/100,1):(n=NI.exec(e))?Lm(n[1],n[2]/100,n[3]/100,n[4]):Tm.hasOwnProperty(e)?Bm(Tm[e]):e==="transparent"?new yt(NaN,NaN,NaN,0):null}function Bm(e){return new yt(e>>16&255,e>>8&255,e&255,1)}function wa(e,n,o,i){return i<=0&&(e=n=o=NaN),new yt(e,n,o,i)}function xI(e){return e instanceof Xo||(e=Qo(e)),e?(e=e.rgb(),new yt(e.r,e.g,e.b,e.opacity)):new yt}function gl(e,n,o,i){return arguments.length===1?xI(e):new yt(e,n,o,i??1)}function yt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}yl(yt,gl,Am(Xo,{brighter(e){return e=e==null?Na:Math.pow(Na,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Jo:Math.pow(Jo,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yt(Mn(this.r),Mn(this.g),Mn(this.b),va(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:Dm,formatHex:Dm,formatHex8:II,formatRgb:Om,toString:Om}));function Dm(){return`#${Bn(this.r)}${Bn(this.g)}${Bn(this.b)}`}function II(){return`#${Bn(this.r)}${Bn(this.g)}${Bn(this.b)}${Bn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Om(){const e=va(this.opacity);return`${e===1?"rgb(":"rgba("}${Mn(this.r)}, ${Mn(this.g)}, ${Mn(this.b)}${e===1?")":`, ${e})`}`}function va(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Mn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Bn(e){return e=Mn(e),(e<16?"0":"")+e.toString(16)}function Lm(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new St(e,n,o,i)}function Pm(e){if(e instanceof St)return new St(e.h,e.s,e.l,e.opacity);if(e instanceof Xo||(e=Qo(e)),!e)return new St;if(e instanceof St)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 St(l,s,c,e.opacity)}function CI(e,n,o,i){return arguments.length===1?Pm(e):new St(e,n,o,i??1)}function St(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}yl(St,CI,Am(Xo,{brighter(e){return e=e==null?Na:Math.pow(Na,e),new St(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Jo:Math.pow(Jo,e),new St(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 yt(bl(e>=240?e-240:e+120,a,i),bl(e,a,i),bl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new St(zm(this.h),xa(this.s),xa(this.l),va(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=va(this.opacity);return`${e===1?"hsl(":"hsla("}${zm(this.h)}, ${xa(this.s)*100}%, ${xa(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zm(e){return e=(e||0)%360,e<0?e+360:e}function xa(e){return Math.max(0,Math.min(1,e||0))}function bl(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Um=e=>()=>e;function SI(e,n){return function(o){return e+o*n}}function $I(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 RI(e){return(e=+e)==1?Fm:function(n,o){return o-n?$I(n,o,e):Um(isNaN(n)?o:n)}}function Fm(e,n){var o=n-e;return o?SI(e,o):Um(isNaN(e)?n:e)}const Hm=(function e(n){var o=RI(n);function i(a,r){var l=o((a=gl(a)).r,(r=gl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Fm(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 cn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var _l=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,El=new RegExp(_l.source,"g");function AI(e){return function(){return e}}function TI(e){return function(n){return e(n)+""}}function VI(e,n){var o=_l.lastIndex=El.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=_l.exec(e))&&(a=El.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:cn(i,a)})),o=El.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?TI(c[0].x):AI(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 Gm=180/Math.PI,kl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function jm(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)*Gm,skewX:Math.atan(c)*Gm,scaleX:l,scaleY:s}}var Ia;function MI(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?kl:jm(n.a,n.b,n.c,n.d,n.e,n.f)}function BI(e){return e==null||(Ia||(Ia=document.createElementNS("http://www.w3.org/2000/svg","g")),Ia.setAttribute("transform",e),!(e=Ia.transform.baseVal.consolidate()))?kl:(e=e.matrix,jm(e.a,e.b,e.c,e.d,e.e,e.f))}function Km(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push("translate(",null,n,null,o);y.push({i:g-4,x:cn(d,m)},{i:g-2,x:cn(u,f)})}else(m||f)&&p.push("translate("+m+n+f+o)}function l(d,u,m,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:m.push(a(m)+"rotate(",null,i)-2,x:cn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,f){d!==u?f.push({i:m.push(a(m)+"skewX(",null,i)-2,x:cn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push(a(p)+"scale(",null,",",null,")");y.push({i:g-4,x:cn(d,m)},{i:g-2,x:cn(u,f)})}else(m!==1||f!==1)&&p.push(a(p)+"scale("+m+","+f+")")}return function(d,u){var m=[],f=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,f),l(d.rotate,u.rotate,m,f),s(d.skewX,u.skewX,m,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,f),d=u=null,function(p){for(var y=-1,g=f.length,_;++y<g;)m[(_=f[y]).i]=_.x(p);return m.join("")}}}var DI=Km(MI,"px, ","px)","deg)"),OI=Km(BI,", ",")",")"),LI=1e-12;function Ym(e){return((e=Math.exp(e))+1/e)/2}function PI(e){return((e=Math.exp(e))-1/e)/2}function zI(e){return((e=Math.exp(2*e))-1)/(e+1)}const UI=(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],f=l[2],p=u-s,y=m-c,g=p*p+y*y,_,b;if(g<LI)b=Math.log(f/d)/n,_=function(H){return[s+H*p,c+H*y,d*Math.exp(n*H*b)]};else{var N=Math.sqrt(g),h=(f*f-d*d+i*g)/(2*d*o*N),E=(f*f-d*d-i*g)/(2*f*o*N),D=Math.log(Math.sqrt(h*h+1)-h),$=Math.log(Math.sqrt(E*E+1)-E);b=($-D)/n,_=function(H){var j=H*b,v=Ym(D),T=d/(o*N)*(v*zI(n*j+D)-PI(D));return[s+T*p,c+T*y,d*v/Ym(n*j+D)]}}return _.duration=b*1e3*n/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var mo=0,ei=0,ti=0,Wm=1e3,Ca,ni,Sa=0,Dn=0,$a=0,oi=typeof performance=="object"&&performance.now?performance:Date,qm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nl(){return Dn||(qm(FI),Dn=oi.now()+$a)}function FI(){Dn=0}function Ra(){this._call=this._time=this._next=null}Ra.prototype=Xm.prototype={constructor:Ra,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Nl():+o)+(n==null?0:+n),!this._next&&ni!==this&&(ni?ni._next=this:Ca=this,ni=this),this._call=e,this._time=o,wl()},stop:function(){this._call&&(this._call=null,this._time=1/0,wl())}};function Xm(e,n,o){var i=new Ra;return i.restart(e,n,o),i}function HI(){Nl(),++mo;for(var e=Ca,n;e;)(n=Dn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--mo}function Jm(){Dn=(Sa=oi.now())+$a,mo=ei=0;try{HI()}finally{mo=0,jI(),Dn=0}}function GI(){var e=oi.now(),n=e-Sa;n>Wm&&($a-=n,Sa=e)}function jI(){for(var e,n=Ca,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ca=o);ni=e,wl(i)}function wl(e){if(!mo){ei&&(ei=clearTimeout(ei));var n=e-Dn;n>24?(e<1/0&&(ei=setTimeout(Jm,e-oi.now()-$a)),ti&&(ti=clearInterval(ti))):(ti||(Sa=oi.now(),ti=setInterval(GI,Wm)),mo=1,qm(Jm))}}function Zm(e,n,o){var i=new Ra;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var KI=dl("start","end","cancel","interrupt"),YI=[],Qm=0,ef=1,vl=2,Aa=3,tf=4,xl=5,Ta=6;function Va(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;WI(e,o,{name:n,index:i,group:a,on:KI,tween:YI,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Qm})}function Il(e,n){var o=$t(e,n);if(o.state>Qm)throw new Error("too late; already scheduled");return o}function Ut(e,n){var o=$t(e,n);if(o.state>Aa)throw new Error("too late; already running");return o}function $t(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function WI(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Xm(r,0,o.time);function r(d){o.state=ef,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,f,p;if(o.state!==ef)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Aa)return Zm(l);p.state===tf?(p.state=Ta,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<n&&(p.state=Ta,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Zm(function(){o.state===Aa&&(o.state=tf,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=vl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===vl){for(o.state=Aa,a=new Array(f=o.tween.length),u=0,m=-1;u<f;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=xl,1),m=-1,f=a.length;++m<f;)a[m].call(e,u);o.state===xl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ta,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Ma(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>vl&&i.state<xl,i.state=Ta,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function qI(e){return this.each(function(){Ma(this,e)})}function XI(e,n){var o,i;return function(){var a=Ut(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 JI(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Ut(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 ZI(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=$t(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?XI:JI)(o,e,n))}function Cl(e,n,o){var i=e._id;return e.each(function(){var a=Ut(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return $t(a,i).value[n]}}function nf(e,n){var o;return(typeof n=="number"?cn:n instanceof Qo?Hm:(o=Qo(n))?(n=o,Hm):VI)(e,n)}function QI(e){return function(){this.removeAttribute(e)}}function eC(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tC(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 nC(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 oC(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 iC(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 aC(e,n){var o=Ea(e),i=o==="transform"?OI:nf;return this.attrTween(e,typeof n=="function"?(o.local?iC:oC)(o,i,Cl(this,"attr."+e,n)):n==null?(o.local?eC:QI)(o):(o.local?nC:tC)(o,i,n))}function rC(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function lC(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function sC(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&lC(e,r)),o}return a._value=n,a}function cC(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&rC(e,r)),o}return a._value=n,a}function dC(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=Ea(e);return this.tween(o,(i.local?sC:cC)(i,n))}function uC(e,n){return function(){Il(this,e).delay=+n.apply(this,arguments)}}function mC(e,n){return n=+n,function(){Il(this,e).delay=n}}function fC(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?uC:mC)(n,e)):$t(this.node(),n).delay}function pC(e,n){return function(){Ut(this,e).duration=+n.apply(this,arguments)}}function hC(e,n){return n=+n,function(){Ut(this,e).duration=n}}function yC(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?pC:hC)(n,e)):$t(this.node(),n).duration}function gC(e,n){if(typeof n!="function")throw new Error;return function(){Ut(this,e).ease=n}}function bC(e){var n=this._id;return arguments.length?this.each(gC(n,e)):$t(this.node(),n).ease}function _C(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Ut(this,e).ease=o}}function EC(e){if(typeof e!="function")throw new Error;return this.each(_C(this._id,e))}function kC(e){typeof e!="function"&&(e=km(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 qt(i,this._parents,this._name,this._id)}function NC(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),f,p=0;p<u;++p)(f=c[p]||d[p])&&(m[p]=f);for(;s<i;++s)l[s]=n[s];return new qt(l,this._parents,this._name,this._id)}function wC(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 vC(e,n,o){var i,a,r=wC(n)?Il:Ut;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function xC(e,n){var o=this._id;return arguments.length<2?$t(this.node(),o).on.on(e):this.each(vC(o,e,n))}function IC(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function CC(){return this.on("end.remove",IC(this._id))}function SC(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ml(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,f=0;f<c;++f)(u=s[f])&&(m=e.call(u,u.__data__,f,s))&&("__data__"in u&&(m.__data__=u.__data__),d[f]=m,Va(d[f],n,o,f,d,$t(u,o)));return new qt(r,this._parents,n,o)}function $C(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Em(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 f=e.call(u,u.__data__,m,c),p,y=$t(u,o),g=0,_=f.length;g<_;++g)(p=f[g])&&Va(p,n,o,g,f,y);r.push(f),l.push(u)}return new qt(r,l,n,o)}var RC=qo.prototype.constructor;function AC(){return new RC(this._groups,this._parents)}function TC(e,n){var o,i,a;return function(){var r=co(this,e),l=(this.style.removeProperty(e),co(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function of(e){return function(){this.style.removeProperty(e)}}function VC(e,n,o){var i,a=o+"",r;return function(){var l=co(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function MC(e,n,o){var i,a,r;return function(){var l=co(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),co(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function BC(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Ut(this,e),d=c.on,u=c.value[r]==null?s||(s=of(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function DC(e,n,o){var i=(e+="")=="transform"?DI:nf;return n==null?this.styleTween(e,TC(e,i)).on("end.style."+e,of(e)):typeof n=="function"?this.styleTween(e,MC(e,i,Cl(this,"style."+e,n))).each(BC(this._id,e)):this.styleTween(e,VC(e,i,n),o).on("end.style."+e,null)}function OC(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function LC(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&OC(e,l,o)),i}return r._value=n,r}function PC(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,LC(e,n,o??""))}function zC(e){return function(){this.textContent=e}}function UC(e){return function(){var n=e(this);this.textContent=n??""}}function FC(e){return this.tween("text",typeof e=="function"?UC(Cl(this,"text",e)):zC(e==null?"":e+""))}function HC(e){return function(n){this.textContent=e.call(this,n)}}function GC(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&HC(a)),n}return i._value=e,i}function jC(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,GC(e))}function KC(){for(var e=this._name,n=this._id,o=af(),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=$t(c,n);Va(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new qt(i,this._parents,e,o)}function YC(){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=Ut(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 WC=0;function qt(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function af(){return++WC}var Xt=qo.prototype;qt.prototype={constructor:qt,select:SC,selectAll:$C,selectChild:Xt.selectChild,selectChildren:Xt.selectChildren,filter:kC,merge:NC,selection:AC,transition:KC,call:Xt.call,nodes:Xt.nodes,node:Xt.node,size:Xt.size,empty:Xt.empty,each:Xt.each,on:xC,attr:aC,attrTween:dC,style:DC,styleTween:PC,text:FC,textTween:jC,remove:CC,tween:ZI,delay:fC,duration:yC,ease:bC,easeVarying:EC,end:YC,[Symbol.iterator]:Xt[Symbol.iterator]};function qC(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var XC={time:null,delay:0,duration:250,ease:qC};function JC(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 ZC(e){var n,o;e instanceof qt?(n=e._id,e=e._name):(n=af(),(o=XC).time=Nl(),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])&&Va(c,e,n,d,l,o||JC(c,n));return new qt(i,this._parents,e,n)}qo.prototype.interrupt=qI,qo.prototype.transition=ZC;const Ba=e=>()=>e;function QC(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 Jt(e,n,o){this.k=e,this.x=n,this.y=o}Jt.prototype={constructor:Jt,scale:function(e){return e===1?this:new Jt(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Jt(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 Sl=new Jt(1,0,0);Jt.prototype;function $l(e){e.stopImmediatePropagation()}function ii(e){e.preventDefault(),e.stopImmediatePropagation()}function eS(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tS(){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 rf(){return this.__zoom||Sl}function nS(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function oS(){return navigator.maxTouchPoints||"ontouchstart"in this}function iS(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 aS(){var e=eS,n=tS,o=iS,i=nS,a=oS,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=UI,d=dl("start","zoom","end"),u,m,f,p=500,y=150,g=0,_=10;function b(k){k.property("__zoom",rf).on("wheel.zoom",j,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",le).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(k,Y,C,W){var ee=k.selection?k.selection():k;ee.property("__zoom",rf),k!==ee?D(k,Y,C,W):ee.interrupt().each(function(){$(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(k,Y,C,W){b.scaleTo(k,function(){var ee=this.__zoom.k,ae=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*ae},C,W)},b.scaleTo=function(k,Y,C,W){b.transform(k,function(){var ee=n.apply(this,arguments),ae=this.__zoom,L=C==null?E(ee):typeof C=="function"?C.apply(this,arguments):C,U=ae.invert(L),ne=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(ae,ne),L,U),ee,l)},C,W)},b.translateBy=function(k,Y,C,W){b.transform(k,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof C=="function"?C.apply(this,arguments):C),n.apply(this,arguments),l)},null,W)},b.translateTo=function(k,Y,C,W,ee){b.transform(k,function(){var ae=n.apply(this,arguments),L=this.__zoom,U=W==null?E(ae):typeof W=="function"?W.apply(this,arguments):W;return o(Sl.translate(U[0],U[1]).scale(L.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof C=="function"?-C.apply(this,arguments):-C),ae,l)},W,ee)};function N(k,Y){return Y=Math.max(r[0],Math.min(r[1],Y)),Y===k.k?k:new Jt(Y,k.x,k.y)}function h(k,Y,C){var W=Y[0]-C[0]*k.k,ee=Y[1]-C[1]*k.k;return W===k.x&&ee===k.y?k:new Jt(k.k,W,ee)}function E(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function D(k,Y,C,W){k.on("start.zoom",function(){$(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(W).end()}).tween("zoom",function(){var ee=this,ae=arguments,L=$(ee,ae).event(W),U=n.apply(ee,ae),ne=C==null?E(U):typeof C=="function"?C.apply(ee,ae):C,ue=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),Ne=ee.__zoom,se=typeof Y=="function"?Y.apply(ee,ae):Y,me=c(Ne.invert(ne).concat(ue/Ne.k),se.invert(ne).concat(ue/se.k));return function(_e){if(_e===1)_e=se;else{var Ie=me(_e),Ve=ue/Ie[2];_e=new Jt(Ve,ne[0]-Ie[0]*Ve,ne[1]-Ie[1]*Ve)}L.zoom(null,_e)}})}function $(k,Y,C){return!C&&k.__zooming||new H(k,Y)}function H(k,Y){this.that=k,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,Y),this.taps=0}H.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,Y){return this.mouse&&k!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var Y=ln(this.that).datum();d.call(k,this.that,new QC(k,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),Y)}};function j(k,...Y){if(!e.apply(this,arguments))return;var C=$(this,Y).event(k),W=this.__zoom,ee=Math.max(r[0],Math.min(r[1],W.k*Math.pow(2,i.apply(this,arguments)))),ae=sn(k);if(C.wheel)(C.mouse[0][0]!==ae[0]||C.mouse[0][1]!==ae[1])&&(C.mouse[1]=W.invert(C.mouse[0]=ae)),clearTimeout(C.wheel);else{if(W.k===ee)return;C.mouse=[ae,W.invert(ae)],Ma(this),C.start()}ii(k),C.wheel=setTimeout(L,y),C.zoom("mouse",o(h(N(W,ee),C.mouse[0],C.mouse[1]),C.extent,l));function L(){C.wheel=null,C.end()}}function v(k,...Y){if(f||!e.apply(this,arguments))return;var C=k.currentTarget,W=$(this,Y,!0).event(k),ee=ln(k.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",ue,!0),ae=sn(k,C),L=k.clientX,U=k.clientY;pI(k.view),$l(k),W.mouse=[ae,this.__zoom.invert(ae)],Ma(this),W.start();function ne(Ne){if(ii(Ne),!W.moved){var se=Ne.clientX-L,me=Ne.clientY-U;W.moved=se*se+me*me>g}W.event(Ne).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=sn(Ne,C),W.mouse[1]),W.extent,l))}function ue(Ne){ee.on("mousemove.zoom mouseup.zoom",null),hI(Ne.view,W.moved),ii(Ne),W.event(Ne).end()}}function T(k,...Y){if(e.apply(this,arguments)){var C=this.__zoom,W=sn(k.changedTouches?k.changedTouches[0]:k,this),ee=C.invert(W),ae=C.k*(k.shiftKey?.5:2),L=o(h(N(C,ae),W,ee),n.apply(this,Y),l);ii(k),s>0?ln(this).transition().duration(s).call(D,L,W,k):ln(this).call(b.transform,L,W,k)}}function F(k,...Y){if(e.apply(this,arguments)){var C=k.touches,W=C.length,ee=$(this,Y,k.changedTouches.length===W).event(k),ae,L,U,ne;for($l(k),L=0;L<W;++L)U=C[L],ne=sn(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==ne[2]&&(ee.touch1=ne,ee.taps=0):(ee.touch0=ne,ae=!0,ee.taps=1+!!u);u&&(u=clearTimeout(u)),ae&&(ee.taps<2&&(m=ne[0],u=setTimeout(function(){u=null},p)),Ma(this),ee.start())}}function I(k,...Y){if(this.__zooming){var C=$(this,Y).event(k),W=k.changedTouches,ee=W.length,ae,L,U,ne;for(ii(k),ae=0;ae<ee;++ae)L=W[ae],U=sn(L,this),C.touch0&&C.touch0[2]===L.identifier?C.touch0[0]=U:C.touch1&&C.touch1[2]===L.identifier&&(C.touch1[0]=U);if(L=C.that.__zoom,C.touch1){var ue=C.touch0[0],Ne=C.touch0[1],se=C.touch1[0],me=C.touch1[1],_e=(_e=se[0]-ue[0])*_e+(_e=se[1]-ue[1])*_e,Ie=(Ie=me[0]-Ne[0])*Ie+(Ie=me[1]-Ne[1])*Ie;L=N(L,Math.sqrt(_e/Ie)),U=[(ue[0]+se[0])/2,(ue[1]+se[1])/2],ne=[(Ne[0]+me[0])/2,(Ne[1]+me[1])/2]}else if(C.touch0)U=C.touch0[0],ne=C.touch0[1];else return;C.zoom("touch",o(h(L,U,ne),C.extent,l))}}function le(k,...Y){if(this.__zooming){var C=$(this,Y).event(k),W=k.changedTouches,ee=W.length,ae,L;for($l(k),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),ae=0;ae<ee;++ae)L=W[ae],C.touch0&&C.touch0[2]===L.identifier?delete C.touch0:C.touch1&&C.touch1[2]===L.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(L=sn(L,this),Math.hypot(m[0]-L[0],m[1]-L[1])<_)){var U=ln(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ba(+k),b):i},b.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ba(!!k),b):e},b.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Ba(!!k),b):a},b.extent=function(k){return arguments.length?(n=typeof k=="function"?k:Ba([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),b):n},b.scaleExtent=function(k){return arguments.length?(r[0]=+k[0],r[1]=+k[1],b):[r[0],r[1]]},b.translateExtent=function(k){return arguments.length?(l[0][0]=+k[0][0],l[1][0]=+k[1][0],l[0][1]=+k[0][1],l[1][1]=+k[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(k){return arguments.length?(o=k,b):o},b.duration=function(k){return arguments.length?(s=+k,b):s},b.interpolate=function(k){return arguments.length?(c=k,b):c},b.on=function(){var k=d.on.apply(d,arguments);return k===d?b:k},b.clickDistance=function(k){return arguments.length?(g=(k=+k)*k,b):Math.sqrt(g)},b.tapDistance=function(k){return arguments.length?(_=+k,b):_},b}const lf=Symbol("MiniMapSlots"),rS=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],lS={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},sS=t.defineComponent({...lS,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(lf),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,f)=>!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,rS))],64)):t.createCommentVNode("",!0)}}),cS=["width","height","viewBox","aria-labelledby"],dS=["id"],uS=["d","fill","stroke","stroke-width"],mS={name:"MiniMap",compatConfig:{MODE:3}},fS=t.defineComponent({...mS,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:f,d3Zoom:p,getNodesInitialized:y}=He(),g=t.ref();t.provide(lf,o);const _=t.toRef(()=>{var ee;return e.width??((ee=i.style)==null?void 0:ee.width)??a}),b=t.toRef(()=>{var ee;return e.height??((ee=i.style)==null?void 0:ee.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),E=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),D=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),$=t.computed(()=>Hr(y.value.filter(ee=>!ee.hidden))),H=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})),j=t.computed(()=>y.value&&y.value.length?v1($.value,H.value):H.value),v=t.computed(()=>{const ee=j.value.width/_.value,ae=j.value.height/b.value;return Math.max(ee,ae)}),T=t.computed(()=>{const ee=v.value*_.value,ae=v.value*b.value,L=e.offsetScale*v.value;return{offset:L,x:j.value.x-(ee-j.value.width)/2-L,y:j.value.y-(ae-j.value.height)/2-L,width:ee+L*2,height:ae+L*2}}),F=t.computed(()=>!T.value.x||!T.value.y?"":`
|
|
49
49
|
M${T.value.x-T.value.offset},${T.value.y-T.value.offset}
|
|
50
50
|
h${T.value.width+T.value.offset*2}
|
|
51
51
|
v${T.value.height+T.value.offset*2}
|
|
52
52
|
h${-T.value.width-T.value.offset*2}z
|
|
53
|
-
M${
|
|
54
|
-
h${
|
|
53
|
+
M${H.value.x+e.maskBorderRadius},${H.value.y}
|
|
54
|
+
h${H.value.width-2*e.maskBorderRadius}
|
|
55
55
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
|
|
56
|
-
v${
|
|
56
|
+
v${H.value.height-2*e.maskBorderRadius}
|
|
57
57
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
|
|
58
|
-
h${-(
|
|
58
|
+
h${-(H.value.width-2*e.maskBorderRadius)}
|
|
59
59
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
60
|
-
v${-(
|
|
61
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(ee=>{if(g.value){const ie=ln(g.value),O=ce=>{if(ce.sourceEvent.type!=="wheel"||!f.value||!p.value)return;const ge=ce.sourceEvent.ctrlKey&&Yo()?10:1,se=-ce.sourceEvent.deltaY*(ce.sourceEvent.deltaMode===1?.05:ce.sourceEvent.deltaMode?1:.002)*e.zoomStep,pe=c.value.zoom*2**(se*ge);p.value.scaleTo(f.value,pe)},U=ce=>{if(ce.sourceEvent.type!=="mousemove"||!f.value||!p.value)return;const ge=v.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),se={x:c.value.x-ce.sourceEvent.movementX*ge,y:c.value.y-ce.sourceEvent.movementY*ge},pe=[[0,0],[u.value.width,u.value.height]],be=Il.translate(se.x,se.y).scale(c.value.zoom),xe=p.value.constrain()(be,pe,d.value);p.value.transform(f.value,xe)},ne=XC().wheelDelta(ce=>Fr(ce)*(e.zoomStep/10)).on("zoom",e.pannable?U:()=>{}).on("zoom.wheel",e.zoomable?O:()=>{});ie.call(ne),ee(()=>{ie.on("zoom",null)})}},{flush:"post"});function C(ee){const[ie,O]=sn(ee);t("click",{event:ee,position:{x:ie,y:O}})}function ae(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeClick(O),t("nodeClick",O)}function E(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeDoubleClick(O),t("nodeDblclick",O)}function Y(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseEnter(O),t("nodeMouseenter",O)}function S(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseMove(O),t("nodeMousemove",O)}function W(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseLeave(O),t("nodeMouseleave",O)}return(ee,ie)=>(n.openBlock(),n.createBlock(n.unref(Tu),{position:ee.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:ee.pannable,zoomable:ee.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:_.value,height:b.value,viewBox:[T.value.x,T.value.y,T.value.width,T.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(l)}`,onClick:C},[ee.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(l)}`},n.toDisplayString(ee.ariaLabel),9,tS)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(y),O=>(n.openBlock(),n.createBlock(QC,{id:O.id,key:O.id,f:"",position:O.computedPosition,dimensions:O.dimensions,selected:O.selected,dragging:O.dragging,style:n.normalizeStyle(O.style),class:n.normalizeClass(P.value(O)),color:h.value(O),"border-radius":ee.nodeBorderRadius,"stroke-color":k.value(O),"stroke-width":ee.nodeStrokeWidth,"shape-rendering":n.unref(N),type:O.type,hidden:O.hidden,onClick:U=>ae(U,O),onDblclick:U=>E(U,O),onMouseenter:U=>Y(U,O),onMousemove:U=>S(U,O),onMouseleave:U=>W(U,O)},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)),n.createElementVNode("path",{class:"vue-flow__minimap-mask",d:H.value,fill:ee.maskColor,stroke:ee.maskStrokeColor,"stroke-width":ee.maskStrokeWidth,"fill-rule":"evenodd"},null,8,nS)],8,eS))]),_:1},8,["position","class"]))}}),aS=["d"],rS=["cx","cy","onDblclick"],lS=["x","y","onPointerdown","onDblclick"],sS=Ge(n.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=He(),i=n.inject(ll),a=n.inject(An,null),r=n.computed(()=>!!a&&a.editable.value),l=n.inject(so,null),s=n.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(t.data.targetRef)||!l.relatedNoteIds.value.has(t.data.noteRef))),c=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),d=n.ref(-1),u=n.ref({x:0,y:0}),m=n.computed(()=>c.value.map((K,v)=>v===d.value?u.value:K)),{source:f,target:p,sourceSide:y,targetSide:g}=cm({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>m.value}),_=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?La(f.value,y.value,m.value,p.value,g.value):za(f.value,m.value,p.value)),b=n.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Pa(f.value,y.value,m.value,p.value,g.value):Ha(f.value,m.value,p.value).map((K,v)=>({point:K,segIndex:v})):[]),N=n.computed(()=>r.value?m.value:[]);function h(K,v){d.value=K,u.value={...c.value[K]},v.target.setPointerCapture(v.pointerId),v.stopPropagation()}function k(K){if(d.value<0)return;const v=o({x:K.clientX,y:K.clientY});u.value={x:v.x,y:v.y}}function P(K){var v,T;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(T=(v=K.target).releasePointerCapture)==null||T.call(v,K.pointerId)}function A(K,v){v.stopPropagation(),i==null||i.removePoint(t.id,K)}function G(K,v){if(!i)return;const T=o({x:v.clientX,y:v.clientY});i.insertPoint(t.id,K,{x:T.x,y:T.y})}return(K,v)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:_.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,aS),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,(T,H)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${H}`,cx:T.point.x,cy:T.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(C=>G(T.segIndex,C),["stop"])},null,42,rS))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.value,(T,H)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${H}`,x:T.x-5,y:T.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:C=>h(H,C),onPointermove:k,onPointerup:P,onDblclick:C=>A(H,C)},null,42,lS))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),cS=["data-theme"],dS={key:0,class:"em-ctx__sep",role:"separator"},uS={key:1,class:"em-ctx__swatches"},mS={class:"em-ctx__swatches-label"},fS={class:"em-ctx__chips"},pS=["title","onClick"],hS=["title","onClick"],yS=["disabled","onClick"],gS={class:"em-ctx__icon"},bS={class:"em-ctx__caption"},_S=Ge(n.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:t}){const o=e,i=(g,_)=>Ct(o.locale??"ko",g,_),a=n.ref(!1),r=n.ref([]),l=n.ref(void 0),s=n.ref(null),c=n.reactive({x:0,y:0}),d=8;async function u(g,_){var h;r.value=_,l.value=(h=g.target)!=null&&h.closest('[data-theme="dark"]')?"dark":void 0,c.x=g.clientX,c.y=g.clientY,a.value=!0,window.addEventListener("keydown",f),window.addEventListener("resize",m),await n.nextTick();const b=s.value;if(!b)return;const N=b.getBoundingClientRect();c.x+N.width>window.innerWidth-d&&(c.x=Math.max(d,window.innerWidth-d-N.width)),c.y+N.height>window.innerHeight-d&&(c.y=Math.max(d,window.innerHeight-d-N.height))}function m(){a.value&&(a.value=!1,r.value=[],window.removeEventListener("keydown",f),window.removeEventListener("resize",m))}function f(g){g.key==="Escape"&&(g.stopPropagation(),m())}function p(g){g.disabled||(g.handler(),m())}function y(g,_){g.onPick(_),m()}return n.onBeforeUnmount(m),t({open:u,close:m}),(g,_)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:m,onContextmenu:n.withModifiers(m,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:n.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:_[0]||(_[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,(b,N)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N},[b.type==="separator"?(n.openBlock(),n.createElementBlock("div",dS)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",uS,[n.createElementVNode("span",mS,n.toDisplayString(b.caption),1),n.createElementVNode("div",fS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:i("em.swatch.none"),onClick:h=>y(b,null)},null,10,pS),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),h=>(n.openBlock(),n.createElementBlock("button",{key:h,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":b.current===h}]),style:n.normalizeStyle({background:n.unref(ao)(h)}),title:n.unref(io)(h),onClick:k=>y(b,h)},null,14,hS))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":b.danger,"is-disabled":b.disabled}]),disabled:b.disabled,role:"menuitem",onClick:h=>p(b)},[n.createElementVNode("span",gS,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",bS,n.toDisplayString(b.caption),1)],10,yS))],64))),128))],36)],8,cS)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-0b8cdb1f"]]),Sl=[".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 fo(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function kS(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function ES(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const g=t(y.left,y.top+y.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,f=0;const p=()=>{const y=d.trim();if(y){const g=t(m,(u+f)/2);c.push({...i,x:g.x,y:g.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(p(),u=g.top,m=g.left,f=g.bottom,d=s[y]):(d+=s[y],f=Math.max(f,g.bottom))}return p(),c}function Da(e,t){const o=[];for(const i of e.querySelectorAll("*"))kS(i)&&(i.closest(Sl)||fo(i)&&o.push(...ES(i,t)));return o}function ai(e){return Math.round(e*100)/100}function NS(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Sl)||!fo(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=t(a.left,a.top),l=t(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="${ai(r.x)}" y="${ai(r.y)}" width="${ai(l.x-r.x)}" height="${ai(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 wS(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!fo(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=>ai(parseFloat(o.getAttribute(d)??"0"));s==="line"?t.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return t}function of(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Sl)||!fo(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 ri(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=t(o.left,o.top),r=t(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 $l(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function vS(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(p,y)=>e.screenToFlowCoordinate({x:p,y}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const p of e.nodes.value){const y=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(p.id)}"]`);if(!y||!fo(y))continue;const g=y.firstElementChild;if(g)if(p.type==="group"){const _=ri(g,o);$l(s,_),i.push({..._,texts:[]});const b=g.querySelector(".em-group__label");b&&i.push({...ri(b,o),stroke:"none",texts:[]}),i.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Da(g,o)})}else if(p.type==="note"){const _={...ri(g,o),texts:Da(g,o),lines:of(g,g,o)};$l(s,_),r.push(_)}else{const _=ri(g,o);$l(s,_);const b=_.radius??{tl:0,tr:0};a.push({..._,stroke:"none",texts:[]});const N=g.querySelector(".em-entity__header");if(N){const h=ri(N,o);a.push({x:_.x,y:_.y,w:_.w,h:h.y+h.h-_.y,fill:h.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}a.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Da(g,o),lines:of(g,g,o),icons:NS(g,o)}),a.push({..._,fill:"none",texts:[]})}}for(const p of t.querySelectorAll(".vue-flow__edge")){const y=p.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!fo(y))continue;const g=y.getAttribute("d");if(!g)continue;const _=getComputedStyle(y),b=_.strokeDasharray,N=wS(p);l.push({d:g,stroke:_.stroke,strokeWidth:parseFloat(_.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:Da(p,o),markers:N.length?N:void 0})}const c=t.closest(".em-canvas")??t,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 Rl(e){return ls(vS(e))}function af(e,t){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function rf(e,t="diagram.svg"){const o=Rl(e);af(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function xS(e){var i,a;const t=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:t>0?t:1,h:o>0?o:1}}async function lf(e,t="diagram.png",o=2){const i=Rl(e),{w:a,h:r}=xS(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,f)=>{s.onload=()=>m(),s.onerror=()=>f(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 변환 실패");af(u,t)}finally{URL.revokeObjectURL(l)}}const IS={class:"em-shortcuts"},CS={class:"em-shortcuts__title"},SS={class:"em-shortcuts__keys"},$S={class:"em-shortcuts__kbd"},RS={key:0,class:"em-shortcuts__plus"},AS={class:"em-shortcuts__desc"},TS={class:"em-shortcuts__actions"},sf=Ge(n.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(s,c)=>Ct(t.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=n.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.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)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.shortcuts.title")},{default:n.withCtx(()=>[n.createElementVNode("div",IS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",CS,n.toDisplayString(d.title),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.items,u=>(n.openBlock(),n.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[n.createElementVNode("span",SS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.keys,(m,f)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:m+f},[n.createElementVNode("kbd",$S,n.toDisplayString(m),1),f<u.keys.length-1?(n.openBlock(),n.createElementBlock("span",RS,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",AS,n.toDisplayString(u.desc),1)]))),128))]))),128)),n.createElementVNode("div",TS,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-af88f86f"]]);function po(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function VS(e,t){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(t);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 MS={class:"em-cmdk",role:"dialog","aria-modal":"true"},BS=["placeholder"],DS={class:"em-cmdk__results"},OS={class:"em-cmdk__section"},LS=["onMouseenter","onClick"],PS={class:"em-cmdk__label"},zS={key:0,class:"em-cmdk__tag"},US={key:1,class:"em-cmdk__sub"},FS={class:"em-cmdk__section"},HS=["onMouseenter","onClick"],GS={class:"em-cmdk__label"},jS={key:1,class:"em-cmdk__empty"},KS=Ge(n.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.ref(""),l=n.ref(0),s=n.ref(null),c=n.computed(()=>a.userLanguage.value),d=n.computed(()=>{const h=c.value,k=a.state.logical.entities.map(A=>{var G,K,v,T,H,C;return{type:"goto",kind:"entity",id:A.modelId,label:((K=(G=A.table)==null?void 0:G.logicalName)==null?void 0:K[h])||A.name,sub:(v=A.table)==null?void 0:v.physicalName,match:po(A.name,(H=(T=A.table)==null?void 0:T.logicalName)==null?void 0:H[h],(C=A.table)==null?void 0:C.physicalName)??""}}),P=a.state.logical.groups.map(A=>{var G,K,v,T;return{type:"goto",kind:"group",id:A.modelId,label:((G=A.name)==null?void 0:G[h])||((K=A.name)==null?void 0:K.ko)||A.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:po((v=A.name)==null?void 0:v[h],(T=A.name)==null?void 0:T.ko,A.packageName)??""}});return[...k,...P]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=n.computed(()=>{const h=[];a.editable.value&&(h.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),h.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),h.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),h.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),h.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),h.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),h.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),h.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const k of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])h.push({type:"action",id:`dm-${k}`,label:a.t(u[k]),run:()=>a.displayMode.value=k});return h});function f(h,k){return h.label.toLowerCase().includes(k)}const p=n.computed(()=>{const h=r.value.trim().toLowerCase();return h?d.value.filter(k=>k.match.includes(h)):d.value}),y=n.computed(()=>{const h=r.value.trim().toLowerCase();return h?m.value.filter(k=>f(k,h)):m.value}),g=n.computed(()=>[...p.value,...y.value]);n.watch([p,y],()=>{l.value=0});function _(h){return g.value.indexOf(h)}function b(h){if(h.type==="goto")a.selection.value={kind:h.kind,id:h.id},a.requestFocus(h.id);else{if(h.disabled)return;h.run()}i("close")}function N(h){if(h.key==="Escape"){i("close"),h.preventDefault();return}if(h.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),h.preventDefault();return}if(h.key==="ArrowUp"){l.value=Math.max(l.value-1,0),h.preventDefault();return}if(h.key==="Enter"){const k=g.value[l.value];k&&b(k),h.preventDefault()}}return n.nextTick(()=>{var h;return(h=s.value)==null?void 0:h.focus()}),(h,k)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:k[1]||(k[1]=n.withModifiers(P=>i("close"),["self"]))},[n.createElementVNode("div",MS,[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":k[0]||(k[0]=P=>r.value=P),class:"em-cmdk__input",type:"text",placeholder:n.unref(a).t("em.cmd.placeholder"),onKeydown:N},null,40,BS),[[n.vModelText,r.value]]),n.createElementVNode("div",DS,[g.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[p.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("div",OS,n.toDisplayString(n.unref(a).t("em.cmd.sectionGoto")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,P=>(n.openBlock(),n.createElementBlock("button",{key:P.id,type:"button",class:n.normalizeClass(["em-cmdk__item",{"is-active":_(P)===l.value}]),onMouseenter:A=>l.value=_(P),onClick:A=>b(P)},[n.createElementVNode("span",PS,n.toDisplayString(P.label),1),P.tag?(n.openBlock(),n.createElementBlock("span",zS,n.toDisplayString(P.tag),1)):P.sub?(n.openBlock(),n.createElementBlock("span",US,n.toDisplayString(P.sub),1)):n.createCommentVNode("",!0)],42,LS))),128))],64)):n.createCommentVNode("",!0),y.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",FS,n.toDisplayString(n.unref(a).t("em.cmd.sectionActions")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,P=>(n.openBlock(),n.createElementBlock("button",{key:P.id,type:"button",class:n.normalizeClass(["em-cmdk__item",{"is-active":_(P)===l.value,"is-disabled":P.disabled}]),onMouseenter:A=>l.value=_(P),onClick:A=>b(P)},[n.createElementVNode("span",GS,n.toDisplayString(P.label),1)],42,HS))),128))],64)):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock("div",jS,n.toDisplayString(n.unref(a).t("em.cmd.empty")),1))])])],32)]))}}),[["__scopeId","data-v-a5a7d1c2"]]);function YS(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const WS={key:0,class:"em-canvas__empty","aria-hidden":"true"},qS={class:"em-canvas__empty-title"},XS=["innerHTML"],JS=["innerHTML"],ZS={key:1,class:"em-canvas__empty-title"},QS={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},e$={class:"em-conflict-banner__body"},t$={class:"em-conflict-banner__title"},n$={class:"em-conflict-banner__detail"},o$={key:0,class:"em-toast",role:"status","aria-live":"polite"},Al="nc:",cf=Ge(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=oe.useModal(),r=n.ref(!1),l=n.ref(null);let s;n.watch(()=>i.notice.value,z=>{z&&(l.value=z.text,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>s&&clearTimeout(s));const c=n.computed(()=>YS(i.opConflict.value)),d=n.ref(!1),u=n.ref(!1),m={x:0,y:0};function f(z){m.x=z.clientX,m.y=z.clientY}const p=n.ref(null);n.provide(ya,p);const y=n.ref(null);n.provide(Yu,y);const g=n.ref(null),_=n.computed(()=>{const z=g.value,q=new Set;if(!z)return q;if(z.kind==="entity")q.add(z.id);else if(z.kind==="group"){const ue=i.resolved.value.groups.find(Ce=>Ce.group.modelId===z.id);for(const Ce of(ue==null?void 0:ue.group.memberEntityRefs)??[])q.add(Ce)}return q}),b=n.computed(()=>{const z=g.value,q=new Set(_.value),ue=new Set,Ce=new Set;if(!z)return{related:q,edges:ue,notes:Ce};if(z.kind==="note"){Ce.add(z.id);for(const Oe of i.resolved.value.noteConnections)Oe.noteRef===z.id&&q.add(Oe.targetRef);return{related:q,edges:ue,notes:Ce}}const Be=_.value;if(!Be.size)return{related:q,edges:ue,notes:Ce};for(const Oe of i.resolved.value.associations){const{end1:he,end2:le}=Oe.association;(Be.has(he.entityRef)||Be.has(le.entityRef))&&(ue.add(Oe.association.modelId),q.add(he.entityRef),q.add(le.entityRef))}for(const Oe of i.resolved.value.noteConnections)q.has(Oe.targetRef)&&Ce.add(Oe.noteRef);return{related:q,edges:ue,notes:Ce}});n.provide(so,{source:g,active:n.computed(()=>g.value!==null),primaryEntityIds:_,relatedEntityIds:n.computed(()=>b.value.related),relatedEdgeIds:n.computed(()=>b.value.edges),relatedNoteIds:n.computed(()=>b.value.notes),hoverGroupId:n.computed(()=>{var z;return((z=g.value)==null?void 0:z.kind)==="group"?g.value.id:null}),setEntityHover:z=>{y.value||u.value||(g.value=z?{kind:"entity",id:z}:null)},setGroupHover:z=>{y.value||u.value||(g.value=z?{kind:"group",id:z}:null)},setNoteHover:z=>{y.value||u.value||(g.value=z?{kind:"note",id:z}:null)}}),n.provide(An,i);function N(z,q){return`${Al}${z}:${q}`}function h(z){if(!z.startsWith(Al))return null;const[q,ue]=z.slice(Al.length).split(":");return q&&ue?{noteRef:q,targetRef:ue}:null}n.provide(ll,{points:z=>{var ue,Ce;const q=h(z);return q?((ue=i.resolved.value.noteConnections.find(Be=>Be.noteRef===q.noteRef&&Be.targetRef===q.targetRef))==null?void 0:ue.waypoints)??[]:((Ce=i.resolved.value.associations.find(Be=>Be.association.modelId===z))==null?void 0:Ce.waypoints)??[]},movePoint:(z,q,ue)=>{const Ce=h(z);Ce?i.moveNoteConnectionWaypoint(Ce.noteRef,Ce.targetRef,q,ue):i.moveWaypoint(z,q,ue)},insertPoint:(z,q,ue)=>{const Ce=h(z);Ce?i.addNoteConnectionWaypoint(Ce.noteRef,Ce.targetRef,q,ue):i.addWaypoint(z,q,ue)},removePoint:(z,q)=>{const ue=h(z);ue?i.removeNoteConnectionWaypoint(ue.noteRef,ue.targetRef,q):i.removeWaypoint(z,q)}});const k=He(),{nodes:P,edges:A,findNode:G,findEdge:K,addNodes:v,addEdges:T,removeNodes:H,removeEdges:C,fitView:ae,setCenter:E,getViewport:Y,screenToFlowCoordinate:S,getSelectedNodes:W,updateNodeInternals:ee}=k,ie=n.ref(!1);async function O(z){ie.value=!0,await n.nextTick(),await new Promise(q=>requestAnimationFrame(()=>q(null)));try{return await z()}finally{ie.value=!1}}function U(){return O(()=>rf(k))}function ne(){return O(()=>lf(k))}t({exportSvg:U,exportPng:ne});const ce=n.computed(()=>i.resolved.value.entities.length===0);function ge(){const z=Y(),{width:q,height:ue}=k.dimensions.value;return{x:(q/2-z.x)/z.zoom,y:(ue/2-z.y)/z.zoom}}function se(){const z=ge();i.addEntity("NewEntity",{x:z.x,y:z.y})}function pe(){const z=ge();i.addNote("메모",{x:z.x,y:z.y})}function be(z){for(const q of i.resolved.value.groups){const{location:ue,size:Ce}=q.geo;if(z.x>=ue.x&&z.x<=ue.x+Ce.width&&z.y>=ue.y&&z.y<=ue.y+Ce.height)return q.group.modelId}return null}function xe(){const z=i.resolved.value,q=new Map(z.groups.map(he=>[he.group.modelId,he.geo])),ue=new Set(z.groups.map(he=>he.group.modelId)),Ce=new Set([...ue,...z.entities.map(he=>he.entity.modelId),...z.notes.map(he=>he.note.modelId)]);for(const he of[...P.value])Ce.has(he.id)||H([he.id]);for(const he of z.groups){const le=he.group.modelId,Pe={width:`${he.geo.size.width}px`,height:`${he.geo.size.height}px`},Ke={group:he.group,style:he.style,locked:he.locked},st=he.locked?!1:void 0,Ze=G(le);Ze?(Ze.position={...he.geo.location},Ze.data=Ke,Ze.style=Pe,Ze.draggable=st):v([{id:le,type:"group",position:{...he.geo.location},draggable:st,style:Pe,data:Ke}])}for(const he of z.entities){const le=he.entity.modelId,Pe=he.groupRef&&ue.has(he.groupRef)?he.groupRef:void 0,Ke={entity:he.entity,displayMode:i.displayMode.value,collapsed:he.collapsed,locked:he.locked,groupRef:Pe,size:he.geo.size,style:he.style,attributeStyles:he.attributeStyles,operationStyles:he.operationStyles},st=he.locked?!1:void 0,Ze=Pe?q.get(Pe):void 0,pt=Ze?{x:he.geo.location.x-Ze.location.x,y:he.geo.location.y-Ze.location.y}:{...he.geo.location},nt=G(le);nt?(nt.position=pt,nt.data=Ke,nt.parentNode=Pe,nt.draggable=st):v([{id:le,type:"entity",position:pt,parentNode:Pe,draggable:st,data:Ke}])}for(const he of z.notes){const le=he.note,Pe=le.modelId,Ke=he.groupRef&&ue.has(he.groupRef)?he.groupRef:void 0,st={note:le,groupRef:Ke},Ze={width:`${le.geo.size.width}px`,height:`${le.geo.size.height}px`},pt=Ke?q.get(Ke):void 0,nt=pt?{x:le.geo.location.x-pt.location.x,y:le.geo.location.y-pt.location.y}:{...le.geo.location},at=G(Pe);at?(at.position=nt,at.data=st,at.style=Ze,at.parentNode=Ke):v([{id:Pe,type:"note",position:nt,parentNode:Ke,style:Ze,data:st}])}const Be=new Map(z.associations.map(he=>[he.association.modelId,he])),Oe=new Set(z.noteConnections.map(he=>N(he.noteRef,he.targetRef)));for(const he of[...A.value])!Be.has(he.id)&&!Oe.has(he.id)&&C([he.id]);for(const[he,le]of Be){const Pe={id:he,type:"association",source:le.association.end1.entityRef,target:le.association.end2.entityRef,sourceHandle:le.sourceColumnRef?`r:${le.sourceColumnRef}`:void 0,targetHandle:le.targetColumnRef?`l:${le.targetColumnRef}`:void 0,data:{association:le.association,sourceColumnRef:le.sourceColumnRef,targetColumnRef:le.targetColumnRef}},Ke=K(he);Ke?(Ke.data=Pe.data,Ke.sourceHandle=Pe.sourceHandle,Ke.targetHandle=Pe.targetHandle):T([Pe])}for(const he of z.noteConnections){const le=N(he.noteRef,he.targetRef),Pe={noteRef:he.noteRef,targetRef:he.targetRef},Ke=K(le);Ke?Ke.data=Pe:T([{id:le,type:"note-connection",source:he.noteRef,target:he.targetRef,data:Pe}])}Te()}function Te(){n.nextTick(()=>requestAnimationFrame(()=>ee()))}function Ae(){const z=W.value.map(ue=>ue.id);if(z.length)return z;const q=i.selection.value;return q&&(q.kind==="entity"||q.kind==="note"||q.kind==="group")?[q.id]:[]}function fe(){return W.value.filter(z=>z.type==="entity").map(z=>z.id)}function ke(){return W.value.filter(z=>z.type==="group").map(z=>z.id)}function we(z){var q;return[...((q=i.state.logical.groups.find(ue=>ue.modelId===z))==null?void 0:q.memberEntityRefs)??[]]}function j(){const z=ke().flatMap(we);return[...new Set([...fe(),...z])]}function L(){return ke().length>0||fe().length>1}function x(){L()?i.copy(j()):i.copy()}async function R(z){if(!z.length)return;await n.nextTick();const q=W.value;q.length&&k.removeSelectedNodes(q);const ue=z.map(Ce=>G(Ce)).filter(Ce=>!!Ce);ue.length&&k.addSelectedNodes(ue)}function V(z){if(L()&&fe().includes(z)){const q=j();return{caption:i.t("em.ctx.copyN",{n:q.length}),icon:"copy",handler:()=>i.copy(q)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:z},i.copy()}}}function Q(z){var Be;const q=z.target;if(q&&(q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable))return;if(z.key==="?"){a.openModal({component:sf,bind:{locale:i.uiLocale.value}}),z.preventDefault();return}if((z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"){r.value=!0,z.preventDefault();return}if(!i.editable.value){(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="c"&&(x(),z.preventDefault());return}if(z.key==="Delete"||z.key==="Backspace"){i.deleteSelection()&&z.preventDefault();return}if(z.key==="ArrowUp"||z.key==="ArrowDown"||z.key==="ArrowLeft"||z.key==="ArrowRight"){if(((Be=i.selection.value)==null?void 0:Be.kind)==="attribute"){if(z.key==="ArrowUp"||z.key==="ArrowDown"){const Pe=z.key==="ArrowDown"?1:-1;(z.altKey?i.nudgeSelectedAttributes(Pe):i.moveAttributeFocus(Pe))&&z.preventDefault()}return}const Oe=z.shiftKey?10:1,he=z.key==="ArrowLeft"?-Oe:z.key==="ArrowRight"?Oe:0,le=z.key==="ArrowUp"?-Oe:z.key==="ArrowDown"?Oe:0;i.nudgeNodes(Ae(),he,le)&&z.preventDefault();return}if(!(z.metaKey||z.ctrlKey))return;const Ce=z.key.toLowerCase();Ce==="c"?(x(),z.preventDefault()):Ce==="v"?(R(i.paste()),z.preventDefault()):Ce==="z"&&(z.shiftKey?i.redo():i.undo(),z.preventDefault())}n.onMounted(async()=>{xe(),await n.nextTick(),ae(),window.addEventListener("keydown",Q),window.addEventListener("pointerup",me),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Q),window.removeEventListener("pointerup",me),window.removeEventListener("pointermove",f)});function me(){p.value=null}function ve(){u.value=!0,g.value=null}function Ee(){var Ce;u.value=!1;const z=(Ce=document.elementFromPoint(m.x,m.y))==null?void 0:Ce.closest(".vue-flow__node"),q=z==null?void 0:z.dataset.id;if(!q){g.value=null;return}const ue=z.classList.contains("vue-flow__node-group")?"group":z.classList.contains("vue-flow__node-note")?"note":"entity";g.value={kind:ue,id:q}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],xe),n.watch(()=>i.revision.value,Te),n.watch(()=>i.resolved.value,z=>{const q=g.value;if(!q)return;(q.kind==="entity"?z.entities.some(Ce=>Ce.entity.modelId===q.id):q.kind==="group"?z.groups.some(Ce=>Ce.group.modelId===q.id):z.notes.some(Ce=>Ce.note.modelId===q.id))||(g.value=null)});function $e(z){const q=z.computedPosition??z.position,ue=z.dimensions??{width:0,height:0};return{x:q.x+ue.width/2,y:q.y+ue.height/2}}function Me(z){const q=z.node;if(q){if(g.value=null,q.type==="group"){const ue=i.resolved.value.groups.find(Ce=>Ce.group.modelId===q.id);y.value=ue?{groupId:q.id,dx:q.position.x-ue.geo.location.x,dy:q.position.y-ue.geo.location.y}:null,p.value=null;return}if(q.type!=="entity"&&q.type!=="note"){p.value=null;return}p.value=be($e(q))}}function Ue(z){var Ce;p.value=null,y.value=null;const q=(Ce=z.nodes)!=null&&Ce.length?z.nodes:[z.node],ue=q.filter(Be=>(Be==null?void 0:Be.type)==="group");if(ue.length){for(const Be of ue){if(!Be)continue;const Oe=i.resolved.value.entities.filter(he=>he.groupRef===Be.id).map(he=>{const le=G(he.entity.modelId),Pe=(le==null?void 0:le.computedPosition)??(le==null?void 0:le.position)??{x:0,y:0};return{id:he.entity.modelId,location:{x:Pe.x,y:Pe.y}}});i.dragGroup(Be.id,{x:Be.position.x,y:Be.position.y},Oe)}return}for(const Be of q){if(!Be||Be.type==="group")continue;const Oe=Be.computedPosition??Be.position,he=Be.dimensions??{width:0,height:0},le={x:Oe.x+he.width/2,y:Oe.y+he.height/2};Be.type==="note"?i.dropNote(Be.id,{x:Oe.x,y:Oe.y},be(le)):i.dropEntity(Be.id,{x:Oe.x,y:Oe.y},be(le))}}function Ye(z){var Pe,Ke,st,Ze,pt;if(!i.editable.value||!z.source||!z.target)return;const q=((Pe=G(z.source))==null?void 0:Pe.type)==="note",ue=((Ke=G(z.target))==null?void 0:Ke.type)==="note";if(q||ue){if(q&&ue)return;const nt=q?z.source:z.target,at=q?z.target:z.source;((st=G(at))==null?void 0:st.type)==="entity"&&i.addNoteConnection(nt,at);return}const Ce=nt=>{var at;return(at=i.state.logical.entities.find(ct=>ct.modelId===nt))==null?void 0:at.stereotype},Be=Ce(z.source)==="JPA_EMBEDDABLE",Oe=Ce(z.target)==="JPA_EMBEDDABLE";if(Be||Oe){if(Be&&Oe)return;const nt=Be?z.source:z.target,at=Be?z.target:z.source;i.addEmbedAssociation(at,nt);return}const he=(Ze=z.sourceHandle)!=null&&Ze.startsWith("r:")?z.sourceHandle.slice(2):void 0,le=(pt=z.targetHandle)!=null&&pt.startsWith("l:")?z.targetHandle.slice(2):void 0;i.addAssociation(z.source,z.target,he,le)}const Fe=n.ref(null);function gt(z,q){var Ce;const ue=i.state.layout.entityLayouts.find(Be=>Be.entityRef===z);return ut((Ce=ue==null?void 0:ue.attributeStyles)==null?void 0:Ce[q])}function w(z,q){var Ce;const ue=i.state.layout.entityLayouts.find(Be=>Be.entityRef===z);return ut((Ce=ue==null?void 0:ue.operationStyles)==null?void 0:Ce[q])}function M(z){var q;return ut((q=i.state.layout.groupLayouts.find(ue=>ue.groupRef===z))==null?void 0:q.style)}function I(z){var q;return ut((q=i.state.layout.notes.find(ue=>ue.modelId===z))==null?void 0:q.style)}function D(z){var Be,Oe;if(z.preventDefault(),!i.editable.value)return;const q=()=>S({x:z.clientX,y:z.clientY}),ue=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const he=q();i.addEntity("NewEntity",{x:he.x,y:he.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const he=q();i.addNote("메모",{x:he.x,y:he.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const he=q();i.addEmptyGroup({x:he.x,y:he.y})}}],Ce=(Be=i.clipboard.value)==null?void 0:Be.kind;(Ce==="entity"||Ce==="entities")&&ue.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>R(i.paste())}),i.resolved.value.entities.length>0&&ue.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(Oe=Fe.value)==null||Oe.open(z,ue)}function B({event:z,node:q}){var Pe,Ke,st,Ze,pt,nt,at,ct,pf,hf,yf,gf,bf,_f,kf,Ef,Nf,wf;const ue=z;if(ue.preventDefault(),!i.editable.value){if(q.type==="group"||q.type==="note")return;const je=(Ke=(Pe=ue.target)==null?void 0:Pe.closest("[data-attr]"))==null?void 0:Ke.dataset.attr;if(je){const Qe=i.selection.value;(Qe==null?void 0:Qe.kind)==="attribute"&&Qe.entityId===q.id&&Qe.ids.includes(je)||i.selectAttribute(q.id,je);const Jt=((st=i.selection.value)==null?void 0:st.kind)==="attribute"&&i.selection.value.entityId===q.id?[...i.selection.value.ids]:[je];(Ze=Fe.value)==null||Ze.open(ue,[{caption:Jt.length>1?i.t("em.ctx.copyN",{n:Jt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(pt=Fe.value)==null||pt.open(ue,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>pa(a,i,q.id)},V(q.id)]);return}if(q.type==="group"){const je=i.isGroupLocked(q.id),Qe=[];je||Qe.push({type:"swatches",caption:i.t("em.common.color"),current:M(q.id),onPick:Jt=>i.setGroupSwatch(q.id,Jt)},{type:"separator"});const rt=L()&&ke().includes(q.id)?j():we(q.id);rt.length&&Qe.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(rt)}),Qe.push({caption:je?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:je?"unlock":"lock",handler:()=>i.setGroupLocked(q.id,!je)}),je||Qe.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(q.id)}),(nt=Fe.value)==null||nt.open(ue,Qe);return}if(q.type==="note"){(at=Fe.value)==null||at.open(ue,[{type:"swatches",caption:i.t("em.common.color"),current:I(q.id),onPick:je=>i.setNoteSwatch(q.id,je)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(q.id)}]);return}const Ce=(pf=(ct=ue.target)==null?void 0:ct.closest("[data-attr]"))==null?void 0:pf.dataset.attr;if(Ce){const je=i.selection.value;(je==null?void 0:je.kind)==="attribute"&&je.entityId===q.id&&je.ids.includes(Ce)||i.selectAttribute(q.id,Ce);const rt=((hf=i.selection.value)==null?void 0:hf.kind)==="attribute"&&i.selection.value.entityId===q.id?[...i.selection.value.ids]:[Ce];if(i.isEntityLocked(q.id)){(yf=Fe.value)==null||yf.open(ue,[{caption:rt.length>1?i.t("em.ctx.copyN",{n:rt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const Jt=rt.length>1,Tl=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(q.id)},{type:"swatches",caption:Jt?i.t("em.ctx.colorN",{n:rt.length}):i.t("em.common.color"),current:Jt?null:gt(q.id,Ce),onPick:xT=>i.setAttributeSwatches(q.id,rt,xT)},{type:"separator"},{caption:Jt?i.t("em.ctx.copyN",{n:rt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],li=i.clipboard.value;(li==null?void 0:li.kind)==="attribute"&&Tl.push({caption:li.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:li.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:q.id},i.paste()}}),Tl.push({type:"separator"},{caption:Jt?i.t("em.ctx.deleteAttrN",{n:rt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(q.id,rt)}),(gf=Fe.value)==null||gf.open(ue,Tl);return}const Be=(_f=(bf=ue.target)==null?void 0:bf.closest("[data-op]"))==null?void 0:_f.dataset.op;if(Be){if(i.isEntityLocked(q.id))return;(kf=Fe.value)==null||kf.open(ue,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(q.id)},{type:"swatches",caption:i.t("em.common.color"),current:w(q.id,Be),onPick:je=>i.setOperationSwatch(q.id,Be,je)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(q.id,Be)}]);return}const Oe=i.resolved.value.entities.find(je=>je.entity.modelId===q.id),he=!!(Oe!=null&&Oe.locked),le=[{caption:he?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>pa(a,i,q.id)}];if(!he){le.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(q.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(q.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const Qe=W.value.filter(rt=>rt.type==="entity").map(rt=>rt.id);i.createGroup(Qe.includes(q.id)&&Qe.length?Qe:[q.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(q.id,q.id)});const je=i.embeddableCatalog.value;if(je.length){le.push({type:"separator"});for(const Qe of je){const rt=((Ef=Qe.label)==null?void 0:Ef.ko)??((Nf=Qe.label)==null?void 0:Nf.en)??Qe.type;le.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:rt}),icon:"link",handler:()=>i.addPredefinedEmbed(q.id,Qe.type)})}}}if(le.push({type:"separator"}),le.push({caption:Oe!=null&&Oe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Oe!=null&&Oe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(q.id,!(Oe!=null&&Oe.collapsed))}),Oe!=null&&Oe.groupRef&&!he&&le.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(q.id)}),le.push({caption:he?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:he?"unlock":"lock",handler:()=>i.setEntityLocked(q.id,!he)}),le.push(V(q.id)),!he){const je=i.clipboard.value;(je==null?void 0:je.kind)==="attribute"&&le.push({caption:je.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:je.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:q.id},i.paste()}}),le.push({type:"separator"}),le.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(q.id)})}(wf=Fe.value)==null||wf.open(ue,le)}function de({event:z,edge:q}){var Be,Oe;const ue=z;if(ue.preventDefault(),!i.editable.value)return;const Ce=h(q.id);if(Ce){(Be=Fe.value)==null||Be.open(ue,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(Ce.noteRef,Ce.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(Ce.noteRef,Ce.targetRef)}]);return}(Oe=Fe.value)==null||Oe.open(ue,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(q.id)},{type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(q.id)}])}function J(z){return z==="group"?"group":z==="note"?"note":"entity"}function X({node:z}){if(W.value.length>1){i.selection.value=null;return}i.selection.value={kind:J(z.type),id:z.id}}function te({nodes:z}){z.length>1&&(i.selection.value=null)}function re({edge:z}){const q=h(z.id);i.selection.value=q?{kind:"note",id:q.noteRef}:{kind:"association",id:z.id}}function Ne(z){const q=i.selection.value;return!!q&&q.kind!=="attribute"&&q.id===z.id}function $(z){var q,ue;return Ne(z)?z.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":z.type==="note"?"var(--em-note-soft)":z.type==="group"?Mu(ut((q=z.data)==null?void 0:q.style),!0)??"var(--em-mm-group)":Mu(ut((ue=z.data)==null?void 0:ue.style))??"var(--em-mm-entity)"}function Z(z){return Ne(z)?"var(--em-selection)":z.type==="note"?"var(--em-note-accent)":z.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function F(z,q){E(z,q,{zoom:Y().zoom,duration:350})}n.watch(()=>i.focusRequest.value,z=>{if(!z)return;const q=G(z.id);if(!q)return;const ue=q.computedPosition??q.position,Ce=q.dimensions??{width:0,height:0};F(ue.x+Ce.width/2,ue.y+Ce.height/2)});function Ie({position:z}){F(z.x,z.y)}function ye({node:z}){i.selection.value={kind:J(z.type),id:z.id};const q=z.computedPosition??z.position,ue=z.dimensions??{width:0,height:0};F(q.x+ue.width/2,q.y+ue.height/2)}function ze({node:z}){ae({nodes:[z.id],duration:350,maxZoom:1.2,padding:.6})}return(z,q)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":d.value,"is-panning":u.value}])},[n.createVNode(n.unref(ck),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ie.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":n.unref(i).editable.value,"nodes-connectable":n.unref(i).editable.value,"connection-mode":n.unref(Kt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:ve,onMoveEnd:Ee,onConnect:Ye,onConnectStart:q[1]||(q[1]=ue=>d.value=!0),onConnectEnd:q[2]||(q[2]=ue=>d.value=!1),onNodeDrag:Me,onNodeDragStop:Ue,onNodeClick:X,onEdgeClick:re,onSelectionChange:te,onPaneClick:q[3]||(q[3]=ue=>n.unref(i).selection.value=null),onPaneContextMenu:D,onNodeContextMenu:B,onEdgeContextMenu:de},{"node-group":n.withCtx(ue=>[n.createVNode(qu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"node-entity":n.withCtx(ue=>[n.createVNode(Wu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"node-note":n.withCtx(ue=>[n.createVNode(Xu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"edge-association":n.withCtx(ue=>[n.createVNode(dm,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"edge-note-connection":n.withCtx(ue=>[n.createVNode(sS,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Xw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Nv),{"show-interactive":!1,position:"bottom-left"},{default:n.withCtx(()=>[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(n.unref(Tn),{class:"em-palette__group-start",title:n.unref(i).t("em.ctx.addEntity"),onClick:se},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1},8,["title"]),n.createVNode(n.unref(Tn),{title:n.unref(i).t("em.ctx.addNote"),onClick:pe},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1},8,["title"]),n.createVNode(n.unref(Tn),{title:n.unref(i).t("em.palette.autoLayout"),onClick:q[0]||(q[0]=ue=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(iS),{key:1,pannable:"",width:224,height:160,"node-color":$,"node-stroke-color":Z,"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:Ie,onNodeClick:ye,onNodeDblclick:ze})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ce.value?(n.openBlock(),n.createElementBlock("div",WS,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("p",qS,n.toDisplayString(n.unref(i).t("em.canvas.emptyTitle")),1),n.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:n.unref(i).t("em.canvas.emptyHint")},null,8,XS),n.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:n.unref(i).t("em.canvas.emptyShortcutHint")},null,8,JS)],64)):(n.openBlock(),n.createElementBlock("p",ZS,n.toDisplayString(n.unref(i).t("em.canvas.emptyReadonly")),1))])):n.createCommentVNode("",!0),r.value?(n.openBlock(),n.createBlock(KS,{key:1,controller:n.unref(i),onClose:q[4]||(q[4]=ue=>r.value=!1)},null,8,["controller"])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[c.value?(n.openBlock(),n.createElementBlock("div",QS,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",e$,[n.createElementVNode("strong",t$,n.toDisplayString(c.value.title),1),n.createElementVNode("span",n$,n.toDisplayString(c.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(_S,{ref_key:"menuRef",ref:Fe,locale:n.unref(i).uiLocale.value},null,8,["locale"]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",o$,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-a49d9d63"]]),i$={class:"em-explorer em-scroll-overlay"},a$={class:"em-explorer__search"},r$=["placeholder","aria-label"],l$=["aria-label","title"],s$={key:0,class:"em-explorer__empty"},c$={class:"em-explorer__rows"},d$=["data-key","onClick","onDblclick"],u$=["onClick"],m$=["title"],f$={class:"em-key-slot"},p$={class:"em-key-slot"},h$={class:"em-explorer__label"},df=Ge(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=oe.useModal(),r=n.computed(()=>{var O;const A=i.resolved.value,G=i.displayMode.value,K=i.userLanguage.value,v=U=>{var ne,ce,ge;return ci(G,U.name,(ce=(ne=U.table)==null?void 0:ne.logicalName)==null?void 0:ce[K],(ge=U.table)==null?void 0:ge.physicalName,i.t("em.node.logicalMissing"))},T=G==="PHYSICAL"||G==="LOGICAL_PHYSICAL",H=U=>{const ne=U.attrType.startsWith("RELATION")&&U.dbAttrs.length>0;return{icon:U.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:U.identifier,fk:ne&&T}}},C=U=>U.attrType.startsWith("EMBED")&&U.dbAttrs.length>0,ae=G==="PHYSICAL"||G==="LOGICAL_PHYSICAL",E=U=>{if(U.attrType!=="EMBED_PREDEF")return U.dbAttrs;const ne=i.embeddableCatalog.value.find(ce=>ce.type===U.type);return ne?U.dbAttrs.map((ce,ge)=>{const se=ne.fields[ge];return se?{...ce,physicalName:ce.physicalName||se.physicalName,logicalName:ce.logicalName??se.logicalName,dataType:ce.dataType||se.dataType,length:ce.length??se.length}:ce}):U.dbAttrs},Y=(U,ne)=>{var pe,be,xe,Te,Ae,fe,ke,we,j;const ce={entityId:ne,attrId:U.modelId};if(C(U)){const L=Za(G,U);return{key:`attr:${U.modelId}`,label:U.name+(L?` : ${L}`:""),icon:"table",attrRef:ce,focusId:ne,matchText:po(U.name,(be=(pe=U.dbAttrs[0])==null?void 0:pe.logicalName)==null?void 0:be[K],(xe=U.dbAttrs[0])==null?void 0:xe.physicalName),children:ae?E(U).map(x=>{var R,V;return{key:`attr:${U.modelId}:col:${x.modelId}`,label:ci(G,x.physicalName,(R=x.logicalName)==null?void 0:R[K],x.physicalName,i.t("em.node.logicalMissing"))+(x.dataType?` : ${x.dataType}`:""),icon:"field",attrRef:ce,focusId:ne,matchText:po(x.physicalName,(V=x.logicalName)==null?void 0:V[K]),children:[]}}):[]}}const ge=Ja(U,i.state.logical.associations),se=Za(G,U,ge);return{key:`attr:${U.modelId}`,label:ci(G,U.name,(Ae=(Te=U.dbAttrs[0])==null?void 0:Te.logicalName)==null?void 0:Ae[K],(fe=U.dbAttrs[0])==null?void 0:fe.physicalName,i.t("em.node.logicalMissing"))+(se?` : ${se}`:""),...H(U),attrRef:ce,focusId:ne,matchText:po(U.name,(we=(ke=U.dbAttrs[0])==null?void 0:ke.logicalName)==null?void 0:we[K],(j=U.dbAttrs[0])==null?void 0:j.physicalName),children:[]}},S=U=>{var ge,se,pe;const ne=U.entity,ce=[...ne.attributes].sort((be,xe)=>be.order-xe.order);return{key:`entity:${ne.modelId}`,label:v(ne),icon:"table",selectKind:"entity",selectId:ne.modelId,focusId:ne.modelId,matchText:po(ne.name,(se=(ge=ne.table)==null?void 0:ge.logicalName)==null?void 0:se[K],(pe=ne.table)==null?void 0:pe.physicalName),children:ce.map(be=>Y(be,ne.modelId))}},W=new Map,ee=[];for(const U of A.entities)if(U.groupRef){const ne=W.get(U.groupRef)??[];ne.push(U),W.set(U.groupRef,ne)}else ee.push(U);const ie=[];for(const U of A.groups){const ne=U.group;ie.push({key:`group:${ne.modelId}`,label:((O=ne.name)==null?void 0:O.ko)||ne.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:ne.modelId,children:(W.get(ne.modelId)??[]).map(S)})}for(const U of ee)ie.push(S(U));if(A.associations.length){const U=new Map(A.entities.map(ne=>[ne.entity.modelId,v(ne.entity)]));ie.push({key:"section:associations",label:i.t("em.explorer.associations",{n:A.associations.length}),icon:"arrow-lr",children:A.associations.map(ne=>{const ce=ne.association,ge=U.get(ce.end1.entityRef)??ce.end1.entityRef,se=U.get(ce.end2.entityRef)??ce.end2.entityRef;return{key:`assoc:${ce.modelId}`,label:`${ge} — ${se}`,icon:"arrow-lr",selectKind:"association",selectId:ce.modelId,children:[]}})})}return A.notes.length&&ie.push({key:"section:notes",label:i.t("em.explorer.notes",{n:A.notes.length}),icon:"note",children:A.notes.map(({note:U})=>{var ne;return{key:`note:${U.modelId}`,label:((ne=U.memo.split(`
|
|
62
|
-
`)[0])==null?void 0:ne.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:U.modelId,focusId:U.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:ie}});function l(A){return A?A.pk&&A.fk?i.t("em.node.keyPfk"):A.pk?i.t("em.node.keyPk"):A.fk?i.t("em.node.keyFk"):"":""}const s=n.ref(new Set);function c(A){const G=new Set(s.value);G.has(A)?G.delete(A):G.add(A),s.value=G}const d=n.ref(""),u=n.ref(null),m=n.computed(()=>d.value.trim().length>0),f=n.computed(()=>{const A=[];if(m.value){const K=VS(r.value,d.value.trim().toLowerCase()),v=(T,H)=>{if(K.has(T.key)){A.push({node:T,depth:H});for(const C of T.children)v(C,H+1)}};return v(r.value,0),A}const G=(K,v)=>{if(A.push({node:K,depth:v}),!s.value.has(K.key))for(const T of K.children)G(T,v+1)};return G(r.value,0),A}),p=n.computed(()=>m.value&&f.value.length<=1);function y(A){var v;if(A.key!=="/"||A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;const G=A.target,K=G==null?void 0:G.tagName;K==="INPUT"||K==="TEXTAREA"||K==="SELECT"||G!=null&&G.isContentEditable||(A.preventDefault(),(v=u.value)==null||v.focus())}n.onMounted(()=>window.addEventListener("keydown",y)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",y));const g=n.computed(()=>{const A=[],G=K=>{if(K.children.length){K.key!=="root"&&A.push(K.key);for(const v of K.children)G(v)}};return G(r.value),A}),_=n.computed(()=>!g.value.some(A=>s.value.has(A)));function b(){s.value=_.value?new Set(g.value):new Set}t({toggleAll:b,allExpanded:_,hasExpandable:n.computed(()=>g.value.length>0)});function N(A){const G=i.selection.value;return A.attrRef?(G==null?void 0:G.kind)==="attribute"&&G.entityId===A.attrRef.entityId&&G.ids.includes(A.attrRef.attrId):!!G&&G.kind!=="attribute"&&!!A.selectId&&A.selectKind===G.kind&&A.selectId===G.id}function h(A){const G=i.selection.value;return A.selectKind==="entity"&&(G==null?void 0:G.kind)==="attribute"&&G.entityId===A.selectId}function k(A,G){if(A.attrRef){const K=G.shiftKey?"range":G.metaKey||G.ctrlKey?"toggle":"replace";i.selectAttribute(A.attrRef.entityId,A.attrRef.attrId,K)}else A.selectKind&&A.selectId&&(i.selection.value={kind:A.selectKind,id:A.selectId});A.focusId&&i.requestFocus(A.focusId)}function P(A){A.selectKind==="entity"&&A.selectId&&pa(a,i,A.selectId)}return(A,G)=>(n.openBlock(),n.createElementBlock("section",i$,[n.createElementVNode("div",a$,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":G[0]||(G[0]=K=>d.value=K),class:"em-explorer__search-input",type:"text",placeholder:n.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":n.unref(i).t("em.explorer.searchAria"),onKeydown:G[1]||(G[1]=n.withKeys(K=>d.value="",["esc"]))},null,40,r$),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":n.unref(i).t("em.explorer.clearSearchAria"),title:n.unref(i).t("em.explorer.clearSearchTitle"),onClick:G[2]||(G[2]=K=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})],8,l$)):n.createCommentVNode("",!0)]),p.value?(n.openBlock(),n.createElementBlock("p",s$,n.toDisplayString(n.unref(i).t("em.explorer.noMatches")),1)):n.createCommentVNode("",!0),n.createElementVNode("div",c$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(f.value,({node:K,depth:v})=>(n.openBlock(),n.createElementBlock("div",{key:K.key,class:n.normalizeClass(["em-explorer__row",{"is-active":N(K),"is-focus-parent":h(K),"is-selectable":!!K.selectKind||!!K.attrRef||!!K.focusId}]),"data-key":K.key,style:n.normalizeStyle({paddingLeft:4+v*14+"px"}),onClick:T=>k(K,T),onDblclick:T=>P(K)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!K.children.length,"is-open":!s.value.has(K.key)}]),onClick:n.withModifiers(T=>K.children.length&&c(K.key),["stop"])},[K.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,u$),K.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(K.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",f$,[K.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):K.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:K.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",p$,[K.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,m$)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:K.icon,size:15},null,8,["name"])),n.createElementVNode("span",h$,n.toDisplayString(K.label),1)],46,d$))),128))])]))}}),[["__scopeId","data-v-7b20d13b"]]),y$={class:"em-text-export"},g$={key:0,class:"em-text-export__tabs",role:"tablist"},b$=["aria-selected","onClick"],_$={class:"em-text-export__pre"},k$={class:"em-text-export__actions"},E$=Ge(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(c,d)=>Ct(t.locale??"ko",c,d),a=n.ref(0);function r(){return t.formats[a.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(r().content),oe.showNotification(i("em.export.copied"),"info")}catch{oe.showNotification(i("em.export.copyFailed"),"error")}}function s(){const c=r(),d=new Blob([c.content],{type:"text/plain;charset=utf-8"}),u=URL.createObjectURL(d);try{const m=document.createElement("a");m.href=u,m.download=c.filename,document.body.appendChild(m),m.click(),m.remove()}finally{URL.revokeObjectURL(u)}}return(c,d)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:t.title??i("em.export.title")},{default:n.withCtx(()=>[n.createElementVNode("div",y$,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",g$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.formats,(u,m)=>(n.openBlock(),n.createElementBlock("button",{key:u.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-export__tab",{"is-active":m===a.value}]),"aria-selected":m===a.value,onClick:f=>a.value=m},n.toDisplayString(u.label),11,b$))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",_$,n.toDisplayString(r().content),1),n.createElementVNode("div",k$,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.export.copy"),onClick:l},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{caption:i("em.export.download"),onClick:s},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:d[0]||(d[0]=u=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-f31001c1"]]),N$={class:"em-text-import"},w$={class:"em-text-import__formats",role:"tablist"},v$=["aria-selected","onClick"],x$=["placeholder"],I$={class:"em-text-import__status"},C$={class:"em-text-import__ok"},S$={key:0,class:"em-text-import__warn"},$$={key:1,class:"em-text-import__err"},R$={key:2,class:"em-text-import__err"},A$={key:3,class:"em-text-import__err"},T$={class:"em-text-import__actions"},V$=Ge(n.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(f,p)=>Ct(t.locale??"ko",f,p),a=n.ref(""),r=n.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"}];function s(f){return f?f.startsWith("{")?"json":/\berdiagram\b/i.test(f)?"mermaid":/\bcreate\s+table\b/i.test(f)?"ddl":null:null}const c=n.computed(()=>r.value==="auto"?s(a.value.trim()):r.value),d=n.computed(()=>{const f=a.value.trim();if(!f)return{status:"empty"};const p=c.value;if(!p)return{status:"unknown"};try{let y,g=[];return p==="json"?y=as(f):p==="mermaid"?y=Kl(f):(y=Xl(f),g=Wa(f).warnings),y.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:y,warnings:g}}catch(y){return{status:"error",message:y instanceof Error?y.message:String(y)}}}),u=n.computed(()=>d.value.status==="ok");function m(){const f=d.value;f.status!=="ok"||!f.source||(t.onImport(f.source),o.close())}return(f,p)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.import.title")},{default:n.withCtx(()=>[n.createElementVNode("div",N$,[n.createElementVNode("div",w$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(l,y=>n.createElementVNode("button",{key:y.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-import__fmt",{"is-active":y.key===r.value}]),"aria-selected":y.key===r.value,onClick:g=>r.value=y.key},n.toDisplayString(i(y.labelKey)),11,v$)),64))]),n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":p[0]||(p[0]=y=>a.value=y),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,x$),[[n.vModelText,a.value]]),n.createElementVNode("div",I$,[d.value.status==="ok"&&d.value.source?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("span",C$,n.toDisplayString(i("em.import.detected",{format:i(`em.import.format${c.value==="json"?"Json":c.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+n.toDisplayString(i("em.import.summary",{entities:d.value.source.logical.entities.length,relations:d.value.source.logical.associations.length})),1),d.value.warnings&&d.value.warnings.length?(n.openBlock(),n.createElementBlock("span",S$," ⚠ "+n.toDisplayString(i("em.import.warnings",{n:d.value.warnings.length})),1)):n.createCommentVNode("",!0)],64)):d.value.status==="error"?(n.openBlock(),n.createElementBlock("span",$$,n.toDisplayString(i("em.import.error",{message:d.value.message??""})),1)):d.value.status==="unknown"?(n.openBlock(),n.createElementBlock("span",R$,n.toDisplayString(i("em.import.unknownFormat")),1)):d.value.status==="emptyParse"?(n.openBlock(),n.createElementBlock("span",A$,n.toDisplayString(i("em.import.emptyParse")),1)):n.createCommentVNode("",!0)]),n.createElementVNode("div",T$,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.import.confirm"),disabled:!u.value,onClick:m},null,8,["caption","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[1]||(p[1]=y=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-43a94e55"]]),M$={class:"em-toolbar"},B$={class:"em-toolbar__mode"},uf=Ge(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,r=oe.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=n.computed({get:()=>i.displayMode.value,set:y=>i.displayMode.value=y});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const y=i.resolved.value.entities;return y.length>0&&y.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=i.state.logical;r.openModal({component:E$,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Ul(y),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Ka(y,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Ka(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:ns(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:is(y,i.state.layout),filename:"diagram.json"}]}})}function f(){r.openModal({component:V$,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(g=>g.modelId))}}})}function p(){r.openModal({component:sf,bind:{locale:i.uiLocale.value}})}return(y,g)=>(n.openBlock(),n.createElementBlock("div",M$,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.undo"),disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:g[0]||(g[0]=_=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.redo"),disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:g[1]||(g[1]=_=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",B$,[n.createTextVNode(n.toDisplayString(n.unref(i).t("em.toolbar.displayLabel"))+" ",1),n.createVNode(n.unref(oe.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=_=>s.value=_),items:l,"value-provider":_=>_.v,"label-provider":_=>n.unref(i).t(_.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(i).t(n.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:n.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:n.unref(i).t("em.toolbar.grid"),tooltip:n.unref(i).t(n.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=_=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:n.unref(i).t("em.toolbar.minimap"),tooltip:n.unref(i).t(n.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=_=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.import"),disabled:!n.unref(i).editable.value,onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportText"),onClick:m},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1},8,["tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=_=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1},8,["tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=_=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[g[8]||(g[8]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:n.unref(i).t("em.toolbar.history"),tooltip:n.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=_=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","caption","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:n.unref(i).t("em.toolbar.shortcuts"),onClick:p},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-38de55b4"]]),D$=["title"],O$=["title"],L$=["disabled","aria-pressed"],P$=["disabled","aria-pressed"],z$=Ge(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=l=>Ct(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[n.createVNode(Ve,{name:"lock",size:14}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.frozen")),1)],8,D$)):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[n.createVNode(Ve,{name:"eye",size:13}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.view")),1)],10,L$),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[n.createVNode(Ve,{name:"pencil",size:13}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.edit")),1)],10,P$)],10,O$))}}),[["__scopeId","data-v-2b5162b7"]]),U$=["disabled"],F$={class:"em-panel__sub"},H$={class:"em-nav"},G$={key:0,class:"em-nav__divider","aria-hidden":"true"},j$={key:1},K$=["onClick","onKeydown"],Y$={class:"em-nav__name"},W$=["title"],q$={key:0,class:"em-panel__note"},X$=["data-attr-block"],J$={class:"em-attr__row"},Z$=["title"],Q$={key:0,class:"em-attr__row"},eR={class:"em-attr__row"},tR={class:"em-attr__row"},nR={class:"em-attr__flags"},oR={class:"em-attr__pii"},iR={class:"em-attr__pii"},aR={class:"em-attr__pii"},rR={key:0,class:"em-attr__pii em-attr__codetop"},lR={class:"em-multilang"},sR={key:2,class:"em-embed-cols"},cR={class:"em-embed-col__label"},dR={class:"em-attr__row"},uR={class:"em-attr__row"},mR={key:0,class:"em-embed-upd"},fR={class:"em-embed-upd"},pR={class:"em-embed-upd"},hR={class:"em-swatch__row em-attr__swatch"},yR=["title","onClick"],gR=["title","onClick"],bR={key:0,class:"em-attr__swatch-hint"},Oa="__OWN__",_R=Ge(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find($=>$.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find($=>$.entityRef===i.value.modelId)??null:null),r=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes.filter(Z=>Z.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes)??[]}),d=n.computed(()=>s.value.filter($=>l.value.has($.modelId)));function u($){return{pk:$.identifier,fk:$.attrType.startsWith("RELATION")&&$.dbAttrs.length>0,required:$.notNull&&!$.identifier}}function m($){return!!i.value&&!!Ri(o.state.logical,i.value.modelId,$.modelId)}function f($){const Z=u($),F=[Z.pk&&"PK",Z.fk&&"FK",Z.required&&"NOT NULL"].filter(Boolean);return F.length?F.join(" · "):void 0}function p($,Z){i.value&&o.selectAttribute(i.value.modelId,$.modelId,Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace")}const y=["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 g($){return $==="none"?o.t("em.common.noneParen"):$}const _=$=>$;function b($){var Z,F;return ut((F=(Z=a.value)==null?void 0:Z.attributeStyles)==null?void 0:F[$.modelId])}function N($){return l.value.size>1&&l.value.has($.modelId)}function h($,Z){if(!i.value)return;const F=N($)?o.selectedAttrIds.value:[$.modelId];o.setAttributeSwatches(i.value.modelId,F,Z)}function k($,Z){i.value&&o.updateAttribute(i.value.modelId,$.modelId,Z)}function P($,Z){k($,{naturalId:Z||void 0,naturalIdMutable:Z?$.naturalIdMutable:void 0})}function A(){return{naturalId:void 0,naturalIdMutable:void 0}}function G($,Z){k($,{identifier:Z,...Z?A():{}})}function K($,Z){k($,{transient:Z||void 0,...Z?A():{}})}function v($){return!!$.transient}const T=$=>$.value,H=$=>$.label;function C($,Z){if(!Z)return;const F=O.value.find(Ie=>Ie.type===Z);if(F){const Ie=$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"};k($,{type:Z,customType:void 0,dbAttrs:[{...Ie,dataType:F.dataType,length:F.length,scale:F.scale}]});return}k($,Z===Rt?{type:Z}:{type:Z,customType:void 0})}function ae($,Z){k($,{customType:Z.trim()===""?void 0:Z})}function E($,Z){const Ie={...$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"},...Z};Z.dataType!==void 0&&!_o.has(Ie.dataType)&&(Ie.scale=void 0),k($,{dbAttrs:[Ie]})}function Y($){var Z;return _o.has(((Z=$.dbAttrs[0])==null?void 0:Z.dataType)??"")}function S($,Z){E($,{logicalName:Object.keys(Z).length?Z:void 0})}function W($,Z){k($,{description:Object.keys(Z).length?Z:void 0})}function ee($){return $.personalInfoAttributeType??"none"}function ie($,Z){k($,{personalInfoAttributeType:Z==="none"?void 0:Z})}const O=n.computed(()=>o.predefinedCustomTypeCatalog.value),U=n.computed(()=>o.embeddableCatalog.value),ne=n.ref(void 0);function ce($){var Z,F;return((Z=$.label)==null?void 0:Z.ko)??((F=$.label)==null?void 0:F.en)??$.type}function ge($){if(!$||!i.value)return;const Z=o.addPredefinedEmbed(i.value.modelId,$);Z&&o.selectAttribute(i.value.modelId,Z),ne.value=void 0}function se(){if(!i.value)return;const $=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,$)}const pe=n.computed(()=>o.groupCodeCatalog.value);function be($){var Z;return((Z=pe.value.find(F=>F.groupCode===$.groupCode))==null?void 0:Z.codes)??[]}function xe($){return["none",...be($)]}function Te($){return $==="none"?"none":$.code}function Ae($){var F,Ie;if($==="none")return o.t("em.common.noneParen");const Z=((F=$.label)==null?void 0:F.ko)??((Ie=$.label)==null?void 0:Ie.en);return Z?`${$.code} (${Z})`:$.code}function fe($,Z){i.value&&o.setAttributeGroupCode(i.value.modelId,$.modelId,Z)}function ke($,Z){k($,{defaultValue:Z==="none"?void 0:Z})}function we($,Z){k($,{defaultValue:Z.trim()===""?void 0:Z})}function j($){return $.attrType.startsWith("EMBED")&&$.dbAttrs.length>0}function L($,Z,F){const Ie=$.dbAttrs.map((ye,ze)=>{if(ze!==Z)return ye;const z={...ye,...F};for(const q of Object.keys(F))F[q]===void 0&&delete z[q];return z});i.value&&o.setEmbedColumns(i.value.modelId,$.modelId,Ie)}function x($,Z,F){L($,Z,{logicalName:Object.keys(F).length?F:void 0})}function R($,Z){var ye,ze,z;if($.attrType==="EMBED_PREDEF"){const q=(ye=o.embeddableCatalog.value.find(ue=>ue.type===$.type))==null?void 0:ye.fields[Z];return q?{name:q.name,physicalName:q.physicalName,dataType:q.dataType,length:q.length,shareable:q.shareable,logicalName:q.logicalName}:void 0}const F=(ze=$.embedded)==null?void 0:ze.embeddableRef;if(!F)return;const Ie=(z=o.state.logical.entities.find(q=>q.modelId===F))==null?void 0:z.attributes.flatMap(q=>q.dbAttrs)[Z];return Ie?{physicalName:Ie.physicalName,dataType:Ie.dataType,length:Ie.length,scale:Ie.scale,logicalName:Ie.logicalName}:void 0}function V($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.dataType)||((Ie=$.dbAttrs[Z])==null?void 0:Ie.dataType)||""}function Q($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.length)??((Ie=$.dbAttrs[Z])==null?void 0:Ie.length)}function me($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.scale)??((Ie=$.dbAttrs[Z])==null?void 0:Ie.scale)}const ve=["inherit","true","false"];function Ee($){return $==="inherit"?o.t("em.common.inherit"):$}function $e($){return($==null?void 0:$.updatable)===void 0?"inherit":$.updatable?"true":"false"}function Me($,Z,F){L($,Z,{updatable:F==="inherit"?void 0:F==="true"})}function Ue($,Z){E($,{updatable:Z==="inherit"?void 0:Z==="true"})}const Ye=["inherit","true","false"];function Fe($){return $==="inherit"?o.t("em.common.inherit"):$}function gt($){return($==null?void 0:$.insertable)===void 0?"inherit":$.insertable?"true":"false"}function w($,Z,F){L($,Z,{insertable:F==="inherit"?void 0:F==="true"})}function M($,Z){E($,{insertable:Z==="inherit"?void 0:Z==="true"})}const I=n.computed(()=>i.value?ui(i.value,o.state.logical.entities):[]),D=n.computed(()=>mn(I.value.flatMap($=>$.attributes.flatMap(Z=>Z.dbAttrs)))),B=n.computed(()=>I.value.flatMap($=>$.attributes.filter(Z=>Z.attrType==="NORMAL"&&Z.dbAttrs.length===1&&Z.dbAttrs[0]).map(Z=>{var F;return{modelId:Z.dbAttrs[0].modelId,physical:Z.dbAttrs[0].physicalName||Z.name,isCurrency:Z.type==="Currency",ownerName:$.modelId===((F=i.value)==null?void 0:F.modelId)?void 0:$.name}})));function de(){const $=[...B.value].sort((Z,F)=>Number(F.isCurrency)-Number(Z.isCurrency));return[Oa,...$.map(Z=>Z.modelId)]}function J($){if($===Oa)return o.t("em.attr.sharedOwn");const Z=B.value.find(Ie=>Ie.modelId===$);if(!Z)return $;const F=Z.ownerName?`${Z.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:F,physical:Z.physical,mode:Z.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function X($){return($==null?void 0:$.sharedColumnRef)??Oa}function te($,Z,F){L($,Z,{sharedColumnRef:F===Oa?void 0:F})}function re($){return($==null?void 0:$.sharedColumnRef)!=null}function Ne($){var Z;return((Z=zn($,D.value))==null?void 0:Z.physicalName)??""}return($,Z)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",F$,[n.createTextVNode(n.toDisplayString(n.unref(o).t("em.attr.section",{n:s.value.length}))+" ",1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:se},null,8,["caption"]),U.value.length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"120px",placeholder:n.unref(o).t("em.attr.addEmbeddable"),"model-value":ne.value,items:U.value,"value-provider":F=>F.type,"label-provider":ce,"onUpdate:modelValue":ge},null,8,["placeholder","model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",H$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,F=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:F.modelId},[F.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",G$,[...Z[0]||(Z[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",j$,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":l.value.has(F.modelId)}]),role:"button",tabindex:"0",onClick:Ie=>p(F,Ie),onKeydown:[n.withKeys(n.withModifiers(Ie=>p(F,Ie),["prevent"]),["enter"]),n.withKeys(n.withModifiers(Ie=>p(F,Ie),["prevent"]),["space"])]},[n.createElementVNode("span",Y$,n.toDisplayString(F.name||n.unref(o).t("em.attr.nameless")),1),n.createElementVNode("span",{class:"em-nav__marks",title:f(F)},[u(F).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(F).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(F).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,W$)],42,K$)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",q$,n.toDisplayString(n.unref(o).t("em.attr.selectHint")),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,F=>{var Ie,ye,ze,z,q,ue,Ce,Be,Oe,he;return n.openBlock(),n.createElementBlock("div",{key:F.modelId,class:n.normalizeClass(["em-attr",{"is-focused":l.value.has(F.modelId)}]),"data-attr-block":F.modelId},[n.createElementVNode("div",J$,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-name-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":F.name,"onUpdate:modelValue":le=>k(F,{name:le})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{name:`attr-type-${F.modelId}`,width:"84px",placeholder:n.unref(o).t("em.attr.typePlaceholder"),disabled:F.attrType.startsWith("EMBED")||!!F.groupCode,items:n.unref(Ql)(F.type,O.value),"value-provider":T,"label-provider":H,"model-value":F.type,"onUpdate:modelValue":le=>C(F,le)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:m(F)?n.unref(o).t("em.attr.fkDeleteHint"):void 0},[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:le=>n.unref(o).removeAttribute(i.value.modelId,F.modelId)},null,8,["onClick"])],8,Z$)]),F.type===n.unref(Rt)?(n.openBlock(),n.createElementBlock("div",Q$,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-customtype-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.customTypePlaceholder"),"model-value":F.customType??"","onUpdate:modelValue":le=>ae(F,le)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),j(F)?(n.openBlock(),n.createElementBlock("div",sR,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.dbAttrs,(le,Pe)=>{var Ke,st,Ze,pt,nt,at;return n.openBlock(),n.createElementBlock("div",{key:le.modelId,class:"em-embed-col"},[n.createElementVNode("span",cR,n.toDisplayString(((Ke=R(F,Pe))==null?void 0:Ke.name)??((st=R(F,Pe))==null?void 0:st.physicalName)??n.unref(o).t("em.attr.colFallback",{n:Pe+1})),1),n.createElementVNode("div",dR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`embed-col-${le.modelId}`,width:"100%",disabled:re(le),placeholder:((Ze=R(F,Pe))==null?void 0:Ze.physicalName)??n.unref(o).t("em.attr.columnPlaceholder"),"model-value":re(le)?Ne(le):le.physicalName,"onUpdate:modelValue":ct=>L(F,Pe,{physicalName:ct})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSTextInput),{name:`embed-dtype-${le.modelId}`,width:"84px",disabled:"","model-value":V(F,Pe)},null,8,["name","model-value"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`embed-len-${le.modelId}`,width:"48px",disabled:"","model-value":Q(F,Pe)},null,8,["name","model-value"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`embed-scale-${le.modelId}`,width:"48px",disabled:"","model-value":me(F,Pe)},null,8,["name","model-value"])]),n.createVNode($n,{controller:n.unref(o),"ref-id":le.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",uR,[n.createVNode(Rn,{class:"grow",name:`embed-logical-${le.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:((nt=(pt=R(F,Pe))==null?void 0:pt.logicalName)==null?void 0:nt.ko)??n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":le.logicalName,"onUpdate:modelValue":ct=>x(F,Pe,ct)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(at=R(F,Pe))!=null&&at.shareable?(n.openBlock(),n.createElementBlock("label",mR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.currencyColumn")),1),n.createVNode(n.unref(oe.BSSelect),{width:"110px","model-value":X(le),items:de(),"value-provider":_,"label-provider":J,"onUpdate:modelValue":ct=>ct&&te(F,Pe,ct)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",fR,[Z[3]||(Z[3]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:re(le),"model-value":re(le)?"false":gt(le),items:Ye,"value-provider":_,"label-provider":Fe,"onUpdate:modelValue":ct=>ct&&w(F,Pe,ct)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",pR,[Z[4]||(Z[4]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:re(le),"model-value":re(le)?"false":$e(le),items:ve,"value-provider":_,"label-provider":Ee,"onUpdate:modelValue":ct=>ct&&Me(F,Pe,ct)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",eR,[n.createVNode(Rn,{class:"grow",name:`attr-logical-${F.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Ie=F.dbAttrs[0])==null?void 0:Ie.logicalName,"onUpdate:modelValue":le=>S(F,le)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",tR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-col-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.columnPlaceholder"),disabled:v(F),"model-value":((ye=F.dbAttrs[0])==null?void 0:ye.physicalName)??"","onUpdate:modelValue":le=>E(F,{physicalName:le})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{name:`attr-dtype-${F.modelId}`,width:"84px",placeholder:"dataType",disabled:v(F),items:n.unref(Jl)(((ze=F.dbAttrs[0])==null?void 0:ze.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":_,"label-provider":n.unref(qa),"model-value":((z=F.dbAttrs[0])==null?void 0:z.dataType)??"","onUpdate:modelValue":le=>le&&E(F,{dataType:le})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`attr-len-${F.modelId}`,width:"48px",placeholder:"len",disabled:v(F),"model-value":(q=F.dbAttrs[0])==null?void 0:q.length,"onUpdate:modelValue":le=>E(F,{length:le||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`attr-scale-${F.modelId}`,width:"48px",placeholder:"scale",disabled:v(F)||!Y(F),"model-value":(ue=F.dbAttrs[0])==null?void 0:ue.scale,"onUpdate:modelValue":le=>E(F,{scale:le||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode($n,{controller:n.unref(o),"ref-id":(Ce=F.dbAttrs[0])==null?void 0:Ce.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",nR,[n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-pk-${F.modelId}`,label:"Primary Key","model-value":F.identifier,disabled:r.value||v(F),"onUpdate:modelValue":le=>G(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-nn-${F.modelId}`,label:"Not Null","model-value":F.notNull,disabled:v(F),"onUpdate:modelValue":le=>k(F,{notNull:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-uq-${F.modelId}`,label:"Unique","model-value":!!((Be=F.dbAttrs[0])!=null&&Be.unique),disabled:v(F),"onUpdate:modelValue":le=>E(F,{unique:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-ai-${F.modelId}`,label:"Auto Increment","model-value":!!((Oe=F.dbAttrs[0])!=null&&Oe.autoIncrement),disabled:v(F)||!F.identifier,"onUpdate:modelValue":le=>E(F,{autoIncrement:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-tr-${F.modelId}`,label:"@Transient","model-value":!!F.transient,disabled:F.identifier,"onUpdate:modelValue":le=>K(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-nid-${F.modelId}`,label:"@NaturalId","model-value":!!F.naturalId,disabled:F.identifier||v(F),"onUpdate:modelValue":le=>P(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${F.modelId}`,label:"mutable","model-value":!!F.naturalIdMutable,disabled:v(F)||!F.naturalId,"onUpdate:modelValue":le=>k(F,{naturalIdMutable:le||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-mv-${F.modelId}`,label:"Multi-Value (Set)","model-value":!!((he=F.dbAttrs[0])!=null&&he.multiValue),disabled:v(F),"onUpdate:modelValue":le=>E(F,{multiValue:le||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",oR,[Z[1]||(Z[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"100%",disabled:v(F),"model-value":gt(F.dbAttrs[0]),items:Ye,"value-provider":_,"label-provider":Fe,"onUpdate:modelValue":le=>le&&M(F,le)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",iR,[Z[2]||(Z[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"100%",disabled:v(F),"model-value":$e(F.dbAttrs[0]),items:ve,"value-provider":_,"label-provider":Ee,"onUpdate:modelValue":le=>le&&Ue(F,le)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",aR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":ee(F),items:y,"value-provider":_,"label-provider":g,"onUpdate:modelValue":le=>le&&ie(F,le)},null,8,["model-value","onUpdate:modelValue"])]),pe.value.length?(n.openBlock(),n.createElementBlock("label",rR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.codeGroup")),1),n.createVNode(Uu,{"model-value":F.groupCode,items:pe.value,locale:n.unref(o).uiLocale.value,"onUpdate:modelValue":le=>fe(F,le)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!pe.value.length}])},[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.defaultValue")),1),be(F).length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"100%","model-value":F.defaultValue??"none",items:xe(F),"value-provider":Te,"label-provider":Ae,"onUpdate:modelValue":le=>le&&ke(F,le)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:1,name:`attr-default-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.defaultValue"),"model-value":F.defaultValue??"","onUpdate:modelValue":le=>we(F,le)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",lR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:`attr-desc-${F.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":F.description,"onUpdate:modelValue":le=>W(F,le)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",hR,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(F)===null}]),title:n.unref(o).t("em.swatch.none"),onClick:le=>h(F,null)},"∅",10,yR),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),le=>(n.openBlock(),n.createElementBlock("button",{key:le,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(F)===le}]),style:n.normalizeStyle({background:n.unref(ao)(le)}),title:n.unref(io)(le),onClick:Pe=>h(F,le)},null,14,gR))),128)),N(F)?(n.openBlock(),n.createElementBlock("span",bR,n.toDisplayString(n.unref(o).t("em.attr.batchHint",{n:l.value.size})),1)):n.createCommentVNode("",!0)])],10,X$)}),128))],8,U$)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-7fd67ee7"]]),kR=["disabled"],ER={class:"em-panel__sub-label"},NR={class:"em-attr__row"},wR={class:"em-field em-idx-params"},vR=["value","placeholder","onChange"],xR=Ge(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.state.logical.entities.find(g=>g.modelId===o.entityId)??null),l=n.computed(()=>r.value?go(r.value,a.superClassCatalog.value):[]),s=n.computed(()=>{var g;return[...(((g=r.value)==null?void 0:g.attributes)??[]).map(_=>({value:_.modelId,label:_.name})),...l.value.map(_=>({value:_.modelId,label:a.t("em.index.inherited",{field:_.field})}))]});function c(){var _;if(!r.value)return;const g=r.value.attributes[0];a.addIndex(r.value.modelId,{modelId:De(),name:`idx_${(((_=r.value.indexes)==null?void 0:_.length)??0)+1}`,unique:!1,columns:g?[{columnRef:g.modelId,descending:!1}]:[]})}function d(g,_){r.value&&a.updateIndex(r.value.modelId,g,_)}function u(g){var b;const _=(b=r.value)==null?void 0:b.attributes[0];_&&d(g.modelId,{columns:[...g.columns,{columnRef:_.modelId,descending:!1}]})}function m(g,_,b){d(g.modelId,{columns:g.columns.map((N,h)=>h===_?{...N,columnRef:b}:N)})}function f(g,_,b){d(g.modelId,{columns:g.columns.map((N,h)=>h===_?{...N,descending:b}:N)})}function p(g,_){d(g.modelId,{columns:g.columns.filter((b,N)=>N!==_)})}function y(g,_){d(g.modelId,{parameters:_.trim()===""?void 0:_})}return(g,_)=>{var b;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:_[0]||(_[0]=N=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",ER,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.index.section",{n:((b=r.value.indexes)==null?void 0:b.length)??0})),1)]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.common.add"),onClick:n.withModifiers(c,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.indexes??[],N=>(n.openBlock(),n.createElementBlock("div",{key:N.modelId,class:"em-attr"},[n.createElementVNode("div",NR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`idx-name-${N.modelId}`,width:"100%",placeholder:n.unref(a).t("em.index.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":h=>d(N.modelId,{name:h})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idx-uq-${N.modelId}`,class:"em-check",label:"UQ","model-value":N.unique,"onUpdate:modelValue":h=>d(N.modelId,{unique:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:h=>n.unref(a).removeIndex(r.value.modelId,N.modelId)},null,8,["onClick"])]),n.createVNode($n,{controller:n.unref(a),"ref-id":N.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.columns,(h,k)=>(n.openBlock(),n.createElementBlock("div",{key:k,class:"em-attr__row"},[n.createVNode(n.unref(oe.BSSelect),{class:"grow","model-value":h.columnRef,items:s.value,"value-provider":P=>P.value,"label-provider":P=>P.label,"onUpdate:modelValue":P=>P&&m(N,k,P)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idx-${N.modelId}-desc-${k}`,class:"em-check",label:"DESC","model-value":h.descending,"onUpdate:modelValue":P=>f(N,k,P)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:"−",onClick:P=>p(N,k)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.index.addColumn"),onClick:h=>u(N)},null,8,["caption","onClick"]),n.createElementVNode("label",wR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.index.condition")),1),n.createElementVNode("textarea",{class:"em-textarea",value:N.parameters??"",rows:"2",placeholder:n.unref(a).t("em.index.conditionPlaceholder"),onChange:h=>y(N,h.target.value)},null,40,vR)])]))),128)):n.createCommentVNode("",!0)],8,kR)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-d883aded"]]),IR=["disabled"],CR={class:"em-panel__sub-label"},SR={class:"em-attr__row"},$R={class:"em-attr__row"},RR={class:"em-multilang"},AR={class:"em-attr__pii"},TR={class:"em-swatch__row em-attr__swatch"},VR=["title","onClick"],MR=["title","onClick"],BR=Ge(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=oe.useModal(),l=n.computed(()=>a.state.logical.entities.find(h=>h.modelId===o.entityId)??null),s=n.computed(()=>l.value?a.state.layout.entityLayouts.find(h=>h.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(h){return h==="none"?a.t("em.common.noneParen"):h}const m=h=>h;function f(h,k){l.value&&a.updateOperation(l.value.modelId,h.modelId,k)}function p(h,k){f(h,{description:Object.keys(k).length?k:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function g(h,k){f(h,{personalInfoAttributeType:k==="none"?void 0:k})}function _(h){var k,P;return ut((P=(k=s.value)==null?void 0:k.operationStyles)==null?void 0:P[h.modelId])}function b(h,k){l.value&&a.setOperationSwatch(l.value.modelId,h.modelId,k)}function N(h){r.openModal({component:Fu,bind:{operationName:h.name,sourceCode:h.sourceCode??"",locale:a.uiLocale.value,onSave:k=>f(h,{sourceCode:k})}})}return(h,k)=>{var P;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:k[1]||(k[1]=A=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",CR,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.op.section",{n:((P=l.value.operations)==null?void 0:P.length)??0})),1)]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.common.add"),onClick:k[0]||(k[0]=n.withModifiers(A=>n.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.operations??[],A=>(n.openBlock(),n.createElementBlock("div",{key:A.modelId,class:"em-attr"},[n.createElementVNode("div",SR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:n.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":G=>f(A,{name:G})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":G=>G&&f(A,{visibility:G})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:G=>n.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),n.createElementVNode("div",$R,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:G=>N(A)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",RR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:`op-desc-${A.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":G=>p(A,G)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",AR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":y(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":G=>G&&g(A,G)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",TR,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(A)===null}]),title:n.unref(a).t("em.swatch.none"),onClick:G=>b(A,null)},"∅",10,VR),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),G=>(n.openBlock(),n.createElementBlock("button",{key:G,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(A)===G}]),style:n.normalizeStyle({background:n.unref(ao)(G)}),title:n.unref(io)(G),onClick:K=>b(A,G)},null,14,MR))),128))])]))),128)):n.createCommentVNode("",!0)],8,IR)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-394829bc"]]),DR=["title"],OR={class:"em-panel__head"},LR={class:"em-panel__head-row"},PR=["title"],zR={class:"em-panel__context"},UR={key:0,class:"em-panel__lock"},FR=["disabled"],HR={key:0,class:"em-panel__note"},GR={key:1,class:"em-panel__note"},jR={key:2,class:"em-jpa"},KR={class:"em-field"},YR={class:"em-field"},WR={class:"em-field"},qR={key:0,class:"em-field"},XR={class:"em-panel__note"},JR={class:"em-panel__sub"},ZR={class:"em-field"},QR={class:"em-jpa"},eA={key:0,class:"em-panel__note"},tA={class:"em-jpa"},nA={class:"em-field"},oA={key:0,class:"em-panel__note"},iA={class:"em-field"},aA={class:"em-multilang"},rA={class:"em-field"},lA=["value"],sA={class:"em-field"},cA={class:"em-swatch"},dA={class:"em-swatch__row"},uA=["title"],mA=["title","onClick"],fA={class:"em-panel__note"},pA={class:"em-field"},hA=["value"],yA={class:"em-swatch"},gA={class:"em-swatch__row"},bA=["title"],_A=["title","onClick"],mf=Ge(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.selection.value),l=n.computed(()=>a.inspectedEntityId.value),s=n.computed(()=>{const x=l.value;return x?a.state.logical.entities.find(R=>R.modelId===x)??null:null}),c=n.computed(()=>{const x=r.value;if((x==null?void 0:x.kind)==="association"){const V=a.state.logical.associations.find(Q=>Q.modelId===x.id);return!!V&&(a.isEntityLocked(V.end1.entityRef)||a.isEntityLocked(V.end2.entityRef))}const R=l.value;return!!R&&a.isEntityLocked(R)}),d=n.computed(()=>{var x;return((x=a.selectedAttr.value)==null?void 0:x.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),m=n.computed(()=>d.value!==null),f=n.ref({});n.watch(m,()=>{f.value={}});function p(x){return f.value[x]??m.value}function y(x){f.value={...f.value,[x]:!p(x)}}const g=n.computed(()=>{var V;const x=s.value;if(!x)return a.t("em.entity.fallback");const R=(V=x.table)==null?void 0:V.physicalName;return R?`${x.name} (${R})`:x.name}),_=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="association"?a.state.logical.associations.find(R=>R.modelId===x.id)??null:null}),b=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="group"?a.state.logical.groups.find(R=>R.modelId===x.id)??null:null}),N=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="note"?a.state.layout.notes.find(R=>R.modelId===x.id)??null:null}),h=n.computed(()=>{var R,V;const x=(R=b.value)==null?void 0:R.name;return(x==null?void 0:x.ko)||(x==null?void 0:x.en)||(x==null?void 0:x.ja)||(x==null?void 0:x.zh)||((V=b.value)==null?void 0:V.packageName)||a.t("em.group.fallback")}),k=n.computed(()=>{if(s.value){const x=u.value.size;if(x>1)return a.t("em.inspector.ctxEntityAttrs",{name:s.value.name,n:x});if(d.value){const R=s.value.attributes.find(V=>V.modelId===d.value);return(R==null?void 0:R.attrType)==="DIVIDER"?a.t("em.inspector.ctxEntityDivider",{name:s.value.name}):a.t("em.inspector.ctxEntityAttr",{name:s.value.name,attr:(R==null?void 0:R.name)??""})}return a.t("em.inspector.ctxEntity",{name:s.value.name})}if(_.value){const x=R=>{var V;return((V=a.state.logical.entities.find(Q=>Q.modelId===R))==null?void 0:V.name)??R};return a.t("em.inspector.ctxAssoc",{a:x(_.value.end1.entityRef),b:x(_.value.end2.entityRef)})}return b.value?a.t("em.inspector.ctxGroup",{name:h.value}):N.value?a.t("em.inspector.ctxNote"):a.t("em.inspector.ctxNone")}),P=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],A=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],G={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},K=x=>{const R=G[x];return R?a.t(R):x},v=x=>{var R;return((R=a.state.logical.entities.find(V=>V.modelId===x))==null?void 0:R.name)??x},T=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],H=["LIST","SET"],C=["inherit","LAZY","EAGER"],ae=x=>x;function E(x){return x==="inherit"?a.t("em.common.inherit"):x}const Y=n.computed(()=>!!_.value&&_.value.end1.entityRef===_.value.end2.entityRef);function S(x,R){_.value&&a.updateAssociationEnd(_.value.modelId,x,R)}function W(x){_.value&&!Y.value&&a.setAssociationIdentifying(_.value.modelId,x)}function ee(x){var R,V,Q;return!!((Q=(V=(R=_.value)==null?void 0:R[x].jpa)==null?void 0:V.cascadeTypes)!=null&&Q.includes("ALL"))}function ie(x,R,V){var ve,Ee;const Q=(ve=_.value)==null?void 0:ve[x];if(R==="ALL"&&V){S(x,{jpa:{...Q==null?void 0:Q.jpa,cascadeTypes:["ALL"]}});return}const me=new Set(((Ee=Q==null?void 0:Q.jpa)==null?void 0:Ee.cascadeTypes)??[]);V?me.add(R):me.delete(R),S(x,{jpa:{...Q==null?void 0:Q.jpa,cascadeTypes:[...me]}})}function O(x,R){var Q;const V=(Q=_.value)==null?void 0:Q[x];S(x,{jpa:{...V==null?void 0:V.jpa,...R}})}function U(x){var R,V;return((V=(R=_.value)==null?void 0:R[x].jpa)==null?void 0:V.fetchType)??"inherit"}function ne(x,R){O(x,{fetchType:R==="inherit"?void 0:R})}function ce(x){var V;const R=(V=_.value)==null?void 0:V[x==="end1"?"end2":"end1"];return(R==null?void 0:R.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(R==null?void 0:R.multiplicity)==="ONE_OR_MORE_INSTANCES"}const ge=n.computed(()=>{const x=_.value;if(!x)return null;for(const R of a.state.logical.entities){const V=R.attributes.find(Ee=>{var $e;return(($e=Ee.embedded)==null?void 0:$e.associationRef)===x.modelId&&Ee.attrType==="EMBED_OWN"});if(!V)continue;const Q=x.end2.entityRef===V.embedded.embeddableRef?"end2":"end1",me=x[Q].multiplicity,ve=x[Q].jpa;return{which:Q,cardinality:me,isCollection:me==="ZERO_OR_MORE_INSTANCES"||me==="ONE_OR_MORE_INSTANCES",collectionType:(ve==null?void 0:ve.collectionType)??"LIST",collectionTable:(ve==null?void 0:ve.collectionTable)??"",orderColumn:(ve==null?void 0:ve.orderColumn)??""}}return null});function se(x){_.value&&a.setEmbedCardinality(_.value.modelId,x)}function pe(x){const R=ge.value;R&&O(R.which,x==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function be(x){const R=ge.value;R&&O(R.which,{collectionTable:x.trim()||void 0})}function xe(x){const R=ge.value;R&&O(R.which,{orderColumn:x.trim()||void 0})}function Te(x){b.value&&a.updateGroup(b.value.modelId,x)}function Ae(x,R){var V;Te({name:{...(V=b.value)==null?void 0:V.name,[x]:R}})}const fe=n.computed(()=>{var x;return b.value?ut((x=a.state.layout.groupLayouts.find(R=>R.groupRef===b.value.modelId))==null?void 0:x.style):null});function ke(x){b.value&&a.setGroupSwatch(b.value.modelId,x)}function we(x){N.value&&a.setNoteMemo(N.value.modelId,x)}const j=n.computed(()=>{var x;return ut((x=N.value)==null?void 0:x.style)});function L(x){N.value&&a.setNoteSwatch(N.value.modelId,x)}return(x,R)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:n.unref(a).t("em.panel.resizeWidth"),onPointerdown:R[0]||(R[0]=(...V)=>e.startResize&&e.startResize(...V))},null,42,DR),n.createElementVNode("header",OR,[n.createElementVNode("div",LR,[R[14]||(R[14]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:n.unref(a).t("em.panel.collapse"),onClick:R[1]||(R[1]=V=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})],8,PR)]),n.createElementVNode("p",zR,n.toDisplayString(k.value),1),c.value&&l.value?(n.openBlock(),n.createElementBlock("div",UR,[n.createVNode(Ve,{name:"lock",size:13}),n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.panel.lockedBanner")),1),n.unref(a).editable.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:R[2]||(R[2]=V=>n.unref(a).setEntityLocked(l.value,!1))},n.toDisplayString(n.unref(a).t("em.panel.unlock")),1)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value||c.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(Du,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:g.value,onToggle:R[3]||(R[3]=V=>y("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(_R,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(xR,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:R[4]||(R[4]=V=>y("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(BR,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:R[5]||(R[5]=V=>y("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(oe.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:n.unref(a).t("em.assoc.identifying"),"model-value":!!_.value.identifying,disabled:Y.value||!!ge.value,"onUpdate:modelValue":W},null,8,["label","model-value","disabled"]),Y.value?(n.openBlock(),n.createElementBlock("p",HR,n.toDisplayString(n.unref(a).t("em.assoc.selfNoIdentifying")),1)):ge.value?(n.openBlock(),n.createElementBlock("p",GR,n.toDisplayString(n.unref(a).t("em.assoc.embedNoIdentifying")),1)):n.createCommentVNode("",!0),ge.value?(n.openBlock(),n.createElementBlock("fieldset",jR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.embed.legend")),1),n.createElementVNode("label",KR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.embed.cardinality")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":ge.value.cardinality,items:A,"value-provider":ae,"label-provider":K,"onUpdate:modelValue":R[6]||(R[6]=V=>V&&se(V))},null,8,["model-value"])]),ge.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",YR,[R[15]||(R[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(oe.BSSelect),{"model-value":ge.value.collectionType,items:H,"value-provider":ae,"label-provider":ae,"onUpdate:modelValue":R[7]||(R[7]=V=>V&&pe(V))},null,8,["model-value"])]),n.createElementVNode("label",WR,[R[16]||(R[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:n.unref(a).t("em.embed.collectionTablePlaceholder"),"model-value":ge.value.collectionTable,"onUpdate:modelValue":be},null,8,["placeholder","model-value"])]),ge.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",qR,[R[17]||(R[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:n.unref(a).t("em.embed.orderColumnPlaceholder"),"model-value":ge.value.orderColumn,"onUpdate:modelValue":xe},null,8,["placeholder","model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),n.createElementVNode("p",XR,n.toDisplayString(n.unref(a).t("em.embed.ownerFixedNote")),1)])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],V=>{var Q,me,ve;return n.withDirectives(n.createElementVNode("div",{key:V,class:"em-end"},[n.createElementVNode("h4",JR,n.toDisplayString(V)+" → "+n.toDisplayString(v(_.value[V].entityRef)),1),ge.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",ZR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.assoc.multiplicity")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":_.value[V].multiplicity,items:P,"value-provider":ae,"label-provider":ae,"onUpdate:modelValue":Ee=>S(V,{multiplicity:Ee})},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-navigable`,class:"em-check",label:"navigable","model-value":_.value[V].navigable,"onUpdate:modelValue":Ee=>S(V,{navigable:Ee})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-composition`,class:"em-check",label:"composition","model-value":_.value[V].composition,"onUpdate:modelValue":Ee=>S(V,{composition:Ee})},null,8,["name","model-value","onUpdate:modelValue"])],64)),n.createElementVNode("fieldset",QR,[R[18]||(R[18]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(T,Ee=>{var $e,Me;return n.createVNode(n.unref(oe.BSCheckbox),{key:Ee,name:`${V}-cascade-${Ee}`,class:"em-check",label:Ee,"model-value":!!((Me=($e=_.value[V].jpa)==null?void 0:$e.cascadeTypes)!=null&&Me.includes(Ee)),disabled:Ee!=="ALL"&&ee(V),"onUpdate:modelValue":Ue=>ie(V,Ee,Ue)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ee(V)?(n.openBlock(),n.createElementBlock("p",eA,n.toDisplayString(n.unref(a).t("em.assoc.cascadeAllNote")),1)):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",tA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.assoc.jpaDetails")),1),n.createElementVNode("label",nA,[R[19]||(R[19]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(oe.BSSelect),{"model-value":U(V),items:C,"value-provider":ae,"label-provider":E,"onUpdate:modelValue":Ee=>Ee&&ne(V,Ee)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Q=_.value[V].jpa)!=null&&Q.orphanRemoval),disabled:ce(V),"onUpdate:modelValue":Ee=>O(V,{orphanRemoval:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ce(V)&&((me=_.value[V].jpa)!=null&&me.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",oA,n.toDisplayString(n.unref(a).t("em.assoc.orphanRemovalNote")),1)):n.createCommentVNode("",!0),n.createElementVNode("label",iA,[R[20]||(R[20]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:`${V}-orderby`,width:"100%",placeholder:n.unref(a).t("em.assoc.orderByPlaceholder"),"model-value":((ve=_.value[V].jpa)==null?void 0:ve.orderBy)??"","onUpdate:modelValue":Ee=>O(V,{orderBy:Ee.trim()||void 0})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])])]),[[n.vShow,!ge.value||V===ge.value.which]])}),64))],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",aA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.group.nameLegend")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,V=>{var Q;return n.openBlock(),n.createElementBlock("label",{key:V,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(V),1),n.createVNode(n.unref(oe.BSTextInput),{name:`grp-name-${V}`,width:"100%","model-value":((Q=b.value.name)==null?void 0:Q[V])??"","onUpdate:modelValue":me=>Ae(V,me)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",rA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createElementVNode("textarea",{class:"em-textarea",value:b.value.description??"",rows:"3",onChange:R[8]||(R[8]=V=>Te({description:V.target.value}))},null,40,lA)]),n.createElementVNode("label",sA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.package")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"grp-package",width:"100%","model-value":b.value.packageName??"","onUpdate:modelValue":R[9]||(R[9]=V=>Te({packageName:V}))},null,8,["model-value"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:n.unref(a).t("em.group.excludeDDL"),"model-value":b.value.excludeDDLGeneration,"onUpdate:modelValue":R[10]||(R[10]=V=>Te({excludeDDLGeneration:V}))},null,8,["label","model-value"]),n.createElementVNode("fieldset",cA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.color")),1),n.createElementVNode("div",dA,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":fe.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:R[11]||(R[11]=V=>ke(null))},"∅",10,uA),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":fe.value===V}]),style:n.normalizeStyle({background:n.unref(ao)(V)}),title:n.unref(io)(V),onClick:Q=>ke(V)},null,14,mA))),128))])]),n.createElementVNode("p",fA,n.toDisplayString(n.unref(a).t("em.group.members",{n:b.value.memberEntityRefs.length})),1)],64)):n.createCommentVNode("",!0),N.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",pA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.common.memo")),1),n.createElementVNode("textarea",{class:"em-textarea",value:N.value.memo,rows:"6",onChange:R[12]||(R[12]=V=>we(V.target.value))},null,40,hA)]),n.createElementVNode("fieldset",yA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.color")),1),n.createElementVNode("div",gA,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":j.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:R[13]||(R[13]=V=>L(null))},"∅",10,bA),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":j.value===V}]),style:n.normalizeStyle({background:n.unref(ao)(V)}),title:n.unref(io)(V),onClick:Q=>L(V)},null,14,_A))),128))])])],64)):n.createCommentVNode("",!0)],8,FR)],4))}}),[["__scopeId","data-v-4a891fbf"]]),kA=["title"],EA={class:"em-validation__title"},NA=["title","onClick"],wA={key:0,class:"em-validation__body"},vA={class:"em-validation__opt"},xA={key:0,class:"em-validation__empty"},IA={key:1,class:"em-validation__empty"},CA={key:2,class:"em-validation__list"},SA=["onClick"],$A={class:"em-validation__item-msg"},RA={key:0,class:"em-validation__item-entity"},AA=["title","onClick"],TA=["title"],VA=Ge(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const g=new Map;for(const _ of o.state.logical.entities)g.set(_.modelId,_.name);return g});function r(g){const _=wk(g);if(!_)return null;const b=a.value.get(_);return b===void 0?null:b.trim()===""?o.t("em.validation.nameless"):b}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=n.computed(()=>{const g={error:0,warning:0,info:0};for(const _ of i.value)g[_.severity]++;return g}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,_)=>l[g.severity].order-l[_.severity].order)),u=n.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:Bu(o.t,g),category:Ek(o.t,g.ruleId)}))),m=n.ref(!1);function f(g){c.value[g]=!c.value[g]}function p(g){if(!m.value){m.value=!0;return}f(g)}function y(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,_)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:_[1]||(_[1]=b=>m.value=!m.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:n.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),n.createElementVNode("span",EA,n.toDisplayString(n.unref(o).t("em.validation.title")),1)],8,kA),n.createElementVNode("div",{class:"em-validation__counts",onClick:_[0]||(_[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],b=>n.createElementVNode("button",{key:b,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!c.value[b]}]]),title:m.value?n.unref(o).t(c.value[b]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:n.unref(o).t(l[b].labelKey)}):n.unref(o).t("em.validation.expandPanel"),onClick:N=>p(b)},[n.createVNode(Ve,{name:l[b].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[b]),1)],10,NA)),64))])]),m.value?(n.openBlock(),n.createElementBlock("div",wA,[n.createElementVNode("label",vA,[n.createVNode(n.unref(oe.BSCheckbox),{name:"val-flag-norel",label:n.unref(o).t("em.validation.checkOrphanEntities"),"model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":_[2]||(_[2]=b=>n.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["label","model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",xA,n.toDisplayString(n.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(n.openBlock(),n.createElementBlock("p",IA,n.toDisplayString(n.unref(o).t("em.validation.noVisibleIssues")),1)):(n.openBlock(),n.createElementBlock("ul",CA,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:b,entityName:N,message:h,category:k},P)=>(n.openBlock(),n.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${P}`,class:n.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:A=>y(b)},[n.createVNode(Ve,{name:l[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",$A,[N?(n.openBlock(),n.createElementBlock("span",RA,n.toDisplayString(N),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(h),1)]),n.unref(o).hasQuickFix(b)?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:n.unref(o).t("em.validation.quickFixTip"),onClick:n.withModifiers(A=>n.unref(o).applyQuickFix(b),["stop"])},n.toDisplayString(n.unref(o).t("em.validation.quickFix")),9,AA)):n.createCommentVNode("",!0),n.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},n.toDisplayString(k),9,TA)],10,SA))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),MA={class:"em-history"},BA={class:"em-history__head"},DA={class:"em-history__title"},OA={class:"em-history__head-actions"},LA=["title","disabled"],PA=["title"],zA={class:"em-history__filters"},UA={class:"em-history__filter"},FA={class:"em-history__body"},HA={key:0,class:"em-history__empty"},GA={key:1,class:"em-history__empty is-error"},jA={key:2,class:"em-history__empty"},KA={key:3,class:"em-history__list"},YA=["onClick"],WA={class:"em-history__summary"},qA={class:"em-history__seq"},XA={class:"em-history__gmeta"},JA={class:"em-history__who"},ZA={key:0,class:"em-history__time"},QA={key:1,class:"em-history__restored-from"},eT={key:0,class:"em-history__detail"},tT={class:"em-history__action-head"},nT={class:"em-history__action-name"},oT={key:0,class:"em-history__fields"},iT={class:"em-history__fname"},aT={key:0,class:"em-history__old"},rT={class:"em-history__val"},lT={key:1,class:"em-history__restore"},sT={class:"em-history__confirm-msg"},cT=["disabled","onClick"],dT=["disabled"],uT=["onClick"],mT=Ge(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.ref([]),l=n.ref(!1),s=n.ref(null),c=n.ref(!1);async function d(){if(a.historyTransport){l.value=!0,s.value=null;try{r.value=await a.historyTransport(),c.value=!0}catch(O){s.value=O instanceof Error?O.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,O=>{O&&u()},{immediate:!0});let m=null;n.watch(()=>a.revision.value,()=>{o.open&&(m&&clearTimeout(m),m=setTimeout(()=>void u(),500))}),n.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const f=n.computed(()=>new Map(a.state.logical.entities.map(O=>[O.modelId,O]))),p=n.computed(()=>new Map(a.state.logical.associations.map(O=>[O.modelId,O]))),y=n.computed(()=>new Map((a.state.logical.groups??[]).map(O=>{var U;return[O.modelId,O.packageName||((U=O.name)==null?void 0:U.ko)||O.modelId]})));function g(O){var ge,se,pe,be,xe,Te,Ae;const U=p.value.get(O);if(!U)return a.t("em.history.assocFallback");if((ge=U.description)!=null&&ge.trim())return U.description.trim();const ne=(be=(pe=f.value.get((se=U.end1)==null?void 0:se.entityRef))==null?void 0:pe.name)==null?void 0:be.trim(),ce=(Ae=(Te=f.value.get((xe=U.end2)==null?void 0:xe.entityRef))==null?void 0:Te.name)==null?void 0:Ae.trim();return ne&&ce?`${ne}→${ce}`:a.t("em.history.assocFallback")}function _(O){var U,ne,ce,ge;if(O.kind==="entity")return((ne=(U=f.value.get(O.ref))==null?void 0:U.name)==null?void 0:ne.trim())||a.t("em.attr.nameless");if(O.kind==="attribute"||O.kind==="operation"||O.kind==="index"){const se=O.entityRef?f.value.get(O.entityRef):void 0,be=((O.kind==="attribute"?se==null?void 0:se.attributes:O.kind==="operation"?se==null?void 0:se.operations:se==null?void 0:se.indexes)??[]).find(Te=>Te.modelId===O.ref),xe=(ce=se==null?void 0:se.name)==null?void 0:ce.trim();return`${xe?xe+".":""}${((ge=be==null?void 0:be.name)==null?void 0:ge.trim())||O.ref}`}return O.kind==="association"?g(O.ref):O.kind==="associationEnd"?`${g(O.ref)}(${O.end})`:O.kind==="group"?a.t("em.history.groupSubject",{name:y.value.get(O.ref)??O.ref}):O.ref}const b={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},h=n.ref("all"),k=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],P=n.computed({get:()=>h.value,set:O=>{O&&(h.value=O)}}),A=n.computed(()=>vs(r.value)),G=n.computed(()=>A.value.length?A.value[0].seq:null),K=n.computed(()=>h.value==="all"?A.value:A.value.filter(O=>(O.kind??"edit")===h.value));function v(O){return O===void 0?"—":O===null?a.t("em.history.emptyValue"):typeof O=="object"?JSON.stringify(O):String(O)}function T(O){const U=_(O.subject);if(O.verb==="add")return a.t("em.history.summaryAdd",{name:U});if(O.verb==="remove")return a.t("em.history.summaryRemove",{name:U});if(O.fields.length===1){const ne=O.fields[0];return`${U}.${ne.field} ${ne.oldValue!==void 0?v(ne.oldValue)+"→":""}${v(ne.value)}`}return a.t("em.history.summaryFields",{name:U,n:O.fields.length})}function H(O){return O.actions.length===0?a.t("em.history.noChange"):O.actions.length===1?T(O.actions[0]):a.t("em.history.summaryMore",{summary:T(O.actions[0]),n:O.actions.length-1})}const C=n.ref(new Set);function ae(O){const U=new Set(C.value);U.has(O)?U.delete(O):U.add(O),C.value=U}function E(O){if(O==null)return"";const U=new Date(O);return isNaN(U.getTime())?String(O):U.toLocaleString()}function Y(O){const U=O.author,ne=O.origin;return U&&ne?`${U}(${ne})`:U||(ne?`(${ne})`:"—")}const S=n.ref(null),W=n.ref(!1);function ee(O){S.value=O}async function ie(O){W.value=!0;try{const U=await a.restoreToSeq(O);U.ok||(s.value=a.t("em.history.restoreFailed",{reason:U.reason??a.t("em.history.unknown")}))}finally{W.value=!1,S.value=null}}return(O,U)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",MA,[n.createElementVNode("header",BA,[n.createElementVNode("div",DA,[n.createVNode(Ve,{name:"undo",size:15}),n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.history.title")),1)]),n.createElementVNode("div",OA,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:n.unref(a).t("em.history.refresh"),disabled:l.value,onClick:U[0]||(U[0]=ne=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,LA),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:n.unref(a).t("em.common.close"),onClick:U[1]||(U[1]=ne=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})],8,PA)])]),n.createElementVNode("div",zA,[n.createElementVNode("label",UA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.toolbar.displayLabel")),1),n.createVNode(n.unref(oe.BSSelect),{modelValue:P.value,"onUpdate:modelValue":U[2]||(U[2]=ne=>P.value=ne),items:k,"value-provider":ne=>ne.v,"label-provider":ne=>n.unref(a).t(ne.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",FA,[l.value&&!c.value?(n.openBlock(),n.createElementBlock("p",HA,n.toDisplayString(n.unref(a).t("em.history.loading")),1)):s.value?(n.openBlock(),n.createElementBlock("p",GA,n.toDisplayString(s.value),1)):K.value.length===0?(n.openBlock(),n.createElementBlock("p",jA,n.toDisplayString(c.value?n.unref(a).t("em.history.emptyLoaded"):n.unref(a).t("em.history.emptyNotLoaded")),1)):(n.openBlock(),n.createElementBlock("ul",KA,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(K.value,ne=>(n.openBlock(),n.createElementBlock("li",{key:ne.seq,class:n.normalizeClass(["em-history__group",[`is-${ne.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:ce=>ae(ne.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":C.value.has(ne.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${ne.kind??"edit"}`])},n.toDisplayString(n.unref(a).t(ne.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),n.createElementVNode("span",WA,n.toDisplayString(H(ne)),1),n.createElementVNode("span",qA,"#"+n.toDisplayString(ne.seq),1)],8,YA),n.createElementVNode("div",XA,[n.createElementVNode("span",JA,n.toDisplayString(Y(ne)),1),ne.ts?(n.openBlock(),n.createElementBlock("span",ZA,n.toDisplayString(E(ne.ts)),1)):n.createCommentVNode("",!0),ne.kind==="restore"&&ne.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",QA,"← #"+n.toDisplayString(ne.restoredFromSeq),1)):n.createCommentVNode("",!0)]),C.value.has(ne.seq)?(n.openBlock(),n.createElementBlock("div",eT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.actions,(ce,ge)=>(n.openBlock(),n.createElementBlock("div",{key:ge,class:"em-history__action"},[n.createElementVNode("div",tT,[n.createVNode(Ve,{name:b[ce.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",nT,n.toDisplayString(_(ce.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${ce.verb}`])},n.toDisplayString(n.unref(a).t(N[ce.verb])),3)]),ce.fields.length?(n.openBlock(),n.createElementBlock("ul",oT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce.fields,(se,pe)=>(n.openBlock(),n.createElementBlock("li",{key:pe,class:"em-history__field"},[n.createElementVNode("span",iT,n.toDisplayString(se.field),1),se.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",aT,n.toDisplayString(v(se.oldValue)),1)):n.createCommentVNode("",!0),se.oldValue!==void 0?(n.openBlock(),n.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",rT,n.toDisplayString(v(se.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&ne.seq!==G.value?(n.openBlock(),n.createElementBlock("div",lT,[S.value===ne.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("span",sT,n.toDisplayString(n.unref(a).t("em.history.confirmRestore")),1),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:ce=>ie(ne.seq)},n.toDisplayString(n.unref(a).t("em.history.doRestore")),9,cT),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:U[3]||(U[3]=ce=>S.value=null)},n.toDisplayString(n.unref(a).t("em.history.cancel")),9,dT)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:ce=>ee(ne.seq)},[n.createVNode(Ve,{name:"undo",size:12}),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.history.restoreToHere")),1)],8,uT))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-45d29598"]]);function fT(e,t){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>=t?i:null}function ff(e){const t=n.ref(fT(e.storageKey,e.min)??e.initial),o=n.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=t.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)),t.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(t.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:t,dragging:o,startResize:i}}const pT={class:"em-modeler"},hT={class:"em-modeler__body"},yT={class:"em-drawer__inner"},gT={class:"em-drawer__head"},bT={class:"em-drawer__actions"},_T=["title"],kT=["title"],ET=["title"],NT=["title"],wT=["title"],vT=Ge(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(!0),i=n.ref(!1),{width:a,dragging:r,startResize:l}=ff({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=ff({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),m=n.ref(null);return(f,p)=>{var y,g,_;return n.openBlock(),n.createElementBlock("div",pT,[n.createVNode(uf,{controller:e.controller,"history-open":i.value,onExportSvg:p[0]||(p[0]=b=>{var N;return(N=u.value)==null?void 0:N.exportSvg()}),onExportPng:p[1]||(p[1]=b=>{var N;return(N=u.value)==null?void 0:N.exportPng()}),onToggleHistory:p[2]||(p[2]=b=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",hT,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",yT,[n.createElementVNode("header",gT,[p[10]||(p[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",bT,[(y=m.value)!=null&&y.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((g=m.value)!=null&&g.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:p[3]||(p[3]=b=>{var N;return(N=m.value)==null?void 0:N.toggleAll()})},[n.createVNode(Ve,{name:(_=m.value)!=null&&_.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,_T)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:p[4]||(p[4]=b=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})],8,kT)])]),n.createVNode(df,{ref_key:"explorer",ref:m,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(r)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:p[5]||(p[5]=(...b)=>n.unref(l)&&n.unref(l)(...b))},null,42,ET),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:p[6]||(p[6]=b=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],8,NT),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(r),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(cf,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(mf,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:p[7]||(p[7]=b=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:p[8]||(p[8]=b=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],8,wT),[[n.vShow,!o.value]])]),_:1}),n.createVNode(mT,{controller:e.controller,open:i.value,onClose:p[9]||(p[9]=b=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(VA,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-cce29135"]]);_e.APPLY_MODEL_OPS_INPUT_SCHEMA=Bh,_e.AssociationEdge=dm,_e.CUSTOM_TYPE_VALUE=Rt,_e.CommandStack=mr,_e.DEFAULT_JAVA_TYPE=Xa,_e.DIAGRAM_JSON_FORMAT=tr,_e.DIAGRAM_JSON_VERSION=nr,_e.DiagramCanvas=cf,_e.DiagramExplorer=df,_e.EDITOR=An,_e.EditModeToggle=z$,_e.EditorToolbar=uf,_e.EntityModeler=vT,_e.EntityNode=Wu,_e.GROUP_CODE_ENUM_VALUE=Ln,_e.GroupNode=qu,_e.INHERITED_REF_PREFIX=si,_e.InvalidDiagramJsonError=fn,_e.JAVA_TYPES=di,_e.NoteNode=Xu,_e.OpSyncAdapter=pc,_e.PHYSICAL_NAME_MAX_LENGTH=ko,_e.PropertyPanel=mf,_e.RevCache=fc,_e.SELECTABLE_JAVA_TYPES=Zl,_e.SYMBOLIC_OP_KINDS=hc,_e.SYMBOLIC_OP_SCHEMA=Ic,_e.UI_LOCALES=qk,_e.anchoredEdgePoint=Fa,_e.buildAgentBatch=Dh,_e.buildDiagramSvg=Rl,_e.buildOrthogonalPath=La,_e.buildSelfLoopPath=Bl,_e.buildStraightPath=za,_e.collectSharedColumns=un,_e.commands=nh,_e.computeAutoLayout=Dl,_e.createEditorController=ew,_e.defaultMermaidDialect=Rf,_e.defaultSqlDialect=np,_e.diagramToJson=is,_e.displayLabel=ci,_e.emptyState=Gu,_e.entityModelToDdl=ns,_e.entityModelToMermaid=Ka,_e.entityModelToText=Ul,_e.estimateEntityHeight=Ll,_e.exportDiagramPng=lf,_e.exportDiagramSvg=rf,_e.fromPersisted=Xh,_e.indexColumnsByModelId=mn,_e.isInheritedColumnRef=yo,_e.javaTypeLabel=Pn,_e.makeInheritedColumnRef=Pl,_e.mergeDiagram=_s,_e.mermaidErToImportSource=Kl,_e.migrateLegacyMoney=Dp,_e.newId=De,_e.orthogonalMidpoints=Pa,_e.packEntityBoxes=Ga,_e.parseDiagramJson=as,_e.parseInheritedColumnRef=ja,_e.parseMermaidEr=jl,_e.parseSqlDdl=Wa,_e.physicalNameLengthOverflow=mi,_e.projectActionLog=vs,_e.projectEntityAudit=Ns,_e.projectFieldAudit=Zt,_e.projectInheritedColumns=go,_e.rectExitPoint=Ua,_e.renderDiagramSvg=ls,_e.resolveColumnPhysicalName=fi,_e.resolveDiagram=Vl,_e.resolveQuickFix=ir,_e.resolveSharedColumn=zn,_e.resolveSymbolicOps=vh,_e.restoreDeepEqual=jn,_e.scaffoldEntityJava=pp,_e.segmentMidpoints=Ha,_e.sharedColumnScopeEntities=ui,_e.sideDir=ho,_e.sqlDdlToImportSource=Xl,_e.synthesizeRestoreOps=Yp,_e.toPersisted=dy,_e.toPersistedV2=uy,_e.translate=Ct,_e.uiMessagesEn=Ou,_e.uiMessagesJa=Lu,_e.uiMessagesKo=Pu,_e.validateModel=ts,Object.defineProperty(_e,Symbol.toStringTag,{value:"Module"})}));
|
|
60
|
+
v${-(H.value.height-2*e.maskBorderRadius)}
|
|
61
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(ee=>{if(g.value){const ae=ln(g.value),L=ue=>{if(ue.sourceEvent.type!=="wheel"||!f.value||!p.value)return;const Ne=ue.sourceEvent.ctrlKey&&Yo()?10:1,se=-ue.sourceEvent.deltaY*(ue.sourceEvent.deltaMode===1?.05:ue.sourceEvent.deltaMode?1:.002)*e.zoomStep,me=c.value.zoom*2**(se*Ne);p.value.scaleTo(f.value,me)},U=ue=>{if(ue.sourceEvent.type!=="mousemove"||!f.value||!p.value)return;const Ne=v.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),se={x:c.value.x-ue.sourceEvent.movementX*Ne,y:c.value.y-ue.sourceEvent.movementY*Ne},me=[[0,0],[u.value.width,u.value.height]],_e=Sl.translate(se.x,se.y).scale(c.value.zoom),Ie=p.value.constrain()(_e,me,d.value);p.value.transform(f.value,Ie)},ne=aS().wheelDelta(ue=>Gr(ue)*(e.zoomStep/10)).on("zoom",e.pannable?U:()=>{}).on("zoom.wheel",e.zoomable?L:()=>{});ae.call(ne),ee(()=>{ae.on("zoom",null)})}},{flush:"post"});function I(ee){const[ae,L]=sn(ee);n("click",{event:ee,position:{x:ae,y:L}})}function le(ee,ae){const L={event:ee,node:ae,connectedEdges:In([ae],s.value)};m.miniMapNodeClick(L),n("nodeClick",L)}function k(ee,ae){const L={event:ee,node:ae,connectedEdges:In([ae],s.value)};m.miniMapNodeDoubleClick(L),n("nodeDblclick",L)}function Y(ee,ae){const L={event:ee,node:ae,connectedEdges:In([ae],s.value)};m.miniMapNodeMouseEnter(L),n("nodeMouseenter",L)}function C(ee,ae){const L={event:ee,node:ae,connectedEdges:In([ae],s.value)};m.miniMapNodeMouseMove(L),n("nodeMousemove",L)}function W(ee,ae){const L={event:ee,node:ae,connectedEdges:In([ae],s.value)};m.miniMapNodeMouseLeave(L),n("nodeMouseleave",L)}return(ee,ae)=>(t.openBlock(),t.createBlock(t.unref(Du),{position:ee.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:ee.pannable,zoomable:ee.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:g,width:_.value,height:b.value,viewBox:[T.value.x,T.value.y,T.value.width,T.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:I},[ee.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(ee.ariaLabel),9,dS)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),L=>(t.openBlock(),t.createBlock(sS,{id:L.id,key:L.id,f:"",position:L.computedPosition,dimensions:L.dimensions,selected:L.selected,dragging:L.dragging,style:t.normalizeStyle(L.style),class:t.normalizeClass(D.value(L)),color:h.value(L),"border-radius":ee.nodeBorderRadius,"stroke-color":E.value(L),"stroke-width":ee.nodeStrokeWidth,"shape-rendering":t.unref(N),type:L.type,hidden:L.hidden,onClick:U=>le(U,L),onDblclick:U=>k(U,L),onMouseenter:U=>Y(U,L),onMousemove:U=>C(U,L),onMouseleave:U=>W(U,L)},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:F.value,fill:ee.maskColor,stroke:ee.maskStrokeColor,"stroke-width":ee.maskStrokeWidth,"fill-rule":"evenodd"},null,8,uS)],8,cS))]),_:1},8,["position","class"]))}}),pS=["d"],hS=["cx","cy","onDblclick"],yS=["x","y","onPointerdown","onDblclick"],gS=Ge(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=He(),i=t.inject(cl),a=t.inject(Tn,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(so,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((j,v)=>v===d.value?u.value:j)),{source:f,target:p,sourceSide:y,targetSide:g}=fm({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),_=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?La(f.value,y.value,m.value,p.value,g.value):za(f.value,m.value,p.value)),b=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Pa(f.value,y.value,m.value,p.value,g.value):Ha(f.value,m.value,p.value).map((j,v)=>({point:j,segIndex:v})):[]),N=t.computed(()=>r.value?m.value:[]);function h(j,v){d.value=j,u.value={...c.value[j]},v.target.setPointerCapture(v.pointerId),v.stopPropagation()}function E(j){if(d.value<0)return;const v=o({x:j.clientX,y:j.clientY});u.value={x:v.x,y:v.y}}function D(j){var v,T;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(T=(v=j.target).releasePointerCapture)==null||T.call(v,j.pointerId)}function $(j,v){v.stopPropagation(),i==null||i.removePoint(n.id,j)}function H(j,v){if(!i)return;const T=o({x:v.clientX,y:v.clientY});i.insertPoint(n.id,j,{x:T.x,y:T.y})}return(j,v)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:_.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,pS),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,(T,F)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${F}`,cx:T.point.x,cy:T.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(I=>H(T.segIndex,I),["stop"])},null,42,hS))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,(T,F)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${F}`,x:T.x-5,y:T.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:I=>h(F,I),onPointermove:E,onPointerup:D,onDblclick:I=>$(F,I)},null,42,yS))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),bS=["data-theme"],_S={key:0,class:"em-ctx__sep",role:"separator"},ES={key:1,class:"em-ctx__swatches"},kS={class:"em-ctx__swatches-label"},NS={class:"em-ctx__chips"},wS=["title","onClick"],vS=["title","onClick"],xS=["disabled","onClick"],IS={class:"em-ctx__icon"},CS={class:"em-ctx__caption"},SS=Ge(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(g,_)=>Ct(o.locale??"ko",g,_),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0}),d=8;async function u(g,_){var h;r.value=_,l.value=(h=g.target)!=null&&h.closest('[data-theme="dark"]')?"dark":void 0,c.x=g.clientX,c.y=g.clientY,a.value=!0,window.addEventListener("keydown",f),window.addEventListener("resize",m),await t.nextTick();const b=s.value;if(!b)return;const N=b.getBoundingClientRect();c.x+N.width>window.innerWidth-d&&(c.x=Math.max(d,window.innerWidth-d-N.width)),c.y+N.height>window.innerHeight-d&&(c.y=Math.max(d,window.innerHeight-d-N.height))}function m(){a.value&&(a.value=!1,r.value=[],window.removeEventListener("keydown",f),window.removeEventListener("resize",m))}function f(g){g.key==="Escape"&&(g.stopPropagation(),m())}function p(g){g.disabled||(g.handler(),m())}function y(g,_){g.onPick(_),m()}return t.onBeforeUnmount(m),n({open:u,close:m}),(g,_)=>(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:m,onContextmenu:t.withModifiers(m,["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:_[0]||(_[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(b,N)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:N},[b.type==="separator"?(t.openBlock(),t.createElementBlock("div",_S)):b.type==="swatches"?(t.openBlock(),t.createElementBlock("div",ES,[t.createElementVNode("span",kS,t.toDisplayString(b.caption),1),t.createElementVNode("div",NS,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:i("em.swatch.none"),onClick:h=>y(b,null)},null,10,wS),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref($n),h=>(t.openBlock(),t.createElementBlock("button",{key:h,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":b.current===h}]),style:t.normalizeStyle({background:t.unref(ao)(h)}),title:t.unref(io)(h),onClick:E=>y(b,h)},null,14,vS))),128))])])):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":b.danger,"is-disabled":b.disabled}]),disabled:b.disabled,role:"menuitem",onClick:h=>p(b)},[t.createElementVNode("span",IS,[b.icon?(t.openBlock(),t.createBlock(Me,{key:0,name:b.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",CS,t.toDisplayString(b.caption),1)],10,xS))],64))),128))],36)],8,bS)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-0b8cdb1f"]]),Rl=[".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 fo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function $S(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function RS(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const g=n(y.left,y.top+y.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,f=0;const p=()=>{const y=d.trim();if(y){const g=n(m,(u+f)/2);c.push({...i,x:g.x,y:g.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(p(),u=g.top,m=g.left,f=g.bottom,d=s[y]):(d+=s[y],f=Math.max(f,g.bottom))}return p(),c}function Da(e,n){const o=[];for(const i of e.querySelectorAll("*"))$S(i)&&(i.closest(Rl)||fo(i)&&o.push(...RS(i,n)));return o}function ai(e){return Math.round(e*100)/100}function AS(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Rl)||!fo(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="${ai(r.x)}" y="${ai(r.y)}" width="${ai(l.x-r.x)}" height="${ai(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 TS(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!fo(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=>ai(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 sf(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Rl)||!fo(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 ri(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 Al(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 VS(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(p,y)=>e.screenToFlowCoordinate({x:p,y}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const p of e.nodes.value){const y=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(p.id)}"]`);if(!y||!fo(y))continue;const g=y.firstElementChild;if(g)if(p.type==="group"){const _=ri(g,o);Al(s,_),i.push({..._,texts:[]});const b=g.querySelector(".em-group__label");b&&i.push({...ri(b,o),stroke:"none",texts:[]}),i.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Da(g,o)})}else if(p.type==="note"){const _={...ri(g,o),texts:Da(g,o),lines:sf(g,g,o)};Al(s,_),r.push(_)}else{const _=ri(g,o);Al(s,_);const b=_.radius??{tl:0,tr:0};a.push({..._,stroke:"none",texts:[]});const N=g.querySelector(".em-entity__header");if(N){const h=ri(N,o);a.push({x:_.x,y:_.y,w:_.w,h:h.y+h.h-_.y,fill:h.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}a.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Da(g,o),lines:sf(g,g,o),icons:AS(g,o)}),a.push({..._,fill:"none",texts:[]})}}for(const p of n.querySelectorAll(".vue-flow__edge")){const y=p.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!fo(y))continue;const g=y.getAttribute("d");if(!g)continue;const _=getComputedStyle(y),b=_.strokeDasharray,N=TS(p);l.push({d:g,stroke:_.stroke,strokeWidth:parseFloat(_.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:Da(p,o),markers:N.length?N:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Tl(e){return cs(VS(e))}function cf(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 df(e,n="diagram.svg"){const o=Tl(e);cf(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function MS(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 uf(e,n="diagram.png",o=2){const i=Tl(e),{w:a,h:r}=MS(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,f)=>{s.onload=()=>m(),s.onerror=()=>f(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 변환 실패");cf(u,n)}finally{URL.revokeObjectURL(l)}}const BS={class:"em-shortcuts"},DS={class:"em-shortcuts__title"},OS={class:"em-shortcuts__keys"},LS={class:"em-shortcuts__kbd"},PS={key:0,class:"em-shortcuts__plus"},zS={class:"em-shortcuts__desc"},US={class:"em-shortcuts__actions"},mf=Ge(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=ie.useModalHandle(),i=(s,c)=>Ct(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.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(ie.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",BS,[(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",DS,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",OS,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,f)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+f},[t.createElementVNode("kbd",LS,t.toDisplayString(m),1),f<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",PS,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",zS,t.toDisplayString(u.desc),1)]))),128))]))),128)),t.createElementVNode("div",US,[t.createVNode(t.unref(ie.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-af88f86f"]]);function po(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function FS(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 HS={class:"em-cmdk",role:"dialog","aria-modal":"true"},GS=["placeholder"],jS={class:"em-cmdk__results"},KS={class:"em-cmdk__section"},YS=["onMouseenter","onClick"],WS={class:"em-cmdk__label"},qS={key:0,class:"em-cmdk__tag"},XS={key:1,class:"em-cmdk__sub"},JS={class:"em-cmdk__section"},ZS=["onMouseenter","onClick"],QS={class:"em-cmdk__label"},e$={key:1,class:"em-cmdk__empty"},t$=Ge(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 h=c.value,E=a.state.logical.entities.map($=>{var H,j,v,T,F,I;return{type:"goto",kind:"entity",id:$.modelId,label:((j=(H=$.table)==null?void 0:H.logicalName)==null?void 0:j[h])||$.name,sub:(v=$.table)==null?void 0:v.physicalName,match:po($.name,(F=(T=$.table)==null?void 0:T.logicalName)==null?void 0:F[h],(I=$.table)==null?void 0:I.physicalName)??""}}),D=a.state.logical.groups.map($=>{var H,j,v,T;return{type:"goto",kind:"group",id:$.modelId,label:((H=$.name)==null?void 0:H[h])||((j=$.name)==null?void 0:j.ko)||$.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:po((v=$.name)==null?void 0:v[h],(T=$.name)==null?void 0:T.ko,$.packageName)??""}});return[...E,...D]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const h=[];a.editable.value&&(h.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),h.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),h.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),h.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),h.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),h.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),h.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),h.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const E of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])h.push({type:"action",id:`dm-${E}`,label:a.t(u[E]),run:()=>a.displayMode.value=E});return h});function f(h,E){return h.label.toLowerCase().includes(E)}const p=t.computed(()=>{const h=r.value.trim().toLowerCase();return h?d.value.filter(E=>E.match.includes(h)):d.value}),y=t.computed(()=>{const h=r.value.trim().toLowerCase();return h?m.value.filter(E=>f(E,h)):m.value}),g=t.computed(()=>[...p.value,...y.value]);t.watch([p,y],()=>{l.value=0});function _(h){return g.value.indexOf(h)}function b(h){if(h.type==="goto")a.selection.value={kind:h.kind,id:h.id},a.requestFocus(h.id);else{if(h.disabled)return;h.run()}i("close")}function N(h){if(h.key==="Escape"){i("close"),h.preventDefault();return}if(h.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),h.preventDefault();return}if(h.key==="ArrowUp"){l.value=Math.max(l.value-1,0),h.preventDefault();return}if(h.key==="Enter"){const E=g.value[l.value];E&&b(E),h.preventDefault()}}return t.nextTick(()=>{var h;return(h=s.value)==null?void 0:h.focus()}),(h,E)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:E[1]||(E[1]=t.withModifiers(D=>i("close"),["self"]))},[t.createElementVNode("div",HS,[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":E[0]||(E[0]=D=>r.value=D),class:"em-cmdk__input",type:"text",placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:N},null,40,GS),[[t.vModelText,r.value]]),t.createElementVNode("div",jS,[g.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[p.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",KS,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,D=>(t.openBlock(),t.createElementBlock("button",{key:D.id,type:"button",class:t.normalizeClass(["em-cmdk__item",{"is-active":_(D)===l.value}]),onMouseenter:$=>l.value=_(D),onClick:$=>b(D)},[t.createElementVNode("span",WS,t.toDisplayString(D.label),1),D.tag?(t.openBlock(),t.createElementBlock("span",qS,t.toDisplayString(D.tag),1)):D.sub?(t.openBlock(),t.createElementBlock("span",XS,t.toDisplayString(D.sub),1)):t.createCommentVNode("",!0)],42,YS))),128))],64)):t.createCommentVNode("",!0),y.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",JS,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,D=>(t.openBlock(),t.createElementBlock("button",{key:D.id,type:"button",class:t.normalizeClass(["em-cmdk__item",{"is-active":_(D)===l.value,"is-disabled":D.disabled}]),onMouseenter:$=>l.value=_(D),onClick:$=>b(D)},[t.createElementVNode("span",QS,t.toDisplayString(D.label),1)],42,ZS))),128))],64)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",e$,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])])],32)]))}}),[["__scopeId","data-v-a5a7d1c2"]]);function n$(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const o$={key:0,class:"em-canvas__empty","aria-hidden":"true"},i$={class:"em-canvas__empty-title"},a$=["innerHTML"],r$=["innerHTML"],l$={key:1,class:"em-canvas__empty-title"},s$={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},c$={class:"em-conflict-banner__body"},d$={class:"em-conflict-banner__title"},u$={class:"em-conflict-banner__detail"},m$={key:0,class:"em-toast",role:"status","aria-live":"polite"},Vl="nc:",ff=Ge(t.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:n}){const i=e.controller,a=ie.useModal(),r=t.ref(!1),l=t.ref(null);let s;t.watch(()=>i.notice.value,z=>{z&&(l.value=z.text,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200))}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const c=t.computed(()=>n$(i.opConflict.value)),d=t.ref(!1),u=t.ref(!1),m={x:0,y:0};function f(z){m.x=z.clientX,m.y=z.clientY}const p=t.ref(null);t.provide(ya,p);const y=t.ref(null);t.provide(Ju,y);const g=t.ref(null),_=t.computed(()=>{const z=g.value,X=new Set;if(!z)return X;if(z.kind==="entity")X.add(z.id);else if(z.kind==="group"){const fe=i.resolved.value.groups.find($e=>$e.group.modelId===z.id);for(const $e of(fe==null?void 0:fe.group.memberEntityRefs)??[])X.add($e)}return X}),b=t.computed(()=>{const z=g.value,X=new Set(_.value),fe=new Set,$e=new Set;if(!z)return{related:X,edges:fe,notes:$e};if(z.kind==="note"){$e.add(z.id);for(const Oe of i.resolved.value.noteConnections)Oe.noteRef===z.id&&X.add(Oe.targetRef);return{related:X,edges:fe,notes:$e}}const Be=_.value;if(!Be.size)return{related:X,edges:fe,notes:$e};for(const Oe of i.resolved.value.associations){const{end1:ye,end2:de}=Oe.association;(Be.has(ye.entityRef)||Be.has(de.entityRef))&&(fe.add(Oe.association.modelId),X.add(ye.entityRef),X.add(de.entityRef))}for(const Oe of i.resolved.value.noteConnections)X.has(Oe.targetRef)&&$e.add(Oe.noteRef);return{related:X,edges:fe,notes:$e}});t.provide(so,{source:g,active:t.computed(()=>g.value!==null),primaryEntityIds:_,relatedEntityIds:t.computed(()=>b.value.related),relatedEdgeIds:t.computed(()=>b.value.edges),relatedNoteIds:t.computed(()=>b.value.notes),hoverGroupId:t.computed(()=>{var z;return((z=g.value)==null?void 0:z.kind)==="group"?g.value.id:null}),setEntityHover:z=>{y.value||u.value||(g.value=z?{kind:"entity",id:z}:null)},setGroupHover:z=>{y.value||u.value||(g.value=z?{kind:"group",id:z}:null)},setNoteHover:z=>{y.value||u.value||(g.value=z?{kind:"note",id:z}:null)}}),t.provide(Tn,i);function N(z,X){return`${Vl}${z}:${X}`}function h(z){if(!z.startsWith(Vl))return null;const[X,fe]=z.slice(Vl.length).split(":");return X&&fe?{noteRef:X,targetRef:fe}:null}t.provide(cl,{points:z=>{var fe,$e;const X=h(z);return X?((fe=i.resolved.value.noteConnections.find(Be=>Be.noteRef===X.noteRef&&Be.targetRef===X.targetRef))==null?void 0:fe.waypoints)??[]:(($e=i.resolved.value.associations.find(Be=>Be.association.modelId===z))==null?void 0:$e.waypoints)??[]},movePoint:(z,X,fe)=>{const $e=h(z);$e?i.moveNoteConnectionWaypoint($e.noteRef,$e.targetRef,X,fe):i.moveWaypoint(z,X,fe)},insertPoint:(z,X,fe)=>{const $e=h(z);$e?i.addNoteConnectionWaypoint($e.noteRef,$e.targetRef,X,fe):i.addWaypoint(z,X,fe)},removePoint:(z,X)=>{const fe=h(z);fe?i.removeNoteConnectionWaypoint(fe.noteRef,fe.targetRef,X):i.removeWaypoint(z,X)}});const E=He(),{nodes:D,edges:$,findNode:H,findEdge:j,addNodes:v,addEdges:T,removeNodes:F,removeEdges:I,fitView:le,setCenter:k,getViewport:Y,screenToFlowCoordinate:C,getSelectedNodes:W,updateNodeInternals:ee}=E,ae=t.ref(!1);async function L(z){ae.value=!0,await t.nextTick(),await new Promise(X=>requestAnimationFrame(()=>X(null)));try{return await z()}finally{ae.value=!1}}function U(){return L(()=>df(E))}function ne(){return L(()=>uf(E))}n({exportSvg:U,exportPng:ne});const ue=t.computed(()=>i.resolved.value.entities.length===0);function Ne(){const z=Y(),{width:X,height:fe}=E.dimensions.value;return{x:(X/2-z.x)/z.zoom,y:(fe/2-z.y)/z.zoom}}function se(){const z=Ne();i.addEntity("NewEntity",{x:z.x,y:z.y})}function me(){const z=Ne();i.addNote("메모",{x:z.x,y:z.y})}function _e(z){for(const X of i.resolved.value.groups){const{location:fe,size:$e}=X.geo;if(z.x>=fe.x&&z.x<=fe.x+$e.width&&z.y>=fe.y&&z.y<=fe.y+$e.height)return X.group.modelId}return null}function Ie(){const z=i.resolved.value,X=new Map(z.groups.map(ye=>[ye.group.modelId,ye.geo])),fe=new Set(z.groups.map(ye=>ye.group.modelId)),$e=new Set([...fe,...z.entities.map(ye=>ye.entity.modelId),...z.notes.map(ye=>ye.note.modelId)]);for(const ye of[...D.value])$e.has(ye.id)||F([ye.id]);for(const ye of z.groups){const de=ye.group.modelId,ze={width:`${ye.geo.size.width}px`,height:`${ye.geo.size.height}px`},Ye={group:ye.group,style:ye.style,locked:ye.locked},st=ye.locked?!1:void 0,Ze=H(de);Ze?(Ze.position={...ye.geo.location},Ze.data=Ye,Ze.style=ze,Ze.draggable=st):v([{id:de,type:"group",position:{...ye.geo.location},draggable:st,style:ze,data:Ye}])}for(const ye of z.entities){const de=ye.entity.modelId,ze=ye.groupRef&&fe.has(ye.groupRef)?ye.groupRef:void 0,Ye={entity:ye.entity,displayMode:i.displayMode.value,collapsed:ye.collapsed,locked:ye.locked,groupRef:ze,size:ye.geo.size,style:ye.style,attributeStyles:ye.attributeStyles,operationStyles:ye.operationStyles},st=ye.locked?!1:void 0,Ze=ze?X.get(ze):void 0,pt=Ze?{x:ye.geo.location.x-Ze.location.x,y:ye.geo.location.y-Ze.location.y}:{...ye.geo.location},nt=H(de);nt?(nt.position=pt,nt.data=Ye,nt.parentNode=ze,nt.draggable=st):v([{id:de,type:"entity",position:pt,parentNode:ze,draggable:st,data:Ye}])}for(const ye of z.notes){const de=ye.note,ze=de.modelId,Ye=ye.groupRef&&fe.has(ye.groupRef)?ye.groupRef:void 0,st={note:de,groupRef:Ye},Ze={width:`${de.geo.size.width}px`,height:`${de.geo.size.height}px`},pt=Ye?X.get(Ye):void 0,nt=pt?{x:de.geo.location.x-pt.location.x,y:de.geo.location.y-pt.location.y}:{...de.geo.location},at=H(ze);at?(at.position=nt,at.data=st,at.style=Ze,at.parentNode=Ye):v([{id:ze,type:"note",position:nt,parentNode:Ye,style:Ze,data:st}])}const Be=new Map(z.associations.map(ye=>[ye.association.modelId,ye])),Oe=new Set(z.noteConnections.map(ye=>N(ye.noteRef,ye.targetRef)));for(const ye of[...$.value])!Be.has(ye.id)&&!Oe.has(ye.id)&&I([ye.id]);for(const[ye,de]of Be){const ze={id:ye,type:"association",source:de.association.end1.entityRef,target:de.association.end2.entityRef,sourceHandle:de.sourceColumnRef?`r:${de.sourceColumnRef}`:void 0,targetHandle:de.targetColumnRef?`l:${de.targetColumnRef}`:void 0,data:{association:de.association,sourceColumnRef:de.sourceColumnRef,targetColumnRef:de.targetColumnRef}},Ye=j(ye);Ye?(Ye.data=ze.data,Ye.sourceHandle=ze.sourceHandle,Ye.targetHandle=ze.targetHandle):T([ze])}for(const ye of z.noteConnections){const de=N(ye.noteRef,ye.targetRef),ze={noteRef:ye.noteRef,targetRef:ye.targetRef},Ye=j(de);Ye?Ye.data=ze:T([{id:de,type:"note-connection",source:ye.noteRef,target:ye.targetRef,data:ze}])}Ve()}function Ve(){t.nextTick(()=>requestAnimationFrame(()=>ee()))}function Te(){const z=W.value.map(fe=>fe.id);if(z.length)return z;const X=i.selection.value;return X&&(X.kind==="entity"||X.kind==="note"||X.kind==="group")?[X.id]:[]}function pe(){return W.value.filter(z=>z.type==="entity").map(z=>z.id)}function ke(){return W.value.filter(z=>z.type==="group").map(z=>z.id)}function ve(z){var X;return[...((X=i.state.logical.groups.find(fe=>fe.modelId===z))==null?void 0:X.memberEntityRefs)??[]]}function G(){const z=ke().flatMap(ve);return[...new Set([...pe(),...z])]}function O(){return ke().length>0||pe().length>1}function Z(){O()?i.copy(G()):i.copy()}async function oe(z){if(!z.length)return;await t.nextTick();const X=W.value;X.length&&E.removeSelectedNodes(X);const fe=z.map($e=>H($e)).filter($e=>!!$e);fe.length&&E.addSelectedNodes(fe)}function R(z){if(O()&&pe().includes(z)){const X=G();return{caption:i.t("em.ctx.copyN",{n:X.length}),icon:"copy",handler:()=>i.copy(X)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:z},i.copy()}}}function A(z){var Be;const X=z.target;if(X&&(X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.isContentEditable))return;if(z.key==="?"){a.openModal({component:mf,bind:{locale:i.uiLocale.value}}),z.preventDefault();return}if((z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"){r.value=!0,z.preventDefault();return}if(!i.editable.value){(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="c"&&(Z(),z.preventDefault());return}if(z.key==="Delete"||z.key==="Backspace"){i.deleteSelection()&&z.preventDefault();return}if(z.key==="ArrowUp"||z.key==="ArrowDown"||z.key==="ArrowLeft"||z.key==="ArrowRight"){if(((Be=i.selection.value)==null?void 0:Be.kind)==="attribute"){if(z.key==="ArrowUp"||z.key==="ArrowDown"){const ze=z.key==="ArrowDown"?1:-1;(z.altKey?i.nudgeSelectedAttributes(ze):i.moveAttributeFocus(ze))&&z.preventDefault()}return}const Oe=z.shiftKey?10:1,ye=z.key==="ArrowLeft"?-Oe:z.key==="ArrowRight"?Oe:0,de=z.key==="ArrowUp"?-Oe:z.key==="ArrowDown"?Oe:0;i.nudgeNodes(Te(),ye,de)&&z.preventDefault();return}if(!(z.metaKey||z.ctrlKey))return;const $e=z.key.toLowerCase();$e==="c"?(Z(),z.preventDefault()):$e==="v"?(oe(i.paste()),z.preventDefault()):$e==="z"&&(z.shiftKey?i.redo():i.undo(),z.preventDefault())}t.onMounted(async()=>{Ie(),await t.nextTick(),le(),window.addEventListener("keydown",A),window.addEventListener("pointerup",K),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",A),window.removeEventListener("pointerup",K),window.removeEventListener("pointermove",f)});function K(){p.value=null}function he(){u.value=!0,g.value=null}function we(){var $e;u.value=!1;const z=($e=document.elementFromPoint(m.x,m.y))==null?void 0:$e.closest(".vue-flow__node"),X=z==null?void 0:z.dataset.id;if(!X){g.value=null;return}const fe=z.classList.contains("vue-flow__node-group")?"group":z.classList.contains("vue-flow__node-note")?"note":"entity";g.value={kind:fe,id:X}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],Ie),t.watch(()=>i.revision.value,Ve),t.watch(()=>i.resolved.value,z=>{const X=g.value;if(!X)return;(X.kind==="entity"?z.entities.some($e=>$e.entity.modelId===X.id):X.kind==="group"?z.groups.some($e=>$e.group.modelId===X.id):z.notes.some($e=>$e.note.modelId===X.id))||(g.value=null)});function Se(z){const X=z.computedPosition??z.position,fe=z.dimensions??{width:0,height:0};return{x:X.x+fe.width/2,y:X.y+fe.height/2}}function Ce(z){const X=z.node;if(X){if(g.value=null,X.type==="group"){const fe=i.resolved.value.groups.find($e=>$e.group.modelId===X.id);y.value=fe?{groupId:X.id,dx:X.position.x-fe.geo.location.x,dy:X.position.y-fe.geo.location.y}:null,p.value=null;return}if(X.type!=="entity"&&X.type!=="note"){p.value=null;return}p.value=_e(Se(X))}}function Pe(z){var $e;p.value=null,y.value=null;const X=($e=z.nodes)!=null&&$e.length?z.nodes:[z.node],fe=X.filter(Be=>(Be==null?void 0:Be.type)==="group");if(fe.length){for(const Be of fe){if(!Be)continue;const Oe=i.resolved.value.entities.filter(ye=>ye.groupRef===Be.id).map(ye=>{const de=H(ye.entity.modelId),ze=(de==null?void 0:de.computedPosition)??(de==null?void 0:de.position)??{x:0,y:0};return{id:ye.entity.modelId,location:{x:ze.x,y:ze.y}}});i.dragGroup(Be.id,{x:Be.position.x,y:Be.position.y},Oe)}return}for(const Be of X){if(!Be||Be.type==="group")continue;const Oe=Be.computedPosition??Be.position,ye=Be.dimensions??{width:0,height:0},de={x:Oe.x+ye.width/2,y:Oe.y+ye.height/2};Be.type==="note"?i.dropNote(Be.id,{x:Oe.x,y:Oe.y},_e(de)):i.dropEntity(Be.id,{x:Oe.x,y:Oe.y},_e(de))}}function Ke(z){var ze,Ye,st,Ze,pt;if(!i.editable.value||!z.source||!z.target)return;const X=((ze=H(z.source))==null?void 0:ze.type)==="note",fe=((Ye=H(z.target))==null?void 0:Ye.type)==="note";if(X||fe){if(X&&fe)return;const nt=X?z.source:z.target,at=X?z.target:z.source;((st=H(at))==null?void 0:st.type)==="entity"&&i.addNoteConnection(nt,at);return}const $e=nt=>{var at;return(at=i.state.logical.entities.find(ct=>ct.modelId===nt))==null?void 0:at.stereotype},Be=$e(z.source)==="JPA_EMBEDDABLE",Oe=$e(z.target)==="JPA_EMBEDDABLE";if(Be||Oe){if(Be&&Oe)return;const nt=Be?z.source:z.target,at=Be?z.target:z.source;i.addEmbedAssociation(at,nt);return}const ye=(Ze=z.sourceHandle)!=null&&Ze.startsWith("r:")?z.sourceHandle.slice(2):void 0,de=(pt=z.targetHandle)!=null&&pt.startsWith("l:")?z.targetHandle.slice(2):void 0;i.addAssociation(z.source,z.target,ye,de)}const Fe=t.ref(null);function gt(z,X){var $e;const fe=i.state.layout.entityLayouts.find(Be=>Be.entityRef===z);return ut(($e=fe==null?void 0:fe.attributeStyles)==null?void 0:$e[X])}function w(z,X){var $e;const fe=i.state.layout.entityLayouts.find(Be=>Be.entityRef===z);return ut(($e=fe==null?void 0:fe.operationStyles)==null?void 0:$e[X])}function B(z){var X;return ut((X=i.state.layout.groupLayouts.find(fe=>fe.groupRef===z))==null?void 0:X.style)}function x(z){var X;return ut((X=i.state.layout.notes.find(fe=>fe.modelId===z))==null?void 0:X.style)}function M(z){var Be,Oe;if(z.preventDefault(),!i.editable.value)return;const X=()=>C({x:z.clientX,y:z.clientY}),fe=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const ye=X();i.addEntity("NewEntity",{x:ye.x,y:ye.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const ye=X();i.addNote("메모",{x:ye.x,y:ye.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const ye=X();i.addEmptyGroup({x:ye.x,y:ye.y})}}],$e=(Be=i.clipboard.value)==null?void 0:Be.kind;($e==="entity"||$e==="entities")&&fe.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>oe(i.paste())}),i.resolved.value.entities.length>0&&fe.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(Oe=Fe.value)==null||Oe.open(z,fe)}function V({event:z,node:X}){var ze,Ye,st,Ze,pt,nt,at,ct,bf,_f,Ef,kf,Nf,wf,vf,xf,If,Cf;const fe=z;if(fe.preventDefault(),!i.editable.value){if(X.type==="group"||X.type==="note")return;const je=(Ye=(ze=fe.target)==null?void 0:ze.closest("[data-attr]"))==null?void 0:Ye.dataset.attr;if(je){const Qe=i.selection.value;(Qe==null?void 0:Qe.kind)==="attribute"&&Qe.entityId===X.id&&Qe.ids.includes(je)||i.selectAttribute(X.id,je);const Zt=((st=i.selection.value)==null?void 0:st.kind)==="attribute"&&i.selection.value.entityId===X.id?[...i.selection.value.ids]:[je];(Ze=Fe.value)==null||Ze.open(fe,[{caption:Zt.length>1?i.t("em.ctx.copyN",{n:Zt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(pt=Fe.value)==null||pt.open(fe,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>pa(a,i,X.id)},R(X.id)]);return}if(X.type==="group"){const je=i.isGroupLocked(X.id),Qe=[];je||Qe.push({type:"swatches",caption:i.t("em.common.color"),current:B(X.id),onPick:Zt=>i.setGroupSwatch(X.id,Zt)},{type:"separator"});const rt=O()&&ke().includes(X.id)?G():ve(X.id);rt.length&&Qe.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(rt)}),Qe.push({caption:je?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:je?"unlock":"lock",handler:()=>i.setGroupLocked(X.id,!je)}),je||Qe.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(X.id)}),(nt=Fe.value)==null||nt.open(fe,Qe);return}if(X.type==="note"){(at=Fe.value)==null||at.open(fe,[{type:"swatches",caption:i.t("em.common.color"),current:x(X.id),onPick:je=>i.setNoteSwatch(X.id,je)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(X.id)}]);return}const $e=(bf=(ct=fe.target)==null?void 0:ct.closest("[data-attr]"))==null?void 0:bf.dataset.attr;if($e){const je=i.selection.value;(je==null?void 0:je.kind)==="attribute"&&je.entityId===X.id&&je.ids.includes($e)||i.selectAttribute(X.id,$e);const rt=((_f=i.selection.value)==null?void 0:_f.kind)==="attribute"&&i.selection.value.entityId===X.id?[...i.selection.value.ids]:[$e];if(i.isEntityLocked(X.id)){(Ef=Fe.value)==null||Ef.open(fe,[{caption:rt.length>1?i.t("em.ctx.copyN",{n:rt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const Zt=rt.length>1,Ml=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(X.id)},{type:"swatches",caption:Zt?i.t("em.ctx.colorN",{n:rt.length}):i.t("em.common.color"),current:Zt?null:gt(X.id,$e),onPick:DT=>i.setAttributeSwatches(X.id,rt,DT)},{type:"separator"},{caption:Zt?i.t("em.ctx.copyN",{n:rt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],li=i.clipboard.value;(li==null?void 0:li.kind)==="attribute"&&Ml.push({caption:li.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:li.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:X.id},i.paste()}}),Ml.push({type:"separator"},{caption:Zt?i.t("em.ctx.deleteAttrN",{n:rt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(X.id,rt)}),(kf=Fe.value)==null||kf.open(fe,Ml);return}const Be=(wf=(Nf=fe.target)==null?void 0:Nf.closest("[data-op]"))==null?void 0:wf.dataset.op;if(Be){if(i.isEntityLocked(X.id))return;(vf=Fe.value)==null||vf.open(fe,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(X.id)},{type:"swatches",caption:i.t("em.common.color"),current:w(X.id,Be),onPick:je=>i.setOperationSwatch(X.id,Be,je)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(X.id,Be)}]);return}const Oe=i.resolved.value.entities.find(je=>je.entity.modelId===X.id),ye=!!(Oe!=null&&Oe.locked),de=[{caption:ye?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>pa(a,i,X.id)}];if(!ye){de.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(X.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(X.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const Qe=W.value.filter(rt=>rt.type==="entity").map(rt=>rt.id);i.createGroup(Qe.includes(X.id)&&Qe.length?Qe:[X.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(X.id,X.id)});const je=i.embeddableCatalog.value;if(je.length){de.push({type:"separator"});for(const Qe of je){const rt=((xf=Qe.label)==null?void 0:xf.ko)??((If=Qe.label)==null?void 0:If.en)??Qe.type;de.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:rt}),icon:"link",handler:()=>i.addPredefinedEmbed(X.id,Qe.type)})}}}if(de.push({type:"separator"}),de.push({caption:Oe!=null&&Oe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Oe!=null&&Oe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(X.id,!(Oe!=null&&Oe.collapsed))}),Oe!=null&&Oe.groupRef&&!ye&&de.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(X.id)}),de.push({caption:ye?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:ye?"unlock":"lock",handler:()=>i.setEntityLocked(X.id,!ye)}),de.push(R(X.id)),!ye){const je=i.clipboard.value;(je==null?void 0:je.kind)==="attribute"&&de.push({caption:je.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:je.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:X.id},i.paste()}}),de.push({type:"separator"}),de.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(X.id)})}(Cf=Fe.value)==null||Cf.open(fe,de)}function ce({event:z,edge:X}){var Be,Oe;const fe=z;if(fe.preventDefault(),!i.editable.value)return;const $e=h(X.id);if($e){(Be=Fe.value)==null||Be.open(fe,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints($e.noteRef,$e.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection($e.noteRef,$e.targetRef)}]);return}(Oe=Fe.value)==null||Oe.open(fe,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(X.id)},{type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(X.id)}])}function J(z){return z==="group"?"group":z==="note"?"note":"entity"}function q({node:z}){if(W.value.length>1){i.selection.value=null;return}i.selection.value={kind:J(z.type),id:z.id}}function te({nodes:z}){z.length>1&&(i.selection.value=null)}function re({edge:z}){const X=h(z.id);i.selection.value=X?{kind:"note",id:X.noteRef}:{kind:"association",id:z.id}}function be(z){const X=i.selection.value;return!!X&&X.kind!=="attribute"&&X.id===z.id}function S(z){var X,fe;return be(z)?z.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":z.type==="note"?"var(--em-note-soft)":z.type==="group"?Lu(ut((X=z.data)==null?void 0:X.style),!0)??"var(--em-mm-group)":Lu(ut((fe=z.data)==null?void 0:fe.style))??"var(--em-mm-entity)"}function Q(z){return be(z)?"var(--em-selection)":z.type==="note"?"var(--em-note-accent)":z.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function P(z,X){k(z,X,{zoom:Y().zoom,duration:350})}t.watch(()=>i.focusRequest.value,z=>{if(!z)return;const X=H(z.id);if(!X)return;const fe=X.computedPosition??X.position,$e=X.dimensions??{width:0,height:0};P(fe.x+$e.width/2,fe.y+$e.height/2)});function xe({position:z}){P(z.x,z.y)}function ge({node:z}){i.selection.value={kind:J(z.type),id:z.id};const X=z.computedPosition??z.position,fe=z.dimensions??{width:0,height:0};P(X.x+fe.width/2,X.y+fe.height/2)}function Ue({node:z}){le({nodes:[z.id],duration:350,maxZoom:1.2,padding:.6})}return(z,X)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-canvas",{"is-connecting":d.value,"is-panning":u.value}])},[t.createVNode(t.unref(gE),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ae.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(Yt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:he,onMoveEnd:we,onConnect:Ke,onConnectStart:X[1]||(X[1]=fe=>d.value=!0),onConnectEnd:X[2]||(X[2]=fe=>d.value=!1),onNodeDrag:Ce,onNodeDragStop:Pe,onNodeClick:q,onEdgeClick:re,onSelectionChange:te,onPaneClick:X[3]||(X[3]=fe=>t.unref(i).selection.value=null),onPaneContextMenu:M,onNodeContextMenu:V,onEdgeContextMenu:ce},{"node-group":t.withCtx(fe=>[t.createVNode(Qu,t.normalizeProps(t.guardReactiveProps(fe)),null,16)]),"node-entity":t.withCtx(fe=>[t.createVNode(Zu,t.normalizeProps(t.guardReactiveProps(fe)),null,16)]),"node-note":t.withCtx(fe=>[t.createVNode(em,t.normalizeProps(t.guardReactiveProps(fe)),null,16)]),"edge-association":t.withCtx(fe=>[t.createVNode(pm,t.normalizeProps(t.guardReactiveProps(fe)),null,16)]),"edge-note-connection":t.withCtx(fe=>[t.createVNode(gS,t.normalizeProps(t.guardReactiveProps(fe)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(av),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(Av),{"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(Vn),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:se},{default:t.withCtx(()=>[t.createVNode(Me,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Vn),{title:t.unref(i).t("em.ctx.addNote"),onClick:me},{default:t.withCtx(()=>[t.createVNode(Me,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Vn),{title:t.unref(i).t("em.palette.autoLayout"),onClick:X[0]||(X[0]=fe=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Me,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(fS),{key:1,pannable:"",width:224,height:160,"node-color":S,"node-stroke-color":Q,"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:xe,onNodeClick:ge,onNodeDblclick:Ue})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ue.value?(t.openBlock(),t.createElementBlock("div",o$,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",i$,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,a$),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,r$)],64)):(t.openBlock(),t.createElementBlock("p",l$,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(t$,{key:1,controller:t.unref(i),onClose:X[4]||(X[4]=fe=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[c.value?(t.openBlock(),t.createElementBlock("div",s$,[t.createVNode(Me,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",c$,[t.createElementVNode("strong",d$,t.toDisplayString(c.value.title),1),t.createElementVNode("span",u$,t.toDisplayString(c.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(SS,{ref_key:"menuRef",ref:Fe,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",m$,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-a49d9d63"]]),f$={class:"em-explorer em-scroll-overlay"},p$={class:"em-explorer__search"},h$=["placeholder","aria-label"],y$=["aria-label","title"],g$={key:0,class:"em-explorer__empty"},b$={class:"em-explorer__rows"},_$=["data-key","onClick","onDblclick"],E$=["onClick"],k$=["title"],N$={class:"em-key-slot"},w$={class:"em-key-slot"},v$={class:"em-explorer__label"},pf=Ge(t.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:n}){const i=e.controller,a=ie.useModal(),r=t.computed(()=>{var L;const $=i.resolved.value,H=i.displayMode.value,j=i.userLanguage.value,v=U=>{var ne,ue,Ne;return ci(H,U.name,(ue=(ne=U.table)==null?void 0:ne.logicalName)==null?void 0:ue[j],(Ne=U.table)==null?void 0:Ne.physicalName,i.t("em.node.logicalMissing"))},T=H==="PHYSICAL"||H==="LOGICAL_PHYSICAL",F=U=>{const ne=U.attrType.startsWith("RELATION")&&U.dbAttrs.length>0;return{icon:U.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:U.identifier,fk:ne&&T}}},I=U=>U.attrType.startsWith("EMBED")&&U.dbAttrs.length>0,le=H==="PHYSICAL"||H==="LOGICAL_PHYSICAL",k=U=>{if(U.attrType!=="EMBED_PREDEF")return U.dbAttrs;const ne=i.embeddableCatalog.value.find(ue=>ue.type===U.type);return ne?U.dbAttrs.map((ue,Ne)=>{const se=ne.fields[Ne];return se?{...ue,physicalName:ue.physicalName||se.physicalName,logicalName:ue.logicalName??se.logicalName,dataType:ue.dataType||se.dataType,length:ue.length??se.length}:ue}):U.dbAttrs},Y=(U,ne)=>{var me,_e,Ie,Ve,Te,pe,ke,ve,G;const ue={entityId:ne,attrId:U.modelId};if(I(U)){const O=Za(H,U);return{key:`attr:${U.modelId}`,label:U.name+(O?` : ${O}`:""),icon:"table",attrRef:ue,focusId:ne,matchText:po(U.name,(_e=(me=U.dbAttrs[0])==null?void 0:me.logicalName)==null?void 0:_e[j],(Ie=U.dbAttrs[0])==null?void 0:Ie.physicalName),children:le?k(U).map(Z=>{var oe,R;return{key:`attr:${U.modelId}:col:${Z.modelId}`,label:ci(H,Z.physicalName,(oe=Z.logicalName)==null?void 0:oe[j],Z.physicalName,i.t("em.node.logicalMissing"))+(Z.dataType?` : ${Z.dataType}`:""),icon:"field",attrRef:ue,focusId:ne,matchText:po(Z.physicalName,(R=Z.logicalName)==null?void 0:R[j]),children:[]}}):[]}}const Ne=Ja(U,i.state.logical.associations),se=Za(H,U,Ne);return{key:`attr:${U.modelId}`,label:ci(H,U.name,(Te=(Ve=U.dbAttrs[0])==null?void 0:Ve.logicalName)==null?void 0:Te[j],(pe=U.dbAttrs[0])==null?void 0:pe.physicalName,i.t("em.node.logicalMissing"))+(se?` : ${se}`:""),...F(U),attrRef:ue,focusId:ne,matchText:po(U.name,(ve=(ke=U.dbAttrs[0])==null?void 0:ke.logicalName)==null?void 0:ve[j],(G=U.dbAttrs[0])==null?void 0:G.physicalName),children:[]}},C=U=>{var Ne,se,me;const ne=U.entity,ue=[...ne.attributes].sort((_e,Ie)=>_e.order-Ie.order);return{key:`entity:${ne.modelId}`,label:v(ne),icon:"table",selectKind:"entity",selectId:ne.modelId,focusId:ne.modelId,matchText:po(ne.name,(se=(Ne=ne.table)==null?void 0:Ne.logicalName)==null?void 0:se[j],(me=ne.table)==null?void 0:me.physicalName),children:ue.map(_e=>Y(_e,ne.modelId))}},W=new Map,ee=[];for(const U of $.entities)if(U.groupRef){const ne=W.get(U.groupRef)??[];ne.push(U),W.set(U.groupRef,ne)}else ee.push(U);const ae=[];for(const U of $.groups){const ne=U.group;ae.push({key:`group:${ne.modelId}`,label:((L=ne.name)==null?void 0:L.ko)||ne.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:ne.modelId,children:(W.get(ne.modelId)??[]).map(C)})}for(const U of ee)ae.push(C(U));if($.associations.length){const U=new Map($.entities.map(ne=>[ne.entity.modelId,v(ne.entity)]));ae.push({key:"section:associations",label:i.t("em.explorer.associations",{n:$.associations.length}),icon:"arrow-lr",children:$.associations.map(ne=>{const ue=ne.association,Ne=U.get(ue.end1.entityRef)??ue.end1.entityRef,se=U.get(ue.end2.entityRef)??ue.end2.entityRef;return{key:`assoc:${ue.modelId}`,label:`${Ne} — ${se}`,icon:"arrow-lr",selectKind:"association",selectId:ue.modelId,children:[]}})})}return $.notes.length&&ae.push({key:"section:notes",label:i.t("em.explorer.notes",{n:$.notes.length}),icon:"note",children:$.notes.map(({note:U})=>{var ne;return{key:`note:${U.modelId}`,label:((ne=U.memo.split(`
|
|
62
|
+
`)[0])==null?void 0:ne.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:U.modelId,focusId:U.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:ae}});function l($){return $?$.pk&&$.fk?i.t("em.node.keyPfk"):$.pk?i.t("em.node.keyPk"):$.fk?i.t("em.node.keyFk"):"":""}const s=t.ref(new Set);function c($){const H=new Set(s.value);H.has($)?H.delete($):H.add($),s.value=H}const d=t.ref(""),u=t.ref(null),m=t.computed(()=>d.value.trim().length>0),f=t.computed(()=>{const $=[];if(m.value){const j=FS(r.value,d.value.trim().toLowerCase()),v=(T,F)=>{if(j.has(T.key)){$.push({node:T,depth:F});for(const I of T.children)v(I,F+1)}};return v(r.value,0),$}const H=(j,v)=>{if($.push({node:j,depth:v}),!s.value.has(j.key))for(const T of j.children)H(T,v+1)};return H(r.value,0),$}),p=t.computed(()=>m.value&&f.value.length<=1);function y($){var v;if($.key!=="/"||$.metaKey||$.ctrlKey||$.altKey||$.shiftKey)return;const H=$.target,j=H==null?void 0:H.tagName;j==="INPUT"||j==="TEXTAREA"||j==="SELECT"||H!=null&&H.isContentEditable||($.preventDefault(),(v=u.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",y)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",y));const g=t.computed(()=>{const $=[],H=j=>{if(j.children.length){j.key!=="root"&&$.push(j.key);for(const v of j.children)H(v)}};return H(r.value),$}),_=t.computed(()=>!g.value.some($=>s.value.has($)));function b(){s.value=_.value?new Set(g.value):new Set}n({toggleAll:b,allExpanded:_,hasExpandable:t.computed(()=>g.value.length>0)});function N($){const H=i.selection.value;return $.attrRef?(H==null?void 0:H.kind)==="attribute"&&H.entityId===$.attrRef.entityId&&H.ids.includes($.attrRef.attrId):!!H&&H.kind!=="attribute"&&!!$.selectId&&$.selectKind===H.kind&&$.selectId===H.id}function h($){const H=i.selection.value;return $.selectKind==="entity"&&(H==null?void 0:H.kind)==="attribute"&&H.entityId===$.selectId}function E($,H){if($.attrRef){const j=H.shiftKey?"range":H.metaKey||H.ctrlKey?"toggle":"replace";i.selectAttribute($.attrRef.entityId,$.attrRef.attrId,j)}else $.selectKind&&$.selectId&&(i.selection.value={kind:$.selectKind,id:$.selectId});$.focusId&&i.requestFocus($.focusId)}function D($){$.selectKind==="entity"&&$.selectId&&pa(a,i,$.selectId)}return($,H)=>(t.openBlock(),t.createElementBlock("section",f$,[t.createElementVNode("div",p$,[t.createVNode(Me,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":H[0]||(H[0]=j=>d.value=j),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:H[1]||(H[1]=t.withKeys(j=>d.value="",["esc"]))},null,40,h$),[[t.vModelText,d.value]]),d.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:H[2]||(H[2]=j=>d.value="")},[t.createVNode(Me,{name:"x",size:13})],8,y$)):t.createCommentVNode("",!0)]),p.value?(t.openBlock(),t.createElementBlock("p",g$,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",b$,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,({node:j,depth:v})=>(t.openBlock(),t.createElementBlock("div",{key:j.key,class:t.normalizeClass(["em-explorer__row",{"is-active":N(j),"is-focus-parent":h(j),"is-selectable":!!j.selectKind||!!j.attrRef||!!j.focusId}]),"data-key":j.key,style:t.normalizeStyle({paddingLeft:4+v*14+"px"}),onClick:T=>E(j,T),onDblclick:T=>D(j)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!j.children.length,"is-open":!s.value.has(j.key)}]),onClick:t.withModifiers(T=>j.children.length&&c(j.key),["stop"])},[j.children.length?(t.openBlock(),t.createBlock(Me,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,E$),j.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(j.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",N$,[j.keyMarks.pk?(t.openBlock(),t.createBlock(Me,{key:0,name:"key",size:14,class:"em-key is-pk"})):j.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Me,{key:1,class:"em-explorer__icon",name:j.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",w$,[j.keyMarks.fk?(t.openBlock(),t.createBlock(Me,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,k$)):(t.openBlock(),t.createBlock(Me,{key:1,class:"em-explorer__icon",name:j.icon,size:15},null,8,["name"])),t.createElementVNode("span",v$,t.toDisplayString(j.label),1)],46,_$))),128))])]))}}),[["__scopeId","data-v-7b20d13b"]]),x$={class:"em-text-export"},I$={key:0,class:"em-text-export__tabs",role:"tablist"},C$=["aria-selected","onClick"],S$={class:"em-text-export__pre"},$$={class:"em-text-export__actions"},R$=Ge(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=ie.useModalHandle(),i=(c,d)=>Ct(n.locale??"ko",c,d),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}async function l(){try{await navigator.clipboard.writeText(r().content),ie.showNotification(i("em.export.copied"),"info")}catch{ie.showNotification(i("em.export.copyFailed"),"error")}}function s(){const c=r(),d=new Blob([c.content],{type:"text/plain;charset=utf-8"}),u=URL.createObjectURL(d);try{const m=document.createElement("a");m.href=u,m.download=c.filename,document.body.appendChild(m),m.click(),m.remove()}finally{URL.revokeObjectURL(u)}}return(c,d)=>(t.openBlock(),t.createBlock(t.unref(ie.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",x$,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",I$,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(u,m)=>(t.openBlock(),t.createElementBlock("button",{key:u.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":m===a.value}]),"aria-selected":m===a.value,onClick:f=>a.value=m},t.toDisplayString(u.label),11,C$))),128))])):t.createCommentVNode("",!0),t.createElementVNode("pre",S$,t.toDisplayString(r().content),1),t.createElementVNode("div",$$,[t.createVNode(t.unref(ie.BSButton),{caption:i("em.export.copy"),onClick:l},null,8,["caption"]),t.createVNode(t.unref(ie.BSButton),{caption:i("em.export.download"),onClick:s},null,8,["caption"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:i("em.common.close"),onClick:d[0]||(d[0]=u=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-f31001c1"]]),A$={class:"em-text-import"},T$={class:"em-text-import__formats",role:"tablist"},V$=["aria-selected","onClick"],M$=["placeholder"],B$={class:"em-text-import__status"},D$={class:"em-text-import__ok"},O$={key:0,class:"em-text-import__warn"},L$={key:1,class:"em-text-import__err"},P$={key:2,class:"em-text-import__err"},z$={key:3,class:"em-text-import__err"},U$={class:"em-text-import__actions"},F$=Ge(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=ie.useModalHandle(),i=(f,p)=>Ct(n.locale??"ko",f,p),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"}];function s(f){return f?f.startsWith("{")?"json":/\berdiagram\b/i.test(f)?"mermaid":/\bcreate\s+table\b/i.test(f)?"ddl":null:null}const c=t.computed(()=>r.value==="auto"?s(a.value.trim()):r.value),d=t.computed(()=>{const f=a.value.trim();if(!f)return{status:"empty"};const p=c.value;if(!p)return{status:"unknown"};try{let y,g=[];return p==="json"?y=ls(f):p==="mermaid"?y=Wl(f):(y=Zl(f),g=Wa(f).warnings),y.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:y,warnings:g}}catch(y){return{status:"error",message:y instanceof Error?y.message:String(y)}}}),u=t.computed(()=>d.value.status==="ok");function m(){const f=d.value;f.status!=="ok"||!f.source||(n.onImport(f.source),o.close())}return(f,p)=>(t.openBlock(),t.createBlock(t.unref(ie.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",A$,[t.createElementVNode("div",T$,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,y=>t.createElementVNode("button",{key:y.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-import__fmt",{"is-active":y.key===r.value}]),"aria-selected":y.key===r.value,onClick:g=>r.value=y.key},t.toDisplayString(i(y.labelKey)),11,V$)),64))]),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":p[0]||(p[0]=y=>a.value=y),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,M$),[[t.vModelText,a.value]]),t.createElementVNode("div",B$,[d.value.status==="ok"&&d.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",D$,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${c.value==="json"?"Json":c.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:d.value.source.logical.entities.length,relations:d.value.source.logical.associations.length})),1),d.value.warnings&&d.value.warnings.length?(t.openBlock(),t.createElementBlock("span",O$," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:d.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):d.value.status==="error"?(t.openBlock(),t.createElementBlock("span",L$,t.toDisplayString(i("em.import.error",{message:d.value.message??""})),1)):d.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",P$,t.toDisplayString(i("em.import.unknownFormat")),1)):d.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",z$,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",U$,[t.createVNode(t.unref(ie.BSButton),{caption:i("em.import.confirm"),disabled:!u.value,onClick:m},null,8,["caption","disabled"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[1]||(p[1]=y=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-43a94e55"]]),H$={class:"em-toolbar"},G$={class:"em-toolbar__mode"},hf=Ge(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=ie.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:y=>i.displayMode.value=y});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const y=i.resolved.value.entities;return y.length>0&&y.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=i.state.logical;r.openModal({component:R$,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Hl(y),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Ka(y,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Ka(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:is(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:rs(y,i.state.layout),filename:"diagram.json"}]}})}function f(){r.openModal({component:F$,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(g=>g.modelId))}}})}function p(){r.openModal({component:mf,bind:{locale:i.uiLocale.value}})}return(y,g)=>(t.openBlock(),t.createElementBlock("div",H$,[t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:g[0]||(g[0]=_=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Me,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:g[1]||(g[1]=_=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Me,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",G$,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(ie.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=_=>s.value=_),items:l,"value-provider":_=>_.v,"label-provider":_=>t.unref(i).t(_.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(ie.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(Me,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=_=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Me,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=_=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Me,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ie.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(Me,{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(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:f},{left:t.withCtx(()=>[t.createVNode(Me,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Me,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=_=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Me,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=_=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Me,{name:"camera",size:16})]),_:1},8,["tooltip"]),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[g[8]||(g[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=_=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Me,{name:"undo",size:16})]),_:1},8,["class","caption","tooltip"])],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:p},{left:t.withCtx(()=>[t.createVNode(Me,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-38de55b4"]]),j$=["title"],K$=["title"],Y$=["disabled","aria-pressed"],W$=["disabled","aria-pressed"],q$=Ge(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=>Ct(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(Me,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,j$)):(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(Me,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,Y$),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(Me,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,W$)],10,K$))}}),[["__scopeId","data-v-2b5162b7"]]),X$=["disabled"],J$={class:"em-panel__sub"},Z$={class:"em-nav"},Q$={key:0,class:"em-nav__divider","aria-hidden":"true"},eR={key:1},tR=["onClick","onKeydown"],nR={class:"em-nav__name"},oR=["title"],iR={key:0,class:"em-panel__note"},aR=["data-attr-block"],rR={class:"em-attr__row"},lR=["title"],sR={key:0,class:"em-attr__row"},cR={key:1,class:"em-attr__navhint"},dR={class:"em-attr__row"},uR={class:"em-attr__row"},mR={class:"em-attr__flags"},fR={class:"em-attr__pii"},pR={class:"em-attr__pii"},hR={class:"em-attr__pii"},yR={key:0,class:"em-attr__pii em-attr__codetop"},gR={class:"em-multilang"},bR={key:3,class:"em-embed-cols"},_R={class:"em-embed-col__label"},ER={class:"em-attr__row"},kR={class:"em-attr__row"},NR={key:0,class:"em-embed-upd"},wR={class:"em-embed-upd"},vR={class:"em-embed-upd"},xR={class:"em-swatch__row em-attr__swatch"},IR=["title","onClick"],CR=["title","onClick"],SR={key:0,class:"em-attr__swatch-hint"},Oa="__OWN__",$R=Ge(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(S=>S.modelId===n.entityId)??null),a=t.computed(()=>i.value?o.state.layout.entityLayouts.find(S=>S.entityRef===i.value.modelId)??null:null),r=t.computed(()=>{var S;return((S=i.value)==null?void 0:S.stereotype)==="JPA_EMBEDDABLE"}),l=t.computed(()=>new Set(o.selectedAttrIds.value)),s=t.computed(()=>{var S;return((S=i.value)==null?void 0:S.attributes.filter(Q=>Q.attrType!=="DIVIDER"))??[]}),c=t.computed(()=>{var S;return((S=i.value)==null?void 0:S.attributes)??[]}),d=t.computed(()=>s.value.filter(S=>l.value.has(S.modelId)));function u(S){return{pk:S.identifier,fk:S.attrType.startsWith("RELATION")&&S.dbAttrs.length>0,required:S.notNull&&!S.identifier}}function m(S){return!!i.value&&!!Ri(o.state.logical,i.value.modelId,S.modelId)}function f(S){const Q=u(S),P=[Q.pk&&"PK",Q.fk&&"FK",Q.required&&"NOT NULL"].filter(Boolean);return P.length?P.join(" · "):void 0}function p(S,Q){i.value&&o.selectAttribute(i.value.modelId,S.modelId,Q.shiftKey?"range":Q.metaKey||Q.ctrlKey?"toggle":"replace")}const y=["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 g(S){return S==="none"?o.t("em.common.noneParen"):S}const _=S=>S;function b(S){var Q,P;return ut((P=(Q=a.value)==null?void 0:Q.attributeStyles)==null?void 0:P[S.modelId])}function N(S){return l.value.size>1&&l.value.has(S.modelId)}function h(S,Q){if(!i.value)return;const P=N(S)?o.selectedAttrIds.value:[S.modelId];o.setAttributeSwatches(i.value.modelId,P,Q)}function E(S,Q){i.value&&o.updateAttribute(i.value.modelId,S.modelId,Q)}function D(S,Q){E(S,{naturalId:Q||void 0,naturalIdMutable:Q?S.naturalIdMutable:void 0})}function $(){return{naturalId:void 0,naturalIdMutable:void 0}}function H(S,Q){E(S,{identifier:Q,...Q?$():{}})}function j(S,Q){E(S,{transient:Q||void 0,...Q?$():{}})}function v(S){return!!S.transient}const T=S=>S.value,F=S=>S.label;function I(S,Q){if(!Q)return;const P=L.value.find(xe=>xe.type===Q);if(P){const xe=S.dbAttrs[0]??{modelId:S.modelId+".c",physicalName:S.name,dataType:"VARCHAR"};E(S,{type:Q,customType:void 0,dbAttrs:[{...xe,dataType:P.dataType,length:P.length,scale:P.scale}]});return}E(S,Q===Rt?{type:Q}:{type:Q,customType:void 0})}function le(S,Q){E(S,{customType:Q.trim()===""?void 0:Q})}function k(S,Q){if(S.attrType==="RELATION_REF")return;const xe={...S.dbAttrs[0]??{modelId:S.modelId+".c",physicalName:S.name,dataType:"VARCHAR"},...Q};Q.dataType!==void 0&&!_o.has(xe.dataType)&&(xe.scale=void 0),E(S,{dbAttrs:[xe]})}function Y(S){var Q;return _o.has(((Q=S.dbAttrs[0])==null?void 0:Q.dataType)??"")}function C(S,Q){k(S,{logicalName:Object.keys(Q).length?Q:void 0})}function W(S,Q){E(S,{description:Object.keys(Q).length?Q:void 0})}function ee(S){return S.personalInfoAttributeType??"none"}function ae(S,Q){E(S,{personalInfoAttributeType:Q==="none"?void 0:Q})}const L=t.computed(()=>o.predefinedCustomTypeCatalog.value),U=t.computed(()=>o.embeddableCatalog.value),ne=t.ref(void 0);function ue(S){var Q,P;return((Q=S.label)==null?void 0:Q.ko)??((P=S.label)==null?void 0:P.en)??S.type}function Ne(S){if(!S||!i.value)return;const Q=o.addPredefinedEmbed(i.value.modelId,S);Q&&o.selectAttribute(i.value.modelId,Q),ne.value=void 0}function se(){if(!i.value)return;const S=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,S)}const me=t.computed(()=>o.groupCodeCatalog.value);function _e(S){var Q;return((Q=me.value.find(P=>P.groupCode===S.groupCode))==null?void 0:Q.codes)??[]}function Ie(S){return["none",..._e(S)]}function Ve(S){return S==="none"?"none":S.code}function Te(S){var P,xe;if(S==="none")return o.t("em.common.noneParen");const Q=((P=S.label)==null?void 0:P.ko)??((xe=S.label)==null?void 0:xe.en);return Q?`${S.code} (${Q})`:S.code}function pe(S,Q){i.value&&o.setAttributeGroupCode(i.value.modelId,S.modelId,Q)}function ke(S,Q){E(S,{defaultValue:Q==="none"?void 0:Q})}function ve(S,Q){E(S,{defaultValue:Q.trim()===""?void 0:Q})}function G(S){return S.attrType.startsWith("EMBED")&&S.dbAttrs.length>0}function O(S,Q,P){const xe=S.dbAttrs.map((ge,Ue)=>{if(Ue!==Q)return ge;const z={...ge,...P};for(const X of Object.keys(P))P[X]===void 0&&delete z[X];return z});i.value&&o.setEmbedColumns(i.value.modelId,S.modelId,xe)}function Z(S,Q,P){O(S,Q,{logicalName:Object.keys(P).length?P:void 0})}function oe(S,Q){var ge,Ue,z;if(S.attrType==="EMBED_PREDEF"){const X=(ge=o.embeddableCatalog.value.find(fe=>fe.type===S.type))==null?void 0:ge.fields[Q];return X?{name:X.name,physicalName:X.physicalName,dataType:X.dataType,length:X.length,shareable:X.shareable,logicalName:X.logicalName}:void 0}const P=(Ue=S.embedded)==null?void 0:Ue.embeddableRef;if(!P)return;const xe=(z=o.state.logical.entities.find(X=>X.modelId===P))==null?void 0:z.attributes.flatMap(X=>X.dbAttrs)[Q];return xe?{physicalName:xe.physicalName,dataType:xe.dataType,length:xe.length,scale:xe.scale,logicalName:xe.logicalName}:void 0}function R(S,Q){var P,xe;return((P=oe(S,Q))==null?void 0:P.dataType)||((xe=S.dbAttrs[Q])==null?void 0:xe.dataType)||""}function A(S,Q){var P,xe;return((P=oe(S,Q))==null?void 0:P.length)??((xe=S.dbAttrs[Q])==null?void 0:xe.length)}function K(S,Q){var P,xe;return((P=oe(S,Q))==null?void 0:P.scale)??((xe=S.dbAttrs[Q])==null?void 0:xe.scale)}const he=["inherit","true","false"];function we(S){return S==="inherit"?o.t("em.common.inherit"):S}function Se(S){return(S==null?void 0:S.updatable)===void 0?"inherit":S.updatable?"true":"false"}function Ce(S,Q,P){O(S,Q,{updatable:P==="inherit"?void 0:P==="true"})}function Pe(S,Q){k(S,{updatable:Q==="inherit"?void 0:Q==="true"})}const Ke=["inherit","true","false"];function Fe(S){return S==="inherit"?o.t("em.common.inherit"):S}function gt(S){return(S==null?void 0:S.insertable)===void 0?"inherit":S.insertable?"true":"false"}function w(S,Q,P){O(S,Q,{insertable:P==="inherit"?void 0:P==="true"})}function B(S,Q){k(S,{insertable:Q==="inherit"?void 0:Q==="true"})}const x=t.computed(()=>i.value?ui(i.value,o.state.logical.entities):[]),M=t.computed(()=>mn(x.value.flatMap(S=>S.attributes.flatMap(Q=>Q.dbAttrs)))),V=t.computed(()=>x.value.flatMap(S=>S.attributes.filter(Q=>Q.attrType==="NORMAL"&&Q.dbAttrs.length===1&&Q.dbAttrs[0]).map(Q=>{var P;return{modelId:Q.dbAttrs[0].modelId,physical:Q.dbAttrs[0].physicalName||Q.name,isCurrency:Q.type==="Currency",ownerName:S.modelId===((P=i.value)==null?void 0:P.modelId)?void 0:S.name}})));function ce(){const S=[...V.value].sort((Q,P)=>Number(P.isCurrency)-Number(Q.isCurrency));return[Oa,...S.map(Q=>Q.modelId)]}function J(S){if(S===Oa)return o.t("em.attr.sharedOwn");const Q=V.value.find(xe=>xe.modelId===S);if(!Q)return S;const P=Q.ownerName?`${Q.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:P,physical:Q.physical,mode:Q.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function q(S){return(S==null?void 0:S.sharedColumnRef)??Oa}function te(S,Q,P){O(S,Q,{sharedColumnRef:P===Oa?void 0:P})}function re(S){return(S==null?void 0:S.sharedColumnRef)!=null}function be(S){var Q;return((Q=Un(S,M.value))==null?void 0:Q.physicalName)??""}return(S,Q)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",J$,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:s.value.length}))+" ",1),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:se},null,8,["caption"]),U.value.length?(t.openBlock(),t.createBlock(t.unref(ie.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":ne.value,items:U.value,"value-provider":P=>P.type,"label-provider":ue,"onUpdate:modelValue":Ne},null,8,["placeholder","model-value","items","value-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",Z$,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,P=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:P.modelId},[P.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",Q$,[...Q[0]||(Q[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",eR,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":l.value.has(P.modelId)}]),role:"button",tabindex:"0",onClick:xe=>p(P,xe),onKeydown:[t.withKeys(t.withModifiers(xe=>p(P,xe),["prevent"]),["enter"]),t.withKeys(t.withModifiers(xe=>p(P,xe),["prevent"]),["space"])]},[t.createElementVNode("span",nR,t.toDisplayString(P.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:f(P)},[u(P).pk?(t.openBlock(),t.createBlock(Me,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(P).required?(t.openBlock(),t.createBlock(Me,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),u(P).fk?(t.openBlock(),t.createBlock(Me,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,oR)],42,tR)]))],64))),128))]),s.value.length&&!d.value.length?(t.openBlock(),t.createElementBlock("p",iR,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,P=>{var xe,ge,Ue,z,X,fe,$e,Be,Oe,ye;return t.openBlock(),t.createElementBlock("div",{key:P.modelId,class:t.normalizeClass(["em-attr",{"is-focused":l.value.has(P.modelId)}]),"data-attr-block":P.modelId},[t.createElementVNode("div",rR,[t.createVNode(t.unref(ie.BSTextInput),{class:"grow",name:`attr-name-${P.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":P.name,"onUpdate:modelValue":de=>E(P,{name:de})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSSelect),{name:`attr-type-${P.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:P.attrType.startsWith("EMBED")||!!P.groupCode||P.attrType==="RELATION_REF",items:t.unref(ts)(P.type,L.value),"value-provider":T,"label-provider":F,"model-value":P.type,"onUpdate:modelValue":de=>I(P,de)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:m(P)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:de=>t.unref(o).removeAttribute(i.value.modelId,P.modelId)},null,8,["onClick"])],8,lR)]),P.type===t.unref(Rt)?(t.openBlock(),t.createElementBlock("div",sR,[t.createVNode(t.unref(ie.BSTextInput),{class:"grow",name:`attr-customtype-${P.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":P.customType??"","onUpdate:modelValue":de=>le(P,de)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),P.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",cR,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):G(P)?(t.openBlock(),t.createElementBlock("div",bR,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(P.dbAttrs,(de,ze)=>{var Ye,st,Ze,pt,nt,at;return t.openBlock(),t.createElementBlock("div",{key:de.modelId,class:"em-embed-col"},[t.createElementVNode("span",_R,t.toDisplayString(((Ye=oe(P,ze))==null?void 0:Ye.name)??((st=oe(P,ze))==null?void 0:st.physicalName)??t.unref(o).t("em.attr.colFallback",{n:ze+1})),1),t.createElementVNode("div",ER,[t.createVNode(t.unref(ie.BSTextInput),{class:"grow",name:`embed-col-${de.modelId}`,width:"100%",disabled:re(de),placeholder:((Ze=oe(P,ze))==null?void 0:Ze.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":re(de)?be(de):de.physicalName,"onUpdate:modelValue":ct=>O(P,ze,{physicalName:ct})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSTextInput),{name:`embed-dtype-${de.modelId}`,width:"84px",disabled:"","model-value":R(P,ze)},null,8,["name","model-value"]),t.createVNode(t.unref(ie.BSNumberInput),{name:`embed-len-${de.modelId}`,width:"48px",disabled:"","model-value":A(P,ze)},null,8,["name","model-value"]),t.createVNode(t.unref(ie.BSNumberInput),{name:`embed-scale-${de.modelId}`,width:"48px",disabled:"","model-value":K(P,ze)},null,8,["name","model-value"])]),t.createVNode(Rn,{controller:t.unref(o),"ref-id":de.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",kR,[t.createVNode(An,{class:"grow",name:`embed-logical-${de.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((nt=(pt=oe(P,ze))==null?void 0:pt.logicalName)==null?void 0:nt.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":de.logicalName,"onUpdate:modelValue":ct=>Z(P,ze,ct)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(at=oe(P,ze))!=null&&at.shareable?(t.openBlock(),t.createElementBlock("label",NR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ie.BSSelect),{width:"110px","model-value":q(de),items:ce(),"value-provider":_,"label-provider":J,"onUpdate:modelValue":ct=>ct&&te(P,ze,ct)},null,8,["model-value","items","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",wR,[Q[3]||(Q[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ie.BSSelect),{width:"110px",disabled:re(de),"model-value":re(de)?"false":gt(de),items:Ke,"value-provider":_,"label-provider":Fe,"onUpdate:modelValue":ct=>ct&&w(P,ze,ct)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",vR,[Q[4]||(Q[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ie.BSSelect),{width:"110px",disabled:re(de),"model-value":re(de)?"false":Se(de),items:he,"value-provider":_,"label-provider":we,"onUpdate:modelValue":ct=>ct&&Ce(P,ze,ct)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",dR,[t.createVNode(An,{class:"grow",name:`attr-logical-${P.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(xe=P.dbAttrs[0])==null?void 0:xe.logicalName,"onUpdate:modelValue":de=>C(P,de)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",uR,[t.createVNode(t.unref(ie.BSTextInput),{class:"grow",name:`attr-col-${P.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.columnPlaceholder"),disabled:v(P),"model-value":((ge=P.dbAttrs[0])==null?void 0:ge.physicalName)??"","onUpdate:modelValue":de=>k(P,{physicalName:de})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSSelect),{name:`attr-dtype-${P.modelId}`,width:"84px",placeholder:"dataType",disabled:v(P),items:t.unref(Ql)(((Ue=P.dbAttrs[0])==null?void 0:Ue.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":_,"label-provider":t.unref(qa),"model-value":((z=P.dbAttrs[0])==null?void 0:z.dataType)??"","onUpdate:modelValue":de=>de&&k(P,{dataType:de})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSNumberInput),{name:`attr-len-${P.modelId}`,width:"48px",placeholder:"len",disabled:v(P),"model-value":(X=P.dbAttrs[0])==null?void 0:X.length,"onUpdate:modelValue":de=>k(P,{length:de||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSNumberInput),{name:`attr-scale-${P.modelId}`,width:"48px",placeholder:"scale",disabled:v(P)||!Y(P),"model-value":(fe=P.dbAttrs[0])==null?void 0:fe.scale,"onUpdate:modelValue":de=>k(P,{scale:de||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),t.createVNode(Rn,{controller:t.unref(o),"ref-id":($e=P.dbAttrs[0])==null?void 0:$e.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",mR,[t.createVNode(t.unref(ie.BSCheckbox),{name:`attr-pk-${P.modelId}`,label:"Primary Key","model-value":P.identifier,disabled:r.value||v(P),"onUpdate:modelValue":de=>H(P,de)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`attr-nn-${P.modelId}`,label:"Not Null","model-value":P.notNull,disabled:v(P),"onUpdate:modelValue":de=>E(P,{notNull:de})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`attr-uq-${P.modelId}`,label:"Unique","model-value":!!((Be=P.dbAttrs[0])!=null&&Be.unique),disabled:v(P),"onUpdate:modelValue":de=>k(P,{unique:de})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`attr-ai-${P.modelId}`,label:"Auto Increment","model-value":!!((Oe=P.dbAttrs[0])!=null&&Oe.autoIncrement),disabled:v(P)||!P.identifier,"onUpdate:modelValue":de=>k(P,{autoIncrement:de})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`attr-tr-${P.modelId}`,label:"@Transient","model-value":!!P.transient,disabled:P.identifier,"onUpdate:modelValue":de=>j(P,de)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`attr-nid-${P.modelId}`,label:"@NaturalId","model-value":!!P.naturalId,disabled:P.identifier||v(P),"onUpdate:modelValue":de=>D(P,de)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${P.modelId}`,label:"mutable","model-value":!!P.naturalIdMutable,disabled:v(P)||!P.naturalId,"onUpdate:modelValue":de=>E(P,{naturalIdMutable:de||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`attr-mv-${P.modelId}`,label:"Multi-Value (Set)","model-value":!!((ye=P.dbAttrs[0])!=null&&ye.multiValue),disabled:v(P),"onUpdate:modelValue":de=>k(P,{multiValue:de||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",fR,[Q[1]||(Q[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ie.BSSelect),{width:"100%",disabled:v(P),"model-value":gt(P.dbAttrs[0]),items:Ke,"value-provider":_,"label-provider":Fe,"onUpdate:modelValue":de=>de&&B(P,de)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",pR,[Q[2]||(Q[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ie.BSSelect),{width:"100%",disabled:v(P),"model-value":Se(P.dbAttrs[0]),items:he,"value-provider":_,"label-provider":we,"onUpdate:modelValue":de=>de&&Pe(P,de)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",hR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ie.BSSelect),{width:"100%","model-value":ee(P),items:y,"value-provider":_,"label-provider":g,"onUpdate:modelValue":de=>de&&ae(P,de)},null,8,["model-value","onUpdate:modelValue"])]),me.value.length?(t.openBlock(),t.createElementBlock("label",yR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(ju,{"model-value":P.groupCode,items:me.value,locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":de=>pe(P,de)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",{class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!me.value.length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),_e(P).length?(t.openBlock(),t.createBlock(t.unref(ie.BSSelect),{key:0,width:"100%","model-value":P.defaultValue??"none",items:Ie(P),"value-provider":Ve,"label-provider":Te,"onUpdate:modelValue":de=>de&&ke(P,de)},null,8,["model-value","items","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ie.BSTextInput),{key:1,name:`attr-default-${P.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":P.defaultValue??"","onUpdate:modelValue":de=>ve(P,de)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2),t.createElementVNode("fieldset",gR,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(An,{multiline:"",name:`attr-desc-${P.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":P.description,"onUpdate:modelValue":de=>W(P,de)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",xR,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(P)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:de=>h(P,null)},"∅",10,IR),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref($n),de=>(t.openBlock(),t.createElementBlock("button",{key:de,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":b(P)===de}]),style:t.normalizeStyle({background:t.unref(ao)(de)}),title:t.unref(io)(de),onClick:ze=>h(P,de)},null,14,CR))),128)),N(P)?(t.openBlock(),t.createElementBlock("span",SR,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:l.value.size})),1)):t.createCommentVNode("",!0)])],10,aR)}),128))],8,X$)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-42b107c0"]]),RR=["disabled"],AR={class:"em-panel__sub-label"},TR={class:"em-attr__row"},VR={class:"em-field em-idx-params"},MR=["value","placeholder","onChange"],BR=Ge(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(g=>g.modelId===o.entityId)??null),l=t.computed(()=>r.value?go(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var g;return[...(((g=r.value)==null?void 0:g.attributes)??[]).map(_=>({value:_.modelId,label:_.name})),...l.value.map(_=>({value:_.modelId,label:a.t("em.index.inherited",{field:_.field})}))]});function c(){var _;if(!r.value)return;const g=r.value.attributes[0];a.addIndex(r.value.modelId,{modelId:De(),name:`idx_${(((_=r.value.indexes)==null?void 0:_.length)??0)+1}`,unique:!1,columns:g?[{columnRef:g.modelId,descending:!1}]:[]})}function d(g,_){r.value&&a.updateIndex(r.value.modelId,g,_)}function u(g){var b;const _=(b=r.value)==null?void 0:b.attributes[0];_&&d(g.modelId,{columns:[...g.columns,{columnRef:_.modelId,descending:!1}]})}function m(g,_,b){d(g.modelId,{columns:g.columns.map((N,h)=>h===_?{...N,columnRef:b}:N)})}function f(g,_,b){d(g.modelId,{columns:g.columns.map((N,h)=>h===_?{...N,descending:b}:N)})}function p(g,_){d(g.modelId,{columns:g.columns.filter((b,N)=>N!==_)})}function y(g,_){d(g.modelId,{parameters:_.trim()===""?void 0:_})}return(g,_)=>{var b;return r.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:_[0]||(_[0]=N=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",AR,[e.collapsible?(t.openBlock(),t.createBlock(Me,{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:((b=r.value.indexes)==null?void 0:b.length)??0})),1)]),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(c,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],N=>(t.openBlock(),t.createElementBlock("div",{key:N.modelId,class:"em-attr"},[t.createElementVNode("div",TR,[t.createVNode(t.unref(ie.BSTextInput),{class:"grow",name:`idx-name-${N.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":h=>d(N.modelId,{name:h})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`idx-uq-${N.modelId}`,class:"em-check",label:"UQ","model-value":N.unique,"onUpdate:modelValue":h=>d(N.modelId,{unique:h})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:h=>t.unref(a).removeIndex(r.value.modelId,N.modelId)},null,8,["onClick"])]),t.createVNode(Rn,{controller:t.unref(a),"ref-id":N.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.columns,(h,E)=>(t.openBlock(),t.createElementBlock("div",{key:E,class:"em-attr__row"},[t.createVNode(t.unref(ie.BSSelect),{class:"grow","model-value":h.columnRef,items:s.value,"value-provider":D=>D.value,"label-provider":D=>D.label,"onUpdate:modelValue":D=>D&&m(N,E,D)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSCheckbox),{name:`idx-${N.modelId}-desc-${E}`,class:"em-check",label:"DESC","model-value":h.descending,"onUpdate:modelValue":D=>f(N,E,D)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:"−",onClick:D=>p(N,E)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),onClick:h=>u(N)},null,8,["caption","onClick"]),t.createElementVNode("label",VR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:N.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:h=>y(N,h.target.value)},null,40,MR)])]))),128)):t.createCommentVNode("",!0)],8,RR)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-d883aded"]]),DR=["disabled"],OR={class:"em-panel__sub-label"},LR={class:"em-attr__row"},PR={class:"em-attr__row"},zR={class:"em-multilang"},UR={class:"em-attr__pii"},FR={class:"em-swatch__row em-attr__swatch"},HR=["title","onClick"],GR=["title","onClick"],jR=Ge(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=ie.useModal(),l=t.computed(()=>a.state.logical.entities.find(h=>h.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(h=>h.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(h){return h==="none"?a.t("em.common.noneParen"):h}const m=h=>h;function f(h,E){l.value&&a.updateOperation(l.value.modelId,h.modelId,E)}function p(h,E){f(h,{description:Object.keys(E).length?E:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function g(h,E){f(h,{personalInfoAttributeType:E==="none"?void 0:E})}function _(h){var E,D;return ut((D=(E=s.value)==null?void 0:E.operationStyles)==null?void 0:D[h.modelId])}function b(h,E){l.value&&a.setOperationSwatch(l.value.modelId,h.modelId,E)}function N(h){r.openModal({component:Ku,bind:{operationName:h.name,sourceCode:h.sourceCode??"",locale:a.uiLocale.value,onSave:E=>f(h,{sourceCode:E})}})}return(h,E)=>{var D;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]=$=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",OR,[e.collapsible?(t.openBlock(),t.createBlock(Me,{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:((D=l.value.operations)==null?void 0:D.length)??0})),1)]),t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:E[0]||(E[0]=t.withModifiers($=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],$=>(t.openBlock(),t.createElementBlock("div",{key:$.modelId,class:"em-attr"},[t.createElementVNode("div",LR,[t.createVNode(t.unref(ie.BSTextInput),{class:"grow",name:`op-name-${$.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":$.name,"onUpdate:modelValue":H=>f($,{name:H})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSSelect),{width:"96px","model-value":$.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":H=>H&&f($,{visibility:H})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:H=>t.unref(a).removeOperation(l.value.modelId,$.modelId)},null,8,["onClick"])]),t.createElementVNode("div",PR,[t.createVNode(t.unref(ie.BSButton),{variant:"text",caption:t.unref(a).t($.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:H=>N($)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",zR,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(An,{multiline:"",name:`op-desc-${$.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":$.description,"onUpdate:modelValue":H=>p($,H)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",UR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(ie.BSSelect),{width:"100%","model-value":y($),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":H=>H&&g($,H)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",FR,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_($)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:H=>b($,null)},"∅",10,HR),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref($n),H=>(t.openBlock(),t.createElementBlock("button",{key:H,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":_($)===H}]),style:t.normalizeStyle({background:t.unref(ao)(H)}),title:t.unref(io)(H),onClick:j=>b($,H)},null,14,GR))),128))])]))),128)):t.createCommentVNode("",!0)],8,DR)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-394829bc"]]),KR=["title"],YR={class:"em-panel__head"},WR={class:"em-panel__head-row"},qR=["title"],XR={class:"em-panel__context"},JR={key:0,class:"em-panel__lock"},ZR=["disabled"],QR={key:0,class:"em-panel__note"},eA={key:1,class:"em-panel__note"},tA={key:2,class:"em-jpa"},nA={class:"em-field"},oA={class:"em-field"},iA={class:"em-field"},aA={key:0,class:"em-field"},rA={class:"em-panel__note"},lA={class:"em-panel__sub"},sA={class:"em-field"},cA={key:0,class:"em-field"},dA={class:"em-jpa"},uA={key:0,class:"em-panel__note"},mA={class:"em-jpa"},fA={class:"em-field"},pA={key:0,class:"em-panel__note"},hA={class:"em-field"},yA={class:"em-multilang"},gA={class:"em-field"},bA=["value"],_A={class:"em-field"},EA={class:"em-swatch"},kA={class:"em-swatch__row"},NA=["title"],wA=["title","onClick"],vA={class:"em-panel__note"},xA={class:"em-field"},IA=["value"],CA={class:"em-swatch"},SA={class:"em-swatch__row"},$A=["title"],RA=["title","onClick"],yf=Ge(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.selection.value),l=t.computed(()=>a.inspectedEntityId.value),s=t.computed(()=>{const R=l.value;return R?a.state.logical.entities.find(A=>A.modelId===R)??null:null}),c=t.computed(()=>{const R=r.value;if((R==null?void 0:R.kind)==="association"){const K=a.state.logical.associations.find(he=>he.modelId===R.id);return!!K&&(a.isEntityLocked(K.end1.entityRef)||a.isEntityLocked(K.end2.entityRef))}const A=l.value;return!!A&&a.isEntityLocked(A)}),d=t.computed(()=>{var R;return((R=a.selectedAttr.value)==null?void 0:R.attrId)??null}),u=t.computed(()=>new Set(a.selectedAttrIds.value)),m=t.computed(()=>d.value!==null),f=t.ref({});t.watch(m,()=>{f.value={}});function p(R){return f.value[R]??m.value}function y(R){f.value={...f.value,[R]:!p(R)}}const g=t.computed(()=>{var K;const R=s.value;if(!R)return a.t("em.entity.fallback");const A=(K=R.table)==null?void 0:K.physicalName;return A?`${R.name} (${A})`:R.name}),_=t.computed(()=>{const R=r.value;return(R==null?void 0:R.kind)==="association"?a.state.logical.associations.find(A=>A.modelId===R.id)??null:null}),b=t.computed(()=>{const R=r.value;return(R==null?void 0:R.kind)==="group"?a.state.logical.groups.find(A=>A.modelId===R.id)??null:null}),N=t.computed(()=>{const R=r.value;return(R==null?void 0:R.kind)==="note"?a.state.layout.notes.find(A=>A.modelId===R.id)??null:null}),h=t.computed(()=>{var A,K;const R=(A=b.value)==null?void 0:A.name;return(R==null?void 0:R.ko)||(R==null?void 0:R.en)||(R==null?void 0:R.ja)||(R==null?void 0:R.zh)||((K=b.value)==null?void 0:K.packageName)||a.t("em.group.fallback")}),E=t.computed(()=>{if(s.value){const R=u.value.size;if(R>1)return a.t("em.inspector.ctxEntityAttrs",{name:s.value.name,n:R});if(d.value){const A=s.value.attributes.find(K=>K.modelId===d.value);return(A==null?void 0:A.attrType)==="DIVIDER"?a.t("em.inspector.ctxEntityDivider",{name:s.value.name}):a.t("em.inspector.ctxEntityAttr",{name:s.value.name,attr:(A==null?void 0:A.name)??""})}return a.t("em.inspector.ctxEntity",{name:s.value.name})}if(_.value){const R=A=>{var K;return((K=a.state.logical.entities.find(he=>he.modelId===A))==null?void 0:K.name)??A};return a.t("em.inspector.ctxAssoc",{a:R(_.value.end1.entityRef),b:R(_.value.end2.entityRef)})}return b.value?a.t("em.inspector.ctxGroup",{name:h.value}):N.value?a.t("em.inspector.ctxNote"):a.t("em.inspector.ctxNone")}),D=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],$=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],H={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},j=R=>{const A=H[R];return A?a.t(A):R},v=R=>{var A;return((A=a.state.logical.entities.find(K=>K.modelId===R))==null?void 0:A.name)??R},T=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],F=["LIST","SET"],I=["inherit","LAZY","EAGER"],le=R=>R;function k(R){return R==="inherit"?a.t("em.common.inherit"):R}const Y=t.computed(()=>!!_.value&&_.value.end1.entityRef===_.value.end2.entityRef);function C(R,A){_.value&&a.updateAssociationEnd(_.value.modelId,R,A)}function W(R){var we;const A=(we=_.value)==null?void 0:we[R];if(!(A!=null&&A.attributeRef))return;const K=a.state.logical.entities.find(Se=>Se.modelId===A.entityRef),he=K==null?void 0:K.attributes.find(Se=>Se.modelId===A.attributeRef);return he&&(he.attrType==="RELATION_OWN"||he.attrType==="RELATION_REF")?he.name:void 0}function ee(R,A){var he;const K=(he=_.value)==null?void 0:he[R];K!=null&&K.attributeRef&&a.updateAttribute(K.entityRef,K.attributeRef,{name:A})}function ae(R){_.value&&!Y.value&&a.setAssociationIdentifying(_.value.modelId,R)}function L(R){var A,K,he;return!!((he=(K=(A=_.value)==null?void 0:A[R].jpa)==null?void 0:K.cascadeTypes)!=null&&he.includes("ALL"))}function U(R,A,K){var Se,Ce;const he=(Se=_.value)==null?void 0:Se[R];if(A==="ALL"&&K){C(R,{jpa:{...he==null?void 0:he.jpa,cascadeTypes:["ALL"]}});return}const we=new Set(((Ce=he==null?void 0:he.jpa)==null?void 0:Ce.cascadeTypes)??[]);K?we.add(A):we.delete(A),C(R,{jpa:{...he==null?void 0:he.jpa,cascadeTypes:[...we]}})}function ne(R,A){var he;const K=(he=_.value)==null?void 0:he[R];C(R,{jpa:{...K==null?void 0:K.jpa,...A}})}function ue(R){var A,K;return((K=(A=_.value)==null?void 0:A[R].jpa)==null?void 0:K.fetchType)??"inherit"}function Ne(R,A){ne(R,{fetchType:A==="inherit"?void 0:A})}function se(R){var K;const A=(K=_.value)==null?void 0:K[R==="end1"?"end2":"end1"];return(A==null?void 0:A.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(A==null?void 0:A.multiplicity)==="ONE_OR_MORE_INSTANCES"}const me=t.computed(()=>{const R=_.value;if(!R)return null;for(const A of a.state.logical.entities){const K=A.attributes.find(Ce=>{var Pe;return((Pe=Ce.embedded)==null?void 0:Pe.associationRef)===R.modelId&&Ce.attrType==="EMBED_OWN"});if(!K)continue;const he=R.end2.entityRef===K.embedded.embeddableRef?"end2":"end1",we=R[he].multiplicity,Se=R[he].jpa;return{which:he,cardinality:we,isCollection:we==="ZERO_OR_MORE_INSTANCES"||we==="ONE_OR_MORE_INSTANCES",collectionType:(Se==null?void 0:Se.collectionType)??"LIST",collectionTable:(Se==null?void 0:Se.collectionTable)??"",orderColumn:(Se==null?void 0:Se.orderColumn)??""}}return null});function _e(R){_.value&&a.setEmbedCardinality(_.value.modelId,R)}function Ie(R){const A=me.value;A&&ne(A.which,R==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function Ve(R){const A=me.value;A&&ne(A.which,{collectionTable:R.trim()||void 0})}function Te(R){const A=me.value;A&&ne(A.which,{orderColumn:R.trim()||void 0})}function pe(R){b.value&&a.updateGroup(b.value.modelId,R)}function ke(R,A){var K;pe({name:{...(K=b.value)==null?void 0:K.name,[R]:A}})}const ve=t.computed(()=>{var R;return b.value?ut((R=a.state.layout.groupLayouts.find(A=>A.groupRef===b.value.modelId))==null?void 0:R.style):null});function G(R){b.value&&a.setGroupSwatch(b.value.modelId,R)}function O(R){N.value&&a.setNoteMemo(N.value.modelId,R)}const Z=t.computed(()=>{var R;return ut((R=N.value)==null?void 0:R.style)});function oe(R){N.value&&a.setNoteSwatch(N.value.modelId,R)}return(R,A)=>(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(a).t("em.panel.resizeWidth"),onPointerdown:A[0]||(A[0]=(...K)=>e.startResize&&e.startResize(...K))},null,42,KR),t.createElementVNode("header",YR,[t.createElementVNode("div",WR,[A[14]||(A[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{type:"button",class:"em-panel__btn",title:t.unref(a).t("em.panel.collapse"),onClick:A[1]||(A[1]=K=>i("collapse"))},[t.createVNode(Me,{name:"panel-right-close",size:16})],8,qR)]),t.createElementVNode("p",XR,t.toDisplayString(E.value),1),c.value&&l.value?(t.openBlock(),t.createElementBlock("div",JR,[t.createVNode(Me,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.panel.lockedBanner")),1),t.unref(a).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:A[2]||(A[2]=K=>t.unref(a).setEntityLocked(l.value,!1))},t.toDisplayString(t.unref(a).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(a).editable.value||c.value},[s.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(zu,{controller:t.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:g.value,onToggle:A[3]||(A[3]=K=>y("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode($R,{controller:t.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),t.createVNode(BR,{controller:t.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:A[4]||(A[4]=K=>y("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(jR,{controller:t.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:A[5]||(A[5]=K=>y("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ie.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(a).t("em.assoc.identifying"),"model-value":!!_.value.identifying,disabled:Y.value||!!me.value,"onUpdate:modelValue":ae},null,8,["label","model-value","disabled"]),Y.value?(t.openBlock(),t.createElementBlock("p",QR,t.toDisplayString(t.unref(a).t("em.assoc.selfNoIdentifying")),1)):me.value?(t.openBlock(),t.createElementBlock("p",eA,t.toDisplayString(t.unref(a).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),me.value?(t.openBlock(),t.createElementBlock("fieldset",tA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.embed.legend")),1),t.createElementVNode("label",nA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.embed.cardinality")),1),t.createVNode(t.unref(ie.BSSelect),{"model-value":me.value.cardinality,items:$,"value-provider":le,"label-provider":j,"onUpdate:modelValue":A[6]||(A[6]=K=>K&&_e(K))},null,8,["model-value"])]),me.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",oA,[A[15]||(A[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(ie.BSSelect),{"model-value":me.value.collectionType,items:F,"value-provider":le,"label-provider":le,"onUpdate:modelValue":A[7]||(A[7]=K=>K&&Ie(K))},null,8,["model-value"])]),t.createElementVNode("label",iA,[A[16]||(A[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(ie.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(a).t("em.embed.collectionTablePlaceholder"),"model-value":me.value.collectionTable,"onUpdate:modelValue":Ve},null,8,["placeholder","model-value"])]),me.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",aA,[A[17]||(A[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(ie.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(a).t("em.embed.orderColumnPlaceholder"),"model-value":me.value.orderColumn,"onUpdate:modelValue":Te},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",rA,t.toDisplayString(t.unref(a).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],K=>{var he,we,Se;return t.withDirectives(t.createElementVNode("div",{key:K,class:"em-end"},[t.createElementVNode("h4",lA,t.toDisplayString(K)+" → "+t.toDisplayString(v(_.value[K].entityRef)),1),me.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",sA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(ie.BSSelect),{"model-value":_.value[K].multiplicity,items:D,"value-provider":le,"label-provider":le,"onUpdate:modelValue":Ce=>C(K,{multiplicity:Ce})},null,8,["model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ie.BSCheckbox),{name:`${K}-navigable`,class:"em-check",label:"navigable","model-value":_.value[K].navigable,"onUpdate:modelValue":Ce=>C(K,{navigable:Ce})},null,8,["name","model-value","onUpdate:modelValue"]),W(K)!==void 0?(t.openBlock(),t.createElementBlock("label",cA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(ie.BSTextInput),{name:`${K}-navname`,width:"100%",placeholder:t.unref(a).t("em.attr.namePlaceholder"),"model-value":W(K),"onUpdate:modelValue":Ce=>ee(K,Ce)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createVNode(t.unref(ie.BSCheckbox),{name:`${K}-composition`,class:"em-check",label:"composition","model-value":_.value[K].composition,"onUpdate:modelValue":Ce=>C(K,{composition:Ce})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",dA,[A[18]||(A[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(T,Ce=>{var Pe,Ke;return t.createVNode(t.unref(ie.BSCheckbox),{key:Ce,name:`${K}-cascade-${Ce}`,class:"em-check",label:Ce,"model-value":!!((Ke=(Pe=_.value[K].jpa)==null?void 0:Pe.cascadeTypes)!=null&&Ke.includes(Ce)),disabled:Ce!=="ALL"&&L(K),"onUpdate:modelValue":Fe=>U(K,Ce,Fe)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),L(K)?(t.openBlock(),t.createElementBlock("p",uA,t.toDisplayString(t.unref(a).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",mA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",fA,[A[19]||(A[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(ie.BSSelect),{"model-value":ue(K),items:I,"value-provider":le,"label-provider":k,"onUpdate:modelValue":Ce=>Ce&&Ne(K,Ce)},null,8,["model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ie.BSCheckbox),{name:`${K}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((he=_.value[K].jpa)!=null&&he.orphanRemoval),disabled:se(K),"onUpdate:modelValue":Ce=>ne(K,{orphanRemoval:Ce})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),se(K)&&((we=_.value[K].jpa)!=null&&we.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",pA,t.toDisplayString(t.unref(a).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",hA,[A[20]||(A[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(ie.BSTextInput),{name:`${K}-orderby`,width:"100%",placeholder:t.unref(a).t("em.assoc.orderByPlaceholder"),"model-value":((Se=_.value[K].jpa)==null?void 0:Se.orderBy)??"","onUpdate:modelValue":Ce=>ne(K,{orderBy:Ce.trim()||void 0})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!me.value||K===me.value.which]])}),64))],64)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",yA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,K=>{var he;return t.openBlock(),t.createElementBlock("label",{key:K,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(K),1),t.createVNode(t.unref(ie.BSTextInput),{name:`grp-name-${K}`,width:"100%","model-value":((he=b.value.name)==null?void 0:he[K])??"","onUpdate:modelValue":we=>ke(K,we)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",gA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:b.value.description??"",rows:"3",onChange:A[8]||(A[8]=K=>pe({description:K.target.value}))},null,40,bA)]),t.createElementVNode("label",_A,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(ie.BSTextInput),{name:"grp-package",width:"100%","model-value":b.value.packageName??"","onUpdate:modelValue":A[9]||(A[9]=K=>pe({packageName:K}))},null,8,["model-value"])]),t.createVNode(t.unref(ie.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(a).t("em.group.excludeDDL"),"model-value":b.value.excludeDDLGeneration,"onUpdate:modelValue":A[10]||(A[10]=K=>pe({excludeDDLGeneration:K}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",EA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.color")),1),t.createElementVNode("div",kA,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ve.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:A[11]||(A[11]=K=>G(null))},"∅",10,NA),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref($n),K=>(t.openBlock(),t.createElementBlock("button",{key:K,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ve.value===K}]),style:t.normalizeStyle({background:t.unref(ao)(K)}),title:t.unref(io)(K),onClick:he=>G(K)},null,14,wA))),128))])]),t.createElementVNode("p",vA,t.toDisplayString(t.unref(a).t("em.group.members",{n:b.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",xA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:N.value.memo,rows:"6",onChange:A[12]||(A[12]=K=>O(K.target.value))},null,40,IA)]),t.createElementVNode("fieldset",CA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.color")),1),t.createElementVNode("div",SA,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Z.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:A[13]||(A[13]=K=>oe(null))},"∅",10,$A),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref($n),K=>(t.openBlock(),t.createElementBlock("button",{key:K,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Z.value===K}]),style:t.normalizeStyle({background:t.unref(ao)(K)}),title:t.unref(io)(K),onClick:he=>oe(K)},null,14,RA))),128))])])],64)):t.createCommentVNode("",!0)],8,ZR)],4))}}),[["__scopeId","data-v-91291e43"]]),AA=["title"],TA={class:"em-validation__title"},VA=["title","onClick"],MA={key:0,class:"em-validation__body"},BA={class:"em-validation__opt"},DA={key:0,class:"em-validation__empty"},OA={key:1,class:"em-validation__empty"},LA={key:2,class:"em-validation__list"},PA=["onClick"],zA={class:"em-validation__item-msg"},UA={key:0,class:"em-validation__item-entity"},FA=["title","onClick"],HA=["title"],GA=Ge(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const g=new Map;for(const _ of o.state.logical.entities)g.set(_.modelId,_.name);return g});function r(g){const _=AE(g);if(!_)return null;const b=a.value.get(_);return b===void 0?null:b.trim()===""?o.t("em.validation.nameless"):b}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const g={error:0,warning:0,info:0};for(const _ of i.value)g[_.severity]++;return g}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,_)=>l[g.severity].order-l[_.severity].order)),u=t.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:Pu(o.t,g),category:$E(o.t,g.ruleId)}))),m=t.ref(!1);function f(g){c.value[g]=!c.value[g]}function p(g){if(!m.value){m.value=!0;return}f(g)}function y(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,_)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:_[1]||(_[1]=b=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Me,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",TA,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,AA),t.createElementVNode("div",{class:"em-validation__counts",onClick:_[0]||(_[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],b=>t.createElementVNode("button",{key:b,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!c.value[b]}]]),title:m.value?t.unref(o).t(c.value[b]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[b].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:N=>p(b)},[t.createVNode(Me,{name:l[b].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[b]),1)],10,VA)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",MA,[t.createElementVNode("label",BA,[t.createVNode(t.unref(ie.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":_[2]||(_[2]=b=>t.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",DA,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",OA,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",LA,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:b,entityName:N,message:h,category:E},D)=>(t.openBlock(),t.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${D}`,class:t.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:$=>y(b)},[t.createVNode(Me,{name:l[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",zA,[N?(t.openBlock(),t.createElementBlock("span",UA,t.toDisplayString(N),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(h),1)]),t.unref(o).hasQuickFix(b)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers($=>t.unref(o).applyQuickFix(b),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,FA)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},t.toDisplayString(E),9,HA)],10,PA))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),jA={class:"em-history"},KA={class:"em-history__head"},YA={class:"em-history__title"},WA={class:"em-history__head-actions"},qA=["title","disabled"],XA=["title"],JA={class:"em-history__filters"},ZA={class:"em-history__filter"},QA={class:"em-history__body"},eT={key:0,class:"em-history__empty"},tT={key:1,class:"em-history__empty is-error"},nT={key:2,class:"em-history__empty"},oT={key:3,class:"em-history__list"},iT=["onClick"],aT={class:"em-history__summary"},rT={class:"em-history__seq"},lT={class:"em-history__gmeta"},sT={class:"em-history__who"},cT={key:0,class:"em-history__time"},dT={key:1,class:"em-history__restored-from"},uT={key:0,class:"em-history__detail"},mT={class:"em-history__action-head"},fT={class:"em-history__action-name"},pT={key:0,class:"em-history__fields"},hT={class:"em-history__fname"},yT={key:0,class:"em-history__old"},gT={class:"em-history__val"},bT={key:1,class:"em-history__restore"},_T={class:"em-history__confirm-msg"},ET=["disabled","onClick"],kT=["disabled"],NT=["onClick"],wT=Ge(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],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);async function d(){if(a.historyTransport){l.value=!0,s.value=null;try{r.value=await a.historyTransport(),c.value=!0}catch(L){s.value=L instanceof Error?L.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}t.watch(()=>o.open,L=>{L&&u()},{immediate:!0});let m=null;t.watch(()=>a.revision.value,()=>{o.open&&(m&&clearTimeout(m),m=setTimeout(()=>void u(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const f=t.computed(()=>new Map(a.state.logical.entities.map(L=>[L.modelId,L]))),p=t.computed(()=>new Map(a.state.logical.associations.map(L=>[L.modelId,L]))),y=t.computed(()=>new Map((a.state.logical.groups??[]).map(L=>{var U;return[L.modelId,L.packageName||((U=L.name)==null?void 0:U.ko)||L.modelId]})));function g(L){var Ne,se,me,_e,Ie,Ve,Te;const U=p.value.get(L);if(!U)return a.t("em.history.assocFallback");if((Ne=U.description)!=null&&Ne.trim())return U.description.trim();const ne=(_e=(me=f.value.get((se=U.end1)==null?void 0:se.entityRef))==null?void 0:me.name)==null?void 0:_e.trim(),ue=(Te=(Ve=f.value.get((Ie=U.end2)==null?void 0:Ie.entityRef))==null?void 0:Ve.name)==null?void 0:Te.trim();return ne&&ue?`${ne}→${ue}`:a.t("em.history.assocFallback")}function _(L){var U,ne,ue,Ne;if(L.kind==="entity")return((ne=(U=f.value.get(L.ref))==null?void 0:U.name)==null?void 0:ne.trim())||a.t("em.attr.nameless");if(L.kind==="attribute"||L.kind==="operation"||L.kind==="index"){const se=L.entityRef?f.value.get(L.entityRef):void 0,_e=((L.kind==="attribute"?se==null?void 0:se.attributes:L.kind==="operation"?se==null?void 0:se.operations:se==null?void 0:se.indexes)??[]).find(Ve=>Ve.modelId===L.ref),Ie=(ue=se==null?void 0:se.name)==null?void 0:ue.trim();return`${Ie?Ie+".":""}${((Ne=_e==null?void 0:_e.name)==null?void 0:Ne.trim())||L.ref}`}return L.kind==="association"?g(L.ref):L.kind==="associationEnd"?`${g(L.ref)}(${L.end})`:L.kind==="group"?a.t("em.history.groupSubject",{name:y.value.get(L.ref)??L.ref}):L.ref}const b={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},h=t.ref("all"),E=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],D=t.computed({get:()=>h.value,set:L=>{L&&(h.value=L)}}),$=t.computed(()=>Is(r.value)),H=t.computed(()=>$.value.length?$.value[0].seq:null),j=t.computed(()=>h.value==="all"?$.value:$.value.filter(L=>(L.kind??"edit")===h.value));function v(L){return L===void 0?"—":L===null?a.t("em.history.emptyValue"):typeof L=="object"?JSON.stringify(L):String(L)}function T(L){const U=_(L.subject);if(L.verb==="add")return a.t("em.history.summaryAdd",{name:U});if(L.verb==="remove")return a.t("em.history.summaryRemove",{name:U});if(L.fields.length===1){const ne=L.fields[0];return`${U}.${ne.field} ${ne.oldValue!==void 0?v(ne.oldValue)+"→":""}${v(ne.value)}`}return a.t("em.history.summaryFields",{name:U,n:L.fields.length})}function F(L){return L.actions.length===0?a.t("em.history.noChange"):L.actions.length===1?T(L.actions[0]):a.t("em.history.summaryMore",{summary:T(L.actions[0]),n:L.actions.length-1})}const I=t.ref(new Set);function le(L){const U=new Set(I.value);U.has(L)?U.delete(L):U.add(L),I.value=U}function k(L){if(L==null)return"";const U=new Date(L);return isNaN(U.getTime())?String(L):U.toLocaleString()}function Y(L){const U=L.author,ne=L.origin;return U&&ne?`${U}(${ne})`:U||(ne?`(${ne})`:"—")}const C=t.ref(null),W=t.ref(!1);function ee(L){C.value=L}async function ae(L){W.value=!0;try{const U=await a.restoreToSeq(L);U.ok||(s.value=a.t("em.history.restoreFailed",{reason:U.reason??a.t("em.history.unknown")}))}finally{W.value=!1,C.value=null}}return(L,U)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("section",jA,[t.createElementVNode("header",KA,[t.createElementVNode("div",YA,[t.createVNode(Me,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",WA,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:U[0]||(U[0]=ne=>d())},[t.createVNode(Me,{name:"redo",size:15})],8,qA),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:U[1]||(U[1]=ne=>i("close"))},[t.createVNode(Me,{name:"panel-close",size:15})],8,XA)])]),t.createElementVNode("div",JA,[t.createElementVNode("label",ZA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(ie.BSSelect),{modelValue:D.value,"onUpdate:modelValue":U[2]||(U[2]=ne=>D.value=ne),items:E,"value-provider":ne=>ne.v,"label-provider":ne=>t.unref(a).t(ne.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",QA,[l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",eT,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",tT,t.toDisplayString(s.value),1)):j.value.length===0?(t.openBlock(),t.createElementBlock("p",nT,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",oT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(j.value,ne=>(t.openBlock(),t.createElementBlock("li",{key:ne.seq,class:t.normalizeClass(["em-history__group",[`is-${ne.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:ue=>le(ne.seq)},[t.createVNode(Me,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":I.value.has(ne.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${ne.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(ne.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",aT,t.toDisplayString(F(ne)),1),t.createElementVNode("span",rT,"#"+t.toDisplayString(ne.seq),1)],8,iT),t.createElementVNode("div",lT,[t.createElementVNode("span",sT,t.toDisplayString(Y(ne)),1),ne.ts?(t.openBlock(),t.createElementBlock("span",cT,t.toDisplayString(k(ne.ts)),1)):t.createCommentVNode("",!0),ne.kind==="restore"&&ne.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",dT,"← #"+t.toDisplayString(ne.restoredFromSeq),1)):t.createCommentVNode("",!0)]),I.value.has(ne.seq)?(t.openBlock(),t.createElementBlock("div",uT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ne.actions,(ue,Ne)=>(t.openBlock(),t.createElementBlock("div",{key:Ne,class:"em-history__action"},[t.createElementVNode("div",mT,[t.createVNode(Me,{name:b[ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",fT,t.toDisplayString(_(ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${ue.verb}`])},t.toDisplayString(t.unref(a).t(N[ue.verb])),3)]),ue.fields.length?(t.openBlock(),t.createElementBlock("ul",pT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ue.fields,(se,me)=>(t.openBlock(),t.createElementBlock("li",{key:me,class:"em-history__field"},[t.createElementVNode("span",hT,t.toDisplayString(se.field),1),se.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",yT,t.toDisplayString(v(se.oldValue)),1)):t.createCommentVNode("",!0),se.oldValue!==void 0?(t.openBlock(),t.createBlock(Me,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",gT,t.toDisplayString(v(se.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&ne.seq!==H.value?(t.openBlock(),t.createElementBlock("div",bT,[C.value===ne.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",_T,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:ue=>ae(ne.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,ET),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:U[3]||(U[3]=ue=>C.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,kT)],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:ue=>ee(ne.seq)},[t.createVNode(Me,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,NT))])):t.createCommentVNode("",!0)],2))),128))]))])],512),[[t.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-45d29598"]]);function vT(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 gf(e){const n=t.ref(vT(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 xT={class:"em-modeler"},IT={class:"em-modeler__body"},CT={class:"em-drawer__inner"},ST={class:"em-drawer__head"},$T={class:"em-drawer__actions"},RT=["title"],AT=["title"],TT=["title"],VT=["title"],MT=["title"],BT=Ge(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(!1),{width:a,dragging:r,startResize:l}=gf({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=gf({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=t.ref(null),m=t.ref(null);return(f,p)=>{var y,g,_;return t.openBlock(),t.createElementBlock("div",xT,[t.createVNode(hf,{controller:e.controller,"history-open":i.value,onExportSvg:p[0]||(p[0]=b=>{var N;return(N=u.value)==null?void 0:N.exportSvg()}),onExportPng:p[1]||(p[1]=b=>{var N;return(N=u.value)==null?void 0:N.exportPng()}),onToggleHistory:p[2]||(p[2]=b=>i.value=!i.value)},null,8,["controller","history-open"]),t.createElementVNode("div",IT,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(a)+"px"})},[t.createElementVNode("div",CT,[t.createElementVNode("header",ST,[p[10]||(p[10]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",$T,[(y=m.value)!=null&&y.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((g=m.value)!=null&&g.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:p[3]||(p[3]=b=>{var N;return(N=m.value)==null?void 0:N.toggleAll()})},[t.createVNode(Me,{name:(_=m.value)!=null&&_.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,RT)):t.createCommentVNode("",!0),t.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:p[4]||(p[4]=b=>n.value=!1)},[t.createVNode(Me,{name:"panel-close",size:16})],8,AT)])]),t.createVNode(pf,{ref_key:"explorer",ref:m,controller:e.controller},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(r)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:p[5]||(p[5]=(...b)=>t.unref(l)&&t.unref(l)(...b))},null,42,TT),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:p[6]||(p[6]=b=>n.value=!0)},[t.createVNode(Me,{name:"panel-open",size:18})],8,VT),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(r),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(a)-6+"px"})},[t.createVNode(ff,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),t.withDirectives(t.createVNode(yf,{controller:e.controller,width:t.unref(s),resizing:t.unref(c),"start-resize":t.unref(d),onCollapse:p[7]||(p[7]=b=>o.value=!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",class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:p[8]||(p[8]=b=>o.value=!0)},[t.createVNode(Me,{name:"panel-right-open",size:18})],8,MT),[[t.vShow,!o.value]])]),_:1}),t.createVNode(wT,{controller:e.controller,open:i.value,onClose:p[9]||(p[9]=b=>i.value=!1)},null,8,["controller","open"])]),t.createVNode(GA,{controller:e.controller,"panel-width":t.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-cce29135"]]);Ee.APPLY_MODEL_OPS_INPUT_SCHEMA=Ph,Ee.AssociationEdge=pm,Ee.CUSTOM_TYPE_VALUE=Rt,Ee.CommandStack=mr,Ee.DEFAULT_JAVA_TYPE=Xa,Ee.DIAGRAM_JSON_FORMAT=tr,Ee.DIAGRAM_JSON_VERSION=nr,Ee.DiagramCanvas=ff,Ee.DiagramExplorer=pf,Ee.EDITOR=Tn,Ee.EditModeToggle=q$,Ee.EditorToolbar=hf,Ee.EntityModeler=BT,Ee.EntityNode=Zu,Ee.GROUP_CODE_ENUM_VALUE=Pn,Ee.GroupNode=Qu,Ee.INHERITED_REF_PREFIX=si,Ee.InvalidDiagramJsonError=fn,Ee.JAVA_TYPES=di,Ee.NoteNode=em,Ee.OpSyncAdapter=yc,Ee.PHYSICAL_NAME_MAX_LENGTH=Eo,Ee.PropertyPanel=yf,Ee.RevCache=hc,Ee.SELECTABLE_JAVA_TYPES=es,Ee.SYMBOLIC_OP_KINDS=gc,Ee.SYMBOLIC_OP_SCHEMA=Sc,Ee.UI_LOCALES=ok,Ee.anchoredEdgePoint=Fa,Ee.buildAgentBatch=zh,Ee.buildDiagramSvg=Tl,Ee.buildOrthogonalPath=La,Ee.buildSelfLoopPath=Ol,Ee.buildStraightPath=za,Ee.collectSharedColumns=un,Ee.commands=rh,Ee.computeAutoLayout=Ll,Ee.createEditorController=cw,Ee.defaultMermaidDialect=Mf,Ee.defaultSqlDialect=rp,Ee.diagramToJson=rs,Ee.displayLabel=ci,Ee.emptyState=Wu,Ee.entityModelToDdl=is,Ee.entityModelToMermaid=Ka,Ee.entityModelToText=Hl,Ee.estimateEntityHeight=zl,Ee.exportDiagramPng=uf,Ee.exportDiagramSvg=df,Ee.fromPersisted=oy,Ee.indexColumnsByModelId=mn,Ee.isInheritedColumnRef=yo,Ee.javaTypeLabel=zn,Ee.makeInheritedColumnRef=Ul,Ee.mergeDiagram=ks,Ee.mermaidErToImportSource=Wl,Ee.migrateLegacyMoney=zp,Ee.newId=De,Ee.orthogonalMidpoints=Pa,Ee.packEntityBoxes=Ga,Ee.parseDiagramJson=ls,Ee.parseInheritedColumnRef=ja,Ee.parseMermaidEr=Yl,Ee.parseSqlDdl=Wa,Ee.physicalNameLengthOverflow=mi,Ee.projectActionLog=Is,Ee.projectEntityAudit=vs,Ee.projectFieldAudit=Qt,Ee.projectInheritedColumns=go,Ee.rectExitPoint=Ua,Ee.renderDiagramSvg=cs,Ee.resolveColumnPhysicalName=fi,Ee.resolveDiagram=Bl,Ee.resolveQuickFix=ir,Ee.resolveSharedColumn=Un,Ee.resolveSymbolicOps=Sh,Ee.restoreDeepEqual=Kn,Ee.scaffoldEntityJava=bp,Ee.segmentMidpoints=Ha,Ee.sharedColumnScopeEntities=ui,Ee.sideDir=ho,Ee.sqlDdlToImportSource=Zl,Ee.synthesizeRestoreOps=Jp,Ee.toPersisted=by,Ee.toPersistedV2=_y,Ee.translate=Ct,Ee.uiMessagesEn=Uu,Ee.uiMessagesJa=Fu,Ee.uiMessagesKo=Hu,Ee.validateModel=os,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})}));
|