@g1cloud/entity-modeler-next 5.2.27 → 5.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(be,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,te){"use strict";var NO=Object.defineProperty;var wO=(be,t,te)=>t in be?NO(be,t,{enumerable:!0,configurable:!0,writable:!0,value:te}):be[t]=te;var dt=(be,t,te)=>wO(be,typeof t!="symbol"?t+"":t,te);const Dy={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Oy(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 Ac(e,n,o={}){const i={...Dy,...o},a=new Map(e.entities.map(g=>[g.modelId,g])),r=new Map(n.entityLayouts.map(g=>[g.entityRef,g])),l=new Map(n.associationLayouts.map(g=>[g.associationRef,g])),s=new Map;for(const g of e.groups)for(const k of g.memberEntityRefs)s.set(k,g.modelId);const c=new Map;for(const g of n.groupLayouts)for(const k of g.memberNoteRefs??[])c.set(k,g.groupRef);let d=0;const u=e.entities.map(g=>{const k=s.get(g.modelId),E=r.get(g.modelId);if(E){const v={location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}};return{entity:g,geo:v,collapsed:E.collapsed??!1,locked:E.locked??!1,groupRef:k,style:E.style,attributeStyles:E.attributeStyles,operationStyles:E.operationStyles}}const b=Oy(d++,i);return{entity:g,geo:b,collapsed:!1,locked:!1,groupRef:k}}),m=new Map(n.groupLayouts.map(g=>[g.groupRef,g])),p=e.groups.map(g=>{const k=m.get(g.modelId),E=k?{location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:E,style:k==null?void 0:k.style,locked:(k==null?void 0:k.locked)??!1}}),f=e.associations.map(g=>{const k=l.get(g.modelId);return{association:g,waypoints:(k==null?void 0:k.waypoints)??[],sourceColumnRef:k==null?void 0:k.sourceColumnRef,targetColumnRef:k==null?void 0:k.targetColumnRef}}),h=n.notes.map(g=>({note:{...g,geo:{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}},groupRef:c.get(g.modelId)})),_=[];for(const g of n.notes)for(const k of g.connections??[])a.has(k.targetRef)&&_.push({noteRef:g.modelId,targetRef:k.targetRef,waypoints:k.waypoints.map(E=>({x:E.x,y:E.y}))});return{entities:u,associations:f,groups:p,notes:h,noteConnections:_}}const Py={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function $c(e,n,o={}){const i={...Py,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),p=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const h=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((_,g)=>{const k=g%h,E=Math.floor(g/h);r.push({id:_,location:{x:p.x+i.pad+k*i.cellWidth,y:p.y+i.pad+i.headerHeight+E*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const p=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+f*i.cellHeight}})}),r}const Tc={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function zy(e,n={}){const o={...Tc,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function el(e,n={}){const o={...Tc,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=zy(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function io(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function Mc(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const Fy={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity",SERIALIZED_TYPE:"Serialized"};function yi(e){return Fy[e]??e}function at(e){return e==="JPA_EMBEDDABLE"||e==="SERIALIZED_TYPE"}function cn(e){return e==="SERIALIZED_TYPE"}const ma="inherited:";function Vc(e,n){return`${ma}${e}:${n}`}function ao(e){return e.startsWith(ma)}function tl(e){if(!ao(e))return null;const n=e.slice(ma.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 gi(e,n){var a;if(at(e.stereotype))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:Vc(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 fa(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Nn(e){return e.attrType==="RELATION_OWN"&&e.dbAttrs.length>1}function nl(e){const n=new Set;for(const o of e)o.end2.attributeRef&&n.add(o.end2.attributeRef),o.end1.attributeRef&&o.end1.navigable&&n.add(o.end1.attributeRef);return n}function ol(e,n,o){var a;if(e.attrType!=="RELATION_OWN"||o.has(e.modelId))return!1;const i=(a=e.derivedFrom)==null?void 0:a.associationRef;return i?n.attributes.some(r=>{var l;return r.modelId!==e.modelId&&r.attrType==="RELATION_OWN"&&((l=r.derivedFrom)==null?void 0:l.associationRef)===i&&o.has(r.modelId)}):!1}function pa(e,n,o,i,a=0){var d;if(!fa(e))return;const r=i.find(u=>u.end1.attributeRef===e.modelId||u.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(u=>u.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(d=e.derivedFrom)==null?void 0:d.sourceAttributeRef;if(c){const u=s==null?void 0:s.attributes.find(m=>m.modelId===c);if(u!=null&&u.dbAttrs[a])return u.dbAttrs[a];if(u)return Un(s)[a];for(const m of o){const p=m.attributes.find(f=>f.modelId===c);if(p)return p.dbAttrs[a]??Un(s)[a]}}if(s)return Un(s)[a]}function il(e){return e.identifier?e.attrType==="NORMAL"||e.attrType==="RELATION_OWN"?!0:Lc(e):!1}function Lc(e){return e.identifier===!0&&(e.attrType==="EMBED_PREDEF"||e.attrType==="EMBED_OWN")&&e.dbAttrs.length>0}function Un(e){return((e==null?void 0:e.attributes)??[]).filter(il).slice().sort((n,o)=>n.order-o.order).flatMap(n=>n.dbAttrs)}const ha=["ko","en","ja","zh"],al=e=>e==null||e.trim()==="";function Hn(e){return e!=null&&Object.values(e).some(n=>!al(n))}function Bc(e){if(e==null)return;const n=Object.keys(e),o=n.filter(a=>!al(e[a]));if(o.length===0)return;if(o.length===n.length)return e;const i={};for(const a of o)i[a]=e[a];return i}function Mt(e,n){if(e==null)return;const o=n?[n,...ha.filter(i=>i!==n)]:ha;for(const i of o){const a=e[i];if(!al(a))return a}}function Uy(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=Dc(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function wn(e,n){return Dc(e,n,new Set)}function Dc(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=Uy(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const Hy=e=>e==null||e.trim()==="";function Oc(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=wn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return pa(e,o,i.entities,i.associations,n)}function Bt(e,n,o,i,a,r){const l=Oc(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:Hn(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function ro(e,n){return((n==null?void 0:n.notNull)??e.notNull)===!0}function In(e){var n,o;return Hn((n=e.table)==null?void 0:n.logicalName)?(o=e.table)==null?void 0:o.logicalName:e.classLogicalName}function Fo(e,n){return Hn(n==null?void 0:n.logicalName)?n==null?void 0:n.logicalName:e.fieldLogicalName}function bi(e,n,o,i,a,r){var l;return Hy(n.physicalName)?((l=Oc(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Pc(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let p=0;p<m.dbAttrs.length;p++){if(u===n)return m.name||void 0;u++}}}function rl(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function vn(e,n){return rl(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function lo(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function so(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function Uo(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function jy(e,n,o){const i=Uo(e,o),a=Uo(n,o);return i.kind===a.kind&&i.value!==a.value}function Ho(e){const n=new Map;for(const o of e.entities){if(o.stereotype!=="SERIALIZED_TYPE"||!o.name)continue;const i=n.get(o.name);i?i.push(o):n.set(o.name,[o])}return n}function zc(e,n){var i,a;const o=(i=n==null?void 0:n.serialization)==null?void 0:i.collectionType;if(!o)return e;if(o==="MAP"){const r=(a=n==null?void 0:n.serialization)==null?void 0:a.mapKeyType;return`Map<${r&&r.trim()?r.slice(r.lastIndexOf(".")+1):"?"}, ${e}>`}return`${o==="SET"?"Set":"List"}<${e}>`}function _i(e,n,o,i){if(n.size===0)return{kind:"none"};const a=n.has(e.type)?e.type:e.customType&&n.has(e.customType)?e.customType:void 0;if(!a)return{kind:"none"};const r=n.get(a);if(r.length===1)return{kind:"resolved",entity:r[0]};if(o&&i){const l=Uo(o,i),s=r.filter(c=>{const d=Uo(c,i);return d.kind===l.kind&&d.value===l.value});if(s.length===1)return{kind:"resolved",entity:s[0]}}return{kind:"ambiguous",name:a,candidates:r}}const Fc=["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"],Ky=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"]),Gy=Fc.filter(e=>!Ky.has(e)),Yy={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function ll(e){return Yy[e]??e}const qy=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),sl=new Set(["NUMERIC","DECIMAL"]),cl=new Set(["TINYINT","SMALLINT","INTEGER","BIGINT","FLOAT","REAL","DOUBLE","NUMERIC","DECIMAL","SERIAL","BIG_SERIAL"]);function Uc(e,n=Gy){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const dn="CustomType";function Hc(e){var o;if(e.type!==dn)return;const n=(o=e.customType)==null?void 0:o.trim();return n||void 0}const jn="GroupCodeEnum",dl="String",ki=[{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:jn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:dn,label:"CustomType"}],Wy=new Map(ki.map(e=>[e.value,e.label]));function jo(e){return Wy.get(e)??e}const Jy={TINYINT:"Short",SMALLINT:"Short",INTEGER:"Integer",BIGINT:"Long",SERIAL:"Integer",BIG_SERIAL:"Long",FLOAT:"Double",REAL:"Double",DOUBLE:"Double",NUMERIC:"BigDecimal",DECIMAL:"BigDecimal",CHAR:"String",VARCHAR:"String",LONGVARCHAR:"String",NCHAR:"String",NVARCHAR:"String",LONGNVARCHAR:"String",CLOB:"String",NCLOB:"String",BIT:"Boolean",BOOLEAN:"Boolean",DATE:"LocalDate",TIMESTAMP:"LocalDateTime",TIMESTAMP_WITH_TIMEZONE:"OffsetDateTime",BINARY:"ByteArray",VARBINARY:"ByteArray",LONGVARBINARY:"ByteArray",BLOB:"ByteArray"};function jc(e){if(e)return Jy[e.toUpperCase()]}const Xy={String:new Set(["VARCHAR","CHAR","LONGVARCHAR","CLOB","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","JSONB"]),CharacterArray:new Set(["CHAR","VARCHAR","LONGVARCHAR","CLOB"]),Integer:new Set(["INTEGER","SERIAL","SMALLINT","NUMERIC","DECIMAL"]),Long:new Set(["BIGINT","BIG_SERIAL","NUMERIC","DECIMAL"]),Short:new Set(["SMALLINT","TINYINT","NUMERIC","DECIMAL"]),Double:new Set(["DOUBLE","FLOAT","REAL","NUMERIC","DECIMAL"]),BigDecimal:new Set(["NUMERIC","DECIMAL"]),BigInteger:new Set(["NUMERIC","DECIMAL","BIGINT"]),Boolean:new Set(["BOOLEAN","BIT","CHAR","VARCHAR"]),Date:new Set(["DATE","TIME","TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),LocalDate:new Set(["DATE"]),LocalDateTime:new Set(["TIMESTAMP"]),Instant:new Set(["TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),ZonedDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),OffsetDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),ByteArray:new Set(["BINARY","VARBINARY","LONGVARBINARY","BLOB"]),Currency:new Set(["VARCHAR","CHAR"]),[jn]:new Set(["VARCHAR","CHAR"])},Kc=new Map(ki.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function Zy(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!Fc.includes(i))return;const a=Kc.get(o)??o,r=Xy[a];if(r)return r.has(i)}function Qy(e){return e?Kc.get(e):void 0}function Gc(e,n,o){return o||n!=="VARCHAR"?null:e==="PrimitiveBoolean"?"primitive":e==="Boolean"?"boxed":null}const eg=new Set(["PrimitiveInt","PrimitiveLong","PrimitiveDouble","PrimitiveShort"]);function tg(e,n,o){return o||!e?!1:eg.has(e)?!0:e==="PrimitiveBoolean"?Gc(e,n,o)==null:!1}const ng=new Set([jn,"CustomMoneyType"]),Yc=ki.filter(e=>!ng.has(e.value)).map(e=>e.value===dn?{...e,label:"CustomType (사용자정의)"}:e);function qc(e,n=[],o=[],i=[]){const a=n.map(c=>{const d=Mt(c.label);return{value:c.type,label:d?`${c.type} (${d})`:c.type}}),r=o.map(c=>({value:c,label:c})),l=i.map(c=>{const d=Mt(c.label);return{value:c.type,label:d?`${c.type} (${d})`:c.type}}),s=[...Yc,...a,...r,...l];return e&&!s.some(c=>c.value===e)?[{value:e,label:jo(e)},...s]:s}function ul(e){return e.attrType==="EMBED_PREDEF"?"structural":e.attrType==="EMBED_OWN"||e.attrType==="EMBED_REF"?"association":e.attrType.startsWith("RELATION")?"derived":"own"}function Wc(e,n,o){return n===e.type?!1:ul(e)!=="own"||o.some(i=>i.type===n)}function ml(e,n){return e===jn!=!!n}function Jc(e,n){return{...e,dataType:n.dataType,length:n.length,scale:n.scale}}function og(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Ei(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 fl(e,n,o,i,a){var r;if(n.attrType==="DIVIDER"||e==="LOGICAL")return"";if((e==="CLASS"||Nn(n))&&n.attrType.startsWith("RELATION")&&i)return o?`${o==="SET"?"Set":"List"}<${i}>`:i;if(o&&n.attrType.startsWith("EMBED"))return`${o==="SET"?"Set":"List"}<${jo(n.type)}>`;if(og(n))return jo(n.type);if(e==="CLASS"){const l=Hc(n)??jo(n.type);return a?zc(l,a):l}return ll(((r=n.dbAttrs[0])==null?void 0:r.dataType)??"")}function ya(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const Xc="(미지정)",ig="(이름 없음)",ga=e=>e==null||String(e).trim()==="",ba=e=>ga(e)?ig:String(e),Zc=e=>ga(e)?Xc:String(e);function Qc(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}return Xc}function ed(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=ga(n)?Zc(e.physicalName):String(n),a=ga(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function _a(e,n){const o=(Mt(e)??Mt(n)??"").trim();return o?` «${o}»`:""}function td(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function nd(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(Mt(c.name)??c.modelId));const a=[];for(const c of e.entities){const d=(r=c.table)!=null&&r.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${ba(c.name)}${d} «${yi(c.stereotype)}»${u?` [${u}]`:""}${_a(In(c))}`);const m=lo(vn(c,e.entities)),p=g=>{var k;return g.sharedColumnRef?(k=so(g,m))==null?void 0:k.physicalName:void 0},f=[...c.attributes].sort((g,k)=>g.order-k.order);for(const g of f){if(g.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${g.name?` ${g.name} ${"─".repeat(8)}`:""}`);continue}const k=g.dbAttrs.map((z,T)=>Bt(g,z,T,c,e,n)),E=[g.identifier?"PK":"",g.notNull&&!cn(c.stereotype)?"NOT NULL":"",(l=g.defaultValue)!=null&&l.trim()?`default=${g.defaultValue.trim()}`:""].filter(Boolean),b=_i(g,Ho(e),c,e),v=Hc(g)??g.type,y=b.kind==="resolved"?zc(v,b.entity):Zc(v),S=` - ${ba(g.name)}: ${y}`,$=z=>z.length?` {${z.join(", ")}}`:"";if(k.length>1){a.push(`${S}${$(E)}${_a(void 0,g.description)}`),k.forEach((z,T)=>{const x=Pc(g,T,e,n);a.push(` · ${x?`${x} → `:""}${ed(z,p(z))}${$(td(z))}${_a(z.logicalName)}`)});continue}const O=k[0],B=O?` → ${ed(O,p(O))}`:"";a.push(`${S}${B}${$([...E,...O?td(O):[]])}${_a(Fo(g,O),g.description)}`)}const h=io(c.attributes);for(const g of c.indexes??[]){const k=g.columns.map(E=>{var b,v;return`${((b=h.attributeOf(E.columnRef))==null?void 0:b.name)??((v=tl(E.columnRef))==null?void 0:v.field)??E.columnRef}${E.descending?" DESC":""}`}).join(", ");a.push(` index ${ba(g.name)}${g.unique?" UNIQUE":""}: ${k}`)}const _=[...c.operations??[]].sort((g,k)=>g.order-k.order);for(const g of _){const k=g.visibility?` {${g.visibility}}`:"",E=(s=g.description)!=null&&s.ko?` — ${g.description.ko}`:"";a.push(` method ${ba(g.name)}()${k}${E}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Qc(c.end1.multiplicity)} —— ${Qc(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
1
+ (function(be,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,te){"use strict";var NO=Object.defineProperty;var wO=(be,t,te)=>t in be?NO(be,t,{enumerable:!0,configurable:!0,writable:!0,value:te}):be[t]=te;var dt=(be,t,te)=>wO(be,typeof t!="symbol"?t+"":t,te);const Dy={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Oy(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 Ac(e,n,o={}){const i={...Dy,...o},a=new Map(e.entities.map(g=>[g.modelId,g])),r=new Map(n.entityLayouts.map(g=>[g.entityRef,g])),l=new Map(n.associationLayouts.map(g=>[g.associationRef,g])),s=new Map;for(const g of e.groups)for(const k of g.memberEntityRefs)s.set(k,g.modelId);const c=new Map;for(const g of n.groupLayouts)for(const k of g.memberNoteRefs??[])c.set(k,g.groupRef);let d=0;const u=e.entities.map(g=>{const k=s.get(g.modelId),E=r.get(g.modelId);if(E){const v={location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}};return{entity:g,geo:v,collapsed:E.collapsed??!1,locked:E.locked??!1,groupRef:k,style:E.style,attributeStyles:E.attributeStyles,operationStyles:E.operationStyles}}const b=Oy(d++,i);return{entity:g,geo:b,collapsed:!1,locked:!1,groupRef:k}}),m=new Map(n.groupLayouts.map(g=>[g.groupRef,g])),p=e.groups.map(g=>{const k=m.get(g.modelId),E=k?{location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:E,style:k==null?void 0:k.style,locked:(k==null?void 0:k.locked)??!1}}),f=e.associations.map(g=>{const k=l.get(g.modelId);return{association:g,waypoints:(k==null?void 0:k.waypoints)??[],sourceColumnRef:k==null?void 0:k.sourceColumnRef,targetColumnRef:k==null?void 0:k.targetColumnRef}}),h=n.notes.map(g=>({note:{...g,geo:{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}},groupRef:c.get(g.modelId)})),_=[];for(const g of n.notes)for(const k of g.connections??[])a.has(k.targetRef)&&_.push({noteRef:g.modelId,targetRef:k.targetRef,waypoints:k.waypoints.map(E=>({x:E.x,y:E.y}))});return{entities:u,associations:f,groups:p,notes:h,noteConnections:_}}const Py={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function $c(e,n,o={}){const i={...Py,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),p=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const h=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((_,g)=>{const k=g%h,E=Math.floor(g/h);r.push({id:_,location:{x:p.x+i.pad+k*i.cellWidth,y:p.y+i.pad+i.headerHeight+E*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const p=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+f*i.cellHeight}})}),r}const Tc={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function zy(e,n={}){const o={...Tc,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function el(e,n={}){const o={...Tc,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=zy(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function io(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function Mc(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const Fy={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity",SERIALIZED_TYPE:"Serialized"};function yi(e){return Fy[e]??e}function at(e){return e==="JPA_EMBEDDABLE"||e==="SERIALIZED_TYPE"}function cn(e){return e==="SERIALIZED_TYPE"}const ma="inherited:";function Vc(e,n){return`${ma}${e}:${n}`}function ao(e){return e.startsWith(ma)}function tl(e){if(!ao(e))return null;const n=e.slice(ma.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 gi(e,n){var a;if(at(e.stereotype))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:Vc(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 fa(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Nn(e){return e.attrType==="RELATION_OWN"&&e.dbAttrs.length>1}function nl(e){const n=new Set;for(const o of e)o.end2.attributeRef&&n.add(o.end2.attributeRef),o.end1.attributeRef&&o.end1.navigable&&n.add(o.end1.attributeRef);return n}function ol(e,n,o){var a;if(e.attrType!=="RELATION_OWN"||o.has(e.modelId))return!1;const i=(a=e.derivedFrom)==null?void 0:a.associationRef;return i?n.attributes.some(r=>{var l;return r.modelId!==e.modelId&&r.attrType==="RELATION_OWN"&&((l=r.derivedFrom)==null?void 0:l.associationRef)===i&&o.has(r.modelId)}):!1}function pa(e,n,o,i,a=0){var d;if(!fa(e))return;const r=i.find(u=>u.end1.attributeRef===e.modelId||u.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(u=>u.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(d=e.derivedFrom)==null?void 0:d.sourceAttributeRef;if(c){const u=s==null?void 0:s.attributes.find(m=>m.modelId===c);if(u!=null&&u.dbAttrs[a])return u.dbAttrs[a];if(u)return Un(s)[a];for(const m of o){const p=m.attributes.find(f=>f.modelId===c);if(p)return p.dbAttrs[a]??Un(s)[a]}}if(s)return Un(s)[a]}function il(e){return e.identifier?e.attrType==="NORMAL"||e.attrType==="RELATION_OWN"?!0:Lc(e):!1}function Lc(e){return e.identifier===!0&&(e.attrType==="EMBED_PREDEF"||e.attrType==="EMBED_OWN")&&e.dbAttrs.length>0}function Un(e){return((e==null?void 0:e.attributes)??[]).filter(il).slice().sort((n,o)=>n.order-o.order).flatMap(n=>n.dbAttrs)}const ha=["ko","en","ja","zh"],al=e=>e==null||e.trim()==="";function Hn(e){return e!=null&&Object.values(e).some(n=>!al(n))}function Bc(e){if(e==null)return;const n=Object.keys(e),o=n.filter(a=>!al(e[a]));if(o.length===0)return;if(o.length===n.length)return e;const i={};for(const a of o)i[a]=e[a];return i}function Mt(e,n){if(e==null)return;const o=n?[n,...ha.filter(i=>i!==n)]:ha;for(const i of o){const a=e[i];if(!al(a))return a}}function Uy(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=Dc(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function wn(e,n){return Dc(e,n,new Set)}function Dc(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=Uy(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const Hy=e=>e==null||e.trim()==="";function Oc(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=wn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return pa(e,o,i.entities,i.associations,n)}function Bt(e,n,o,i,a,r){const l=Oc(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:Hn(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function ro(e,n){return((n==null?void 0:n.notNull)??e.notNull)===!0}function In(e){var n,o;return Hn((n=e.table)==null?void 0:n.logicalName)?(o=e.table)==null?void 0:o.logicalName:e.classLogicalName}function Fo(e,n){return Hn(n==null?void 0:n.logicalName)?n==null?void 0:n.logicalName:e.fieldLogicalName}function bi(e,n,o,i,a,r){var l;return Hy(n.physicalName)?((l=Oc(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Pc(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let p=0;p<m.dbAttrs.length;p++){if(u===n)return m.name||void 0;u++}}}function rl(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function vn(e,n){return rl(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function lo(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function so(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function Uo(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function jy(e,n,o){const i=Uo(e,o),a=Uo(n,o);return i.kind===a.kind&&i.value!==a.value}function Ho(e){const n=new Map;for(const o of e.entities){if(o.stereotype!=="SERIALIZED_TYPE"||!o.name)continue;const i=n.get(o.name);i?i.push(o):n.set(o.name,[o])}return n}function zc(e,n){var i,a;const o=(i=n==null?void 0:n.serialization)==null?void 0:i.collectionType;if(!o)return e;if(o==="MAP"){const r=(a=n==null?void 0:n.serialization)==null?void 0:a.mapKeyType;return`Map<${r&&r.trim()?r.slice(r.lastIndexOf(".")+1):"?"}, ${e}>`}return`${o==="SET"?"Set":"List"}<${e}>`}function _i(e,n,o,i){if(n.size===0)return{kind:"none"};const a=n.has(e.type)?e.type:e.customType&&n.has(e.customType)?e.customType:void 0;if(!a)return{kind:"none"};const r=n.get(a);if(r.length===1)return{kind:"resolved",entity:r[0]};if(o&&i){const l=Uo(o,i),s=r.filter(c=>{const d=Uo(c,i);return d.kind===l.kind&&d.value===l.value});if(s.length===1)return{kind:"resolved",entity:s[0]}}return{kind:"ambiguous",name:a,candidates:r}}const Fc=["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"],Ky=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"]),Gy=Fc.filter(e=>!Ky.has(e)),Yy={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function ll(e){return Yy[e]??e}const qy=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),sl=new Set(["NUMERIC","DECIMAL"]),cl=new Set(["TINYINT","SMALLINT","INTEGER","BIGINT","FLOAT","REAL","DOUBLE","NUMERIC","DECIMAL","SERIAL","BIG_SERIAL"]);function Uc(e,n=Gy){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const dn="CustomType";function Hc(e){var o;if(e.type!==dn)return;const n=(o=e.customType)==null?void 0:o.trim();return n||void 0}const jn="GroupCodeEnum",dl="String",ki=[{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:jn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:dn,label:"CustomType"}],Wy=new Map(ki.map(e=>[e.value,e.label]));function jo(e){return Wy.get(e)??e}const Jy={TINYINT:"Short",SMALLINT:"Short",INTEGER:"Integer",BIGINT:"Long",SERIAL:"Integer",BIG_SERIAL:"Long",FLOAT:"Double",REAL:"Double",DOUBLE:"Double",NUMERIC:"BigDecimal",DECIMAL:"BigDecimal",CHAR:"String",VARCHAR:"String",LONGVARCHAR:"String",NCHAR:"String",NVARCHAR:"String",LONGNVARCHAR:"String",CLOB:"String",NCLOB:"String",BIT:"Boolean",BOOLEAN:"Boolean",DATE:"LocalDate",TIMESTAMP:"LocalDateTime",TIMESTAMP_WITH_TIMEZONE:"OffsetDateTime",BINARY:"ByteArray",VARBINARY:"ByteArray",LONGVARBINARY:"ByteArray",BLOB:"ByteArray"};function jc(e){if(e)return Jy[e.toUpperCase()]}const Xy={String:new Set(["VARCHAR","CHAR","LONGVARCHAR","CLOB","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","JSONB"]),CharacterArray:new Set(["CHAR","VARCHAR","LONGVARCHAR","CLOB"]),Integer:new Set(["INTEGER","SERIAL","SMALLINT","NUMERIC","DECIMAL"]),Long:new Set(["BIGINT","BIG_SERIAL","NUMERIC","DECIMAL"]),Short:new Set(["SMALLINT","TINYINT","NUMERIC","DECIMAL"]),Double:new Set(["DOUBLE","FLOAT","REAL","NUMERIC","DECIMAL"]),BigDecimal:new Set(["NUMERIC","DECIMAL"]),BigInteger:new Set(["NUMERIC","DECIMAL","BIGINT"]),Boolean:new Set(["BOOLEAN","BIT","CHAR","VARCHAR"]),Date:new Set(["DATE","TIME","TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),LocalDate:new Set(["DATE"]),LocalDateTime:new Set(["TIMESTAMP"]),Instant:new Set(["TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),ZonedDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),OffsetDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),ByteArray:new Set(["BINARY","VARBINARY","LONGVARBINARY","BLOB"]),Currency:new Set(["VARCHAR","CHAR"]),[jn]:new Set(["VARCHAR","CHAR"])},Kc=new Map(ki.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function Zy(e,n,o){const i=e==null?void 0:e.trim(),a=n==null?void 0:n.trim();if(!i||!a||!Fc.includes(a))return;const r=Kc.get(i)??i,l=Xy[r];if(l)return l.has(a);const s=o==null?void 0:o.find(c=>c.type===i);if(s!=null&&s.dataType)return s.dataType.trim()===a}function Qy(e){return e?Kc.get(e):void 0}function Gc(e,n,o){return o||n!=="VARCHAR"?null:e==="PrimitiveBoolean"?"primitive":e==="Boolean"?"boxed":null}const eg=new Set(["PrimitiveInt","PrimitiveLong","PrimitiveDouble","PrimitiveShort"]);function tg(e,n,o){return o||!e?!1:eg.has(e)?!0:e==="PrimitiveBoolean"?Gc(e,n,o)==null:!1}const ng=new Set([jn,"CustomMoneyType"]),Yc=ki.filter(e=>!ng.has(e.value)).map(e=>e.value===dn?{...e,label:"CustomType (사용자정의)"}:e);function qc(e,n=[],o=[],i=[]){const a=n.map(c=>{const d=Mt(c.label);return{value:c.type,label:d?`${c.type} (${d})`:c.type}}),r=o.map(c=>({value:c,label:c})),l=i.map(c=>{const d=Mt(c.label);return{value:c.type,label:d?`${c.type} (${d})`:c.type}}),s=[...Yc,...a,...r,...l];return e&&!s.some(c=>c.value===e)?[{value:e,label:jo(e)},...s]:s}function ul(e){return e.attrType==="EMBED_PREDEF"?"structural":e.attrType==="EMBED_OWN"||e.attrType==="EMBED_REF"?"association":e.attrType.startsWith("RELATION")?"derived":"own"}function Wc(e,n,o){return n===e.type?!1:ul(e)!=="own"||o.some(i=>i.type===n)}function ml(e,n){return e===jn!=!!n}function Jc(e,n){return{...e,dataType:n.dataType,length:n.length,scale:n.scale}}function og(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Ei(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 fl(e,n,o,i,a){var r;if(n.attrType==="DIVIDER"||e==="LOGICAL")return"";if((e==="CLASS"||Nn(n))&&n.attrType.startsWith("RELATION")&&i)return o?`${o==="SET"?"Set":"List"}<${i}>`:i;if(o&&n.attrType.startsWith("EMBED"))return`${o==="SET"?"Set":"List"}<${jo(n.type)}>`;if(og(n))return jo(n.type);if(e==="CLASS"){const l=Hc(n)??jo(n.type);return a?zc(l,a):l}return ll(((r=n.dbAttrs[0])==null?void 0:r.dataType)??"")}function ya(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const Xc="(미지정)",ig="(이름 없음)",ga=e=>e==null||String(e).trim()==="",ba=e=>ga(e)?ig:String(e),Zc=e=>ga(e)?Xc:String(e);function Qc(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}return Xc}function ed(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=ga(n)?Zc(e.physicalName):String(n),a=ga(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function _a(e,n){const o=(Mt(e)??Mt(n)??"").trim();return o?` «${o}»`:""}function td(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function nd(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(Mt(c.name)??c.modelId));const a=[];for(const c of e.entities){const d=(r=c.table)!=null&&r.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${ba(c.name)}${d} «${yi(c.stereotype)}»${u?` [${u}]`:""}${_a(In(c))}`);const m=lo(vn(c,e.entities)),p=g=>{var k;return g.sharedColumnRef?(k=so(g,m))==null?void 0:k.physicalName:void 0},f=[...c.attributes].sort((g,k)=>g.order-k.order);for(const g of f){if(g.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${g.name?` ${g.name} ${"─".repeat(8)}`:""}`);continue}const k=g.dbAttrs.map((z,T)=>Bt(g,z,T,c,e,n)),E=[g.identifier?"PK":"",g.notNull&&!cn(c.stereotype)?"NOT NULL":"",(l=g.defaultValue)!=null&&l.trim()?`default=${g.defaultValue.trim()}`:""].filter(Boolean),b=_i(g,Ho(e),c,e),v=Hc(g)??g.type,y=b.kind==="resolved"?zc(v,b.entity):Zc(v),S=` - ${ba(g.name)}: ${y}`,$=z=>z.length?` {${z.join(", ")}}`:"";if(k.length>1){a.push(`${S}${$(E)}${_a(void 0,g.description)}`),k.forEach((z,T)=>{const x=Pc(g,T,e,n);a.push(` · ${x?`${x} → `:""}${ed(z,p(z))}${$(td(z))}${_a(z.logicalName)}`)});continue}const O=k[0],B=O?` → ${ed(O,p(O))}`:"";a.push(`${S}${B}${$([...E,...O?td(O):[]])}${_a(Fo(g,O),g.description)}`)}const h=io(c.attributes);for(const g of c.indexes??[]){const k=g.columns.map(E=>{var b,v;return`${((b=h.attributeOf(E.columnRef))==null?void 0:b.name)??((v=tl(E.columnRef))==null?void 0:v.field)??E.columnRef}${E.descending?" DESC":""}`}).join(", ");a.push(` index ${ba(g.name)}${g.unique?" UNIQUE":""}: ${k}`)}const _=[...c.operations??[]].sort((g,k)=>g.order-k.order);for(const g of _){const k=g.visibility?` {${g.visibility}}`:"",E=(s=g.description)!=null&&s.ko?` — ${g.description.ko}`:"";a.push(` method ${ba(g.name)}()${k}${E}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Qc(c.end1.multiplicity)} —— ${Qc(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
2
2
  `).trim()}function co(e){return e.referenceOnly===!0}function pl(e){const n=new Set;for(const o of e.entities)co(o)&&n.add(o.modelId);return n}function od(e){return e.entities.filter(n=>!co(n))}function id(e,n=pl(e)){return n.size===0?e.associations:e.associations.filter(o=>!n.has(o.end1.entityRef)&&!n.has(o.end2.entityRef))}function hl(e,n){return n?{...e,entities:e.entities.map(o=>o.referenceOnly?o:{...o,referenceOnly:!0})}:e}function ag(e,n){return co(e)||n===!0}const rg=e=>e&&e[0].toLowerCase()+e.slice(1);function ka(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function ad(e){return e!=="EXACTLY_ONE_INSTANCE"&&e!=="ONE_OR_MORE_INSTANCES"}function Ea(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function lg(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function Na(e,n){const o=rg(e);return n?lg(o):o}function uo(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function sg(e){return e==="CLASS"?"class":"er"}function yl(e,n,o){const i=cg(e);return n==="class"?yg(i):fg(i,o)}function cg(e){const n=pl(e);return n.size===0?e:{...e,entities:od(e),associations:id(e,n)}}function Ni(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function gl(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function rd(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=Ni(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 dg(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const ld=Ea;function bl(e){return e!=null&&sd[e]!=null}const sd={NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"};function cd(e,n){const o={NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"},i=bl(e)?e:"ZERO_OR_MORE_INSTANCES";return(n==="left"?sd:o)[i]}function ug(e,n,o,i){if(e.dbAttrs.length===0)return[];const a=[];return e.dbAttrs.forEach((r,l)=>{var p;const s=Bt(e,r,l,n,o,i);if(s.sharedColumnRef!=null)return;const c=l===0?e.name:Pc(e,l,o,i),d=Ni(s.dataType||e.type,"unknown"),u=Ni(s.physicalName||c,"col"),m=s.length?`(${s.length}${s.scale!=null?`,${s.scale}`:""})`:"";a.push(mg(d,u,e,s.unique===!0,m,(p=s.logicalName)==null?void 0:p.ko))}),a}function mg(e,n,o,i,a,r){const l=[o.identifier?"PK":"",dg(o)?"FK":"",i?"UK":""].filter(Boolean).join(", "),s=gl([r,a].filter(Boolean).join(" ")),c=[` ${e} ${n}`];return l&&c.push(l),c.join(" ")+(s?` "${s}"`:"")}function fg(e,n){const o=rd(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),i=["erDiagram"];for(const r of e.entities){const l=o.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){i.push(` ${l}`);continue}i.push(` ${l} {`);for(const c of s)for(const d of ug(c,r,e,n))i.push(d);i.push(" }")}const a=[];for(const r of e.associations){const l=o.get(r.end1.entityRef),s=o.get(r.end2.entityRef);if(!l||!s)continue;const c=`${cd(r.end1.multiplicity,"left")}--${cd(r.end2.multiplicity,"right")}`,d=gl(r.description);i.push(` ${l} ${c} ${s} : "${d}"`),(!bl(r.end1.multiplicity)||!bl(r.end2.multiplicity))&&a.push(`${l} -- ${s}`)}if(a.length>0){i.push(`%% ⚠ 다중성 미지정 ${a.length}건 — 0..*(가장 약한 주장)로 표기함. 모델을 정정할 지점:`);for(const r of a)i.push(`%% ${r}`)}return i.join(`
3
3
  `)}function pg(e){return e&&e!=="UNDEFINED"?yi(e):null}function hg(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function yg(e){const n=rd(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=pg(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(` +${hg(c.type)} ${Ni(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${Ni(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=gg(i),s=gl(i.description),c=` ${a} "${ld(i.end1.multiplicity)}" ${l} "${ld(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
4
  `)}function gg(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Le(){return crypto.randomUUID()}const bg={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},_g={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function kg(e,n,o){var a,r;if(!o.size)return;const i=new Map(e.map(l=>[l.modelId,l]));for(const l of e){const s=l.attributes.filter(d=>o.has(d.modelId));if(!s.length)continue;const c=n.filter(d=>d.end2.entityRef===l.modelId).map(d=>({assoc:d,parent:i.get(d.end1.entityRef)})).filter(d=>d.parent!=null);if(c.length)for(const d of s){const u=(a=d.dbAttrs[0])==null?void 0:a.physicalName,m=(f,h)=>f.attributes.find(_=>{var g;return _.identifier&&(h==null||((g=_.dbAttrs[0])==null?void 0:g.physicalName)===h)});let p=c.length===1?c[0]:void 0;if(!p){const f=c.filter(h=>m(h.parent,u)!=null);f.length===1&&(p=f[0])}p&&(d.attrType="RELATION_OWN",d.derivedFrom={associationRef:p.assoc.modelId,sourceAttributeRef:((r=m(p.parent,u)??m(p.parent))==null?void 0:r.modelId)??""},p.assoc.end2.attributeRef||(p.assoc.end2.attributeRef=d.modelId))}}}function Eg(e,n){let o=e,i;const a=o.match(/"([^"]*)"\s*$/);a&&(i=a[1],o=o.slice(0,a.index).trim());const r=o.split(/\s+/).filter(Boolean);if(r.length<2)return null;const l=r[0],s=r[1],c=new Set(r.slice(2).join(" ").split(",").map(h=>h.trim()).filter(Boolean));let d,u,m;if(i!=null){const h=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(h){d=Number(h[1]),h[2]!=null&&(u=Number(h[2]));const _=i.slice(0,h.index).trim();_&&(m=_)}else i.trim()&&(m=i.trim())}const p={modelId:Le(),physicalName:s,dataType:l};return d!=null&&(p.length=d),u!=null&&(p.scale=u),c.has("UK")&&(p.unique=!0),m&&(p.logicalName={ko:m}),{attr:{modelId:Le(),name:s,type:jc(l)??"",attrType:"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[p]},foreignKey:c.has("FK")}}function dd(e){const n=e.split(`
@@ -20,7 +20,7 @@ ${S}
20
20
  -- ⚠ @OrderColumn "${p}": 타입 근거가 모델에 없어 컬럼 생략(임베더블 속성으로 선언하면 방출됨)`:"";o.createStmts.push(`CREATE TABLE ${c} (
21
21
  ${m.join(`,
22
22
  `)}${h}
23
- );`);const _=Go(r);o.alterStmts.push(`ALTER TABLE ${c} ADD CONSTRAINT fk_${c}_${_} FOREIGN KEY (${d.map(g=>g.name).join(", ")}) REFERENCES ${_} (${d.map(g=>g.name).join(", ")});`)}}function Og(e,n){const o=n.associations.find(i=>{var a;return i.modelId===((a=e.embedded)==null?void 0:a.associationRef)});if(!(!o||!e.embedded))return o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1}function Pg(e,n,o){var r,l,s;if(e.attrType==="EMBED_PREDEF")return(((l=(r=o==null?void 0:o.embeddableCatalog)==null?void 0:r.find(c=>c.type===e.type))==null?void 0:l.fields)??[]).map(c=>({col:c}));const i=(s=e.embedded)==null?void 0:s.embeddableRef;if(i==null)return[];const a=n.entities.find(c=>c.modelId===i);return a?gd(a,n,o).map(c=>({col:c.col,attr:c.attr})):[]}const El="entity-modeler-diagram",Nl=1;class fo extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function _d(e,n){return JSON.stringify({format:El,version:Nl,logical:e,layout:n},null,2)}const wa=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yo=e=>Array.isArray(e)?e:[];function kd(e){let n;try{n=JSON.parse(e)}catch{throw new fo("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!wa(n))throw new fo("최상위가 객체가 아닙니다.");if(n.format!==El)throw new fo(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Nl)throw new fo(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!wa(o)||!Array.isArray(o.entities))throw new fo("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!wa(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new fo("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:Yo(o.associations),groups:Yo(o.groups)},a=wa(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Yo(a.entityLayouts),associationLayouts:Yo(a.associationLayouts),groupLayouts:Yo(a.groupLayouts),notes:Yo(a.notes)};return{logical:i,layout:r}}const zg=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ht(e){return e.replace(zg,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Fe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Ed(e){return`<text ${[`x="${Fe(e.x)}"`,`y="${Fe(e.y)}"`,`fill="${Ht(e.fill)}"`,`font-size="${Fe(e.fontSize)}"`,e.fontFamily?`font-family="${Ht(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ht(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ht(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ht(e.text)}</text>`}function Fg(e){return`<line x1="${Fe(e.x1)}" y1="${Fe(e.y)}" x2="${Fe(e.x2)}" y2="${Fe(e.y)}" stroke="${Ht(e.stroke)}" stroke-width="${Fe(e.strokeWidth??1)}" />`}function Ug(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 Hg(e,n,o,i,a){return[`M${Fe(e+a.tl)},${Fe(n)}`,`L${Fe(e+o-a.tr)},${Fe(n)}`,a.tr?`Q${Fe(e+o)},${Fe(n)} ${Fe(e+o)},${Fe(n+a.tr)}`:"",`L${Fe(e+o)},${Fe(n+i-a.br)}`,a.br?`Q${Fe(e+o)},${Fe(n+i)} ${Fe(e+o-a.br)},${Fe(n+i)}`:"",`L${Fe(e+a.bl)},${Fe(n+i)}`,a.bl?`Q${Fe(e)},${Fe(n+i)} ${Fe(e)},${Fe(n+i-a.bl)}`:"",`L${Fe(e)},${Fe(n+a.tl)}`,a.tl?`Q${Fe(e)},${Fe(n)} ${Fe(e+a.tl)},${Fe(n)}`:"","Z"].filter(Boolean).join(" ")}function wl(e){const n=Ug(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${Ht(e.fill)}"`,`stroke="${Ht(e.stroke)}"`,`stroke-width="${Fe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ht(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Fe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Hg(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Fe(e.x)}" y="${Fe(e.y)}" width="${Fe(e.w)}" height="${Fe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Fg(l));for(const l of e.texts)r.push(Ed(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function jg(e){const o=[`<path ${[`d="${Ht(e.d)}"`,'fill="none"',`stroke="${Ht(e.stroke)}"`,`stroke-width="${Fe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ht(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Ed(i));return`<g>${o.join("")}</g>`}function Nd(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Fe(n)}" y="${Fe(o)}" width="${Fe(i)}" height="${Fe(a)}" fill="${Ht(e.background)}" />`);for(const l of e.groups)r.push(wl(l));for(const l of e.edges)r.push(jg(l));for(const l of e.entities)r.push(wl(l));for(const l of e.notes)r.push(wl(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Fe(n)} ${Fe(o)} ${Fe(i)} ${Fe(a)}" width="${Fe(i)}" height="${Fe(a)}">`+r.join("")+"</svg>"}const Ia=()=>crypto.randomUUID(),wd=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Kg=e=>e&&e[0].toLowerCase()+e.slice(1),Gg=e=>e&&e[0].toUpperCase()+e.slice(1);function Yg(e,n){return Kg(e??"")+Gg(n??"")}function qg(e,n){const o=uo(e.name,n);if(o===e.name)return e;const i=o.slice(e.name.length);return{...e,name:o,dbAttrs:e.dbAttrs.map((a,r)=>{var l;return{...a,physicalName:`${((l=e.originPhysicalNames)==null?void 0:l[r])??""}${i}`}})}}function Id(e,n){const o=e.entities.find(d=>d.modelId===n.end1.entityRef);if(!o)return[];if(at(o.stereotype))return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!ad(n.end1.multiplicity),l=o.attributes.filter(il).sort((d,u)=>d.order-u.order);if(l.length===0)return[];const s=l[0],c=l.flatMap(d=>d.dbAttrs);return[(d=>{const u=Yg(o.name,d.name);return{associationRef:n.modelId,sourceAttributeRef:d.modelId,name:u,type:d.type,identifier:a,notNull:r,dbAttrs:c.map(m=>({physicalName:"",logicalName:m.logicalName,dataType:m.dataType,length:m.length,scale:m.scale})),originPhysicalNames:c.map(m=>m.physicalName??"")}})(s)]}const va=(e,n)=>`${e}::${n}`,Ca=e=>e??void 0;function Wg(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||Ca(s.length)!==Ca(r.length)||Ca(s.scale)!==Ca(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 Jg(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 Ii(e,n,o=Ia){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=at(a.stereotype)?[]:r.flatMap(f=>Id(e,f)),s=new Map(l.map(f=>[va(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[va(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=va(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let p=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of l){const h=va(f.associationRef,f.sourceAttributeRef),_=d.get(h);if(_){const g=Wg(_,f,o);g&&i.update.push({attributeId:_.modelId,patch:g})}else{const g=qg(f,m);m.add(g.name),i.add.push(Jg(g,p++,o))}}return i}function vd(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 Xg(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function Il(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function vl(e,n,o=Ia){const i=new Map,a=Xg(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(p=>p.end1.entityRef===d).map(p=>p.end2.entityRef));for(const p of m){const f=Ii(a,p,o);if(wd(f))continue;const h=i.get(p);i.set(p,h?Il(h,f):f);const _=a.entities.find(g=>g.modelId===p);_&&vd(_,f),r.has(p)||(r.add(p),c.push(p))}}return i}function Zg(e,n,o=Ia){const i=[],a=Ii(e,n,o);let r=e;wd(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return vd(s,a),s})});for(const[l,s]of vl(r,n,o))i.push({entityId:l,plan:s});return i}function Cd(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function Sd(e,n,o=Ia){const i=new Map;for(const a of n)for(const{entityId:r,plan:l}of Zg(e,a,o)){const s=i.get(r);i.set(r,s?Il(s,l):l)}return[...i].map(([a,r])=>({entityId:a,plan:Cd(r)}))}function po(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||!fa(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const vi=63;function Cl(e){if(!e)return null;const n=e.length;return n>vi?n:null}function Sa(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Rt(e){return!e||e.trim()===""}function qo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Qg(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const p=o.get(m.end1.entityRef)??[];p.push(m.end2.entityRef),o.set(m.end1.entityRef,p)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const p of o.get(m)??[]){const f=l.get(p)??i;if(f===i)u(p);else if(f===a){const h=s.slice(s.indexOf(p)),_=[...h].sort().join(" ");d.has(_)||(d.add(_),c.push(h))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function xd(e){return!at(e.stereotype)}function eb(e){return e.filter(n=>!at(n.stereotype)&&!n.abstractClass)}function Rd(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function tb(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=Rt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function nb(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>tb(a,o))).size===1}function Ad(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function Sl(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 xa(e,n){var p,f,h,_,g,k,E,b,v;const o=[],i=new Map(e.entities.map(y=>[y.modelId,y])),a=new Map(e.associations.map(y=>[y.modelId,y])),r=nl(e.associations),l=pl(e),s=l.size===0?e.entities:od(e),c=id(e,l);for(const y of Ad(s,S=>S.name))for(const S of y){const $=y.filter(z=>z!==S),O=xd(S)&&$.some(xd),B=$.some(z=>!jy(S,z,e));!O&&!B||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:S.modelId,params:{name:S.name,reason:O?"entity":"package"}})}for(const y of Ad(eb(s),Rd))if(new Set(y.map(S=>S.name)).size!==1&&!nb(y,e))for(const S of y)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:S.modelId,params:{name:Rd(S)}});const d=s.flatMap(y=>(y.indexes??[]).map(S=>({e:y,ix:S})));for(const y of Sl(d,S=>S.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:y.ix.modelId,contextRef:y.e.modelId,params:{name:y.ix.name}});for(const y of s){const S=y.attributes.filter(I=>I.attrType!=="DIVIDER");if(Rt(y.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:y.modelId}),y.stereotype==="JPA_ENTITY"&&!y.abstractClass&&(S.some(I=>I.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:y.modelId}),Rt((p=y.table)==null?void 0:p.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:y.modelId})),at(y.stereotype))for(const I of S.filter(C=>C.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S.filter(C=>C.identifier&&C.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S)if(!I.identifier)for(const C of I.dbAttrs)!C.autoIncrement&&Rt(C.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:C.autoIncrement?{name:I.name}:{name:I.name,seq:C.sequenceName??""}});const $=S.filter(I=>I.identifier&&!I.transient);if($.reduce((I,C)=>I+C.dbAttrs.length,0)>=2)for(const I of $)for(const C of I.dbAttrs)!C.autoIncrement&&Rt(C.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S.filter(C=>C.naturalId&&C.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S.filter(C=>C.naturalId&&C.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S.filter(C=>C.naturalId&&!C.notNull&&!C.identifier&&!C.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});!y.abstractClass&&S.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:y.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&S.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:y.modelId,params:{count:S.length,threshold:n.largeEntityThreshold}});for(const I of Sl(S,C=>C.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S)if(Rt(I.name)){const C=(I.attrType.startsWith("RELATION")||I.attrType.startsWith("EMBED"))&&!ol(I,y,r);o.push({ruleId:C?"CHK-NAME-7":"CHK-NAME-4",severity:C?"error":"info",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,...C?{params:{attrType:I.attrType}}:{}})}const O=S.flatMap(I=>I.dbAttrs.map((C,U)=>({attr:I,index:U,col:C,eff:Bt(I,C,U,y,e,n),name:bi(I,C,U,y,e,n)})).filter(C=>C.eff.sharedColumnRef==null));for(const I of Sl(O,C=>C.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:I.col.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of O){if(!Rt(I.name)||I.attr.transient||Rt(I.attr.name)&&(I.attr.attrType.startsWith("RELATION")||I.attr.attrType.startsWith("EMBED"))||I.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const C=pa(I.attr,y,e.entities,e.associations,I.index);Rt(C==null?void 0:C.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:I.col.modelId,contextRef:y.modelId,params:{name:I.attr.name}})}for(const I of O){const C=I.col,U=Cl(C.physicalName);U!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{max:vi,len:U}}),n!=null&&n.reservedWords&&!Rt(C.physicalName)&&n.reservedWords.has(C.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{name:C.physicalName}}),n!=null&&n.selectableDataTypes&&!Rt(C.dataType)&&!n.selectableDataTypes.has(C.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{dataType:C.dataType}});const A=I.attr.transient||C.multiValue||I.attr.attrType.startsWith("EMBED")||I.attr.attrType.startsWith("RELATION")?void 0:Zy(I.attr.type,C.dataType);A===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{type:I.attr.type,dataType:Sa(C)}}),y.stereotype!=="SERIALIZED_TYPE"&&I.attr.attrType==="NORMAL"&&!I.attr.transient&&!I.attr.identifier&&!ro(I.attr,C)&&!Rt(C.dataType)&&A!==!1&&tg(I.attr.type,C.dataType,C.multiValue)&&o.push({ruleId:"CHK-TYPE-8",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{type:jo(I.attr.type),boxed:Qy(I.attr.type)??"",dataType:Sa(C)}}),A!==!1&&!Rt(C.dataType)&&qy.has(C.dataType)&&!C.length&&(Bt(I.attr,C,I.index,y,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{dataType:C.dataType}}))}for(const I of O)Rt(I.col.dataType)&&(I.attr.transient||I.attr.attrType.startsWith("EMBED")||I.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:I.col.modelId,contextRef:y.modelId,params:{name:I.attr.name}}));if((f=n==null?void 0:n.embeddableCatalog)!=null&&f.length){const I=lo(vn(y,e.entities));for(const C of S){if(C.attrType!=="EMBED_PREDEF")continue;const U=n.embeddableCatalog.find(A=>A.type===C.type);U&&C.dbAttrs.forEach((A,P)=>{if(A.sharedColumnRef==null)return;const F=U.fields[P],H=I.get(A.sharedColumnRef);if(!F||!H)return;(H.dataType!==F.dataType||(H.length??null)!==(F.length??null)||(H.scale??null)!==(F.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:A.modelId,contextRef:y.modelId,params:{targetType:Sa(H),metaName:F.name,metaType:Sa(F)}})})}}for(const I of S){const C=I.dbAttrs[0];if(!(C!=null&&C.multiValue))continue;I.type===jn&&C.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{type:I.type||"",dataType:C.dataType||""}})}for(const I of S){if(I.attrType!=="EMBED_OWN"||!I.embedded)continue;const C=i.get(I.embedded.embeddableRef);if(!C)continue;const U=a.get(I.embedded.associationRef),A=U==null?void 0:U.end1.entityRef===I.embedded.embeddableRef?U.end1:U.end2;if(A&&qo(A.multiplicity))continue;const P=wn(C).length;I.dbAttrs.length!==P&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name,embeddable:C.name,slots:I.dbAttrs.length,declared:P}})}const B=(h=y.table)==null?void 0:h.physicalName,z=Cl(B);z!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:y.modelId,params:{max:vi,len:z}}),n!=null&&n.reservedWords&&!Rt(B)&&n.reservedWords.has(B.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:y.modelId,params:{name:B}});const T=new Set;for(const I of y.attributes){T.add(I.modelId);for(const C of I.dbAttrs)T.add(C.modelId)}const x=new Set(gi(y,(n==null?void 0:n.superClassCatalog)??[]).map(I=>I.modelId)),R=(((_=n==null?void 0:n.superClassCatalog)==null?void 0:_.length)??0)>0,N=io(y.attributes);for(const I of y.indexes??[]){const C=Cl(I.name);C!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:{max:vi,len:C}}),n!=null&&n.reservedWords&&!Rt(I.name)&&n.reservedWords.has(I.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const U of I.columns){const A=U.columnRef;if(T.has(A)||x.has(A))continue;const P=ao(A);P&&!R||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:P?{name:I.name,field:((g=tl(A))==null?void 0:g.field)??A}:{name:I.name}})}I.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}}),new Set(I.columns.map(U=>N.canon(U.columnRef))).size!==I.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}})}}const u=new Map;for(const y of e.entities)for(const S of y.attributes)S.attrType==="EMBED_OWN"&&S.embedded&&u.set(S.embedded.associationRef,S);for(const y of c){if(qo(y.end1.multiplicity)&&qo(y.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:y.modelId}),u.has(y.modelId)&&y.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:y.modelId}),!u.has(y.modelId)){const S=!!y.end2.attributeRef&&(((E=(k=y.end2.jpa)==null?void 0:k.cascadeTypes)==null?void 0:E.length)??0)>0,$=!!y.end1.attributeRef&&y.end1.navigable&&(((v=(b=y.end1.jpa)==null?void 0:b.cascadeTypes)==null?void 0:v.length)??0)>0;S&&$&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:y.modelId})}if(!u.has(y.modelId)&&y.end1.navigable&&y.end1.attributeRef){const S=i.get(y.end1.entityRef),$=S==null?void 0:S.attributes.some(z=>z.modelId===y.end1.attributeRef),O=i.get(y.end2.entityRef),B=Id(e,y).length>0;$&&O&&B&&(y.end2.attributeRef&&O.attributes.some(T=>T.modelId===y.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:y.modelId,params:{child:O.name}}))}for(const S of["end1","end2"]){const $=y[S].jpa;if(!$)continue;const O=$.cascadeTypes??[];O.includes("ALL")&&O.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:y.modelId,params:{which:S}}),qo(y[S].multiplicity)&&$.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:y.modelId,params:{which:S}}),$.orphanRemoval&&qo(y[S==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:y.modelId,params:{which:S}}),!qo(y[S].multiplicity)&&($.collectionType||$.collectionTable||$.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:y.modelId,params:{which:S}}),$.collectionType==="SET"&&$.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:y.modelId,params:{which:S}})}}const m=new Map(e.entities.map(y=>[y.modelId,y.name||y.modelId]));for(const y of Qg(s,c)){const S=[...y,y[0]].map($=>m.get($)??$).join(" → ");for(const $ of y)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:$,params:{path:S}})}if(n!=null&&n.flagEntitiesWithoutRelations){const y=new Set;for(const $ of e.associations)y.add($.end1.entityRef),y.add($.end2.entityRef);const S=new Map(e.entities.map($=>[$.name,$.modelId]));for(const $ of e.entities){for(const O of $.attributes)O.embedded&&(y.add($.modelId),y.add(O.embedded.embeddableRef));if(!Rt($.superClass)){y.add($.modelId);const O=S.get($.superClass);O&&y.add(O)}}for(const $ of s)y.has($.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:$.modelId})}return o}function xl(e,n){var r,l;if(e.ruleId==="CHK-DSN-7")return ob(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(s=>s.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:null}function ob(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=io(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const Kn="javax.persistence",nt={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"},ib={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function $d(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Dt(o)?null:o??ib[n]}const Ra={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function ab(e){if(!e)return;if(Ra[e])return{simpleName:e,fqn:Ra[e]};const n=Object.entries(Ra).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}const Rl={List:"java.util.List",Set:"java.util.Set",Map:"java.util.Map"},rb={LIST:"List",SET:"Set",MAP:"Map"};function Td(e,n,o,i,a){var _,g,k,E;const r=_i(e,Ho(o),n,o);if(r.kind==="none")return;if(r.kind==="ambiguous")return{type:r.name,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[`직렬화 타입 '${r.name}' 동명 ${r.candidates.length}개 — 어느 선언인지 결정 필요(패키지로 구분)`]};const l=r.entity,s=l.name,c=[],d=[],u=Cn(l,o,i),m=Cn(n,o,i);u?u!==m&&c.push(`${u}.${s}`):d.push(`직렬화 타입 '${s}' package 미지정 — import 확인 필요`);const p=(_=l.serialization)==null?void 0:_.collectionType;let f=s;if(p){const b=rb[p];if(c.push(Rl[b]),p==="MAP"){const v=(g=l.serialization)==null?void 0:g.mapKeyType;if(Dt(v))d.push(`직렬화 타입 '${s}' Map 키 타입 미지정(serialization.mapKeyType) — 임시 'Object', 모델 확인 필요`),f=`Map<Object, ${s}>`;else{const y=v;y.includes(".")?(c.push(y),f=`Map<${y.slice(y.lastIndexOf(".")+1)}, ${s}>`):f=`Map<${y}, ${s}>`}}else f=`${b}<${s}>`}const h=[];if(a&&((k=e.dbAttrs[0])==null?void 0:k.dataType)==="JSONB")c.push(nt.jdbcTypeCode,nt.sqlTypes),h.push("@JdbcTypeCode(SqlTypes.JSON)");else if(a){const b=(E=Vd(i,s))==null?void 0:E.converterFqn;b==null||Dt(b)?d.push(b===null?`직렬화 타입 '${s}' 컨버터 비활성(customTypeCatalog.converterFqn = null) — @Convert 손채움 필요`:`직렬화 타입 '${s}' 컨버터 미지정(customTypeCatalog.converterFqn) — @Convert 손채움 필요`):(Md(b,`직렬화 타입 '${s}'`,d),c.push(`${Kn}.Convert`),h.push(`@Convert(converter = ${b}.class)`))}return{type:f,primitive:!1,imports:c,fieldAnnotations:h,fillIns:d}}function Md(e,n,o){e.includes("$")&&o.push(`${n} 컨버터 FQN 에 바이너리명 '$' 포함(customTypeCatalog.converterFqn = '${e}') — 자바 «소스» 표기는 중첩을 '.' 로 쓴다(예: Outer.Inner). 현재 값 그대로는 컴파일되지 않는다`)}function Vd(e,n){const o=e.customTypeCatalog;if(!o||!n)return;if(o[n])return o[n];const i=Object.entries(o).find(([,a])=>(a.imports??[]).includes(n));return i==null?void 0:i[1]}function lb(e,n){var c;const o=Dt(e.fieldType)?n:e.fieldType,i=[...e.imports??[]],a=[],r=(c=/^(\w+)\s*</.exec(o))==null?void 0:c[1];r&&(Rl[r]?i.push(Rl[r]):a.push(`컨테이너 '${r}' import 확인 필요 (java.util List·Set·Map 외)`));const l=e.converterFqn,s=!(l==null||Dt(l));return s&&Md(l,`CustomType '${n}'`,a),s?i.push(`${Kn}.Convert`):a.push(l===null?`CustomType '${n}' 컨버터 비활성(customTypeCatalog.converterFqn = null) — @Convert 손채움 필요`:`CustomType '${n}' 컨버터 미지정(customTypeCatalog.converterFqn) — @Convert 손채움 필요`),{type:o,primitive:!1,imports:i,fieldAnnotations:s?[`@Convert(converter = ${l}.class)`]:[],fillIns:a}}function Ld(e){return!(Dt(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function sb(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(co(l)||o.skipUngeneratable!==!1&&!Ld(l)||a.push(mb(l,e,o)))}return a}class Al{constructor(){dt(this,"imports",new Set);dt(this,"body",[]);dt(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${Kn}.${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(`
23
+ );`);const _=Go(r);o.alterStmts.push(`ALTER TABLE ${c} ADD CONSTRAINT fk_${c}_${_} FOREIGN KEY (${d.map(g=>g.name).join(", ")}) REFERENCES ${_} (${d.map(g=>g.name).join(", ")});`)}}function Og(e,n){const o=n.associations.find(i=>{var a;return i.modelId===((a=e.embedded)==null?void 0:a.associationRef)});if(!(!o||!e.embedded))return o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1}function Pg(e,n,o){var r,l,s;if(e.attrType==="EMBED_PREDEF")return(((l=(r=o==null?void 0:o.embeddableCatalog)==null?void 0:r.find(c=>c.type===e.type))==null?void 0:l.fields)??[]).map(c=>({col:c}));const i=(s=e.embedded)==null?void 0:s.embeddableRef;if(i==null)return[];const a=n.entities.find(c=>c.modelId===i);return a?gd(a,n,o).map(c=>({col:c.col,attr:c.attr})):[]}const El="entity-modeler-diagram",Nl=1;class fo extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function _d(e,n){return JSON.stringify({format:El,version:Nl,logical:e,layout:n},null,2)}const wa=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yo=e=>Array.isArray(e)?e:[];function kd(e){let n;try{n=JSON.parse(e)}catch{throw new fo("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!wa(n))throw new fo("최상위가 객체가 아닙니다.");if(n.format!==El)throw new fo(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Nl)throw new fo(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!wa(o)||!Array.isArray(o.entities))throw new fo("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!wa(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new fo("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:Yo(o.associations),groups:Yo(o.groups)},a=wa(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Yo(a.entityLayouts),associationLayouts:Yo(a.associationLayouts),groupLayouts:Yo(a.groupLayouts),notes:Yo(a.notes)};return{logical:i,layout:r}}const zg=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ht(e){return e.replace(zg,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Fe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Ed(e){return`<text ${[`x="${Fe(e.x)}"`,`y="${Fe(e.y)}"`,`fill="${Ht(e.fill)}"`,`font-size="${Fe(e.fontSize)}"`,e.fontFamily?`font-family="${Ht(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ht(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ht(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ht(e.text)}</text>`}function Fg(e){return`<line x1="${Fe(e.x1)}" y1="${Fe(e.y)}" x2="${Fe(e.x2)}" y2="${Fe(e.y)}" stroke="${Ht(e.stroke)}" stroke-width="${Fe(e.strokeWidth??1)}" />`}function Ug(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 Hg(e,n,o,i,a){return[`M${Fe(e+a.tl)},${Fe(n)}`,`L${Fe(e+o-a.tr)},${Fe(n)}`,a.tr?`Q${Fe(e+o)},${Fe(n)} ${Fe(e+o)},${Fe(n+a.tr)}`:"",`L${Fe(e+o)},${Fe(n+i-a.br)}`,a.br?`Q${Fe(e+o)},${Fe(n+i)} ${Fe(e+o-a.br)},${Fe(n+i)}`:"",`L${Fe(e+a.bl)},${Fe(n+i)}`,a.bl?`Q${Fe(e)},${Fe(n+i)} ${Fe(e)},${Fe(n+i-a.bl)}`:"",`L${Fe(e)},${Fe(n+a.tl)}`,a.tl?`Q${Fe(e)},${Fe(n)} ${Fe(e+a.tl)},${Fe(n)}`:"","Z"].filter(Boolean).join(" ")}function wl(e){const n=Ug(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${Ht(e.fill)}"`,`stroke="${Ht(e.stroke)}"`,`stroke-width="${Fe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ht(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Fe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Hg(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Fe(e.x)}" y="${Fe(e.y)}" width="${Fe(e.w)}" height="${Fe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Fg(l));for(const l of e.texts)r.push(Ed(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function jg(e){const o=[`<path ${[`d="${Ht(e.d)}"`,'fill="none"',`stroke="${Ht(e.stroke)}"`,`stroke-width="${Fe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ht(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Ed(i));return`<g>${o.join("")}</g>`}function Nd(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Fe(n)}" y="${Fe(o)}" width="${Fe(i)}" height="${Fe(a)}" fill="${Ht(e.background)}" />`);for(const l of e.groups)r.push(wl(l));for(const l of e.edges)r.push(jg(l));for(const l of e.entities)r.push(wl(l));for(const l of e.notes)r.push(wl(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Fe(n)} ${Fe(o)} ${Fe(i)} ${Fe(a)}" width="${Fe(i)}" height="${Fe(a)}">`+r.join("")+"</svg>"}const Ia=()=>crypto.randomUUID(),wd=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Kg=e=>e&&e[0].toLowerCase()+e.slice(1),Gg=e=>e&&e[0].toUpperCase()+e.slice(1);function Yg(e,n){return Kg(e??"")+Gg(n??"")}function qg(e,n){const o=uo(e.name,n);if(o===e.name)return e;const i=o.slice(e.name.length);return{...e,name:o,dbAttrs:e.dbAttrs.map((a,r)=>{var l;return{...a,physicalName:`${((l=e.originPhysicalNames)==null?void 0:l[r])??""}${i}`}})}}function Id(e,n){const o=e.entities.find(d=>d.modelId===n.end1.entityRef);if(!o)return[];if(at(o.stereotype))return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!ad(n.end1.multiplicity),l=o.attributes.filter(il).sort((d,u)=>d.order-u.order);if(l.length===0)return[];const s=l[0],c=l.flatMap(d=>d.dbAttrs);return[(d=>{const u=Yg(o.name,d.name);return{associationRef:n.modelId,sourceAttributeRef:d.modelId,name:u,type:d.type,identifier:a,notNull:r,dbAttrs:c.map(m=>({physicalName:"",logicalName:m.logicalName,dataType:m.dataType,length:m.length,scale:m.scale})),originPhysicalNames:c.map(m=>m.physicalName??"")}})(s)]}const va=(e,n)=>`${e}::${n}`,Ca=e=>e??void 0;function Wg(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||Ca(s.length)!==Ca(r.length)||Ca(s.scale)!==Ca(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 Jg(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 Ii(e,n,o=Ia){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=at(a.stereotype)?[]:r.flatMap(f=>Id(e,f)),s=new Map(l.map(f=>[va(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[va(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=va(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let p=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of l){const h=va(f.associationRef,f.sourceAttributeRef),_=d.get(h);if(_){const g=Wg(_,f,o);g&&i.update.push({attributeId:_.modelId,patch:g})}else{const g=qg(f,m);m.add(g.name),i.add.push(Jg(g,p++,o))}}return i}function vd(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 Xg(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function Il(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function vl(e,n,o=Ia){const i=new Map,a=Xg(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(p=>p.end1.entityRef===d).map(p=>p.end2.entityRef));for(const p of m){const f=Ii(a,p,o);if(wd(f))continue;const h=i.get(p);i.set(p,h?Il(h,f):f);const _=a.entities.find(g=>g.modelId===p);_&&vd(_,f),r.has(p)||(r.add(p),c.push(p))}}return i}function Zg(e,n,o=Ia){const i=[],a=Ii(e,n,o);let r=e;wd(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return vd(s,a),s})});for(const[l,s]of vl(r,n,o))i.push({entityId:l,plan:s});return i}function Cd(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function Sd(e,n,o=Ia){const i=new Map;for(const a of n)for(const{entityId:r,plan:l}of Zg(e,a,o)){const s=i.get(r);i.set(r,s?Il(s,l):l)}return[...i].map(([a,r])=>({entityId:a,plan:Cd(r)}))}function po(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||!fa(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const vi=63;function Cl(e){if(!e)return null;const n=e.length;return n>vi?n:null}function Sa(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Rt(e){return!e||e.trim()===""}function qo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Qg(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const p=o.get(m.end1.entityRef)??[];p.push(m.end2.entityRef),o.set(m.end1.entityRef,p)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const p of o.get(m)??[]){const f=l.get(p)??i;if(f===i)u(p);else if(f===a){const h=s.slice(s.indexOf(p)),_=[...h].sort().join(" ");d.has(_)||(d.add(_),c.push(h))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function xd(e){return!at(e.stereotype)}function eb(e){return e.filter(n=>!at(n.stereotype)&&!n.abstractClass)}function Rd(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function tb(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=Rt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function nb(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>tb(a,o))).size===1}function Ad(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function Sl(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 xa(e,n){var p,f,h,_,g,k,E,b,v;const o=[],i=new Map(e.entities.map(y=>[y.modelId,y])),a=new Map(e.associations.map(y=>[y.modelId,y])),r=nl(e.associations),l=pl(e),s=l.size===0?e.entities:od(e),c=id(e,l);for(const y of Ad(s,S=>S.name))for(const S of y){const $=y.filter(z=>z!==S),O=xd(S)&&$.some(xd),B=$.some(z=>!jy(S,z,e));!O&&!B||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:S.modelId,params:{name:S.name,reason:O?"entity":"package"}})}for(const y of Ad(eb(s),Rd))if(new Set(y.map(S=>S.name)).size!==1&&!nb(y,e))for(const S of y)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:S.modelId,params:{name:Rd(S)}});const d=s.flatMap(y=>(y.indexes??[]).map(S=>({e:y,ix:S})));for(const y of Sl(d,S=>S.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:y.ix.modelId,contextRef:y.e.modelId,params:{name:y.ix.name}});for(const y of s){const S=y.attributes.filter(I=>I.attrType!=="DIVIDER");if(Rt(y.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:y.modelId}),y.stereotype==="JPA_ENTITY"&&!y.abstractClass&&(S.some(I=>I.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:y.modelId}),Rt((p=y.table)==null?void 0:p.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:y.modelId})),at(y.stereotype))for(const I of S.filter(C=>C.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S.filter(C=>C.identifier&&C.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S)if(!I.identifier)for(const C of I.dbAttrs)!C.autoIncrement&&Rt(C.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:C.autoIncrement?{name:I.name}:{name:I.name,seq:C.sequenceName??""}});const $=S.filter(I=>I.identifier&&!I.transient);if($.reduce((I,C)=>I+C.dbAttrs.length,0)>=2)for(const I of $)for(const C of I.dbAttrs)!C.autoIncrement&&Rt(C.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S.filter(C=>C.naturalId&&C.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S.filter(C=>C.naturalId&&C.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S.filter(C=>C.naturalId&&!C.notNull&&!C.identifier&&!C.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});!y.abstractClass&&S.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:y.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&S.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:y.modelId,params:{count:S.length,threshold:n.largeEntityThreshold}});for(const I of Sl(S,C=>C.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of S)if(Rt(I.name)){const C=(I.attrType.startsWith("RELATION")||I.attrType.startsWith("EMBED"))&&!ol(I,y,r);o.push({ruleId:C?"CHK-NAME-7":"CHK-NAME-4",severity:C?"error":"info",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,...C?{params:{attrType:I.attrType}}:{}})}const O=S.flatMap(I=>I.dbAttrs.map((C,U)=>({attr:I,index:U,col:C,eff:Bt(I,C,U,y,e,n),name:bi(I,C,U,y,e,n)})).filter(C=>C.eff.sharedColumnRef==null));for(const I of Sl(O,C=>C.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:I.col.modelId,contextRef:y.modelId,params:{name:I.name}});for(const I of O){if(!Rt(I.name)||I.attr.transient||Rt(I.attr.name)&&(I.attr.attrType.startsWith("RELATION")||I.attr.attrType.startsWith("EMBED"))||I.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const C=pa(I.attr,y,e.entities,e.associations,I.index);Rt(C==null?void 0:C.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:I.col.modelId,contextRef:y.modelId,params:{name:I.attr.name}})}for(const I of O){const C=I.col,U=Cl(C.physicalName);U!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{max:vi,len:U}}),n!=null&&n.reservedWords&&!Rt(C.physicalName)&&n.reservedWords.has(C.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{name:C.physicalName}}),n!=null&&n.selectableDataTypes&&!Rt(C.dataType)&&!n.selectableDataTypes.has(C.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{dataType:C.dataType}});const A=I.attr.transient||C.multiValue||I.attr.attrType.startsWith("EMBED")||I.attr.attrType.startsWith("RELATION")?void 0:Zy(I.attr.type,C.dataType,n==null?void 0:n.predefinedCustomTypes);A===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{type:I.attr.type,dataType:Sa(C)}}),y.stereotype!=="SERIALIZED_TYPE"&&I.attr.attrType==="NORMAL"&&!I.attr.transient&&!I.attr.identifier&&!ro(I.attr,C)&&!Rt(C.dataType)&&A!==!1&&tg(I.attr.type,C.dataType,C.multiValue)&&o.push({ruleId:"CHK-TYPE-8",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{type:jo(I.attr.type),boxed:Qy(I.attr.type)??"",dataType:Sa(C)}}),A!==!1&&!Rt(C.dataType)&&qy.has(C.dataType)&&!C.length&&(Bt(I.attr,C,I.index,y,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{dataType:C.dataType}}))}for(const I of O)Rt(I.col.dataType)&&(I.attr.transient||I.attr.attrType.startsWith("EMBED")||I.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:I.col.modelId,contextRef:y.modelId,params:{name:I.attr.name}}));if((f=n==null?void 0:n.embeddableCatalog)!=null&&f.length){const I=lo(vn(y,e.entities));for(const C of S){if(C.attrType!=="EMBED_PREDEF")continue;const U=n.embeddableCatalog.find(A=>A.type===C.type);U&&C.dbAttrs.forEach((A,P)=>{if(A.sharedColumnRef==null)return;const F=U.fields[P],H=I.get(A.sharedColumnRef);if(!F||!H)return;(H.dataType!==F.dataType||(H.length??null)!==(F.length??null)||(H.scale??null)!==(F.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:A.modelId,contextRef:y.modelId,params:{targetType:Sa(H),metaName:F.name,metaType:Sa(F)}})})}}for(const I of S){const C=I.dbAttrs[0];if(!(C!=null&&C.multiValue))continue;I.type===jn&&C.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:C.modelId,contextRef:y.modelId,params:{type:I.type||"",dataType:C.dataType||""}})}for(const I of S){if(I.attrType!=="EMBED_OWN"||!I.embedded)continue;const C=i.get(I.embedded.embeddableRef);if(!C)continue;const U=a.get(I.embedded.associationRef),A=U==null?void 0:U.end1.entityRef===I.embedded.embeddableRef?U.end1:U.end2;if(A&&qo(A.multiplicity))continue;const P=wn(C).length;I.dbAttrs.length!==P&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name,embeddable:C.name,slots:I.dbAttrs.length,declared:P}})}const B=(h=y.table)==null?void 0:h.physicalName,z=Cl(B);z!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:y.modelId,params:{max:vi,len:z}}),n!=null&&n.reservedWords&&!Rt(B)&&n.reservedWords.has(B.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:y.modelId,params:{name:B}});const T=new Set;for(const I of y.attributes){T.add(I.modelId);for(const C of I.dbAttrs)T.add(C.modelId)}const x=new Set(gi(y,(n==null?void 0:n.superClassCatalog)??[]).map(I=>I.modelId)),R=(((_=n==null?void 0:n.superClassCatalog)==null?void 0:_.length)??0)>0,N=io(y.attributes);for(const I of y.indexes??[]){const C=Cl(I.name);C!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:{max:vi,len:C}}),n!=null&&n.reservedWords&&!Rt(I.name)&&n.reservedWords.has(I.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}});for(const U of I.columns){const A=U.columnRef;if(T.has(A)||x.has(A))continue;const P=ao(A);P&&!R||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:P?{name:I.name,field:((g=tl(A))==null?void 0:g.field)??A}:{name:I.name}})}I.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}}),new Set(I.columns.map(U=>N.canon(U.columnRef))).size!==I.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:y.modelId,params:{name:I.name}})}}const u=new Map;for(const y of e.entities)for(const S of y.attributes)S.attrType==="EMBED_OWN"&&S.embedded&&u.set(S.embedded.associationRef,S);for(const y of c){if(qo(y.end1.multiplicity)&&qo(y.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:y.modelId}),u.has(y.modelId)&&y.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:y.modelId}),!u.has(y.modelId)){const S=!!y.end2.attributeRef&&(((E=(k=y.end2.jpa)==null?void 0:k.cascadeTypes)==null?void 0:E.length)??0)>0,$=!!y.end1.attributeRef&&y.end1.navigable&&(((v=(b=y.end1.jpa)==null?void 0:b.cascadeTypes)==null?void 0:v.length)??0)>0;S&&$&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:y.modelId})}if(!u.has(y.modelId)&&y.end1.navigable&&y.end1.attributeRef){const S=i.get(y.end1.entityRef),$=S==null?void 0:S.attributes.some(z=>z.modelId===y.end1.attributeRef),O=i.get(y.end2.entityRef),B=Id(e,y).length>0;$&&O&&B&&(y.end2.attributeRef&&O.attributes.some(T=>T.modelId===y.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:y.modelId,params:{child:O.name}}))}for(const S of["end1","end2"]){const $=y[S].jpa;if(!$)continue;const O=$.cascadeTypes??[];O.includes("ALL")&&O.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:y.modelId,params:{which:S}}),qo(y[S].multiplicity)&&$.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:y.modelId,params:{which:S}}),$.orphanRemoval&&qo(y[S==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:y.modelId,params:{which:S}}),!qo(y[S].multiplicity)&&($.collectionType||$.collectionTable||$.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:y.modelId,params:{which:S}}),$.collectionType==="SET"&&$.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:y.modelId,params:{which:S}})}}const m=new Map(e.entities.map(y=>[y.modelId,y.name||y.modelId]));for(const y of Qg(s,c)){const S=[...y,y[0]].map($=>m.get($)??$).join(" → ");for(const $ of y)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:$,params:{path:S}})}if(n!=null&&n.flagEntitiesWithoutRelations){const y=new Set;for(const $ of e.associations)y.add($.end1.entityRef),y.add($.end2.entityRef);const S=new Map(e.entities.map($=>[$.name,$.modelId]));for(const $ of e.entities){for(const O of $.attributes)O.embedded&&(y.add($.modelId),y.add(O.embedded.embeddableRef));if(!Rt($.superClass)){y.add($.modelId);const O=S.get($.superClass);O&&y.add(O)}}for(const $ of s)y.has($.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:$.modelId})}return o}function xl(e,n){var r,l;if(e.ruleId==="CHK-DSN-7")return ob(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(s=>s.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:null}function ob(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=io(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const Kn="javax.persistence",nt={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"},ib={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function $d(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Dt(o)?null:o??ib[n]}const Ra={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function ab(e){if(!e)return;if(Ra[e])return{simpleName:e,fqn:Ra[e]};const n=Object.entries(Ra).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}const Rl={List:"java.util.List",Set:"java.util.Set",Map:"java.util.Map"},rb={LIST:"List",SET:"Set",MAP:"Map"};function Td(e,n,o,i,a){var _,g,k,E;const r=_i(e,Ho(o),n,o);if(r.kind==="none")return;if(r.kind==="ambiguous")return{type:r.name,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[`직렬화 타입 '${r.name}' 동명 ${r.candidates.length}개 — 어느 선언인지 결정 필요(패키지로 구분)`]};const l=r.entity,s=l.name,c=[],d=[],u=Cn(l,o,i),m=Cn(n,o,i);u?u!==m&&c.push(`${u}.${s}`):d.push(`직렬화 타입 '${s}' package 미지정 — import 확인 필요`);const p=(_=l.serialization)==null?void 0:_.collectionType;let f=s;if(p){const b=rb[p];if(c.push(Rl[b]),p==="MAP"){const v=(g=l.serialization)==null?void 0:g.mapKeyType;if(Dt(v))d.push(`직렬화 타입 '${s}' Map 키 타입 미지정(serialization.mapKeyType) — 임시 'Object', 모델 확인 필요`),f=`Map<Object, ${s}>`;else{const y=v;y.includes(".")?(c.push(y),f=`Map<${y.slice(y.lastIndexOf(".")+1)}, ${s}>`):f=`Map<${y}, ${s}>`}}else f=`${b}<${s}>`}const h=[];if(a&&((k=e.dbAttrs[0])==null?void 0:k.dataType)==="JSONB")c.push(nt.jdbcTypeCode,nt.sqlTypes),h.push("@JdbcTypeCode(SqlTypes.JSON)");else if(a){const b=(E=Vd(i,s))==null?void 0:E.converterFqn;b==null||Dt(b)?d.push(b===null?`직렬화 타입 '${s}' 컨버터 비활성(customTypeCatalog.converterFqn = null) — @Convert 손채움 필요`:`직렬화 타입 '${s}' 컨버터 미지정(customTypeCatalog.converterFqn) — @Convert 손채움 필요`):(Md(b,`직렬화 타입 '${s}'`,d),c.push(`${Kn}.Convert`),h.push(`@Convert(converter = ${b}.class)`))}return{type:f,primitive:!1,imports:c,fieldAnnotations:h,fillIns:d}}function Md(e,n,o){e.includes("$")&&o.push(`${n} 컨버터 FQN 에 바이너리명 '$' 포함(customTypeCatalog.converterFqn = '${e}') — 자바 «소스» 표기는 중첩을 '.' 로 쓴다(예: Outer.Inner). 현재 값 그대로는 컴파일되지 않는다`)}function Vd(e,n){const o=e.customTypeCatalog;if(!o||!n)return;if(o[n])return o[n];const i=Object.entries(o).find(([,a])=>(a.imports??[]).includes(n));return i==null?void 0:i[1]}function lb(e,n){var c;const o=Dt(e.fieldType)?n:e.fieldType,i=[...e.imports??[]],a=[],r=(c=/^(\w+)\s*</.exec(o))==null?void 0:c[1];r&&(Rl[r]?i.push(Rl[r]):a.push(`컨테이너 '${r}' import 확인 필요 (java.util List·Set·Map 외)`));const l=e.converterFqn,s=!(l==null||Dt(l));return s&&Md(l,`CustomType '${n}'`,a),s?i.push(`${Kn}.Convert`):a.push(l===null?`CustomType '${n}' 컨버터 비활성(customTypeCatalog.converterFqn = null) — @Convert 손채움 필요`:`CustomType '${n}' 컨버터 미지정(customTypeCatalog.converterFqn) — @Convert 손채움 필요`),{type:o,primitive:!1,imports:i,fieldAnnotations:s?[`@Convert(converter = ${l}.class)`]:[],fillIns:a}}function Ld(e){return!(Dt(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function sb(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(co(l)||o.skipUngeneratable!==!1&&!Ld(l)||a.push(mb(l,e,o)))}return a}class Al{constructor(){dt(this,"imports",new Set);dt(this,"body",[]);dt(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${Kn}.${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(`
24
24
  `)+`
25
25
  `}}function Bd(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Dd(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function ho(e,n){n&&(e.import(nt.lombokGetter),e.line(" @Getter"))}function Ci(e,n){if(!e)return[];const o=ha.filter(i=>(e[i]??"").trim()!=="").map(i=>`${n} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${n}/**`,`${n} * <ul>`,...o,`${n} * </ul>`,`${n} */`]}function Si(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...ki,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===jn){if(i){const c=[`${Kn}.Enumerated`,`${Kn}.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:[`${Kn}.Enumerated`,`${Kn}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===dn){const c=ab(n);if(c)return{...a,type:n||"Object",fillIns:[`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`]};const d=Vd(o,n);return d?lb(d,n):{...a,type:n||"Object",fillIns:[`CustomType 확인 필요: ${n??"(미지정)"}`]}}if(e==="CustomMoneyType"){const c=$d(o,"money");return{type:"Money",primitive:!1,imports:c?[nt.money,`${Kn}.Convert`]:[nt.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=Ra[e];if(s)return{type:e,primitive:!1,imports:[s,nt.jdbcTypeCode,nt.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 $l(e){return e.attributes.filter(il).sort((n,o)=>n.order-o.order)}const cb=Lc,Od="EmbeddedId";function db(e,n){var a;const o=(a=e.derivedFrom)==null?void 0:a.associationRef;if(!o)return;const i=n.associations.find(r=>r.modelId===o);return i?n.entities.find(r=>r.modelId===i.end1.entityRef):void 0}function Aa(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return{type:Si(e.type,e.customType,o,e.groupCode).type};const a=db(e,n)??n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return{type:Si(e.type,e.customType,o).type};const r=$l(a);return r.length>=2?{type:`${a.name}PK`,pkOwner:a}:r.length===1?Aa(r[0],n,o,new Set([...i,a.modelId])):{type:Si(e.type,e.customType,o).type}}function Pd(e,n,o,i=new Set){return Aa(e,n,o,i).type}function zd(e,n,o,i){return`${Cn(e,o,i)||yo}.${e.name}.${n}`}function $a(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!Ta(n.end2.multiplicity)&&e.dbAttrs.length===1}function Tl(e,n,o){var a;if(e.derivedIdFieldName)return e.derivedIdFieldName;const i=Ol(e,n,o,0);return Dd(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function ub(e,n,o,i,a){var l;const r=e.derivedFrom?(l=o.get(n.end1.entityRef))==null?void 0:l.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef):void 0;return Pd(r||e,i,a)}function Ml(e,n,o){var h,_,g;const i=new Map(n.entities.map(k=>[k.modelId,k])),a=nl(n.associations),r=new Map;for(const k of n.associations)k.end2.attributeRef&&r.set(k.end2.attributeRef,{assoc:k,role:"owner"}),k.end1.attributeRef&&k.end1.navigable&&r.set(k.end1.attributeRef,{assoc:k,role:"inverse"});const l=$l(e),s=new Set;for(const k of l)$a(k,(h=r.get(k.modelId))==null?void 0:h.assoc)&&s.add(k.modelId);const c=new Set(l.filter(k=>k.attrType==="NORMAL").flatMap(k=>k.dbAttrs.map(E=>E.physicalName)).filter(Boolean)),d=[],u=[];for(const k of l){if(!s.has(k.modelId))continue;const E=r.get(k.modelId).assoc,b=k.dbAttrs[0],v=(b==null?void 0:b.physicalName)||Ol(k,E,i,0)||"";if(v&&c.has(v))continue;const y=Tl(k,E,i);if(!y){u.push(k);continue}const S=k.derivedFrom?(_=i.get(E.end1.entityRef))==null?void 0:_.attributes.find($=>$.modelId===k.derivedFrom.sourceAttributeRef):void 0;d.push({attr:{modelId:`synthetic-id:${k.modelId}`,name:y,type:o?o(k,E):(S==null?void 0:S.type)??k.type,customType:(S==null?void 0:S.customType)??k.customType,attrType:"NORMAL",identifier:!0,notNull:!0,order:k.order,dbAttrs:[{...b??{modelId:`synthetic-col:${k.modelId}`,dataType:""},physicalName:v}]},role:"scalar",synthetic:!0,sourceAttr:k})}const m=[],p=[];for(const k of e.attributes)if(k.attrType!=="DIVIDER"){if(k.attrType.startsWith("EMBED")){p.push({attr:k,role:"embed",synthetic:!1,sourceAttr:k,collection:Ei(k,n.associations)});continue}if(k.attrType==="RELATION_OWN"){const E=r.get(k.modelId);E?p.push({attr:k,role:"relation-owner",synthetic:!1,sourceAttr:k,assoc:E.assoc,target:i.get(E.assoc.end1.entityRef)}):ol(k,e,a)?m.push({attr:k,reason:"join-column-only"}):m.push({attr:k,reason:"no-anchor"});continue}if(k.attrType==="RELATION_REF"){const E=r.get(k.modelId);if(!E){m.push({attr:k,reason:"nav-not-materialized"});continue}p.push({attr:k,role:"relation-inverse",synthetic:!1,sourceAttr:k,assoc:E.assoc,target:i.get(E.assoc.end2.entityRef),collection:Ta(E.assoc.end2.multiplicity)?((g=E.assoc.end2.jpa)==null?void 0:g.collectionType)??"LIST":void 0});continue}p.push({attr:k,role:"scalar",synthetic:!1,sourceAttr:k})}return{fields:[...d,...p].sort((k,E)=>k.attr.order-E.attr.order),omitted:m,unresolvedDerivedIds:u}}function mb(e,n,o){var x,R,N,I,C,U;if(e.stereotype==="JPA_EMBEDDABLE")return fb(e,n,o);if(e.stereotype==="SERIALIZED_TYPE")return pb(e,n,o);const i=new Al,a=e.name;let r=Cn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${yo}')`),r=yo);const l=new Map(n.entities.map(A=>[A.modelId,A])),s=r,c=Yd(e,o,i),d=new Map;for(const A of n.associations)A.end2.attributeRef&&d.set(A.end2.attributeRef,{assoc:A,role:"owner"}),A.end1.attributeRef&&A.end1.navigable&&d.set(A.end1.attributeRef,{assoc:A,role:"inverse"});const u=$l(e),m=new Set;for(const A of u)$a(A,(x=d.get(A.modelId))==null?void 0:x.assoc)&&m.add(A.modelId);const p=Ml(e,n,(A,P)=>ub(A,P,l,n,o)),f=p.fields.filter(A=>A.synthetic).map(A=>A.attr);for(const A of p.unresolvedDerivedIds)i.fillIn(`${a}.${A.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);for(const A of p.omitted)A.reason==="no-anchor"&&i.fillIn(`${e.name}.${A.attr.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`);const h=new Set(p.omitted.map(A=>A.attr.modelId)),_=[...u.filter(A=>!m.has(A.modelId)&&!h.has(A.modelId)),...f].sort((A,P)=>A.order-P.order),g=_.length>=2,k=_.length===1,E=`${a}PK`,b=A=>m.has(A.modelId)?"mapsId":A.identifier?"id":"none",v=o.lombok!==!1;i.jpa("Entity"),i.import(nt.jsonIdentityInfo),i.import(nt.jsogGenerator);const y=["@Entity"];y.push(wb(e,n,o,i)),y.push('@SuppressWarnings("serial")'),y.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),g&&(i.jpa("IdClass"),i.import(`${r}.${a}.${E}`),y.push(`@IdClass(${a}.${E}.class)`)),(R=e.jpaAttrs)!=null&&R.useDynamicInsert&&(y.push("@DynamicInsert"),i.import(nt.dynamicInsert)),(N=e.jpaAttrs)!=null&&N.useDynamicUpdate&&(y.push("@DynamicUpdate"),i.import(nt.dynamicUpdate)),(I=e.jpaAttrs)!=null&&I.useCacheable&&(y.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(Ud),y.push("@PersonalInfo")),v&&(i.import(nt.lombokNoArgs),i.import(nt.lombokAccessLevel),y.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const A of Ci(In(e),""))i.line(A);for(const A of y)i.line(A);const S=e.abstractClass?"abstract ":"";i.line(`public ${S}class ${a}${c}${Ll(e,i)} {`);const $=p.fields.map(A=>A.attr),O=new Set(f.map(A=>A.modelId));for(const A of u){if(!m.has(A.modelId))continue;const P=(C=A.dbAttrs[0])==null?void 0:C.physicalName;if(P)for(const F of u)F.attrType==="NORMAL"&&F.dbAttrs.some(H=>H.physicalName===P)&&O.add(F.modelId)}const B=(U=e.jpaAttrs)!=null&&U.useVersion?u.length?u[u.length-1].modelId:null:void 0,z=[];for(const A of $){if(A.attrType.startsWith("EMBED"))z.push(...Kd(A,e,n,o,i));else if(A.attrType==="RELATION_OWN"){const P=d.get(A.modelId),F=vb(A,P.assoc,s,l,b(A),v,n,o,i);F&&z.push(F)}else if(A.attrType==="RELATION_REF"){const P=d.get(A.modelId),F=Cb(A,P.assoc,s,l,v,n,o,i);F&&z.push(F)}else z.push(Hd(A,e,n,o,i,O.has(A.modelId)));A.modelId===B&&Fd(i,z,v)}B===null&&Fd(i,z,v),v||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Vl(z,i,v),Bl(e,i),g&&(i.import(nt.jsonBackReference),i.import(nt.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${E} getPK() {`),i.line(` return (${E}) HibernateBeanUtil.getPK(this);`),i.line(" }"),xb(E,_.map(A=>{const P=Aa(A,n,o);return P.pkOwner&&i.import(zd(P.pkOwner,P.type,n,o)),{type:P.type,name:A.name}}),v,i)),i.line("}");let T;if(g)T=Rb(a,E,r);else if(k){const A=Aa(_[0],n,o);T=Ab(a,r,A.type,A.pkOwner?zd(A.pkOwner,A.type,n,o):void 0)}return{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:T}}function Fd(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 Vl(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${Bd(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 fb(e,n,o){const i=new Al,a=e.name;let r=Cn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${yo}')`),r=yo),i.jpa("Embeddable"),i.import(nt.jsonIdentityInfo),i.import(nt.jsogGenerator),i.import(nt.serializable);for(const d of Ci(In(e),""))i.line(d);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)");const l=e.abstractClass?"abstract ":"";i.line(`public ${l}class ${a}${Ll(e,i,["Serializable"])} {`);const s=e.attributes.filter(d=>d.attrType!=="DIVIDER").sort((d,u)=>d.order-u.order),c=[];for(const d of s){if(d.attrType.startsWith("EMBED")){c.push(...Kd(d,e,n,o,i));continue}c.push(Hd(d,e,n,o,i))}return Vl(c,i,o.lombok!==!1),Bl(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function pb(e,n,o){const i=new Al,a=e.name;let r=Cn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${yo}')`),r=yo),i.import(nt.serializable);for(const u of Ci(In(e),""))i.line(u);e.hasPersonalInfo&&(i.import(Ud),i.line("@PersonalInfo"));const l=e.abstractClass?"abstract ":"",s=Yd(e,o,i,!1);i.line(`public ${l}class ${a}${s}${Ll(e,i,["Serializable"])} {`);const c=e.attributes.filter(u=>u.attrType!=="DIVIDER").sort((u,m)=>u.order-m.order),d=[];for(const u of c){if(u.attrType.startsWith("EMBED")){i.fillIn(`${a}.${u.name||"(무명)"}: 직렬화 타입에 임베드 속성(${u.attrType}) — 직렬화 타입은 관계로 임베드되지 않으므로 방출하지 않음, 모델 정정 필요`);continue}if(u.attrType.startsWith("RELATION")){i.fillIn(`${a}.${u.name||"(무명)"}: 직렬화 타입에 연관 속성(${u.attrType}) — 직렬화 타입은 연관에 참여하지 않으므로 방출하지 않음, 모델 정정 필요`);continue}d.push(gb(u,e,n,o,i))}return Vl(d,i,o.lombok!==!1),Bl(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function hb(e){if(e.fieldAnnotations.length===0)return yb;const n=e.fieldAnnotations.join(" "),o=new Set;for(const i of e.imports){const a=i.slice(i.lastIndexOf(".")+1).replace(/\$/g,"\\$"),r=new RegExp(`\\b${a}\\b`);r.test(n)&&!r.test(e.type)&&o.add(i)}return o}const yb=new Set;function gb(e,n,o,i,a){const r=n.name,l=e.name||"unnamedField";e.name||a.fillIn(`${r}.${l}: 속성 이름 미지정 — 직렬화 타입 필드명을 결정할 근거가 없음, 모델 정정 필요`);const s=Td(e,n,o,i,!1)??Si(e.type,e.customType,i,e.groupCode),c=hb(s);for(const f of s.imports)c.has(f)||a.import(f);for(const f of s.fillIns)a.fillIn(`${r}.${l}: ${f}`);const d=/^(List|Set|Map)</.test(s.type),u=d?void 0:e.collectionType,m=u==="SET"?"HashSet":"ArrayList",p=u?`${u==="SET"?"Set":"List"}<${s.type}>`:s.type;u?(a.import(u==="SET"?"java.util.Set":"java.util.List"),a.import(`java.util.${m}`)):d&&e.collectionType&&a.fillIn(`${r}.${l}: 컨테이너가 요소 타입(${s.type})과 속성(collectionType) 양쪽에 지정됨 — 요소 타입 것을 쓴다, 모델 확인 필요`),a.line("");for(const f of Ci(Hn(e.fieldLogicalName)?e.fieldLogicalName:e.description," "))a.line(f);return ho(a,i.lombok!==!1),a.line(u?` private ${p} ${l} = new ${m}<>();`:` private ${p} ${l};`),{type:p,name:l,category:0}}function Ll(e,n,o=[]){const i=(e.declarationOfInterfaces??[]).map(s=>s.trim()).filter(Boolean),a=new Set(i.filter(s=>!s.includes("."))),r=[...i].sort().map(s=>{if(!s.includes("."))return s;const c=s.slice(s.lastIndexOf(".")+1);return a.has(c)?s:(n.import(s),c)}),l=[...o,...r];return l.length?` implements ${l.join(", ")}`:""}const Ud="net.g1project.bluecomm.annotation.PersonalInfo",bb="net.g1project.bluecomm.annotation.PersonalInfoAttribute",_b="net.g1project.bluecomm.model.PersonalInfoAttributeType";function Bl(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Dt(i.name)||Dt(a))continue;const r=a.replace(/\r\n/g,`
26
26
  `).split(`
@@ -31,7 +31,7 @@ ${u}
31
31
  `)+`
32
32
  `}}function Ab(e,n,o,i){const a=[`${n}.${e}`,...i?[i]:[],nt.jpaRepository,nt.querydslExecutor].sort(),r=[`package ${n};`,""];for(const l of a)r.push(`import ${l};`);return r.push(""),r.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),r.push("}"),{fileName:`${e}Repository.java`,source:r.join(`
33
33
  `)+`
34
- `}}const yo="com.example",$b="command.domain";function Cn(e,n,o={}){const i=Uo(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??$b,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Tb="CustomMoneyType",Mb="Money";function Vb(e){return!(e.type!==Tb||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Lb(e){const n=e.dbAttrs[0]??{modelId:Le(),physicalName:"",dataType:""},o={modelId:Le(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Mb,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Bb(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Vb(l)?(a=!0,n=!0,Lb(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Db(e,n){const o=new Map,i=[],a=new Map;for(const h of e.entities){const _=new Map,g=new Map,k=new Map,E=(b,v,y)=>{if(!b)return;o.get(b)||o.set(b,[{entityId:v,assignedId:b}]),i.push({id:b,entityId:v,sink:y}),y(b)};for(const b of h.attributes){E(b.modelId,h.modelId,v=>_.set(b,v));for(const v of b.dbAttrs)E(v.modelId,h.modelId,y=>g.set(v,y))}for(const b of h.indexes??[])E(b.modelId,h.modelId,v=>k.set(b,v));a.set(h,{attrs:_,cols:g,idx:k})}const r=new Set(o.keys()),l=new Map;for(const h of i){const _=(l.get(h.id)??0)+1;if(l.set(h.id,_),_===1)continue;const g=Ob(h.id,_-1,r);r.add(g),o.get(h.id).push({entityId:h.entityId,assignedId:g}),h.sink(g)}const s=[...o.values()].reduce((h,_)=>h+Math.max(0,_.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(h,_)=>{var k;if(!_||!h)return _;const g=o.get(_);return!g||g.length<2?_:((k=g.find(E=>E.entityId===h))==null?void 0:k.assignedId)??_},d=new Map(e.associations.map(h=>[h.modelId,h])),u=(h,_)=>{const g=d.get(h);if(g)return g.end1.entityRef===_?g.end2.entityRef:g.end1.entityRef},m=e.entities.map(h=>{var b;const _=a.get(h),g=h.attributes.map(v=>{const y=_.attrs.get(v),S=v.dbAttrs.map(B=>{const z=_.cols.get(B);return z===B.modelId?B:{...B,modelId:z}});let $=v.derivedFrom;if($){const B=u($.associationRef,h.modelId),z=c(B,$.sourceAttributeRef);z!==$.sourceAttributeRef&&($={...$,sourceAttributeRef:z})}return y!==v.modelId||$!==v.derivedFrom||S.some((B,z)=>B!==v.dbAttrs[z])?{...v,modelId:y,dbAttrs:S,derivedFrom:$}:v}),k=(b=h.indexes)==null?void 0:b.map(v=>{const y=_.idx.get(v),S=v.columns.map(O=>{const B=c(h.modelId,O.columnRef);return B===O.columnRef?O:{...O,columnRef:B}});return y!==v.modelId||S.some((O,B)=>O!==v.columns[B])?{...v,modelId:y,columns:S}:v});return g.some((v,y)=>v!==h.attributes[y])||k&&h.indexes&&k.some((v,y)=>v!==h.indexes[y])?{...h,attributes:g,...k?{indexes:k}:{}}:h}),p=e.associations.map(h=>{const _=c(h.end1.entityRef,h.end1.attributeRef),g=c(h.end2.entityRef,h.end2.attributeRef);return _===h.end1.attributeRef&&g===h.end2.attributeRef?h:{...h,end1:_===h.end1.attributeRef?h.end1:{...h.end1,attributeRef:_},end2:g===h.end2.attributeRef?h.end2:{...h.end2,attributeRef:g}}}),f=n.associationLayouts.map(h=>{const _=d.get(h.associationRef);if(!_)return h;const g=c(_.end1.entityRef,h.sourceColumnRef),k=c(_.end2.entityRef,h.targetColumnRef);return g===h.sourceColumnRef&&k===h.targetColumnRef?h:{...h,sourceColumnRef:g,targetColumnRef:k}});return{logical:{...e,entities:m,associations:p},layout:f.some((h,_)=>h!==n.associationLayouts[_])?{...n,associationLayouts:f}:n,reissued:s}}function Ob(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}const Pb="5.2.27";function Yt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Pl(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function qd(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Wd(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(qd);if(!i.length)continue;const a=o.filter(s=>!qd(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 Wo(e){return JSON.parse(JSON.stringify(e))}function Jd(e,n,o){var O;const i=o.idFactory??Le,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const B=new Set(n);for(const z of r.associations){const T=B.has(z.end1.entityRef),x=B.has(z.end2.entityRef);T!==x&&s.add(T?z.end2.entityRef:z.end1.entityRef)}}const c=r.entities.filter(B=>s.has(B.modelId)),d=new Set(c.map(B=>B.modelId)),u=r.associations.filter(B=>d.has(B.end1.entityRef)&&d.has(B.end2.entityRef)),m=new Set(u.map(B=>B.modelId)),p=new Map,f=B=>{let z=p.get(B);return z||(z=i(),p.set(B,z)),z};for(const B of c){f(B.modelId);for(const z of B.attributes){f(z.modelId);for(const T of z.dbAttrs)f(T.modelId)}for(const z of B.indexes??[])f(z.modelId);for(const z of B.operations??[])f(z.modelId)}for(const B of u)f(B.modelId);const h=B=>p.get(B),_=c.map(B=>{const z=Wo(B);z.modelId=h(B.modelId),z.attributes=z.attributes.map(T=>zb(T,h,m,d));for(const T of z.indexes??[])T.modelId=h(T.modelId),T.columns=T.columns.map(x=>ao(x.columnRef)?x:{...x,columnRef:h(x.columnRef)}).filter(x=>x.columnRef!==void 0);for(const T of z.operations??[])T.modelId=h(T.modelId);return z});Wd(_);const g=u.map(B=>{const z=Wo(B);return z.modelId=h(B.modelId),z.end1=Xd(z.end1,h),z.end2=Xd(z.end2,h),z}),k=[];for(const B of r.groups){const z=B.memberEntityRefs.filter(x=>d.has(x));if(z.length===0)continue;const T=Wo(B);T.modelId=f(B.modelId),T.memberEntityRefs=z.map(x=>h(x)),k.push(T)}const E=o.collisionSuffix??"_imported",b=new Set(o.existing.entities.map(B=>B.name)),v=new Set(o.existing.entities.map(B=>{var z;return(z=B.table)==null?void 0:z.physicalName}).filter(B=>!!B));for(const B of _)b.has(B.name)&&(B.name=`${B.name}${E}`),(O=B.table)!=null&&O.physicalName&&v.has(B.table.physicalName)&&(B.table.physicalName=`${B.table.physicalName}${E}`);const y=[];for(const B of l.entityLayouts){const z=h(B.entityRef);if(!z)continue;const T=Wo(B);T.entityRef=z,T.geo={...T.geo,location:zl(T.geo.location,a)},T.attributeStyles&&(T.attributeStyles=Ma(T.attributeStyles,h)),T.operationStyles&&(T.operationStyles=Ma(T.operationStyles,h)),y.push(T)}const S=[];for(const B of l.associationLayouts){const z=h(B.associationRef);if(!z)continue;const T=Wo(B);T.associationRef=z,T.sourceColumnRef=B.sourceColumnRef?h(B.sourceColumnRef):void 0,T.targetColumnRef=B.targetColumnRef?h(B.targetColumnRef):void 0,T.waypoints=T.waypoints.map(x=>zl(x,a)),S.push(T)}const $=[];for(const B of l.groupLayouts){const z=h(B.groupRef);if(!z)continue;const T=Wo(B);T.groupRef=z,T.geo={...T.geo,location:zl(T.geo.location,a)},delete T.memberNoteRefs,$.push(T)}return{logical:{entities:_,associations:g,groups:k},layout:{entityLayouts:y,associationLayouts:S,groupLayouts:$},idMap:p}}function zl(e,n){return{x:e.x+n.x,y:e.y+n.y}}function zb(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 Xd(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function Ma(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Fl(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function go(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)=>go(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(!go(e[i],n[i]))return!1;return!0}return!1}function bo(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||go(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function _o(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 Fb(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 Ub=new Set(["attributes","operations","indexes","rev"]),Hb=new Set(["end1","end2","rev"]),jb=new Set(["memberEntityRefs","rev"]),Zd=new Set(["modelId"]),Kb=new Set(["modelId","columns"]),Gb=new Set([]);function Yb(e,n,o,i){const a=_o(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=bo(s,c,Zd);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=_o(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=bo(s,c,Zd);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=_o(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(!go(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=bo(s,c,Kb);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function qb(e,n,o){const i=_o(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:Fl(l)});for(const{cur:l,tgt:s}of i.common){const c=bo(l,s,Ub);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Yb(l.modelId,l,s,o)}const a=_o(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:Fl(l)});for(const{cur:l,tgt:s}of a.common){const c=bo(l,s,Hb);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=bo(l[d]??{},s[d]??{},Gb);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=_o(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:Fl(l)});for(const{cur:l,tgt:s}of r.common){const c=bo(l,s,jb);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Fb(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 Va(e,n,o,i,a,r,l){const s=_o(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)go(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 Wb(e,n,o){Va(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Va(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Va(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Va(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Jb(e,n){const o=[];return qb(e.logical,n.logical,o),Wb(e.layout,n.layout,o),o}function Xb(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 Zb={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 Qb{constructor(n){dt(this,"out",[]);dt(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({...xi(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({...xi(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({...xi(n),field:a,value:void 0,removed:!0});continue}this.out.push({...xi(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({...xi(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function xi(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 un(e,n,o,i){if(o==null||typeof o!="object")return;const a=Zb[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function ko(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Ul(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Gn(e,n){var r,l,s,c,d,u,m,p;const o=Xb(n),i=new Qb(n.field),a=[...e].sort((f,h)=>f.seq-h.seq);for(const f of a)for(const h of f.ops)switch(o){case"entity":if(h.entityRef!==n.entityRef)break;h.kind==="entity.add"?un(i,f,h.value,"entity"):h.kind==="entity.update"?ko(i,f,h.patch):h.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const _=Ul((r=h.value)==null?void 0:r.attributes,n.attributeRef);_&&un(i,f,_,"attribute")}else h.kind==="attribute.add"&&((l=h.value)==null?void 0:l.modelId)===n.attributeRef?un(i,f,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===n.attributeRef?ko(i,f,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===n.attributeRef||h.kind==="entity.remove")&&i.remove(f);break;case"operation":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const _=Ul((s=h.value)==null?void 0:s.operations,n.operationRef);_&&un(i,f,_,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===n.operationRef?un(i,f,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===n.operationRef?ko(i,f,h.patch):(h.kind==="operation.remove"&&h.operationRef===n.operationRef||h.kind==="entity.remove")&&i.remove(f);break;case"index":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const _=Ul((d=h.value)==null?void 0:d.indexes,n.indexRef);_&&un(i,f,_,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===n.indexRef?un(i,f,h.value,"index"):h.kind==="index.update"&&h.indexRef===n.indexRef?ko(i,f,h.patch):(h.kind==="index.remove"&&h.indexRef===n.indexRef||h.kind==="entity.remove")&&i.remove(f);break;case"association":if(h.associationRef!==n.associationRef)break;h.kind==="association.add"?un(i,f,h.value,"association"):h.kind==="association.update"?ko(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(h.associationRef!==n.associationRef)break;if(h.kind==="association.add"){const _=(m=h.value)==null?void 0:m[n.end];un(i,f,_,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===n.end?ko(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"group":if(h.groupRef!==n.groupRef)break;if(h.kind==="group.add"){un(i,f,h.value,"group");const _=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(_))for(const g of _)i.member(f,g,!1)}else h.kind==="group.update"?ko(i,f,h.patch):h.kind==="group.remove"?i.remove(f):h.kind==="group.addMember"&&h.entityRef!=null?i.member(f,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(f,h.entityRef,!0);break}return i.result()}const rt={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},e_={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":rt,"entityLayout.remove":rt,"entityLayout.move":rt,"entityLayout.resize":rt,"entityLayout.setCollapsed":rt,"entityLayout.setLocked":rt,"entityLayout.setStyle":rt,"entityLayout.setAttrStyle":rt,"entityLayout.setOpStyle":rt,"groupLayout.add":rt,"groupLayout.remove":rt,"groupLayout.move":rt,"groupLayout.resize":rt,"groupLayout.setLocked":rt,"groupLayout.setStyle":rt,"groupLayout.addNoteMember":rt,"groupLayout.removeNoteMember":rt,"associationLayout.add":rt,"associationLayout.remove":rt,"associationLayout.setWaypoints":rt,"note.add":rt,"note.remove":rt,"note.move":rt,"note.resize":rt,"note.setMemo":rt,"note.setStyle":rt,"noteConnection.add":rt,"noteConnection.remove":rt,"noteConnection.setWaypoints":rt},Xt=e=>typeof e=="string"?e:void 0,t_=e=>{var n;return Xt((n=e.value)==null?void 0:n.modelId)};function Qd(e){return Xt(e.containerRef)??Xt(e.entityRef)}function Hl(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=Xt(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function jl(e){const n=e_[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=Xt(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Hl(o,"attributes","attribute",a),...Hl(o,"operations","operation",a),...Hl(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Qd(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?t_(o):Xt(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=Xt(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=Xt(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function n_(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=Xt(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Qd(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=Xt(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=Xt(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function o_(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function i_(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of jl(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function La(e,n){return e.map(o=>({...o,subject:n}))}function eu(e,n){const o=e.filter(s=>s.ops.some(c=>o_(c,n))),{attributes:i,operations:a,indexes:r}=i_(o,n),l=[...La(Gn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...La(Gn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...La(Gn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...La(Gn(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 Kl(e){return`${e.kind}:${e.ref}:${e.end??""}`}function a_(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of jl(i))a.existence==="add"&&n.add(Kl(a.subject));return n}function r_(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=n_(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function l_(e){const{entities:n,associations:o,groups:i}=r_(e),a=[];for(const r of n)for(const l of eu(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Gn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Gn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Gn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function Gl(e){const n=l_(e),o=a_(e),i=new Map;for(const l of n){const s=Kl(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=Kl(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}function tu(e){return`${e.kind}:${e.ref}:${e.end??""}`}function s_(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of jl(r)){if(!l.existence||l.inline)continue;const s=l.subject;c_.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const c_=new Set(["attribute","operation","index"]);function Yl(e,n){const{fromSeq:o}=n,i=Gl(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const p=tu(m.subject);let f=s.get(p);f||(f={subject:m.subject,evs:[]},s.set(p,f)),f.evs.push(m)};for(const m of l)for(const p of m.actions)c({seq:m.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const m of s_(e,o,r)){const p=s.get(tu(m.subject));p!=null&&p.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,h)=>f.seq-h.seq);const p=m.evs[m.evs.length-1];m.subject.kind==="entity"&&p.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const p=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||p&&f)continue;const h=new Map;let _=null;for(const k of m.evs){k.verb==="add"&&_!==null&&_!=="add"&&h.clear(),_=k.verb;for(const E of k.fields){const b=h.get(E.field);b?b.lastValue=E.value:h.set(E.field,{firstOld:E.oldValue,hasOld:E.oldValue!==void 0,lastValue:E.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const k=[];for(const[E,b]of h)k.push({field:E,value:b.lastValue});d.push({subject:m.subject,verb:"added",fields:k});continue}const g=[];for(const[k,E]of h)E.hasOld&&go(E.firstOld,E.lastValue)||g.push({field:k,value:E.lastValue,...E.hasOld?{oldValue:E.firstOld}:{}});g.length!==0&&d.push({subject:m.subject,verb:"modified",fields:g})}return{fromSeq:o,toSeq:r,entries:d}}function nu(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class ql{constructor(n){dt(this,"undoStack",[]);dt(this,"redoStack",[]);dt(this,"savePoint",null);dt(this,"listeners",new Set);dt(this,"commandListeners",new Set);dt(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function Ot(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function ou(e,n){var r,l;const o={logical:structuredClone(e.logical),layout:structuredClone(e.layout)},i=[],a=[];for(const s of n){s.apply(o);const c=((l=(r=s.emitOps)==null?void 0:r.call(s,o))==null?void 0:l.forward)??[];c.length===0&&a.push(s.label),i.push(...c)}return{ops:i,skipped:a}}function iu(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function It(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Zt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function mt(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function Sn(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 Ba(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=iu(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=It(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 au(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=iu(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=It(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(p=>p.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function Da(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=mt(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(mt(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Ot(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Ot(o)}]}}}}function ru(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=mt(i,e);o=a.name,a.name=n},invert(i){mt(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 Jo(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=It(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=It(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 lu(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=It(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=It(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 Ri(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 su(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=It(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=Ri(r.style,n)},invert(i){const a=It(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=It(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 cu(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=It(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=It(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 du(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=It(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=It(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 Wl(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 Oa(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=It(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=Ri(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=It(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=It(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 Pa(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 uu(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:Ot(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Ot(o)}]}}}}function mu(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 fu(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 za(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 pu(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 hu(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 yu(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=Ri(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 gu(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 qt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){mt(o,e).attributes.push(n)},invert(o){const i=mt(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 Qt(e,n,o){const i={},a=r=>{const l=mt(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:Ot(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Ot(i)}]}}}}function bu(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=mt(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&&mt(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 _u(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function Jl(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=mt(a,e);i=r.attributes.map(s=>({...s}));const l=Pl([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&mt(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=mt(a,e).attributes;return _u("attribute.update","attributeRef",e,r,i??[])}}}function ku(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=mt(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=mt(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 Eu(e,n,o){const i={},a=r=>{var s;const l=(s=mt(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:Ot(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Ot(i)}]}}}}function Nu(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=mt(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=mt(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 wu(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=mt(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Pl([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=mt(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=mt(a,e).operations??[];return _u("operation.update","operationRef",e,r,i??[])}}}function Iu(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=It(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=Ri(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=It(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=It(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 Fa(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 vu(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function Ua(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Ot(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Ot(o)}]}}}}function en(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:Ot(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Ot(i)}]}}}}function Cu(e,n){return{label:"인덱스 추가",apply(o){const i=mt(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=mt(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 Ha(e,n,o){const i={},a=r=>{var s;const l=(s=mt(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:Ot(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Ot(i)}]}}}}function Su(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=mt(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&&mt(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 mn=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),Ai=(e,n)=>{var o;return((o=Zt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function xu(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Zt(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=Zt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=Ai(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[mn(e,r)],invert:[mn(e,l)]}}}}function Ru(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Zt(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=Zt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=Ai(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[mn(e,a)],invert:[mn(e,r)]}}}}function Au(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Zt(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=Zt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[mn(e,Ai(a,e))],invert:[mn(e,i??[])]}}}}function $u(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Zt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Zt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[mn(e,Ai(o,e))],invert:[mn(e,n??[])]}}}}function Tu(e,n,o){return{label:"waypoint 추가",apply(i){const a=Zt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Zt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=Ai(i,e),r=a.slice();return r.splice(n,1),{forward:[mn(e,a)],invert:[mn(e,r)]}}}}function Mu(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 Vu(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 $i(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 Lu(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 Bu(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 Du(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=Ri(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 Ou(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 Pu(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 Yn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),ja=(e,n,o)=>{var i;return((i=Sn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function zu(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 Fu(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 Uu(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=Sn(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=Sn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=ja(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Yn(e,n,l)],invert:[Yn(e,n,s)]}}}}function Hu(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=Sn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=Sn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=ja(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Yn(e,n,r)],invert:[Yn(e,n,l)]}}}}function ju(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=Sn(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=Sn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=ja(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Yn(e,n,r)],invert:[Yn(e,n,l)]}}}}function Ku(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Sn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=Sn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Yn(e,n,ja(i,e,n))],invert:[Yn(e,n,o??[])]}}}}function ot(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 d_=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Fa,addAttribute:qt,addEntity:Ba,addEntityToGroup:fu,addGroup:Pa,addIndex:Cu,addNote:Mu,addNoteConnection:zu,addNoteConnectionWaypoint:Hu,addNoteToGroup:Ou,addOperation:ku,addWaypoint:Tu,clearNoteConnectionWaypoints:Ku,clearWaypoints:$u,composite:ot,moveEntity:Jo,moveGroup:pu,moveNote:$i,moveNoteConnectionWaypoint:Uu,moveWaypoint:xu,removeAssociation:vu,removeAttribute:bu,removeEntity:au,removeEntityFromGroup:za,removeGroup:mu,removeIndex:Su,removeNote:Vu,removeNoteConnection:Fu,removeNoteConnectionWaypoint:ju,removeNoteFromGroup:Pu,removeOperation:Nu,removeWaypoint:Ru,renameEntity:ru,reorderAttributes:Jl,reorderOperations:wu,resizeEntity:lu,resizeGroup:hu,resizeNote:Lu,setAllEntitiesCollapsed:Wl,setAttributeSwatch:Oa,setEntityCollapsed:cu,setEntityLocked:du,setEntitySwatch:su,setGroupLocked:gu,setGroupSwatch:yu,setNoteMemo:Bu,setNoteSwatch:Du,setOperationSwatch:Iu,translateWaypoints:Au,updateAssociation:Ua,updateAssociationEnd:en,updateAttribute:Qt,updateEntity:Da,updateGroup:uu,updateIndex:Ha,updateOperation:Eu},Symbol.toStringTag,{value:"Module"}));class Gu{constructor(){dt(this,"revs",new Map);dt(this,"layoutVersion",0);dt(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const u_=[400,1200];function m_(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function f_(e){const n=m_(e);return n==null||n===408||n===429?!0:n<400||n>=500}const p_=e=>new Promise(n=>setTimeout(n,e));class Yu{constructor(n){dt(this,"cache",new Gu);dt(this,"newClientOpId");dt(this,"debounceMs");dt(this,"retryDelaysMs");dt(this,"emissions",new WeakMap);dt(this,"open",null);dt(this,"debounceHandle",null);dt(this,"queue",[]);dt(this,"sending",!1);dt(this,"_frozen",!1);dt(this,"stack",null);dt(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Le,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??u_}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!f_(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await p_(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const qu=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Wu=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Ju(e,n,o){var c;if(!n.length||!((c=e.indexes)!=null&&c.length))return[];const i=new Set(n),a=new Set,r=new Map,l=d=>{const u=o==null?void 0:o.get(d);u===void 0?a.add(d):u!==d&&r.set(d,u)};for(const d of e.attributes)if(i.has(d.modelId)){l(d.modelId);for(const u of d.dbAttrs)l(u.modelId)}if(!a.size&&!r.size)return[];const s=[];for(const d of e.indexes){let u=!1;const m=[];for(const p of d.columns){if(a.has(p.columnRef)){u=!0;continue}const f=r.get(p.columnRef);f===void 0?m.push(p):(m.push({...p,columnRef:f}),u=!0)}u&&s.push({indexRef:d.modelId,columns:m})}return s}function h_(e){return wn(e).length}function Xl(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function y_(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=bi(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function Xu(e,n,o=Le){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=h_(i);if(a===0)return[];const r=Xl(e,n),l=wn(i).map(c=>c.col),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;y_(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function Zu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const h=r.get(f);if(!h)return[];l.push(h)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,h)=>f===c[h]))return[];const d=new Map(s.map((f,h)=>[f,h])),u=Xl(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const _=c.map(k=>h.dbAttrs[d.get(k)]),g=_.reduce((k,E,b)=>E===h.dbAttrs[b]?k:k+1,0);g&&m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:_,moved:g})}return m}function Qu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=wn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(wn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,h)=>{c.has(f)&&d.add(h)}),d.size===s.length)return[];const u=Xl(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const _=h.dbAttrs.filter((E,b)=>d.has(b)),g=h.dbAttrs.filter((E,b)=>!d.has(b));h.dbAttrs.some((E,b)=>{if(d.has(b))return!1;const v=l[b],y=!!E.physicalName&&E.physicalName!==((v==null?void 0:v.physicalName)??""),S=E.sharedColumnRef!=null&&E.sharedColumnRef!==(v==null?void 0:v.sharedColumnRef);return y||S})||m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:_,dropped:g})}return m}function fn(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>bu(e,r))}function Wt(e,n,o){if(!n.length)return[];const i=new Map;for(const{entityId:r,attributeId:l}of n){const s=i.get(r)??[];s.push(l),i.set(r,s)}const a=[];for(const[r,l]of i){const s=e.entities.find(c=>c.modelId===r);if(s)for(const c of Ju(s,l,o))a.push(Ha(r,c.indexRef,{columns:c.columns}))}return a}function Ka(e,n,o,i){var c;const a=[];a.push(...fn(n,o.remove,i));for(const d of o.update)a.push(Qt(n,d.attributeId,d.patch));for(const d of o.add)a.push(qt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const p=l.filter(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,h)=>f.order-h.order)[0];p&&a.push(en(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function Eo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Xo(e,n,o){const i=[];for(const[a,r]of vl(e,n,Le))i.push(...Ka(e,a,r,o));for(const a of Xu(e,n,Le))i.push(Qt(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function g_(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Pl([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return Zu(e,n,r).map(l=>Qt(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function Zl(e,n,o){return Qu(e,n,o).map(i=>Qt(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function b_(e,n,o){const i=new Set(o.remove);return Eo(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 Ga(e,n,o){const i=[];for(const{entityId:a,plan:r}of Sd(e,n,Le))i.push(...Ka(e,a,r,o));return i}function em(e,n,o=new Set){var r,l,s,c;if(!cn(n))return[];const i=[];for(const d of e.attributes){if(o.has(d.modelId))continue;const u={},m=(r=d.dbAttrs.find(p=>Hn(p.logicalName)))==null?void 0:r.logicalName;m&&!Hn(d.fieldLogicalName)&&(u.fieldLogicalName=m),d.dbAttrs.length>0&&(u.dbAttrs=[]),d.notNull&&(u.notNull=!1),Object.keys(u).length>0&&i.push(Qt(e.modelId,d.modelId,u))}const a={};return Hn((l=e.table)==null?void 0:l.logicalName)&&!Hn(e.classLogicalName)&&(a.classLogicalName=e.table.logicalName),(s=e.table)!=null&&s.physicalName&&(a.table=null),(c=e.indexes)!=null&&c.length&&(a.indexes=[]),e.schema&&(a.schema=null),e.jpaAttrs&&(a.jpaAttrs=null),Object.keys(a).length>0&&i.push(Da(e.modelId,a)),i}function tm(e){return wn(e).map(n=>({...n.col,modelId:Le()}))}function nm(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=Yt(o.attributes),p=new Set(o.attributes.map(h=>h.name));let f="id";for(let h=2;p.has(f);h++)f=`id${h}`;a={modelId:Le(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Le(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(qt(n,a))}const r=[];for(const m of e.entities)for(const p of m.attributes){if(((u=p.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(k=>k.modelId===p.embedded.associationRef);if(!f)continue;const h=f.end1.entityRef===m.modelId,_=h?f.end1:f.end2,g=h?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:_.multiplicity,navigable:_.navigable,composition:!1},end2:{entityRef:n,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const p=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return p.size?{...m,attributes:m.attributes.filter(f=>!p.has(f.modelId))}:m}),associations:e.associations.map(m=>{const p=r.find(f=>f.assocId===m.modelId);return p?{...m,end1:p.end1,end2:p.end2}:m})},s=Ii(l,n,Le);for(const m of r){const p=s.add.find(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...fn(m.ownerId,[m.dispId],c)),i.push(Ua(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Ka(l,n,s,c));const d=b_(l,n,s);return i.push(...Xo(d,n,c)),i.push(...Wt(e,c)),i}function om(e,n,o){const i=e.associations.find(l=>l.modelId===n);if(!i||i.end1.navigable===o)return null;const a=e.entities.find(l=>l.modelId===i.end1.entityRef),r=e.entities.find(l=>l.modelId===i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")return null;if(o===!0&&!i.end1.attributeRef){const l=ka(i.end2.multiplicity),s=i.end1.navFieldNameHint||Na(r.name,l),c=uo(s,new Set(a.attributes.map(m=>m.name))),d=Le(),u={modelId:d,name:c,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:Yt(a.attributes),dbAttrs:[]};return{cmds:[qt(i.end1.entityRef,u)],endPatch:{attributeRef:d,navFieldNameHint:void 0}}}if(o===!1&&i.end1.attributeRef){const l=i.end1.attributeRef,s=a.attributes.find(m=>m.modelId===l&&m.attrType==="RELATION_REF"),c={attributeRef:void 0,navFieldNameHint:(s==null?void 0:s.name)??i.end1.navFieldNameHint};if(!s)return{cmds:[],endPatch:c};const d=[],u=[...fn(i.end1.entityRef,[l],d)];return u.push(...Wt(e,d)),{cmds:u,endPatch:c}}return null}function im(e,n,o){const i=e.entities.find(u=>u.modelId===n);if(!i)return[];const a=i.attributes.filter(u=>u.identifier&&!u.derivedFrom).map(u=>Qt(n,u.modelId,{identifier:!1})),r=Eo({...e,entities:e.entities.map(u=>u.modelId===n?{...u,stereotype:o}:u)},n,u=>u.map(m=>m.identifier&&!m.derivedFrom?{...m,identifier:!1}:m)),l=[],s=Ga(r,[n],l);s.push(...Wt(e,l));const c=o==="JPA_EMBEDDABLE"?__(e,n):[],d=em(i,o,new Set(l.filter(u=>u.entityId===n).map(u=>u.attributeId)));return[...a,...s,...c,...d]}function __(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(b=>b.modelId===c);if(!d||d.attributes.some(b=>{var v;return((v=b.embedded)==null?void 0:v.associationRef)===r.modelId}))continue;const u=Le(),m=Yt(d.attributes),p=new Set(d.attributes.map(b=>b.name)),f=a(o.name);let h=f;for(let b=2;p.has(h);b++)h=`${f}${b}`;const _=o.attributes.filter(b=>!b.identifier&&!b.derivedFrom).flatMap(b=>b.dbAttrs).map(b=>({...b,modelId:Le()})),g={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:_,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(qt(c,g));const k=l?"end2":"end1",E=l?"end1":"end2";i.push(Ua(r.modelId,{identifying:!1,[k]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Le()},[E]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function am(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[pu(n,o),...i.map(u=>Jo(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(Au(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const p=e.layout.notes.find(f=>f.modelId===m);p&&c.push($i(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}const rm={diagramId:"",logicalModelRef:"",entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]};function k_(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function E_(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function lm(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function At(e,n){if(!Ya(n))return{ok:!1,reason:"shape",matches:[]};const o=k_(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_(i,e))}}function N_(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Ql(e,n){const o=N_(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function es(e,n,o){return e.reason==="shape"?{code:"handle-shape-invalid",opIndex:n,where:"group",expected:"{ref, by?}",got:is(o)}:e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const w_=new Set(["name","description","packageName","excludeDDLGeneration"]);function I_(e,n){var a;const o=Uo(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(p=>p.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function sm(e,n){const o=E_(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 v_(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function C_(e,n){const o=v_(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 cm(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 ts(e){return e.by!==void 0&&e.by!=="name"}function S_(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function x_(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function R_(e,n){const o=S_(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 dm(e,n){const o=x_(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 um(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function mm(e){return um(e)&&e.dataType==null}function fm(e,n,o){const i=um(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},...e.collectionType?{collectionType:e.collectionType}:{},...e.fieldLogicalName?{fieldLogicalName:e.fieldLogicalName}:{},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 pm(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let p=!1;for(const f of n.fields){const h=u.get(f.name);if(h!=null&&h.sharedColumnPhysicalName){const _={ref:h.sharedColumnPhysicalName,by:"physicalName"},g=cm(vn(i,a),_);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:g.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});continue}m.push({modelId:c(),physicalName:(h==null?void 0:h.physicalName)??"",dataType:"",...h!=null&&h.length?{length:h.length}:{},...h!=null&&h.scale?{scale:h.scale}:{},...(h==null?void 0:h.insertable)!=null?{insertable:h.insertable}:{},...(h==null?void 0:h.updatable)!=null?{updatable:h.updatable}:{},...(h==null?void 0:h.notNull)!=null?{notNull:h.notNull}:{}})}return p?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}const A_=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName","collectionType","fieldLogicalName"]),Zo=e=>new Set(Object.keys(e)),$_=Zo({name:!0,stereotype:!0,physicalName:!0,useVersion:!0,attributes:!0,indexes:!0,operations:!0,serialization:!0,classLogicalName:!0}),hm=Zo({name:!0,type:!0,identifier:!0,notNull:!0,transient:!0,physicalName:!0,dataType:!0,length:!0,scale:!0,groupCode:!0,defaultValue:!0,attributeGroup:!0,description:!0,columnLogicalName:!0,unique:!0,updatable:!0,embeddableOverrides:!0,collectionType:!0,fieldLogicalName:!0}),ym=Zo({name:!0,unique:!0,columns:!0,description:!0,parameters:!0}),gm=Zo({name:!0,visibility:!0,sourceCode:!0,description:!0,personalInfoAttributeType:!0}),T_=Zo({from:!0,to:!0,fromMultiplicity:!0,toMultiplicity:!0,identifying:!0,composition:!0}),M_=Zo({name:!0,packageName:!0,description:!0,excludeDDLGeneration:!0,members:!0});function xn(e,n){return No(e,n)}const V_=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","classLogicalName","referenceOnly","serialization"]),L_=new Set(["description","identifying"]),B_=new Set(["multiplicity","navigable","composition"]),D_=new Set(["name","unique","description","parameters"]),O_=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function No(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const ns=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),P_=new Set([...ns].filter(e=>e!=="sharedColumnRef"));function z_(e,n,o,i){if(i||o.some(l=>!P_.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))ns.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function F_(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,p)=>{const f=n.fields[p],h=f?c.get(f.name):void 0;if(!h){d.push(m);return}if(h.sharedColumnPhysicalName){const g={ref:h.sharedColumnPhysicalName,by:"physicalName"},k=cm(vn(i,a),g);if(!k.ok){s.push(k.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:k.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:k.value.modelId});return}const _={...m};delete _.sharedColumnRef,d.push({..._,...h.physicalName!=null?{physicalName:h.physicalName}:{},...h.length!=null?{length:h.length}:{},...h.scale!=null?{scale:h.scale}:{},...h.notNull!=null?{notNull:h.notNull}:{},...h.insertable!=null?{insertable:h.insertable}:{},...h.updatable!=null?{updatable:h.updatable}:{}})}),u?null:d}function bm(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 _m(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=C_(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 Qo(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function U_(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Ju(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function H_(e,n,o,i,a,r){const l=m=>{const p=new Map;for(const{entityId:f,item:h}of m){if(a.has(f))continue;const _=p.get(f)??[];_.push(h),p.set(f,_)}return p},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,p]of s)if(!c.has(m))for(const f of Qu(n,m,p))u(f);for(const[m,p]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(h=>h.modelId===m?{...h,attributes:[...h.attributes,...p]}:h)};for(const h of Xu(f,m,r))u(h)}}function km(e,n){const o={...e},i=[];for(const[a,r]of Object.entries(n)){if(!a.includes(".")){o[a]=r===null?void 0:r;continue}const l=/^dbAttrs\.(\d+)\.(.+)$/.exec(a);l&&i.push([Number(l[1]),l[2],r])}if(i.length){const a=(o.dbAttrs??[]).map(r=>({...r}));for(const[r,l,s]of i)a[r]&&(a[r][l]=s===null?void 0:s);o.dbAttrs=a}return o}function Em(e,n,o,i,a,r,l){var p;for(const f of i.remove)Qo(e,r,o,f);for(const f of i.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:f.attributeId,patch:f.patch}),a.attrPatches.push({entityId:o,attributeId:f.attributeId,patch:f.patch});const s=((p=n.entities.find(f=>f.modelId===o))==null?void 0:p.attributes)??[],c=[];for(const f of i.add){const h={...f,order:l(o,s)};e.push({kind:"attribute.add",casUnit:"logical",containerRef:o,entityRef:o,value:h}),a.cascadeAdds.push({entityId:o,attribute:h}),c.push(h)}const d=new Set(i.remove),u=[...s.filter(f=>!d.has(f.modelId)),...c],m=new Set(u.map(f=>f.modelId));for(const f of n.associations){if(f.end2.entityRef!==o)continue;const h=f.end2.attributeRef;if(h&&m.has(h))continue;const g=u.filter(k=>{var E;return((E=k.derivedFrom)==null?void 0:E.associationRef)===f.modelId&&k.dbAttrs.length>0}).sort((k,E)=>k.order-E.order)[0];g&&(e.push({kind:"associationEnd.update",casUnit:"logical",containerRef:f.modelId,associationRef:f.modelId,end:"end2",patch:{attributeRef:g.modelId}}),a.endPatches.push({associationRef:f.modelId,end:"end2",patch:{attributeRef:g.modelId}}))}}function os(e,n,o,i,a,r,l){for(const{entityId:s,plan:c}of Sd(n,o,i))Em(e,n,s,c,a,r,l)}function j_(e,n,o,i,a,r){const l=new Map;for(const{entityId:p,attributeId:f}of i.pairs)l.has(p)||l.set(p,new Set),l.get(p).add(f);const s=new Map;for(const p of r.attrPatches)s.has(p.entityId)||s.set(p.entityId,[]),s.get(p.entityId).push(p);const c=new Map;for(const{entityId:p,attribute:f}of[...a,...r.cascadeAdds])c.has(p)||c.set(p,[]),c.get(p).push(f);const d=p=>{const f={};for(const[h,_]of Object.entries(p))h.includes(".")||(f[h]=_===null?void 0:_);return f},u=e.entities.filter(p=>!n.has(p.modelId)).map(p=>{const f=l.get(p.modelId),h=s.get(p.modelId),_=c.get(p.modelId);if(!f&&!h&&!_)return p;let g=p.attributes;return f&&(g=g.filter(k=>!f.has(k.modelId))),h&&(g=g.map(k=>{const E=h.filter(b=>b.attributeId===k.modelId);return E.length?E.reduce((b,v)=>km(b,v.patch),k):k})),_&&(g=[...g,..._]),{...p,attributes:g}}),m=e.associations.filter(p=>!o.has(p.modelId)&&!n.has(p.end1.entityRef)&&!n.has(p.end2.entityRef)).map(p=>{let f=p;for(const h of r.assocPatches)h.associationRef===p.modelId&&(f={...f,...d(h.patch)});for(const h of r.endPatches)h.associationRef===p.modelId&&(f={...f,[h.end]:{...f[h.end],...d(h.patch)}});return f}).concat(r.addedAssociations);return{...e,entities:u,associations:m}}function K_(e,n,o,i,a,r,l,s,c){if(!l.identifierCascadeParents.size)return;const d=j_(n,o,i,a,r,l),u=new Map;for(const m of l.identifierCascadeParents)for(const[p,f]of vl(d,m,s)){const h=u.get(p);u.set(p,h?Il(h,f):f)}for(const[m,p]of u)Em(e,d,m,Cd(p),l,a,c)}function G_(e){const n=i=>{if(i==null||typeof i!="object"||Array.isArray(i))return!1;const a=Object.keys(i);return a.length>0&&a.every(r=>ha.includes(r))},o=i=>{if(n(i))return Bc(i)??null;if(Array.isArray(i)){const a=i.map(o);return a.some((r,l)=>r!==i[l])?a:i}if(i!=null&&typeof i=="object"){const a=i;let r=!1;const l={};for(const[s,c]of Object.entries(a))l[s]=o(c),l[s]!==c&&(r=!0);return r?l:i}return i};return e.map(i=>o(i))}function Y_(e,n,o={}){const i=G_(n),a=o.mkId??Le,r=o.embeddableCatalog??[],l=y=>r.find(S=>S.type===y),s=[],c=[],d=new Map,u=(y,S)=>{const $=d.get(y)??Yt(S);return d.set(y,$+1),$},m=new Map,p=new Set,f=new Set,h={seen:new Set,pairs:[]},_=[],g={attrPatches:[],cascadeAdds:[],addedAssociations:[],assocPatches:[],endPatches:[],identifierCascadeParents:new Set},k=new Set,E=(y,S)=>`${y}\0${S}`,b=new Set;for(const y of i)y.kind==="entity.add"&&(b.add(y.spec.name),y.spec.physicalName&&b.add(y.spec.physicalName));const v=new Set;return i.forEach((y,S)=>{var $,O,B,z,T;if(W_(y,S,c))switch(y.kind){case"entity.add":{{const P={ref:y.spec.name},F=xn(y.spec,$_);if(F.length){c.push({code:"entity-spec-unknown-key",opIndex:S,handle:P,keys:F});break}let H=!1;for(const G of y.spec.attributes??[]){const le=xn(G,hm);le.length&&(c.push({code:"attribute-spec-unknown-key",opIndex:S,entity:P,handle:{ref:G.name},keys:le}),H=!0)}for(const G of y.spec.indexes??[]){const le=xn(G,ym);le.length&&(c.push({code:"index-spec-unknown-key",opIndex:S,entity:P,handle:{ref:G.name},keys:le}),H=!0)}for(const G of y.spec.operations??[]){const le=xn(G,gm);le.length&&(c.push({code:"operation-spec-unknown-key",opIndex:S,entity:P,handle:{ref:G.name},keys:le}),H=!0)}if(H)break}const x=e.entities.filter(P=>P.name===y.spec.name).map(P=>P.modelId);if(x.length||v.has(y.spec.name)){c.push({code:"entity-name-conflict",opIndex:S,handle:{ref:y.spec.name},matches:x});break}v.add(y.spec.name);const R=a(),N={modelId:R,name:y.spec.name,stereotype:y.spec.stereotype??"JPA_ENTITY",attributes:[],...y.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...y.spec.physicalName?{table:{physicalName:y.spec.physicalName}}:{},...y.spec.serialization?{serialization:y.spec.serialization}:{},...y.spec.classLogicalName?{classLogicalName:y.spec.classLogicalName}:{}},I={ref:y.spec.name};let C=!1;for(const[P,F]of(y.spec.attributes??[]).entries()){if(ml(F.type,F.groupCode)){c.push(F.groupCode?{code:"groupcode-type-mismatch",opIndex:S,entity:I,handle:{ref:F.name},type:String(F.type??""),groupCode:F.groupCode}:{code:"groupcode-required",opIndex:S,entity:I,handle:{ref:F.name}}),C=!0;continue}if(!l(F.type)&&!(($=F.embeddableOverrides)!=null&&$.length)&&mm(F)){c.push({code:"datatype-required",opIndex:S,entity:I,handle:{ref:F.name}}),C=!0;continue}const H=l(F.type);if(H){const G=pm(F,H,P,N,e.entities,S,I,c,a);G?N.attributes.push(G):C=!0}else(O=F.embeddableOverrides)!=null&&O.length?(c.push({code:"embeddable-type-unresolved",opIndex:S,entity:I,handle:{ref:F.name}}),C=!0):N.attributes.push(fm(F,P,a))}const U=(y.spec.operations??[]).map((P,F)=>bm(P,F,a));U.length&&(N.operations=U);const A=[];for(const P of y.spec.indexes??[]){const F=_m(N,P,S,I,c,a);F?A.push(F):C=!0}if(A.length&&(N.indexes=A),C)break;s.push({kind:"entity.add",casUnit:"logical",entityRef:R,value:N});break}case"entity.update":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=No(y.patch,V_,["jpaAttrs.","table.","serialization."]);if(R.length){c.push({code:"entity-patch-unknown-key",opIndex:S,entity:y.entity,keys:R});break}const N=y.patch.stereotype;if(typeof N=="string"&&N!==x.value.stereotype){const I=x.value.stereotype,C=N,U=at(C)&&!at(I),A=!at(C)&&at(I);if(C!==I&&at(C)&&at(I)&&e.entities.filter(G=>G.attributes.some(le=>{var se;return((se=le.embedded)==null?void 0:se.embeddableRef)===x.value.modelId})).length>0){c.push({code:"stereotype-embeddable-transition-unsupported",opIndex:S,entity:y.entity,from:I??"",to:C});break}if(C==="SERIALIZED_TYPE"&&e.associations.filter(G=>G.end1.entityRef===x.value.modelId||G.end2.entityRef===x.value.modelId).length>0){c.push({code:"stereotype-serialized-transition-unsupported",opIndex:S,entity:y.entity,from:I??"",to:C});break}const F=U?im(e,x.value.modelId,C):A?nm(e,x.value.modelId):[];if(F.length){const H=Da(x.value.modelId,y.patch),G=ou({logical:e,layout:rm},[H,...F]);s.push(...G.ops);break}}s.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:y.patch});break}case"entity.remove":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=x.value.modelId,N=e.associations.filter(A=>A.end1.entityRef===R||A.end2.entityRef===R),I=new Set(N.map(A=>A.modelId));for(const A of N)p.has(A.modelId)||(p.add(A.modelId),s.push({kind:"association.remove",casUnit:"logical",associationRef:A.modelId}));for(const A of e.entities)if(A.modelId!==R)for(const P of A.attributes)P.embedded&&I.has(P.embedded.associationRef)&&Qo(s,h,A.modelId,P.modelId);for(const A of N){if(A.end1.entityRef===R||!A.end1.attributeRef)continue;const P=e.entities.find(H=>H.modelId===A.end1.entityRef),F=P==null?void 0:P.attributes.find(H=>H.modelId===A.end1.attributeRef&&H.attrType==="RELATION_REF");F&&Qo(s,h,P.modelId,F.modelId)}const C={...e,entities:e.entities.filter(A=>A.modelId!==R),associations:e.associations.filter(A=>!I.has(A.modelId))},U=new Set(N.filter(A=>A.end1.entityRef===R&&A.end2.entityRef!==R).map(A=>A.end2.entityRef));os(s,C,[...U],a,g,h,u);for(const A of e.groups)A.memberEntityRefs.includes(R)&&(k.has(E(A.modelId,R))||(k.add(E(A.modelId,R)),s.push({kind:"group.removeMember",casUnit:"logical",containerRef:A.modelId,groupRef:A.modelId,entityRef:R})));f.add(R),s.push({kind:"entity.remove",casUnit:"logical",entityRef:R});break}case"attribute.add":{{const C=xn(y.spec,hm);if(C.length){c.push({code:"attribute-spec-unknown-key",opIndex:S,entity:y.entity,handle:{ref:y.spec.name},keys:C});break}}const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}if(ml(y.spec.type,y.spec.groupCode)){c.push(y.spec.groupCode?{code:"groupcode-type-mismatch",opIndex:S,entity:y.entity,handle:{ref:y.spec.name},type:String(y.spec.type??""),groupCode:y.spec.groupCode}:{code:"groupcode-required",opIndex:S,entity:y.entity,handle:{ref:y.spec.name}});break}if(!l(y.spec.type)&&!((B=y.spec.embeddableOverrides)!=null&&B.length)&&mm(y.spec)){c.push({code:"datatype-required",opIndex:S,entity:y.entity,handle:{ref:y.spec.name}});break}const R=u(x.value.modelId,x.value.attributes),N=l(y.spec.type);let I;if(N)I=pm(y.spec,N,R,x.value,e.entities,S,y.entity,c,a);else if((z=y.spec.embeddableOverrides)!=null&&z.length){c.push({code:"embeddable-type-unresolved",opIndex:S,entity:y.entity,handle:{ref:y.spec.name}});break}else I=fm(y.spec,R,a);if(!I)break;s.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:I}),_.push({entityId:x.value.modelId,attribute:I}),I.identifier&&g.identifierCascadeParents.add(x.value.modelId);break}case"attribute.update":case"attribute.remove":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=sm(x.value,y.attribute);if(!R.ok){c.push(R.reason==="not-found"?{code:"attribute-not-found",opIndex:S,entity:y.entity,handle:y.attribute}:{code:"attribute-ambiguous",opIndex:S,entity:y.entity,handle:y.attribute,matches:R.matches});break}if(y.kind==="attribute.update"){const N=[],I=[];let C=!1;for(const F of Object.keys(y.patch)){if(F.includes(".")){F.startsWith("dbAttrs.")?C=!0:I.push(F);continue}ns.has(F)?N.push(F):A_.has(F)||I.push(F)}if(I.length){c.push({code:"attribute-patch-unknown-key",opIndex:S,entity:y.entity,handle:y.attribute,keys:I});break}if("attrType"in y.patch){const F=String(y.patch.attrType),H=Wu.includes(F)?F!==R.value.attrType?"transition":void 0:"unknown-value";if(H){c.push({code:"attribute-attrtype-unsupported",opIndex:S,entity:y.entity,handle:y.attribute,reason:H,current:R.value.attrType,requested:F});break}}if("type"in y.patch){const F=String(y.patch.type);if(Wc(R.value,F,r)){const H=ul(R.value),G=H==="association"?"association-owned":H==="derived"?"derived":"column-count";c.push({code:"attribute-type-conversion-unsupported",opIndex:S,entity:y.entity,handle:y.attribute,reason:G,current:R.value.type,requested:F});break}}const U="type"in y.patch?y.patch.type:R.value.type,A="groupCode"in y.patch?y.patch.groupCode:R.value.groupCode;if(ml(U,A)){c.push(A?{code:"groupcode-type-mismatch",opIndex:S,entity:y.entity,handle:y.attribute,type:String(U??""),groupCode:String(A)}:{code:"groupcode-required",opIndex:S,entity:y.entity,handle:y.attribute});break}let P=y.patch;if(N.length){const F=z_(R.value,y.patch,N,C);if(!F){c.push({code:"attribute-patch-dbattr-flat-key",opIndex:S,entity:y.entity,handle:y.attribute,keys:N});break}P=F}if((T=y.embeddableOverrides)!=null&&T.length){const F=l(R.value.type);if(!F||R.value.attrType!=="EMBED_PREDEF"){c.push({code:"embeddable-type-unresolved",opIndex:S,entity:y.entity,handle:y.attribute});break}const H=F_(R.value,F,y.embeddableOverrides,x.value,e.entities,S,y.entity,c);if(!H)break;P={...P,dbAttrs:H}}s.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:R.value.modelId,patch:P}),g.attrPatches.push({entityId:x.value.modelId,attributeId:R.value.modelId,patch:P});{const F=R.value,H=km(F,P),G=(H.identifier??!1)!==(F.identifier??!1),le=(F.identifier||H.identifier)&&("type"in P||"customType"in P||"dbAttrs"in P||Object.keys(P).some(se=>se.startsWith("dbAttrs.")));(G||le)&&g.identifierCascadeParents.add(x.value.modelId)}}else{const N=po(e,x.value.modelId,R.value.modelId);if(N){const I=C=>{var U;return((U=e.entities.find(A=>A.modelId===C))==null?void 0:U.name)??C};c.push({code:"attribute-fk-managed",opIndex:S,entity:y.entity,handle:y.attribute,association:{from:I(N.end1.entityRef),to:I(N.end2.entityRef)}});break}Qo(s,h,x.value.modelId,R.value.modelId),R.value.identifier&&g.identifierCascadeParents.add(x.value.modelId)}break}case"association.add":{{const A=xn(y.spec,T_);if(A.length){c.push({code:"association-spec-unknown-key",opIndex:S,handle:{from:y.spec.from,to:y.spec.to},keys:A});break}}const x=At(e,y.spec.from),R=At(e,y.spec.to);if(x.ok||c.push($t(x.reason,S,y.spec.from,x.matches,b)),R.ok||c.push($t(R.reason,S,y.spec.to,R.matches,b)),!x.ok||!R.ok)break;if(y.spec.identifying&&x.value.modelId===R.value.modelId){c.push({code:"self-identifying",opIndex:S,handle:{from:y.spec.from,to:y.spec.to}});break}if(x.value.stereotype==="JPA_EMBEDDABLE"||R.value.stereotype==="JPA_EMBEDDABLE"){c.push({code:"embeddable-relation-unsupported",opIndex:S,handle:{from:y.spec.from,to:y.spec.to}});break}if(x.value.stereotype==="SERIALIZED_TYPE"||R.value.stereotype==="SERIALIZED_TYPE"){c.push({code:"serialized-relation-invalid",opIndex:S,handle:{from:y.spec.from,to:y.spec.to}});break}const N=a(),I={modelId:N,...y.spec.identifying!=null?{identifying:y.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:y.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:R.value.modelId,multiplicity:y.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:y.spec.composition??!1}},C={...e,associations:[...e.associations,I]},U=Ii(C,R.value.modelId,a);U.add[0]&&(I.end2.attributeRef=U.add[0].modelId),s.push({kind:"association.add",casUnit:"logical",associationRef:N,value:I}),g.addedAssociations.push(I);for(const A of U.add){const P={...A,order:u(R.value.modelId,R.value.attributes)};s.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:P}),g.cascadeAdds.push({entityId:R.value.modelId,attribute:P})}break}case"association.remove":{const x=At(e,y.association.from),R=At(e,y.association.to);if(x.ok||c.push($t(x.reason,S,y.association.from,x.matches,b)),R.ok||c.push($t(R.reason,S,y.association.to,R.matches,b)),!x.ok||!R.ok)break;const N=lm(e,x.value.modelId,R.value.modelId);if(N.length!==1){c.push(N.length===0?{code:"association-not-found",opIndex:S,handle:y.association}:{code:"association-ambiguous",opIndex:S,handle:y.association,matches:N.map(A=>A.modelId)});break}const I=N[0];p.has(I.modelId)||(p.add(I.modelId),s.push({kind:"association.remove",casUnit:"logical",associationRef:I.modelId}));const C=e.entities.find(A=>A.attributes.some(P=>{var F;return((F=P.embedded)==null?void 0:F.associationRef)===I.modelId}));if(C){const A=C.attributes.find(P=>{var F;return((F=P.embedded)==null?void 0:F.associationRef)===I.modelId});Qo(s,h,C.modelId,A.modelId);break}if(I.end1.attributeRef){const A=e.entities.find(F=>F.modelId===I.end1.entityRef),P=A==null?void 0:A.attributes.find(F=>F.modelId===I.end1.attributeRef&&F.attrType==="RELATION_REF");P&&Qo(s,h,A.modelId,P.modelId)}const U={...e,associations:e.associations.filter(A=>A.modelId!==I.modelId)};os(s,U,[I.end2.entityRef],a,g,h,u);break}case"association.update":{const x=Nm(e,y.association,S,c,b);if(!x)break;const R=y.patch.identifying,N=typeof R=="boolean"?R:void 0;if(N===!0&&x.end1.entityRef===x.end2.entityRef){c.push({code:"self-identifying",opIndex:S,handle:y.association});break}const I=No(y.patch,L_);if(I.length){c.push({code:"association-patch-unknown-key",opIndex:S,handle:y.association,keys:I});break}if(s.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:y.patch}),g.assocPatches.push({associationRef:x.modelId,patch:y.patch}),N!==void 0&&N!==(x.identifying??!1)){const C={...e,associations:e.associations.map(U=>U.modelId===x.modelId?{...U,identifying:N}:U)};os(s,C,[x.end2.entityRef],a,g,h,u)}break}case"associationEnd.update":{const x=Nm(e,y.association,S,c,b);if(!x)break;const R=y.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(y.patch,"navigable")){if(R==="end2"){c.push({code:"navigable-toggle-unsupported",opIndex:S,handle:y.association});break}const I=y.patch.navigable===!0;if(x.end1.navigable!==I){const C=om(e,x.modelId,I);if(C){const U=en(x.modelId,"end1",{...y.patch,...C.endPatch}),A=ou({logical:e,layout:rm},[...C.cmds,U]);s.push(...A.ops);break}}}const N=No(y.patch,B_,["jpa."]);if(N.length){c.push({code:"association-end-patch-unknown-key",opIndex:S,handle:y.association,keys:N});break}s.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:R,patch:y.patch}),g.endPatches.push({associationRef:x.modelId,end:R,patch:y.patch});break}case"index.add":{{const N=xn(y.spec,ym);if(N.length){c.push({code:"index-spec-unknown-key",opIndex:S,entity:y.entity,handle:{ref:y.spec.name},keys:N});break}}const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=_m(x.value,y.spec,S,y.entity,c,a);if(!R)break;s.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.modelId,value:R});break}case"index.update":case"index.remove":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}if(ts(y.index)){c.push({code:"handle-by-unsupported",opIndex:S,entity:y.entity,handle:y.index,target:"index"});break}const R=R_(x.value,y.index);if(!R.ok){c.push(R.reason==="not-found"?{code:"index-not-found",opIndex:S,entity:y.entity,handle:y.index}:{code:"index-ambiguous",opIndex:S,entity:y.entity,handle:y.index,matches:R.matches});break}if(y.kind==="index.update"){if("columns"in y.patch){c.push({code:"index-columns-patch-unsupported",opIndex:S,entity:y.entity,handle:y.index});break}const N=No(y.patch,D_);if(N.length){c.push({code:"index-patch-unknown-key",opIndex:S,entity:y.entity,handle:y.index,keys:N});break}s.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId,patch:y.patch})}else s.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId});break}case"operation.add":{{const I=xn(y.spec,gm);if(I.length){c.push({code:"operation-spec-unknown-key",opIndex:S,entity:y.entity,handle:{ref:y.spec.name},keys:I});break}}const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=m.get(x.value.modelId)??(x.value.operations?Yt(x.value.operations):0);m.set(x.value.modelId,R+1);const N=bm(y.spec,R,a);s.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:N.modelId,value:N});break}case"operation.update":case"operation.remove":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}if(ts(y.operation)){c.push({code:"handle-by-unsupported",opIndex:S,entity:y.entity,handle:y.operation,target:"operation"});break}const R=dm(x.value,y.operation);if(!R.ok){c.push(R.reason==="not-found"?{code:"operation-not-found",opIndex:S,entity:y.entity,handle:y.operation}:{code:"operation-ambiguous",opIndex:S,entity:y.entity,handle:y.operation,matches:R.matches});break}if(y.kind==="operation.update"){const N=No(y.patch,O_);if(N.length){c.push({code:"operation-patch-unknown-key",opIndex:S,entity:y.entity,handle:y.operation,keys:N});break}s.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId,patch:y.patch})}else s.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=y.kind==="attribute.reorder",R=At(e,y.entity);if(!R.ok){c.push($t(R.reason,S,y.entity,R.matches,b));break}const N=x?y.order:y.operations;if(N.length===0){c.push({code:"reorder-empty",opIndex:S,entity:y.entity});break}const I=[],C=new Set;let U=!1;for(const H of N){if(!x&&ts(H)){c.push({code:"handle-by-unsupported",opIndex:S,entity:y.entity,handle:H,target:"operation"}),U=!0;continue}const G=x?sm(R.value,H):dm(R.value,H);if(!G.ok){c.push(G.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:S,entity:y.entity,handle:H}:{code:"reorder-handle-ambiguous",opIndex:S,entity:y.entity,handle:H,matches:G.matches}),U=!0;continue}if(C.has(G.value.modelId)){c.push({code:"reorder-handle-duplicate",opIndex:S,entity:y.entity,handle:H}),U=!0;continue}C.add(G.value.modelId),I.push(G.value)}if(U)break;const P=[...x?R.value.attributes:R.value.operations??[]].sort((H,G)=>H.order-G.order).filter(H=>!C.has(H.modelId)),F=[...I,...P];if(F.forEach((H,G)=>{H.order!==G&&s.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:H.modelId,patch:{order:G}}:{kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:H.modelId,patch:{order:G}})}),x)for(const H of Zu(e,R.value.modelId,F.map(G=>G.modelId)))s.push({kind:"attribute.update",casUnit:"logical",containerRef:H.entityId,entityRef:H.entityId,attributeRef:H.attributeId,patch:{dbAttrs:H.dbAttrs}});break}case"group.add":{{const C=xn(y.spec,M_);if(C.length){c.push({code:"group-spec-unknown-key",opIndex:S,keys:C});break}}const x=[];let R=!1;for(const C of y.spec.members){const U=At(e,C);if(!U.ok){c.push($t(U.reason,S,C,U.matches,b)),R=!0;continue}x.push(U.value.modelId)}if(R)break;const N=a(),I={modelId:N,excludeDDLGeneration:y.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...y.spec.name?{name:y.spec.name}:{},...y.spec.packageName?{packageName:y.spec.packageName}:{},...y.spec.description?{description:y.spec.description}:{}};s.push({kind:"group.add",casUnit:"logical",groupRef:N,value:I});break}case"group.update":{const x=Ql(e,y.group);if(!x.ok){c.push(es(x,S,y.group));break}const R=No(y.patch,w_);if(R.length){c.push({code:"group-patch-unknown-key",opIndex:S,handle:y.group,keys:R});break}s.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:y.patch});break}case"group.remove":{const x=Ql(e,y.group);if(!x.ok){c.push(es(x,S,y.group));break}s.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=Ql(e,y.group);if(!x.ok){c.push(es(x,S,y.group));break}const R=At(e,y.entity);if(!R.ok){c.push($t(R.reason,S,y.entity,R.matches,b));break}const N=x.value.memberEntityRefs.includes(R.value.modelId);if(y.kind==="group.addMember"?N:!N)break;if(y.kind==="group.removeMember"){if(k.has(E(x.value.modelId,R.value.modelId)))break;k.add(E(x.value.modelId,R.value.modelId))}s.push({kind:y.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:R.value.modelId});break}}}),c.length||K_(s,e,f,p,h,_,g,a,u),c.length||U_(s,e,h,f),c.length||H_(s,e,h,_,f,a),c.length?{ok:!1,errors:c}:{ok:!0,ops:s}}function $t(e,n,o,i,a){return e==="shape"?{code:"handle-shape-invalid",opIndex:n,where:"entity",expected:"{ref, by?}",got:is(o)}: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}}const Ya=e=>!!e&&typeof e=="object"&&typeof e.ref=="string",q_=e=>!!e&&typeof e=="object"&&Ya(e.from)&&Ya(e.to),is=e=>e===void 0?"undefined":e===null?"null":typeof e!="object"?typeof e:`{${Object.keys(e).join(",")}}`;function W_(e,n,o){const i=e,a=[];for(const l of["attribute","index","operation","group"])l in i&&a.push([l,i[l],Ya(i[l])]);(e.kind==="association.update"||e.kind==="association.remove"||e.kind==="associationEnd.update")&&a.push(["association",i.association,q_(i.association)]);let r=!0;for(const[l,s,c]of a)c||(r=!1,o.push({code:"handle-shape-invalid",opIndex:n,where:l,expected:l==="association"?"{from:{ref}, to:{ref}}":"{ref, by?}",got:is(s)}));return r}function Nm(e,n,o,i,a){const r=At(e,n.from),l=At(e,n.to);if(r.ok||i.push($t(r.reason,o,n.from,r.matches,a)),l.ok||i.push($t(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=lm(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 wm={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},J_={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},X_={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},tn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Z_={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","SERIALIZED_TYPE"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},classLogicalName:{...tn,description:"**클래스** 논리명(다국어). 테이블이 없는 자리(직렬화 타입 SERIALIZED_TYPE)의 논리명이 여기 산다 — 그 타입은 table 자체를 갖지 않아 table.logicalName 을 줄 데가 없다. ⚠️테이블이 있는 엔티티는 table.logicalName 이 이기므로 그쪽을 쓴다."},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"}},serialization:{$ref:"#/$defs/serialization"}},required:["name"],additionalProperties:!1},Q_={type:"object",description:"직렬화 타입의 컨테이너(SERIALIZED_TYPE 전용). 미지정 = 컬렉션이 아닌 단일 값(한 컬럼에 구조 하나). 신규 엔티티는 entity.add 에 함께 줘야 한다 — 같은 배치의 entity.update 는 갓 만든 엔티티에 닿지 못한다.",properties:{collectionType:{type:"string",enum:["LIST","SET","MAP"],description:"컨테이너 종류. 코퍼스 실재가 java.util 3종뿐이라 그만 표현한다(미지 컨테이너는 발명하지 않는다)."},mapKeyType:{type:"string",description:"collectionType='MAP' 일 때의 키 타입(단순명 또는 FQN). 그 외엔 무의미."}},additionalProperties:!1},ek={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:{...tn,description:"속성 설명(다국어)."},columnLogicalName:{...tn,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},fieldLogicalName:{...tn,description:"**필드** 논리명(다국어). 평탄 `logicalName`(컬럼 논리명)과 **다른 축**이다 — 컬럼이 없는 자리(직렬화 타입 SERIALIZED_TYPE 의 자기 필드)는 dbAttrs 가 0이라 컬럼 논리명을 줄 데가 없고, 그 자리의 논리명이 여기 산다(캔버스 논리 뷰·탐색기 검색·코드젠 javadoc 이 읽는다). 컬럼이 있는 자리에서는 컬럼 논리명이 이긴다."},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"},collectionType:{type:"string",enum:["LIST","SET"],description:"이 «필드»가 컬렉션인가 — **직렬화 타입(SERIALIZED_TYPE)의 자기 필드 전용**(예: Set<String>·List<StoredFile>). 컬럼 있는 자리는 읽지 않는다 — 그쪽 컨테이너는 요소 타입이 소유한다(entity 의 serialization.collectionType). 요소가 문서 안 직렬화 타입이면 그 타입이 이미 감싸므로 지정하지 않는다. 미지정 = 컬렉션 아님."}},required:["name","type"],additionalProperties:!1},tk={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF. ⚠️바인딩 축만 덮는다 — 서브컬럼 **논리명**은 여기 없고 patch의 dotted `dbAttrs.<i>.logicalName`이 받는다.",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 컬럼에만 저장."},notNull:{type:"boolean",description:"JPA @Column(nullable=false) — **이 서브컬럼 하나의** NOT NULL. 미설정이면 속성 축(notNull)을 따른다. ★임베더블은 컬럼마다 제약이 갈릴 수 있어(실측: ChangedBy 는 type 컬럼만 NOT NULL) 속성 축 하나로는 담기지 않는다. OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},Im={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},nk={type:"object",description:'일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)·직렬화 타입을 end 로 주면 거부된다. 직렬화 타입은 관계가 아니라 소비 속성의 type 으로 지목한다(attribute.update {type: "<타입명>"}). (임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).',properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Im,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Im,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},ok={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...wm,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},ik={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...tn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},ak={type:"object",properties:{name:{...tn,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},rk={type:"object",description:'기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 «바인딩» 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부). ★다중 컬럼 속성의 **개별 컬럼 필드**는 dotted 키로 지목한다 — `{"dbAttrs.<i>.logicalName":{ko:"…"}}` 처럼. dotted 허용 접두는 `dbAttrs.` 하나뿐이고, 같은 op에서 평탄 키와 섞으면 $set 충돌로 거부된다.',properties:{name:{type:"string"},type:{type:"string",description:"자바 타입. **컬럼 개수가 바뀌는 전환은 거부된다** — 임베더블 타입(Money 등)으로 바꾸거나 임베더블 속성을 다른 타입으로 바꾸는 것은 컬럼 구조가 함께 가야 성립한다. 그 전환은 attribute.remove + attribute.add 로 내고(자리를 지키려면 같은 배치에 attribute.reorder), 임베드 서브컬럼 «바인딩» 조정만 embeddableOverrides 소관이다."},customType:{type:"string"},attrType:{type:"string",enum:[...Wu],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},derivedIdFieldName:{type:"string",description:"파생 식별(@MapsId) FK가 매핑되는 **스칼라 @Id 필드명**. 이 속성의 name은 연관 필드명(@MapsId @OneToOne 필드)이고 같은 관계가 두 Java 필드를 만든다. 단일 컬럼 @OneToOne 식별 FK에만 의미가 있고, 미설정 시 부모 PK 물리명의 camelCase로 파생된다(실물 관행). 컬럼은 공유하므로 속성은 하나이며 물리명은 지정하지 않는다."},description:{...tn,description:"속성 설명(다국어)."},fieldLogicalName:{...tn,description:"**필드** 논리명(다국어). 평탄 `logicalName`(컬럼 논리명)과 **다른 축**이다 — 컬럼이 없는 자리(직렬화 타입 SERIALIZED_TYPE 의 자기 필드)는 dbAttrs 가 0이라 컬럼 논리명을 줄 데가 없고, 그 자리의 논리명이 여기 산다(캔버스 논리 뷰·탐색기 검색·코드젠 javadoc 이 읽는다). 컬럼이 있는 자리에서는 컬럼 논리명이 이긴다."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...tn,description:"**컬럼** 논리명(다국어). 대상이 스칼라 단일 컬럼일 때 dbAttrs[0]에 매핑된다. ★대상이 **다중 컬럼**(EMBED_PREDEF·Money 등)이면 이 평탄 키는 «어느 컬럼인지 모호» 로 거부되고, dotted `dbAttrs.<i>.logicalName` 이 그 값을 받는다(embeddableOverrides 에는 논리명 축이 없다). dbAttrs 가 0인 속성(직렬화 타입 필드·transient)에 주면 거부되고, 그 자리는 `fieldLogicalName` 이 받는다."}},additionalProperties:!1},lk={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},sk={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},ck={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...tn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},dk={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table·serialization·classLogicalName. classLogicalName = **클래스** 논리명(테이블 없는 직렬화 타입의 논리명이 사는 곳 — 그 타입은 table 을 갖지 않는다). 테이블이 있는 엔티티는 table.logicalName(dotted-key)이 이긴다. serialization(직렬화 타입 컨테이너)은 통째로 주거나(예: {"serialization":{"collectionType":"LIST"}}) dotted-key로 준다({"serialization.collectionType":"LIST"}). 컬렉션 아님으로 되돌릴 땐 null 로 비운다(wire clear 규약). jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경. stereotype 은 값 타입(JPA_EMBEDDABLE·SERIALIZED_TYPE) 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},uk={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function pt(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const mk={"entity.add":pt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":pt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":pt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":pt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":pt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":pt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":pt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":pt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":pt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":pt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":pt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":pt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":pt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":pt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":pt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":pt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":pt("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"}}},required:["entity","order"]}),"operation.reorder":pt("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"}}},required:["entity","operations"]}),"group.add":pt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":pt("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":pt("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":pt("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":pt("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},fk={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},pk={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...tn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},vm={anyOf:qu.map(e=>mk[e])},hk={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:wm,nameHandle:J_,groupHandle:fk,assocHandle:X_,entitySpec:Z_,serialization:Q_,attrSpec:ek,embeddableOverrides:tk,assocSpec:nk,indexSpec:ok,operationSpec:ik,groupSpec:ak,entityUpdatePatch:dk,attrUpdatePatch:rk,assocUpdatePatch:lk,assocEndUpdatePatch:uk,indexUpdatePatch:sk,operationUpdatePatch:ck,groupUpdatePatch:pk,symbolicOp:vm}};function yk(e,n,o,i={}){const a=i.mkClientOpId??Le,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 Cm={location:{x:0,y:0},size:{width:220,height:140}};function Sm(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,notNull:e.notNull,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const gk=/^[-=_*~\s]{3,}$/;function bk(e){return e.attrType&&e.attrType!=="NORMAL"||!gk.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function _k(e){return e.type===dn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function kk(e,n){if(e.attrType==="DIVIDER"||bk(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=_k(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(Sm)}}function Ek(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Nk(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 wk(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(kk),operations:(n=e.operations)==null?void 0:n.map(Ek),indexes:(o=e.indexes)==null?void 0:o.map(Nk),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Ik(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??{...Cm},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 xm(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 as(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:xm(e)}}function vk(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>rs(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Ck(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:vk(e),end1:as(e.end1),end2:as(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 rs(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Rm(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Am(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 $m(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(Sm)}}function Sk(e,n,o){var v,y;const i=rs(e.end1.attribute),a=rs(e.end2.attribute);if(i===a)return Ck(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(y=(v=s.dbAttrs)==null?void 0:v[0])==null?void 0:y.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((S,$)=>Math.max(S,$.order),-1)+1:s.order??0,p={...$m(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const f=n.get(r.endModel.refId),h=l.attribute;let _;if(h&&f&&r.navigable){const S=ka(l.multiplicity);_={modelId:h.modelId??crypto.randomUUID(),name:uo(h.name??Na((u==null?void 0:u.name)??l.endModel.refId,S),new Set(f.attributes.map($=>$.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce(($,O)=>Math.max($,O.order),-1)+1,dbAttrs:[]},f.attributes.push(_)}const g=(S,$)=>({entityRef:S.endModel.refId,multiplicity:S.multiplicity,navigable:S.navigable,composition:S.composition,attributeRef:$?_==null?void 0:_.modelId:p.modelId,jpa:xm(S)}),k=r.endModel.refId===l.endModel.refId,E={modelId:e.modelId,description:e.description,identifying:!k&&p.identifier===!0?!0:void 0,end1:g(e.end1,i),end2:g(e.end2,a)},b={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:E,layout:b}}function xk(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),notNull:e.notNull??(o==null?void 0:o.notNull)}}function Rk(e,n,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((_,g)=>Math.max(_,g.order),-1)+1:l.order??0,d={...$m(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(_=>xk(_,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=_=>({...as(_),legacyEmbedRaw:_.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function Ak(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 Tm(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=Ak(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 Mm(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 Vm(e,n){const o=(i,a)=>{if(i==null)return;const r=i[a];if(r==null)return;const l=Bc(r);l!==r&&(l===void 0?delete i[a]:i[a]=l)};for(const i of n)o(i,"name");for(const i of e){o(i,"classLogicalName"),o(i,"description"),o(i.table,"logicalName");for(const a of i.operations??[])o(a,"description");for(const a of i.attributes){o(a,"fieldLogicalName"),o(a,"description");for(const r of a.dbAttrs??[])o(r,"logicalName")}}}function $k(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||at(a.stereotype)||at(r.stereotype))continue;const l=i.end1.attributeRef?a.attributes.find(p=>p.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(p=>p.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=ka(i.end2.multiplicity),u=Na(r.name,d),m=uo(u,new Set(a.attributes.map(p=>p.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((p,f)=>Math.max(p,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function Tk(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||at(a.stereotype)||at(r.stereotype))continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function Lm(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if(l&&at(l.stereotype))continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!ad(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function Bm(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?Mk(n):Vk(n)}function Mk(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:p,...f}=m;return p!=null&&(o[m.modelId]=p),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);$k(a,r),Tk(a,r),Lm(a,r),Vm(a,l);const{version:s,...c}=e.layout;Mm(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Vk(e){var k,E;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(b,v)=>{o.push(wk(b));const y=Ik(b);y.geo={location:{x:y.geo.location.x+v.x,y:y.geo.location.y+v.y},size:y.geo.size},i.push(y);for(const S of b.ownedAssociations??[])c.push(S)},u={x:0,y:0};for(const b of e.entities??[])d(b,u);const m=[];for(const b of e.groups??[]){const v=b.entities??[];l.push({modelId:b.modelId,name:b.name,description:b.description,packageName:b.packageName,excludeDDLGeneration:b.excludeDDLGeneration??!1,memberEntityRefs:v.map(S=>S.modelId)});const y=((k=b.geo)==null?void 0:k.location)??u;if(b.geo){const S=(b.notes??[]).map($=>$.modelId);s.push({groupRef:b.modelId,geo:b.geo,style:b.style,locked:b.locked,memberNoteRefs:S.length?S:void 0})}for(const S of v)d(S,y);for(const S of b.notes??[])m.push(Tm(S,y))}const p=new Map(o.map(b=>[b.modelId,b])),f=new Map,h=new Map;for(const b of o)for(const v of b.attributes)for(const y of v.dbAttrs)f.set(y.modelId,v.modelId),h.set(y.modelId,y);for(const b of c)for(const v of[b.end1,b.end2]){const y=v.attribute;if(y&&(((E=y.dbAttrs)==null?void 0:E.length)??0)>0)for(const S of y.dbAttrs)S.modelId&&f.set(S.modelId,y.modelId)}for(const b of c){const v=Rm(b.end1.attribute),y=Rm(b.end2.attribute),S=Am(b.end1)||Am(b.end2),{assoc:$,layout:O}=v!==y||S?Rk(b,p,h):Sk(b,p,f);a.push($),r.push(O)}Mm(o,a,r),Wd(o),Lm(o,a),Vm(o,l);const _={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(b=>Tm(b)),...m]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:_,meta:g}}function Dm(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,notNull:e.notNull,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function Lk(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(Dm),style:n}}function Bk(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 Dk(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 qn(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 Ok(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{...Dm(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function Pk(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function Om(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 zk(e){const n=new Set;for(const o of e.logical.associations){const i=Om(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function Fk(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 Uk(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function Hk(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:Uk(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),notNull:o(e.notNull,n==null?void 0:n.notNull)}}function jk(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var h;return((h=f.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,p)=>Hk(m,l[p]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:qn(e.end1,c?s:u),end2:qn(e.end2,c?u:s)}}function Kk(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:qn(e.end1,e.end1.legacyEmbedRaw),end2:qn(e.end2,e.end2.legacyEmbedRaw)};const a=jk(e,n,i);if(a)return a;const r=Om(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?Ok(r.fk,l):void 0,c=Pk(r.navAttr);return{...i,end1:qn(e.end1,r.navEnd===e.end1?s:c),end2:qn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:qn(e.end1),end2:qn(e.end2)}}function Pm(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(p=>p.entityRef===e.modelId),l=n.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>n.layout.associationLayouts.find(f=>f.associationRef===p),c=(r==null?void 0:r.geo)??{...Cm},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(p=>!o.has(p.modelId)&&!i.has(p.modelId)).map(p=>{var f;return Lk(p,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var f;return Bk(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>Kk(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(Dk),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 Gk(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=>zm(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Pm(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 zm(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 Yk(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=zk(e),r=Fk(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=>Pm(s,e,a,r)),groups:e.logical.groups.map(s=>Gk(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>zm(s))}}function qk(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,referenceOnly:n.referenceOnly,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const Wk=["notNull"];function Jk(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=Bm(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(p=>[p.modelId,p]))]));for(const m of i.logical.entities){const p=c.get(m.modelId);if(p)for(const f of m.attributes){const h=p.get(f.modelId);if(!h){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const _={};for(const g of Wk)f[g]===!0!=(h[g]===!0)&&(_[g]=f[g],s.attributeFieldsByName[g]=(s.attributeFieldsByName[g]??0)+1);Object.keys(_).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:_}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const p=d.get(m.modelId);p&&(m.end1.attributeRef&&m.end1.attributeRef!==p.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&p.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function Ti(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function Rn(e){return typeof e=="function"?e():t.unref(e)}const Xk=typeof window<"u"&&typeof document<"u",Zk=e=>typeof e<"u",Qk=Object.prototype.toString,eE=e=>Qk.call(e)==="[object Object]",tE=()=>{};function nE(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 Fm=e=>e();function oE(e=Fm){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 Um(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function iE(e,n,o={}){const{eventFilter:i=Fm,...a}=o;return t.watch(e,nE(i,n),a)}function ei(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=oE(i);return{stop:iE(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function aE(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=Rn(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 ls(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:h,throwOnTimeout:_}={}){let g=null;const E=[new Promise(b=>{g=t.watch(e,v=>{m(v)!==n&&(g==null||g(),b(v))},{flush:p,deep:f,immediate:!0})})];return h!=null&&E.push(Um(h,_).then(()=>Rn(e)).finally(()=>g==null?void 0:g())),Promise.race(E)}function i(m,p){if(!t.isRef(m))return o(v=>v===m,p);const{flush:f="sync",deep:h=!1,timeout:_,throwOnTimeout:g}=p??{};let k=null;const b=[new Promise(v=>{k=t.watch([e,m],([y,S])=>{n!==(y===S)&&(k==null||k(),v(y))},{flush:f,deep:h,immediate:!0})})];return _!=null&&b.push(Um(_,g).then(()=>Rn(e)).finally(()=>(k==null||k(),Rn(e)))),Promise.race(b)}function a(m){return o(p=>!!p,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,p){return o(f=>{const h=Array.from(f);return h.includes(m)||h.includes(Rn(m))},p)}function d(m){return u(1,m)}function u(m=1,p){let f=-1;return o(()=>(f+=1,f>=m),p)}return Array.isArray(Rn(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return ls(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return ls(e,!n)}}}function ss(e){return ls(e)}function rE(e){var n;const o=Rn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Hm=Xk?window:void 0;function jm(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Hm):[n,o,i,a]=e,!n)return tE;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,p,f)=>(u.addEventListener(m,p,f),()=>u.removeEventListener(m,p,f)),c=t.watch(()=>[rE(n),Rn(a)],([u,m])=>{if(l(),!u)return;const p=eE(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(h=>s(u,f,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return Ti(d),d}function lE(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Km(...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=Hm,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=lE(n);return jm(a,r,u=>{u.repeat&&Rn(s)||c(u)&&o(u)},l)}function sE(e){return JSON.parse(JSON.stringify(e))}function cs(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:p}=i,f=t.getCurrentInstance(),h=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let _=d;n||(n="modelValue"),_=_||`update:${n.toString()}`;const g=b=>s?typeof s=="function"?s(b):sE(b):b,k=()=>Zk(e[n])?g(e[n]):m,E=b=>{p?p(b)&&h(_,b):h(_,b)};if(c){const b=k(),v=t.ref(b);let y=!1;return t.watch(()=>e[n],S=>{y||(y=!0,v.value=g(S),t.nextTick(()=>y=!1))}),t.watch(v,S=>{!y&&(S!==e[n]||u)&&E(S)},{deep:u}),v}else return t.computed({get(){return k()},set(b){E(b)}})}var cE={value:()=>{}};function qa(){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 Wa(o)}function Wa(e){this._=e}function dE(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}})}Wa.prototype=qa.prototype={constructor:Wa,on:function(e,n){var o=this._,i=dE(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=uE(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 Wa(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 uE(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]=cE,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ds="http://www.w3.org/1999/xhtml";const Ym={svg:"http://www.w3.org/2000/svg",xhtml:ds,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ja(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ym.hasOwnProperty(n)?{space:Ym[n],local:e}:e}function mE(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ds&&n.documentElement.namespaceURI===ds?n.createElement(e):n.createElementNS(o,e)}}function fE(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qm(e){var n=Ja(e);return(n.local?fE:mE)(n)}function pE(){}function us(e){return e==null?pE:function(){return this.querySelector(e)}}function hE(e){typeof e!="function"&&(e=us(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new jt(i,this._parents)}function yE(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function gE(){return[]}function Wm(e){return e==null?gE:function(){return this.querySelectorAll(e)}}function bE(e){return function(){return yE(e.apply(this,arguments))}}function _E(e){typeof e=="function"?e=bE(e):e=Wm(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 jt(i,a)}function Jm(e){return function(){return this.matches(e)}}function Xm(e){return function(n){return n.matches(e)}}var kE=Array.prototype.find;function EE(e){return function(){return kE.call(this.children,e)}}function NE(){return this.firstElementChild}function wE(e){return this.select(e==null?NE:EE(typeof e=="function"?e:Xm(e)))}var IE=Array.prototype.filter;function vE(){return Array.from(this.children)}function CE(e){return function(){return IE.call(this.children,e)}}function SE(e){return this.selectAll(e==null?vE:CE(typeof e=="function"?e:Xm(e)))}function xE(e){typeof e!="function"&&(e=Jm(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 jt(i,this._parents)}function Zm(e){return new Array(e.length)}function RE(){return new jt(this._enter||this._groups.map(Zm),this._parents)}function Xa(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Xa.prototype={constructor:Xa,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function AE(e){return function(){return e}}function $E(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new Xa(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function TE(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new Xa(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function ME(e){return e.__data__}function VE(e,n){if(!arguments.length)return Array.from(this,ME);var o=n?TE:$E,i=this._parents,a=this._groups;typeof e!="function"&&(e=AE(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=LE(e.call(u,u&&u.__data__,d,i)),h=f.length,_=s[d]=new Array(h),g=l[d]=new Array(h),k=c[d]=new Array(p);o(u,m,_,g,k,f,n);for(var E=0,b=0,v,y;E<h;++E)if(v=_[E]){for(E>=b&&(b=E+1);!(y=g[b])&&++b<h;);v._next=y||null}}return l=new jt(l,i),l._enter=s,l._exit=c,l}function LE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function BE(){return new jt(this._exit||this._groups.map(Zm),this._parents)}function DE(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 OE(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new jt(s,this._parents)}function PE(){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 zE(e){e||(e=FE);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new jt(a,this._parents).order()}function FE(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function UE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function HE(){return Array.from(this)}function jE(){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 KE(){let e=0;for(const n of this)++e;return e}function GE(){return!this.node()}function YE(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 qE(e){return function(){this.removeAttribute(e)}}function WE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function JE(e,n){return function(){this.setAttribute(e,n)}}function XE(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function ZE(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function QE(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 e1(e,n){var o=Ja(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?WE:qE:typeof n=="function"?o.local?QE:ZE:o.local?XE:JE)(o,n))}function Qm(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function t1(e){return function(){this.style.removeProperty(e)}}function n1(e,n,o){return function(){this.style.setProperty(e,n,o)}}function o1(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function i1(e,n,o){return arguments.length>1?this.each((n==null?t1:typeof n=="function"?o1:n1)(e,n,o??"")):ti(this.node(),e)}function ti(e,n){return e.style.getPropertyValue(n)||Qm(e).getComputedStyle(e,null).getPropertyValue(n)}function a1(e){return function(){delete this[e]}}function r1(e,n){return function(){this[e]=n}}function l1(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function s1(e,n){return arguments.length>1?this.each((n==null?a1:typeof n=="function"?l1:r1)(e,n)):this.node()[e]}function ef(e){return e.trim().split(/^|\s+/)}function ms(e){return e.classList||new tf(e)}function tf(e){this._node=e,this._names=ef(e.getAttribute("class")||"")}tf.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 nf(e,n){for(var o=ms(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function of(e,n){for(var o=ms(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function c1(e){return function(){nf(this,e)}}function d1(e){return function(){of(this,e)}}function u1(e,n){return function(){(n.apply(this,arguments)?nf:of)(this,e)}}function m1(e,n){var o=ef(e+"");if(arguments.length<2){for(var i=ms(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?u1:n?c1:d1)(o,n))}function f1(){this.textContent=""}function p1(e){return function(){this.textContent=e}}function h1(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function y1(e){return arguments.length?this.each(e==null?f1:(typeof e=="function"?h1:p1)(e)):this.node().textContent}function g1(){this.innerHTML=""}function b1(e){return function(){this.innerHTML=e}}function _1(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function k1(e){return arguments.length?this.each(e==null?g1:(typeof e=="function"?_1:b1)(e)):this.node().innerHTML}function E1(){this.nextSibling&&this.parentNode.appendChild(this)}function N1(){return this.each(E1)}function w1(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function I1(){return this.each(w1)}function v1(e){var n=typeof e=="function"?e:qm(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function C1(){return null}function S1(e,n){var o=typeof e=="function"?e:qm(e),i=n==null?C1:typeof n=="function"?n:us(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function x1(){var e=this.parentNode;e&&e.removeChild(this)}function R1(){return this.each(x1)}function A1(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function $1(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function T1(e){return this.select(e?$1:A1)}function M1(e){return arguments.length?this.property("__data__",e):this.node().__data__}function V1(e){return function(n){e.call(this,n,this.__data__)}}function L1(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 B1(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 D1(e,n,o){return function(){var i=this.__on,a,r=V1(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 O1(e,n,o){var i=L1(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?D1:B1,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function af(e,n,o){var i=Qm(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 P1(e,n){return function(){return af(this,e,n)}}function z1(e,n){return function(){return af(this,e,n.apply(this,arguments))}}function F1(e,n){return this.each((typeof n=="function"?z1:P1)(e,n))}function*U1(){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 rf=[null];function jt(e,n){this._groups=e,this._parents=n}function Mi(){return new jt([[document.documentElement]],rf)}function H1(){return this}jt.prototype=Mi.prototype={constructor:jt,select:hE,selectAll:_E,selectChild:wE,selectChildren:SE,filter:xE,data:VE,enter:RE,exit:BE,join:DE,merge:OE,selection:H1,order:PE,sort:zE,call:UE,nodes:HE,node:jE,size:KE,empty:GE,each:YE,attr:e1,style:i1,property:s1,classed:m1,text:y1,html:k1,raise:N1,lower:I1,append:v1,insert:S1,remove:R1,clone:T1,datum:M1,on:O1,dispatch:F1,[Symbol.iterator]:U1};function nn(e){return typeof e=="string"?new jt([[document.querySelector(e)]],[document.documentElement]):new jt([[e]],rf)}function j1(e){let n;for(;n=e.sourceEvent;)e=n;return e}function pn(e,n){if(e=j1(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 K1={passive:!1},Vi={capture:!0,passive:!1};function fs(e){e.stopImmediatePropagation()}function ni(e){e.preventDefault(),e.stopImmediatePropagation()}function lf(e){var n=e.document.documentElement,o=nn(e).on("dragstart.drag",ni,Vi);"onselectstart"in n?o.on("selectstart.drag",ni,Vi):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function sf(e,n){var o=e.document.documentElement,i=nn(e).on("dragstart.drag",null);n&&(i.on("click.drag",ni,Vi),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 Za=e=>()=>e;function ps(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}})}ps.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function G1(e){return!e.ctrlKey&&!e.button}function Y1(){return this.parentNode}function q1(e,n){return n??{x:e.x,y:e.y}}function W1(){return navigator.maxTouchPoints||"ontouchstart"in this}function J1(){var e=G1,n=Y1,o=q1,i=W1,a={},r=qa("start","drag","end"),l=0,s,c,d,u,m=0;function p(v){v.on("mousedown.drag",f).filter(i).on("touchstart.drag",g).on("touchmove.drag",k,K1).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(v,y){if(!(u||!e.call(this,v,y))){var S=b(this,n.call(this,v,y),v,y,"mouse");S&&(nn(v.view).on("mousemove.drag",h,Vi).on("mouseup.drag",_,Vi),lf(v.view),fs(v),d=!1,s=v.clientX,c=v.clientY,S("start",v))}}function h(v){if(ni(v),!d){var y=v.clientX-s,S=v.clientY-c;d=y*y+S*S>m}a.mouse("drag",v)}function _(v){nn(v.view).on("mousemove.drag mouseup.drag",null),sf(v.view,d),ni(v),a.mouse("end",v)}function g(v,y){if(e.call(this,v,y)){var S=v.changedTouches,$=n.call(this,v,y),O=S.length,B,z;for(B=0;B<O;++B)(z=b(this,$,v,y,S[B].identifier,S[B]))&&(fs(v),z("start",v,S[B]))}}function k(v){var y=v.changedTouches,S=y.length,$,O;for($=0;$<S;++$)(O=a[y[$].identifier])&&(ni(v),O("drag",v,y[$]))}function E(v){var y=v.changedTouches,S=y.length,$,O;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),$=0;$<S;++$)(O=a[y[$].identifier])&&(fs(v),O("end",v,y[$]))}function b(v,y,S,$,O,B){var z=r.copy(),T=pn(B||S,y),x,R,N;if((N=o.call(v,new ps("beforestart",{sourceEvent:S,target:p,identifier:O,active:l,x:T[0],y:T[1],dx:0,dy:0,dispatch:z}),$))!=null)return x=N.x-T[0]||0,R=N.y-T[1]||0,function I(C,U,A){var P=T,F;switch(C){case"start":a[O]=I,F=l++;break;case"end":delete a[O],--l;case"drag":T=pn(A||U,y),F=l;break}z.call(C,v,new ps(C,{sourceEvent:U,subject:N,target:p,identifier:O,active:F,x:T[0]+x,y:T[1]+R,dx:T[0]-P[0],dy:T[1]-P[1],dispatch:z}),$)}}return p.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Za(!!v),p):e},p.container=function(v){return arguments.length?(n=typeof v=="function"?v:Za(v),p):n},p.subject=function(v){return arguments.length?(o=typeof v=="function"?v:Za(v),p):o},p.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:Za(!!v),p):i},p.on=function(){var v=r.on.apply(r,arguments);return v===r?p:v},p.clickDistance=function(v){return arguments.length?(m=(v=+v)*v,p):Math.sqrt(m)},p}function hs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function cf(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Li(){}var Bi=.7,Qa=1/Bi,oi="\\s*([+-]?\\d+)\\s*",Di="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",hn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",X1=/^#([0-9a-f]{3,8})$/,Z1=new RegExp(`^rgb\\(${oi},${oi},${oi}\\)$`),Q1=new RegExp(`^rgb\\(${hn},${hn},${hn}\\)$`),eN=new RegExp(`^rgba\\(${oi},${oi},${oi},${Di}\\)$`),tN=new RegExp(`^rgba\\(${hn},${hn},${hn},${Di}\\)$`),nN=new RegExp(`^hsl\\(${Di},${hn},${hn}\\)$`),oN=new RegExp(`^hsla\\(${Di},${hn},${hn},${Di}\\)$`),df={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};hs(Li,wo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:uf,formatHex:uf,formatHex8:iN,formatHsl:aN,formatRgb:mf,toString:mf});function uf(){return this.rgb().formatHex()}function iN(){return this.rgb().formatHex8()}function aN(){return gf(this).formatHsl()}function mf(){return this.rgb().formatRgb()}function wo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=X1.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?ff(n):o===3?new Pt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?er(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?er(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=Z1.exec(e))?new Pt(n[1],n[2],n[3],1):(n=Q1.exec(e))?new Pt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=eN.exec(e))?er(n[1],n[2],n[3],n[4]):(n=tN.exec(e))?er(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=nN.exec(e))?yf(n[1],n[2]/100,n[3]/100,1):(n=oN.exec(e))?yf(n[1],n[2]/100,n[3]/100,n[4]):df.hasOwnProperty(e)?ff(df[e]):e==="transparent"?new Pt(NaN,NaN,NaN,0):null}function ff(e){return new Pt(e>>16&255,e>>8&255,e&255,1)}function er(e,n,o,i){return i<=0&&(e=n=o=NaN),new Pt(e,n,o,i)}function rN(e){return e instanceof Li||(e=wo(e)),e?(e=e.rgb(),new Pt(e.r,e.g,e.b,e.opacity)):new Pt}function ys(e,n,o,i){return arguments.length===1?rN(e):new Pt(e,n,o,i??1)}function Pt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}hs(Pt,ys,cf(Li,{brighter(e){return e=e==null?Qa:Math.pow(Qa,e),new Pt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Bi:Math.pow(Bi,e),new Pt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Pt(Io(this.r),Io(this.g),Io(this.b),tr(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:pf,formatHex:pf,formatHex8:lN,formatRgb:hf,toString:hf}));function pf(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}`}function lN(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}${vo((isNaN(this.opacity)?1:this.opacity)*255)}`}function hf(){const e=tr(this.opacity);return`${e===1?"rgb(":"rgba("}${Io(this.r)}, ${Io(this.g)}, ${Io(this.b)}${e===1?")":`, ${e})`}`}function tr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Io(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vo(e){return e=Io(e),(e<16?"0":"")+e.toString(16)}function yf(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new on(e,n,o,i)}function gf(e){if(e instanceof on)return new on(e.h,e.s,e.l,e.opacity);if(e instanceof Li||(e=wo(e)),!e)return new on;if(e instanceof on)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 on(l,s,c,e.opacity)}function sN(e,n,o,i){return arguments.length===1?gf(e):new on(e,n,o,i??1)}function on(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}hs(on,sN,cf(Li,{brighter(e){return e=e==null?Qa:Math.pow(Qa,e),new on(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Bi:Math.pow(Bi,e),new on(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 Pt(gs(e>=240?e-240:e+120,a,i),gs(e,a,i),gs(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new on(bf(this.h),nr(this.s),nr(this.l),tr(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=tr(this.opacity);return`${e===1?"hsl(":"hsla("}${bf(this.h)}, ${nr(this.s)*100}%, ${nr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function bf(e){return e=(e||0)%360,e<0?e+360:e}function nr(e){return Math.max(0,Math.min(1,e||0))}function gs(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const bs=e=>()=>e;function cN(e,n){return function(o){return e+o*n}}function dN(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 uN(e){return(e=+e)==1?_f:function(n,o){return o-n?dN(n,o,e):bs(isNaN(n)?o:n)}}function _f(e,n){var o=n-e;return o?cN(e,o):bs(isNaN(e)?n:e)}const or=(function e(n){var o=uN(n);function i(a,r){var l=o((a=ys(a)).r,(r=ys(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=_f(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function mN(e,n){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 fN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function pN(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]=Oi(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 hN(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function yn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function yN(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]=Oi(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var _s=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ks=new RegExp(_s.source,"g");function gN(e){return function(){return e}}function bN(e){return function(n){return e(n)+""}}function kf(e,n){var o=_s.lastIndex=ks.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=_s.exec(e))&&(a=ks.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:yn(i,a)})),o=ks.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?bN(c[0].x):gN(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 Oi(e,n){var o=typeof n,i;return n==null||o==="boolean"?bs(n):(o==="number"?yn:o==="string"?(i=wo(n))?(n=i,or):kf:n instanceof wo?or:n instanceof Date?hN:fN(n)?mN:Array.isArray(n)?pN:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?yN:yn)(e,n)}var Ef=180/Math.PI,Es={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Nf(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)*Ef,skewX:Math.atan(c)*Ef,scaleX:l,scaleY:s}}var ir;function _N(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Es:Nf(n.a,n.b,n.c,n.d,n.e,n.f)}function kN(e){return e==null||(ir||(ir=document.createElementNS("http://www.w3.org/2000/svg","g")),ir.setAttribute("transform",e),!(e=ir.transform.baseVal.consolidate()))?Es:(e=e.matrix,Nf(e.a,e.b,e.c,e.d,e.e,e.f))}function wf(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var _=f.push("translate(",null,n,null,o);h.push({i:_-4,x:yn(d,m)},{i:_-2,x:yn(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:yn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:yn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var _=f.push(a(f)+"scale(",null,",",null,")");h.push({i:_-4,x:yn(d,m)},{i:_-2,x:yn(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,_=p.length,g;++h<_;)m[(g=p[h]).i]=g.x(f);return m.join("")}}}var EN=wf(_N,"px, ","px)","deg)"),NN=wf(kN,", ",")",")"),wN=1e-12;function If(e){return((e=Math.exp(e))+1/e)/2}function IN(e){return((e=Math.exp(e))-1/e)/2}function vN(e){return((e=Math.exp(2*e))-1)/(e+1)}const ar=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,_=f*f+h*h,g,k;if(_<wN)k=Math.log(p/d)/n,g=function($){return[s+$*f,c+$*h,d*Math.exp(n*$*k)]};else{var E=Math.sqrt(_),b=(p*p-d*d+i*_)/(2*d*o*E),v=(p*p-d*d-i*_)/(2*p*o*E),y=Math.log(Math.sqrt(b*b+1)-b),S=Math.log(Math.sqrt(v*v+1)-v);k=(S-y)/n,g=function($){var O=$*k,B=If(y),z=d/(o*E)*(B*vN(n*O+y)-IN(y));return[s+z*f,c+z*h,d*B/If(n*O+y)]}}return g.duration=k*1e3*n/Math.SQRT2,g}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var ii=0,Pi=0,zi=0,vf=1e3,rr,Fi,lr=0,Co=0,sr=0,Ui=typeof performance=="object"&&performance.now?performance:Date,Cf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ns(){return Co||(Cf(CN),Co=Ui.now()+sr)}function CN(){Co=0}function cr(){this._call=this._time=this._next=null}cr.prototype=Sf.prototype={constructor:cr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ns():+o)+(n==null?0:+n),!this._next&&Fi!==this&&(Fi?Fi._next=this:rr=this,Fi=this),this._call=e,this._time=o,ws()},stop:function(){this._call&&(this._call=null,this._time=1/0,ws())}};function Sf(e,n,o){var i=new cr;return i.restart(e,n,o),i}function SN(){Ns(),++ii;for(var e=rr,n;e;)(n=Co-e._time)>=0&&e._call.call(void 0,n),e=e._next;--ii}function xf(){Co=(lr=Ui.now())+sr,ii=Pi=0;try{SN()}finally{ii=0,RN(),Co=0}}function xN(){var e=Ui.now(),n=e-lr;n>vf&&(sr-=n,lr=e)}function RN(){for(var e,n=rr,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:rr=o);Fi=e,ws(i)}function ws(e){if(!ii){Pi&&(Pi=clearTimeout(Pi));var n=e-Co;n>24?(e<1/0&&(Pi=setTimeout(xf,e-Ui.now()-sr)),zi&&(zi=clearInterval(zi))):(zi||(lr=Ui.now(),zi=setInterval(xN,vf)),ii=1,Cf(xf))}}function Rf(e,n,o){var i=new cr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var AN=qa("start","end","cancel","interrupt"),$N=[],Af=0,$f=1,Is=2,dr=3,Tf=4,vs=5,ur=6;function mr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;TN(e,o,{name:n,index:i,group:a,on:AN,tween:$N,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Af})}function Cs(e,n){var o=an(e,n);if(o.state>Af)throw new Error("too late; already scheduled");return o}function gn(e,n){var o=an(e,n);if(o.state>dr)throw new Error("too late; already running");return o}function an(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function TN(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Sf(r,0,o.time);function r(d){o.state=$f,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==$f)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===dr)return Rf(l);f.state===Tf?(f.state=ur,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=ur,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Rf(function(){o.state===dr&&(o.state=Tf,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Is,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Is){for(o.state=dr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=vs,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===vs&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ur,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function fr(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>Is&&i.state<vs,i.state=ur,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function MN(e){return this.each(function(){fr(this,e)})}function VN(e,n){var o,i;return function(){var a=gn(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 LN(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=gn(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 BN(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=an(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?VN:LN)(o,e,n))}function Ss(e,n,o){var i=e._id;return e.each(function(){var a=gn(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return an(a,i).value[n]}}function Mf(e,n){var o;return(typeof n=="number"?yn:n instanceof wo?or:(o=wo(n))?(n=o,or):kf)(e,n)}function DN(e){return function(){this.removeAttribute(e)}}function ON(e){return function(){this.removeAttributeNS(e.space,e.local)}}function PN(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 zN(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 FN(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 UN(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 HN(e,n){var o=Ja(e),i=o==="transform"?NN:Mf;return this.attrTween(e,typeof n=="function"?(o.local?UN:FN)(o,i,Ss(this,"attr."+e,n)):n==null?(o.local?ON:DN)(o):(o.local?zN:PN)(o,i,n))}function jN(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function KN(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function GN(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&KN(e,r)),o}return a._value=n,a}function YN(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&jN(e,r)),o}return a._value=n,a}function qN(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=Ja(e);return this.tween(o,(i.local?GN:YN)(i,n))}function WN(e,n){return function(){Cs(this,e).delay=+n.apply(this,arguments)}}function JN(e,n){return n=+n,function(){Cs(this,e).delay=n}}function XN(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?WN:JN)(n,e)):an(this.node(),n).delay}function ZN(e,n){return function(){gn(this,e).duration=+n.apply(this,arguments)}}function QN(e,n){return n=+n,function(){gn(this,e).duration=n}}function e0(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?ZN:QN)(n,e)):an(this.node(),n).duration}function t0(e,n){if(typeof n!="function")throw new Error;return function(){gn(this,e).ease=n}}function n0(e){var n=this._id;return arguments.length?this.each(t0(n,e)):an(this.node(),n).ease}function o0(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;gn(this,e).ease=o}}function i0(e){if(typeof e!="function")throw new Error;return this.each(o0(this._id,e))}function a0(e){typeof e!="function"&&(e=Jm(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 An(i,this._parents,this._name,this._id)}function r0(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new An(l,this._parents,this._name,this._id)}function l0(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 s0(e,n,o){var i,a,r=l0(n)?Cs:gn;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function c0(e,n){var o=this._id;return arguments.length<2?an(this.node(),o).on.on(e):this.each(s0(o,e,n))}function d0(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function u0(){return this.on("end.remove",d0(this._id))}function m0(e){var n=this._name,o=this._id;typeof e!="function"&&(e=us(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,mr(d[p],n,o,p,d,an(u,o)));return new An(r,this._parents,n,o)}function f0(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Wm(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=an(u,o),_=0,g=p.length;_<g;++_)(f=p[_])&&mr(f,n,o,_,p,h);r.push(p),l.push(u)}return new An(r,l,n,o)}var p0=Mi.prototype.constructor;function h0(){return new p0(this._groups,this._parents)}function y0(e,n){var o,i,a;return function(){var r=ti(this,e),l=(this.style.removeProperty(e),ti(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Vf(e){return function(){this.style.removeProperty(e)}}function g0(e,n,o){var i,a=o+"",r;return function(){var l=ti(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function b0(e,n,o){var i,a,r;return function(){var l=ti(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),ti(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function _0(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=gn(this,e),d=c.on,u=c.value[r]==null?s||(s=Vf(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function k0(e,n,o){var i=(e+="")=="transform"?EN:Mf;return n==null?this.styleTween(e,y0(e,i)).on("end.style."+e,Vf(e)):typeof n=="function"?this.styleTween(e,b0(e,i,Ss(this,"style."+e,n))).each(_0(this._id,e)):this.styleTween(e,g0(e,i,n),o).on("end.style."+e,null)}function E0(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function N0(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&E0(e,l,o)),i}return r._value=n,r}function w0(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,N0(e,n,o??""))}function I0(e){return function(){this.textContent=e}}function v0(e){return function(){var n=e(this);this.textContent=n??""}}function C0(e){return this.tween("text",typeof e=="function"?v0(Ss(this,"text",e)):I0(e==null?"":e+""))}function S0(e){return function(n){this.textContent=e.call(this,n)}}function x0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&S0(a)),n}return i._value=e,i}function R0(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,x0(e))}function A0(){for(var e=this._name,n=this._id,o=Lf(),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=an(c,n);mr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new An(i,this._parents,e,o)}function $0(){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=gn(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 T0=0;function An(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Lf(){return++T0}var $n=Mi.prototype;An.prototype={constructor:An,select:m0,selectAll:f0,selectChild:$n.selectChild,selectChildren:$n.selectChildren,filter:a0,merge:r0,selection:h0,transition:A0,call:$n.call,nodes:$n.nodes,node:$n.node,size:$n.size,empty:$n.empty,each:$n.each,on:c0,attr:HN,attrTween:qN,style:k0,styleTween:w0,text:C0,textTween:R0,remove:u0,tween:BN,delay:XN,duration:e0,ease:n0,easeVarying:i0,end:$0,[Symbol.iterator]:$n[Symbol.iterator]};function M0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var V0={time:null,delay:0,duration:250,ease:M0};function L0(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 B0(e){var n,o;e instanceof An?(n=e._id,e=e._name):(n=Lf(),(o=V0).time=Ns(),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])&&mr(c,e,n,d,l,o||L0(c,n));return new An(i,this._parents,e,n)}Mi.prototype.interrupt=MN,Mi.prototype.transition=B0;const pr=e=>()=>e;function D0(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Tn(e,n,o){this.k=e,this.x=n,this.y=o}Tn.prototype={constructor:Tn,scale:function(e){return e===1?this:new Tn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Tn(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 ai=new Tn(1,0,0);Tn.prototype;function xs(e){e.stopImmediatePropagation()}function Hi(e){e.preventDefault(),e.stopImmediatePropagation()}function O0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function P0(){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 Bf(){return this.__zoom||ai}function z0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function F0(){return navigator.maxTouchPoints||"ontouchstart"in this}function U0(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 H0(){var e=O0,n=P0,o=U0,i=z0,a=F0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ar,d=qa("start","zoom","end"),u,m,p,f=500,h=150,_=0,g=10;function k(N){N.property("__zoom",Bf).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",T).on("touchmove.zoom",x).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(N,I,C,U){var A=N.selection?N.selection():N;A.property("__zoom",Bf),N!==A?y(N,I,C,U):A.interrupt().each(function(){S(this,arguments).event(U).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},k.scaleBy=function(N,I,C,U){k.scaleTo(N,function(){var A=this.__zoom.k,P=typeof I=="function"?I.apply(this,arguments):I;return A*P},C,U)},k.scaleTo=function(N,I,C,U){k.transform(N,function(){var A=n.apply(this,arguments),P=this.__zoom,F=C==null?v(A):typeof C=="function"?C.apply(this,arguments):C,H=P.invert(F),G=typeof I=="function"?I.apply(this,arguments):I;return o(b(E(P,G),F,H),A,l)},C,U)},k.translateBy=function(N,I,C,U){k.transform(N,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof C=="function"?C.apply(this,arguments):C),n.apply(this,arguments),l)},null,U)},k.translateTo=function(N,I,C,U,A){k.transform(N,function(){var P=n.apply(this,arguments),F=this.__zoom,H=U==null?v(P):typeof U=="function"?U.apply(this,arguments):U;return o(ai.translate(H[0],H[1]).scale(F.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof C=="function"?-C.apply(this,arguments):-C),P,l)},U,A)};function E(N,I){return I=Math.max(r[0],Math.min(r[1],I)),I===N.k?N:new Tn(I,N.x,N.y)}function b(N,I,C){var U=I[0]-C[0]*N.k,A=I[1]-C[1]*N.k;return U===N.x&&A===N.y?N:new Tn(N.k,U,A)}function v(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function y(N,I,C,U){N.on("start.zoom",function(){S(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(U).end()}).tween("zoom",function(){var A=this,P=arguments,F=S(A,P).event(U),H=n.apply(A,P),G=C==null?v(H):typeof C=="function"?C.apply(A,P):C,le=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),se=A.__zoom,ue=typeof I=="function"?I.apply(A,P):I,ye=c(se.invert(G).concat(le/se.k),ue.invert(G).concat(le/ue.k));return function(ae){if(ae===1)ae=ue;else{var Ie=ye(ae),Pe=le/Ie[2];ae=new Tn(Pe,G[0]-Ie[0]*Pe,G[1]-Ie[1]*Pe)}F.zoom(null,ae)}})}function S(N,I,C){return!C&&N.__zooming||new $(N,I)}function $(N,I){this.that=N,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(N,I),this.taps=0}$.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,I){return this.mouse&&N!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var I=nn(this.that).datum();d.call(N,this.that,new D0(N,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:d}),I)}};function O(N,...I){if(!e.apply(this,arguments))return;var C=S(this,I).event(N),U=this.__zoom,A=Math.max(r[0],Math.min(r[1],U.k*Math.pow(2,i.apply(this,arguments)))),P=pn(N);if(C.wheel)(C.mouse[0][0]!==P[0]||C.mouse[0][1]!==P[1])&&(C.mouse[1]=U.invert(C.mouse[0]=P)),clearTimeout(C.wheel);else{if(U.k===A)return;C.mouse=[P,U.invert(P)],fr(this),C.start()}Hi(N),C.wheel=setTimeout(F,h),C.zoom("mouse",o(b(E(U,A),C.mouse[0],C.mouse[1]),C.extent,l));function F(){C.wheel=null,C.end()}}function B(N,...I){if(p||!e.apply(this,arguments))return;var C=N.currentTarget,U=S(this,I,!0).event(N),A=nn(N.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",le,!0),P=pn(N,C),F=N.clientX,H=N.clientY;lf(N.view),xs(N),U.mouse=[P,this.__zoom.invert(P)],fr(this),U.start();function G(se){if(Hi(se),!U.moved){var ue=se.clientX-F,ye=se.clientY-H;U.moved=ue*ue+ye*ye>_}U.event(se).zoom("mouse",o(b(U.that.__zoom,U.mouse[0]=pn(se,C),U.mouse[1]),U.extent,l))}function le(se){A.on("mousemove.zoom mouseup.zoom",null),sf(se.view,U.moved),Hi(se),U.event(se).end()}}function z(N,...I){if(e.apply(this,arguments)){var C=this.__zoom,U=pn(N.changedTouches?N.changedTouches[0]:N,this),A=C.invert(U),P=C.k*(N.shiftKey?.5:2),F=o(b(E(C,P),U,A),n.apply(this,I),l);Hi(N),s>0?nn(this).transition().duration(s).call(y,F,U,N):nn(this).call(k.transform,F,U,N)}}function T(N,...I){if(e.apply(this,arguments)){var C=N.touches,U=C.length,A=S(this,I,N.changedTouches.length===U).event(N),P,F,H,G;for(xs(N),F=0;F<U;++F)H=C[F],G=pn(H,this),G=[G,this.__zoom.invert(G),H.identifier],A.touch0?!A.touch1&&A.touch0[2]!==G[2]&&(A.touch1=G,A.taps=0):(A.touch0=G,P=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(A.taps<2&&(m=G[0],u=setTimeout(function(){u=null},f)),fr(this),A.start())}}function x(N,...I){if(this.__zooming){var C=S(this,I).event(N),U=N.changedTouches,A=U.length,P,F,H,G;for(Hi(N),P=0;P<A;++P)F=U[P],H=pn(F,this),C.touch0&&C.touch0[2]===F.identifier?C.touch0[0]=H:C.touch1&&C.touch1[2]===F.identifier&&(C.touch1[0]=H);if(F=C.that.__zoom,C.touch1){var le=C.touch0[0],se=C.touch0[1],ue=C.touch1[0],ye=C.touch1[1],ae=(ae=ue[0]-le[0])*ae+(ae=ue[1]-le[1])*ae,Ie=(Ie=ye[0]-se[0])*Ie+(Ie=ye[1]-se[1])*Ie;F=E(F,Math.sqrt(ae/Ie)),H=[(le[0]+ue[0])/2,(le[1]+ue[1])/2],G=[(se[0]+ye[0])/2,(se[1]+ye[1])/2]}else if(C.touch0)H=C.touch0[0],G=C.touch0[1];else return;C.zoom("touch",o(b(F,H,G),C.extent,l))}}function R(N,...I){if(this.__zooming){var C=S(this,I).event(N),U=N.changedTouches,A=U.length,P,F;for(xs(N),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),P=0;P<A;++P)F=U[P],C.touch0&&C.touch0[2]===F.identifier?delete C.touch0:C.touch1&&C.touch1[2]===F.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&&(F=pn(F,this),Math.hypot(m[0]-F[0],m[1]-F[1])<g)){var H=nn(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return k.wheelDelta=function(N){return arguments.length?(i=typeof N=="function"?N:pr(+N),k):i},k.filter=function(N){return arguments.length?(e=typeof N=="function"?N:pr(!!N),k):e},k.touchable=function(N){return arguments.length?(a=typeof N=="function"?N:pr(!!N),k):a},k.extent=function(N){return arguments.length?(n=typeof N=="function"?N:pr([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),k):n},k.scaleExtent=function(N){return arguments.length?(r[0]=+N[0],r[1]=+N[1],k):[r[0],r[1]]},k.translateExtent=function(N){return arguments.length?(l[0][0]=+N[0][0],l[1][0]=+N[1][0],l[0][1]=+N[0][1],l[1][1]=+N[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(N){return arguments.length?(o=N,k):o},k.duration=function(N){return arguments.length?(s=+N,k):s},k.interpolate=function(N){return arguments.length?(c=N,k):c},k.on=function(){var N=d.on.apply(d,arguments);return N===d?k:N},k.clickDistance=function(N){return arguments.length?(_=(N=+N)*N,k):Math.sqrt(_)},k.tapDistance=function(N){return arguments.length?(g=+N,k):g},k}var $e=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))($e||{}),Rs=(e=>(e.Partial="partial",e.Full="full",e))(Rs||{}),So=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(So||{}),Mn=(e=>(e.Strict="strict",e.Loose="loose",e))(Mn||{}),As=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(As||{}),ji=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ji||{}),Df=(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))(Df||{});const j0=["INPUT","SELECT","TEXTAREA"],K0=typeof document<"u"?document:null;function $s(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 j0.includes(i==null?void 0:i.nodeName)||a||!!r}function G0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Of(e,n,o,i){const a=n.replace("+",`
34
+ `}}const yo="com.example",$b="command.domain";function Cn(e,n,o={}){const i=Uo(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??$b,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Tb="CustomMoneyType",Mb="Money";function Vb(e){return!(e.type!==Tb||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Lb(e){const n=e.dbAttrs[0]??{modelId:Le(),physicalName:"",dataType:""},o={modelId:Le(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Mb,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Bb(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Vb(l)?(a=!0,n=!0,Lb(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Db(e,n){const o=new Map,i=[],a=new Map;for(const h of e.entities){const _=new Map,g=new Map,k=new Map,E=(b,v,y)=>{if(!b)return;o.get(b)||o.set(b,[{entityId:v,assignedId:b}]),i.push({id:b,entityId:v,sink:y}),y(b)};for(const b of h.attributes){E(b.modelId,h.modelId,v=>_.set(b,v));for(const v of b.dbAttrs)E(v.modelId,h.modelId,y=>g.set(v,y))}for(const b of h.indexes??[])E(b.modelId,h.modelId,v=>k.set(b,v));a.set(h,{attrs:_,cols:g,idx:k})}const r=new Set(o.keys()),l=new Map;for(const h of i){const _=(l.get(h.id)??0)+1;if(l.set(h.id,_),_===1)continue;const g=Ob(h.id,_-1,r);r.add(g),o.get(h.id).push({entityId:h.entityId,assignedId:g}),h.sink(g)}const s=[...o.values()].reduce((h,_)=>h+Math.max(0,_.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(h,_)=>{var k;if(!_||!h)return _;const g=o.get(_);return!g||g.length<2?_:((k=g.find(E=>E.entityId===h))==null?void 0:k.assignedId)??_},d=new Map(e.associations.map(h=>[h.modelId,h])),u=(h,_)=>{const g=d.get(h);if(g)return g.end1.entityRef===_?g.end2.entityRef:g.end1.entityRef},m=e.entities.map(h=>{var b;const _=a.get(h),g=h.attributes.map(v=>{const y=_.attrs.get(v),S=v.dbAttrs.map(B=>{const z=_.cols.get(B);return z===B.modelId?B:{...B,modelId:z}});let $=v.derivedFrom;if($){const B=u($.associationRef,h.modelId),z=c(B,$.sourceAttributeRef);z!==$.sourceAttributeRef&&($={...$,sourceAttributeRef:z})}return y!==v.modelId||$!==v.derivedFrom||S.some((B,z)=>B!==v.dbAttrs[z])?{...v,modelId:y,dbAttrs:S,derivedFrom:$}:v}),k=(b=h.indexes)==null?void 0:b.map(v=>{const y=_.idx.get(v),S=v.columns.map(O=>{const B=c(h.modelId,O.columnRef);return B===O.columnRef?O:{...O,columnRef:B}});return y!==v.modelId||S.some((O,B)=>O!==v.columns[B])?{...v,modelId:y,columns:S}:v});return g.some((v,y)=>v!==h.attributes[y])||k&&h.indexes&&k.some((v,y)=>v!==h.indexes[y])?{...h,attributes:g,...k?{indexes:k}:{}}:h}),p=e.associations.map(h=>{const _=c(h.end1.entityRef,h.end1.attributeRef),g=c(h.end2.entityRef,h.end2.attributeRef);return _===h.end1.attributeRef&&g===h.end2.attributeRef?h:{...h,end1:_===h.end1.attributeRef?h.end1:{...h.end1,attributeRef:_},end2:g===h.end2.attributeRef?h.end2:{...h.end2,attributeRef:g}}}),f=n.associationLayouts.map(h=>{const _=d.get(h.associationRef);if(!_)return h;const g=c(_.end1.entityRef,h.sourceColumnRef),k=c(_.end2.entityRef,h.targetColumnRef);return g===h.sourceColumnRef&&k===h.targetColumnRef?h:{...h,sourceColumnRef:g,targetColumnRef:k}});return{logical:{...e,entities:m,associations:p},layout:f.some((h,_)=>h!==n.associationLayouts[_])?{...n,associationLayouts:f}:n,reissued:s}}function Ob(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}const Pb="5.2.28";function Yt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Pl(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function qd(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Wd(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(qd);if(!i.length)continue;const a=o.filter(s=>!qd(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 Wo(e){return JSON.parse(JSON.stringify(e))}function Jd(e,n,o){var O;const i=o.idFactory??Le,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const B=new Set(n);for(const z of r.associations){const T=B.has(z.end1.entityRef),x=B.has(z.end2.entityRef);T!==x&&s.add(T?z.end2.entityRef:z.end1.entityRef)}}const c=r.entities.filter(B=>s.has(B.modelId)),d=new Set(c.map(B=>B.modelId)),u=r.associations.filter(B=>d.has(B.end1.entityRef)&&d.has(B.end2.entityRef)),m=new Set(u.map(B=>B.modelId)),p=new Map,f=B=>{let z=p.get(B);return z||(z=i(),p.set(B,z)),z};for(const B of c){f(B.modelId);for(const z of B.attributes){f(z.modelId);for(const T of z.dbAttrs)f(T.modelId)}for(const z of B.indexes??[])f(z.modelId);for(const z of B.operations??[])f(z.modelId)}for(const B of u)f(B.modelId);const h=B=>p.get(B),_=c.map(B=>{const z=Wo(B);z.modelId=h(B.modelId),z.attributes=z.attributes.map(T=>zb(T,h,m,d));for(const T of z.indexes??[])T.modelId=h(T.modelId),T.columns=T.columns.map(x=>ao(x.columnRef)?x:{...x,columnRef:h(x.columnRef)}).filter(x=>x.columnRef!==void 0);for(const T of z.operations??[])T.modelId=h(T.modelId);return z});Wd(_);const g=u.map(B=>{const z=Wo(B);return z.modelId=h(B.modelId),z.end1=Xd(z.end1,h),z.end2=Xd(z.end2,h),z}),k=[];for(const B of r.groups){const z=B.memberEntityRefs.filter(x=>d.has(x));if(z.length===0)continue;const T=Wo(B);T.modelId=f(B.modelId),T.memberEntityRefs=z.map(x=>h(x)),k.push(T)}const E=o.collisionSuffix??"_imported",b=new Set(o.existing.entities.map(B=>B.name)),v=new Set(o.existing.entities.map(B=>{var z;return(z=B.table)==null?void 0:z.physicalName}).filter(B=>!!B));for(const B of _)b.has(B.name)&&(B.name=`${B.name}${E}`),(O=B.table)!=null&&O.physicalName&&v.has(B.table.physicalName)&&(B.table.physicalName=`${B.table.physicalName}${E}`);const y=[];for(const B of l.entityLayouts){const z=h(B.entityRef);if(!z)continue;const T=Wo(B);T.entityRef=z,T.geo={...T.geo,location:zl(T.geo.location,a)},T.attributeStyles&&(T.attributeStyles=Ma(T.attributeStyles,h)),T.operationStyles&&(T.operationStyles=Ma(T.operationStyles,h)),y.push(T)}const S=[];for(const B of l.associationLayouts){const z=h(B.associationRef);if(!z)continue;const T=Wo(B);T.associationRef=z,T.sourceColumnRef=B.sourceColumnRef?h(B.sourceColumnRef):void 0,T.targetColumnRef=B.targetColumnRef?h(B.targetColumnRef):void 0,T.waypoints=T.waypoints.map(x=>zl(x,a)),S.push(T)}const $=[];for(const B of l.groupLayouts){const z=h(B.groupRef);if(!z)continue;const T=Wo(B);T.groupRef=z,T.geo={...T.geo,location:zl(T.geo.location,a)},delete T.memberNoteRefs,$.push(T)}return{logical:{entities:_,associations:g,groups:k},layout:{entityLayouts:y,associationLayouts:S,groupLayouts:$},idMap:p}}function zl(e,n){return{x:e.x+n.x,y:e.y+n.y}}function zb(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 Xd(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function Ma(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Fl(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function go(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)=>go(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(!go(e[i],n[i]))return!1;return!0}return!1}function bo(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||go(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function _o(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 Fb(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 Ub=new Set(["attributes","operations","indexes","rev"]),Hb=new Set(["end1","end2","rev"]),jb=new Set(["memberEntityRefs","rev"]),Zd=new Set(["modelId"]),Kb=new Set(["modelId","columns"]),Gb=new Set([]);function Yb(e,n,o,i){const a=_o(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=bo(s,c,Zd);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=_o(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=bo(s,c,Zd);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=_o(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(!go(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=bo(s,c,Kb);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function qb(e,n,o){const i=_o(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:Fl(l)});for(const{cur:l,tgt:s}of i.common){const c=bo(l,s,Ub);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Yb(l.modelId,l,s,o)}const a=_o(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:Fl(l)});for(const{cur:l,tgt:s}of a.common){const c=bo(l,s,Hb);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=bo(l[d]??{},s[d]??{},Gb);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=_o(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:Fl(l)});for(const{cur:l,tgt:s}of r.common){const c=bo(l,s,jb);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Fb(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 Va(e,n,o,i,a,r,l){const s=_o(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)go(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 Wb(e,n,o){Va(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Va(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Va(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Va(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Jb(e,n){const o=[];return qb(e.logical,n.logical,o),Wb(e.layout,n.layout,o),o}function Xb(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 Zb={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 Qb{constructor(n){dt(this,"out",[]);dt(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({...xi(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({...xi(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({...xi(n),field:a,value:void 0,removed:!0});continue}this.out.push({...xi(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({...xi(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function xi(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 un(e,n,o,i){if(o==null||typeof o!="object")return;const a=Zb[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function ko(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Ul(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Gn(e,n){var r,l,s,c,d,u,m,p;const o=Xb(n),i=new Qb(n.field),a=[...e].sort((f,h)=>f.seq-h.seq);for(const f of a)for(const h of f.ops)switch(o){case"entity":if(h.entityRef!==n.entityRef)break;h.kind==="entity.add"?un(i,f,h.value,"entity"):h.kind==="entity.update"?ko(i,f,h.patch):h.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const _=Ul((r=h.value)==null?void 0:r.attributes,n.attributeRef);_&&un(i,f,_,"attribute")}else h.kind==="attribute.add"&&((l=h.value)==null?void 0:l.modelId)===n.attributeRef?un(i,f,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===n.attributeRef?ko(i,f,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===n.attributeRef||h.kind==="entity.remove")&&i.remove(f);break;case"operation":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const _=Ul((s=h.value)==null?void 0:s.operations,n.operationRef);_&&un(i,f,_,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===n.operationRef?un(i,f,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===n.operationRef?ko(i,f,h.patch):(h.kind==="operation.remove"&&h.operationRef===n.operationRef||h.kind==="entity.remove")&&i.remove(f);break;case"index":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const _=Ul((d=h.value)==null?void 0:d.indexes,n.indexRef);_&&un(i,f,_,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===n.indexRef?un(i,f,h.value,"index"):h.kind==="index.update"&&h.indexRef===n.indexRef?ko(i,f,h.patch):(h.kind==="index.remove"&&h.indexRef===n.indexRef||h.kind==="entity.remove")&&i.remove(f);break;case"association":if(h.associationRef!==n.associationRef)break;h.kind==="association.add"?un(i,f,h.value,"association"):h.kind==="association.update"?ko(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(h.associationRef!==n.associationRef)break;if(h.kind==="association.add"){const _=(m=h.value)==null?void 0:m[n.end];un(i,f,_,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===n.end?ko(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"group":if(h.groupRef!==n.groupRef)break;if(h.kind==="group.add"){un(i,f,h.value,"group");const _=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(_))for(const g of _)i.member(f,g,!1)}else h.kind==="group.update"?ko(i,f,h.patch):h.kind==="group.remove"?i.remove(f):h.kind==="group.addMember"&&h.entityRef!=null?i.member(f,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(f,h.entityRef,!0);break}return i.result()}const rt={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},e_={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":rt,"entityLayout.remove":rt,"entityLayout.move":rt,"entityLayout.resize":rt,"entityLayout.setCollapsed":rt,"entityLayout.setLocked":rt,"entityLayout.setStyle":rt,"entityLayout.setAttrStyle":rt,"entityLayout.setOpStyle":rt,"groupLayout.add":rt,"groupLayout.remove":rt,"groupLayout.move":rt,"groupLayout.resize":rt,"groupLayout.setLocked":rt,"groupLayout.setStyle":rt,"groupLayout.addNoteMember":rt,"groupLayout.removeNoteMember":rt,"associationLayout.add":rt,"associationLayout.remove":rt,"associationLayout.setWaypoints":rt,"note.add":rt,"note.remove":rt,"note.move":rt,"note.resize":rt,"note.setMemo":rt,"note.setStyle":rt,"noteConnection.add":rt,"noteConnection.remove":rt,"noteConnection.setWaypoints":rt},Xt=e=>typeof e=="string"?e:void 0,t_=e=>{var n;return Xt((n=e.value)==null?void 0:n.modelId)};function Qd(e){return Xt(e.containerRef)??Xt(e.entityRef)}function Hl(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=Xt(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function jl(e){const n=e_[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=Xt(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Hl(o,"attributes","attribute",a),...Hl(o,"operations","operation",a),...Hl(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Qd(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?t_(o):Xt(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=Xt(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=Xt(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function n_(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=Xt(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Qd(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=Xt(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=Xt(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function o_(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function i_(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of jl(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function La(e,n){return e.map(o=>({...o,subject:n}))}function eu(e,n){const o=e.filter(s=>s.ops.some(c=>o_(c,n))),{attributes:i,operations:a,indexes:r}=i_(o,n),l=[...La(Gn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...La(Gn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...La(Gn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...La(Gn(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 Kl(e){return`${e.kind}:${e.ref}:${e.end??""}`}function a_(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of jl(i))a.existence==="add"&&n.add(Kl(a.subject));return n}function r_(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=n_(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function l_(e){const{entities:n,associations:o,groups:i}=r_(e),a=[];for(const r of n)for(const l of eu(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Gn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Gn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Gn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function Gl(e){const n=l_(e),o=a_(e),i=new Map;for(const l of n){const s=Kl(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=Kl(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}function tu(e){return`${e.kind}:${e.ref}:${e.end??""}`}function s_(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of jl(r)){if(!l.existence||l.inline)continue;const s=l.subject;c_.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const c_=new Set(["attribute","operation","index"]);function Yl(e,n){const{fromSeq:o}=n,i=Gl(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const p=tu(m.subject);let f=s.get(p);f||(f={subject:m.subject,evs:[]},s.set(p,f)),f.evs.push(m)};for(const m of l)for(const p of m.actions)c({seq:m.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const m of s_(e,o,r)){const p=s.get(tu(m.subject));p!=null&&p.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,h)=>f.seq-h.seq);const p=m.evs[m.evs.length-1];m.subject.kind==="entity"&&p.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const p=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||p&&f)continue;const h=new Map;let _=null;for(const k of m.evs){k.verb==="add"&&_!==null&&_!=="add"&&h.clear(),_=k.verb;for(const E of k.fields){const b=h.get(E.field);b?b.lastValue=E.value:h.set(E.field,{firstOld:E.oldValue,hasOld:E.oldValue!==void 0,lastValue:E.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const k=[];for(const[E,b]of h)k.push({field:E,value:b.lastValue});d.push({subject:m.subject,verb:"added",fields:k});continue}const g=[];for(const[k,E]of h)E.hasOld&&go(E.firstOld,E.lastValue)||g.push({field:k,value:E.lastValue,...E.hasOld?{oldValue:E.firstOld}:{}});g.length!==0&&d.push({subject:m.subject,verb:"modified",fields:g})}return{fromSeq:o,toSeq:r,entries:d}}function nu(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class ql{constructor(n){dt(this,"undoStack",[]);dt(this,"redoStack",[]);dt(this,"savePoint",null);dt(this,"listeners",new Set);dt(this,"commandListeners",new Set);dt(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function Ot(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function ou(e,n){var r,l;const o={logical:structuredClone(e.logical),layout:structuredClone(e.layout)},i=[],a=[];for(const s of n){s.apply(o);const c=((l=(r=s.emitOps)==null?void 0:r.call(s,o))==null?void 0:l.forward)??[];c.length===0&&a.push(s.label),i.push(...c)}return{ops:i,skipped:a}}function iu(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function It(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Zt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function mt(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function Sn(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 Ba(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=iu(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=It(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 au(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=iu(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=It(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(p=>p.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function Da(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=mt(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(mt(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Ot(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Ot(o)}]}}}}function ru(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=mt(i,e);o=a.name,a.name=n},invert(i){mt(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 Jo(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=It(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=It(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 lu(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=It(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=It(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 Ri(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 su(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=It(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=Ri(r.style,n)},invert(i){const a=It(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=It(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 cu(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=It(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=It(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 du(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=It(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=It(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 Wl(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 Oa(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=It(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=Ri(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=It(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=It(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 Pa(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 uu(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:Ot(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Ot(o)}]}}}}function mu(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 fu(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 za(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 pu(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 hu(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 yu(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=Ri(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 gu(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 qt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){mt(o,e).attributes.push(n)},invert(o){const i=mt(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 Qt(e,n,o){const i={},a=r=>{const l=mt(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:Ot(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Ot(i)}]}}}}function bu(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=mt(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&&mt(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 _u(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function Jl(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=mt(a,e);i=r.attributes.map(s=>({...s}));const l=Pl([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&mt(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=mt(a,e).attributes;return _u("attribute.update","attributeRef",e,r,i??[])}}}function ku(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=mt(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=mt(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 Eu(e,n,o){const i={},a=r=>{var s;const l=(s=mt(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:Ot(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Ot(i)}]}}}}function Nu(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=mt(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=mt(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 wu(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=mt(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Pl([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=mt(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=mt(a,e).operations??[];return _u("operation.update","operationRef",e,r,i??[])}}}function Iu(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=It(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=Ri(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=It(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=It(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 Fa(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 vu(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function Ua(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Ot(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Ot(o)}]}}}}function en(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:Ot(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Ot(i)}]}}}}function Cu(e,n){return{label:"인덱스 추가",apply(o){const i=mt(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=mt(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 Ha(e,n,o){const i={},a=r=>{var s;const l=(s=mt(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:Ot(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Ot(i)}]}}}}function Su(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=mt(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&&mt(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 mn=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),Ai=(e,n)=>{var o;return((o=Zt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function xu(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Zt(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=Zt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=Ai(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[mn(e,r)],invert:[mn(e,l)]}}}}function Ru(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Zt(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=Zt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=Ai(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[mn(e,a)],invert:[mn(e,r)]}}}}function Au(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Zt(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=Zt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[mn(e,Ai(a,e))],invert:[mn(e,i??[])]}}}}function $u(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Zt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Zt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[mn(e,Ai(o,e))],invert:[mn(e,n??[])]}}}}function Tu(e,n,o){return{label:"waypoint 추가",apply(i){const a=Zt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Zt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=Ai(i,e),r=a.slice();return r.splice(n,1),{forward:[mn(e,a)],invert:[mn(e,r)]}}}}function Mu(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 Vu(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 $i(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 Lu(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 Bu(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 Du(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=Ri(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 Ou(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 Pu(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 Yn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),ja=(e,n,o)=>{var i;return((i=Sn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function zu(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 Fu(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 Uu(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=Sn(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=Sn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=ja(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Yn(e,n,l)],invert:[Yn(e,n,s)]}}}}function Hu(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=Sn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=Sn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=ja(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Yn(e,n,r)],invert:[Yn(e,n,l)]}}}}function ju(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=Sn(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=Sn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=ja(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Yn(e,n,r)],invert:[Yn(e,n,l)]}}}}function Ku(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Sn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=Sn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Yn(e,n,ja(i,e,n))],invert:[Yn(e,n,o??[])]}}}}function ot(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 d_=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Fa,addAttribute:qt,addEntity:Ba,addEntityToGroup:fu,addGroup:Pa,addIndex:Cu,addNote:Mu,addNoteConnection:zu,addNoteConnectionWaypoint:Hu,addNoteToGroup:Ou,addOperation:ku,addWaypoint:Tu,clearNoteConnectionWaypoints:Ku,clearWaypoints:$u,composite:ot,moveEntity:Jo,moveGroup:pu,moveNote:$i,moveNoteConnectionWaypoint:Uu,moveWaypoint:xu,removeAssociation:vu,removeAttribute:bu,removeEntity:au,removeEntityFromGroup:za,removeGroup:mu,removeIndex:Su,removeNote:Vu,removeNoteConnection:Fu,removeNoteConnectionWaypoint:ju,removeNoteFromGroup:Pu,removeOperation:Nu,removeWaypoint:Ru,renameEntity:ru,reorderAttributes:Jl,reorderOperations:wu,resizeEntity:lu,resizeGroup:hu,resizeNote:Lu,setAllEntitiesCollapsed:Wl,setAttributeSwatch:Oa,setEntityCollapsed:cu,setEntityLocked:du,setEntitySwatch:su,setGroupLocked:gu,setGroupSwatch:yu,setNoteMemo:Bu,setNoteSwatch:Du,setOperationSwatch:Iu,translateWaypoints:Au,updateAssociation:Ua,updateAssociationEnd:en,updateAttribute:Qt,updateEntity:Da,updateGroup:uu,updateIndex:Ha,updateOperation:Eu},Symbol.toStringTag,{value:"Module"}));class Gu{constructor(){dt(this,"revs",new Map);dt(this,"layoutVersion",0);dt(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const u_=[400,1200];function m_(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function f_(e){const n=m_(e);return n==null||n===408||n===429?!0:n<400||n>=500}const p_=e=>new Promise(n=>setTimeout(n,e));class Yu{constructor(n){dt(this,"cache",new Gu);dt(this,"newClientOpId");dt(this,"debounceMs");dt(this,"retryDelaysMs");dt(this,"emissions",new WeakMap);dt(this,"open",null);dt(this,"debounceHandle",null);dt(this,"queue",[]);dt(this,"sending",!1);dt(this,"_frozen",!1);dt(this,"stack",null);dt(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Le,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??u_}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!f_(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await p_(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const qu=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Wu=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Ju(e,n,o){var c;if(!n.length||!((c=e.indexes)!=null&&c.length))return[];const i=new Set(n),a=new Set,r=new Map,l=d=>{const u=o==null?void 0:o.get(d);u===void 0?a.add(d):u!==d&&r.set(d,u)};for(const d of e.attributes)if(i.has(d.modelId)){l(d.modelId);for(const u of d.dbAttrs)l(u.modelId)}if(!a.size&&!r.size)return[];const s=[];for(const d of e.indexes){let u=!1;const m=[];for(const p of d.columns){if(a.has(p.columnRef)){u=!0;continue}const f=r.get(p.columnRef);f===void 0?m.push(p):(m.push({...p,columnRef:f}),u=!0)}u&&s.push({indexRef:d.modelId,columns:m})}return s}function h_(e){return wn(e).length}function Xl(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function y_(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=bi(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function Xu(e,n,o=Le){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=h_(i);if(a===0)return[];const r=Xl(e,n),l=wn(i).map(c=>c.col),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;y_(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function Zu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const h=r.get(f);if(!h)return[];l.push(h)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,h)=>f===c[h]))return[];const d=new Map(s.map((f,h)=>[f,h])),u=Xl(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const _=c.map(k=>h.dbAttrs[d.get(k)]),g=_.reduce((k,E,b)=>E===h.dbAttrs[b]?k:k+1,0);g&&m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:_,moved:g})}return m}function Qu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=wn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(wn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,h)=>{c.has(f)&&d.add(h)}),d.size===s.length)return[];const u=Xl(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const _=h.dbAttrs.filter((E,b)=>d.has(b)),g=h.dbAttrs.filter((E,b)=>!d.has(b));h.dbAttrs.some((E,b)=>{if(d.has(b))return!1;const v=l[b],y=!!E.physicalName&&E.physicalName!==((v==null?void 0:v.physicalName)??""),S=E.sharedColumnRef!=null&&E.sharedColumnRef!==(v==null?void 0:v.sharedColumnRef);return y||S})||m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:_,dropped:g})}return m}function fn(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>bu(e,r))}function Wt(e,n,o){if(!n.length)return[];const i=new Map;for(const{entityId:r,attributeId:l}of n){const s=i.get(r)??[];s.push(l),i.set(r,s)}const a=[];for(const[r,l]of i){const s=e.entities.find(c=>c.modelId===r);if(s)for(const c of Ju(s,l,o))a.push(Ha(r,c.indexRef,{columns:c.columns}))}return a}function Ka(e,n,o,i){var c;const a=[];a.push(...fn(n,o.remove,i));for(const d of o.update)a.push(Qt(n,d.attributeId,d.patch));for(const d of o.add)a.push(qt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const p=l.filter(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,h)=>f.order-h.order)[0];p&&a.push(en(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function Eo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Xo(e,n,o){const i=[];for(const[a,r]of vl(e,n,Le))i.push(...Ka(e,a,r,o));for(const a of Xu(e,n,Le))i.push(Qt(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function g_(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Pl([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return Zu(e,n,r).map(l=>Qt(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function Zl(e,n,o){return Qu(e,n,o).map(i=>Qt(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function b_(e,n,o){const i=new Set(o.remove);return Eo(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 Ga(e,n,o){const i=[];for(const{entityId:a,plan:r}of Sd(e,n,Le))i.push(...Ka(e,a,r,o));return i}function em(e,n,o=new Set){var r,l,s,c;if(!cn(n))return[];const i=[];for(const d of e.attributes){if(o.has(d.modelId))continue;const u={},m=(r=d.dbAttrs.find(p=>Hn(p.logicalName)))==null?void 0:r.logicalName;m&&!Hn(d.fieldLogicalName)&&(u.fieldLogicalName=m),d.dbAttrs.length>0&&(u.dbAttrs=[]),d.notNull&&(u.notNull=!1),Object.keys(u).length>0&&i.push(Qt(e.modelId,d.modelId,u))}const a={};return Hn((l=e.table)==null?void 0:l.logicalName)&&!Hn(e.classLogicalName)&&(a.classLogicalName=e.table.logicalName),(s=e.table)!=null&&s.physicalName&&(a.table=null),(c=e.indexes)!=null&&c.length&&(a.indexes=[]),e.schema&&(a.schema=null),e.jpaAttrs&&(a.jpaAttrs=null),Object.keys(a).length>0&&i.push(Da(e.modelId,a)),i}function tm(e){return wn(e).map(n=>({...n.col,modelId:Le()}))}function nm(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=Yt(o.attributes),p=new Set(o.attributes.map(h=>h.name));let f="id";for(let h=2;p.has(f);h++)f=`id${h}`;a={modelId:Le(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Le(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(qt(n,a))}const r=[];for(const m of e.entities)for(const p of m.attributes){if(((u=p.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(k=>k.modelId===p.embedded.associationRef);if(!f)continue;const h=f.end1.entityRef===m.modelId,_=h?f.end1:f.end2,g=h?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:_.multiplicity,navigable:_.navigable,composition:!1},end2:{entityRef:n,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const p=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return p.size?{...m,attributes:m.attributes.filter(f=>!p.has(f.modelId))}:m}),associations:e.associations.map(m=>{const p=r.find(f=>f.assocId===m.modelId);return p?{...m,end1:p.end1,end2:p.end2}:m})},s=Ii(l,n,Le);for(const m of r){const p=s.add.find(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...fn(m.ownerId,[m.dispId],c)),i.push(Ua(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Ka(l,n,s,c));const d=b_(l,n,s);return i.push(...Xo(d,n,c)),i.push(...Wt(e,c)),i}function om(e,n,o){const i=e.associations.find(l=>l.modelId===n);if(!i||i.end1.navigable===o)return null;const a=e.entities.find(l=>l.modelId===i.end1.entityRef),r=e.entities.find(l=>l.modelId===i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")return null;if(o===!0&&!i.end1.attributeRef){const l=ka(i.end2.multiplicity),s=i.end1.navFieldNameHint||Na(r.name,l),c=uo(s,new Set(a.attributes.map(m=>m.name))),d=Le(),u={modelId:d,name:c,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:Yt(a.attributes),dbAttrs:[]};return{cmds:[qt(i.end1.entityRef,u)],endPatch:{attributeRef:d,navFieldNameHint:void 0}}}if(o===!1&&i.end1.attributeRef){const l=i.end1.attributeRef,s=a.attributes.find(m=>m.modelId===l&&m.attrType==="RELATION_REF"),c={attributeRef:void 0,navFieldNameHint:(s==null?void 0:s.name)??i.end1.navFieldNameHint};if(!s)return{cmds:[],endPatch:c};const d=[],u=[...fn(i.end1.entityRef,[l],d)];return u.push(...Wt(e,d)),{cmds:u,endPatch:c}}return null}function im(e,n,o){const i=e.entities.find(u=>u.modelId===n);if(!i)return[];const a=i.attributes.filter(u=>u.identifier&&!u.derivedFrom).map(u=>Qt(n,u.modelId,{identifier:!1})),r=Eo({...e,entities:e.entities.map(u=>u.modelId===n?{...u,stereotype:o}:u)},n,u=>u.map(m=>m.identifier&&!m.derivedFrom?{...m,identifier:!1}:m)),l=[],s=Ga(r,[n],l);s.push(...Wt(e,l));const c=o==="JPA_EMBEDDABLE"?__(e,n):[],d=em(i,o,new Set(l.filter(u=>u.entityId===n).map(u=>u.attributeId)));return[...a,...s,...c,...d]}function __(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(b=>b.modelId===c);if(!d||d.attributes.some(b=>{var v;return((v=b.embedded)==null?void 0:v.associationRef)===r.modelId}))continue;const u=Le(),m=Yt(d.attributes),p=new Set(d.attributes.map(b=>b.name)),f=a(o.name);let h=f;for(let b=2;p.has(h);b++)h=`${f}${b}`;const _=o.attributes.filter(b=>!b.identifier&&!b.derivedFrom).flatMap(b=>b.dbAttrs).map(b=>({...b,modelId:Le()})),g={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:_,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(qt(c,g));const k=l?"end2":"end1",E=l?"end1":"end2";i.push(Ua(r.modelId,{identifying:!1,[k]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Le()},[E]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function am(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[pu(n,o),...i.map(u=>Jo(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(Au(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const p=e.layout.notes.find(f=>f.modelId===m);p&&c.push($i(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}const rm={diagramId:"",logicalModelRef:"",entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]};function k_(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function E_(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function lm(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function At(e,n){if(!Ya(n))return{ok:!1,reason:"shape",matches:[]};const o=k_(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_(i,e))}}function N_(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Ql(e,n){const o=N_(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function es(e,n,o){return e.reason==="shape"?{code:"handle-shape-invalid",opIndex:n,where:"group",expected:"{ref, by?}",got:is(o)}:e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const w_=new Set(["name","description","packageName","excludeDDLGeneration"]);function I_(e,n){var a;const o=Uo(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(p=>p.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function sm(e,n){const o=E_(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 v_(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function C_(e,n){const o=v_(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 cm(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 ts(e){return e.by!==void 0&&e.by!=="name"}function S_(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function x_(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function R_(e,n){const o=S_(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 dm(e,n){const o=x_(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 um(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function mm(e){return um(e)&&e.dataType==null}function fm(e,n,o){const i=um(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},...e.collectionType?{collectionType:e.collectionType}:{},...e.fieldLogicalName?{fieldLogicalName:e.fieldLogicalName}:{},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 pm(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let p=!1;for(const f of n.fields){const h=u.get(f.name);if(h!=null&&h.sharedColumnPhysicalName){const _={ref:h.sharedColumnPhysicalName,by:"physicalName"},g=cm(vn(i,a),_);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:g.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});continue}m.push({modelId:c(),physicalName:(h==null?void 0:h.physicalName)??"",dataType:"",...h!=null&&h.length?{length:h.length}:{},...h!=null&&h.scale?{scale:h.scale}:{},...(h==null?void 0:h.insertable)!=null?{insertable:h.insertable}:{},...(h==null?void 0:h.updatable)!=null?{updatable:h.updatable}:{},...(h==null?void 0:h.notNull)!=null?{notNull:h.notNull}:{}})}return p?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}const A_=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName","collectionType","fieldLogicalName"]),Zo=e=>new Set(Object.keys(e)),$_=Zo({name:!0,stereotype:!0,physicalName:!0,useVersion:!0,attributes:!0,indexes:!0,operations:!0,serialization:!0,classLogicalName:!0}),hm=Zo({name:!0,type:!0,identifier:!0,notNull:!0,transient:!0,physicalName:!0,dataType:!0,length:!0,scale:!0,groupCode:!0,defaultValue:!0,attributeGroup:!0,description:!0,columnLogicalName:!0,unique:!0,updatable:!0,embeddableOverrides:!0,collectionType:!0,fieldLogicalName:!0}),ym=Zo({name:!0,unique:!0,columns:!0,description:!0,parameters:!0}),gm=Zo({name:!0,visibility:!0,sourceCode:!0,description:!0,personalInfoAttributeType:!0}),T_=Zo({from:!0,to:!0,fromMultiplicity:!0,toMultiplicity:!0,identifying:!0,composition:!0}),M_=Zo({name:!0,packageName:!0,description:!0,excludeDDLGeneration:!0,members:!0});function xn(e,n){return No(e,n)}const V_=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","classLogicalName","referenceOnly","serialization"]),L_=new Set(["description","identifying"]),B_=new Set(["multiplicity","navigable","composition"]),D_=new Set(["name","unique","description","parameters"]),O_=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function No(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const ns=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),P_=new Set([...ns].filter(e=>e!=="sharedColumnRef"));function z_(e,n,o,i){if(i||o.some(l=>!P_.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))ns.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function F_(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,p)=>{const f=n.fields[p],h=f?c.get(f.name):void 0;if(!h){d.push(m);return}if(h.sharedColumnPhysicalName){const g={ref:h.sharedColumnPhysicalName,by:"physicalName"},k=cm(vn(i,a),g);if(!k.ok){s.push(k.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:k.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:k.value.modelId});return}const _={...m};delete _.sharedColumnRef,d.push({..._,...h.physicalName!=null?{physicalName:h.physicalName}:{},...h.length!=null?{length:h.length}:{},...h.scale!=null?{scale:h.scale}:{},...h.notNull!=null?{notNull:h.notNull}:{},...h.insertable!=null?{insertable:h.insertable}:{},...h.updatable!=null?{updatable:h.updatable}:{}})}),u?null:d}function bm(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 _m(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=C_(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 Qo(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function U_(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Ju(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function H_(e,n,o,i,a,r){const l=m=>{const p=new Map;for(const{entityId:f,item:h}of m){if(a.has(f))continue;const _=p.get(f)??[];_.push(h),p.set(f,_)}return p},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,p]of s)if(!c.has(m))for(const f of Qu(n,m,p))u(f);for(const[m,p]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(h=>h.modelId===m?{...h,attributes:[...h.attributes,...p]}:h)};for(const h of Xu(f,m,r))u(h)}}function km(e,n){const o={...e},i=[];for(const[a,r]of Object.entries(n)){if(!a.includes(".")){o[a]=r===null?void 0:r;continue}const l=/^dbAttrs\.(\d+)\.(.+)$/.exec(a);l&&i.push([Number(l[1]),l[2],r])}if(i.length){const a=(o.dbAttrs??[]).map(r=>({...r}));for(const[r,l,s]of i)a[r]&&(a[r][l]=s===null?void 0:s);o.dbAttrs=a}return o}function Em(e,n,o,i,a,r,l){var p;for(const f of i.remove)Qo(e,r,o,f);for(const f of i.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:f.attributeId,patch:f.patch}),a.attrPatches.push({entityId:o,attributeId:f.attributeId,patch:f.patch});const s=((p=n.entities.find(f=>f.modelId===o))==null?void 0:p.attributes)??[],c=[];for(const f of i.add){const h={...f,order:l(o,s)};e.push({kind:"attribute.add",casUnit:"logical",containerRef:o,entityRef:o,value:h}),a.cascadeAdds.push({entityId:o,attribute:h}),c.push(h)}const d=new Set(i.remove),u=[...s.filter(f=>!d.has(f.modelId)),...c],m=new Set(u.map(f=>f.modelId));for(const f of n.associations){if(f.end2.entityRef!==o)continue;const h=f.end2.attributeRef;if(h&&m.has(h))continue;const g=u.filter(k=>{var E;return((E=k.derivedFrom)==null?void 0:E.associationRef)===f.modelId&&k.dbAttrs.length>0}).sort((k,E)=>k.order-E.order)[0];g&&(e.push({kind:"associationEnd.update",casUnit:"logical",containerRef:f.modelId,associationRef:f.modelId,end:"end2",patch:{attributeRef:g.modelId}}),a.endPatches.push({associationRef:f.modelId,end:"end2",patch:{attributeRef:g.modelId}}))}}function os(e,n,o,i,a,r,l){for(const{entityId:s,plan:c}of Sd(n,o,i))Em(e,n,s,c,a,r,l)}function j_(e,n,o,i,a,r){const l=new Map;for(const{entityId:p,attributeId:f}of i.pairs)l.has(p)||l.set(p,new Set),l.get(p).add(f);const s=new Map;for(const p of r.attrPatches)s.has(p.entityId)||s.set(p.entityId,[]),s.get(p.entityId).push(p);const c=new Map;for(const{entityId:p,attribute:f}of[...a,...r.cascadeAdds])c.has(p)||c.set(p,[]),c.get(p).push(f);const d=p=>{const f={};for(const[h,_]of Object.entries(p))h.includes(".")||(f[h]=_===null?void 0:_);return f},u=e.entities.filter(p=>!n.has(p.modelId)).map(p=>{const f=l.get(p.modelId),h=s.get(p.modelId),_=c.get(p.modelId);if(!f&&!h&&!_)return p;let g=p.attributes;return f&&(g=g.filter(k=>!f.has(k.modelId))),h&&(g=g.map(k=>{const E=h.filter(b=>b.attributeId===k.modelId);return E.length?E.reduce((b,v)=>km(b,v.patch),k):k})),_&&(g=[...g,..._]),{...p,attributes:g}}),m=e.associations.filter(p=>!o.has(p.modelId)&&!n.has(p.end1.entityRef)&&!n.has(p.end2.entityRef)).map(p=>{let f=p;for(const h of r.assocPatches)h.associationRef===p.modelId&&(f={...f,...d(h.patch)});for(const h of r.endPatches)h.associationRef===p.modelId&&(f={...f,[h.end]:{...f[h.end],...d(h.patch)}});return f}).concat(r.addedAssociations);return{...e,entities:u,associations:m}}function K_(e,n,o,i,a,r,l,s,c){if(!l.identifierCascadeParents.size)return;const d=j_(n,o,i,a,r,l),u=new Map;for(const m of l.identifierCascadeParents)for(const[p,f]of vl(d,m,s)){const h=u.get(p);u.set(p,h?Il(h,f):f)}for(const[m,p]of u)Em(e,d,m,Cd(p),l,a,c)}function G_(e){const n=i=>{if(i==null||typeof i!="object"||Array.isArray(i))return!1;const a=Object.keys(i);return a.length>0&&a.every(r=>ha.includes(r))},o=i=>{if(n(i))return Bc(i)??null;if(Array.isArray(i)){const a=i.map(o);return a.some((r,l)=>r!==i[l])?a:i}if(i!=null&&typeof i=="object"){const a=i;let r=!1;const l={};for(const[s,c]of Object.entries(a))l[s]=o(c),l[s]!==c&&(r=!0);return r?l:i}return i};return e.map(i=>o(i))}function Y_(e,n,o={}){const i=G_(n),a=o.mkId??Le,r=o.embeddableCatalog??[],l=y=>r.find(S=>S.type===y),s=[],c=[],d=new Map,u=(y,S)=>{const $=d.get(y)??Yt(S);return d.set(y,$+1),$},m=new Map,p=new Set,f=new Set,h={seen:new Set,pairs:[]},_=[],g={attrPatches:[],cascadeAdds:[],addedAssociations:[],assocPatches:[],endPatches:[],identifierCascadeParents:new Set},k=new Set,E=(y,S)=>`${y}\0${S}`,b=new Set;for(const y of i)y.kind==="entity.add"&&(b.add(y.spec.name),y.spec.physicalName&&b.add(y.spec.physicalName));const v=new Set;return i.forEach((y,S)=>{var $,O,B,z,T;if(W_(y,S,c))switch(y.kind){case"entity.add":{{const P={ref:y.spec.name},F=xn(y.spec,$_);if(F.length){c.push({code:"entity-spec-unknown-key",opIndex:S,handle:P,keys:F});break}let H=!1;for(const G of y.spec.attributes??[]){const le=xn(G,hm);le.length&&(c.push({code:"attribute-spec-unknown-key",opIndex:S,entity:P,handle:{ref:G.name},keys:le}),H=!0)}for(const G of y.spec.indexes??[]){const le=xn(G,ym);le.length&&(c.push({code:"index-spec-unknown-key",opIndex:S,entity:P,handle:{ref:G.name},keys:le}),H=!0)}for(const G of y.spec.operations??[]){const le=xn(G,gm);le.length&&(c.push({code:"operation-spec-unknown-key",opIndex:S,entity:P,handle:{ref:G.name},keys:le}),H=!0)}if(H)break}const x=e.entities.filter(P=>P.name===y.spec.name).map(P=>P.modelId);if(x.length||v.has(y.spec.name)){c.push({code:"entity-name-conflict",opIndex:S,handle:{ref:y.spec.name},matches:x});break}v.add(y.spec.name);const R=a(),N={modelId:R,name:y.spec.name,stereotype:y.spec.stereotype??"JPA_ENTITY",attributes:[],...y.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...y.spec.physicalName?{table:{physicalName:y.spec.physicalName}}:{},...y.spec.serialization?{serialization:y.spec.serialization}:{},...y.spec.classLogicalName?{classLogicalName:y.spec.classLogicalName}:{}},I={ref:y.spec.name};let C=!1;for(const[P,F]of(y.spec.attributes??[]).entries()){if(ml(F.type,F.groupCode)){c.push(F.groupCode?{code:"groupcode-type-mismatch",opIndex:S,entity:I,handle:{ref:F.name},type:String(F.type??""),groupCode:F.groupCode}:{code:"groupcode-required",opIndex:S,entity:I,handle:{ref:F.name}}),C=!0;continue}if(!l(F.type)&&!(($=F.embeddableOverrides)!=null&&$.length)&&mm(F)){c.push({code:"datatype-required",opIndex:S,entity:I,handle:{ref:F.name}}),C=!0;continue}const H=l(F.type);if(H){const G=pm(F,H,P,N,e.entities,S,I,c,a);G?N.attributes.push(G):C=!0}else(O=F.embeddableOverrides)!=null&&O.length?(c.push({code:"embeddable-type-unresolved",opIndex:S,entity:I,handle:{ref:F.name}}),C=!0):N.attributes.push(fm(F,P,a))}const U=(y.spec.operations??[]).map((P,F)=>bm(P,F,a));U.length&&(N.operations=U);const A=[];for(const P of y.spec.indexes??[]){const F=_m(N,P,S,I,c,a);F?A.push(F):C=!0}if(A.length&&(N.indexes=A),C)break;s.push({kind:"entity.add",casUnit:"logical",entityRef:R,value:N});break}case"entity.update":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=No(y.patch,V_,["jpaAttrs.","table.","serialization."]);if(R.length){c.push({code:"entity-patch-unknown-key",opIndex:S,entity:y.entity,keys:R});break}const N=y.patch.stereotype;if(typeof N=="string"&&N!==x.value.stereotype){const I=x.value.stereotype,C=N,U=at(C)&&!at(I),A=!at(C)&&at(I);if(C!==I&&at(C)&&at(I)&&e.entities.filter(G=>G.attributes.some(le=>{var se;return((se=le.embedded)==null?void 0:se.embeddableRef)===x.value.modelId})).length>0){c.push({code:"stereotype-embeddable-transition-unsupported",opIndex:S,entity:y.entity,from:I??"",to:C});break}if(C==="SERIALIZED_TYPE"&&e.associations.filter(G=>G.end1.entityRef===x.value.modelId||G.end2.entityRef===x.value.modelId).length>0){c.push({code:"stereotype-serialized-transition-unsupported",opIndex:S,entity:y.entity,from:I??"",to:C});break}const F=U?im(e,x.value.modelId,C):A?nm(e,x.value.modelId):[];if(F.length){const H=Da(x.value.modelId,y.patch),G=ou({logical:e,layout:rm},[H,...F]);s.push(...G.ops);break}}s.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:y.patch});break}case"entity.remove":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=x.value.modelId,N=e.associations.filter(A=>A.end1.entityRef===R||A.end2.entityRef===R),I=new Set(N.map(A=>A.modelId));for(const A of N)p.has(A.modelId)||(p.add(A.modelId),s.push({kind:"association.remove",casUnit:"logical",associationRef:A.modelId}));for(const A of e.entities)if(A.modelId!==R)for(const P of A.attributes)P.embedded&&I.has(P.embedded.associationRef)&&Qo(s,h,A.modelId,P.modelId);for(const A of N){if(A.end1.entityRef===R||!A.end1.attributeRef)continue;const P=e.entities.find(H=>H.modelId===A.end1.entityRef),F=P==null?void 0:P.attributes.find(H=>H.modelId===A.end1.attributeRef&&H.attrType==="RELATION_REF");F&&Qo(s,h,P.modelId,F.modelId)}const C={...e,entities:e.entities.filter(A=>A.modelId!==R),associations:e.associations.filter(A=>!I.has(A.modelId))},U=new Set(N.filter(A=>A.end1.entityRef===R&&A.end2.entityRef!==R).map(A=>A.end2.entityRef));os(s,C,[...U],a,g,h,u);for(const A of e.groups)A.memberEntityRefs.includes(R)&&(k.has(E(A.modelId,R))||(k.add(E(A.modelId,R)),s.push({kind:"group.removeMember",casUnit:"logical",containerRef:A.modelId,groupRef:A.modelId,entityRef:R})));f.add(R),s.push({kind:"entity.remove",casUnit:"logical",entityRef:R});break}case"attribute.add":{{const C=xn(y.spec,hm);if(C.length){c.push({code:"attribute-spec-unknown-key",opIndex:S,entity:y.entity,handle:{ref:y.spec.name},keys:C});break}}const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}if(ml(y.spec.type,y.spec.groupCode)){c.push(y.spec.groupCode?{code:"groupcode-type-mismatch",opIndex:S,entity:y.entity,handle:{ref:y.spec.name},type:String(y.spec.type??""),groupCode:y.spec.groupCode}:{code:"groupcode-required",opIndex:S,entity:y.entity,handle:{ref:y.spec.name}});break}if(!l(y.spec.type)&&!((B=y.spec.embeddableOverrides)!=null&&B.length)&&mm(y.spec)){c.push({code:"datatype-required",opIndex:S,entity:y.entity,handle:{ref:y.spec.name}});break}const R=u(x.value.modelId,x.value.attributes),N=l(y.spec.type);let I;if(N)I=pm(y.spec,N,R,x.value,e.entities,S,y.entity,c,a);else if((z=y.spec.embeddableOverrides)!=null&&z.length){c.push({code:"embeddable-type-unresolved",opIndex:S,entity:y.entity,handle:{ref:y.spec.name}});break}else I=fm(y.spec,R,a);if(!I)break;s.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:I}),_.push({entityId:x.value.modelId,attribute:I}),I.identifier&&g.identifierCascadeParents.add(x.value.modelId);break}case"attribute.update":case"attribute.remove":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=sm(x.value,y.attribute);if(!R.ok){c.push(R.reason==="not-found"?{code:"attribute-not-found",opIndex:S,entity:y.entity,handle:y.attribute}:{code:"attribute-ambiguous",opIndex:S,entity:y.entity,handle:y.attribute,matches:R.matches});break}if(y.kind==="attribute.update"){const N=[],I=[];let C=!1;for(const F of Object.keys(y.patch)){if(F.includes(".")){F.startsWith("dbAttrs.")?C=!0:I.push(F);continue}ns.has(F)?N.push(F):A_.has(F)||I.push(F)}if(I.length){c.push({code:"attribute-patch-unknown-key",opIndex:S,entity:y.entity,handle:y.attribute,keys:I});break}if("attrType"in y.patch){const F=String(y.patch.attrType),H=Wu.includes(F)?F!==R.value.attrType?"transition":void 0:"unknown-value";if(H){c.push({code:"attribute-attrtype-unsupported",opIndex:S,entity:y.entity,handle:y.attribute,reason:H,current:R.value.attrType,requested:F});break}}if("type"in y.patch){const F=String(y.patch.type);if(Wc(R.value,F,r)){const H=ul(R.value),G=H==="association"?"association-owned":H==="derived"?"derived":"column-count";c.push({code:"attribute-type-conversion-unsupported",opIndex:S,entity:y.entity,handle:y.attribute,reason:G,current:R.value.type,requested:F});break}}const U="type"in y.patch?y.patch.type:R.value.type,A="groupCode"in y.patch?y.patch.groupCode:R.value.groupCode;if(ml(U,A)){c.push(A?{code:"groupcode-type-mismatch",opIndex:S,entity:y.entity,handle:y.attribute,type:String(U??""),groupCode:String(A)}:{code:"groupcode-required",opIndex:S,entity:y.entity,handle:y.attribute});break}let P=y.patch;if(N.length){const F=z_(R.value,y.patch,N,C);if(!F){c.push({code:"attribute-patch-dbattr-flat-key",opIndex:S,entity:y.entity,handle:y.attribute,keys:N});break}P=F}if((T=y.embeddableOverrides)!=null&&T.length){const F=l(R.value.type);if(!F||R.value.attrType!=="EMBED_PREDEF"){c.push({code:"embeddable-type-unresolved",opIndex:S,entity:y.entity,handle:y.attribute});break}const H=F_(R.value,F,y.embeddableOverrides,x.value,e.entities,S,y.entity,c);if(!H)break;P={...P,dbAttrs:H}}s.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:R.value.modelId,patch:P}),g.attrPatches.push({entityId:x.value.modelId,attributeId:R.value.modelId,patch:P});{const F=R.value,H=km(F,P),G=(H.identifier??!1)!==(F.identifier??!1),le=(F.identifier||H.identifier)&&("type"in P||"customType"in P||"dbAttrs"in P||Object.keys(P).some(se=>se.startsWith("dbAttrs.")));(G||le)&&g.identifierCascadeParents.add(x.value.modelId)}}else{const N=po(e,x.value.modelId,R.value.modelId);if(N){const I=C=>{var U;return((U=e.entities.find(A=>A.modelId===C))==null?void 0:U.name)??C};c.push({code:"attribute-fk-managed",opIndex:S,entity:y.entity,handle:y.attribute,association:{from:I(N.end1.entityRef),to:I(N.end2.entityRef)}});break}Qo(s,h,x.value.modelId,R.value.modelId),R.value.identifier&&g.identifierCascadeParents.add(x.value.modelId)}break}case"association.add":{{const A=xn(y.spec,T_);if(A.length){c.push({code:"association-spec-unknown-key",opIndex:S,handle:{from:y.spec.from,to:y.spec.to},keys:A});break}}const x=At(e,y.spec.from),R=At(e,y.spec.to);if(x.ok||c.push($t(x.reason,S,y.spec.from,x.matches,b)),R.ok||c.push($t(R.reason,S,y.spec.to,R.matches,b)),!x.ok||!R.ok)break;if(y.spec.identifying&&x.value.modelId===R.value.modelId){c.push({code:"self-identifying",opIndex:S,handle:{from:y.spec.from,to:y.spec.to}});break}if(x.value.stereotype==="JPA_EMBEDDABLE"||R.value.stereotype==="JPA_EMBEDDABLE"){c.push({code:"embeddable-relation-unsupported",opIndex:S,handle:{from:y.spec.from,to:y.spec.to}});break}if(x.value.stereotype==="SERIALIZED_TYPE"||R.value.stereotype==="SERIALIZED_TYPE"){c.push({code:"serialized-relation-invalid",opIndex:S,handle:{from:y.spec.from,to:y.spec.to}});break}const N=a(),I={modelId:N,...y.spec.identifying!=null?{identifying:y.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:y.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:R.value.modelId,multiplicity:y.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:y.spec.composition??!1}},C={...e,associations:[...e.associations,I]},U=Ii(C,R.value.modelId,a);U.add[0]&&(I.end2.attributeRef=U.add[0].modelId),s.push({kind:"association.add",casUnit:"logical",associationRef:N,value:I}),g.addedAssociations.push(I);for(const A of U.add){const P={...A,order:u(R.value.modelId,R.value.attributes)};s.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:P}),g.cascadeAdds.push({entityId:R.value.modelId,attribute:P})}break}case"association.remove":{const x=At(e,y.association.from),R=At(e,y.association.to);if(x.ok||c.push($t(x.reason,S,y.association.from,x.matches,b)),R.ok||c.push($t(R.reason,S,y.association.to,R.matches,b)),!x.ok||!R.ok)break;const N=lm(e,x.value.modelId,R.value.modelId);if(N.length!==1){c.push(N.length===0?{code:"association-not-found",opIndex:S,handle:y.association}:{code:"association-ambiguous",opIndex:S,handle:y.association,matches:N.map(A=>A.modelId)});break}const I=N[0];p.has(I.modelId)||(p.add(I.modelId),s.push({kind:"association.remove",casUnit:"logical",associationRef:I.modelId}));const C=e.entities.find(A=>A.attributes.some(P=>{var F;return((F=P.embedded)==null?void 0:F.associationRef)===I.modelId}));if(C){const A=C.attributes.find(P=>{var F;return((F=P.embedded)==null?void 0:F.associationRef)===I.modelId});Qo(s,h,C.modelId,A.modelId);break}if(I.end1.attributeRef){const A=e.entities.find(F=>F.modelId===I.end1.entityRef),P=A==null?void 0:A.attributes.find(F=>F.modelId===I.end1.attributeRef&&F.attrType==="RELATION_REF");P&&Qo(s,h,A.modelId,P.modelId)}const U={...e,associations:e.associations.filter(A=>A.modelId!==I.modelId)};os(s,U,[I.end2.entityRef],a,g,h,u);break}case"association.update":{const x=Nm(e,y.association,S,c,b);if(!x)break;const R=y.patch.identifying,N=typeof R=="boolean"?R:void 0;if(N===!0&&x.end1.entityRef===x.end2.entityRef){c.push({code:"self-identifying",opIndex:S,handle:y.association});break}const I=No(y.patch,L_);if(I.length){c.push({code:"association-patch-unknown-key",opIndex:S,handle:y.association,keys:I});break}if(s.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:y.patch}),g.assocPatches.push({associationRef:x.modelId,patch:y.patch}),N!==void 0&&N!==(x.identifying??!1)){const C={...e,associations:e.associations.map(U=>U.modelId===x.modelId?{...U,identifying:N}:U)};os(s,C,[x.end2.entityRef],a,g,h,u)}break}case"associationEnd.update":{const x=Nm(e,y.association,S,c,b);if(!x)break;const R=y.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(y.patch,"navigable")){if(R==="end2"){c.push({code:"navigable-toggle-unsupported",opIndex:S,handle:y.association});break}const I=y.patch.navigable===!0;if(x.end1.navigable!==I){const C=om(e,x.modelId,I);if(C){const U=en(x.modelId,"end1",{...y.patch,...C.endPatch}),A=ou({logical:e,layout:rm},[...C.cmds,U]);s.push(...A.ops);break}}}const N=No(y.patch,B_,["jpa."]);if(N.length){c.push({code:"association-end-patch-unknown-key",opIndex:S,handle:y.association,keys:N});break}s.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:R,patch:y.patch}),g.endPatches.push({associationRef:x.modelId,end:R,patch:y.patch});break}case"index.add":{{const N=xn(y.spec,ym);if(N.length){c.push({code:"index-spec-unknown-key",opIndex:S,entity:y.entity,handle:{ref:y.spec.name},keys:N});break}}const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=_m(x.value,y.spec,S,y.entity,c,a);if(!R)break;s.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.modelId,value:R});break}case"index.update":case"index.remove":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}if(ts(y.index)){c.push({code:"handle-by-unsupported",opIndex:S,entity:y.entity,handle:y.index,target:"index"});break}const R=R_(x.value,y.index);if(!R.ok){c.push(R.reason==="not-found"?{code:"index-not-found",opIndex:S,entity:y.entity,handle:y.index}:{code:"index-ambiguous",opIndex:S,entity:y.entity,handle:y.index,matches:R.matches});break}if(y.kind==="index.update"){if("columns"in y.patch){c.push({code:"index-columns-patch-unsupported",opIndex:S,entity:y.entity,handle:y.index});break}const N=No(y.patch,D_);if(N.length){c.push({code:"index-patch-unknown-key",opIndex:S,entity:y.entity,handle:y.index,keys:N});break}s.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId,patch:y.patch})}else s.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:R.value.modelId});break}case"operation.add":{{const I=xn(y.spec,gm);if(I.length){c.push({code:"operation-spec-unknown-key",opIndex:S,entity:y.entity,handle:{ref:y.spec.name},keys:I});break}}const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}const R=m.get(x.value.modelId)??(x.value.operations?Yt(x.value.operations):0);m.set(x.value.modelId,R+1);const N=bm(y.spec,R,a);s.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:N.modelId,value:N});break}case"operation.update":case"operation.remove":{const x=At(e,y.entity);if(!x.ok){c.push($t(x.reason,S,y.entity,x.matches,b));break}if(ts(y.operation)){c.push({code:"handle-by-unsupported",opIndex:S,entity:y.entity,handle:y.operation,target:"operation"});break}const R=dm(x.value,y.operation);if(!R.ok){c.push(R.reason==="not-found"?{code:"operation-not-found",opIndex:S,entity:y.entity,handle:y.operation}:{code:"operation-ambiguous",opIndex:S,entity:y.entity,handle:y.operation,matches:R.matches});break}if(y.kind==="operation.update"){const N=No(y.patch,O_);if(N.length){c.push({code:"operation-patch-unknown-key",opIndex:S,entity:y.entity,handle:y.operation,keys:N});break}s.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId,patch:y.patch})}else s.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:R.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=y.kind==="attribute.reorder",R=At(e,y.entity);if(!R.ok){c.push($t(R.reason,S,y.entity,R.matches,b));break}const N=x?y.order:y.operations;if(N.length===0){c.push({code:"reorder-empty",opIndex:S,entity:y.entity});break}const I=[],C=new Set;let U=!1;for(const H of N){if(!x&&ts(H)){c.push({code:"handle-by-unsupported",opIndex:S,entity:y.entity,handle:H,target:"operation"}),U=!0;continue}const G=x?sm(R.value,H):dm(R.value,H);if(!G.ok){c.push(G.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:S,entity:y.entity,handle:H}:{code:"reorder-handle-ambiguous",opIndex:S,entity:y.entity,handle:H,matches:G.matches}),U=!0;continue}if(C.has(G.value.modelId)){c.push({code:"reorder-handle-duplicate",opIndex:S,entity:y.entity,handle:H}),U=!0;continue}C.add(G.value.modelId),I.push(G.value)}if(U)break;const P=[...x?R.value.attributes:R.value.operations??[]].sort((H,G)=>H.order-G.order).filter(H=>!C.has(H.modelId)),F=[...I,...P];if(F.forEach((H,G)=>{H.order!==G&&s.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:H.modelId,patch:{order:G}}:{kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:H.modelId,patch:{order:G}})}),x)for(const H of Zu(e,R.value.modelId,F.map(G=>G.modelId)))s.push({kind:"attribute.update",casUnit:"logical",containerRef:H.entityId,entityRef:H.entityId,attributeRef:H.attributeId,patch:{dbAttrs:H.dbAttrs}});break}case"group.add":{{const C=xn(y.spec,M_);if(C.length){c.push({code:"group-spec-unknown-key",opIndex:S,keys:C});break}}const x=[];let R=!1;for(const C of y.spec.members){const U=At(e,C);if(!U.ok){c.push($t(U.reason,S,C,U.matches,b)),R=!0;continue}x.push(U.value.modelId)}if(R)break;const N=a(),I={modelId:N,excludeDDLGeneration:y.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...y.spec.name?{name:y.spec.name}:{},...y.spec.packageName?{packageName:y.spec.packageName}:{},...y.spec.description?{description:y.spec.description}:{}};s.push({kind:"group.add",casUnit:"logical",groupRef:N,value:I});break}case"group.update":{const x=Ql(e,y.group);if(!x.ok){c.push(es(x,S,y.group));break}const R=No(y.patch,w_);if(R.length){c.push({code:"group-patch-unknown-key",opIndex:S,handle:y.group,keys:R});break}s.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:y.patch});break}case"group.remove":{const x=Ql(e,y.group);if(!x.ok){c.push(es(x,S,y.group));break}s.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=Ql(e,y.group);if(!x.ok){c.push(es(x,S,y.group));break}const R=At(e,y.entity);if(!R.ok){c.push($t(R.reason,S,y.entity,R.matches,b));break}const N=x.value.memberEntityRefs.includes(R.value.modelId);if(y.kind==="group.addMember"?N:!N)break;if(y.kind==="group.removeMember"){if(k.has(E(x.value.modelId,R.value.modelId)))break;k.add(E(x.value.modelId,R.value.modelId))}s.push({kind:y.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:R.value.modelId});break}}}),c.length||K_(s,e,f,p,h,_,g,a,u),c.length||U_(s,e,h,f),c.length||H_(s,e,h,_,f,a),c.length?{ok:!1,errors:c}:{ok:!0,ops:s}}function $t(e,n,o,i,a){return e==="shape"?{code:"handle-shape-invalid",opIndex:n,where:"entity",expected:"{ref, by?}",got:is(o)}: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}}const Ya=e=>!!e&&typeof e=="object"&&typeof e.ref=="string",q_=e=>!!e&&typeof e=="object"&&Ya(e.from)&&Ya(e.to),is=e=>e===void 0?"undefined":e===null?"null":typeof e!="object"?typeof e:`{${Object.keys(e).join(",")}}`;function W_(e,n,o){const i=e,a=[];for(const l of["attribute","index","operation","group"])l in i&&a.push([l,i[l],Ya(i[l])]);(e.kind==="association.update"||e.kind==="association.remove"||e.kind==="associationEnd.update")&&a.push(["association",i.association,q_(i.association)]);let r=!0;for(const[l,s,c]of a)c||(r=!1,o.push({code:"handle-shape-invalid",opIndex:n,where:l,expected:l==="association"?"{from:{ref}, to:{ref}}":"{ref, by?}",got:is(s)}));return r}function Nm(e,n,o,i,a){const r=At(e,n.from),l=At(e,n.to);if(r.ok||i.push($t(r.reason,o,n.from,r.matches,a)),l.ok||i.push($t(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=lm(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 wm={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},J_={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},X_={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},tn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Z_={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","SERIALIZED_TYPE"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},classLogicalName:{...tn,description:"**클래스** 논리명(다국어). 테이블이 없는 자리(직렬화 타입 SERIALIZED_TYPE)의 논리명이 여기 산다 — 그 타입은 table 자체를 갖지 않아 table.logicalName 을 줄 데가 없다. ⚠️테이블이 있는 엔티티는 table.logicalName 이 이기므로 그쪽을 쓴다."},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"}},serialization:{$ref:"#/$defs/serialization"}},required:["name"],additionalProperties:!1},Q_={type:"object",description:"직렬화 타입의 컨테이너(SERIALIZED_TYPE 전용). 미지정 = 컬렉션이 아닌 단일 값(한 컬럼에 구조 하나). 신규 엔티티는 entity.add 에 함께 줘야 한다 — 같은 배치의 entity.update 는 갓 만든 엔티티에 닿지 못한다.",properties:{collectionType:{type:"string",enum:["LIST","SET","MAP"],description:"컨테이너 종류. 코퍼스 실재가 java.util 3종뿐이라 그만 표현한다(미지 컨테이너는 발명하지 않는다)."},mapKeyType:{type:"string",description:"collectionType='MAP' 일 때의 키 타입(단순명 또는 FQN). 그 외엔 무의미."}},additionalProperties:!1},ek={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:{...tn,description:"속성 설명(다국어)."},columnLogicalName:{...tn,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},fieldLogicalName:{...tn,description:"**필드** 논리명(다국어). 평탄 `logicalName`(컬럼 논리명)과 **다른 축**이다 — 컬럼이 없는 자리(직렬화 타입 SERIALIZED_TYPE 의 자기 필드)는 dbAttrs 가 0이라 컬럼 논리명을 줄 데가 없고, 그 자리의 논리명이 여기 산다(캔버스 논리 뷰·탐색기 검색·코드젠 javadoc 이 읽는다). 컬럼이 있는 자리에서는 컬럼 논리명이 이긴다."},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"},collectionType:{type:"string",enum:["LIST","SET"],description:"이 «필드»가 컬렉션인가 — **직렬화 타입(SERIALIZED_TYPE)의 자기 필드 전용**(예: Set<String>·List<StoredFile>). 컬럼 있는 자리는 읽지 않는다 — 그쪽 컨테이너는 요소 타입이 소유한다(entity 의 serialization.collectionType). 요소가 문서 안 직렬화 타입이면 그 타입이 이미 감싸므로 지정하지 않는다. 미지정 = 컬렉션 아님."}},required:["name","type"],additionalProperties:!1},tk={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF. ⚠️바인딩 축만 덮는다 — 서브컬럼 **논리명**은 여기 없고 patch의 dotted `dbAttrs.<i>.logicalName`이 받는다.",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 컬럼에만 저장."},notNull:{type:"boolean",description:"JPA @Column(nullable=false) — **이 서브컬럼 하나의** NOT NULL. 미설정이면 속성 축(notNull)을 따른다. ★임베더블은 컬럼마다 제약이 갈릴 수 있어(실측: ChangedBy 는 type 컬럼만 NOT NULL) 속성 축 하나로는 담기지 않는다. OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},Im={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},nk={type:"object",description:'일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)·직렬화 타입을 end 로 주면 거부된다. 직렬화 타입은 관계가 아니라 소비 속성의 type 으로 지목한다(attribute.update {type: "<타입명>"}). (임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).',properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Im,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Im,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},ok={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...wm,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},ik={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...tn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},ak={type:"object",properties:{name:{...tn,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},rk={type:"object",description:'기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 «바인딩» 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부). ★다중 컬럼 속성의 **개별 컬럼 필드**는 dotted 키로 지목한다 — `{"dbAttrs.<i>.logicalName":{ko:"…"}}` 처럼. dotted 허용 접두는 `dbAttrs.` 하나뿐이고, 같은 op에서 평탄 키와 섞으면 $set 충돌로 거부된다.',properties:{name:{type:"string"},type:{type:"string",description:"자바 타입. **컬럼 개수가 바뀌는 전환은 거부된다** — 임베더블 타입(Money 등)으로 바꾸거나 임베더블 속성을 다른 타입으로 바꾸는 것은 컬럼 구조가 함께 가야 성립한다. 그 전환은 attribute.remove + attribute.add 로 내고(자리를 지키려면 같은 배치에 attribute.reorder), 임베드 서브컬럼 «바인딩» 조정만 embeddableOverrides 소관이다."},customType:{type:"string"},attrType:{type:"string",enum:[...Wu],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},derivedIdFieldName:{type:"string",description:"파생 식별(@MapsId) FK가 매핑되는 **스칼라 @Id 필드명**. 이 속성의 name은 연관 필드명(@MapsId @OneToOne 필드)이고 같은 관계가 두 Java 필드를 만든다. 단일 컬럼 @OneToOne 식별 FK에만 의미가 있고, 미설정 시 부모 PK 물리명의 camelCase로 파생된다(실물 관행). 컬럼은 공유하므로 속성은 하나이며 물리명은 지정하지 않는다."},description:{...tn,description:"속성 설명(다국어)."},fieldLogicalName:{...tn,description:"**필드** 논리명(다국어). 평탄 `logicalName`(컬럼 논리명)과 **다른 축**이다 — 컬럼이 없는 자리(직렬화 타입 SERIALIZED_TYPE 의 자기 필드)는 dbAttrs 가 0이라 컬럼 논리명을 줄 데가 없고, 그 자리의 논리명이 여기 산다(캔버스 논리 뷰·탐색기 검색·코드젠 javadoc 이 읽는다). 컬럼이 있는 자리에서는 컬럼 논리명이 이긴다."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...tn,description:"**컬럼** 논리명(다국어). 대상이 스칼라 단일 컬럼일 때 dbAttrs[0]에 매핑된다. ★대상이 **다중 컬럼**(EMBED_PREDEF·Money 등)이면 이 평탄 키는 «어느 컬럼인지 모호» 로 거부되고, dotted `dbAttrs.<i>.logicalName` 이 그 값을 받는다(embeddableOverrides 에는 논리명 축이 없다). dbAttrs 가 0인 속성(직렬화 타입 필드·transient)에 주면 거부되고, 그 자리는 `fieldLogicalName` 이 받는다."}},additionalProperties:!1},lk={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},sk={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},ck={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...tn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},dk={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table·serialization·classLogicalName. classLogicalName = **클래스** 논리명(테이블 없는 직렬화 타입의 논리명이 사는 곳 — 그 타입은 table 을 갖지 않는다). 테이블이 있는 엔티티는 table.logicalName(dotted-key)이 이긴다. serialization(직렬화 타입 컨테이너)은 통째로 주거나(예: {"serialization":{"collectionType":"LIST"}}) dotted-key로 준다({"serialization.collectionType":"LIST"}). 컬렉션 아님으로 되돌릴 땐 null 로 비운다(wire clear 규약). jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경. stereotype 은 값 타입(JPA_EMBEDDABLE·SERIALIZED_TYPE) 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},uk={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function pt(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const mk={"entity.add":pt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":pt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":pt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":pt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":pt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":pt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":pt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":pt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":pt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":pt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":pt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":pt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":pt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":pt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":pt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":pt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":pt("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"}}},required:["entity","order"]}),"operation.reorder":pt("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"}}},required:["entity","operations"]}),"group.add":pt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":pt("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":pt("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":pt("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":pt("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},fk={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},pk={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...tn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},vm={anyOf:qu.map(e=>mk[e])},hk={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:wm,nameHandle:J_,groupHandle:fk,assocHandle:X_,entitySpec:Z_,serialization:Q_,attrSpec:ek,embeddableOverrides:tk,assocSpec:nk,indexSpec:ok,operationSpec:ik,groupSpec:ak,entityUpdatePatch:dk,attrUpdatePatch:rk,assocUpdatePatch:lk,assocEndUpdatePatch:uk,indexUpdatePatch:sk,operationUpdatePatch:ck,groupUpdatePatch:pk,symbolicOp:vm}};function yk(e,n,o,i={}){const a=i.mkClientOpId??Le,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 Cm={location:{x:0,y:0},size:{width:220,height:140}};function Sm(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,notNull:e.notNull,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const gk=/^[-=_*~\s]{3,}$/;function bk(e){return e.attrType&&e.attrType!=="NORMAL"||!gk.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function _k(e){return e.type===dn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function kk(e,n){if(e.attrType==="DIVIDER"||bk(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=_k(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(Sm)}}function Ek(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Nk(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 wk(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(kk),operations:(n=e.operations)==null?void 0:n.map(Ek),indexes:(o=e.indexes)==null?void 0:o.map(Nk),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Ik(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??{...Cm},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 xm(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 as(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:xm(e)}}function vk(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>rs(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Ck(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:vk(e),end1:as(e.end1),end2:as(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 rs(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Rm(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Am(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 $m(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(Sm)}}function Sk(e,n,o){var v,y;const i=rs(e.end1.attribute),a=rs(e.end2.attribute);if(i===a)return Ck(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(y=(v=s.dbAttrs)==null?void 0:v[0])==null?void 0:y.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((S,$)=>Math.max(S,$.order),-1)+1:s.order??0,p={...$m(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const f=n.get(r.endModel.refId),h=l.attribute;let _;if(h&&f&&r.navigable){const S=ka(l.multiplicity);_={modelId:h.modelId??crypto.randomUUID(),name:uo(h.name??Na((u==null?void 0:u.name)??l.endModel.refId,S),new Set(f.attributes.map($=>$.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce(($,O)=>Math.max($,O.order),-1)+1,dbAttrs:[]},f.attributes.push(_)}const g=(S,$)=>({entityRef:S.endModel.refId,multiplicity:S.multiplicity,navigable:S.navigable,composition:S.composition,attributeRef:$?_==null?void 0:_.modelId:p.modelId,jpa:xm(S)}),k=r.endModel.refId===l.endModel.refId,E={modelId:e.modelId,description:e.description,identifying:!k&&p.identifier===!0?!0:void 0,end1:g(e.end1,i),end2:g(e.end2,a)},b={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:E,layout:b}}function xk(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),notNull:e.notNull??(o==null?void 0:o.notNull)}}function Rk(e,n,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((_,g)=>Math.max(_,g.order),-1)+1:l.order??0,d={...$m(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(_=>xk(_,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=_=>({...as(_),legacyEmbedRaw:_.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function Ak(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 Tm(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=Ak(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 Mm(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 Vm(e,n){const o=(i,a)=>{if(i==null)return;const r=i[a];if(r==null)return;const l=Bc(r);l!==r&&(l===void 0?delete i[a]:i[a]=l)};for(const i of n)o(i,"name");for(const i of e){o(i,"classLogicalName"),o(i,"description"),o(i.table,"logicalName");for(const a of i.operations??[])o(a,"description");for(const a of i.attributes){o(a,"fieldLogicalName"),o(a,"description");for(const r of a.dbAttrs??[])o(r,"logicalName")}}}function $k(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||at(a.stereotype)||at(r.stereotype))continue;const l=i.end1.attributeRef?a.attributes.find(p=>p.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(p=>p.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=ka(i.end2.multiplicity),u=Na(r.name,d),m=uo(u,new Set(a.attributes.map(p=>p.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((p,f)=>Math.max(p,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function Tk(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||at(a.stereotype)||at(r.stereotype))continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function Lm(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if(l&&at(l.stereotype))continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!ad(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function Bm(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?Mk(n):Vk(n)}function Mk(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:p,...f}=m;return p!=null&&(o[m.modelId]=p),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);$k(a,r),Tk(a,r),Lm(a,r),Vm(a,l);const{version:s,...c}=e.layout;Mm(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Vk(e){var k,E;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(b,v)=>{o.push(wk(b));const y=Ik(b);y.geo={location:{x:y.geo.location.x+v.x,y:y.geo.location.y+v.y},size:y.geo.size},i.push(y);for(const S of b.ownedAssociations??[])c.push(S)},u={x:0,y:0};for(const b of e.entities??[])d(b,u);const m=[];for(const b of e.groups??[]){const v=b.entities??[];l.push({modelId:b.modelId,name:b.name,description:b.description,packageName:b.packageName,excludeDDLGeneration:b.excludeDDLGeneration??!1,memberEntityRefs:v.map(S=>S.modelId)});const y=((k=b.geo)==null?void 0:k.location)??u;if(b.geo){const S=(b.notes??[]).map($=>$.modelId);s.push({groupRef:b.modelId,geo:b.geo,style:b.style,locked:b.locked,memberNoteRefs:S.length?S:void 0})}for(const S of v)d(S,y);for(const S of b.notes??[])m.push(Tm(S,y))}const p=new Map(o.map(b=>[b.modelId,b])),f=new Map,h=new Map;for(const b of o)for(const v of b.attributes)for(const y of v.dbAttrs)f.set(y.modelId,v.modelId),h.set(y.modelId,y);for(const b of c)for(const v of[b.end1,b.end2]){const y=v.attribute;if(y&&(((E=y.dbAttrs)==null?void 0:E.length)??0)>0)for(const S of y.dbAttrs)S.modelId&&f.set(S.modelId,y.modelId)}for(const b of c){const v=Rm(b.end1.attribute),y=Rm(b.end2.attribute),S=Am(b.end1)||Am(b.end2),{assoc:$,layout:O}=v!==y||S?Rk(b,p,h):Sk(b,p,f);a.push($),r.push(O)}Mm(o,a,r),Wd(o),Lm(o,a),Vm(o,l);const _={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(b=>Tm(b)),...m]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:_,meta:g}}function Dm(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,notNull:e.notNull,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function Lk(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(Dm),style:n}}function Bk(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 Dk(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 qn(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 Ok(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{...Dm(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function Pk(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function Om(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 zk(e){const n=new Set;for(const o of e.logical.associations){const i=Om(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function Fk(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 Uk(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function Hk(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:Uk(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),notNull:o(e.notNull,n==null?void 0:n.notNull)}}function jk(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var h;return((h=f.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,p)=>Hk(m,l[p]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:qn(e.end1,c?s:u),end2:qn(e.end2,c?u:s)}}function Kk(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:qn(e.end1,e.end1.legacyEmbedRaw),end2:qn(e.end2,e.end2.legacyEmbedRaw)};const a=jk(e,n,i);if(a)return a;const r=Om(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?Ok(r.fk,l):void 0,c=Pk(r.navAttr);return{...i,end1:qn(e.end1,r.navEnd===e.end1?s:c),end2:qn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:qn(e.end1),end2:qn(e.end2)}}function Pm(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(p=>p.entityRef===e.modelId),l=n.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>n.layout.associationLayouts.find(f=>f.associationRef===p),c=(r==null?void 0:r.geo)??{...Cm},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(p=>!o.has(p.modelId)&&!i.has(p.modelId)).map(p=>{var f;return Lk(p,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var f;return Bk(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>Kk(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(Dk),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 Gk(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=>zm(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Pm(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 zm(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 Yk(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=zk(e),r=Fk(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=>Pm(s,e,a,r)),groups:e.logical.groups.map(s=>Gk(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>zm(s))}}function qk(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,referenceOnly:n.referenceOnly,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const Wk=["notNull"];function Jk(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=Bm(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(p=>[p.modelId,p]))]));for(const m of i.logical.entities){const p=c.get(m.modelId);if(p)for(const f of m.attributes){const h=p.get(f.modelId);if(!h){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const _={};for(const g of Wk)f[g]===!0!=(h[g]===!0)&&(_[g]=f[g],s.attributeFieldsByName[g]=(s.attributeFieldsByName[g]??0)+1);Object.keys(_).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:_}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const p=d.get(m.modelId);p&&(m.end1.attributeRef&&m.end1.attributeRef!==p.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&p.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function Ti(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function Rn(e){return typeof e=="function"?e():t.unref(e)}const Xk=typeof window<"u"&&typeof document<"u",Zk=e=>typeof e<"u",Qk=Object.prototype.toString,eE=e=>Qk.call(e)==="[object Object]",tE=()=>{};function nE(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 Fm=e=>e();function oE(e=Fm){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 Um(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function iE(e,n,o={}){const{eventFilter:i=Fm,...a}=o;return t.watch(e,nE(i,n),a)}function ei(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=oE(i);return{stop:iE(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function aE(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=Rn(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 ls(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:h,throwOnTimeout:_}={}){let g=null;const E=[new Promise(b=>{g=t.watch(e,v=>{m(v)!==n&&(g==null||g(),b(v))},{flush:p,deep:f,immediate:!0})})];return h!=null&&E.push(Um(h,_).then(()=>Rn(e)).finally(()=>g==null?void 0:g())),Promise.race(E)}function i(m,p){if(!t.isRef(m))return o(v=>v===m,p);const{flush:f="sync",deep:h=!1,timeout:_,throwOnTimeout:g}=p??{};let k=null;const b=[new Promise(v=>{k=t.watch([e,m],([y,S])=>{n!==(y===S)&&(k==null||k(),v(y))},{flush:f,deep:h,immediate:!0})})];return _!=null&&b.push(Um(_,g).then(()=>Rn(e)).finally(()=>(k==null||k(),Rn(e)))),Promise.race(b)}function a(m){return o(p=>!!p,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,p){return o(f=>{const h=Array.from(f);return h.includes(m)||h.includes(Rn(m))},p)}function d(m){return u(1,m)}function u(m=1,p){let f=-1;return o(()=>(f+=1,f>=m),p)}return Array.isArray(Rn(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return ls(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return ls(e,!n)}}}function ss(e){return ls(e)}function rE(e){var n;const o=Rn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Hm=Xk?window:void 0;function jm(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Hm):[n,o,i,a]=e,!n)return tE;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,p,f)=>(u.addEventListener(m,p,f),()=>u.removeEventListener(m,p,f)),c=t.watch(()=>[rE(n),Rn(a)],([u,m])=>{if(l(),!u)return;const p=eE(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(h=>s(u,f,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return Ti(d),d}function lE(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Km(...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=Hm,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=lE(n);return jm(a,r,u=>{u.repeat&&Rn(s)||c(u)&&o(u)},l)}function sE(e){return JSON.parse(JSON.stringify(e))}function cs(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:p}=i,f=t.getCurrentInstance(),h=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let _=d;n||(n="modelValue"),_=_||`update:${n.toString()}`;const g=b=>s?typeof s=="function"?s(b):sE(b):b,k=()=>Zk(e[n])?g(e[n]):m,E=b=>{p?p(b)&&h(_,b):h(_,b)};if(c){const b=k(),v=t.ref(b);let y=!1;return t.watch(()=>e[n],S=>{y||(y=!0,v.value=g(S),t.nextTick(()=>y=!1))}),t.watch(v,S=>{!y&&(S!==e[n]||u)&&E(S)},{deep:u}),v}else return t.computed({get(){return k()},set(b){E(b)}})}var cE={value:()=>{}};function qa(){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 Wa(o)}function Wa(e){this._=e}function dE(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}})}Wa.prototype=qa.prototype={constructor:Wa,on:function(e,n){var o=this._,i=dE(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=uE(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 Wa(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 uE(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]=cE,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ds="http://www.w3.org/1999/xhtml";const Ym={svg:"http://www.w3.org/2000/svg",xhtml:ds,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ja(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ym.hasOwnProperty(n)?{space:Ym[n],local:e}:e}function mE(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ds&&n.documentElement.namespaceURI===ds?n.createElement(e):n.createElementNS(o,e)}}function fE(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qm(e){var n=Ja(e);return(n.local?fE:mE)(n)}function pE(){}function us(e){return e==null?pE:function(){return this.querySelector(e)}}function hE(e){typeof e!="function"&&(e=us(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new jt(i,this._parents)}function yE(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function gE(){return[]}function Wm(e){return e==null?gE:function(){return this.querySelectorAll(e)}}function bE(e){return function(){return yE(e.apply(this,arguments))}}function _E(e){typeof e=="function"?e=bE(e):e=Wm(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 jt(i,a)}function Jm(e){return function(){return this.matches(e)}}function Xm(e){return function(n){return n.matches(e)}}var kE=Array.prototype.find;function EE(e){return function(){return kE.call(this.children,e)}}function NE(){return this.firstElementChild}function wE(e){return this.select(e==null?NE:EE(typeof e=="function"?e:Xm(e)))}var IE=Array.prototype.filter;function vE(){return Array.from(this.children)}function CE(e){return function(){return IE.call(this.children,e)}}function SE(e){return this.selectAll(e==null?vE:CE(typeof e=="function"?e:Xm(e)))}function xE(e){typeof e!="function"&&(e=Jm(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 jt(i,this._parents)}function Zm(e){return new Array(e.length)}function RE(){return new jt(this._enter||this._groups.map(Zm),this._parents)}function Xa(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Xa.prototype={constructor:Xa,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function AE(e){return function(){return e}}function $E(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new Xa(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function TE(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new Xa(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function ME(e){return e.__data__}function VE(e,n){if(!arguments.length)return Array.from(this,ME);var o=n?TE:$E,i=this._parents,a=this._groups;typeof e!="function"&&(e=AE(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=LE(e.call(u,u&&u.__data__,d,i)),h=f.length,_=s[d]=new Array(h),g=l[d]=new Array(h),k=c[d]=new Array(p);o(u,m,_,g,k,f,n);for(var E=0,b=0,v,y;E<h;++E)if(v=_[E]){for(E>=b&&(b=E+1);!(y=g[b])&&++b<h;);v._next=y||null}}return l=new jt(l,i),l._enter=s,l._exit=c,l}function LE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function BE(){return new jt(this._exit||this._groups.map(Zm),this._parents)}function DE(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 OE(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new jt(s,this._parents)}function PE(){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 zE(e){e||(e=FE);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new jt(a,this._parents).order()}function FE(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function UE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function HE(){return Array.from(this)}function jE(){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 KE(){let e=0;for(const n of this)++e;return e}function GE(){return!this.node()}function YE(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 qE(e){return function(){this.removeAttribute(e)}}function WE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function JE(e,n){return function(){this.setAttribute(e,n)}}function XE(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function ZE(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function QE(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 e1(e,n){var o=Ja(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?WE:qE:typeof n=="function"?o.local?QE:ZE:o.local?XE:JE)(o,n))}function Qm(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function t1(e){return function(){this.style.removeProperty(e)}}function n1(e,n,o){return function(){this.style.setProperty(e,n,o)}}function o1(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function i1(e,n,o){return arguments.length>1?this.each((n==null?t1:typeof n=="function"?o1:n1)(e,n,o??"")):ti(this.node(),e)}function ti(e,n){return e.style.getPropertyValue(n)||Qm(e).getComputedStyle(e,null).getPropertyValue(n)}function a1(e){return function(){delete this[e]}}function r1(e,n){return function(){this[e]=n}}function l1(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function s1(e,n){return arguments.length>1?this.each((n==null?a1:typeof n=="function"?l1:r1)(e,n)):this.node()[e]}function ef(e){return e.trim().split(/^|\s+/)}function ms(e){return e.classList||new tf(e)}function tf(e){this._node=e,this._names=ef(e.getAttribute("class")||"")}tf.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 nf(e,n){for(var o=ms(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function of(e,n){for(var o=ms(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function c1(e){return function(){nf(this,e)}}function d1(e){return function(){of(this,e)}}function u1(e,n){return function(){(n.apply(this,arguments)?nf:of)(this,e)}}function m1(e,n){var o=ef(e+"");if(arguments.length<2){for(var i=ms(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?u1:n?c1:d1)(o,n))}function f1(){this.textContent=""}function p1(e){return function(){this.textContent=e}}function h1(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function y1(e){return arguments.length?this.each(e==null?f1:(typeof e=="function"?h1:p1)(e)):this.node().textContent}function g1(){this.innerHTML=""}function b1(e){return function(){this.innerHTML=e}}function _1(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function k1(e){return arguments.length?this.each(e==null?g1:(typeof e=="function"?_1:b1)(e)):this.node().innerHTML}function E1(){this.nextSibling&&this.parentNode.appendChild(this)}function N1(){return this.each(E1)}function w1(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function I1(){return this.each(w1)}function v1(e){var n=typeof e=="function"?e:qm(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function C1(){return null}function S1(e,n){var o=typeof e=="function"?e:qm(e),i=n==null?C1:typeof n=="function"?n:us(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function x1(){var e=this.parentNode;e&&e.removeChild(this)}function R1(){return this.each(x1)}function A1(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function $1(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function T1(e){return this.select(e?$1:A1)}function M1(e){return arguments.length?this.property("__data__",e):this.node().__data__}function V1(e){return function(n){e.call(this,n,this.__data__)}}function L1(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 B1(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 D1(e,n,o){return function(){var i=this.__on,a,r=V1(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 O1(e,n,o){var i=L1(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?D1:B1,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function af(e,n,o){var i=Qm(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 P1(e,n){return function(){return af(this,e,n)}}function z1(e,n){return function(){return af(this,e,n.apply(this,arguments))}}function F1(e,n){return this.each((typeof n=="function"?z1:P1)(e,n))}function*U1(){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 rf=[null];function jt(e,n){this._groups=e,this._parents=n}function Mi(){return new jt([[document.documentElement]],rf)}function H1(){return this}jt.prototype=Mi.prototype={constructor:jt,select:hE,selectAll:_E,selectChild:wE,selectChildren:SE,filter:xE,data:VE,enter:RE,exit:BE,join:DE,merge:OE,selection:H1,order:PE,sort:zE,call:UE,nodes:HE,node:jE,size:KE,empty:GE,each:YE,attr:e1,style:i1,property:s1,classed:m1,text:y1,html:k1,raise:N1,lower:I1,append:v1,insert:S1,remove:R1,clone:T1,datum:M1,on:O1,dispatch:F1,[Symbol.iterator]:U1};function nn(e){return typeof e=="string"?new jt([[document.querySelector(e)]],[document.documentElement]):new jt([[e]],rf)}function j1(e){let n;for(;n=e.sourceEvent;)e=n;return e}function pn(e,n){if(e=j1(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 K1={passive:!1},Vi={capture:!0,passive:!1};function fs(e){e.stopImmediatePropagation()}function ni(e){e.preventDefault(),e.stopImmediatePropagation()}function lf(e){var n=e.document.documentElement,o=nn(e).on("dragstart.drag",ni,Vi);"onselectstart"in n?o.on("selectstart.drag",ni,Vi):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function sf(e,n){var o=e.document.documentElement,i=nn(e).on("dragstart.drag",null);n&&(i.on("click.drag",ni,Vi),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 Za=e=>()=>e;function ps(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}})}ps.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function G1(e){return!e.ctrlKey&&!e.button}function Y1(){return this.parentNode}function q1(e,n){return n??{x:e.x,y:e.y}}function W1(){return navigator.maxTouchPoints||"ontouchstart"in this}function J1(){var e=G1,n=Y1,o=q1,i=W1,a={},r=qa("start","drag","end"),l=0,s,c,d,u,m=0;function p(v){v.on("mousedown.drag",f).filter(i).on("touchstart.drag",g).on("touchmove.drag",k,K1).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(v,y){if(!(u||!e.call(this,v,y))){var S=b(this,n.call(this,v,y),v,y,"mouse");S&&(nn(v.view).on("mousemove.drag",h,Vi).on("mouseup.drag",_,Vi),lf(v.view),fs(v),d=!1,s=v.clientX,c=v.clientY,S("start",v))}}function h(v){if(ni(v),!d){var y=v.clientX-s,S=v.clientY-c;d=y*y+S*S>m}a.mouse("drag",v)}function _(v){nn(v.view).on("mousemove.drag mouseup.drag",null),sf(v.view,d),ni(v),a.mouse("end",v)}function g(v,y){if(e.call(this,v,y)){var S=v.changedTouches,$=n.call(this,v,y),O=S.length,B,z;for(B=0;B<O;++B)(z=b(this,$,v,y,S[B].identifier,S[B]))&&(fs(v),z("start",v,S[B]))}}function k(v){var y=v.changedTouches,S=y.length,$,O;for($=0;$<S;++$)(O=a[y[$].identifier])&&(ni(v),O("drag",v,y[$]))}function E(v){var y=v.changedTouches,S=y.length,$,O;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),$=0;$<S;++$)(O=a[y[$].identifier])&&(fs(v),O("end",v,y[$]))}function b(v,y,S,$,O,B){var z=r.copy(),T=pn(B||S,y),x,R,N;if((N=o.call(v,new ps("beforestart",{sourceEvent:S,target:p,identifier:O,active:l,x:T[0],y:T[1],dx:0,dy:0,dispatch:z}),$))!=null)return x=N.x-T[0]||0,R=N.y-T[1]||0,function I(C,U,A){var P=T,F;switch(C){case"start":a[O]=I,F=l++;break;case"end":delete a[O],--l;case"drag":T=pn(A||U,y),F=l;break}z.call(C,v,new ps(C,{sourceEvent:U,subject:N,target:p,identifier:O,active:F,x:T[0]+x,y:T[1]+R,dx:T[0]-P[0],dy:T[1]-P[1],dispatch:z}),$)}}return p.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Za(!!v),p):e},p.container=function(v){return arguments.length?(n=typeof v=="function"?v:Za(v),p):n},p.subject=function(v){return arguments.length?(o=typeof v=="function"?v:Za(v),p):o},p.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:Za(!!v),p):i},p.on=function(){var v=r.on.apply(r,arguments);return v===r?p:v},p.clickDistance=function(v){return arguments.length?(m=(v=+v)*v,p):Math.sqrt(m)},p}function hs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function cf(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Li(){}var Bi=.7,Qa=1/Bi,oi="\\s*([+-]?\\d+)\\s*",Di="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",hn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",X1=/^#([0-9a-f]{3,8})$/,Z1=new RegExp(`^rgb\\(${oi},${oi},${oi}\\)$`),Q1=new RegExp(`^rgb\\(${hn},${hn},${hn}\\)$`),eN=new RegExp(`^rgba\\(${oi},${oi},${oi},${Di}\\)$`),tN=new RegExp(`^rgba\\(${hn},${hn},${hn},${Di}\\)$`),nN=new RegExp(`^hsl\\(${Di},${hn},${hn}\\)$`),oN=new RegExp(`^hsla\\(${Di},${hn},${hn},${Di}\\)$`),df={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};hs(Li,wo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:uf,formatHex:uf,formatHex8:iN,formatHsl:aN,formatRgb:mf,toString:mf});function uf(){return this.rgb().formatHex()}function iN(){return this.rgb().formatHex8()}function aN(){return gf(this).formatHsl()}function mf(){return this.rgb().formatRgb()}function wo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=X1.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?ff(n):o===3?new Pt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?er(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?er(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=Z1.exec(e))?new Pt(n[1],n[2],n[3],1):(n=Q1.exec(e))?new Pt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=eN.exec(e))?er(n[1],n[2],n[3],n[4]):(n=tN.exec(e))?er(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=nN.exec(e))?yf(n[1],n[2]/100,n[3]/100,1):(n=oN.exec(e))?yf(n[1],n[2]/100,n[3]/100,n[4]):df.hasOwnProperty(e)?ff(df[e]):e==="transparent"?new Pt(NaN,NaN,NaN,0):null}function ff(e){return new Pt(e>>16&255,e>>8&255,e&255,1)}function er(e,n,o,i){return i<=0&&(e=n=o=NaN),new Pt(e,n,o,i)}function rN(e){return e instanceof Li||(e=wo(e)),e?(e=e.rgb(),new Pt(e.r,e.g,e.b,e.opacity)):new Pt}function ys(e,n,o,i){return arguments.length===1?rN(e):new Pt(e,n,o,i??1)}function Pt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}hs(Pt,ys,cf(Li,{brighter(e){return e=e==null?Qa:Math.pow(Qa,e),new Pt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Bi:Math.pow(Bi,e),new Pt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Pt(Io(this.r),Io(this.g),Io(this.b),tr(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:pf,formatHex:pf,formatHex8:lN,formatRgb:hf,toString:hf}));function pf(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}`}function lN(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}${vo((isNaN(this.opacity)?1:this.opacity)*255)}`}function hf(){const e=tr(this.opacity);return`${e===1?"rgb(":"rgba("}${Io(this.r)}, ${Io(this.g)}, ${Io(this.b)}${e===1?")":`, ${e})`}`}function tr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Io(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vo(e){return e=Io(e),(e<16?"0":"")+e.toString(16)}function yf(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new on(e,n,o,i)}function gf(e){if(e instanceof on)return new on(e.h,e.s,e.l,e.opacity);if(e instanceof Li||(e=wo(e)),!e)return new on;if(e instanceof on)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 on(l,s,c,e.opacity)}function sN(e,n,o,i){return arguments.length===1?gf(e):new on(e,n,o,i??1)}function on(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}hs(on,sN,cf(Li,{brighter(e){return e=e==null?Qa:Math.pow(Qa,e),new on(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Bi:Math.pow(Bi,e),new on(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 Pt(gs(e>=240?e-240:e+120,a,i),gs(e,a,i),gs(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new on(bf(this.h),nr(this.s),nr(this.l),tr(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=tr(this.opacity);return`${e===1?"hsl(":"hsla("}${bf(this.h)}, ${nr(this.s)*100}%, ${nr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function bf(e){return e=(e||0)%360,e<0?e+360:e}function nr(e){return Math.max(0,Math.min(1,e||0))}function gs(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const bs=e=>()=>e;function cN(e,n){return function(o){return e+o*n}}function dN(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 uN(e){return(e=+e)==1?_f:function(n,o){return o-n?dN(n,o,e):bs(isNaN(n)?o:n)}}function _f(e,n){var o=n-e;return o?cN(e,o):bs(isNaN(e)?n:e)}const or=(function e(n){var o=uN(n);function i(a,r){var l=o((a=ys(a)).r,(r=ys(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=_f(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function mN(e,n){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 fN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function pN(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]=Oi(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 hN(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function yn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function yN(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]=Oi(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var _s=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ks=new RegExp(_s.source,"g");function gN(e){return function(){return e}}function bN(e){return function(n){return e(n)+""}}function kf(e,n){var o=_s.lastIndex=ks.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=_s.exec(e))&&(a=ks.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:yn(i,a)})),o=ks.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?bN(c[0].x):gN(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 Oi(e,n){var o=typeof n,i;return n==null||o==="boolean"?bs(n):(o==="number"?yn:o==="string"?(i=wo(n))?(n=i,or):kf:n instanceof wo?or:n instanceof Date?hN:fN(n)?mN:Array.isArray(n)?pN:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?yN:yn)(e,n)}var Ef=180/Math.PI,Es={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Nf(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)*Ef,skewX:Math.atan(c)*Ef,scaleX:l,scaleY:s}}var ir;function _N(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Es:Nf(n.a,n.b,n.c,n.d,n.e,n.f)}function kN(e){return e==null||(ir||(ir=document.createElementNS("http://www.w3.org/2000/svg","g")),ir.setAttribute("transform",e),!(e=ir.transform.baseVal.consolidate()))?Es:(e=e.matrix,Nf(e.a,e.b,e.c,e.d,e.e,e.f))}function wf(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var _=f.push("translate(",null,n,null,o);h.push({i:_-4,x:yn(d,m)},{i:_-2,x:yn(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:yn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:yn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var _=f.push(a(f)+"scale(",null,",",null,")");h.push({i:_-4,x:yn(d,m)},{i:_-2,x:yn(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,_=p.length,g;++h<_;)m[(g=p[h]).i]=g.x(f);return m.join("")}}}var EN=wf(_N,"px, ","px)","deg)"),NN=wf(kN,", ",")",")"),wN=1e-12;function If(e){return((e=Math.exp(e))+1/e)/2}function IN(e){return((e=Math.exp(e))-1/e)/2}function vN(e){return((e=Math.exp(2*e))-1)/(e+1)}const ar=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,_=f*f+h*h,g,k;if(_<wN)k=Math.log(p/d)/n,g=function($){return[s+$*f,c+$*h,d*Math.exp(n*$*k)]};else{var E=Math.sqrt(_),b=(p*p-d*d+i*_)/(2*d*o*E),v=(p*p-d*d-i*_)/(2*p*o*E),y=Math.log(Math.sqrt(b*b+1)-b),S=Math.log(Math.sqrt(v*v+1)-v);k=(S-y)/n,g=function($){var O=$*k,B=If(y),z=d/(o*E)*(B*vN(n*O+y)-IN(y));return[s+z*f,c+z*h,d*B/If(n*O+y)]}}return g.duration=k*1e3*n/Math.SQRT2,g}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var ii=0,Pi=0,zi=0,vf=1e3,rr,Fi,lr=0,Co=0,sr=0,Ui=typeof performance=="object"&&performance.now?performance:Date,Cf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ns(){return Co||(Cf(CN),Co=Ui.now()+sr)}function CN(){Co=0}function cr(){this._call=this._time=this._next=null}cr.prototype=Sf.prototype={constructor:cr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ns():+o)+(n==null?0:+n),!this._next&&Fi!==this&&(Fi?Fi._next=this:rr=this,Fi=this),this._call=e,this._time=o,ws()},stop:function(){this._call&&(this._call=null,this._time=1/0,ws())}};function Sf(e,n,o){var i=new cr;return i.restart(e,n,o),i}function SN(){Ns(),++ii;for(var e=rr,n;e;)(n=Co-e._time)>=0&&e._call.call(void 0,n),e=e._next;--ii}function xf(){Co=(lr=Ui.now())+sr,ii=Pi=0;try{SN()}finally{ii=0,RN(),Co=0}}function xN(){var e=Ui.now(),n=e-lr;n>vf&&(sr-=n,lr=e)}function RN(){for(var e,n=rr,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:rr=o);Fi=e,ws(i)}function ws(e){if(!ii){Pi&&(Pi=clearTimeout(Pi));var n=e-Co;n>24?(e<1/0&&(Pi=setTimeout(xf,e-Ui.now()-sr)),zi&&(zi=clearInterval(zi))):(zi||(lr=Ui.now(),zi=setInterval(xN,vf)),ii=1,Cf(xf))}}function Rf(e,n,o){var i=new cr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var AN=qa("start","end","cancel","interrupt"),$N=[],Af=0,$f=1,Is=2,dr=3,Tf=4,vs=5,ur=6;function mr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;TN(e,o,{name:n,index:i,group:a,on:AN,tween:$N,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Af})}function Cs(e,n){var o=an(e,n);if(o.state>Af)throw new Error("too late; already scheduled");return o}function gn(e,n){var o=an(e,n);if(o.state>dr)throw new Error("too late; already running");return o}function an(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function TN(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Sf(r,0,o.time);function r(d){o.state=$f,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==$f)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===dr)return Rf(l);f.state===Tf?(f.state=ur,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=ur,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Rf(function(){o.state===dr&&(o.state=Tf,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Is,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Is){for(o.state=dr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=vs,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===vs&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ur,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function fr(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>Is&&i.state<vs,i.state=ur,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function MN(e){return this.each(function(){fr(this,e)})}function VN(e,n){var o,i;return function(){var a=gn(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 LN(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=gn(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 BN(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=an(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?VN:LN)(o,e,n))}function Ss(e,n,o){var i=e._id;return e.each(function(){var a=gn(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return an(a,i).value[n]}}function Mf(e,n){var o;return(typeof n=="number"?yn:n instanceof wo?or:(o=wo(n))?(n=o,or):kf)(e,n)}function DN(e){return function(){this.removeAttribute(e)}}function ON(e){return function(){this.removeAttributeNS(e.space,e.local)}}function PN(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 zN(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 FN(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 UN(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 HN(e,n){var o=Ja(e),i=o==="transform"?NN:Mf;return this.attrTween(e,typeof n=="function"?(o.local?UN:FN)(o,i,Ss(this,"attr."+e,n)):n==null?(o.local?ON:DN)(o):(o.local?zN:PN)(o,i,n))}function jN(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function KN(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function GN(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&KN(e,r)),o}return a._value=n,a}function YN(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&jN(e,r)),o}return a._value=n,a}function qN(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=Ja(e);return this.tween(o,(i.local?GN:YN)(i,n))}function WN(e,n){return function(){Cs(this,e).delay=+n.apply(this,arguments)}}function JN(e,n){return n=+n,function(){Cs(this,e).delay=n}}function XN(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?WN:JN)(n,e)):an(this.node(),n).delay}function ZN(e,n){return function(){gn(this,e).duration=+n.apply(this,arguments)}}function QN(e,n){return n=+n,function(){gn(this,e).duration=n}}function e0(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?ZN:QN)(n,e)):an(this.node(),n).duration}function t0(e,n){if(typeof n!="function")throw new Error;return function(){gn(this,e).ease=n}}function n0(e){var n=this._id;return arguments.length?this.each(t0(n,e)):an(this.node(),n).ease}function o0(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;gn(this,e).ease=o}}function i0(e){if(typeof e!="function")throw new Error;return this.each(o0(this._id,e))}function a0(e){typeof e!="function"&&(e=Jm(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 An(i,this._parents,this._name,this._id)}function r0(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new An(l,this._parents,this._name,this._id)}function l0(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 s0(e,n,o){var i,a,r=l0(n)?Cs:gn;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function c0(e,n){var o=this._id;return arguments.length<2?an(this.node(),o).on.on(e):this.each(s0(o,e,n))}function d0(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function u0(){return this.on("end.remove",d0(this._id))}function m0(e){var n=this._name,o=this._id;typeof e!="function"&&(e=us(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,mr(d[p],n,o,p,d,an(u,o)));return new An(r,this._parents,n,o)}function f0(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Wm(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=an(u,o),_=0,g=p.length;_<g;++_)(f=p[_])&&mr(f,n,o,_,p,h);r.push(p),l.push(u)}return new An(r,l,n,o)}var p0=Mi.prototype.constructor;function h0(){return new p0(this._groups,this._parents)}function y0(e,n){var o,i,a;return function(){var r=ti(this,e),l=(this.style.removeProperty(e),ti(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Vf(e){return function(){this.style.removeProperty(e)}}function g0(e,n,o){var i,a=o+"",r;return function(){var l=ti(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function b0(e,n,o){var i,a,r;return function(){var l=ti(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),ti(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function _0(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=gn(this,e),d=c.on,u=c.value[r]==null?s||(s=Vf(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function k0(e,n,o){var i=(e+="")=="transform"?EN:Mf;return n==null?this.styleTween(e,y0(e,i)).on("end.style."+e,Vf(e)):typeof n=="function"?this.styleTween(e,b0(e,i,Ss(this,"style."+e,n))).each(_0(this._id,e)):this.styleTween(e,g0(e,i,n),o).on("end.style."+e,null)}function E0(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function N0(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&E0(e,l,o)),i}return r._value=n,r}function w0(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,N0(e,n,o??""))}function I0(e){return function(){this.textContent=e}}function v0(e){return function(){var n=e(this);this.textContent=n??""}}function C0(e){return this.tween("text",typeof e=="function"?v0(Ss(this,"text",e)):I0(e==null?"":e+""))}function S0(e){return function(n){this.textContent=e.call(this,n)}}function x0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&S0(a)),n}return i._value=e,i}function R0(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,x0(e))}function A0(){for(var e=this._name,n=this._id,o=Lf(),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=an(c,n);mr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new An(i,this._parents,e,o)}function $0(){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=gn(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 T0=0;function An(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Lf(){return++T0}var $n=Mi.prototype;An.prototype={constructor:An,select:m0,selectAll:f0,selectChild:$n.selectChild,selectChildren:$n.selectChildren,filter:a0,merge:r0,selection:h0,transition:A0,call:$n.call,nodes:$n.nodes,node:$n.node,size:$n.size,empty:$n.empty,each:$n.each,on:c0,attr:HN,attrTween:qN,style:k0,styleTween:w0,text:C0,textTween:R0,remove:u0,tween:BN,delay:XN,duration:e0,ease:n0,easeVarying:i0,end:$0,[Symbol.iterator]:$n[Symbol.iterator]};function M0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var V0={time:null,delay:0,duration:250,ease:M0};function L0(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 B0(e){var n,o;e instanceof An?(n=e._id,e=e._name):(n=Lf(),(o=V0).time=Ns(),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])&&mr(c,e,n,d,l,o||L0(c,n));return new An(i,this._parents,e,n)}Mi.prototype.interrupt=MN,Mi.prototype.transition=B0;const pr=e=>()=>e;function D0(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Tn(e,n,o){this.k=e,this.x=n,this.y=o}Tn.prototype={constructor:Tn,scale:function(e){return e===1?this:new Tn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Tn(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 ai=new Tn(1,0,0);Tn.prototype;function xs(e){e.stopImmediatePropagation()}function Hi(e){e.preventDefault(),e.stopImmediatePropagation()}function O0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function P0(){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 Bf(){return this.__zoom||ai}function z0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function F0(){return navigator.maxTouchPoints||"ontouchstart"in this}function U0(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 H0(){var e=O0,n=P0,o=U0,i=z0,a=F0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ar,d=qa("start","zoom","end"),u,m,p,f=500,h=150,_=0,g=10;function k(N){N.property("__zoom",Bf).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",T).on("touchmove.zoom",x).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(N,I,C,U){var A=N.selection?N.selection():N;A.property("__zoom",Bf),N!==A?y(N,I,C,U):A.interrupt().each(function(){S(this,arguments).event(U).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},k.scaleBy=function(N,I,C,U){k.scaleTo(N,function(){var A=this.__zoom.k,P=typeof I=="function"?I.apply(this,arguments):I;return A*P},C,U)},k.scaleTo=function(N,I,C,U){k.transform(N,function(){var A=n.apply(this,arguments),P=this.__zoom,F=C==null?v(A):typeof C=="function"?C.apply(this,arguments):C,H=P.invert(F),G=typeof I=="function"?I.apply(this,arguments):I;return o(b(E(P,G),F,H),A,l)},C,U)},k.translateBy=function(N,I,C,U){k.transform(N,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof C=="function"?C.apply(this,arguments):C),n.apply(this,arguments),l)},null,U)},k.translateTo=function(N,I,C,U,A){k.transform(N,function(){var P=n.apply(this,arguments),F=this.__zoom,H=U==null?v(P):typeof U=="function"?U.apply(this,arguments):U;return o(ai.translate(H[0],H[1]).scale(F.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof C=="function"?-C.apply(this,arguments):-C),P,l)},U,A)};function E(N,I){return I=Math.max(r[0],Math.min(r[1],I)),I===N.k?N:new Tn(I,N.x,N.y)}function b(N,I,C){var U=I[0]-C[0]*N.k,A=I[1]-C[1]*N.k;return U===N.x&&A===N.y?N:new Tn(N.k,U,A)}function v(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function y(N,I,C,U){N.on("start.zoom",function(){S(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(U).end()}).tween("zoom",function(){var A=this,P=arguments,F=S(A,P).event(U),H=n.apply(A,P),G=C==null?v(H):typeof C=="function"?C.apply(A,P):C,le=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),se=A.__zoom,ue=typeof I=="function"?I.apply(A,P):I,ye=c(se.invert(G).concat(le/se.k),ue.invert(G).concat(le/ue.k));return function(ae){if(ae===1)ae=ue;else{var Ie=ye(ae),Pe=le/Ie[2];ae=new Tn(Pe,G[0]-Ie[0]*Pe,G[1]-Ie[1]*Pe)}F.zoom(null,ae)}})}function S(N,I,C){return!C&&N.__zooming||new $(N,I)}function $(N,I){this.that=N,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(N,I),this.taps=0}$.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,I){return this.mouse&&N!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var I=nn(this.that).datum();d.call(N,this.that,new D0(N,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:d}),I)}};function O(N,...I){if(!e.apply(this,arguments))return;var C=S(this,I).event(N),U=this.__zoom,A=Math.max(r[0],Math.min(r[1],U.k*Math.pow(2,i.apply(this,arguments)))),P=pn(N);if(C.wheel)(C.mouse[0][0]!==P[0]||C.mouse[0][1]!==P[1])&&(C.mouse[1]=U.invert(C.mouse[0]=P)),clearTimeout(C.wheel);else{if(U.k===A)return;C.mouse=[P,U.invert(P)],fr(this),C.start()}Hi(N),C.wheel=setTimeout(F,h),C.zoom("mouse",o(b(E(U,A),C.mouse[0],C.mouse[1]),C.extent,l));function F(){C.wheel=null,C.end()}}function B(N,...I){if(p||!e.apply(this,arguments))return;var C=N.currentTarget,U=S(this,I,!0).event(N),A=nn(N.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",le,!0),P=pn(N,C),F=N.clientX,H=N.clientY;lf(N.view),xs(N),U.mouse=[P,this.__zoom.invert(P)],fr(this),U.start();function G(se){if(Hi(se),!U.moved){var ue=se.clientX-F,ye=se.clientY-H;U.moved=ue*ue+ye*ye>_}U.event(se).zoom("mouse",o(b(U.that.__zoom,U.mouse[0]=pn(se,C),U.mouse[1]),U.extent,l))}function le(se){A.on("mousemove.zoom mouseup.zoom",null),sf(se.view,U.moved),Hi(se),U.event(se).end()}}function z(N,...I){if(e.apply(this,arguments)){var C=this.__zoom,U=pn(N.changedTouches?N.changedTouches[0]:N,this),A=C.invert(U),P=C.k*(N.shiftKey?.5:2),F=o(b(E(C,P),U,A),n.apply(this,I),l);Hi(N),s>0?nn(this).transition().duration(s).call(y,F,U,N):nn(this).call(k.transform,F,U,N)}}function T(N,...I){if(e.apply(this,arguments)){var C=N.touches,U=C.length,A=S(this,I,N.changedTouches.length===U).event(N),P,F,H,G;for(xs(N),F=0;F<U;++F)H=C[F],G=pn(H,this),G=[G,this.__zoom.invert(G),H.identifier],A.touch0?!A.touch1&&A.touch0[2]!==G[2]&&(A.touch1=G,A.taps=0):(A.touch0=G,P=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(A.taps<2&&(m=G[0],u=setTimeout(function(){u=null},f)),fr(this),A.start())}}function x(N,...I){if(this.__zooming){var C=S(this,I).event(N),U=N.changedTouches,A=U.length,P,F,H,G;for(Hi(N),P=0;P<A;++P)F=U[P],H=pn(F,this),C.touch0&&C.touch0[2]===F.identifier?C.touch0[0]=H:C.touch1&&C.touch1[2]===F.identifier&&(C.touch1[0]=H);if(F=C.that.__zoom,C.touch1){var le=C.touch0[0],se=C.touch0[1],ue=C.touch1[0],ye=C.touch1[1],ae=(ae=ue[0]-le[0])*ae+(ae=ue[1]-le[1])*ae,Ie=(Ie=ye[0]-se[0])*Ie+(Ie=ye[1]-se[1])*Ie;F=E(F,Math.sqrt(ae/Ie)),H=[(le[0]+ue[0])/2,(le[1]+ue[1])/2],G=[(se[0]+ye[0])/2,(se[1]+ye[1])/2]}else if(C.touch0)H=C.touch0[0],G=C.touch0[1];else return;C.zoom("touch",o(b(F,H,G),C.extent,l))}}function R(N,...I){if(this.__zooming){var C=S(this,I).event(N),U=N.changedTouches,A=U.length,P,F;for(xs(N),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),P=0;P<A;++P)F=U[P],C.touch0&&C.touch0[2]===F.identifier?delete C.touch0:C.touch1&&C.touch1[2]===F.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&&(F=pn(F,this),Math.hypot(m[0]-F[0],m[1]-F[1])<g)){var H=nn(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return k.wheelDelta=function(N){return arguments.length?(i=typeof N=="function"?N:pr(+N),k):i},k.filter=function(N){return arguments.length?(e=typeof N=="function"?N:pr(!!N),k):e},k.touchable=function(N){return arguments.length?(a=typeof N=="function"?N:pr(!!N),k):a},k.extent=function(N){return arguments.length?(n=typeof N=="function"?N:pr([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),k):n},k.scaleExtent=function(N){return arguments.length?(r[0]=+N[0],r[1]=+N[1],k):[r[0],r[1]]},k.translateExtent=function(N){return arguments.length?(l[0][0]=+N[0][0],l[1][0]=+N[1][0],l[0][1]=+N[0][1],l[1][1]=+N[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(N){return arguments.length?(o=N,k):o},k.duration=function(N){return arguments.length?(s=+N,k):s},k.interpolate=function(N){return arguments.length?(c=N,k):c},k.on=function(){var N=d.on.apply(d,arguments);return N===d?k:N},k.clickDistance=function(N){return arguments.length?(_=(N=+N)*N,k):Math.sqrt(_)},k.tapDistance=function(N){return arguments.length?(g=+N,k):g},k}var $e=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))($e||{}),Rs=(e=>(e.Partial="partial",e.Full="full",e))(Rs||{}),So=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(So||{}),Mn=(e=>(e.Strict="strict",e.Loose="loose",e))(Mn||{}),As=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(As||{}),ji=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ji||{}),Df=(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))(Df||{});const j0=["INPUT","SELECT","TEXTAREA"],K0=typeof document<"u"?document:null;function $s(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 j0.includes(i==null?void 0:i.nodeName)||a||!!r}function G0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Of(e,n,o,i){const a=n.replace("+",`
35
35
  `).replace(`
36
36
 
37
37
  `,`
@@ -56,7 +56,7 @@ Edge: ${e}
56
56
  Source: ${n}
57
57
  Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
58
58
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
59
- 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 vt extends Error{constructor(n,...o){var i;super((i=sp[n])==null?void 0:i.call(sp,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Ds(e){return"clientX"in e}function uw(e){return"sourceEvent"in e}function bn(e,n){const o=Ds(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 Ji=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function mw(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 kr(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const fw=()=>!0;function Os(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function pw(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())yr(a,hr(r))>0&&i.push(r);return i}const hw=250;function yw(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=pw(e,o,n+hw);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:p,y:f}=si(d,m,m.position,!0),h=Math.sqrt((p-e.x)**2+(f-e.y)**2);h>n||(h<s?(l=[{...m,x:p,y:f}],s=h):h===s&&l.push({...m,x:p,y:f}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function cp(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=fw},u,m,p,f){const h=r==="target",_=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:g,y:k}=bn(e),E=l.elementFromPoint(g,k),b=E!=null&&E.classList.contains(`${s}-flow__handle`)?E:_,v={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const y=dp(void 0,b),S=b.getAttribute("data-nodeid"),$=b.getAttribute("data-handleid"),O=b.classList.contains("connectable"),B=b.classList.contains("connectableend");if(!S||!y)return v;const z={source:h?S:i,sourceHandle:h?$:a,target:h?i:S,targetHandle:h?a:$};v.connection=z;const x=O&&B&&(o===Mn.Strict?h&&y==="source"||!h&&y==="target":S!==i||$!==a);v.isValid=x&&d(z,{nodes:m,edges:u,sourceNode:p(z.source),targetNode:p(z.target)}),v.toHandle=up(S,y,$,f,o,!0)}return v}function dp(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function gw(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function bw(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function up(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===Mn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...si(d,m,m.position,!0)}:m}const Ps={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},_w=["production","prod"];function Xi(e,...n){mp()&&console.warn(`[Vue Flow]: ${e}`,...n)}function mp(){return!_w.includes(process.env.NODE_ENV||"")}function fp(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,...gr(l)}}):null}function zs(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 bt(e){return typeof t.unref(e)<"u"}function kw(e,n,o,i){if(!e||!e.source||!e.target)return o(new vt(gt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Wn(e)?a=e:a={...e,id:Gf(e)},a=jf(a,void 0,i),ew(a,n)?!1:a}function Ew(e,n,o,i,a){if(!n.source||!n.target)return a(new vt(gt.EDGE_INVALID,e.id)),!1;if(!o)return a(new vt(gt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Gf(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function pp(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Ro(l)){o(new vt(gt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=X0(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new vt(gt.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 hp(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 Fs(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}`;hp("source",c,u,e,a,l),hp("target",c,d,e,r,s)}}function yp(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Us(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=Wn(d)?d:kw(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new vt(gt.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new vt(gt.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new vt(gt.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new vt(gt.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...jf(u,f,r),sourceNode:m,targetNode:p})}return c}const gp=Symbol("vueFlow"),bp=Symbol("nodeId"),_p=Symbol("nodeRef"),Nw=Symbol("edgeId"),ww=Symbol("edgeRef"),Er=Symbol("slots");function kp(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:p,findNode:f,multiSelectionActive:h,nodesSelectionActive:_,selectNodesOnDrag:g,removeSelectedElements:k,addSelectedNodes:E,updateNodePositions:b,emits:v}=tt(),{onStart:y,onDrag:S,onStop:$,onClick:O,el:B,disabled:z,id:T,selectable:x,dragHandle:R}=e,N=t.shallowRef(!1);let I=[],C,U=null,A={x:void 0,y:void 0},P={x:0,y:0},F=null,H=!1,G=!1,le=0,se=!1;const ue=Cw(),ye=({x:ge,y:_e})=>{A={x:ge,y:_e};let V=!1;if(I=I.map(L=>{const j={x:ge-L.distance.x,y:_e-L.distance.y},{computedPosition:ee}=Bs(L,o.value?kr(j,i.value):j,v.error,l.value,L.parentNode?f(L.parentNode):void 0);return V=V||L.position.x!==ee.x||L.position.y!==ee.y,L.position=ee,L}),G=G||V,!!V&&(b(I,!0,!0),N.value=!0,F)){const[L,j]=Ls({id:T,dragItems:I,findNode:f});S({event:F,node:L,nodes:j})}},ae=()=>{if(!U)return;const[ge,_e]=Qf(P,U,u.value);if(ge!==0||_e!==0){const V={x:(A.x??0)-ge/c.value.zoom,y:(A.y??0)-_e/c.value.zoom};p({x:ge,y:_e})&&ye(V)}le=requestAnimationFrame(ae)},Ie=(ge,_e)=>{H=!0;const V=f(T);!g.value&&!h.value&&V&&(V.selected||k()),V&&t.toValue(x)&&g.value&&zs(V,h.value,E,k,_,!1,_e);const L=ue(ge.sourceEvent);if(A=L,I=aw(r.value,m.value,L,T),I.length){const[j,ee]=Ls({id:T,dragItems:I,findNode:f});y({event:ge.sourceEvent,node:j,nodes:ee})}},Pe=(ge,_e)=>{var V;ge.sourceEvent.type==="touchmove"&&ge.sourceEvent.touches.length>1||(G=!1,s.value===0&&Ie(ge,_e),A=ue(ge.sourceEvent),U=((V=n.value)==null?void 0:V.getBoundingClientRect())||null,P=bn(ge.sourceEvent,U))},Ae=(ge,_e)=>{const V=ue(ge.sourceEvent);if(!se&&H&&d.value&&(se=!0,ae()),!H){const L=V.xSnapped-(A.x??0),j=V.ySnapped-(A.y??0);Math.sqrt(L*L+j*j)>s.value&&Ie(ge,_e)}(A.x!==V.xSnapped||A.y!==V.ySnapped)&&I.length&&H&&(F=ge.sourceEvent,P=bn(ge.sourceEvent,U),ye(V))},de=ge=>{let _e=!1;if(!H&&!N.value&&!h.value){const V=ge.sourceEvent,L=ue(V),j=L.xSnapped-(A.x??0),ee=L.ySnapped-(A.y??0),Z=Math.sqrt(j*j+ee*ee);Z!==0&&Z<=s.value&&(O==null||O(V),_e=!0)}if(I.length&&!_e){G&&(b(I,!1,!1),G=!1);const[V,L]=Ls({id:T,dragItems:I,findNode:f});$({event:ge.sourceEvent,node:V,nodes:L})}I=[],N.value=!1,se=!1,H=!1,A={x:void 0,y:void 0},cancelAnimationFrame(le)};return t.watch([()=>t.toValue(z),B],([ge,_e],V,L)=>{if(_e){const j=nn(_e);ge||(C=J1().on("start",ee=>Pe(ee,_e)).on("drag",ee=>Ae(ee,_e)).on("end",ee=>de(ee)).filter(ee=>{const Z=ee.target,pe=t.toValue(R);return!ee.button&&(!a.value||!ap(Z,`.${a.value}`,_e)&&(!pe||ap(Z,pe,_e)))}),j.call(C)),L(()=>{j.on(".drag",null),C&&(C.on("start",null),C.on("drag",null),C.on("end",null))})}}),N}function Iw(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),updateStart:Se(),update:Se(),updateEnd:Se()}}function vw(e,n){const o=Iw();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 Cw(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=tt();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=uw(a)?a.sourceEvent:a,{x:c,y:d}=bn(s,l),u=qi({x:c,y:d},e.value),{x:m,y:p}=o.value?kr(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function Nr(){return!0}function Ep({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:p,nodesConnectable:f,autoPanOnConnect:h,autoPanSpeed:_,findNode:g,panBy:k,startConnection:E,updateConnection:b,endConnection:v,emits:y,viewport:S,edges:$,nodes:O,isValidConnection:B,nodeLookup:z}=tt();let T=null,x=!1,R=null;function N(C){var U;const A=t.toValue(o)==="target",P=Ds(C),F=Hf(C.target),H=C.currentTarget;if(H&&(P&&C.button===0||!P)){let G=function(Ee){V=bn(Ee,de),ye=yw(qi(V,S.value,!1,[1,1]),u.value,z.value,ee),L||(j(),L=!0);const W=cp(Ee,{handle:ye,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:A?"target":"source",isValidConnection:ue,doc:F,lib:"vue",flowId:s,nodeLookup:z.value},$.value,O.value,g,z.value);R=W.handleDomNode,T=W.connection,x=bw(!!ye,W.isValid);const J={...ve,isValid:x,to:W.toHandle&&x?Yi({x:W.toHandle.x,y:W.toHandle.y},S.value):V,toHandle:W.toHandle,toPosition:x&&W.toHandle?W.toHandle.position:Ps[ee.position],toNode:W.toHandle?z.value.get(W.toHandle.nodeId):null};if(x&&ye&&(ve!=null&&ve.toHandle)&&J.toHandle&&ve.toHandle.type===J.toHandle.type&&ve.toHandle.nodeId===J.toHandle.nodeId&&ve.toHandle.id===J.toHandle.id&&ve.to.x===J.to.x&&ve.to.y===J.to.y)return;const X=ye??W.toHandle;if(b(X&&x?Yi({x:X.x,y:X.y},S.value):V,X,gw(!!X,x)),ve=J,!ye&&!x&&!R)return Os(_e);T&&T.source!==T.target&&R&&(Os(_e),_e=R,R.classList.add("connecting","vue-flow__handle-connecting"),R.classList.toggle("valid",!!x),R.classList.toggle("vue-flow__handle-valid",!!x))},le=function(Ee){"touches"in Ee&&Ee.touches.length>0||((ye||R)&&T&&x&&(r?r(Ee,T):y.connect(T)),y.connectEnd(Ee),a&&(l==null||l(Ee)),Os(_e),cancelAnimationFrame(ae),v(Ee),L=!1,x=!1,T=null,R=null,F.removeEventListener("mousemove",G),F.removeEventListener("mouseup",le),F.removeEventListener("touchmove",G),F.removeEventListener("touchend",le))};const se=g(t.toValue(n));let ue=t.toValue(i)||B.value||Nr;!ue&&se&&(ue=(A?se.isValidSourcePos:se.isValidTargetPos)||Nr);let ye,ae=0;const{x:Ie,y:Pe}=bn(C),Ae=dp(t.toValue(a),H),de=(U=c.value)==null?void 0:U.getBoundingClientRect();if(!de||!Ae)return;const ge=up(t.toValue(n),Ae,t.toValue(e),z.value,d.value);if(!ge)return;let _e,V=bn(C,de),L=!1;const j=()=>{if(!h.value)return;const[Ee,W]=Qf(V,de,_.value);k({x:Ee,y:W}),ae=requestAnimationFrame(j)},ee={...ge,nodeId:t.toValue(n),type:Ae,position:ge.position},Z=z.value.get(t.toValue(n)),me={inProgress:!0,isValid:null,from:si(Z,ee,$e.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:Z,to:V,toHandle:null,toPosition:Ps[ee.position],toNode:null};E({nodeId:t.toValue(n),id:t.toValue(e),type:Ae,position:(H==null?void 0:H.getAttribute("data-handlepos"))||$e.Top,...V},{x:Ie-de.left,y:Pe-de.top}),y.connectStart({event:C,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:Ae});let ve=me;F.addEventListener("mousemove",G),F.addEventListener("mouseup",le),F.addEventListener("touchmove",G),F.addEventListener("touchend",le)}}function I(C){var U,A;if(!m.value)return;const P=t.toValue(o)==="target";if(!p.value){y.clickConnectStart({event:C,nodeId:t.toValue(n),handleId:t.toValue(e)}),E({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:$e.Top,...bn(C)},void 0,!0);return}let F=t.toValue(i)||B.value||Nr;const H=g(t.toValue(n));if(!F&&H&&(F=(P?H.isValidSourcePos:H.isValidTargetPos)||Nr),H&&(typeof H.connectable>"u"?f.value:H.connectable)===!1)return;const G=Hf(C.target),le=cp(C,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:$e.Top,...bn(C)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:F,doc:G,lib:"vue",flowId:s,nodeLookup:z.value},$.value,O.value,g,z.value),se=((U=le.connection)==null?void 0:U.source)===((A=le.connection)==null?void 0:A.target);le.isValid&&le.connection&&!se&&y.connect(le.connection),y.clickConnectEnd(C),v(C,!0)}return{handlePointerDown:N,handleClick:I}}function Sw(){return t.inject(bp,"")}function Np(e){const n=e??Sw()??"",o=t.inject(_p,t.ref(null)),{findNode:i,edges:a,emits:r}=tt(),l=i(n);return l||r.error(new vt(gt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Ao([l],a.value))}}function xw(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),dragStart:Se(),drag:Se(),dragStop:Se()}}function Rw(e,n){const o=xw();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 wp(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=tt();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,p=d?4:1,f=c.x*u*p,h=c.y*m*p,_=[];for(const g of e.value)if(g.draggable||l&&typeof g.draggable>"u"){const k={x:g.computedPosition.x+f,y:g.computedPosition.y+h},{position:E}=Bs(g,k,s.error,n.value,g.parentNode?i(g.parentNode):void 0);_.push({id:g.id,position:E,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(_,!0,!1)}}const wr=.1,Aw=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Zn(){return Xi("Viewport not initialized yet."),Promise.resolve(!1)}const $w={zoomIn:Zn,zoomOut:Zn,zoomTo:Zn,fitView:Zn,setCenter:Zn,fitBounds:Zn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Zn,setTransform:Zn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Tw(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Oi:ar).scaleBy(Hs(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}=Uf({x:-i,y:-a},e.translateExtent),m=ai.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?Oi:ar).transform(Hs(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"?Oi:ar).scaleTo(Hs(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:wr,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Ts(s),{x:d,y:u,zoom:m}=Jf(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??wr);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:wr})=>{const{x:l,y:s,zoom:c}=Jf(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??wr);return o(l,s,c,r)},project:a=>qi(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 qi(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 Yi(s,e.viewport)}return{x:0,y:0}}}:$w)}function Hs(e,n=0,o=Aw,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function Mw(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let _,g,k=!!(o.nodes.value.length||o.edges.value.length);_=ei([e.modelValue,()=>{var E,b;return(b=(E=e.modelValue)==null?void 0:E.value)==null?void 0:b.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setElements(E),!g&&!k&&E.length?k=!0:g==null||g.resume())}),g=ei([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([E,b])=>{var v;(v=e.modelValue)!=null&&v.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...E,...b],t.nextTick(()=>{_==null||_.resume()}))},{immediate:k}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let _,g,k=!!o.nodes.value.length;_=ei([e.nodes,()=>{var E,b;return(b=(E=e.nodes)==null?void 0:E.value)==null?void 0:b.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setNodes(E),!g&&!k&&E.length?k=!0:g==null||g.resume())}),g=ei([o.nodes,()=>o.nodes.value.length],([E])=>{var b;(b=e.nodes)!=null&&b.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...E],t.nextTick(()=>{_==null||_.resume()}))},{immediate:k}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let _,g,k=!!o.edges.value.length;_=ei([e.edges,()=>{var E,b;return(b=(E=e.edges)==null?void 0:E.value)==null?void 0:b.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setEdges(E),!g&&!k&&E.length?k=!0:g==null||g.resume())}),g=ei([o.edges,()=>o.edges.value.length],([E])=>{var b;(b=e.edges)!=null&&b.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...E],t.nextTick(()=>{_==null||_.resume()}))},{immediate:k}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&bt(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&bt(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&bt(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&bt(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{bt(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const _=async g=>{let k=g;typeof n.autoConnect=="function"&&(k=await n.autoConnect(g)),k!==!1&&o.addEdges([k])};t.watch(()=>n.autoConnect,()=>{bt(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(g,k,E)=>{g?o.onConnect(_):o.hooks.value.connect.off(_),E(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},f=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(n)){const k=g;if(!_.includes(k)){const E=t.toRef(()=>n[k]),b=o[k];t.isRef(b)&&i.run(()=>{t.watch(E,v=>{bt(v)&&(b.value=v)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function Vw(){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=>Xi(e.message))}}function Lw(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),Ti(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),Ti(r.removeHasEmitListeners)}});function i(a){var r;const l=Bw(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function Bw(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Ip(){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:Rs.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ji.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:So.Bezier,style:{}},connectionMode:Mn.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:Ji()?"Meta":"Control",zoomActivationKeyCode:Ji()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Vw(),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 Dw=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Ow(e,n,o){const i=Tw(e),a=V=>{const L=V??[];e.hooks.updateNodeInternals.trigger(L)},r=V=>Q0(V,e.nodes,e.edges),l=V=>Z0(V,e.nodes,e.edges),s=V=>Ao(V,e.edges),c=({id:V,type:L,nodeId:j})=>{var ee;const Z=V?`-${L}-${V}`:`-${L}`;return Array.from(((ee=e.connectionLookup.get(`${j}${Z}`))==null?void 0:ee.values())??[])},d=V=>{if(V)return n.value.get(V)},u=V=>{if(V)return o.value.get(V)},m=(V,L,j)=>{var ee,Z;const pe=[];for(const me of V){const ve={id:me.id,type:"position",dragging:j,from:me.from};if(L&&(ve.position=me.position,me.parentNode)){const Ee=d(me.parentNode);ve.position={x:ve.position.x-(((ee=Ee==null?void 0:Ee.computedPosition)==null?void 0:ee.x)??0),y:ve.position.y-(((Z=Ee==null?void 0:Ee.computedPosition)==null?void 0:Z.y)??0)}}pe.push(ve)}pe!=null&&pe.length&&e.hooks.nodesChange.trigger(pe)},p=V=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const j=window.getComputedStyle(L),{m22:ee}=new window.DOMMatrixReadOnly(j.transform),Z=[];for(const pe of V){const me=pe,ve=d(me.id);if(ve){const Ee=gr(me.nodeElement);if(!!(Ee.width&&Ee.height&&(ve.dimensions.width!==Ee.width||ve.dimensions.height!==Ee.height||me.forceUpdate))){const J=me.nodeElement.getBoundingClientRect();ve.dimensions=Ee,ve.handleBounds.source=fp("source",me.nodeElement,J,ee,ve.id),ve.handleBounds.target=fp("target",me.nodeElement,J,ee,ve.id),Z.push({id:ve.id,type:"dimensions",dimensions:Ee})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),Z.length&&e.hooks.nodesChange.trigger(Z)},f=(V,L)=>{const j=new Set,ee=new Set;for(const me of V)Ro(me)?j.add(me.id):Wn(me)&&ee.add(me.id);const Z=Xn(n.value,j,!0),pe=Xn(o.value,ee);if(e.multiSelectionActive){for(const me of j)Z.push(Jn(me,L));for(const me of ee)pe.push(Jn(me,L))}Z.length&&e.hooks.nodesChange.trigger(Z),pe.length&&e.hooks.edgesChange.trigger(pe)},h=V=>{if(e.multiSelectionActive){const L=V.map(j=>Jn(j.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(Xn(n.value,new Set(V.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(Xn(o.value))},_=V=>{if(e.multiSelectionActive){const L=V.map(j=>Jn(j.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(Xn(o.value,new Set(V.map(L=>L.id)))),e.hooks.nodesChange.trigger(Xn(n.value,new Set,!0))},g=V=>{f(V,!0)},k=V=>{const j=(V||e.nodes).map(ee=>(ee.selected=!1,Jn(ee.id,!1)));e.hooks.nodesChange.trigger(j)},E=V=>{const j=(V||e.edges).map(ee=>(ee.selected=!1,Jn(ee.id,!1)));e.hooks.edgesChange.trigger(j)},b=V=>{if(!V||!V.length)return f([],!1);const L=V.reduce((j,ee)=>{const Z=Jn(ee.id,!1);return Ro(ee)?j.nodes.push(Z):j.edges.push(Z),j},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},v=V=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([V,e.maxZoom]),e.minZoom=V},y=V=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,V]),e.maxZoom=V},S=V=>{var L;(L=e.d3Zoom)==null||L.translateExtent(V),e.translateExtent=V},$=V=>{e.nodeExtent=V,a()},O=V=>{var L;(L=e.d3Zoom)==null||L.clickDistance(V)},B=V=>{e.nodesDraggable=V,e.nodesConnectable=V,e.elementsSelectable=V},z=V=>{const L=V instanceof Function?V(e.nodes):V;!e.initialized&&!L.length||(e.nodes=pp(L,d,e.hooks.error.trigger))},T=V=>{const L=V instanceof Function?V(e.edges):V;if(!e.initialized&&!L.length)return;const j=Us(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Fs(e.connectionLookup,o.value,j),e.edges=j},x=V=>{const L=V instanceof Function?V([...e.nodes,...e.edges]):V;!e.initialized&&!L.length||(z(L.filter(Ro)),T(L.filter(Wn)))},R=V=>{let L=V instanceof Function?V(e.nodes):V;L=Array.isArray(L)?L:[L];const j=pp(L,d,e.hooks.error.trigger),ee=[];for(const Z of j)ee.push(tp(Z));ee.length&&e.hooks.nodesChange.trigger(ee)},N=V=>{let L=V instanceof Function?V(e.edges):V;L=Array.isArray(L)?L:[L];const j=Us(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),ee=[];for(const Z of j)ee.push(tp(Z));ee.length&&e.hooks.edgesChange.trigger(ee)},I=(V,L=!0,j=!1)=>{const ee=V instanceof Function?V(e.nodes):V,Z=Array.isArray(ee)?ee:[ee],pe=[],me=[];function ve(W){const J=s(W);for(const X of J)(!bt(X.deletable)||X.deletable)&&me.push(op(X.id,X.source,X.target,X.sourceHandle,X.targetHandle))}function Ee(W){const J=[];for(const X of e.nodes)X.parentNode===W&&J.push(X);if(J.length){for(const X of J)pe.push(np(X.id));L&&ve(J);for(const X of J)Ee(X.id)}}for(const W of Z){const J=typeof W=="string"?d(W):W;J&&(bt(J.deletable)&&!J.deletable||(pe.push(np(J.id)),L&&ve([J]),j&&Ee(J.id)))}me.length&&e.hooks.edgesChange.trigger(me),pe.length&&e.hooks.nodesChange.trigger(pe)},C=V=>{const L=V instanceof Function?V(e.edges):V,j=Array.isArray(L)?L:[L],ee=[];for(const Z of j){const pe=typeof Z=="string"?u(Z):Z;pe&&(bt(pe.deletable)&&!pe.deletable||ee.push(op(typeof Z=="string"?Z:Z.id,pe.source,pe.target,pe.sourceHandle,pe.targetHandle)))}e.hooks.edgesChange.trigger(ee)},U=(V,L,j=!0)=>{const ee=u(V.id);if(!ee)return!1;const Z=e.edges.indexOf(ee),pe=Ew(V,L,ee,j,e.hooks.error.trigger);if(pe){const[me]=Us([pe],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((ve,Ee)=>Ee===Z?me:ve),Fs(e.connectionLookup,o.value,[me]),me}return!1},A=(V,L,j={replace:!1})=>{const ee=u(V);if(!ee)return;const Z=typeof L=="function"?L(ee):L;ee.data=j.replace?Z:{...ee.data,...Z}},P=V=>ep(V,e.nodes),F=V=>{const L=ep(V,e.edges);return Fs(e.connectionLookup,o.value,L),L},H=(V,L,j={replace:!1})=>{const ee=d(V);if(!ee)return;const Z=typeof L=="function"?L(ee):L;j.replace?e.nodes.splice(e.nodes.indexOf(ee),1,Z):Object.assign(ee,Z)},G=(V,L,j={replace:!1})=>{const ee=d(V);if(!ee)return;const Z=typeof L=="function"?L(ee):L;ee.data=j.replace?Z:{...ee.data,...Z}},le=(V,L,j=!1)=>{j?e.connectionClickStartHandle=V:e.connectionStartHandle=V,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},se=(V,L=null,j=null)=>{e.connectionStartHandle&&(e.connectionPosition=V,e.connectionEndHandle=L,e.connectionStatus=j)},ue=(V,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ye=V=>{const L=J0(V),j=L?null:Gi(V)?V:d(V.id);return!L&&!j?[null,null,L]:[L?V:hr(j),j,L]},ae=(V,L=!0,j=e.nodes)=>{const[ee,Z,pe]=ye(V);if(!ee)return[];const me=[];for(const ve of j||e.nodes){if(!pe&&(ve.id===Z.id||!ve.computedPosition))continue;const Ee=hr(ve),W=yr(Ee,ee);(L&&W>0||W>=Ee.width*Ee.height||W>=Number(ee.width)*Number(ee.height))&&me.push(ve)}return me},Ie=(V,L,j=!0)=>{const[ee]=ye(V);if(!ee)return!1;const Z=yr(ee,L);return j&&Z>0||Z>=Number(ee.width)*Number(ee.height)},Pe=V=>{const{viewport:L,dimensions:j,d3Zoom:ee,d3Selection:Z,translateExtent:pe}=e;if(!ee||!Z||!V.x&&!V.y)return!1;const me=ai.translate(L.x+V.x,L.y+V.y).scale(L.zoom),ve=[[0,0],[j.width,j.height]],Ee=ee.constrain()(me,ve,pe),W=e.viewport.x!==Ee.x||e.viewport.y!==Ee.y||e.viewport.zoom!==Ee.k;return ee.transform(Z,Ee),W},Ae=V=>{const L=V instanceof Function?V(e):V,j=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];bt(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const ee=L.modelValue||L.nodes||L.edges?[]:void 0;ee&&(L.modelValue&&ee.push(...L.modelValue),L.nodes&&ee.push(...L.nodes),L.edges&&ee.push(...L.edges),x(ee));const Z=()=>{bt(L.maxZoom)&&y(L.maxZoom),bt(L.minZoom)&&v(L.minZoom),bt(L.translateExtent)&&S(L.translateExtent)};for(const pe of Object.keys(L)){const me=pe,ve=L[me];![...Dw,...j].includes(me)&&bt(ve)&&(e[me]=ve)}ss(()=>e.d3Zoom).not.toBeNull().then(Z),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:x,setNodes:z,setEdges:T,addNodes:R,addEdges:N,removeNodes:I,removeEdges:C,findNode:d,findEdge:u,updateEdge:U,updateEdgeData:A,updateNode:H,updateNodeData:G,applyEdgeChanges:F,applyNodeChanges:P,addSelectedElements:g,addSelectedNodes:h,addSelectedEdges:_,setMinZoom:v,setMaxZoom:y,setTranslateExtent:S,setNodeExtent:$,setPaneClickDistance:O,removeSelectedElements:b,removeSelectedNodes:k,removeSelectedEdges:E,startConnection:le,updateConnection:se,endConnection:ue,setInteractive:B,setState:Ae,getIntersectingNodes:ae,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ie,panBy:Pe,fitView:V=>i.value.fitView(V),zoomIn:V=>i.value.zoomIn(V),zoomOut:V=>i.value.zoomOut(V),zoomTo:(V,L)=>i.value.zoomTo(V,L),setViewport:(V,L)=>i.value.setViewport(V,L),setTransform:(V,L)=>i.value.setTransform(V,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(V,L,j)=>i.value.setCenter(V,L,j),fitBounds:(V,L)=>i.value.fitBounds(V,L),project:V=>i.value.project(V),screenToFlowCoordinate:V=>i.value.screenToFlowCoordinate(V),flowToScreenCoordinate:V=>i.value.flowToScreenCoordinate(V),toObject:()=>{const V=[],L=[];for(const j of e.nodes){const{computedPosition:ee,handleBounds:Z,selected:pe,dimensions:me,isParent:ve,resizing:Ee,dragging:W,events:J,...X}=j;V.push(X)}for(const j of e.edges){const{selected:ee,sourceNode:Z,targetNode:pe,events:me,...ve}=j;L.push(ve)}return JSON.parse(JSON.stringify({nodes:V,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:V=>new Promise(L=>{const{nodes:j,edges:ee,position:Z,zoom:pe,viewport:me}=V;j&&z(j),ee&&T(ee);const[ve,Ee]=me!=null&&me.x&&(me!=null&&me.y)?[me.x,me.y]:Z??[null,null];if(ve&&Ee){const W=(me==null?void 0:me.zoom)||pe||e.viewport.zoom;return ss(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:ve,y:Ee,zoom:W}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const V=Ip();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=ai.translate(V.defaultViewport.x??0,V.defaultViewport.y??0).scale(xo(V.defaultViewport.zoom??1,V.minZoom,V.maxZoom)),j=e.viewportRef.getBoundingClientRect(),ee=[[0,0],[j.width,j.height]],Z=e.d3Zoom.constrain()(L,ee,V.translateExtent);e.d3Zoom.transform(e.d3Selection,Z)}Ae(V)},$destroy:()=>{}}}const Pw=["data-id","data-handleid","data-nodeid","data-handlepos"],zw={name:"Handle",compatConfig:{MODE:3}},Qn=t.defineComponent({...zw,props:{id:{default:null},type:{},position:{default:()=>$e.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:p}=tt(),{id:f,node:h,nodeEl:_,connectedEdges:g}=Np(),k=t.ref(),E=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),b=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),v=t.toRef(()=>{var T,x,R,N,I,C;return((T=l.value)==null?void 0:T.nodeId)===f&&((x=l.value)==null?void 0:x.id)===e.id&&((R=l.value)==null?void 0:R.type)===i.value||((N=c.value)==null?void 0:N.nodeId)===f&&((I=c.value)==null?void 0:I.id)===e.id&&((C=c.value)==null?void 0:C.type)===i.value}),y=t.toRef(()=>{var T,x,R;return((T=s.value)==null?void 0:T.nodeId)===f&&((x=s.value)==null?void 0:x.id)===e.id&&((R=s.value)==null?void 0:R.type)===i.value}),{handlePointerDown:S,handleClick:$}=Ep({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),O=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(T=>{const x=T[`${i.value}Handle`];return T[i.value]!==f?!1:x?x===e.id:!0}):typeof e.connectable=="number"?g.value.filter(T=>{const x=T[`${i.value}Handle`];return T[i.value]!==f?!1:x?x===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,g.value):bt(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var T;if(!h.dimensions.width||!h.dimensions.height)return;const x=(T=h.handleBounds[i.value])==null?void 0:T.find(P=>P.id===e.id);if(!d.value||x)return;const R=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!k.value||!R||!e.id)return;const N=_.value.getBoundingClientRect(),I=k.value.getBoundingClientRect(),C=window.getComputedStyle(R),{m22:U}=new window.DOMMatrixReadOnly(C.transform),A={id:e.id,position:e.position,x:(I.left-N.left)/U,y:(I.top-N.top)/U,type:i.value,nodeId:f,...gr(k.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],A]});function B(T){const x=Ds(T);O.value&&E.value&&(x&&T.button===0||!x)&&S(T)}function z(T){!f||!s.value&&!E.value||O.value&&$(T)}return n({handleClick:$,handlePointerDown:S,onClick:z,onPointerDown:B}),(T,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:k,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":T.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${T.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:O.value,connecting:y.value,connectablestart:E.value,connectableend:b.value,connectionindicator:O.value&&(E.value&&!v.value||b.value&&v.value)}]]),onMousedown:B,onTouchstartPassive:B,onClick:z},[t.renderSlot(T.$slots,"default",{id:T.id})],42,Pw))}}),Ir=function({sourcePosition:e=$e.Bottom,targetPosition:n=$e.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Qn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Qn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Ir.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ir.inheritAttrs=!1,Ir.compatConfig={MODE:3};const Fw=Ir,vr=function({targetPosition:e=$e.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Qn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};vr.props=["targetPosition","label","isValidTargetPos","connectable","data"],vr.inheritAttrs=!1,vr.compatConfig={MODE:3};const Uw=vr,Cr=function({sourcePosition:e=$e.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Qn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Cr.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Cr.inheritAttrs=!1,Cr.compatConfig={MODE:3};const Hw=Cr,jw=["transform"],Kw=["width","height","x","y","rx","ry"],Gw=["y"],Yw={name:"EdgeText",compatConfig:{MODE:3}},qw=t.defineComponent({...Yw,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,Kw)):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,Gw)],8,jw))}}),Ww=["id","d","marker-end","marker-start"],Jw=["d","stroke-width"],Xw={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Sr=t.defineComponent({...Xw,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,Ww),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,Jw)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(qw,{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 vp({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 Cp({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 xr(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Sp({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case $e.Left:l=n-xr(n-i,r),s=o;break;case $e.Right:l=n+xr(i-n,r),s=o;break;case $e.Top:l=n,s=o-xr(o-a,r);break;case $e.Bottom:l=n,s=o+xr(a-o,r);break}return[l,s]}function xp(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,curvature:s=.25}=e,[c,d]=Sp({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=Sp({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,h,_]=Cp({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,p,f,h,_]}function Rp({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case $e.Left:case $e.Right:r=.5*(n+i),l=o;break;case $e.Top:case $e.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Ap(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top}=e,[s,c]=Rp({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=Rp({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,h]=Cp({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,p,f,h]}const $p={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};function Zw({source:e,sourcePosition:n=$e.Bottom,target:o}){return n===$e.Left||n===$e.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function Tp(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function Qw({source:e,sourcePosition:n=$e.Bottom,target:o,targetPosition:i=$e.Top,center:a,offset:r}){const l=$p[n],s=$p[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=Zw({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,h,_;const g={x:0,y:0},k={x:0,y:0},[E,b,v,y]=vp({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){h=a.x??E,_=a.y??b;const $=[{x:h,y:c.y},{x:h,y:d.y}],O=[{x:c.x,y:_},{x:d.x,y:_}];l[m]===p?f=m==="x"?$:O:f=m==="x"?O:$}else{const $=[{x:c.x,y:d.y}],O=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?O:$:f=l.y===p?$:O,n===i){const R=Math.abs(e[m]-o[m]);if(R<=r){const N=Math.min(r-1,r-R);l[m]===p?g[m]=(c[m]>e[m]?-1:1)*N:k[m]=(d[m]>o[m]?-1:1)*N}}if(n!==i){const R=m==="x"?"y":"x",N=l[m]===s[R],I=c[R]>d[R],C=c[R]<d[R];(l[m]===1&&(!N&&I||N&&C)||l[m]!==1&&(!N&&C||N&&I))&&(f=m==="x"?$:O)}const B={x:c.x+g.x,y:c.y+g.y},z={x:d.x+k.x,y:d.y+k.y},T=Math.max(Math.abs(B.x-f[0].x),Math.abs(z.x-f[0].x)),x=Math.max(Math.abs(B.y-f[0].y),Math.abs(z.y-f[0].y));T>=x?(h=(B.x+z.x)/2,_=f[0].y):(h=f[0].x,_=(B.y+z.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...f,{x:d.x+k.x,y:d.y+k.y},o],h,_,v,y]}function eI(e,n,o,i){const a=Math.min(Tp(e,n)/2,Tp(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 js(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,h,_]=Qw({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((k,E,b)=>{let v;return b>0&&b<m.length-1?v=eI(m[b-1],E,m[b+1],s):v=`${b===0?"M":"L"}${E.x} ${E.y}`,k+=v,k},""),p,f,h,_]}function tI(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=vp({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const nI=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]=tI(e);return t.h(Sr,{path:o,labelX:i,labelY:a,...n,...e})}}}),Mp=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]=js({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Sr,{path:o,labelX:i,labelY:a,...n,...e})}}}),oI=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(Mp,{...e,...n,borderRadius:0})}}),iI=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]=xp({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Sr,{path:o,labelX:i,labelY:a,...n,...e})}}}),aI=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]=Ap({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Sr,{path:o,labelX:i,labelY:a,...n,...e})}}}),rI={input:Hw,default:Fw,output:Uw},lI={default:iI,straight:nI,step:oI,smoothstep:Mp,simplebezier:aI};function sI(e,n,o){const i=t.computed(()=>_=>n.value.get(_)),a=t.computed(()=>_=>o.value.get(_)),r=t.computed(()=>{const _={...lI,...e.edgeTypes},g=Object.keys(_);for(const k of e.edges)k.type&&!g.includes(k.type)&&(_[k.type]=k.type);return _}),l=t.computed(()=>{const _={...rI,...e.nodeTypes},g=Object.keys(_);for(const k of e.nodes)k.type&&!g.includes(k.type)&&(_[k.type]=k.type);return _}),s=t.computed(()=>e.onlyRenderVisibleElements?Wf(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const g of e.edges){const k=n.value.get(g.source),E=n.value.get(g.target);cw({sourcePos:k.computedPosition||{x:0,y:0},targetPos:E.computedPosition||{x:0,y:0},sourceWidth:k.dimensions.width,sourceHeight:k.dimensions.height,targetWidth:E.dimensions.width,targetHeight:E.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(g)}return _}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const _=[];for(const g of e.nodes)g.selected&&_.push(g);return _}),m=t.computed(()=>{const _=[];for(const g of e.edges)g.selected&&_.push(g);return _}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const _=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&_.push(g);return _}),h=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:h}}class $o{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)??$o.instance;return $o.instance=i??new $o,o&&(o.config.globalProperties.$vueFlowStorage=$o.instance),$o.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=Ip(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[h]=f.on}const l={};for(const[p,f]of Object.entries(a.hooks))l[p]=f.trigger;const s=t.computed(()=>{const p=new Map;for(const f of a.nodes)p.set(f.id,f);return p}),c=t.computed(()=>{const p=new Map;for(const f of a.edges)p.set(f.id,f);return p}),d=sI(a,s,c),u=Ow(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...aE(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 tt(e){const n=$o.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(gp,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,p,f)=>{const h=g=>{d.applyNodeChanges(g)},_=g=>{d.applyEdgeChanges(g)};m?(d.onNodesChange(h),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(_)),f(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),Ti(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Xi(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(gp,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new vt(gt.USEVUEFLOW_OPTIONS))}return s}function cI(e){const{emits:n,dimensions:o}=tt();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=gr(e.value);(s.width===0||s.height===0)&&n.error(new vt(gt.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 dI={name:"UserSelection",compatConfig:{MODE:3}},uI=t.defineComponent({...dI,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))}}),mI=["tabIndex"],fI={name:"NodesSelection",compatConfig:{MODE:3}},pI=t.defineComponent({...fI,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=tt(),s=wp(),c=t.ref(null),d=kp({el:c,onStart(h){n.selectionDragStart(h),n.nodeDragStart(h)},onDrag(h){n.selectionDrag(h),n.nodeDrag(h)},onStop(h){n.selectionDragStop(h),n.nodeDragStop(h)}});t.onMounted(()=>{var h;r.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=t.computed(()=>Ts(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){n.selectionContextMenu({event:h,nodes:i.value})}function f(h){r.value||ri[h.key]&&(h.preventDefault(),s({x:ri[h.key].x,y:ri[h.key].y},h.shiftKey))}return(h,_)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,mI)],6)):t.createCommentVNode("",!0)}});function hI(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const yI={name:"Pane",compatConfig:{MODE:3}},gI=t.defineComponent({...yI,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:p,removeEdges:f,selectionMode:h,deleteKeyCode:_,multiSelectionKeyCode:g,multiSelectionActive:k,edgeLookup:E,nodeLookup:b,connectionLookup:v,defaultEdgeOptions:y,connectionStartHandle:S,panOnDrag:$}=tt(),O=t.shallowRef(null),B=t.shallowRef(new Set),z=t.shallowRef(new Set),T=t.shallowRef(null),x=t.toRef(()=>c.value&&(e.isSelecting||r.value)),R=t.toRef(()=>S.value!==null);let N=!1,I=!1;const C=Ki(_,{actInsideInputWithModifier:!1}),U=Ki(g);t.watch(C,ue=>{ue&&(p(m.value),f(u.value),d.value=!1)}),t.watch(U,ue=>{k.value=ue});function A(ue,ye){return ae=>{ae.target===ye&&(ue==null||ue(ae))}}function P(ue){if(N||R.value){N=!1;return}a.paneClick(ue),l(),d.value=!1}function F(ue){var ye;if(Array.isArray($.value)&&((ye=$.value)!=null&&ye.includes(2))){ue.preventDefault();return}a.paneContextMenu(ue)}function H(ue){a.paneScroll(ue)}function G(ue){var ye,ae,Ie;if(T.value=((ye=n.value)==null?void 0:ye.getBoundingClientRect())??null,!c.value||!e.isSelecting||ue.button!==0||ue.target!==O.value||!T.value)return;(Ie=(ae=ue.target)==null?void 0:ae.setPointerCapture)==null||Ie.call(ae,ue.pointerId);const{x:Pe,y:Ae}=hI(ue,T.value);I=!0,N=!1,l(),s.value={width:0,height:0,startX:Pe,startY:Ae,x:Pe,y:Ae},a.selectionStart(ue)}function le(ue){var ye;if(!T.value||!s.value)return;N=!0;const{x:ae,y:Ie}=bn(ue,T.value),{startX:Pe=0,startY:Ae=0}=s.value,de={startX:Pe,startY:Ae,x:ae<Pe?ae:Pe,y:Ie<Ae?Ie:Ae,width:Math.abs(ae-Pe),height:Math.abs(Ie-Ae)},ge=B.value,_e=z.value;B.value=new Set(Wf(o.value,de,i.value,h.value===Rs.Partial,!0).map(L=>L.id)),z.value=new Set;const V=((ye=y.value)==null?void 0:ye.selectable)??!0;for(const L of B.value){const j=v.value.get(L);if(j)for(const{edgeId:ee}of j.values()){const Z=E.value.get(ee);Z&&(Z.selectable??V)&&z.value.add(ee)}}if(!yp(ge,B.value)){const L=Xn(b.value,B.value,!0);a.nodesChange(L)}if(!yp(_e,z.value)){const L=Xn(E.value,z.value);a.edgesChange(L)}s.value=de,r.value=!0,d.value=!1}function se(ue){var ye;ue.button!==0||!I||((ye=ue.target)==null||ye.releasePointerCapture(ue.pointerId),!r.value&&s.value&&ue.target===O.value&&P(ue),r.value=!1,s.value=null,d.value=B.value.size>0,a.selectionEnd(ue),e.selectionKeyPressed&&(N=!1),I=!1)}return(ue,ye)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:O,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:ue.isSelecting}]),onClick:ye[0]||(ye[0]=ae=>x.value?void 0:A(P,O.value)(ae)),onContextmenu:ye[1]||(ye[1]=ae=>A(F,O.value)(ae)),onWheelPassive:ye[2]||(ye[2]=ae=>A(H,O.value)(ae)),onPointerenter:ye[3]||(ye[3]=ae=>x.value?void 0:t.unref(a).paneMouseEnter(ae)),onPointerdown:ye[4]||(ye[4]=ae=>x.value?G(ae):t.unref(a).paneMouseMove(ae)),onPointermove:ye[5]||(ye[5]=ae=>x.value?le(ae):t.unref(a).paneMouseMove(ae)),onPointerup:ye[6]||(ye[6]=ae=>x.value?se(ae):void 0),onPointerleave:ye[7]||(ye[7]=ae=>t.unref(a).paneMouseLeave(ae))},[t.renderSlot(ue.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(uI,{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(pI,{key:1})):t.createCommentVNode("",!0)],34))}}),bI={name:"Transform",compatConfig:{MODE:3}},_I=t.defineComponent({...bI,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=tt(),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))}}),kI={name:"Viewport",compatConfig:{MODE:3}},EI=t.defineComponent({...kI,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:p,zoomOnPinch:f,zoomOnScroll:h,preventScrolling:_,noWheelClassName:g,noPanClassName:k,emits:E,connectionStartHandle:b,userSelectionActive:v,paneDragging:y,d3Zoom:S,d3Selection:$,d3ZoomHandler:O,viewport:B,viewportRef:z,paneClickDistance:T}=tt();cI(z);const x=t.shallowRef(!1),R=t.shallowRef(!1);let N=null,I=!1,C=0,U={x:0,y:0,zoom:0};const A=Ki(s),P=Ki(l),F=Ki(r),H=t.toRef(()=>(!P.value||P.value&&l.value===!0)&&(A.value||m.value)),G=t.toRef(()=>A.value||c.value),le=t.toRef(()=>l.value===!0&&H.value!==!0),se=t.toRef(()=>P.value&&l.value!==!0||v.value||le.value),ue=t.toRef(()=>b.value!==null);t.onMounted(()=>{if(!z.value){Xi("Viewport element is missing");return}const Ae=z.value,de=Ae.getBoundingClientRect(),ge=H0().clickDistance(T.value).scaleExtent([n.value,o.value]).translateExtent(a.value),_e=nn(Ae).call(ge),V=_e.on("wheel.zoom"),L=ai.translate(i.value.x??0,i.value.y??0).scale(xo(i.value.zoom??1,n.value,o.value)),j=[[0,0],[de.width,de.height]],ee=ge.constrain()(L,j,a.value);ge.transform(_e,ee),ge.wheelDelta(Ms),S.value=ge,$.value=_e,O.value=V,B.value={x:ee.x,y:ee.y,zoom:ee.k},ge.on("start",Z=>{var pe;if(!Z.sourceEvent)return null;C=Z.sourceEvent.button,x.value=!0;const me=Ie(Z.transform);((pe=Z.sourceEvent)==null?void 0:pe.type)==="mousedown"&&(y.value=!0),U=me,E.viewportChangeStart(me),E.moveStart({event:Z,flowTransform:me})}),ge.on("end",Z=>{if(!Z.sourceEvent)return null;if(x.value=!1,y.value=!1,ye(H.value,C??0)&&!I&&E.paneContextMenu(Z.sourceEvent),I=!1,ae(U,Z.transform)){const pe=Ie(Z.transform);U=pe,E.viewportChangeEnd(pe),E.moveEnd({event:Z,flowTransform:pe})}}),ge.filter(Z=>{var pe;const me=F.value||h.value,ve=f.value&&Z.ctrlKey,Ee=Z.button,W=Z.type==="wheel";if(Ee===1&&Z.type==="mousedown"&&(Pe(Z,"vue-flow__node")||Pe(Z,"vue-flow__edge")))return!0;if(!H.value&&!me&&!G.value&&!p.value&&!f.value||v.value||ue.value&&!W||!p.value&&Z.type==="dblclick"||Pe(Z,g.value)&&W||Pe(Z,k.value)&&(!W||G.value&&W&&!F.value)||!f.value&&Z.ctrlKey&&W||!me&&!G.value&&!ve&&W)return!1;if(!f&&Z.type==="touchstart"&&((pe=Z.touches)==null?void 0:pe.length)>1)return Z.preventDefault(),!1;if(!H.value&&(Z.type==="mousedown"||Z.type==="touchstart")||le.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ee===0||Array.isArray(m.value)&&!m.value.includes(Ee)&&(Z.type==="mousedown"||Z.type==="touchstart"))return!1;const J=Array.isArray(m.value)&&m.value.includes(Ee)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ee||Ee<=1;return(!Z.ctrlKey||A.value||W)&&J}),t.watch([v,H],()=>{v.value&&!x.value?ge.on("zoom",null):v.value||ge.on("zoom",Z=>{B.value={x:Z.transform.x,y:Z.transform.y,zoom:Z.transform.k};const pe=Ie(Z.transform);I=ye(H.value,C??0),E.viewportChange(pe),E.move({event:Z,flowTransform:pe})})},{immediate:!0}),t.watch([v,G,d,F,f,_,g],()=>{G.value&&!F.value&&!v.value?_e.on("wheel.zoom",Z=>{if(Pe(Z,g.value))return!1;const pe=F.value||h.value,me=f.value&&Z.ctrlKey;if(!(!_.value||G.value||pe||me))return!1;Z.preventDefault(),Z.stopImmediatePropagation();const Ee=_e.property("__zoom").k||1,W=Ji();if(!A.value&&Z.ctrlKey&&f.value&&W){const De=pn(Z),Oe=Ms(Z),ie=Ee*2**Oe;ge.scaleTo(_e,ie,De,Z);return}const J=Z.deltaMode===1?20:1;let X=d.value===ji.Vertical?0:Z.deltaX*J,he=d.value===ji.Horizontal?0:Z.deltaY*J;!W&&Z.shiftKey&&d.value!==ji.Vertical&&!X&&he&&(X=he,he=0),ge.translateBy(_e,-(X/Ee)*u.value,-(he/Ee)*u.value);const Te=Ie(_e.property("__zoom"));N&&clearTimeout(N),R.value?(E.move({event:Z,flowTransform:Te}),E.viewportChange(Te),N=setTimeout(()=>{E.moveEnd({event:Z,flowTransform:Te}),E.viewportChangeEnd(Te),R.value=!1},150)):(R.value=!0,E.moveStart({event:Z,flowTransform:Te}),E.viewportChangeStart(Te))},{passive:!1}):typeof V<"u"&&_e.on("wheel.zoom",function(Z,pe){const me=!_.value&&Z.type==="wheel"&&!Z.ctrlKey,ve=F.value||h.value,Ee=f.value&&Z.ctrlKey;if(!ve&&!c.value&&!Ee&&Z.type==="wheel"||me||Pe(Z,g.value))return null;Z.preventDefault(),V.call(this,Z,pe)},{passive:!1})},{immediate:!0})});function ye(Ae,de){return de===2&&Array.isArray(Ae)&&Ae.includes(2)}function ae(Ae,de){return Ae.x!==de.x&&!Number.isNaN(de.x)||Ae.y!==de.y&&!Number.isNaN(de.y)||Ae.zoom!==de.k&&!Number.isNaN(de.k)}function Ie(Ae){return{x:Ae.x,y:Ae.y,zoom:Ae.k}}function Pe(Ae,de){return Ae.target.closest(`.${de}`)}return(Ae,de)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:z,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(gI,{"is-selecting":se.value,"selection-key-pressed":t.unref(P),class:t.normalizeClass({connecting:ue.value,dragging:t.unref(y),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(_I,null,{default:t.withCtx(()=>[t.renderSlot(Ae.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),NI=["id"],wI=["id"],II=["id"],vI={name:"A11yDescriptions",compatConfig:{MODE:3}},CI=t.defineComponent({...vI,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=tt();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(Pf)}-${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,NI),t.createElementVNode("div",{id:`${t.unref(zf)}-${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,wI),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(W0)}-${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,II))],64))}});function SI(){const e=tt();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function xI(e,n,o){return o===$e.Left?e-n:o===$e.Right?e+n:e}function RI(e,n,o){return o===$e.Top?e-n:o===$e.Bottom?e+n:e}const Ks=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=$e.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:xI(n,e,i),cy:RI(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Ks.props=["radius","centerX","centerY","position","type"],Ks.compatConfig={MODE:3};const Vp=Ks,AI=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:p,multiSelectionActive:f,disableKeyboardA11y:h,elementsSelectable:_,edgesUpdatable:g,edgesFocusable:k,hooks:E}=tt(),b=t.computed(()=>u(e.id)),{emit:v,on:y}=vw(b.value,r),S=t.inject(Er),$=t.getCurrentInstance(),O=t.ref(!1),B=t.ref(!1),z=t.ref(""),T=t.ref(null),x=t.ref("source"),R=t.ref(null),N=t.toRef(()=>typeof b.value.selectable>"u"?_.value:b.value.selectable),I=t.toRef(()=>typeof b.value.updatable>"u"?g.value:b.value.updatable),C=t.toRef(()=>typeof b.value.focusable>"u"?k.value:b.value.focusable);t.provide(Nw,e.id),t.provide(ww,R);const U=t.computed(()=>b.value.class instanceof Function?b.value.class(b.value):b.value.class),A=t.computed(()=>b.value.style instanceof Function?b.value.style(b.value):b.value.style),P=t.computed(()=>{const L=b.value.type||"default",j=S==null?void 0:S[`edge-${L}`];if(j)return j;let ee=b.value.template??c.value[L];if(typeof ee=="string"&&$){const Z=Object.keys($.appContext.components);Z&&Z.includes(L)&&(ee=t.resolveComponent(L,!1))}return ee&&typeof ee!="string"?ee:(r.error(new vt(gt.EDGE_TYPE_MISSING,ee)),!1)}),{handlePointerDown:F}=Ep({nodeId:z,handleId:T,type:x,isValidConnection:p,edgeUpdaterType:x,onEdgeUpdate:le,onEdgeUpdateEnd:se});return()=>{const L=m(b.value.source),j=m(b.value.target),ee="pathOptions"in b.value?b.value.pathOptions:{};if(!L&&!j)return r.error(new vt(gt.EDGE_SOURCE_TARGET_MISSING,b.value.id,b.value.source,b.value.target)),null;if(!L)return r.error(new vt(gt.EDGE_SOURCE_MISSING,b.value.id,b.value.source)),null;if(!j)return r.error(new vt(gt.EDGE_TARGET_MISSING,b.value.id,b.value.target)),null;if(!b.value||b.value.hidden||L.hidden||j.hidden)return null;let Z;i.value===Mn.Strict?Z=L.handleBounds.source:Z=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const pe=lp(Z,b.value.sourceHandle);let me;i.value===Mn.Strict?me=j.handleBounds.target:me=[...j.handleBounds.target||[],...j.handleBounds.source||[]];const ve=lp(me,b.value.targetHandle),Ee=(pe==null?void 0:pe.position)||$e.Bottom,W=(ve==null?void 0:ve.position)||$e.Top,{x:J,y:X}=si(L,pe,Ee),{x:he,y:Te}=si(j,ve,W);return b.value.sourceX=J,b.value.sourceY=X,b.value.targetX=he,b.value.targetY=Te,t.h("g",{ref:R,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${P.value===!1?"default":b.value.type||"default"}`,s.value,U.value,{updating:O.value,selected:b.value.selected,animated:b.value.animated,inactive:!N.value&&!E.value.edgeClick.hasListeners()}],tabIndex:C.value?0:void 0,"aria-label":b.value.ariaLabel===null?void 0:b.value.ariaLabel??`Edge from ${b.value.source} to ${b.value.target}`,"aria-describedby":C.value?`${zf}-${n}`:void 0,"aria-roledescription":"edge",role:C.value?"group":"img",...b.value.domAttributes,onClick:ye,onContextmenu:ae,onDblclick:Ie,onMouseenter:Pe,onMousemove:Ae,onMouseleave:de,onKeyDown:C.value?V:void 0},[B.value?null:t.h(P.value===!1?c.value.default:P.value,{id:e.id,sourceNode:L,targetNode:j,source:b.value.source,target:b.value.target,type:b.value.type,updatable:I.value,selected:b.value.selected,animated:b.value.animated,label:b.value.label,labelStyle:b.value.labelStyle,labelShowBg:b.value.labelShowBg,labelBgStyle:b.value.labelBgStyle,labelBgPadding:b.value.labelBgPadding,labelBgBorderRadius:b.value.labelBgBorderRadius,data:b.value.data,events:{...b.value.events,...y},style:A.value,markerStart:`url('#${Wi(b.value.markerStart,n)}')`,markerEnd:`url('#${Wi(b.value.markerEnd,n)}')`,sourcePosition:Ee,targetPosition:W,sourceX:J,sourceY:X,targetX:he,targetY:Te,sourceHandleId:b.value.sourceHandle,targetHandleId:b.value.targetHandle,interactionWidth:b.value.interactionWidth,...ee}),[I.value==="source"||I.value===!0?[t.h("g",{onMousedown:ge,onMouseenter:H,onMouseout:G},t.h(Vp,{position:Ee,centerX:J,centerY:X,radius:a.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[t.h("g",{onMousedown:_e,onMouseenter:H,onMouseout:G},t.h(Vp,{position:W,centerX:he,centerY:Te,radius:a.value,type:"target","data-type":"target"}))]:null]])};function H(){O.value=!0}function G(){O.value=!1}function le(L,j){v.update({event:L,edge:b.value,connection:j})}function se(L){v.updateEnd({event:L,edge:b.value}),B.value=!1}function ue(L,j){L.button===0&&(B.value=!0,z.value=j?b.value.target:b.value.source,T.value=(j?b.value.targetHandle:b.value.sourceHandle)??null,x.value=j?"target":"source",v.updateStart({event:L,edge:b.value}),F(L))}function ye(L){var j;const ee={event:L,edge:b.value};N.value&&(l.value=!1,b.value.selected&&f.value?(d([b.value]),(j=R.value)==null||j.blur()):o([b.value])),v.click(ee)}function ae(L){v.contextMenu({event:L,edge:b.value})}function Ie(L){v.doubleClick({event:L,edge:b.value})}function Pe(L){v.mouseEnter({event:L,edge:b.value})}function Ae(L){v.mouseMove({event:L,edge:b.value})}function de(L){v.mouseLeave({event:L,edge:b.value})}function ge(L){ue(L,!0)}function _e(L){ue(L,!1)}function V(L){var j;!h.value&&Ff.includes(L.key)&&N.value&&(L.key==="Escape"?((j=R.value)==null||j.blur(),d([u(e.id)])):o([u(e.id)]))}}}),$I=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}=tt(),p=(e=t.inject(Er))==null?void 0:e["connection-line"],f=t.computed(()=>{var E;return m((E=i.value)==null?void 0:E.nodeId)}),h=t.computed(()=>{var E;return m((E=a.value)==null?void 0:E.nodeId)??null}),_=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),g=t.computed(()=>c.value.markerStart?`url(#${Wi(c.value.markerStart,n)})`:""),k=t.computed(()=>c.value.markerEnd?`url(#${Wi(c.value.markerEnd,n)})`:"");return()=>{var E,b,v;if(!f.value||!i.value)return null;const y=i.value.id,S=i.value.type,$=f.value.handleBounds;let O=($==null?void 0:$[S])??[];if(o.value===Mn.Loose){const A=($==null?void 0:$[S==="source"?"target":"source"])??[];O=[...O,...A]}if(!O)return null;const B=(y?O.find(A=>A.id===y):O[0])??null,z=(B==null?void 0:B.position)??$e.Top,{x:T,y:x}=si(f.value,B,z);let R=null;h.value&&(o.value===Mn.Strict?R=((E=h.value.handleBounds[S==="source"?"target":"source"])==null?void 0:E.find(A=>{var P;return A.id===((P=a.value)==null?void 0:P.id)}))||null:R=((b=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:b.find(A=>{var P;return A.id===((P=a.value)==null?void 0:P.id)}))||null);const N=((v=a.value)==null?void 0:v.position)??(z?Ps[z]:null);if(!z||!N)return null;const I=l.value??c.value.type??So.Bezier;let C="";const U={sourceX:T,sourceY:x,sourcePosition:z,targetX:_.value.x,targetY:_.value.y,targetPosition:N};return I===So.Bezier?[C]=xp(U):I===So.Step?[C]=js({...U,borderRadius:0}):I===So.SmoothStep?[C]=js(U):I===So.SimpleBezier?[C]=Ap(U):C=`M${T},${x} ${_.value.x},${_.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:T,sourceY:x,sourcePosition:z,targetX:_.value.x,targetY:_.value.y,targetPosition:N,sourceNode:f.value,sourceHandle:B,targetNode:h.value,targetHandle:R,markerEnd:k.value,markerStart:g.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":k.value,"marker-start":g.value})))}}}),TI=["id","markerWidth","markerHeight","markerUnits","orient"],MI={name:"MarkerType",compatConfig:{MODE:3}},VI=t.defineComponent({...MI,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(As).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(As).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,TI))}}),LI={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},BI={name:"MarkerDefinitions",compatConfig:{MODE:3}},DI=t.defineComponent({...BI,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=tt(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Wi(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",LI,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(VI,{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))])]))}}),OI={name:"Edges",compatConfig:{MODE:3}},PI=t.defineComponent({...OI,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=tt();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(DI),(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(dw)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(AI),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref($I))],64))}}),zI=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:p,elevateNodesOnSelect:f,disableKeyboardA11y:h,ariaLiveMessage:_,snapToGrid:g,snapGrid:k,nodeDragThreshold:E,nodesDraggable:b,elementsSelectable:v,nodesConnectable:y,nodesFocusable:S,hooks:$}=tt(),O=t.ref(null);t.provide(_p,O),t.provide(bp,e.id);const B=t.inject(Er),z=t.getCurrentInstance(),T=wp(),{node:x,parentNode:R}=Np(e.id),{emit:N,on:I}=Rw(x,l),C=t.toRef(()=>typeof x.draggable>"u"?b.value:x.draggable),U=t.toRef(()=>typeof x.selectable>"u"?v.value:x.selectable),A=t.toRef(()=>typeof x.connectable>"u"?y.value:x.connectable),P=t.toRef(()=>typeof x.focusable>"u"?S.value:x.focusable),F=t.computed(()=>U.value||C.value||$.value.nodeClick.hasListeners()||$.value.nodeDoubleClick.hasListeners()||$.value.nodeMouseEnter.hasListeners()||$.value.nodeMouseMove.hasListeners()||$.value.nodeMouseLeave.hasListeners()),H=t.toRef(()=>!!x.dimensions.width&&!!x.dimensions.height),G=t.computed(()=>{const j=x.type||"default",ee=B==null?void 0:B[`node-${j}`];if(ee)return ee;let Z=x.template||m.value[j];if(typeof Z=="string"&&z){const pe=Object.keys(z.appContext.components);pe&&pe.includes(j)&&(Z=t.resolveComponent(j,!1))}return Z&&typeof Z!="string"?Z:(l.error(new vt(gt.NODE_TYPE_MISSING,Z)),!1)}),le=kp({id:e.id,el:O,disabled:()=>!C.value,selectable:U,dragHandle:()=>x.dragHandle,onStart(j){N.dragStart(j)},onDrag(j){N.drag(j)},onStop(j){N.dragStop(j)},onClick(j){V(j)}}),se=t.computed(()=>x.class instanceof Function?x.class(x):x.class),ue=t.computed(()=>{const j=(x.style instanceof Function?x.style(x):x.style)||{},ee=x.width instanceof Function?x.width(x):x.width,Z=x.height instanceof Function?x.height(x):x.height;return!j.width&&ee&&(j.width=typeof ee=="string"?ee:`${ee}px`),!j.height&&Z&&(j.height=typeof Z=="string"?Z:`${Z}px`),j}),ye=t.toRef(()=>Number(x.zIndex??ue.value.zIndex??0));return u(j=>{(j.includes(e.id)||!j.length)&&Ie()}),t.onMounted(()=>{t.watch(()=>x.hidden,(j=!1,ee,Z)=>{!j&&O.value&&(e.resizeObserver.observe(O.value),Z(()=>{O.value&&e.resizeObserver.unobserve(O.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>x.type,()=>x.sourcePosition,()=>x.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:O.value,forceUpdate:!0}])})}),t.watch([()=>x.position.x,()=>x.position.y,()=>{var j;return(j=R.value)==null?void 0:j.computedPosition.x},()=>{var j;return(j=R.value)==null?void 0:j.computedPosition.y},()=>{var j;return(j=R.value)==null?void 0:j.computedPosition.z},ye,()=>x.selected,()=>x.dimensions.height,()=>x.dimensions.width,()=>{var j;return(j=R.value)==null?void 0:j.dimensions.height},()=>{var j;return(j=R.value)==null?void 0:j.dimensions.width}],([j,ee,Z,pe,me,ve])=>{const Ee={x:j,y:ee,z:ve+(f.value&&x.selected?1e3:0)};typeof Z<"u"&&typeof pe<"u"?x.computedPosition=iw({x:Z,y:pe,z:me},Ee):x.computedPosition=Ee},{flush:"post",immediate:!0}),t.watch([()=>x.extent,p],([j,ee],[Z,pe])=>{(j!==Z||ee!==pe)&&ae()}),x.extent==="parent"||typeof x.extent=="object"&&"range"in x.extent&&x.extent.range==="parent"?ss(()=>H).toBe(!0).then(ae):ae(),()=>x.hidden?null:t.h("div",{ref:O,"data-id":x.id,class:["vue-flow__node",`vue-flow__node-${G.value===!1?"default":x.type||"default"}`,{[o.value]:C.value,dragging:le==null?void 0:le.value,draggable:C.value,selected:x.selected,selectable:U.value,parent:x.isParent},se.value],style:{visibility:H.value?"visible":"hidden",zIndex:x.computedPosition.z??ye.value,transform:`translate(${x.computedPosition.x}px,${x.computedPosition.y}px)`,pointerEvents:F.value?"all":"none",...ue.value},tabIndex:P.value?0:void 0,role:P.value?"group":void 0,"aria-describedby":h.value?void 0:`${Pf}-${n}`,"aria-label":x.ariaLabel,"aria-roledescription":"node",...x.domAttributes,onMouseenter:Pe,onMousemove:Ae,onMouseleave:de,onContextmenu:ge,onClick:V,onDblclick:_e,onKeydown:L},[t.h(G.value===!1?m.value.default:G.value,{id:x.id,type:x.type,data:x.data,events:{...x.events,...I},selected:x.selected,resizing:x.resizing,dragging:le.value,connectable:A.value,position:x.computedPosition,dimensions:x.dimensions,isValidTargetPos:x.isValidTargetPos,isValidSourcePos:x.isValidSourcePos,parent:x.parentNode,parentNodeId:x.parentNode,zIndex:x.computedPosition.z??ye.value,targetPosition:x.targetPosition,sourcePosition:x.sourcePosition,label:x.label,dragHandle:x.dragHandle,onUpdateNodeInternals:Ie})]);function ae(){const j=x.computedPosition,{computedPosition:ee,position:Z}=Bs(x,g.value?kr(j,k.value):j,l.error,p.value,R.value);(x.computedPosition.x!==ee.x||x.computedPosition.y!==ee.y)&&(x.computedPosition={...x.computedPosition,...ee}),(x.position.x!==Z.x||x.position.y!==Z.y)&&(x.position=Z)}function Ie(){O.value&&d([{id:e.id,nodeElement:O.value,forceUpdate:!0}])}function Pe(j){le!=null&&le.value||N.mouseEnter({event:j,node:x})}function Ae(j){le!=null&&le.value||N.mouseMove({event:j,node:x})}function de(j){le!=null&&le.value||N.mouseLeave({event:j,node:x})}function ge(j){return N.contextMenu({event:j,node:x})}function _e(j){return N.doubleClick({event:j,node:x})}function V(j){U.value&&(!i.value||!C.value||E.value>0)&&zs(x,r.value,c,s,a,!1,O.value),N.click({event:j,node:x})}function L(j){if(!($s(j)||h.value))if(Ff.includes(j.key)&&U.value){const ee=j.key==="Escape";zs(x,r.value,c,s,a,ee,O.value)}else C.value&&x.selected&&ri[j.key]&&(j.preventDefault(),_.value=`Moved selected node ${j.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~x.position.x}, y: ${~~x.position.y}`,T({x:ri[j.key].x,y:ri[j.key].y},j.shiftKey))}}});function FI(e={includeHiddenNodes:!1}){const{nodes:n}=tt();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 UI={class:"vue-flow__nodes vue-flow__container"},HI={name:"Nodes",compatConfig:{MODE:3}},jI=t.defineComponent({...HI,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=tt(),a=FI(),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",UI,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(zI),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=p,f},s,0),128)):t.createCommentVNode("",!0)]))}});function KI(){const{emits:e}=tt();t.onMounted(()=>{if(mp()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new vt(gt.MISSING_STYLES))}})}const GI=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),YI={name:"VueFlow",compatConfig:{MODE:3}},qI=t.defineComponent({...YI,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=cs(i,"modelValue",o),l=cs(i,"nodes",o),s=cs(i,"edges",o),c=tt(i),d=Mw({modelValue:r,nodes:l,edges:s},i,c);return Lw(o,c.hooks),SI(),KI(),t.provide(Er,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(EI,null,{default:t.withCtx(()=>[t.createVNode(PI),GI,t.createVNode(jI),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(CI)],512))}}),WI={name:"Panel",compatConfig:{MODE:3}},Lp=t.defineComponent({...WI,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=tt(),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))}}),JI=["width","height","innerHTML"],XI=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(t.openBlock(),t.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:n[e.name]??""},null,8,JI))}}),Qe=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},xe=Qe(XI,[["__scopeId","data-v-05aac699"]]),To=["red","amber","green","teal","blue","indigo","violet","pink"],Bp={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function ZI(e){return typeof e=="string"&&e in Bp}const QI={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},ev=.15;function tv(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 nv(e){if(typeof e!="string")return null;const n=tv(e);if(!n||n.s<ev)return null;let o=null,i=1/0;for(const a of To){const r=Math.abs(n.h-QI[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function Vt(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(ZI(n))return n;const o=e==null?void 0:e.properties;return nv((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Gs(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const ov={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)"},iv={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 Dp(e,n=!1){return e?n?iv[e]:ov[e]:null}function Mo(e){return Bp[e]}function ci(e){return`var(--em-swatch-${e}-bar)`}function av(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 rv(e,n){const o=av(n);return o?e(o):n.split("-")[1]??n}function lv(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";case"CHK-TYPE-8":return"em.check.type8";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function Op(e,n){const o=lv(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 sv(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const cv={class:"em-inline-issue__msgs"},Vo=Qe(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(xe,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",cv,[(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(Op)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),dv=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],uv={key:0,class:"em-mlang__dot"},mv=["id","role","aria-labelledby"],fv=["title"],Jt=Qe(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const k=o.defaultLang;return k&&o.languages.includes(k)?k:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const k=o.activeLang;return k&&o.languages.includes(k)?k:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(k){var E,b;return!!((b=(E=o.modelValue)==null?void 0:E[k])!=null&&b.trim())}const d=k=>`${o.name}-tab-${k}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(k){var v,y;const E=o.languages,b=E[(k+E.length)%E.length];b&&(l.value=b,await t.nextTick(),(y=(v=m.value)==null?void 0:v.querySelectorAll('[role="tab"]')[E.indexOf(b)])==null||y.focus())}function f(k){p(o.languages.indexOf(s.value)+k)}const h=t.computed(()=>o.languages.filter(k=>{var E,b;return k!==s.value&&!!((b=(E=o.modelValue)==null?void 0:E[k])!=null&&b.trim())})),_=t.computed(()=>{var k;return((k=o.modelValue)==null?void 0:k[s.value])??""});function g(k){const E={...o.modelValue};k.trim()===""?delete E[s.value]:E[s.value]=k,i("update:modelValue",E)}return(k,E)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,b=>(t.openBlock(),t.createElementBlock("span",{id:d(b),key:b,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===b}]),role:"tab","aria-selected":s.value===b,"aria-controls":u.value,tabindex:s.value===b?0:-1,onClick:v=>l.value=b,onKeydown:[t.withKeys(t.withModifiers(v=>l.value=b,["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>l.value=b,["prevent"]),["space"]),E[0]||(E[0]=t.withKeys(t.withModifiers(v=>f(-1),["prevent"]),["left"])),E[1]||(E[1]=t.withKeys(t.withModifiers(v=>f(1),["prevent"]),["right"])),E[2]||(E[2]=t.withKeys(t.withModifiers(v=>p(0),["prevent"]),["home"])),E[3]||(E[3]=t.withKeys(t.withModifiers(v=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(b),1),c(b)?(t.openBlock(),t.createElementBlock("span",uv,"•")):t.createCommentVNode("",!0)],42,dv))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(te.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":_.value,"onUpdate:modelValue":g},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":_.value,"onUpdate:modelValue":g},null,8,["name","placeholder","model-value"]))],8,mv),r.value&&h.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:h.value.join(", "),"aria-hidden":"true"},"•",8,fv)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),pv=["disabled"],hv={class:"em-panel__sub-label"},yv={class:"em-field"},gv={class:"em-field"},bv={class:"em-field"},_v={key:0,class:"em-field"},kv={class:"em-field"},Ev={class:"em-class"},Nv={class:"em-field"},wv={class:"em-field"},Iv={key:1,class:"em-attr__navhint"},vv={key:2,class:"em-field"},Cv={key:3,class:"em-field"},Sv={class:"em-multilang"},xv={class:"em-multilang"},Rv={key:4,class:"em-jpa"},Av={class:"em-field"},$v={class:"em-field"},Tv={class:"em-field"},Mv=["title"],Vv={class:"em-swatch"},Lv={class:"em-swatch__row"},Bv=["title"],Dv=["title","onClick"],Pp=Qe(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(H=>H.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(H=>H.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var H;return Vt(((H=l.value)==null?void 0:H.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","SERIALIZED_TYPE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=["none","LIST","SET","MAP"],u=t.computed(()=>{var H,G;return((G=(H=r.value)==null?void 0:H.serialization)==null?void 0:G.collectionType)??"none"});function m(H){return H==="none"?a.t("em.entity.serializedContainerNone"):H}function p(H){var se,ue;const G=H==="none"?void 0:H,le=G==="MAP"?(ue=(se=r.value)==null?void 0:se.serialization)==null?void 0:ue.mapKeyType:void 0;E({serialization:G?{collectionType:G,...le?{mapKeyType:le}:{}}:null})}function f(H){var le,se;((se=(le=r.value)==null?void 0:le.serialization)==null?void 0:se.collectionType)==="MAP"&&E({serialization:{collectionType:"MAP",...H.trim()?{mapKeyType:H.trim()}:{}}})}const h=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],_=["inherit","STRING","CHAR","INTEGER"],g=H=>H;function k(H){return H==="inherit"?a.t("em.common.inherit"):H}function E(H){r.value&&a.updateEntity(r.value.modelId,H)}function b(H,G,le){var ue;const se=((ue=r.value)==null?void 0:ue.table)??{physicalName:""};E(H==="physicalName"?{table:{...se,physicalName:le}}:{table:{...se,logicalName:{...se.logicalName,[G]:le}}})}const v=t.computed(()=>{var H;return cn(((H=r.value)==null?void 0:H.stereotype)??"UNDEFINED")});function y(H){var le,se,ue;const G=v.value?(le=r.value)==null?void 0:le.classLogicalName:(ue=(se=r.value)==null?void 0:se.table)==null?void 0:ue.logicalName;return(G==null?void 0:G[H])??""}function S(H,G){var ue;if(!v.value)return b("logicalName",H,G);const le={...(ue=r.value)==null?void 0:ue.classLogicalName,[H]:G},se=Object.fromEntries(Object.entries(le).filter(([,ye])=>ye!=null&&String(ye).trim()!==""));E({classLogicalName:Object.keys(se).length?se:void 0})}function $(H){E({description:Object.keys(H).length?H:void 0})}function O(H,G){var le;E({jpaAttrs:{...(le=r.value)==null?void 0:le.jpaAttrs,[H]:G}})}function B(H,G){O(H,G)}const z=t.computed(()=>{var H,G;return((G=(H=r.value)==null?void 0:H.jpaAttrs)==null?void 0:G.discriminatorType)??"inherit"}),T=t.computed(()=>{var H,G;return!((G=(H=r.value)==null?void 0:H.jpaAttrs)!=null&&G.useDiscriminator)});function x(H){O("discriminatorType",H==="inherit"?void 0:H)}function R(H){E({hasPersonalInfo:H})}function N(H){E({referenceOnly:H?!0:void 0})}function I(H){E({superClass:H.trim()||void 0})}function C(H){E({schema:H.trim()||void 0})}function U(H){E({abstractClass:H})}const A=t.computed(()=>{var H,G;return((G=(H=r.value)==null?void 0:H.declarationOfInterfaces)==null?void 0:G.join(", "))??""});function P(H){const G=H.split(",").map(le=>le.trim()).filter(Boolean);E({declarationOfInterfaces:G.length?G:void 0})}function F(H){r.value&&a.setEntitySwatch(r.value.modelId,H)}return(H,G)=>{var le,se,ue,ye;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:G[0]||(G[0]=ae=>i("toggle"))},[t.createElementVNode("span",hv,[t.createVNode(xe,{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(Vo,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",yv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":G[1]||(G[1]=ae=>E({name:ae}))},null,8,["model-value"])]),t.createElementVNode("label",gv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":g,"label-provider":t.unref(yi),"onUpdate:modelValue":G[2]||(G[2]=ae=>E({stereotype:ae}))},null,8,["model-value","label-provider"])]),r.value.stereotype==="SERIALIZED_TYPE"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",bv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.serializedContainer")),1),t.createVNode(t.unref(te.BSSelect),{name:"ent-ser-container","model-value":u.value,items:d,"value-provider":g,"label-provider":m,"onUpdate:modelValue":G[3]||(G[3]=ae=>ae&&p(ae))},null,8,["model-value"])]),u.value==="MAP"?(t.openBlock(),t.createElementBlock("label",_v,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.serializedMapKey")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-ser-mapkey",width:"100%",placeholder:t.unref(a).t("em.entity.serializedMapKeyPlaceholder"),"model-value":((le=r.value.serialization)==null?void 0:le.mapKeyType)??"","onUpdate:modelValue":f},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("label",kv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":G[4]||(G[4]=ae=>E({packageName:ae}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Ev,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Nv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":G[5]||(G[5]=ae=>I(ae))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",wv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":A.value,"onUpdate:modelValue":G[6]||(G[6]=ae=>P(ae))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":G[7]||(G[7]=ae=>U(ae))},null,8,["label","model-value"])]),t.unref(at)(r.value.stereotype)?(t.openBlock(),t.createElementBlock("p",Iv,t.toDisplayString(t.unref(a).t("em.entity.noOwnTableNote")),1)):(t.openBlock(),t.createElementBlock("label",vv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-table",width:"100%","model-value":((se=r.value.table)==null?void 0:se.physicalName)??"","onUpdate:modelValue":G[8]||(G[8]=ae=>b("physicalName",null,ae))},null,8,["model-value"])])),t.unref(cn)(r.value.stereotype)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",Cv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":G[9]||(G[9]=ae=>C(ae))},null,8,["placeholder","model-value"])])),t.createElementVNode("fieldset",Sv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t(v.value?"em.entity.classLogicalLegend":"em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,ae=>(t.openBlock(),t.createElementBlock("label",{key:ae,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(ae),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${ae}`,width:"100%","model-value":y(ae),"onUpdate:modelValue":Ie=>S(ae,Ie)},null,8,["name","model-value","onUpdate:modelValue"])]))),128))]),t.createElementVNode("fieldset",xv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":$},null,8,["languages","default-lang","model-value"])]),t.unref(cn)(r.value.stereotype)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",Rv,[G[14]||(G[14]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(h,ae=>{var Ie;return t.createVNode(t.unref(te.BSCheckbox),{key:ae.key,name:`jpa-${ae.key}`,class:"em-check",label:ae.label,"model-value":!!((Ie=r.value.jpaAttrs)!=null&&Ie[ae.key]),"onUpdate:modelValue":Pe=>B(ae.key,Pe)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Av,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(te.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:T.value,"model-value":((ue=r.value.jpaAttrs)==null?void 0:ue.discriminatorColumnName)??"","onUpdate:modelValue":G[10]||(G[10]=ae=>O("discriminatorColumnName",ae.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",$v,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(te.BSSelect),{disabled:T.value,"model-value":z.value,items:_,"value-provider":g,"label-provider":k,"onUpdate:modelValue":G[11]||(G[11]=ae=>ae&&x(ae))},null,8,["disabled","model-value"])]),t.createElementVNode("label",Tv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(te.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:T.value,"model-value":(ye=r.value.jpaAttrs)==null?void 0:ye.discriminatorLength,"onUpdate:modelValue":G[12]||(G[12]=ae=>O("discriminatorLength",ae||void 0))},null,8,["disabled","model-value"])])])),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":R},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(te.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":N},null,8,["label","model-value"])],8,Mv),t.createElementVNode("fieldset",Vv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",Lv,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:G[13]||(G[13]=ae=>F(null))},"∅",10,Bv),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),ae=>(t.openBlock(),t.createElementBlock("button",{key:ae,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===ae}]),style:t.normalizeStyle({background:t.unref(ci)(ae)}),title:t.unref(a).t(t.unref(Mo)(ae)),onClick:Ie=>F(ae)},null,14,Dv))),128))])])],64)):t.createCommentVNode("",!0)],8,pv)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-e5c28fb1"]]),Ov=["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"],Ys=["inherit","true","false"],Rr="__OWN__";function zp(e,n){const o=t.computed(()=>e.state.logical.entities.find(K=>K.modelId===n())??null),i=t.computed(()=>{var K;return at(((K=o.value)==null?void 0:K.stereotype)??"UNDEFINED")}),a=t.computed(()=>{var K;return cn(((K=o.value)==null?void 0:K.stereotype)??"UNDEFINED")}),r=t.computed(()=>new Set(e.selectedAttrIds.value));function l(K){return K==="none"?e.t("em.common.noneParen"):K}const s=K=>K;function c(K,oe){o.value&&e.updateAttribute(o.value.modelId,K.modelId,oe)}const d=t.computed(()=>nl(e.state.logical.associations));function u(K){if(!o.value)return;const oe=po(e.state.logical,o.value.modelId,K.modelId);return oe&&$a(K,oe)?oe:void 0}function m(K){return!!u(K)}function p(K){return m(K)?K.derivedIdFieldName??"":K.name??""}function f(K){const oe=u(K);if(!oe)return e.t("em.attr.namePlaceholder");const Me=new Map(e.state.logical.entities.map(ze=>[ze.modelId,ze]));return Tl({...K,derivedIdFieldName:void 0},oe,Me)||e.t("em.attr.namePlaceholder")}function h(K,oe){m(K)?c(K,{derivedIdFieldName:oe||void 0}):c(K,{name:oe})}function _(K){return K.name??""}function g(K,oe){c(K,{name:oe})}function k(K){return!!o.value&&ol(K,o.value,d.value)}function E(K){var ze,Ct;const oe=(ze=K.derivedFrom)==null?void 0:ze.associationRef,Me=(Ct=o.value)==null?void 0:Ct.attributes.find(Tt=>{var Ue;return Tt.attrType==="RELATION_OWN"&&((Ue=Tt.derivedFrom)==null?void 0:Ue.associationRef)===oe&&d.value.has(Tt.modelId)});return e.t("em.attr.joinColumnOnlyNote",{anchor:(Me==null?void 0:Me.name)||e.t("em.attr.nameless")})}function b(K){return!!o.value&&!!po(e.state.logical,o.value.modelId,K.modelId)}function v(K,oe){c(K,{naturalId:oe||void 0,naturalIdMutable:oe?K.naturalIdMutable:void 0})}function y(){return{naturalId:void 0,naturalIdMutable:void 0}}function S(K,oe){c(K,{identifier:oe,...oe?y():{}})}function $(K,oe){c(K,{transient:oe||void 0,...oe?y():{}})}const O=["none","LIST","SET"];function B(K,oe){c(K,{collectionType:oe==="none"?void 0:oe})}function z(K){return!!K.transient||K.attrType==="RELATION_REF"}function T(K){return fa(K)}function x(K,oe=0){var Me;return((Me=pa(K,o.value,e.state.logical.entities,e.state.logical.associations,oe))==null?void 0:Me.physicalName)||void 0}function R(K){const oe=ul(K);return oe==="association"||oe==="derived"||!!K.groupCode}const N=K=>K.value,I=K=>K.label;function C(K,oe){if(!oe)return;if(o.value&&Wc(K,oe,e.embeddableCatalog.value)){e.convertAttributeType(o.value.modelId,K.modelId,oe);return}const Me=Pe.value.find(ze=>ze.type===oe);if(Me){const ze=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};c(K,{type:oe,customType:void 0,dbAttrs:[Jc(ze,Me)]});return}c(K,oe===dn?{type:oe}:{type:oe,customType:void 0})}function U(K,oe){c(K,{customType:oe.trim()===""?void 0:oe})}function A(K,oe){if(K.attrType==="RELATION_REF")return;const ze={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...oe};oe.dataType!==void 0&&!sl.has(ze.dataType)&&(ze.scale=void 0),c(K,{dbAttrs:[ze]})}function P(K){var oe;return sl.has(((oe=K.dbAttrs[0])==null?void 0:oe.dataType)??"")}function F(K){return!P(K)&&!T(K)&&!z(K)?e.t("em.attr.scaleTypeHint"):void 0}function H(K,oe){A(K,{logicalName:Object.keys(oe).length?oe:void 0})}function G(K,oe){c(K,{fieldLogicalName:Object.keys(oe).length?oe:void 0})}function le(K){var oe;return a.value?K.fieldLogicalName:(oe=K.dbAttrs[0])==null?void 0:oe.logicalName}function se(K,oe){a.value?G(K,oe):H(K,oe)}function ue(K,oe){const Me=e.t("em.attr.logicalPlaceholder"),ze=K.dbAttrs[0];if(a.value||!ze)return Me;const Ct=Bt(K,ze,0,o.value??void 0,e.state.logical,{embeddableCatalog:e.embeddableCatalog.value}).logicalName;return Mt(Ct,oe)??Me}function ye(K,oe){c(K,{description:Object.keys(oe).length?oe:void 0})}function ae(K){return K.personalInfoAttributeType??"none"}function Ie(K,oe){c(K,{personalInfoAttributeType:oe==="none"?void 0:oe})}const Pe=t.computed(()=>e.predefinedCustomTypeCatalog.value),Ae=t.computed(()=>[...Ho(e.state.logical).keys()].sort()),de=t.computed(()=>e.embeddableCatalog.value);function ge(K){return Mt(K.label,e.userLanguage.value)??K.type}const _e=t.computed(()=>e.groupCodeCatalog.value);function V(K){var oe;return((oe=_e.value.find(Me=>Me.groupCode===K.groupCode))==null?void 0:oe.codes)??[]}function L(K){return["none",...V(K)]}function j(K){return K==="none"?"none":K.code}function ee(K){if(K==="none")return e.t("em.common.noneParen");const oe=Mt(K.label,e.userLanguage.value);return oe?`${K.code} (${oe})`:K.code}function Z(K,oe){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,oe)}function pe(K,oe){c(K,{defaultValue:oe==="none"?void 0:oe})}function me(K,oe){c(K,{defaultValue:oe.trim()===""?void 0:oe})}function ve(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}const Ee=Nn;function W(K){return ve(K)||Ee(K)}function J(K,oe,Me){const ze=K.dbAttrs.map((Ct,Tt)=>{if(Tt!==oe)return Ct;const Ue={...Ct,...Me};for(const M of Object.keys(Me))Me[M]===void 0&&delete Ue[M];return Ue});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,ze)}function X(K,oe,Me){J(K,oe,{logicalName:Object.keys(Me).length?Me:void 0})}function he(K,oe){var Ct,Tt,Ue;if(Ee(K)){const M=pa(K,o.value,e.state.logical.entities,e.state.logical.associations,oe);return M?{physicalName:M.physicalName,dataType:M.dataType,length:M.length,scale:M.scale,logicalName:M.logicalName}:void 0}if(K.attrType==="EMBED_PREDEF"){const M=(Ct=e.embeddableCatalog.value.find(w=>w.type===K.type))==null?void 0:Ct.fields[oe];return M?{name:M.name,physicalName:M.physicalName,dataType:M.dataType,length:M.length,scale:M.scale,shareable:M.shareable,logicalName:M.logicalName}:void 0}const Me=(Tt=K.embedded)==null?void 0:Tt.embeddableRef;if(!Me)return;const ze=(Ue=e.state.logical.entities.find(M=>M.modelId===Me))==null?void 0:Ue.attributes.flatMap(M=>M.dbAttrs)[oe];return ze?{physicalName:ze.physicalName,dataType:ze.dataType,length:ze.length,scale:ze.scale,logicalName:ze.logicalName}:void 0}function Te(K,oe){var Me,ze;return((Me=he(K,oe))==null?void 0:Me.dataType)||((ze=K.dbAttrs[oe])==null?void 0:ze.dataType)||""}function De(K,oe){var Me,ze;return((Me=he(K,oe))==null?void 0:Me.length)??((ze=K.dbAttrs[oe])==null?void 0:ze.length)}function Oe(K,oe){var Me,ze;return((Me=he(K,oe))==null?void 0:Me.scale)??((ze=K.dbAttrs[oe])==null?void 0:ze.scale)}function ie(K){return e.t(Ee(K)?"em.attr.fkFixedHint":"em.attr.embedFixedHint")}const Ne=Ys;function Ye(K){return K==="inherit"?e.t("em.common.inherit"):K}function it(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function Q(K,oe,Me){J(K,oe,{updatable:Me==="inherit"?void 0:Me==="true"})}function ce(K,oe){A(K,{updatable:oe==="inherit"?void 0:oe==="true"})}const je=Ys;function lt(K){return K==="inherit"?e.t("em.common.inherit"):K}function Xe(K){return(K==null?void 0:K.notNull)===void 0||(K==null?void 0:K.notNull)===null?"inherit":K.notNull?"true":"false"}function _t(K,oe,Me){J(K,oe,{notNull:Me==="inherit"?void 0:Me==="true"})}const st=Ys;function kt(K){return K==="inherit"?e.t("em.common.inherit"):K}function Et(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function On(K,oe,Me){J(K,oe,{insertable:Me==="inherit"?void 0:Me==="true"})}function En(K,oe){A(K,{insertable:oe==="inherit"?void 0:oe==="true"})}const Nt=t.computed(()=>o.value?rl(o.value,e.state.logical.entities):[]),ft=t.computed(()=>lo(Nt.value.flatMap(K=>K.attributes.flatMap(oe=>oe.dbAttrs)))),ht=t.computed(()=>Nt.value.flatMap(K=>K.attributes.filter(oe=>oe.attrType==="NORMAL"&&oe.dbAttrs.length===1&&oe.dbAttrs[0]).map(oe=>{var Me;return{modelId:oe.dbAttrs[0].modelId,physical:oe.dbAttrs[0].physicalName||oe.name,isCurrency:oe.type==="Currency",ownerName:K.modelId===((Me=o.value)==null?void 0:Me.modelId)?void 0:K.name}})));function St(){const K=[...ht.value].sort((oe,Me)=>Number(Me.isCurrency)-Number(oe.isCurrency));return[Rr,...K.map(oe=>oe.modelId)]}function Pn(K){if(K===Rr)return e.t("em.attr.sharedOwn");const oe=ht.value.find(ze=>ze.modelId===K);if(!oe)return K;const Me=oe.ownerName?`${oe.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:Me,physical:oe.physical,mode:oe.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function ut(K){return(K==null?void 0:K.sharedColumnRef)??Rr}function Be(K,oe,Me){J(K,oe,{sharedColumnRef:Me===Rr?void 0:Me})}function q(K){return(K==null?void 0:K.sharedColumnRef)!=null}function Gt(K){var oe;return((oe=so(K,ft.value))==null?void 0:oe.physicalName)??""}return{SERIALIZED_FIELD_CONTAINERS:O,setCollectionType:B,entity:o,isValueType:i,isColumnless:a,focusedAttrIds:r,personalInfoItems:Ov,piiLabel:l,idn:s,setAttr:c,isDerivedIdRow:m,rowName:p,rowNamePlaceholder:f,setRowName:h,assocFieldName:_,setAssocFieldName:g,nameLocked:k,nameLockedHint:E,isManagedFk:b,setNaturalId:v,clearNaturalIdPatch:y,setIdentifier:S,setTransient:$,dbLocked:z,fkDerived:T,fkOriginPhysical:x,typeLocked:R,typeValueOf:N,typeLabelOf:I,setAttrType:C,setAttrCustomType:U,setDb:A,scaleApplicable:P,scaleHint:F,setDbLogical:H,setAttrLogical:G,logicalNameOf:le,setLogicalName:se,setAttrDescription:ye,attrPiiValue:ae,setAttrPii:Ie,predefinedCustomTypeCatalog:Pe,serializedTypeNames:Ae,embeddableCatalog:de,predefinedLabel:ge,groupCodeCatalog:_e,attrGroupCodes:V,attrCodeItems:L,codeValueOf:j,codeLabelOf:ee,setAttrGroupCode:Z,setAttrCode:pe,setAttrDefaultValue:me,isEmbedExpanded:ve,isMultiColFk:Ee,hasColumnSlots:W,setDbAt:J,setDbLogicalAt:X,logicalPlaceholder:ue,colSlotMeta:he,fixedDataType:Te,fixedLength:De,fixedScale:Oe,slotFixedHint:ie,updatableItems:Ne,updatableLabel:Ye,updatableValue:it,setUpdatableAt:Q,setUpdatable:ce,insertableItems:st,insertableLabel:kt,insertableValue:Et,setInsertableAt:On,notNullItems:je,notNullLabel:lt,notNullValue:Xe,setNotNullAt:_t,setInsertable:En,scopeEntities:Nt,columnsById:ft,sharedCandidates:ht,sharedItems:St,sharedLabel:Pn,sharedValue:ut,setSharedAt:Be,isShared:q,sharedPhysical:Gt}}const Fp={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.classLogicalLegend":"Class logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.fkFixedHint":"Inherited from the parent PK column — its shape follows the parent.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.derivedIdField":"Derived @Id field","em.attr.assocField":"Association field (@MapsId)","em.attr.derivedIdNote":"This attribute emits **two Java fields** — the name box above is the scalar @Id field (leave empty to derive it from the parent PK column), and this is the @MapsId association field. The same value is also editable from the relationship inspector.","em.attr.joinColumnOnlyNote":"Sibling column of a composite foreign key — JPA emits one field per association, so this name is never generated. Edit the field name on «{anchor}».","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.attr.embedConvertPkBlocked":"An identifier attribute cannot be converted to an embeddable with a different column count — changing the PK shape breaks child FKs that mirror it","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.fkChildCols":"Composite foreign key — {n} columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.connectHintNode":"Drag to connect a relationship (anchored to the whole entity)","em.node.derivedIdRow":"Scalar @Id field emitted by a derived identifier (@MapsId). The model stores a single association attribute; edit it from that attribute’s inspector.","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every sub-column in this entity","em.node.embedAllShow":"Expand all collapsed sub-columns","em.node.embedAllSummary":"{n} sub-column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.entity.valueTypeSwitchEmbedded":'"{name}" is currently embedded by {owners} entit(y/ies), so it cannot be switched directly between a serialized type and an embeddable — remove the embedded attributes first (a serialized type is referenced by type, not by a relation)',"em.attr.serializedNoColumnNote":"A serialized type has no per-field physical columns — it is serialized whole into a single column on the consuming attribute","em.attr.serializedContainer":"Container","em.attr.serializedContainerNone":"None (single value)","em.entity.noOwnTableNote":"A value type has no table of its own — an embeddable is flattened into the owner table, and a serialized type is serialized into a single column on the consuming attribute","em.entity.serializedTypeHasRelations":'"{name}" participates in {count} relationship(s), so it cannot be turned into a serialized type — remove those relationships first (a serialized type is referenced by an attribute type, not by a relationship)',"em.entity.serializedContainer":"Container","em.entity.serializedContainerNone":"none (single value)","em.entity.serializedMapKey":"Map key type","em.entity.serializedMapKeyPlaceholder":"e.g. PromoType (unset → codegen emits a placeholder Object + fill-in)","em.entity.noIndexNote":"A serialized type cannot have indexes — an index is placed on columns, and this type is serialized whole into a single column on the consuming attribute","em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'A value type (embeddable / 직렬화 타입) cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","em.check.type8":"A nullable column ({dataType}) is mapped to a primitive type ({type}) — reading a NULL from the DB throws at load time. Mark it NOT NULL or switch to the boxed type ({boxed})","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},Up={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.classLogicalLegend":"クラス論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.fkFixedHint":"親のPKカラムから継承された値です — 形状は親に従います。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.derivedIdField":"派生識別 @Id フィールド","em.attr.assocField":"関連フィールド名(@MapsId)","em.attr.derivedIdNote":"この属性は**2つの Java フィールド**を出力します — 上の名前欄はスカラー @Id のフィールド名(空欄なら親 PK の物理名から派生)で、こちらは @MapsId 関連フィールド名です。同じ値は関連線のインスペクタからも編集できます。","em.attr.joinColumnOnlyNote":"複合外部キーの兄弟カラムです — JPAのフィールドは関連ごとに1つだけなので、この名前は出力されません。フィールド名は«{anchor}»で編集してください。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.attr.embedConvertPkBlocked":"識別子属性は列数が変わる埋め込み型には変換できません — PK の形が変わると、それを写す子の FK が崩れます","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.fkChildCols":"複合外部キー — カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.connectHintNode":"ドラッグして関連を接続(エンティティ全体を始点に)","em.node.derivedIdRow":"派生識別(@MapsId)が出力するスカラー @Id フィールドです — モデルには関連属性ひとつとして保存され、編集はその属性のインスペクタで行います。","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティのサブカラムをすべて折りたたむ","em.node.embedAllShow":"折りたたまれたサブカラムをすべて展開","em.node.embedAllSummary":"サブカラム {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.entity.valueTypeSwitchEmbedded":'"{name}" は現在 {owners} 件のエンティティに組み込まれているため、シリアライズ型と組込み可能の間を直接切り替えられません — 先に組込み属性を整理してください(シリアライズ型は関係ではなく型参照で指定されます)',"em.attr.serializedNoColumnNote":"シリアライズ型はフィールドごとの物理カラムを持ちません — 利用側属性の単一カラムにまとめてシリアライズされます","em.attr.serializedContainer":"コンテナ","em.attr.serializedContainerNone":"なし (単一値)","em.entity.noOwnTableNote":"値型は自身のテーブルを持ちません — 組込み可能は所有者テーブルに展開され、シリアライズ型は利用側属性の単一カラムにシリアライズされます","em.entity.serializedTypeHasRelations":'"{name}" は {count} 件の関連に参加しているためシリアライズ型に変更できません — 先に関連を整理してください(シリアライズ型は関係ではなく属性の型参照で指定されます)',"em.entity.serializedContainer":"コンテナ","em.entity.serializedContainerNone":"なし(単一値)","em.entity.serializedMapKey":"Map キー型","em.entity.serializedMapKeyPlaceholder":"例: PromoType(未指定ならコード生成が仮の Object + 手入力箇所を出す)","em.entity.noIndexNote":"シリアライズ型はインデックスを持てません — インデックスはカラムに張られますが、この型は利用側属性の単一カラムにまとめてシリアライズされます","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'値型(組込み可能・シリアライズ型)は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","em.check.type8":"NULL 許容カラム({dataType})がプリミティブ型({type})にマッピングされています — DB の NULL を読み込んだ瞬間に例外が発生します。NOT NULL を指定するか、ボックス型({boxed})に変更してください","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},Hp={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.classLogicalLegend":"클래스 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.fkFixedHint":"부모 PK 컬럼에서 상속된 값입니다 — 형상은 부모를 따릅니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.derivedIdField":"파생 식별 @Id 필드","em.attr.assocField":"연관 필드명(@MapsId)","em.attr.derivedIdNote":"이 속성은 **두 Java 필드**를 냅니다 — 위 이름 칸은 스칼라 @Id 필드명(비우면 부모 PK 물리명에서 파생)이고, 여기는 @MapsId 연관 필드명입니다. 같은 값을 관계선 인스펙터에서도 편집할 수 있습니다.","em.attr.joinColumnOnlyNote":"복합 외래키의 형제 컬럼입니다 — JPA 필드는 관계당 하나뿐이라 이 이름은 방출되지 않습니다. 필드명은 «{anchor}»에서 편집하세요.","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.attr.embedConvertPkBlocked":"식별자 속성은 컬럼 개수가 바뀌는 임베더블로 전환할 수 없습니다 — PK 형상이 바뀌면 이 PK를 참조하는 자식 FK가 함께 어긋납니다","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.fkChildCols":"복합 외래키 — 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.connectHintNode":"드래그해 관계 연결 (이 엔티티 전체를 시작점으로)","em.node.derivedIdRow":"파생 식별(@MapsId)이 방출하는 스칼라 @Id 필드입니다 — 모델에는 연관 속성 하나로 저장되며, 편집은 그 속성의 인스펙터에서 합니다.","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 서브컬럼 모두 접기","em.node.embedAllShow":"접힌 서브컬럼 모두 펼치기","em.node.embedAllSummary":"서브컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.entity.valueTypeSwitchEmbedded":'"{name}"은(는) 현재 {owners}개 엔티티에 임베드되어 있어 직렬화 타입/임베더블 사이를 바로 전환할 수 없습니다 — 임베드 속성을 먼저 정리한 뒤 전환하세요(직렬화 타입은 관계가 아니라 타입 참조로 지목됩니다)',"em.attr.serializedNoColumnNote":"직렬화 타입은 필드별 물리 컬럼이 없습니다 — 소비 속성의 컬럼 하나에 통째로 직렬화됩니다","em.attr.serializedContainer":"컨테이너","em.attr.serializedContainerNone":"없음 (단일 값)","em.entity.noOwnTableNote":"값 타입은 자체 테이블이 없습니다 — 임베더블은 소유자 테이블로 펼쳐지고, 직렬화 타입은 소비 속성의 컬럼 하나에 직렬화됩니다","em.entity.serializedTypeHasRelations":'"{name}"은(는) 연관관계 {count}개에 참여 중이라 직렬화 타입으로 바꿀 수 없습니다 — 연관을 먼저 정리하세요(직렬화 타입은 관계가 아니라 소비 속성의 타입 참조로 지목됩니다)',"em.entity.serializedContainer":"컨테이너","em.entity.serializedContainerNone":"없음 (단일 값)","em.entity.serializedMapKey":"Map 키 타입","em.entity.serializedMapKeyPlaceholder":"예: PromoType (미지정 시 코드젠이 임시 Object + 손채움)","em.entity.noIndexNote":"직렬화 타입은 인덱스를 가질 수 없습니다 — 인덱스는 컬럼에 걸리는데 이 타입은 소비 속성의 컬럼 하나에 통째로 직렬화됩니다","em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'값 타입(임베더블·직렬화 타입)은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","em.check.type8":"NULL 허용 컬럼({dataType})이 원시 타입({type})에 매핑됩니다 — DB의 NULL 을 읽는 순간 예외가 납니다. NOT NULL 을 지정하거나 박싱 타입({boxed})으로 바꾸세요","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},Pv=["ko","en","ja"],qs={ko:Hp,en:Fp,ja:Up};function rn(e,n,o){let a=(qs[e]??qs.ko)[n]??qs.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const jp=["ko","en","ja","zh"];function zv(e){if(e)for(const n of jp){const o=e[n];if(o)return o}}function Ws(e){const n=zv(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function Fv(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:jp.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const Uv=["aria-expanded","placeholder"],Hv=["aria-selected","onClick","onMouseenter"],jv={key:0,class:"gcc__opt gcc__opt--empty"},Kp=Qe(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(B,z)=>rn(o.locale??"ko",B,z),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),p=t.computed(()=>o.items.find(B=>B.groupCode===o.modelValue)),f=t.computed(()=>p.value?Ws(p.value):"");t.watch(f,B=>{d.value||(c.value=B)},{immediate:!0});const h=t.computed(()=>c.value===f.value?o.items:Fv(o.items,c.value));function _(){var z;const B=(z=r.value)==null?void 0:z.getBoundingClientRect();B&&(m.value={left:`${B.left}px`,top:`${B.bottom}px`,width:`${B.width}px`})}function g(){d.value=!0,_(),u.value=Math.max(0,h.value.findIndex(B=>B.groupCode===o.modelValue)),window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),document.addEventListener("mousedown",O)}function k(){d.value=!1,window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_),document.removeEventListener("mousedown",O)}t.onBeforeUnmount(k);function E(){g(),t.nextTick(()=>{var B;return(B=l.value)==null?void 0:B.select()})}function b(){d.value||g(),u.value=0}function v(B){i("update:modelValue",B.groupCode),c.value=Ws(B),k()}function y(){i("update:modelValue",void 0),c.value="",k()}function S(){c.value.trim()===""?y():(c.value=f.value,k())}function $(B){var z;if(B.key==="ArrowDown")d.value||g(),u.value=Math.min(u.value+1,h.value.length-1),B.preventDefault();else if(B.key==="ArrowUp")u.value=Math.max(u.value-1,0),B.preventDefault();else if(B.key==="Enter"){const T=h.value[u.value];T&&v(T),B.preventDefault()}else B.key==="Escape"&&(c.value=f.value,k(),(z=l.value)==null||z.blur())}function O(B){var T,x;const z=B.target;!((T=r.value)!=null&&T.contains(z))&&!((x=s.value)!=null&&x.contains(z))&&S()}return(B,z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":z[0]||(z[0]=T=>c.value=T),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:E,onInput:b,onKeydown:$},null,40,Uv),[[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:z[1]||(z[1]=t.withModifiers(()=>{},["prevent"])),onClick:y},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,(T,x)=>(t.openBlock(),t.createElementBlock("li",{key:T.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":x===u.value,"is-selected":T.groupCode===e.modelValue}]),role:"option","aria-selected":T.groupCode===e.modelValue,onMousedown:z[2]||(z[2]=t.withModifiers(()=>{},["prevent"])),onClick:R=>v(T),onMouseenter:R=>u.value=x},t.toDisplayString(t.unref(Ws)(T)),43,Hv))),128)),h.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",jv,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),Kv=["aria-labelledby"],Gv=["aria-checked","tabindex","onClick","onKeydown"],Gp=Qe(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,Gv))),128))],8,Kv))}}),[["__scopeId","data-v-5c793bbb"]]),Yv=["disabled"],qv={class:"em-aw__toolbar"},Wv={class:"em-aw__count"},Jv={class:"em-aw__scroll"},Xv={class:"em-aw__table"},Zv={class:"c-name"},Qv={class:"c-type"},eC={class:"c-logical"},tC=["id"],nC={class:"c-col"},oC={class:"c-constraints"},iC={class:"c-del"},aC={class:"c-expand"},rC=["title","onClick","onKeydown"],lC=["title"],sC=["title"],cC={key:1,class:"em-aw__muted"},dC=["title"],uC=["title"],mC=["title"],fC=["title"],pC={class:"em-aw__cflags"},hC=["title"],yC={key:0,class:"em-aw__embed-col"},gC={class:"em-aw__embed-label"},bC=["title"],_C={colspan:"8"},kC={class:"em-aw__detail"},EC={class:"em-aw__dgroup"},NC=["title"],wC={class:"em-aw__df"},IC={class:"em-aw__df"},vC={class:"em-aw__dgroup"},CC={key:0,class:"em-aw__dgroup"},SC={class:"em-aw__df"},xC={key:0,class:"em-aw__df"},RC={class:"em-aw__df"},AC={class:"em-aw__dgroup em-aw__ddesc"},$C={class:"c-expand"},TC=["title","onClick","onKeydown"],MC={key:1,class:"em-aw__caret is-static","aria-hidden":"true"},VC=["title"],LC=["title"],BC=["colspan"],DC=["title"],OC={class:"em-aw__cflags"},PC=["title"],zC={colspan:"8"},FC={class:"em-aw__detail"},UC={class:"em-aw__dgroup em-aw__ddesc"},HC={class:"c-expand"},jC=["title","onClick","onKeydown"],KC={class:"em-aw__embed-label"},GC=["title"],YC=["title"],qC={class:"em-aw__ro"},WC=["title"],JC={class:"em-aw__ro"},XC=["title"],ZC={class:"em-aw__ro"},QC={key:0,class:"em-aw__detail-row em-aw__embed-detail"},eS={colspan:"8"},tS={class:"em-aw__detail"},nS={class:"em-aw__dgroup"},oS={key:0,class:"em-aw__df"},iS={class:"em-aw__df"},aS={class:"em-aw__df"},rS={key:0},lS={colspan:"99",class:"em-aw__empty"},sS=6,Yp=5,cS=Qe(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isValueType:a,isColumnless:r,focusedAttrIds:l,personalInfoItems:s,piiLabel:c,idn:d,logicalNameOf:u,setLogicalName:m,logicalPlaceholder:p,SERIALIZED_FIELD_CONTAINERS:f,setCollectionType:h,setAttr:_,isDerivedIdRow:g,rowName:k,rowNamePlaceholder:E,setRowName:b,assocFieldName:v,setAssocFieldName:y,nameLocked:S,nameLockedHint:$,isManagedFk:O,setNaturalId:B,setIdentifier:z,setTransient:T,dbLocked:x,fkDerived:R,fkOriginPhysical:N,typeLocked:I,typeValueOf:C,typeLabelOf:U,setAttrType:A,setAttrCustomType:P,setDb:F,scaleApplicable:H,scaleHint:G,attrPiiValue:le,setAttrPii:se,predefinedCustomTypeCatalog:ue,serializedTypeNames:ye,embeddableCatalog:ae,predefinedLabel:Ie,groupCodeCatalog:Pe,attrGroupCodes:Ae,attrCodeItems:de,codeValueOf:ge,codeLabelOf:_e,setAttrGroupCode:V,setAttrCode:L,setAttrDefaultValue:j,setAttrDescription:ee,hasColumnSlots:Z,isMultiColFk:pe,setDbAt:me,setDbLogicalAt:ve,colSlotMeta:Ee,fixedDataType:W,fixedLength:J,fixedScale:X,slotFixedHint:he,updatableItems:Te,updatableLabel:De,updatableValue:Oe,setUpdatableAt:ie,setUpdatable:Ne,insertableItems:Ye,insertableLabel:it,insertableValue:Q,setInsertableAt:ce,setInsertable:je,sharedItems:lt,sharedLabel:Xe,sharedValue:_t,setSharedAt:st,isShared:kt,sharedPhysical:Et}=zp(o,()=>n.entityId),On=t.computed(()=>{var ut;return[...((ut=i.value)==null?void 0:ut.attributes)??[]].sort((Be,q)=>Be.order-q.order)}),En=t.computed(()=>{var ut;return(((ut=i.value)==null?void 0:ut.attributes)??[]).filter(Be=>Be.attrType!=="DIVIDER").length}),Nt=t.ref(new Set);function ft(ut){return Nt.value.has(ut)}function ht(ut){const Be=new Set(Nt.value);Be.has(ut)?Be.delete(ut):Be.add(ut),Nt.value=Be}const St=t.ref(o.userLanguage.value);function Pn(ut){!ut||!i.value||o.addPredefinedEmbed(i.value.modelId,ut)}return(ut,Be)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",qv,[t.createElementVNode("span",Wv,t.toDisplayString(t.unref(o).t("em.attr.section",{n:En.value})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Be[0]||(Be[0]=q=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:Be[1]||(Be[1]=q=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(ae).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(ae),"value-provider":q=>q.type,"label-provider":t.unref(Ie),"onUpdate:modelValue":Pn},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Jv,[t.createElementVNode("table",Xv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[Be[3]||(Be[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",Zv,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",Qv,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",eC,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,tC),t.createVNode(Gp,{modelValue:St.value,"onUpdate:modelValue":Be[2]||(Be[2]=q=>St.value=q),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",nC,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),Be[4]||(Be[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),Be[5]||(Be[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",oC,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),Be[6]||(Be[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(On.value,q=>{var Gt,K,oe,Me,ze,Ct,Tt,Ue,M;return t.openBlock(),t.createElementBlock(t.Fragment,{key:q.modelId},[q.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(l).has(q.modelId)}])},[Be[7]||(Be[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-divlabel-${q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":q.name,"onUpdate:modelValue":w=>t.unref(_)(q,{name:w})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:sS,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",iC,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeAttribute(t.unref(i).modelId,q.modelId)},null,8,["onClick"])])],2)):t.unref(Z)(q)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(l).has(q.modelId)}])},[t.createElementVNode("td",$C,[t.unref(pe)(q)?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["em-aw__caret",{"is-open":ft(q.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(q.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:w=>ht(q.modelId),onKeydown:[t.withKeys(t.withModifiers(w=>ht(q.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(w=>ht(q.modelId),["prevent"]),["space"])]},[t.createVNode(xe,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,TC)):(t.openBlock(),t.createElementBlock("span",MC,[t.createVNode(xe,{name:"chevron",size:14,class:"em-aw__caret-ic"})]))]),t.createElementVNode("td",{title:t.unref(S)(q)?t.unref($)(q):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${q.modelId}`,width:"100%",disabled:t.unref(S)(q),placeholder:t.unref(E)(q),"model-value":t.unref(k)(q),"onUpdate:modelValue":w=>t.unref(b)(q,w)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,VC),t.createElementVNode("td",{title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${q.modelId}`,width:"100%",disabled:"","model-value":q.type},null,8,["name","model-value"])],8,LC),t.createElementVNode("td",{colspan:t.unref(pe)(q)?Yp-1:Yp,class:"em-aw__embed-note"},t.toDisplayString(t.unref(pe)(q)?t.unref(o).t("em.attr.fkChildCols",{n:q.dbAttrs.length}):t.unref(o).t("em.attr.embedChildCols",{n:q.dbAttrs.length})),9,BC),t.unref(pe)(q)?(t.openBlock(),t.createElementBlock("td",{key:0,class:"c-constraints",title:t.unref(o).t("em.attr.fkDerivedNote")},[t.createElementVNode("div",OC,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${q.modelId}`,label:"PK","model-value":q.identifier,disabled:"","onUpdate:modelValue":w=>t.unref(z)(q,w)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${q.modelId}`,label:"NN","model-value":q.notNull,disabled:"","onUpdate:modelValue":w=>t.unref(_)(q,{notNull:w})},null,8,["name","model-value","onUpdate:modelValue"])])],8,DC)):t.createCommentVNode("",!0),t.createElementVNode("td",{class:"c-del",title:t.unref(O)(q)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeAttribute(t.unref(i).modelId,q.modelId)},null,8,["onClick"])],8,PC)],2),t.unref(pe)(q)&&ft(q.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(l).has(q.modelId)}])},[Be[15]||(Be[15]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",zC,[t.createElementVNode("div",FC,[t.createElementVNode("fieldset",UC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`aw-desc-${q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":q.description,"onUpdate:modelValue":w=>t.unref(ee)(q,w)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(q.dbAttrs,(w,ne)=>{var ke,Ce,Ve,Ke,He;return t.openBlock(),t.createElementBlock(t.Fragment,{key:w.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":ft(w.modelId)}])},[t.createElementVNode("td",HC,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ft(w.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(w.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:fe=>ht(w.modelId),onKeydown:[t.withKeys(t.withModifiers(fe=>ht(w.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(fe=>ht(w.modelId),["prevent"]),["space"])]},[t.createVNode(xe,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,jC)]),t.createElementVNode("td",KC,"↳ "+t.toDisplayString(((ke=t.unref(Ee)(q,ne))==null?void 0:ke.name)??((Ce=t.unref(Ee)(q,ne))==null?void 0:Ce.physicalName)??t.unref(o).t("em.attr.colFallback",{n:ne+1})),1),Be[16]||(Be[16]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(Jt,{name:`aw-embed-logical-${w.modelId}`,languages:t.unref(o).languages.value,"active-lang":St.value,placeholder:t.unref(Mt)((Ve=t.unref(Ee)(q,ne))==null?void 0:Ve.logicalName,St.value)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":w.logicalName,"onUpdate:modelValue":fe=>t.unref(ve)(q,ne,fe)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(kt)(w)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-embed-col-${w.modelId}`,width:"100%",disabled:t.unref(kt)(w),placeholder:((Ke=t.unref(Ee)(q,ne))==null?void 0:Ke.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(kt)(w)?t.unref(Et)(w):w.physicalName,"onUpdate:modelValue":fe=>t.unref(me)(q,ne,{physicalName:fe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":w.modelId},null,8,["controller","ref-id"])],8,GC),t.createElementVNode("td",{title:t.unref(he)(q)},[t.createElementVNode("span",qC,t.toDisplayString(t.unref(W)(q,ne)),1)],8,YC),t.createElementVNode("td",{title:t.unref(he)(q)},[t.createElementVNode("span",JC,t.toDisplayString(t.unref(J)(q,ne)??""),1)],8,WC),t.createElementVNode("td",{class:"c-constraints",title:t.unref(he)(q)},[t.createElementVNode("span",ZC,t.toDisplayString(t.unref(X)(q,ne)!=null?`scale ${t.unref(X)(q,ne)}`:""),1)],8,XC),Be[17]||(Be[17]=t.createElementVNode("td",null,null,-1))],2),ft(w.modelId)?(t.openBlock(),t.createElementBlock("tr",QC,[Be[20]||(Be[20]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",eS,[t.createElementVNode("div",tS,[t.createElementVNode("fieldset",nS,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(He=t.unref(Ee)(q,ne))!=null&&He.shareable?(t.openBlock(),t.createElementBlock("label",oS,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(_t)(w),items:t.unref(lt)(),"value-provider":t.unref(d),"label-provider":t.unref(Xe),"onUpdate:modelValue":fe=>fe&&t.unref(st)(q,ne,fe)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",iS,[Be[18]||(Be[18]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(kt)(w),"model-value":t.unref(kt)(w)?"false":t.unref(Q)(w),items:t.unref(Ye),"value-provider":t.unref(d),"label-provider":t.unref(it),"onUpdate:modelValue":fe=>fe&&t.unref(ce)(q,ne,fe)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",aS,[Be[19]||(Be[19]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(kt)(w),"model-value":t.unref(kt)(w)?"false":t.unref(Oe)(w),items:t.unref(Te),"value-provider":t.unref(d),"label-provider":t.unref(De),"onUpdate:modelValue":fe=>fe&&t.unref(ie)(q,ne,fe)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(l).has(q.modelId),"em-aw__open":ft(q.modelId)})},[t.createElementVNode("td",aC,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ft(q.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(q.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:w=>ht(q.modelId),onKeydown:[t.withKeys(t.withModifiers(w=>ht(q.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(w=>ht(q.modelId),["prevent"]),["space"])]},[t.createVNode(xe,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,rC)]),t.createElementVNode("td",{title:t.unref(S)(q)?t.unref($)(q):t.unref(g)(q)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${q.modelId}`,width:"100%",disabled:t.unref(S)(q),placeholder:t.unref(E)(q),"model-value":t.unref(k)(q),"onUpdate:modelValue":w=>t.unref(b)(q,w)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,lC),t.createElementVNode("td",{title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:t.unref(I)(q),items:t.unref(qc)(q.type,t.unref(ue),t.unref(ye),t.unref(ae)),"value-provider":t.unref(C),"label-provider":t.unref(U),"model-value":q.type,"onUpdate:modelValue":w=>t.unref(A)(q,w)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),q.type===t.unref(dn)&&!t.unref(R)(q)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":q.customType??"","onUpdate:modelValue":w=>t.unref(P)(q,w)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,sC),t.createElementVNode("td",null,[q.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Jt,{key:0,name:`aw-logical-${q.modelId}`,languages:t.unref(o).languages.value,"active-lang":St.value,placeholder:t.unref(p)(q,St.value),"model-value":t.unref(u)(q),"onUpdate:modelValue":w=>t.unref(m)(q,w)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",cC,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${q.modelId}`,width:"100%",placeholder:t.unref(N)(q)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(r)||t.unref(x)(q),"model-value":((Gt=q.dbAttrs[0])==null?void 0:Gt.physicalName)??"","onUpdate:modelValue":w=>t.unref(F)(q,{physicalName:w})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":(K=q.dbAttrs[0])==null?void 0:K.modelId},null,8,["controller","ref-id"])]),t.unref(r)?(t.openBlock(),t.createElementBlock("td",{key:0,title:t.unref(o).t("em.attr.serializedNoColumnNote")},[t.createVNode(t.unref(te.BSSelect),{name:`aw-container-${q.modelId}`,width:"100%",items:[...t.unref(f)],"value-provider":t.unref(d),"label-provider":w=>w==="none"?t.unref(o).t("em.attr.serializedContainerNone"):w,"model-value":q.collectionType??"none","onUpdate:modelValue":w=>w&&t.unref(h)(q,w)},null,8,["name","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,dC)):(t.openBlock(),t.createElementBlock("td",{key:1,title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${q.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(x)(q)||t.unref(R)(q),items:t.unref(Uc)(((oe=q.dbAttrs[0])==null?void 0:oe.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(d),"label-provider":t.unref(ll),"model-value":((Me=q.dbAttrs[0])==null?void 0:Me.dataType)??"","onUpdate:modelValue":w=>w&&t.unref(F)(q,{dataType:w})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,uC)),t.createElementVNode("td",{title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${q.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(x)(q)||t.unref(R)(q),"model-value":(ze=q.dbAttrs[0])==null?void 0:ze.length,"onUpdate:modelValue":w=>t.unref(F)(q,{length:w||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,mC),t.createElementVNode("td",{class:"c-constraints",title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",pC,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${q.modelId}`,label:"PK","model-value":q.identifier,disabled:t.unref(a)||t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(z)(q,w)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${q.modelId}`,label:"NN","model-value":t.unref(r)?!1:q.notNull,disabled:t.unref(r)||t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(_)(q,{notNull:w})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${q.modelId}`,label:"UQ","model-value":!!((Ct=q.dbAttrs[0])!=null&&Ct.unique),disabled:t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(F)(q,{unique:w})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,fC),t.createElementVNode("td",{class:"c-del",title:t.unref(O)(q)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeAttribute(t.unref(i).modelId,q.modelId)},null,8,["onClick"])],8,hC)],2),t.unref(g)(q)?(t.openBlock(),t.createElementBlock("tr",yC,[Be[8]||(Be[8]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",gC,"↳ "+t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("td",{colspan:"7",title:t.unref(o).t("em.attr.derivedIdNote")},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-assocname-${q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(v)(q),"onUpdate:modelValue":w=>t.unref(y)(q,w)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,bC)])):t.createCommentVNode("",!0),ft(q.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(l).has(q.modelId)}])},[Be[14]||(Be[14]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",_C,[t.createElementVNode("div",kC,[t.createElementVNode("fieldset",EC,[Be[12]||(Be[12]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(G)(q)},[Be[9]||(Be[9]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${q.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(x)(q)||t.unref(R)(q)||!t.unref(H)(q),"model-value":(Tt=q.dbAttrs[0])==null?void 0:Tt.scale,"onUpdate:modelValue":w=>t.unref(F)(q,{scale:w||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,NC),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${q.modelId}`,label:"Auto Increment","model-value":!!((Ue=q.dbAttrs[0])!=null&&Ue.autoIncrement),disabled:t.unref(x)(q)||t.unref(R)(q)||!q.identifier,"onUpdate:modelValue":w=>t.unref(F)(q,{autoIncrement:w})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",wC,[Be[10]||(Be[10]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${q.modelId}`,width:"110px",disabled:t.unref(x)(q),"model-value":t.unref(Q)(q.dbAttrs[0]),items:t.unref(Ye),"value-provider":t.unref(d),"label-provider":t.unref(it),"onUpdate:modelValue":w=>w&&t.unref(je)(q,w)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",IC,[Be[11]||(Be[11]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${q.modelId}`,width:"110px",disabled:t.unref(x)(q),"model-value":t.unref(Oe)(q.dbAttrs[0]),items:t.unref(Te),"value-provider":t.unref(d),"label-provider":t.unref(De),"onUpdate:modelValue":w=>w&&t.unref(Ne)(q,w)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",vC,[Be[13]||(Be[13]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${q.modelId}`,label:"@Transient","model-value":!!q.transient,disabled:q.identifier||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(T)(q,w)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${q.modelId}`,label:"@NaturalId","model-value":!!q.naturalId,disabled:q.identifier||t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(B)(q,w)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${q.modelId}`,label:"mutable","model-value":!!q.naturalIdMutable,disabled:t.unref(x)(q)||!q.naturalId,"onUpdate:modelValue":w=>t.unref(_)(q,{naturalIdMutable:w||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${q.modelId}`,label:"Multi-Value (Set)","model-value":!!((M=q.dbAttrs[0])!=null&&M.multiValue),disabled:t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(F)(q,{multiValue:w||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(R)(q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",CC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",SC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(le)(q),items:t.unref(s),"value-provider":t.unref(d),"label-provider":t.unref(c),"onUpdate:modelValue":w=>w&&t.unref(se)(q,w)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(Pe).length?(t.openBlock(),t.createElementBlock("label",xC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Kp,{"model-value":q.groupCode,items:t.unref(Pe),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":w=>t.unref(V)(q,w)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",RC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(Ae)(q).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":q.defaultValue??"none",items:t.unref(de)(q),"value-provider":t.unref(ge),"label-provider":t.unref(_e),"onUpdate:modelValue":w=>w&&t.unref(L)(q,w)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`aw-default-${q.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":q.defaultValue??"","onUpdate:modelValue":w=>t.unref(j)(q,w)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",AC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`aw-desc-${q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":q.description,"onUpdate:modelValue":w=>t.unref(ee)(q,w)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",rS,[t.createElementVNode("td",lS,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,Yv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-472632d9"]]);function Js(e,n){return n&&n!==e?`${e} (${n})`:e}function qp(e,n,o){const i=e.dbAttrs[n];return i?bi(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function dS(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):Js(o,qp(e,0,n))}function Xs(e,n){var l;if(ao(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?Js(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return Js(i,qp(o,r<0?0:r,n))}function Wp(e){const n=[];for(const o of e.entity.attributes??[]){const i=o.dbAttrs.filter(a=>!a.sharedColumnRef);if(i.length!==0){if(o.dbAttrs.length===1){n.push({ref:o.modelId,label:dS(o,e)});continue}for(const a of i)n.push({ref:a.modelId,label:Xs(a.modelId,e)})}}return n}const uS=["disabled"],mS={class:"em-idxw__list"},fS={class:"em-idxw__list-head"},pS=["aria-label"],hS=["aria-current","onClick","onKeydown"],yS={class:"em-idxw__item-name"},gS={key:0,class:"em-idxw__badge"},bS={class:"em-idxw__item-cnt"},_S={key:0,class:"em-idxw__empty"},kS={key:0,class:"em-idxw__edit"},ES={class:"em-idxw__form"},NS={class:"em-field em-idxw__name"},wS={class:"em-field"},IS=["value","placeholder"],vS={class:"em-idxw__transfer"},CS={class:"em-idxw__pane"},SS={class:"em-idxw__pane-head"},xS=["aria-label"],RS=["aria-pressed","onClick","onKeydown"],AS=["title"],$S={key:0,class:"em-idxw__empty"},TS={class:"em-idxw__arrows"},MS={class:"em-idxw__pane"},VS={class:"em-idxw__pane-head"},LS={class:"em-idxw__col-name"},BS=["title"],DS={class:"em-idxw__col-ops"},OS=["title","disabled","onClick"],PS=["title","disabled","onClick"],zS=["title","onClick"],FS={key:0,class:"em-idxw__empty"},US={key:1,class:"em-idxw__edit em-idxw__edit--empty"},HS=Qe(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(R=>R.modelId===n.entityId)??null),a=t.computed(()=>{var R;return((R=i.value)==null?void 0:R.indexes)??[]}),r=t.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,R=>{var N;R.some(I=>I.modelId===s.value)||(s.value=((N=R[0])==null?void 0:N.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(R=>R.modelId===s.value)??null),d=t.computed(()=>i.value?gi(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>io(r.value)),m=R=>u.value.canon(R),p=t.computed(()=>{var R;return new Set((((R=c.value)==null?void 0:R.columns)??[]).map(N=>m(N.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function h(R){return R.physicalName&&R.physicalName!==R.field?`${R.field} (${R.physicalName})`:R.field}function _(R){return Xs(R,f.value)}const g=t.computed(()=>[...Wp(f.value).filter(R=>!p.value.has(m(R.ref))).map(R=>({ref:R.ref,label:R.label,inherited:!1})),...d.value.filter(R=>!p.value.has(m(R.modelId))).map(R=>({ref:R.modelId,label:h(R),inherited:!0}))]),k=t.ref(new Set);t.watch(s,()=>k.value=new Set);function E(R){return ao(R)}function b(R,N){i.value&&o.updateIndex(i.value.modelId,R,N)}function v(){var N;if(!i.value)return;const R=Le();o.addIndex(i.value.modelId,{modelId:R,name:`idx_${(((N=i.value.indexes)==null?void 0:N.length)??0)+1}`,unique:!1,columns:[]}),s.value=R}function y(R){i.value&&o.removeIndex(i.value.modelId,R)}function S(R){c.value&&b(c.value.modelId,{parameters:R.trim()===""?void 0:R})}function $(R){const N=new Set(k.value);N.has(R)?N.delete(R):N.add(R),k.value=N}function O(){const R=c.value;if(!R||!k.value.size)return;const N=[...k.value].map(I=>({columnRef:I,descending:!1}));b(R.modelId,{columns:[...R.columns,...N]}),k.value=new Set}function B(R){const N=c.value;N&&b(N.modelId,{columns:N.columns.filter((I,C)=>C!==R)})}function z(R,N){const I=c.value;I&&b(I.modelId,{columns:I.columns.map((C,U)=>U===R?{...C,descending:N}:C)})}function T(R,N){const I=c.value;if(!I)return;const C=R+N;if(C<0||C>=I.columns.length)return;const U=[...I.columns];[U[R],U[C]]=[U[C],U[R]],b(I.modelId,{columns:U}),x(C,N)}async function x(R,N){var P,F;await t.nextTick();const I=(P=l.value)==null?void 0:P.querySelectorAll(".em-idxw__col--idx")[R];if(!I)return;const C=H=>I.querySelector(`[data-move="${H}"]`),U=C(N<0?"up":"down"),A=C(N<0?"down":"up");(F=U&&!U.disabled?U:A)==null||F.focus()}return(R,N)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",mS,[t.createElementVNode("div",fS,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:v},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":I.modelId===s.value}]),role:"button",tabindex:"0","aria-current":I.modelId===s.value?"true":void 0,onClick:C=>s.value=I.modelId,onKeydown:[t.withKeys(t.withModifiers(C=>s.value=I.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(C=>s.value=I.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",yS,t.toDisplayString(I.name||t.unref(o).t("em.attr.nameless")),1),I.unique?(t.openBlock(),t.createElementBlock("span",gS,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",bS,t.toDisplayString(I.columns.length),1)],42,hS))),128))],8,pS),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",_S,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",kS,[t.createElementVNode("div",ES,[t.createElementVNode("label",NS,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":N[0]||(N[0]=I=>b(c.value.modelId,{name:I}))},null,8,["model-value"]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":N[1]||(N[1]=I=>b(c.value.modelId,{unique:I}))},null,8,["model-value"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:N[2]||(N[2]=I=>y(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",wS,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:N[3]||(N[3]=I=>S(I.target.value))},null,40,IS)]),t.createElementVNode("div",vS,[t.createElementVNode("div",CS,[t.createElementVNode("div",SS,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:g.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:g.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":k.value.has(I.ref)}]),role:"button",tabindex:"0","aria-pressed":k.value.has(I.ref),onClick:C=>$(I.ref),onKeydown:[t.withKeys(t.withModifiers(C=>$(I.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(C=>$(I.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(I.label),1),I.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,AS)):t.createCommentVNode("",!0)],42,RS))),128))],8,xS),g.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",$S,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",TS,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!k.value.size,onClick:O},null,8,["caption","disabled"])]),t.createElementVNode("div",MS,[t.createElementVNode("div",VS,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(I,C)=>(t.openBlock(),t.createElementBlock("li",{key:C,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",LS,[t.createTextVNode(t.toDisplayString(_(I.columnRef)),1),E(I.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,BS)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${C}`,class:"em-check",label:"DESC","model-value":I.descending,"onUpdate:modelValue":U=>z(C,U)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",DS,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:C===0,onClick:U=>T(C,-1)},"↑",8,OS),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:C===c.value.columns.length-1,onClick:U=>T(C,1)},"↓",8,PS),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:U=>B(C)},"✕",8,zS)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",FS,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",US,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,uS)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-76dd7610"]]),jS={class:"em-op-src"},KS=["placeholder"],GS={class:"em-op-src__actions"},Jp=Qe(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(l,s)=>rn(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",jS,[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,KS),[[t.vModelText,a.value]]),t.createElementVNode("div",GS,[t.createVNode(t.unref(te.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),YS=["disabled"],qS={class:"em-ow__toolbar"},WS={class:"em-ow__count"},JS={class:"em-ow__scroll"},XS={class:"em-ow__table"},ZS={class:"c-name"},QS={class:"c-desc"},ex=["id"],tx={class:"c-pii"},nx={class:"c-src"},ox={class:"c-del"},ix={key:0},ax={colspan:"6",class:"em-ow__empty"},rx=Qe(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModal(),a=t.computed(()=>o.state.logical.entities.find(g=>g.modelId===n.entityId)??null),r=t.computed(()=>{var g;return[...((g=a.value)==null?void 0:g.operations)??[]].sort((k,E)=>k.order-E.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(g){return g==="none"?o.t("em.common.noneParen"):g}const u=g=>g;function m(g,k){a.value&&o.updateOperation(a.value.modelId,g.modelId,k)}function p(g,k){m(g,{description:Object.keys(k).length?k:void 0})}function f(g){return g.personalInfoAttributeType??"none"}function h(g,k){m(g,{personalInfoAttributeType:k==="none"?void 0:k})}function _(g){i.openModal({component:Jp,bind:{operationName:g.name,sourceCode:g.sourceCode??"",locale:o.uiLocale.value,onSave:k=>m(g,{sourceCode:k})}})}return(g,k)=>{var E,b;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",qS,[t.createElementVNode("span",WS,t.toDisplayString(t.unref(o).t("em.op.section",{n:((E=a.value.operations)==null?void 0:E.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:k[0]||(k[0]=v=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",JS,[t.createElementVNode("table",XS,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",ZS,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),k[2]||(k[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",QS,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,ex),t.createVNode(Gp,{modelValue:l.value,"onUpdate:modelValue":k[1]||(k[1]=v=>l.value=v),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",tx,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",nx,t.toDisplayString(t.unref(o).t("em.op.body")),1),k[3]||(k[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,v=>(t.openBlock(),t.createElementBlock("tr",{key:v.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`ow-name-${v.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":v.name,"onUpdate:modelValue":y=>m(v,{name:y})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":v.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":y=>y&&m(v,{visibility:y})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(Jt,{name:`ow-desc-${v.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":v.description,"onUpdate:modelValue":y=>p(v,y)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":f(v),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":y=>y&&h(v,y)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t(v.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:y=>_(v)},null,8,["caption","onClick"])]),t.createElementVNode("td",ox,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:y=>t.unref(o).removeOperation(a.value.modelId,v.modelId)},null,8,["onClick"])])]))),128)),(b=a.value.operations)!=null&&b.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",ix,[t.createElementVNode("td",ax,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,YS)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),lx={class:"em-detail__tabs"},sx=["onClick"],cx={key:0,class:"em-detail__lock"},dx=["disabled"],ux={key:0,class:"em-detail__narrow"},mx=Qe(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",lx,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:p=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,sx)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",cx,[t.createVNode(xe,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",ux,[t.createVNode(Pp,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(cS,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(HS,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(rx,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,dx)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Ar(e,n,o){e.openModal({component:mx,bind:{controller:t.markRaw(n),entityId:o}})}function fx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Le(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},p={...n.logical,associations:[...n.logical.associations,m]},f=Ii(p,s,Le),h=f.add[0];h&&(m.end2.attributeRef=h.modelId);const _={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(h==null?void 0:h.modelId)??d},g=Fa(m,_),k=Ka(p,s,f,[]);return i(k.length?ot("관계 추가",[g,...k]):g),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(S=>S.modelId===l),d=n.logical.entities.find(S=>S.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Le(),m=Le(),p=Le(),f=Yt(c.attributes),h=tm(d),_=S=>S&&S.charAt(0).toLowerCase()+S.slice(1),g=new Set(c.attributes.map(S=>S.name)),k=_(d.name);let E=k;for(let S=2;g.has(E);S++)E=`${k}${S}`;const b={modelId:m,name:E,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:h,embedded:{associationRef:u,embeddableRef:s}},v={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},y={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(ot("임베드 추가",[qt(l,b),Fa(v,y)])),u},setEmbedCardinality(l,s){var k;if(r(l))return;const c=n.logical.associations.find(E=>E.modelId===l);if(!c)return;let d,u;for(const E of n.logical.entities){const b=E.attributes.find(v=>{var y;return((y=v.embedded)==null?void 0:y.associationRef)===l&&v.attrType==="EMBED_OWN"});if(b){d=E.modelId,u=b;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,p=c.end2.entityRef===m?"end2":"end1",f=c[p];if(f.multiplicity===s)return;const h=E=>E==="ZERO_OR_MORE_INSTANCES"||E==="ONE_OR_MORE_INSTANCES",_=h(f.multiplicity),g=h(s);if(_===g){i(en(l,p,{multiplicity:s}));return}if(g)i(ot("임베드 컬렉션 전환",[Qt(d,u.modelId,{dbAttrs:[]}),en(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((k=f.jpa)==null?void 0:k.collectionType)??"LIST"}})]));else{const E=n.logical.entities.find(b=>b.modelId===m);if(!E)return;i(ot("임베드 단일 전환",[Qt(d,u.modelId,{dbAttrs:tm(E)}),en(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=vu(l);if(!s){i(c);return}for(const f of n.logical.entities){const h=f.attributes.find(_=>{var g;return((g=_.embedded)==null?void 0:g.associationRef)===l});if(h){const _=[];i(ot("임베드 삭제",[c,...fn(f.modelId,[h.modelId],_),...Wt(n.logical,_)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=Ga(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(_=>_.modelId===s.end1.entityRef),h=f==null?void 0:f.attributes.find(_=>_.modelId===s.end1.attributeRef&&_.attrType==="RELATION_REF");h&&p.push(...fn(f.modelId,[h.modelId],m))}p.push(...Wt(n.logical,m)),i(p.length?ot("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(h=>h.modelId===l),d=Ua(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(h=>h.modelId===l?{...h,identifying:s}:h)},p=[],f=Ga(m,[u],p);f.push(...Wt(n.logical,p)),i(f.length?ot("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=om(n.logical,l,c.navigable===!0);if(u){const m=en(l,"end1",{...c,...u.endPatch}),p=u.endPatch.attributeRef?[...u.cmds,m]:[...u.cmds,m];i(p.length>1?ot(c.navigable===!0?"inverse nav 추가":"inverse nav 제거",p):m);return}}i(en(l,s,c))}}}function px(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,predefinedCustomTypeCatalog:l,t:s,emitGateNotice:c,selection:d}=e,u=(m,p,f)=>{if(a(m))return;const h=Qt(m,p,f),_=Eo(n.logical,m,E=>E.map(b=>b.modelId===p?{...b,...f}:b)),g=[],k=Xo(_,m,g);k.push(...Wt(n.logical,g)),i(k.length?ot("속성 수정",[h,...k]):h)};return{addPredefinedEmbed(m,p){if(!o.value||a(m))return null;const f=r.value.find(b=>b.type===p),h=n.logical.entities.find(b=>b.modelId===m);if(!f||!h)return null;const _=Yt(h.attributes),g=Le(),k=f.fields.map(()=>({modelId:Le(),physicalName:"",dataType:""})),E={modelId:g,name:f.defaultName,type:f.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:_,dbAttrs:k};return i(qt(m,E)),g},convertAttributeType(m,p,f){if(!o.value||a(m))return null;const h=n.logical.entities.find(N=>N.modelId===m),_=h==null?void 0:h.attributes.find(N=>N.modelId===p);if(!h||!_||_.attrType!=="NORMAL"&&_.attrType!=="EMBED_PREDEF"||_.groupCode||!f||f===_.type||po(n.logical,m,p))return null;const g=r.value.find(N=>N.type===f),k=g?void 0:l.value.find(N=>N.type===f),E=g?g.fields.length:1,b=_.dbAttrs.length===E;if(g&&_.identifier&&!b)return c(s("em.attr.embedConvertPkBlocked")),null;const v=Array.from({length:E},(N,I)=>{const C=b?{..._.dbAttrs[I]}:{modelId:Le(),physicalName:g?"":_.name,dataType:""};return k?Jc(C,k):C}),{customType:y,...S}=_,$=Le(),O={...S,modelId:$,type:f,attrType:g?"EMBED_PREDEF":"NORMAL",identifier:_.identifier,dbAttrs:v};f===dn&&y!==void 0&&(O.customType=y);const B=[],z=fn(m,[p],B),T=Eo(n.logical,m,N=>N.filter(I=>I.modelId!==p)),x=new Map;if(b){for(const N of v)x.set(N.modelId,N.modelId);x.set(p,v.length===1?v[0].modelId:$)}const R=[...Xo(T,m,B),...Wt(n.logical,B,x),...Zl(n.logical,m,[p])];return i(ot("속성 타입 전환",[...z,...R,qt(m,O)])),$},addSerializedTypeAttribute(m,p){if(!o.value||a(m))return null;const f=n.logical.entities.find(E=>E.modelId===m),h=n.logical.entities.find(E=>E.modelId===p);if(!f||!h||!cn(h.stereotype)||!h.name)return null;const _=h.name.charAt(0).toLowerCase()+h.name.slice(1),g=uo(_,new Set(f.attributes.map(E=>E.name))),k=Le();return i(qt(m,{modelId:k,name:g,type:h.name,attrType:"NORMAL",identifier:!1,notNull:!1,order:Yt(f.attributes),dbAttrs:[{modelId:Le(),physicalName:g,dataType:"CLOB"}]})),k},addAttribute(m,p={}){if(!o.value||a(m))return null;const f=n.logical.entities.find(S=>S.modelId===m),h=f?Yt(f.attributes):0,_=p.modelId??Le(),g=p.name??`field${h}`,k={modelId:_,name:g,type:p.type??dl,attrType:p.attrType??"NORMAL",identifier:p.identifier??!1,notNull:p.notNull??!1,order:h,dbAttrs:p.dbAttrs??(f&&cn(f.stereotype)?[]:[{modelId:Le(),physicalName:g,dataType:"VARCHAR"}]),...p},E=qt(m,k),b=Eo(n.logical,m,S=>[...S,k]),v=[],y=Xo(b,m,v);return y.push(...Wt(n.logical,v)),i(y.length?ot("속성 추가",[E,...y]):E),_},addDivider(m){if(!o.value||a(m))return null;const p=n.logical.entities.find(g=>g.modelId===m),f=p?Yt(p.attributes):0,h=Le();return i(qt(m,{modelId:h,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:f,dbAttrs:[]})),h},updateAttribute(m,p,f){u(m,p,f)},setAttributeGroupCode(m,p,f){u(m,p,{groupCode:f,type:f?jn:dl})},setEmbedColumns(m,p,f){var b,v;if(a(m))return;const h=Qt(m,p,{dbAttrs:f}),_=(b=n.logical.entities.find(y=>y.modelId===m))==null?void 0:b.attributes.find(y=>y.modelId===p),g=(v=_==null?void 0:_.embedded)==null?void 0:v.associationRef,k=g?n.logical.associations.find(y=>y.modelId===g):void 0,E=[];k&&g&&(k.end1.legacyEmbedRaw&&E.push(en(g,"end1",{legacyEmbedRaw:void 0})),k.end2.legacyEmbedRaw&&E.push(en(g,"end2",{legacyEmbedRaw:void 0}))),i(E.length?ot("임베드 컬럼 수정",[h,...E]):h)},removeAttribute(m,p){if(a(m))return;if(po(n.logical,m,p)){c(s("em.attr.fkDeleteHint"));return}const f=[],h=fn(m,[p],f),_=Eo(n.logical,m,E=>E.filter(b=>b.modelId!==p)),g=[...Xo(_,m,f),...Wt(n.logical,f),...Zl(n.logical,m,[p])],k=[...h,...g];i(k.length===1?k[0]:ot("속성 삭제",k))},removeAttributes(m,p){var b;if(!p.length||a(m))return;const f=p.filter(v=>!po(n.logical,m,v));if(f.length<p.length&&c(s("em.attr.fkDeleteHint")),!f.length)return;const h=[],_=fn(m,f,h),g=new Set(f),k=Eo(n.logical,m,v=>v.filter(y=>!g.has(y.modelId))),E=[..._,...Xo(k,m,h),...Wt(n.logical,h),...Zl(n.logical,m,f)];i(E.length===1?E[0]:ot("속성 삭제",E)),((b=d.value)==null?void 0:b.kind)==="attribute"&&d.value.entityId===m&&(d.value=null)},setAttributeSwatch(m,p,f){i(Oa(m,p,f))},setAttributeSwatches(m,p,f){p.length&&(p.length===1?i(Oa(m,p[0],f)):i(ot("속성 색상",p.map(h=>Oa(m,h,f)))))},reorderAttributes(m,p,f){if(!p.length||a(m))return;const h=Jl(m,p,f),_=g_(n.logical,m,p,f);i(_.length?ot("속성 재정렬",[h,..._]):h)}}}function hx(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Le(),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=Le();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Le()}for(const a of n.indexes??[]){a.modelId=Le();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Le();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const yx=220;function gx(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||yx));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 Zs=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function bx(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const _=c.filter(g=>n.logical.entities.some(k=>k.modelId===g));if(_.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:_}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const _=n.logical.entities.find(k=>k.modelId===d.entityId);if(!_)return;const g=[..._.attributes].sort((k,E)=>k.order-E.order).filter(k=>d.ids.includes(k.modelId));if(!g.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:g}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(_=>_.modelId===u),p=n.layout.entityLayouts.find(_=>_.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let h;if(p){const{entityRef:_,geo:g,locked:k,...E}=p;Object.keys(E).length&&(h=E)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:h}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const h=n.logical.entities.find(v=>v.modelId===f);if(!h)return[];const _=new Set(h.attributes.map(v=>v.name)),g=new Set(h.attributes.flatMap(v=>v.dbAttrs.map(y=>y.physicalName))),k=Yt(h.attributes),E=[],b=c.attributes.map((v,y)=>{const S=JSON.parse(JSON.stringify(v));S.modelId=Le();for(const $ of S.dbAttrs)$.modelId=Le();_.has(S.name)&&(S.name=uo(`${S.name}_copy`,_)),_.add(S.name);for(const $ of S.dbAttrs)$.physicalName&&g.has($.physicalName)&&($.physicalName=uo(`${$.physicalName}_copy`,g)),$.physicalName&&g.add($.physicalName);return S.order=k+y,E.push(S.modelId),qt(f,S)});return l(b.length===1?b[0]:ot("속성 붙여넣기",b)),i.value={kind:"attribute",entityId:f,ids:E,anchor:E[E.length-1]},[]}const{clone:d,idMap:u}=hx(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let p;if(c.layoutExtras){const f={...c.layoutExtras},h=_=>u.get(_);f.attributeStyles&&(f.attributeStyles=Ma(f.attributeStyles,h)),f.operationStyles&&(f.operationStyles=Ma(f.operationStyles,h)),p=f}return l(Ba(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Jd(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const p=(u==null?void 0:u.placement)??"append-right",f=p==="append-right"?gx(n.layout,m.layout):p.offset,h=new Map(m.layout.entityLayouts.map(b=>[b.entityRef,b])),_=new Map(m.layout.associationLayouts.map(b=>[b.associationRef,b])),g=new Map(m.layout.groupLayouts.map(b=>[b.groupRef,b])),k=[];let E=80;for(const b of m.logical.entities){const v=h.get(b.modelId),y=v?{location:Zs(v.geo.location,f),size:{...v.geo.size}}:{location:{x:E+=40,y:80},size:{width:220,height:140}};let S;if(v){const{entityRef:$,geo:O,locked:B,...z}=v;S=z}k.push(Ba(b,y,S))}for(const b of m.logical.associations){const v=_.get(b.modelId),y=v?{...v,waypoints:v.waypoints.map(S=>Zs(S,f))}:{associationRef:b.modelId,waypoints:[]};k.push(Fa(b,y))}for(const b of m.logical.groups){const v=g.get(b.modelId),y=v?{location:Zs(v.geo.location,f),size:{...v.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let S;if(v){const{groupRef:$,geo:O,locked:B,memberNoteRefs:z,...T}=v;S=T}k.push(Pa(b,y,S))}return l(ot("다이어그램 가져오기",k)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(b=>b.modelId)}};return s}function _x(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l,t:s,emitGateNotice:c}=e;return{addEntity(d="NewEntity",u={x:80,y:80}){if(!o.value)return null;const m=Le(),p={modelId:m,name:d,stereotype:"JPA_ENTITY",table:{physicalName:d.toLowerCase()},attributes:[{modelId:Le(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Le(),physicalName:"id",dataType:"BIGINT"}]}]};return i(Ba(p,{location:{...u},size:{width:220,height:140}})),m},renameEntity(d,u){a(d)||i(ru(d,u))},updateEntity(d,u){if(a(d))return;const m=Da(d,u),p=n.logical.entities.find(E=>E.modelId===d),f=p==null?void 0:p.stereotype,h=u.stereotype,_=!!h&&!!p&&!!f&&at(h)&&!at(f),g=!!h&&!!p&&!!f&&!at(h)&&at(f);if(!!h&&!!p&&!!f&&h!==f&&at(h)&&at(f)&&p){const E=n.logical.entities.filter(v=>v.attributes.some(y=>{var S;return((S=y.embedded)==null?void 0:S.embeddableRef)===d}));if(E.length>0){c(s("em.entity.valueTypeSwitchEmbedded",{name:p.name,owners:E.length}));return}const b=em(p,h);i(b.length?ot("직렬화 타입 변환",[m,...b]):m);return}if(h==="SERIALIZED_TYPE"&&p){const E=n.logical.associations.filter(b=>b.end1.entityRef===d||b.end2.entityRef===d);if(E.length>0){c(s("em.entity.serializedTypeHasRelations",{name:p.name,count:E.length}));return}}if(_&&p&&h){const E=im(n.logical,d,h),b=[m,...E];i(b.length>1?ot(h==="SERIALIZED_TYPE"?"직렬화 타입 변환":"임베더블 변환",b):m);return}if(g){const E=nm(n.logical,d),b=[m,...E];i(b.length>1?ot("엔터티 전환",b):m);return}i(m)},moveEntity(d,u){a(d)||i(Jo(d,u))},resizeEntity(d,u){a(d)||i(lu(d,u))},removeEntity(d){if(a(d))return;const u=au(d);if(!n.logical.entities.find(E=>E.modelId===d)){i(u);return}const p=n.logical.associations.filter(E=>E.end1.entityRef===d||E.end2.entityRef===d),f=new Set(p.map(E=>E.modelId)),h=[],_=[];for(const E of n.logical.entities)if(E.modelId!==d)for(const b of E.attributes)b.embedded&&f.has(b.embedded.associationRef)&&h.push(...fn(E.modelId,[b.modelId],_));for(const E of p){if(E.end1.entityRef===d||!E.end1.attributeRef)continue;const b=n.logical.entities.find(y=>y.modelId===E.end1.entityRef),v=b==null?void 0:b.attributes.find(y=>y.modelId===E.end1.attributeRef&&y.attrType==="RELATION_REF");v&&h.push(...fn(b.modelId,[v.modelId],_))}const g={...n.logical,entities:n.logical.entities.filter(E=>E.modelId!==d),associations:n.logical.associations.filter(E=>!f.has(E.modelId))},k=new Set(p.filter(E=>E.end1.entityRef===d&&E.end2.entityRef!==d).map(E=>E.end2.entityRef));h.push(...Ga(g,[...k],_)),h.push(...Wt(n.logical,_.filter(E=>E.entityId!==d))),i(h.length?ot("엔티티 삭제",[u,...h]):u)},setEntitySwatch(d,u){i(su(d,u))},setEntityCollapsed(d,u){i(cu(d,u))},setEntityLocked(d,u){i(du(d,u))},isEntityLocked(d){return r(d)},isAssociationLocked(d){return l(d)},collapseAll(){i(Wl(!0))},expandAll(){i(Wl(!1))}}}function kx(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(k=>n.layout.entityLayouts.find(E=>E.entityRef===k)).filter(k=>!!k);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,h=-1/0;for(const k of u){const E=k.geo.size.width||220,b=k.geo.size.height||140;m=Math.min(m,k.geo.location.x),p=Math.min(p,k.geo.location.y),f=Math.max(f,k.geo.location.x+E),h=Math.max(h,k.geo.location.y+b)}const _=40,g=28;return{location:{x:m-_,y:p-_-g},size:{width:f-m+_*2,height:h-p+_*2+g}}}return{dragGroup(d,u,m){l(d)||i(ot("그룹 이동",am(n,d,u,m)))},resizeGroup(d,u){l(d)||i(hu(d,u))},setGroupSwatch(d,u){i(yu(d,u))},setGroupLocked(d,u){i(gu(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(uu(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const h of n.logical.groups)for(const _ of d)h.memberEntityRefs.includes(_)&&m.push(za(h.modelId,_));const p=Le(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(Pa(f,c(d))),i(ot("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Le();return i(Pa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(mu(d))},dropEntity(d,u,m){var h;if(r(d))return;const p=((h=n.logical.groups.find(_=>_.memberEntityRefs.includes(d)))==null?void 0:h.modelId)??null,f=[Jo(d,u)];p!==m&&(p&&f.push(za(p,d)),m&&f.push(fu(m,d))),i(ot("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(za(u.modelId,d))},dropNote(d,u,m){var h;const p=((h=n.layout.groupLayouts.find(_=>{var g;return(g=_.memberNoteRefs)==null?void 0:g.includes(d)}))==null?void 0:h.groupRef)??null,f=[$i(d,u)];p!==m&&(p&&f.push(Pu(p,d)),m&&f.push(Ou(m,d))),i(ot("이동",f))}}}function Ex(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(_,g){if(d(),!o.value||!e.opTransport)return;const k=new Yu({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:E=>{i.value=!1,a.value=E},onError:e.onOpError});k.seed((g==null?void 0:g.revSeed)??{}),c=k.attach(_),s=k}const m=t.computed(()=>o.value&&r!==void 0),p=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function h(_){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let g;try{g=await l(_)}catch(k){return{ok:!1,reason:k instanceof Error?k.message:String(k)}}return g.ok&&p.value++,g}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:h,reloadRequest:p}}function Nx(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Le();return o(Mu({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(Vu(i))},moveNote(i,a){o($i(i,a))},resizeNote(i,a){o(Lu(i,a))},setNoteMemo(i,a){o(Bu(i,a))},setNoteSwatch(i,a){o(Du(i,a))},addNoteConnection(i,a){o(zu(i,a))},removeNoteConnection(i,a){o(Fu(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Uu(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Hu(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(ju(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Ku(i,a))}}}function wx(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const v=p.ids.includes(u),y=v?p.ids.filter($=>$!==u):[...p.ids,u];if(!y.length){o.value=null;return}const S=v&&p.anchor===u?y[y.length-1]:v?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:y,anchor:S};return}const h=n.logical.entities.find(v=>v.modelId===d),_=[...(h==null?void 0:h.attributes)??[]].sort((v,y)=>v.order-y.order).map(v=>v.modelId),g=_.indexOf(p.anchor),k=_.indexOf(u);if(g<0||k<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[E,b]=g<=k?[g,k]:[k,g];o.value={kind:"attribute",entityId:d,ids:_.slice(E,b+1),anchor:p.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(_=>_.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(_=>_.modelId===u.anchor);if(p<0)return!1;const f=Math.min(Math.max(p+d,0),m.attributes.length-1);if(f===p)return!0;const h=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[h],anchor:h},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(v=>v.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),h=p.map((v,y)=>f.has(v.modelId)?y:-1).filter(v=>v>=0);if(!h.length)return!1;const _=Math.min(...h),g=p.filter(v=>!f.has(v.modelId)),k=p.slice(0,_).filter(v=>!f.has(v.modelId)).length;let E;if(d<0){if(k<=0)return!0;E=k-1}else{if(g.length-k<=0)return!0;E=k+1}if(r(u.entityId))return!0;const b=p.filter(v=>f.has(v.modelId)).map(v=>v.modelId);return a(Jl(u.entityId,b,E)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(E=>E.modelId)),f=new Set(n.logical.groups.map(E=>E.modelId)),h=new Set(n.layout.notes.map(E=>E.modelId)),_=new Set;for(const E of d){if(!f.has(E))continue;const b=n.logical.groups.find(v=>v.modelId===E);for(const v of(b==null?void 0:b.memberEntityRefs)??[])_.add(v)}const g=[],k=[];for(const E of d)if(f.has(E)){if(s(E))continue;const b=n.layout.groupLayouts.find($=>$.groupRef===E);if(!b)continue;const v=n.logical.groups.find($=>$.modelId===E),y=((v==null?void 0:v.memberEntityRefs)??[]).map($=>{var B;const O=((B=n.layout.entityLayouts.find(z=>z.entityRef===$))==null?void 0:B.geo.location)??{x:0,y:0};return{id:$,location:{x:O.x+u,y:O.y+m}}}),S={x:b.geo.location.x+u,y:b.geo.location.y+m};g.push(ot("그룹 이동",am(n,E,S,y))),k.push("g:"+E)}else if(p.has(E)){if(_.has(E)||l(E))continue;const b=n.layout.entityLayouts.find(v=>v.entityRef===E);if(!b)continue;g.push(Jo(E,{x:b.geo.location.x+u,y:b.geo.location.y+m})),k.push("e:"+E)}else if(h.has(E)){const b=n.layout.notes.find(v=>v.modelId===E);if(!b)continue;g.push($i(E,{x:b.geo.location.x+u,y:b.geo.location.y+m})),k.push("n:"+E)}return g.length?(a(ot("이동",g,"nudge:"+k.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const eo=Symbol("editorController");function Xp(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Ix(e=Xp(),n={}){var Ne,Ye,it;const o=t.reactive(e);let i=new ql(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=(Q,ce)=>rn(u.value,Q,ce),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),h=t.ref(n.largeEntityThreshold),_=t.ref(n.flagEntitiesWithoutRelations??!1),g=t.ref(!1),k=t.ref(!1),E=t.ref(!1),b=t.ref(0),v=t.ref(null);let y=0;const S=Q=>{if(n.onNotice){n.onNotice(Q);return}v.value={text:Q,id:++y}},$=t.ref(((Ne=n.meta)==null?void 0:Ne.schemaVersion)??1),O=t.ref(((Ye=n.meta)==null?void 0:Ye.opWriteEnabled)??!1),B=t.ref(((it=n.meta)==null?void 0:it.referenceOnly)??!1),z=t.computed(()=>$.value>=2&&O.value),T=t.ref(!($.value>=2&&O.value===!1)),x=t.ref("LOGICAL_PHYSICAL"),R=t.ref("straight"),N=t.ref(!0),I=t.ref(!0),C=t.ref(null),U=t.computed(()=>{var Q;return((Q=C.value)==null?void 0:Q.kind)==="attribute"?{entityId:C.value.entityId,attrId:C.value.anchor}:null}),A=t.computed(()=>{var Q;return((Q=C.value)==null?void 0:Q.kind)==="attribute"?C.value.ids:[]}),P=t.computed(()=>{var Q,ce;return((Q=C.value)==null?void 0:Q.kind)==="entity"?C.value.id:((ce=C.value)==null?void 0:ce.kind)==="attribute"?C.value.entityId:null}),F=t.ref(null),H=t.ref(null),G=t.ref(null),le=t.ref(null),se=Ex({state:o,opMode:z,editable:T,opConflict:G,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function ue(){i.onChange(()=>{g.value=i.canUndo,k.value=i.canRedo,E.value=i.isDirty,b.value++})}ue(),se.setupOpAdapter(i,n.meta);const ye=t.computed(()=>Ac(o.logical,o.layout)),ae=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:h.value,flagEntitiesWithoutRelations:_.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Ie=()=>hl(o.logical,B.value),Pe=n.validationDebounceMs??250;let Ae,de=()=>{};if(Pe>0){const Q=t.shallowRef(xa(Ie(),ae.value));let ce;de=()=>{ce!==void 0&&(clearTimeout(ce),ce=void 0),Q.value=xa(Ie(),ae.value)},t.watch([b,ae,B],()=>{ce!==void 0&&clearTimeout(ce),ce=setTimeout(de,Pe)},{flush:"sync"}),Ae=t.computed(()=>Q.value)}else Ae=t.computed(()=>xa(Ie(),ae.value));const ge=t.computed(()=>{const Q=new Map;for(const ce of Ae.value){if(!ce.targetRef)continue;const je=Q.get(ce.targetRef);je?je.push(ce):Q.set(ce.targetRef,[ce])}return Q}),_e=1500,V=new Map,L=Q=>{const ce=Date.now();ce-(V.get(Q)??0)<_e||(V.set(Q,ce),S(Q))},j=Q=>{if(!le.value){if(!T.value){L(m("em.notice.readOnly"));return}try{i.execute(Q)}catch(ce){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${Q.label}):`,ce),T.value=!1,le.value={label:Q.label}}}},ee=Q=>o.layout.entityLayouts.some(ce=>ce.entityRef===Q&&!!ce.locked),Z=Q=>o.layout.groupLayouts.some(ce=>ce.groupRef===Q&&!!ce.locked),pe=Q=>{const ce=o.logical.associations.find(je=>je.modelId===Q);return!!ce&&(ee(ce.end1.entityRef)||ee(ce.end2.entityRef))},me=Q=>ee(Q)?(L(m("em.notice.entityLocked")),!0):!1,ve=Q=>Z(Q)?(L(m("em.notice.groupLocked")),!0):!1,Ee=Q=>pe(Q)?(L(m("em.notice.assocLocked")),!0):!1,W=bx({state:o,clipboard:H,selection:C,inspectedEntityId:P,editable:T,run:j}),J=wx({state:o,selection:C,focusRequest:F,run:j,gateEntityLocked:me,isEntityLockedFn:ee,isGroupLockedFn:Z}),X=_x({state:o,editable:T,run:j,gateEntityLocked:me,isEntityLockedFn:ee,isAssocLockedFn:pe,t:m,emitGateNotice:L}),he=px({state:o,editable:T,run:j,gateEntityLocked:me,embeddableCatalog:a,predefinedCustomTypeCatalog:l,t:m,emitGateNotice:L,selection:C}),Te=kx({state:o,editable:T,run:j,selection:C,gateEntityLocked:me,gateGroupLocked:ve,isGroupLockedFn:Z}),De=Nx({editable:T,run:j}),Oe=fx({state:o,editable:T,run:j,gateEntityLocked:me,gateAssocLocked:Ee});return{state:o,resolved:ye,issues:Ae,issuesByRef:ge,flagEntitiesWithoutRelations:_,canUndo:g,canRedo:k,dirty:E,revision:b,notice:v,editable:T,schemaVersion:$,opWriteEnabled:O,opMode:z,opConflict:G,commandFailure:le,historyTransport:se.historyTransport,historyAvailable:se.historyAvailable,restoreTransport:se.restoreTransport,restoreAvailable:se.restoreAvailable,restoreToSeq:se.restoreToSeq,reloadRequest:se.reloadRequest,displayMode:x,routingMode:R,showGrid:N,showMinimap:I,selection:C,selectedAttr:U,selectedAttrIds:A,inspectedEntityId:P,focusRequest:F,clipboard:H,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:B,uiLocale:u,t:m,selectableDataTypes:f,setEditable(Q){T.value=Q&&z.value},setEmbeddableCatalog(Q){a.value=Q},setGroupCodeCatalog(Q){r.value=Q},setPredefinedCustomTypeCatalog(Q){l.value=Q},setSuperClassCatalog(Q){s.value=Q},selectAttribute:J.selectAttribute,moveAttributeFocus:J.moveAttributeFocus,nudgeSelectedAttributes:J.nudgeSelectedAttributes,nudgeNodes:J.nudgeNodes,requestFocus:J.requestFocus,deleteSelection(){if(!T.value)return!1;const Q=C.value;if(!Q)return!1;if(Q.kind==="attribute"){if(me(Q.entityId))return!1;const ce=Q.ids;if(!ce.length)return!1;ce.length===1?he.removeAttribute(Q.entityId,ce[0]):he.removeAttributes(Q.entityId,ce)}else if(Q.kind==="entity"){if(me(Q.id))return!1;X.removeEntity(Q.id)}else if(Q.kind==="note")De.removeNote(Q.id);else if(Q.kind==="group"){if(ve(Q.id))return!1;Te.removeGroup(Q.id)}else Oe.removeAssociation(Q.id);return C.value=null,!0},undo:()=>{T.value&&i.undo()},redo:()=>{T.value&&i.redo()},markSaved:()=>{T.value&&(se.flush(),i.markSavePoint())},loadDiagram(Q,ce){se.teardownOpAdapter(),o.logical=Q.logical,o.layout=Q.layout,i=new ql(o),ue(),$.value=(ce==null?void 0:ce.schemaVersion)??1,O.value=(ce==null?void 0:ce.opWriteEnabled)??!1,B.value=(ce==null?void 0:ce.referenceOnly)??!1,T.value=!($.value>=2&&O.value===!1),G.value=null,le.value=null,C.value=null,g.value=i.canUndo,k.value=i.canRedo,E.value=i.isDirty,se.setupOpAdapter(i,ce),de()},flush:se.flush,whenOpsSettled:se.whenOpsSettled,addEntity:X.addEntity,renameEntity:X.renameEntity,updateEntity:X.updateEntity,moveEntity:X.moveEntity,resizeEntity:X.resizeEntity,removeEntity:X.removeEntity,setEntitySwatch:X.setEntitySwatch,setEntityCollapsed:X.setEntityCollapsed,setEntityLocked:X.setEntityLocked,isEntityLocked:X.isEntityLocked,isAssociationLocked:X.isAssociationLocked,collapseAll:X.collapseAll,expandAll:X.expandAll,setAttributeSwatch:he.setAttributeSwatch,dragGroup:Te.dragGroup,resizeGroup:Te.resizeGroup,setGroupSwatch:Te.setGroupSwatch,setGroupLocked:Te.setGroupLocked,isGroupLocked:Te.isGroupLocked,updateGroup:Te.updateGroup,createGroup:Te.createGroup,addEmptyGroup:Te.addEmptyGroup,removeGroup:Te.removeGroup,dropEntity:Te.dropEntity,ungroupEntity:Te.ungroupEntity,dropNote:Te.dropNote,addPredefinedEmbed:he.addPredefinedEmbed,convertAttributeType:he.convertAttributeType,addSerializedTypeAttribute:he.addSerializedTypeAttribute,addAttribute:he.addAttribute,addDivider:he.addDivider,updateAttribute:he.updateAttribute,setAttributeGroupCode:he.setAttributeGroupCode,setEmbedColumns:he.setEmbedColumns,removeAttribute:he.removeAttribute,removeAttributes:he.removeAttributes,setAttributeSwatches:he.setAttributeSwatches,reorderAttributes:he.reorderAttributes,addIndex(Q,ce){me(Q)||j(Cu(Q,ce))},updateIndex(Q,ce,je){me(Q)||j(Ha(Q,ce,je))},removeIndex(Q,ce){me(Q)||j(Su(Q,ce))},addOperation(Q,ce={}){if(!T.value||me(Q))return null;const je=o.logical.entities.find(st=>st.modelId===Q),lt=je!=null&&je.operations?Yt(je.operations):0,Xe=ce.modelId??Le(),_t={modelId:Xe,name:ce.name??`method${lt}`,visibility:ce.visibility??"PACKAGE",order:lt,...ce};return j(ku(Q,_t)),Xe},updateOperation(Q,ce,je){me(Q)||j(Eu(Q,ce,je))},removeOperation(Q,ce){me(Q)||j(Nu(Q,ce))},reorderOperations(Q,ce,je){!ce.length||me(Q)||j(wu(Q,ce,je))},setOperationSwatch(Q,ce,je){j(Iu(Q,ce,je))},addAssociation:Oe.addAssociation,addEmbedAssociation:Oe.addEmbedAssociation,setEmbedCardinality:Oe.setEmbedCardinality,removeAssociation:Oe.removeAssociation,setAssociationIdentifying:Oe.setAssociationIdentifying,updateAssociationEnd:Oe.updateAssociationEnd,hasQuickFix(Q){if(!T.value)return!1;const ce=xl(Q,o.logical);return ce?ce.kind==="setEndCascades"?!pe(ce.assocRef):!ee(ce.entityRef):!1},applyQuickFix(Q){if(!T.value)return!1;const ce=xl(Q,o.logical);if(!ce)return!1;if(ce.kind==="setIndexColumns")return me(ce.entityRef)?!1:(j(Ha(ce.entityRef,ce.indexRef,{columns:ce.columns})),!0);if(Ee(ce.assocRef))return!1;const je=o.logical.associations.find(lt=>lt.modelId===ce.assocRef);return je?(j(en(ce.assocRef,ce.which,{jpa:{...je[ce.which].jpa,cascadeTypes:ce.cascades}})),!0):!1},moveWaypoint(Q,ce,je){j(xu(Q,ce,je))},addWaypoint(Q,ce,je){j(Tu(Q,ce,je))},removeWaypoint(Q,ce){j(Ru(Q,ce))},clearWaypoints(Q){j($u(Q))},addNote:De.addNote,removeNote:De.removeNote,moveNote:De.moveNote,resizeNote:De.resizeNote,setNoteMemo:De.setNoteMemo,setNoteSwatch:De.setNoteSwatch,addNoteConnection:De.addNoteConnection,removeNoteConnection:De.removeNoteConnection,moveNoteConnectionWaypoint:De.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:De.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:De.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:De.clearNoteConnectionWaypoints,autoLayout(){const Q=$c(o.logical,o.layout);Q.length&&j(ot("자동 배치",Q.map(ce=>Jo(ce.id,ce.location))))},copy:W.copy,paste:W.paste,importEntities:W.importEntities}}const $r=Symbol("groupHover"),Zp=Symbol("groupDrag"),Lo=Symbol("relationHighlight"),Qp=Symbol("diffOverlay"),eh=Symbol("nodeInternals"),th=Symbol("columnResolution");function vx(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function nh(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!vx(e[o],n[o]))return!1;return!0}function Cx(e,n){const o=e,i=n;for(const a of Object.keys(o))if(o[a]!==i[a])return!1;return!0}function oh(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!nh(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function Sx(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function xx(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!Sx(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!oh(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!nh(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!!Rx(e.classRows,n.classRows)}function Rx(e,n){if(e===n)return!0;if(!e||!n||e.length!==n.length)return!1;for(let o=0;o<e.length;o++){const i=e[o],a=n[o];if(i.synthetic!==a.synthetic||i.sourceAttrId!==a.sourceAttrId||i.targetName!==a.targetName||i.collection!==a.collection||i.attr!==a.attr&&!oh(i.attr,a.attr))return!1}return!0}function Ax(){let e;return(n,o)=>e=$x(n,o,e)}function $x(e,n,o){const i=e.entities,a=new Map,r={embeddableCatalog:n};let l=null;const s=()=>l??(l=new Map(i.map(c=>[c.modelId,c])));for(const c of i){const d=new Map,u=new Map,m=new Map;let p=null;const f=()=>p??(p=lo(vn(c,i)));for(const b of c.attributes){if(fa(b)){const S=b.dbAttrs[0],$=S&&Bt(b,S,0,c,e);S&&$&&!Cx($,S)&&d.set(b.modelId,{...b,dbAttrs:[$,...b.dbAttrs.slice(1)]})}if(b.identifier&&b.attrType==="RELATION_OWN"){const S=po(e,c.modelId,b.modelId);if(S&&$a(b,S)){const $=d.get(b.modelId)??b,O=b.derivedIdFieldName||Tl({...b,derivedIdFieldName:void 0},S,s());O&&d.set(b.modelId,{...$,derivedIdFieldName:O})}}const v=Ei(b,e.associations);if(v&&m.set(b.modelId,v),Nn(b)){u.set(b.modelId,b.dbAttrs.map((S,$)=>Bt(b,S,$,c,e)));continue}if(!b.attrType.startsWith("EMBED")||b.dbAttrs.length===0||b.attrType==="EMBED_PREDEF"&&!(n!=null&&n.some(S=>S.type===b.type)))continue;const y=f();u.set(b.modelId,b.dbAttrs.map((S,$)=>{const O=Bt(b,S,$,c,e,r),B=so(O,y);return B?{...O,physicalName:B.physicalName}:O}))}const h=new Map,_=new Map;for(const b of c.attributes){const v=u.get(b.modelId);if(v)for(let y=0;y<v.length;y++){const S=`${b.attrType}\0${b.type??""}\0${y}`,$={attrId:b.modelId,slot:y,name:v[y].physicalName??""},O=_.get(S);O?O.push($):_.set(S,[$])}}for(const b of _.values()){if(b.length<2)continue;const v=new Map;for(const y of b)v.set(y.name,(v.get(y.name)??0)+1);for(const y of b){if((v.get(y.name)??0)<2)continue;const S=h.get(y.attrId);S?S.add(y.slot):h.set(y.attrId,new Set([y.slot]))}}const g=Ml(c,e).fields.map(b=>{var v;return{attr:b.attr,synthetic:b.synthetic,sourceAttrId:b.sourceAttr.modelId,targetName:(v=b.target)==null?void 0:v.name,collection:b.collection}}),k={effectiveAttrs:d,embedCols:u,collectionTypes:m,redundantSlots:h,classRows:g},E=o==null?void 0:o.get(c.modelId);a.set(c.modelId,E&&xx(k,E)?E:k)}return a}const ih=Symbol("embedSlotCollapse"),ah=(e,n)=>`${e}:${n}`,rh="all:",lh="one:",sh="fk:",ch=e=>`${rh}${e}`,Tx=(e,n)=>`${lh}${e}:${n}`,Mx=(e,n)=>`${sh}${e}:${n}`,Vx=e=>e.startsWith(sh)||!e.startsWith(rh)&&!e.startsWith(lh),Lx=["title"],Bx={key:0,class:"em-sel","aria-hidden":"true"},Dx=["title","aria-expanded","disabled"],Ox={class:"em-entity__stereotype"},Px={key:2,class:"em-entity__name"},zx=["title","aria-expanded"],Fx={"aria-hidden":"true"},Ux=["data-attr","title","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Hx=["onPointerdown"],jx={key:1,class:"em-entity__divider-label"},Kx=["title"],Gx={class:"em-key-slot"},Yx={class:"em-key-slot"},qx=["title","aria-expanded","onClick"],Wx=["title","onClick"],Jx=["title","aria-expanded","onClick"],Xx={key:2,class:"em-entity__type"},Zx=["onClick"],Qx={class:"em-entity__attrname"},eR={class:"em-entity__type"},tR={key:1,class:"em-entity__embed-summary"},nR=["title"],oR=["data-op"],iR=["onPointerdown"],aR={class:"em-entity__op-vis","aria-hidden":"true"},rR=["title"],lR={key:4,class:"em-entity__footer"},dh=Qe(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(eo,null),i=(D,Y)=>o?o.t(D,Y):rn("ko",D,Y),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=te.useModal();function l(){o&&Ar(r,o,n.id)}const s=t.inject($r,null),c=t.inject(Lo,null),d=t.inject(Qp,null),u=t.computed(()=>{var D;return((D=d==null?void 0:d.marks.value)==null?void 0:D.get(n.id))??null}),m=t.inject(th,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(ih,void 0),h=t.inject(eh,null);t.onUpdated(()=>h==null?void 0:h.mark(n.id));const _=t.computed(()=>!!o&&o.editable.value);function g(){s&&(s.value=n.data.groupRef??null)}function k(){c==null||c.setEntityHover(n.id)}function E(){c==null||c.setEntityHover(null)}const b=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),v=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!b.value),y=t.computed(()=>{var D;return((D=o==null?void 0:o.selection.value)==null?void 0:D.kind)==="entity"&&o.selection.value.id===n.id}),S=t.computed(()=>!!n.selected&&!y.value),$=t.computed(()=>{var D;return o&&((D=o.selectedAttr.value)==null?void 0:D.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),O=t.computed(()=>$.value.size>0);function B(D,Y){const we=Y.shiftKey?"range":Y.metaKey||Y.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,U(D),we)}const z=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!y.value),T=t.computed(()=>n.data.entity),x=t.computed(()=>ag(T.value,o==null?void 0:o.referenceOnlyDocument.value)),R=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),N=t.computed(()=>{var D;if(R.value==="CLASS"){const Y=(D=p.value)==null?void 0:D.classRows;if(Y)return Y.map(we=>we.attr)}return[...T.value.attributes].sort((Y,we)=>Y.order-we.order)}),I=t.computed(()=>{var Y;const D=R.value==="CLASS"?(Y=p.value)==null?void 0:Y.classRows:void 0;return new Set((D??[]).filter(we=>we.synthetic).map(we=>we.attr.modelId))});function C(D){return I.value.has(D.modelId)}function U(D){return F.value.get(D.modelId)??D.modelId}function A(D){return $.value.has(U(D))}function P(D){var Y;return!!((Y=u.value)!=null&&Y.changedAttributeIds.has(U(D)))}const F=t.computed(()=>{var Y;const D=new Map;if(R.value!=="CLASS")return D;for(const we of((Y=p.value)==null?void 0:Y.classRows)??[])we.synthetic&&D.set(we.attr.modelId,we.sourceAttrId);return D}),H=t.computed(()=>{var we;const D=new Map,Y=R.value==="CLASS";for(const Re of((we=p.value)==null?void 0:we.classRows)??[])!Y&&!Nn(Re.attr)||(Re.targetName||Re.collection)&&D.set(Re.attr.modelId,{targetName:Re.targetName,collection:Re.collection});return D}),G=t.computed(()=>n.data.collapsed??!1),le=t.computed(()=>n.data.locked??!1),se=t.computed(()=>_.value&&!le.value);function ue(){_.value&&(o==null||o.setEntityCollapsed(n.id,!G.value))}const ye=t.computed(()=>!G.value&&N.value.some(D=>!he(D))),ae=[{id:"e-left",pos:$e.Left},{id:"e-right",pos:$e.Right}],Ie=t.computed(()=>R.value==="PHYSICAL"||R.value==="LOGICAL_PHYSICAL"),Pe=t.computed(()=>{var we;const D=R.value==="PHYSICAL"||R.value==="LOGICAL_PHYSICAL",Y={};for(const Re of N.value){const re=Re.attrType.startsWith("RELATION")&&Re.dbAttrs.length>0,Ge=cn(((we=T.value)==null?void 0:we.stereotype)??"UNDEFINED");Y[Re.modelId]={pk:Re.identifier,fk:re&&D,required:!Ge&&Re.notNull&&!Re.identifier}}return Y});function Ae(D){if(!D)return"";const Y=[];return D.pk&&D.fk?Y.push(i("em.node.keyPfk")):D.pk?Y.push(i("em.node.keyPk")):D.fk&&Y.push(i("em.node.keyFk")),D.required&&Y.push(i("em.node.required")),Y.join(" · ")}const de=t.computed(()=>{const D=Gs(Vt(n.data.style)),Y={};return D&&(Y["--em-header-bg"]=D.bar,Y["--em-header-fg"]=D.barOn),Y});function ge(D){var Y,we;return(we=Gs(Vt((Y=n.data.attributeStyles)==null?void 0:Y[D.modelId])))==null?void 0:we.text}const _e=t.computed(()=>[...T.value.operations??[]].sort((D,Y)=>D.order-Y.order)),V=t.computed(()=>R.value==="CLASS"&&_e.value.length>0),L={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function j(D){return D?L[D]:"~"}function ee(D){var Y,we;return(we=Gs(Vt((Y=n.data.operationStyles)==null?void 0:Y[D.modelId])))==null?void 0:we.text}function Z(D,Y,we){switch(R.value){case"CLASS":return[{text:D}];case"PHYSICAL":return[{text:we||D}];case"LOGICAL":return[Y?{text:Y}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const Re=Y?{text:Y}:{text:i("em.node.logicalMissing"),missing:!0};return we?[Re,{text:` · ${we}`}]:[Re]}}}function pe(D){var Y;return((Y=p.value)==null?void 0:Y.effectiveAttrs.get(D.modelId))??D}function me(D){var Re;if(J(D))return[{text:D.name}];const Y=pe(D),we=Fo(Y,Y.dbAttrs[0]);return Z(ve(D),we==null?void 0:we[a.value],((Re=Y.dbAttrs[0])==null?void 0:Re.physicalName)??"")}function ve(D){return R.value==="CLASS"?D.name:pe(D).derivedIdFieldName||D.name}function Ee(D){return D.attrType.startsWith("EMBED")&&D.dbAttrs.length>0}const W=Nn;function J(D){return Ee(D)||W(D)}function X(D){return W(D)?Mx(n.id,D.modelId):Tx(n.id,D.modelId)}function he(D){return D.attrType==="DIVIDER"}function Te(D){var Y;return((Y=p.value)==null?void 0:Y.embedCols.get(D.modelId))??D.dbAttrs}function De(D){var Y;return(Y=p.value)==null?void 0:Y.redundantSlots.get(D.modelId)}const Oe=t.computed(()=>(f==null?void 0:f.isCollapsed(ch(n.id)))??!1),ie=t.computed(()=>Oe.value&&Ie.value?N.value.reduce((D,Y)=>J(Y)?D+Te(Y).length:D,0):0),Ne=t.computed(()=>N.value.some(D=>J(D)));function Ye(D){const Y=De(D);return!Y||Y.size===0?!1:f?f.isCollapsed(ah(n.id,D.modelId)):!1}function it(D){var Y;return Ye(D)?((Y=De(D))==null?void 0:Y.size)??0:0}function Q(D){return f?f.isCollapsed(X(D)):!1}function ce(D){var Y;return!Ie.value||Oe.value?null:Q(D)?"attr":(((Y=De(D))==null?void 0:Y.size)??0)>0?"slot":null}function je(D){return!Oe.value&&J(D)}function lt(D){return Q(D)?Te(D).length:0}function Xe(D){if(Oe.value||Q(D))return[];const Y=Te(D);if(!Ye(D))return Y;const we=De(D);return Y.filter((Re,re)=>!we.has(re))}function _t(D){f==null||f.toggle(ah(n.id,D.modelId))}function st(D){f==null||f.toggle(X(D))}function kt(){f==null||f.toggle(ch(n.id))}function Et(D){var Y;return Z(D.physicalName,(Y=D.logicalName)==null?void 0:Y[a.value],D.physicalName)}function On(D){var Ge;const Y=H.value.get(D.modelId),we=(Y==null?void 0:Y.collection)??((Ge=p.value)==null?void 0:Ge.collectionTypes.get(D.modelId)),Re=o?_i(D,Ho(o.state.logical),T.value,o.state.logical):void 0,re=(Re==null?void 0:Re.kind)==="resolved"?Re.entity:void 0;return fl(R.value,pe(D),we,Y==null?void 0:Y.targetName,re)}const En=t.computed(()=>{const D={};for(const Y of N.value)D[Y.modelId]=On(Y);return D}),Nt=t.computed(()=>{var D,Y;return Z(T.value.name,(D=In(T.value))==null?void 0:D[a.value],((Y=T.value.table)==null?void 0:Y.physicalName)??"")}),ft=t.ref(!1),ht=t.ref(""),St=t.ref(null);async function Pn(){var D,Y;se.value&&(ht.value=T.value.name,ft.value=!0,await t.nextTick(),(D=St.value)==null||D.focus(),(Y=St.value)==null||Y.select())}function ut(){if(!ft.value)return;ft.value=!1;const D=ht.value.trim();D&&D!==T.value.name&&(o==null||o.renameEntity(n.id,D))}function Be(){o==null||o.addAttribute(n.id)}function q(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:Gt,findNode:K}=tt(),oe=t.ref(null),Me=t.computed(()=>{const D=oe.value??n.data.size;return D?{width:`${D.width}px`,minHeight:`${D.height}px`}:void 0});let ze=null;function Ct(D){var Re,re,Ge;if(!se.value)return;D.stopPropagation();const Y=(Re=K(n.id))==null?void 0:Re.dimensions,we=Gt({x:D.clientX,y:D.clientY});ze={fx:we.x,fy:we.y,w:(Y==null?void 0:Y.width)??((re=n.data.size)==null?void 0:re.width)??200,h:(Y==null?void 0:Y.height)??((Ge=n.data.size)==null?void 0:Ge.height)??120},D.target.setPointerCapture(D.pointerId)}function Tt(D){if(!ze)return;const Y=Gt({x:D.clientX,y:D.clientY});oe.value={width:Math.max(40,ze.w+(Y.x-ze.fx)),height:Math.max(40,ze.h+(Y.y-ze.fy))}}function Ue(D){var Y,we,Re;if(ze&&oe.value&&o){const re=(Y=K(n.id))==null?void 0:Y.dimensions;o.resizeEntity(n.id,{width:Math.round((re==null?void 0:re.width)??oe.value.width),height:Math.round((re==null?void 0:re.height)??oe.value.height)})}ze=null,oe.value=null,(Re=(we=D.target).releasePointerCapture)==null||Re.call(we,D.pointerId)}const M=t.ref(null),w=t.ref(null);function ne(D,Y){if(!se.value)return;Y.stopPropagation(),Y.preventDefault();const we=$.value,Re=we.has(D.modelId)?new Set(we):new Set([D.modelId]);w.value={ids:Re,dropIndex:-1,lineY:0},Y.target.setPointerCapture(Y.pointerId)}function ke(D){if(!w.value||!M.value)return;const Y=Array.from(M.value.querySelectorAll(".em-entity__row"));if(!Y.length)return;let we=Y.length;for(let Ge=0;Ge<Y.length;Ge++){const ct=Y[Ge].getBoundingClientRect();if(D.clientY<ct.top+ct.height/2){we=Ge;break}}const Re=Y[Y.length-1],re=we<Y.length?Y[we].offsetTop:Re.offsetTop+Re.offsetHeight;w.value={...w.value,dropIndex:we,lineY:re}}function Ce(){const D=w.value;if(w.value=null,!D||D.dropIndex<0)return;const Y=N.value,we=Y.filter(Ze=>D.ids.has(Ze.modelId)).map(Ze=>Ze.modelId),Re=Y.filter((Ze,zo)=>D.ids.has(Ze.modelId)&&zo<D.dropIndex).length,re=D.dropIndex-Re,Ge=Y.filter(Ze=>!D.ids.has(Ze.modelId)).map(Ze=>Ze.modelId);[...Ge.slice(0,re),...we,...Ge.slice(re)].join(",")!==Y.map(Ze=>Ze.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,we,re))}function Ve(){w.value=null}const Ke=t.ref(null),He=t.ref(null);function fe(D,Y){se.value&&(Y.stopPropagation(),Y.preventDefault(),He.value={id:D.modelId,dropIndex:-1,lineY:0},Y.target.setPointerCapture(Y.pointerId))}function qe(D){if(!He.value||!Ke.value)return;const Y=Array.from(Ke.value.querySelectorAll(".em-entity__op-row"));if(!Y.length)return;let we=Y.length;for(let Ge=0;Ge<Y.length;Ge++){const ct=Y[Ge].getBoundingClientRect();if(D.clientY<ct.top+ct.height/2){we=Ge;break}}const Re=Y[Y.length-1],re=we<Y.length?Y[we].offsetTop:Re.offsetTop+Re.offsetHeight;He.value={...He.value,dropIndex:we,lineY:re}}function We(){const D=He.value;if(He.value=null,!D||D.dropIndex<0)return;const we=_e.value.findIndex(re=>re.modelId===D.id);if(we<0)return;const Re=D.dropIndex-(we<D.dropIndex?1:0);Re!==we&&(o==null||o.reorderOperations(n.id,[D.id],Re))}function Je(){He.value=null}return(D,Y)=>{var we,Re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":b.value,"is-related":v.value,"is-dimmed":z.value,"is-selected":y.value,"is-multi-selected":S.value,"has-focused-attr":O.value,"is-locked":le.value,"is-reference-only":x.value,"is-diff-added":((we=u.value)==null?void 0:we.verb)==="added","is-diff-modified":((Re=u.value)==null?void 0:Re.verb)==="modified"}]),tabindex:"-1",title:x.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(Me.value),onPointerdown:g,onMouseenter:k,onMouseleave:E,onDblclick:l},[y.value?(t.openBlock(),t.createElementBlock("div",Bx,[...Y[11]||(Y[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(de.value),onDblclick:t.withModifiers(Pn,["stop"])},[ye.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},t.renderList(ae,re=>t.createVNode(t.unref(Qn),{id:re.id,key:re.id,type:"source",position:re.pos,class:"em-handle em-handle--node",title:se.value?i("em.node.connectHintNode"):void 0},null,8,["id","position","title"])),64)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(G.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!G.value,disabled:!_.value,onClick:t.withModifiers(ue,["stop"]),onPointerdown:Y[0]||(Y[0]=t.withModifiers(()=>{},["stop"])),onDblclick:Y[1]||(Y[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(G.value?"▸":"▾"),41,Dx),t.createElementVNode("span",Ox,"«"+t.toDisplayString(t.unref(yi)(T.value.stereotype))+"»",1),ft.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"inputEl",ref:St,"onUpdate:modelValue":Y[2]||(Y[2]=re=>ht.value=re),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(ut,["enter"]),Y[3]||(Y[3]=t.withKeys(re=>ft.value=!1,["esc"]))],onBlur:ut,onPointerdown:Y[4]||(Y[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,ht.value]]):(t.openBlock(),t.createElementBlock("span",Px,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Nt.value,(re,Ge)=>(t.openBlock(),t.createElementBlock("span",{key:Ge,class:t.normalizeClass({"em-entity__missing":re.missing})},t.toDisplayString(re.text),3))),128))])),!G.value&&Ie.value&&Ne.value?(t.openBlock(),t.createElementBlock("button",{key:3,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:Oe.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!Oe.value,onClick:t.withModifiers(kt,["stop"]),onPointerdown:Y[5]||(Y[5]=t.withModifiers(()=>{},["stop"])),onDblclick:Y[6]||(Y[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(xe,{name:"table",size:11}),t.createElementVNode("span",Fx,t.toDisplayString(Oe.value?"▸":"▾"),1)],40,zx)):t.createCommentVNode("",!0),le.value?(t.openBlock(),t.createBlock(xe,{key:4,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:5,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),G.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:M,class:"em-entity__attrs"},[w.value&&w.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${w.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,re=>{var Ge,ct,Ze,zo,da;return t.openBlock(),t.createElementBlock(t.Fragment,{key:re.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":A(re),"is-dragging":(Ge=w.value)==null?void 0:Ge.ids.has(re.modelId),"is-embed":J(re),"is-divider":he(re),"has-embed-badge":!!ce(re),nodrag:he(re)&&se.value,"is-diff-changed":P(re),"is-synthetic":C(re)}]),"data-attr":re.modelId,title:C(re)?i("em.node.derivedIdRow"):void 0,onClick:t.withModifiers(yt=>B(re,yt),["stop"]),onPointerdown:yt=>he(re)?ne(re,yt):void 0,onPointermove:yt=>he(re)?ke(yt):void 0,onPointerup:yt=>he(re)?Ce():void 0,onPointercancel:yt=>he(re)?Ve():void 0},[se.value&&!he(re)&&!C(re)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:yt=>ne(re,yt),onPointermove:ke,onPointerup:Ce,onPointercancel:Ve,onClick:Y[7]||(Y[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Hx)):t.createCommentVNode("",!0),he(re)?(t.openBlock(),t.createElementBlock("span",jx,t.toDisplayString(re.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Qn),{id:`l:${re.modelId}`,type:"target",position:t.unref($e).Left,class:"em-handle",title:se.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:Ae(Pe.value[re.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",Gx,[(ct=Pe.value[re.modelId])!=null&&ct.pk?(t.openBlock(),t.createBlock(xe,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Ze=Pe.value[re.modelId])!=null&&Ze.required?(t.openBlock(),t.createBlock(xe,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",Yx,[Ie.value&&je(re)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:Q(re)?i("em.node.embedAttrShow",{count:lt(re)}):i("em.node.embedAttrHide"),"aria-expanded":!Q(re),onClick:t.withModifiers(yt=>st(re),["stop"]),onPointerdown:Y[8]||(Y[8]=t.withModifiers(()=>{},["stop"])),onDblclick:Y[9]||(Y[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(Q(re)?"▸":"▾"),41,qx)):J(re)?(t.openBlock(),t.createBlock(xe,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(zo=Pe.value[re.modelId])!=null&&zo.fk?(t.openBlock(),t.createBlock(xe,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,Kx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:ge(re)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me(re),(yt,zn)=>(t.openBlock(),t.createElementBlock("span",{key:zn,class:t.normalizeClass({"em-entity__missing":yt.missing})},t.toDisplayString(yt.text),3))),128))],4),ce(re)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:lt(re)}),onClick:t.withModifiers(yt=>st(re),["stop"])},"+"+t.toDisplayString(lt(re)),9,Wx)):ce(re)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:Ye(re)?i("em.node.embedRepeatedShow",{count:((da=De(re))==null?void 0:da.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!Ye(re),onClick:t.withModifiers(yt=>_t(re),["stop"])},t.toDisplayString(Ye(re)?`+${it(re)}`:"−"),9,Jx)):t.createCommentVNode("",!0),En.value[re.modelId]?(t.openBlock(),t.createElementBlock("span",Xx,t.toDisplayString(En.value[re.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Qn),{id:`r:${re.modelId}`,type:"source",position:t.unref($e).Right,class:"em-handle",title:se.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,Ux),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J(re)&&Ie.value?Xe(re):[],yt=>(t.openBlock(),t.createElementBlock("li",{key:`${re.modelId}:${yt.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":A(re)}]),onClick:t.withModifiers(zn=>B(re,zn),["stop"])},[Y[12]||(Y[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",Qx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Et(yt),(zn,et)=>(t.openBlock(),t.createElementBlock("span",{key:et,class:t.normalizeClass({"em-entity__missing":zn.missing})},t.toDisplayString(zn.text),3))),128))]),t.createElementVNode("span",eR,t.toDisplayString(yt.dataType),1)],10,Zx))),128))],64)}),128)),ie.value?(t.openBlock(),t.createElementBlock("li",tR,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(kt,["stop"])},[t.createVNode(xe,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:ie.value})),1)],8,nR)])):t.createCommentVNode("",!0)],512)),!G.value&&V.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ke,class:"em-entity__ops"},[He.value&&He.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${He.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,re=>{var Ge,ct;return t.openBlock(),t.createElementBlock("li",{key:re.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ge=He.value)==null?void 0:Ge.id)===re.modelId,"is-diff-changed":!!((ct=u.value)!=null&&ct.changedOperationIds.has(re.modelId))}]),"data-op":re.modelId},[se.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ze=>fe(re,Ze),onPointermove:qe,onPointerup:We,onPointercancel:Je,onClick:Y[10]||(Y[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,iR)):t.createCommentVNode("",!0),t.createElementVNode("span",aR,t.toDisplayString(j(re.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:ee(re)})},t.toDisplayString(re.name)+"()",5)],10,oR)}),128))],512)):_e.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:_e.value.length})},[t.createVNode(xe,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:_e.value.length})),1)],8,rR)):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("footer",lR,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Be},t.toDisplayString(i("em.node.addAttr")),1),Y[13]||(Y[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:q},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),se.value&&!ft.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:Ct,onPointermove:Tt,onPointerup:Ue},null,32)):t.createCommentVNode("",!0)],46,Lx)}}}),[["__scopeId","data-v-0224247e"]]),sR={key:0,class:"em-sel","aria-hidden":"true"},cR={class:"em-group__label"},dR={class:"em-group__name"},uR={key:0,class:"em-group__pkg"},mR={key:1,class:"em-group__flag"},uh=Qe(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(()=>Vt(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(eo,null),s=(T,x)=>l?l.t(T,x):rn("ko",T,x),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($r,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Lo,null);function h(){n.id&&(f==null||f.setGroupHover(n.id))}function _(){f==null||f.setGroupHover(null)}const g=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),k=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:E,findNode:b}=tt();let v=null,y=null;function S(T){var N;if(!n.id||!c.value)return;T.stopPropagation();const x=((N=b(n.id))==null?void 0:N.dimensions)??{width:400,height:300},R=E({x:T.clientX,y:T.clientY});v={fx:R.x,fy:R.y,w:x.width,h:x.height},T.target.setPointerCapture(T.pointerId)}function $(T){if(!v||!n.id)return;const x=E({x:T.clientX,y:T.clientY});y={width:Math.max(160,v.w+(x.x-v.fx)),height:Math.max(120,v.h+(x.y-v.fy))};const R=b(n.id);R&&(R.style={width:`${y.width}px`,height:`${y.height}px`})}function O(T){var x,R;v&&y&&n.id&&l&&l.resizeGroup(n.id,y),v=null,y=null,(R=(x=T.target).releasePointerCapture)==null||R.call(x,T.pointerId)}const B=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),z=t.computed(()=>{const T=o.value.name;return Mt(T,B.value)||o.value.packageName||s("em.group.fallback")});return(T,x)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":g.value,"is-dimmed":k.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:h,onMouseleave:_},[d.value?(t.openBlock(),t.createElementBlock("div",sR,[...x[0]||(x[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",cR,[t.createElementVNode("span",dR,t.toDisplayString(z.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",uR,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",mR,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(xe,{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:S,onPointermove:$,onPointerup:O},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-4fd27d62"]]),fR={key:0,class:"em-sel","aria-hidden":"true"},pR={key:2,class:"em-note__text"},mh=Qe(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(eo,null),i=t.inject($r,null),a=t.inject(Lo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>Vt(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const p=t.computed(()=>{var N;return((N=a==null?void 0:a.source.value)==null?void 0:N.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),h=t.computed(()=>{var N;return((N=o==null?void 0:o.selection.value)==null?void 0:N.kind)==="note"&&o.selection.value.id===n.id}),_=t.computed(()=>!!n.selected&&!h.value),g=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!h.value),k=[{id:"n-top",pos:$e.Top},{id:"n-right",pos:$e.Right},{id:"n-bottom",pos:$e.Bottom},{id:"n-left",pos:$e.Left}],E=t.ref(!1),b=t.ref(""),v=t.ref(null);async function y(){var N;l.value&&(b.value=r.value.memo,E.value=!0,await t.nextTick(),(N=v.value)==null||N.focus())}function S(){E.value&&(E.value=!1,b.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,b.value)))}const{screenToFlowCoordinate:$,findNode:O}=tt();let B=null,z=null;function T(N){var U;if(!l.value)return;N.stopPropagation();const I=((U=O(n.id))==null?void 0:U.dimensions)??r.value.geo.size,C=$({x:N.clientX,y:N.clientY});B={fx:C.x,fy:C.y,w:I.width,h:I.height},N.target.setPointerCapture(N.pointerId)}function x(N){if(!B)return;const I=$({x:N.clientX,y:N.clientY});z={width:Math.max(140,B.w+(I.x-B.fx)),height:Math.max(60,B.h+(I.y-B.fy))};const C=O(n.id);C&&(C.style={width:`${z.width}px`,height:`${z.height}px`})}function R(N){var I,C;B&&z&&o&&o.resizeNote(n.id,z),B=null,z=null,(C=(I=N.target).releasePointerCapture)==null||C.call(I,N.pointerId)}return(N,I)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":g.value,"is-selected":h.value,"is-multi-selected":_.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:y,onPointerdown:d,onMouseenter:u,onMouseleave:m},[h.value?(t.openBlock(),t.createElementBlock("div",fR,[...I[4]||(I[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),E.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:v,"onUpdate:modelValue":I[0]||(I[0]=C=>b.value=C),class:"em-note__edit nodrag",onBlur:S,onKeydown:I[1]||(I[1]=t.withKeys(C=>E.value=!1,["esc"])),onPointerdown:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,b.value]]):(t.openBlock(),t.createElementBlock("div",pR,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(k,C=>t.createVNode(t.unref(Qn),{id:C.id,key:C.id,type:"source",position:C.pos,class:"em-note-handle",onPointerdown:I[3]||(I[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!E.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:T,onPointermove:x,onPointerup:R},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Tr(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 di=.5;function fh(e,n,o,i,a,r){const l=Tr(n),s=Tr(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let p=e;const f=(g,k)=>{(Math.abs(g.x-p.x)>=di||Math.abs(g.y-p.y)>=di)&&(m.push({a:p,b:g,seg:k}),p=g)};f(c,0);let h=l.x!==0,_=c;for(let g=1;g<u.length;g++){const k=u[g],E=g<=o.length?g-1:o.length,b=Math.abs(k.x-_.x)<di,v=Math.abs(k.y-_.y)<di;b&&v||(b?(f(k,E),h=!1):v?(f(k,E),h=!0):h?(f({x:_.x,y:k.y},E),f(k,E),h=!0):(f({x:k.x,y:_.y},E),f(k,E),h=!1),_=k)}return f(i,o.length),m}function Qs(e,n,o,i,a,r=20){const l=fh(e,n,o,i,a,r);let s=`M ${Lt(e.x)},${Lt(e.y)}`;for(const c of l)s+=` L ${Lt(c.b.x)},${Lt(c.b.y)}`;return s}const hR=14;function ph(e,n,o,i,a,r=20){return fh(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=hR).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function Lt(e){return Math.round(e*100)/100}const yR=36;function gR(e,n,o=yR){const i=Math.max(e.x,n.x)+o;return`M ${Lt(e.x)},${Lt(e.y)} L ${Lt(i)},${Lt(e.y)} L ${Lt(i)},${Lt(n.y)} L ${Lt(n.x)},${Lt(n.y)}`}function ec(e,n,o){const i=[e,...n,o];let a=`M ${Lt(i[0].x)},${Lt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${Lt(i[r].x)},${Lt(i[r].y)}`;return a}function bR(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function hh(e,n){const o=bR(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<di&&Math.abs(l)<di)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 yh(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 gh(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 _R=20,kR=22,ER=7,NR=22,bh=31,_h=7,wR=20,kh=11,Eh=11,IR=bh+_h;function vR(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function CR(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Mr(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function Nh(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function Vr(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function wh(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Nh(e,n);return[Vr(o,a,r-Math.PI/2),Vr(o,a,r+Math.PI/2)]}function Ih(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 vh(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Mr(e,n,_R),[d,u]=wh(e,n,c,kR);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}),vR(o.multiplicity)){const m=Mr(e,n,bh);r.push({cx:m.x,cy:m.y,r:_h})}if(CR(o.multiplicity)){const m=Mr(e,n,ER),[p,f]=wh(e,n,m,NR);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Mr(e,n,wR),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Nh(e,n),m=Vr(d,kh/2,u-Math.PI/2),p=Vr(d,kh/2,u+Math.PI/2);l.push({points:[e,m,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=Ih(s,c,Eh,!0),u=Ih(s,c,Eh,!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 Ch=200,Sh=120,tc=24;function xh(e){var a,r;if(!e)return{x:0,y:0,width:Ch,height:Sh};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Ch,i=((r=e.dimensions)==null?void 0:r.height)||Sh;return{x:n.x,y:n.y,width:o,height:i}}function Rh(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function nc(e){const n=t.computed(()=>xh(e.sourceNode())),o=t.computed(()=>xh(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,h;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<tc){const _=(m+p)/2;m=_-tc/2,p=_+tc/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??Rh(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Rh(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?yh(n.value,d,r.value.x):hh(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?yh(o.value,d,l.value.x):hh(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 oc=Symbol("waypointController"),SR=["d"],xR=["d"],RR=["d"],AR=["x1","y1","x2","y2"],$R=["cx","cy","r"],TR=["x","y"],MR=["x","y"],VR=["cx","cy","onDblclick"],LR=["x","y","onPointerdown","onDblclick"],Ah=Qe(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=tt(),i=t.inject(oc),a=t.inject(eo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Zp,null),s=t.inject(Lo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var de;return((de=a==null?void 0:a.selection.value)==null?void 0:de.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 de=l==null?void 0:l.value;if(!de||!a)return null;const ge=a.resolved.value.entities,_e=L=>{var j;return(j=ge.find(ee=>ee.entity.modelId===L))==null?void 0:j.groupRef},V=n.data.association;return _e(V.end1.entityRef)===de.groupId&&_e(V.end2.entityRef)===de.groupId?{dx:de.dx,dy:de.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),h=t.ref({x:0,y:0}),_=t.computed(()=>{const de=m.value;return p.value.map((ge,_e)=>_e===f.value?h.value:de?{x:ge.x+de.dx,y:ge.y+de.dy}:ge)}),g=t.computed(()=>{var de;return!!((de=n.sourceNode.data)!=null&&de.collapsed)}),k=t.computed(()=>{var de;return!!((de=n.targetNode.data)!=null&&de.collapsed)}),{source:E,target:b,sourceSide:v,targetSide:y,isSelf:S}=nc({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>_.value,sourceRowY:()=>n.data.sourceColumnRef&&!g.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!k.value?n.targetY:void 0}),$=IR+4,O=t.computed(()=>S.value?gR(E.value,b.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Qs(E.value,v.value,_.value,b.value,y.value,$):ec(E.value,_.value,b.value)),B=t.computed(()=>S.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ph(E.value,v.value,_.value,b.value,y.value,$):gh(E.value,_.value,b.value).map((de,ge)=>({point:de,segIndex:ge}))),z=t.computed(()=>S.value||!r.value?[]:_.value),T=Ea;function x(de,ge){f.value=de,h.value={...p.value[de]},ge.target.setPointerCapture(ge.pointerId),ge.stopPropagation()}function R(de){if(f.value<0)return;const ge=o({x:de.clientX,y:de.clientY});h.value={x:ge.x,y:ge.y}}function N(de){var ge,_e;f.value>=0&&i&&i.movePoint(n.id,f.value,{...h.value}),f.value=-1,(_e=(ge=de.target).releasePointerCapture)==null||_e.call(ge,de.pointerId)}function I(de,ge){ge.stopPropagation(),i==null||i.removePoint(n.id,de)}function C(de,ge){if(!i)return;const _e=o({x:ge.clientX,y:ge.clientY});i.insertPoint(n.id,de,{x:_e.x,y:_e.y})}const U=t.computed(()=>T(n.data.association.end1.multiplicity)),A=t.computed(()=>T(n.data.association.end2.multiplicity)),P=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),F=t.computed(()=>P.value==="class"),H=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const de=Tr(v.value);return{x:E.value.x+de.x*10,y:E.value.y+de.y*10}}return _.value[0]??b.value}),G=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ge=Tr(y.value);return{x:b.value.x+ge.x*10,y:b.value.y+ge.y*10}}const de=_.value;return de[de.length-1]??E.value}),le=t.computed(()=>{const de=n.data.association;return{multiplicity:de.end1.multiplicity,navigable:de.end1.navigable,composition:de.end1.composition,otherNavigable:de.end2.navigable}}),se=t.computed(()=>{const de=n.data.association;return{multiplicity:de.end2.multiplicity,navigable:de.end2.navigable,composition:de.end2.composition,otherNavigable:de.end1.navigable}}),ue=t.computed(()=>vh(E.value,H.value,le.value,P.value)),ye=t.computed(()=>vh(b.value,G.value,se.value,P.value)),ae=t.computed(()=>[...ue.value.lines,...ye.value.lines]),Ie=t.computed(()=>[...ue.value.circles,...ye.value.circles]),Pe=t.computed(()=>[...ue.value.polygons,...ye.value.polygons].map(de=>`M${de.points.map(ge=>`${ge.x},${ge.y}`).join(" L")} Z`)),Ae=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(de,ge)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:O.value,fill:"none",class:"em-edge__hit"},null,8,SR),t.createElementVNode("path",{d:O.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,xR),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Pe.value,(_e,V)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${V}`,d:_e,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",Ae.value])},null,10,RR))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ae.value,(_e,V)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${V}`,x1:_e.x1,y1:_e.y1,x2:_e.x2,y2:_e.y2,class:t.normalizeClass(["em-edge__marker",Ae.value])},null,10,AR))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.value,(_e,V)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${V}`,cx:_e.cx,cy:_e.cy,r:_e.r,class:t.normalizeClass(["em-edge__marker",Ae.value])},null,10,$R))),128)),F.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(E).x+8,y:t.unref(E).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(U.value),11,TR),t.createElementVNode("text",{x:t.unref(b).x-8,y:t.unref(b).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(A.value),11,MR)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.value,(_e,V)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${V}`,cx:_e.point.x,cy:_e.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(L=>C(_e.segIndex,L),["stop"])},null,42,VR))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(z.value,(_e,V)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${V}`,x:_e.x-5,y:_e.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>x(V,L),onPointermove:R,onPointerup:N,onDblclick:L=>I(V,L)},null,42,LR))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var Vn=(e=>(e.Lines="lines",e.Dots="dots",e))(Vn||{});const $h=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]}`})},Th=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};Vn.Lines+"",Vn.Dots+"";const BR={[Vn.Dots]:"#81818a",[Vn.Lines]:"#eee"},DR=["id","x","y","width","height","patternTransform"],OR={key:2,height:"100",width:"100"},PR=["fill"],zR=["x","y","fill"],FR={name:"Background",compatConfig:{MODE:3}},UR=t.defineComponent({...FR,props:{id:{},variant:{default:()=>Vn.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}=tt(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||BR[e.variant||Vn.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(Vn).Lines?(t.openBlock(),t.createBlock(t.unref($h),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(Vn).Dots?(t.openBlock(),t.createBlock(t.unref(Th),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",OR,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,PR)])):t.createCommentVNode("",!0)])],8,DR)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,zR),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),HR={name:"ControlButton",compatConfig:{MODE:3}},jR=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},KR={type:"button",class:"vue-flow__controls-button"};function GR(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",KR,[t.renderSlot(e.$slots,"default")])}const Bo=jR(HR,[["render",GR]]),YR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},qR=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function WR(e,n){return t.openBlock(),t.createElementBlock("svg",YR,qR)}const JR={render:WR},XR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ZR=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function QR(e,n){return t.openBlock(),t.createElementBlock("svg",XR,ZR)}const eA={render:QR},tA={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},nA=[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 oA(e,n){return t.openBlock(),t.createElementBlock("svg",tA,nA)}const iA={render:oA},aA={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},rA=[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 lA(e,n){return t.openBlock(),t.createElementBlock("svg",aA,rA)}const sA={render:lA},cA={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dA=[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 uA(e,n){return t.openBlock(),t.createElementBlock("svg",cA,dA)}const mA={render:uA},fA={name:"Controls",compatConfig:{MODE:3}},pA=t.defineComponent({...fA,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Df.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}=tt(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),h=t.toRef(()=>d.value.zoom>=m.value);function _(){l(),n("zoomIn")}function g(){s(),n("zoomOut")}function k(){c(e.fitViewParams),n("fitView")}function E(){r(!p.value),n("interactionChange",!p.value)}return(b,v)=>(t.openBlock(),t.createBlock(t.unref(Lp),{class:"vue-flow__controls",position:b.position},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"top"),b.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(b.$slots,"control-zoom-in",{},()=>[t.createVNode(Bo,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(JR))))])]),_:3},8,["disabled"])]),t.renderSlot(b.$slots,"control-zoom-out",{},()=>[t.createVNode(Bo,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(eA))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),b.showFitView?t.renderSlot(b.$slots,"control-fit-view",{key:1},()=>[t.createVNode(Bo,{class:"vue-flow__controls-fitview",onClick:k},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(iA))))])]),_:3})]):t.createCommentVNode("",!0),b.showInteractive?t.renderSlot(b.$slots,"control-interactive",{key:2},()=>[b.showInteractive?(t.openBlock(),t.createBlock(Bo,{key:0,class:"vue-flow__controls-interactive",onClick:E},{default:t.withCtx(()=>[p.value?t.renderSlot(b.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(mA))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(b.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(sA))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(b.$slots,"default")]),_:3},8,["position"]))}});var hA={value:()=>{}};function ic(){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 Lr(o)}function Lr(e){this._=e}function yA(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}})}Lr.prototype=ic.prototype={constructor:Lr,on:function(e,n){var o=this._,i=yA(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=gA(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]=Mh(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Mh(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 Lr(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 gA(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Mh(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=hA,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ac="http://www.w3.org/1999/xhtml";const Vh={svg:"http://www.w3.org/2000/svg",xhtml:ac,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Br(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Vh.hasOwnProperty(n)?{space:Vh[n],local:e}:e}function bA(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ac&&n.documentElement.namespaceURI===ac?n.createElement(e):n.createElementNS(o,e)}}function _A(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Lh(e){var n=Br(e);return(n.local?_A:bA)(n)}function kA(){}function rc(e){return e==null?kA:function(){return this.querySelector(e)}}function EA(e){typeof e!="function"&&(e=rc(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 NA(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wA(){return[]}function Bh(e){return e==null?wA:function(){return this.querySelectorAll(e)}}function IA(e){return function(){return NA(e.apply(this,arguments))}}function vA(e){typeof e=="function"?e=IA(e):e=Bh(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 Dh(e){return function(){return this.matches(e)}}function Oh(e){return function(n){return n.matches(e)}}var CA=Array.prototype.find;function SA(e){return function(){return CA.call(this.children,e)}}function xA(){return this.firstElementChild}function RA(e){return this.select(e==null?xA:SA(typeof e=="function"?e:Oh(e)))}var AA=Array.prototype.filter;function $A(){return Array.from(this.children)}function TA(e){return function(){return AA.call(this.children,e)}}function MA(e){return this.selectAll(e==null?$A:TA(typeof e=="function"?e:Oh(e)))}function VA(e){typeof e!="function"&&(e=Dh(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 Ph(e){return new Array(e.length)}function LA(){return new Kt(this._enter||this._groups.map(Ph),this._parents)}function Dr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Dr.prototype={constructor:Dr,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 BA(e){return function(){return e}}function DA(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 Dr(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function OA(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new Dr(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function PA(e){return e.__data__}function zA(e,n){if(!arguments.length)return Array.from(this,PA);var o=n?OA:DA,i=this._parents,a=this._groups;typeof e!="function"&&(e=BA(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=FA(e.call(u,u&&u.__data__,d,i)),h=f.length,_=s[d]=new Array(h),g=l[d]=new Array(h),k=c[d]=new Array(p);o(u,m,_,g,k,f,n);for(var E=0,b=0,v,y;E<h;++E)if(v=_[E]){for(E>=b&&(b=E+1);!(y=g[b])&&++b<h;);v._next=y||null}}return l=new Kt(l,i),l._enter=s,l._exit=c,l}function FA(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function UA(){return new Kt(this._exit||this._groups.map(Ph),this._parents)}function HA(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 jA(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Kt(s,this._parents)}function KA(){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 GA(e){e||(e=YA);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Kt(a,this._parents).order()}function YA(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function qA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function WA(){return Array.from(this)}function JA(){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 XA(){let e=0;for(const n of this)++e;return e}function ZA(){return!this.node()}function QA(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 e$(e){return function(){this.removeAttribute(e)}}function t$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function n$(e,n){return function(){this.setAttribute(e,n)}}function o$(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function i$(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function a$(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function r$(e,n){var o=Br(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?t$:e$:typeof n=="function"?o.local?a$:i$:o.local?o$:n$)(o,n))}function zh(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function l$(e){return function(){this.style.removeProperty(e)}}function s$(e,n,o){return function(){this.style.setProperty(e,n,o)}}function c$(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function d$(e,n,o){return arguments.length>1?this.each((n==null?l$:typeof n=="function"?c$:s$)(e,n,o??"")):ui(this.node(),e)}function ui(e,n){return e.style.getPropertyValue(n)||zh(e).getComputedStyle(e,null).getPropertyValue(n)}function u$(e){return function(){delete this[e]}}function m$(e,n){return function(){this[e]=n}}function f$(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function p$(e,n){return arguments.length>1?this.each((n==null?u$:typeof n=="function"?f$:m$)(e,n)):this.node()[e]}function Fh(e){return e.trim().split(/^|\s+/)}function lc(e){return e.classList||new Uh(e)}function Uh(e){this._node=e,this._names=Fh(e.getAttribute("class")||"")}Uh.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 Hh(e,n){for(var o=lc(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function jh(e,n){for(var o=lc(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function h$(e){return function(){Hh(this,e)}}function y$(e){return function(){jh(this,e)}}function g$(e,n){return function(){(n.apply(this,arguments)?Hh:jh)(this,e)}}function b$(e,n){var o=Fh(e+"");if(arguments.length<2){for(var i=lc(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?g$:n?h$:y$)(o,n))}function _$(){this.textContent=""}function k$(e){return function(){this.textContent=e}}function E$(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function N$(e){return arguments.length?this.each(e==null?_$:(typeof e=="function"?E$:k$)(e)):this.node().textContent}function w$(){this.innerHTML=""}function I$(e){return function(){this.innerHTML=e}}function v$(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function C$(e){return arguments.length?this.each(e==null?w$:(typeof e=="function"?v$:I$)(e)):this.node().innerHTML}function S$(){this.nextSibling&&this.parentNode.appendChild(this)}function x$(){return this.each(S$)}function R$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function A$(){return this.each(R$)}function $$(e){var n=typeof e=="function"?e:Lh(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function T$(){return null}function M$(e,n){var o=typeof e=="function"?e:Lh(e),i=n==null?T$:typeof n=="function"?n:rc(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function V$(){var e=this.parentNode;e&&e.removeChild(this)}function L$(){return this.each(V$)}function B$(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function D$(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function O$(e){return this.select(e?D$:B$)}function P$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function z$(e){return function(n){e.call(this,n,this.__data__)}}function F$(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 U$(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 H$(e,n,o){return function(){var i=this.__on,a,r=z$(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 j$(e,n,o){var i=F$(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?H$:U$,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Kh(e,n,o){var i=zh(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 K$(e,n){return function(){return Kh(this,e,n)}}function G$(e,n){return function(){return Kh(this,e,n.apply(this,arguments))}}function Y$(e,n){return this.each((typeof n=="function"?G$:K$)(e,n))}function*q$(){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 Gh=[null];function Kt(e,n){this._groups=e,this._parents=n}function Zi(){return new Kt([[document.documentElement]],Gh)}function W$(){return this}Kt.prototype=Zi.prototype={constructor:Kt,select:EA,selectAll:vA,selectChild:RA,selectChildren:MA,filter:VA,data:zA,enter:LA,exit:UA,join:HA,merge:jA,selection:W$,order:KA,sort:GA,call:qA,nodes:WA,node:JA,size:XA,empty:ZA,each:QA,attr:r$,style:d$,property:p$,classed:b$,text:N$,html:C$,raise:x$,lower:A$,append:$$,insert:M$,remove:L$,clone:O$,datum:P$,on:j$,dispatch:Y$,[Symbol.iterator]:q$};function to(e){return typeof e=="string"?new Kt([[document.querySelector(e)]],[document.documentElement]):new Kt([[e]],Gh)}function J$(e){let n;for(;n=e.sourceEvent;)e=n;return e}function no(e,n){if(e=J$(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 sc={capture:!0,passive:!1};function cc(e){e.preventDefault(),e.stopImmediatePropagation()}function X$(e){var n=e.document.documentElement,o=to(e).on("dragstart.drag",cc,sc);"onselectstart"in n?o.on("selectstart.drag",cc,sc):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Z$(e,n){var o=e.document.documentElement,i=to(e).on("dragstart.drag",null);n&&(i.on("click.drag",cc,sc),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 dc(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Yh(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Qi(){}var ea=.7,Or=1/ea,mi="\\s*([+-]?\\d+)\\s*",ta="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Q$=/^#([0-9a-f]{3,8})$/,eT=new RegExp(`^rgb\\(${mi},${mi},${mi}\\)$`),tT=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),nT=new RegExp(`^rgba\\(${mi},${mi},${mi},${ta}\\)$`),oT=new RegExp(`^rgba\\(${_n},${_n},${_n},${ta}\\)$`),iT=new RegExp(`^hsl\\(${ta},${_n},${_n}\\)$`),aT=new RegExp(`^hsla\\(${ta},${_n},${_n},${ta}\\)$`),qh={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};dc(Qi,na,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wh,formatHex:Wh,formatHex8:rT,formatHsl:lT,formatRgb:Jh,toString:Jh});function Wh(){return this.rgb().formatHex()}function rT(){return this.rgb().formatHex8()}function lT(){return ty(this).formatHsl()}function Jh(){return this.rgb().formatRgb()}function na(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Q$.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Xh(n):o===3?new zt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Pr(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Pr(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=eT.exec(e))?new zt(n[1],n[2],n[3],1):(n=tT.exec(e))?new zt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=nT.exec(e))?Pr(n[1],n[2],n[3],n[4]):(n=oT.exec(e))?Pr(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=iT.exec(e))?ey(n[1],n[2]/100,n[3]/100,1):(n=aT.exec(e))?ey(n[1],n[2]/100,n[3]/100,n[4]):qh.hasOwnProperty(e)?Xh(qh[e]):e==="transparent"?new zt(NaN,NaN,NaN,0):null}function Xh(e){return new zt(e>>16&255,e>>8&255,e&255,1)}function Pr(e,n,o,i){return i<=0&&(e=n=o=NaN),new zt(e,n,o,i)}function sT(e){return e instanceof Qi||(e=na(e)),e?(e=e.rgb(),new zt(e.r,e.g,e.b,e.opacity)):new zt}function uc(e,n,o,i){return arguments.length===1?sT(e):new zt(e,n,o,i??1)}function zt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}dc(zt,uc,Yh(Qi,{brighter(e){return e=e==null?Or:Math.pow(Or,e),new zt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ea:Math.pow(ea,e),new zt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new zt(Do(this.r),Do(this.g),Do(this.b),zr(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:Zh,formatHex:Zh,formatHex8:cT,formatRgb:Qh,toString:Qh}));function Zh(){return`#${Oo(this.r)}${Oo(this.g)}${Oo(this.b)}`}function cT(){return`#${Oo(this.r)}${Oo(this.g)}${Oo(this.b)}${Oo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qh(){const e=zr(this.opacity);return`${e===1?"rgb(":"rgba("}${Do(this.r)}, ${Do(this.g)}, ${Do(this.b)}${e===1?")":`, ${e})`}`}function zr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Do(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Oo(e){return e=Do(e),(e<16?"0":"")+e.toString(16)}function ey(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new ln(e,n,o,i)}function ty(e){if(e instanceof ln)return new ln(e.h,e.s,e.l,e.opacity);if(e instanceof Qi||(e=na(e)),!e)return new ln;if(e instanceof ln)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 ln(l,s,c,e.opacity)}function dT(e,n,o,i){return arguments.length===1?ty(e):new ln(e,n,o,i??1)}function ln(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}dc(ln,dT,Yh(Qi,{brighter(e){return e=e==null?Or:Math.pow(Or,e),new ln(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ea:Math.pow(ea,e),new ln(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 zt(mc(e>=240?e-240:e+120,a,i),mc(e,a,i),mc(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new ln(ny(this.h),Fr(this.s),Fr(this.l),zr(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=zr(this.opacity);return`${e===1?"hsl(":"hsla("}${ny(this.h)}, ${Fr(this.s)*100}%, ${Fr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ny(e){return e=(e||0)%360,e<0?e+360:e}function Fr(e){return Math.max(0,Math.min(1,e||0))}function mc(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 oy=e=>()=>e;function uT(e,n){return function(o){return e+o*n}}function mT(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 fT(e){return(e=+e)==1?iy:function(n,o){return o-n?mT(n,o,e):oy(isNaN(n)?o:n)}}function iy(e,n){var o=n-e;return o?uT(e,o):oy(isNaN(e)?n:e)}const ay=(function e(n){var o=fT(n);function i(a,r){var l=o((a=uc(a)).r,(r=uc(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=iy(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 oo(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var fc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pc=new RegExp(fc.source,"g");function pT(e){return function(){return e}}function hT(e){return function(n){return e(n)+""}}function yT(e,n){var o=fc.lastIndex=pc.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=fc.exec(e))&&(a=pc.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:oo(i,a)})),o=pc.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?hT(c[0].x):pT(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 ry=180/Math.PI,hc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ly(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)*ry,skewX:Math.atan(c)*ry,scaleX:l,scaleY:s}}var Ur;function gT(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?hc:ly(n.a,n.b,n.c,n.d,n.e,n.f)}function bT(e){return e==null||(Ur||(Ur=document.createElementNS("http://www.w3.org/2000/svg","g")),Ur.setAttribute("transform",e),!(e=Ur.transform.baseVal.consolidate()))?hc:(e=e.matrix,ly(e.a,e.b,e.c,e.d,e.e,e.f))}function sy(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var _=f.push("translate(",null,n,null,o);h.push({i:_-4,x:oo(d,m)},{i:_-2,x:oo(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:oo(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:oo(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var _=f.push(a(f)+"scale(",null,",",null,")");h.push({i:_-4,x:oo(d,m)},{i:_-2,x:oo(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,_=p.length,g;++h<_;)m[(g=p[h]).i]=g.x(f);return m.join("")}}}var _T=sy(gT,"px, ","px)","deg)"),kT=sy(bT,", ",")",")"),ET=1e-12;function cy(e){return((e=Math.exp(e))+1/e)/2}function NT(e){return((e=Math.exp(e))-1/e)/2}function wT(e){return((e=Math.exp(2*e))-1)/(e+1)}const IT=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,_=f*f+h*h,g,k;if(_<ET)k=Math.log(p/d)/n,g=function($){return[s+$*f,c+$*h,d*Math.exp(n*$*k)]};else{var E=Math.sqrt(_),b=(p*p-d*d+i*_)/(2*d*o*E),v=(p*p-d*d-i*_)/(2*p*o*E),y=Math.log(Math.sqrt(b*b+1)-b),S=Math.log(Math.sqrt(v*v+1)-v);k=(S-y)/n,g=function($){var O=$*k,B=cy(y),z=d/(o*E)*(B*wT(n*O+y)-NT(y));return[s+z*f,c+z*h,d*B/cy(n*O+y)]}}return g.duration=k*1e3*n/Math.SQRT2,g}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var fi=0,oa=0,ia=0,dy=1e3,Hr,aa,jr=0,Po=0,Kr=0,ra=typeof performance=="object"&&performance.now?performance:Date,uy=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yc(){return Po||(uy(vT),Po=ra.now()+Kr)}function vT(){Po=0}function Gr(){this._call=this._time=this._next=null}Gr.prototype=my.prototype={constructor:Gr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?yc():+o)+(n==null?0:+n),!this._next&&aa!==this&&(aa?aa._next=this:Hr=this,aa=this),this._call=e,this._time=o,gc()},stop:function(){this._call&&(this._call=null,this._time=1/0,gc())}};function my(e,n,o){var i=new Gr;return i.restart(e,n,o),i}function CT(){yc(),++fi;for(var e=Hr,n;e;)(n=Po-e._time)>=0&&e._call.call(void 0,n),e=e._next;--fi}function fy(){Po=(jr=ra.now())+Kr,fi=oa=0;try{CT()}finally{fi=0,xT(),Po=0}}function ST(){var e=ra.now(),n=e-jr;n>dy&&(Kr-=n,jr=e)}function xT(){for(var e,n=Hr,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:Hr=o);aa=e,gc(i)}function gc(e){if(!fi){oa&&(oa=clearTimeout(oa));var n=e-Po;n>24?(e<1/0&&(oa=setTimeout(fy,e-ra.now()-Kr)),ia&&(ia=clearInterval(ia))):(ia||(jr=ra.now(),ia=setInterval(ST,dy)),fi=1,uy(fy))}}function py(e,n,o){var i=new Gr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var RT=ic("start","end","cancel","interrupt"),AT=[],hy=0,yy=1,bc=2,Yr=3,gy=4,_c=5,qr=6;function Wr(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:RT,tween:AT,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:hy})}function kc(e,n){var o=sn(e,n);if(o.state>hy)throw new Error("too late; already scheduled");return o}function kn(e,n){var o=sn(e,n);if(o.state>Yr)throw new Error("too late; already running");return o}function sn(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=my(r,0,o.time);function r(d){o.state=yy,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==yy)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Yr)return py(l);f.state===gy?(f.state=qr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=qr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(py(function(){o.state===Yr&&(o.state=gy,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=bc,o.on.call("start",e,e.__data__,o.index,o.group),o.state===bc){for(o.state=Yr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=_c,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===_c&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=qr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Jr(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>bc&&i.state<_c,i.state=qr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function TT(e){return this.each(function(){Jr(this,e)})}function MT(e,n){var o,i;return function(){var a=kn(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 VT(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=kn(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 LT(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=sn(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?MT:VT)(o,e,n))}function Ec(e,n,o){var i=e._id;return e.each(function(){var a=kn(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return sn(a,i).value[n]}}function by(e,n){var o;return(typeof n=="number"?oo:n instanceof na?ay:(o=na(n))?(n=o,ay):yT)(e,n)}function BT(e){return function(){this.removeAttribute(e)}}function DT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function OT(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 PT(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 zT(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 FT(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 UT(e,n){var o=Br(e),i=o==="transform"?kT:by;return this.attrTween(e,typeof n=="function"?(o.local?FT:zT)(o,i,Ec(this,"attr."+e,n)):n==null?(o.local?DT:BT)(o):(o.local?PT:OT)(o,i,n))}function HT(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function jT(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function KT(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&jT(e,r)),o}return a._value=n,a}function GT(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&HT(e,r)),o}return a._value=n,a}function YT(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=Br(e);return this.tween(o,(i.local?KT:GT)(i,n))}function qT(e,n){return function(){kc(this,e).delay=+n.apply(this,arguments)}}function WT(e,n){return n=+n,function(){kc(this,e).delay=n}}function JT(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?qT:WT)(n,e)):sn(this.node(),n).delay}function XT(e,n){return function(){kn(this,e).duration=+n.apply(this,arguments)}}function ZT(e,n){return n=+n,function(){kn(this,e).duration=n}}function QT(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?XT:ZT)(n,e)):sn(this.node(),n).duration}function eM(e,n){if(typeof n!="function")throw new Error;return function(){kn(this,e).ease=n}}function tM(e){var n=this._id;return arguments.length?this.each(eM(n,e)):sn(this.node(),n).ease}function nM(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;kn(this,e).ease=o}}function oM(e){if(typeof e!="function")throw new Error;return this.each(nM(this._id,e))}function iM(e){typeof e!="function"&&(e=Dh(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 Ln(i,this._parents,this._name,this._id)}function aM(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new Ln(l,this._parents,this._name,this._id)}function rM(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 lM(e,n,o){var i,a,r=rM(n)?kc:kn;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function sM(e,n){var o=this._id;return arguments.length<2?sn(this.node(),o).on.on(e):this.each(lM(o,e,n))}function cM(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function dM(){return this.on("end.remove",cM(this._id))}function uM(e){var n=this._name,o=this._id;typeof e!="function"&&(e=rc(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Wr(d[p],n,o,p,d,sn(u,o)));return new Ln(r,this._parents,n,o)}function mM(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Bh(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=sn(u,o),_=0,g=p.length;_<g;++_)(f=p[_])&&Wr(f,n,o,_,p,h);r.push(p),l.push(u)}return new Ln(r,l,n,o)}var fM=Zi.prototype.constructor;function pM(){return new fM(this._groups,this._parents)}function hM(e,n){var o,i,a;return function(){var r=ui(this,e),l=(this.style.removeProperty(e),ui(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function _y(e){return function(){this.style.removeProperty(e)}}function yM(e,n,o){var i,a=o+"",r;return function(){var l=ui(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function gM(e,n,o){var i,a,r;return function(){var l=ui(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),ui(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function bM(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=kn(this,e),d=c.on,u=c.value[r]==null?s||(s=_y(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function _M(e,n,o){var i=(e+="")=="transform"?_T:by;return n==null?this.styleTween(e,hM(e,i)).on("end.style."+e,_y(e)):typeof n=="function"?this.styleTween(e,gM(e,i,Ec(this,"style."+e,n))).each(bM(this._id,e)):this.styleTween(e,yM(e,i,n),o).on("end.style."+e,null)}function kM(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function EM(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&kM(e,l,o)),i}return r._value=n,r}function NM(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,EM(e,n,o??""))}function wM(e){return function(){this.textContent=e}}function IM(e){return function(){var n=e(this);this.textContent=n??""}}function vM(e){return this.tween("text",typeof e=="function"?IM(Ec(this,"text",e)):wM(e==null?"":e+""))}function CM(e){return function(n){this.textContent=e.call(this,n)}}function SM(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&CM(a)),n}return i._value=e,i}function xM(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,SM(e))}function RM(){for(var e=this._name,n=this._id,o=ky(),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=sn(c,n);Wr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ln(i,this._parents,e,o)}function AM(){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=kn(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 $M=0;function Ln(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function ky(){return++$M}var Bn=Zi.prototype;Ln.prototype={constructor:Ln,select:uM,selectAll:mM,selectChild:Bn.selectChild,selectChildren:Bn.selectChildren,filter:iM,merge:aM,selection:pM,transition:RM,call:Bn.call,nodes:Bn.nodes,node:Bn.node,size:Bn.size,empty:Bn.empty,each:Bn.each,on:sM,attr:UT,attrTween:YT,style:_M,styleTween:NM,text:vM,textTween:xM,remove:dM,tween:LT,delay:JT,duration:QT,ease:tM,easeVarying:oM,end:AM,[Symbol.iterator]:Bn[Symbol.iterator]};function TM(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var MM={time:null,delay:0,duration:250,ease:TM};function VM(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 LM(e){var n,o;e instanceof Ln?(n=e._id,e=e._name):(n=ky(),(o=MM).time=yc(),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])&&Wr(c,e,n,d,l,o||VM(c,n));return new Ln(i,this._parents,e,n)}Zi.prototype.interrupt=TT,Zi.prototype.transition=LM;const Xr=e=>()=>e;function BM(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Dn(e,n,o){this.k=e,this.x=n,this.y=o}Dn.prototype={constructor:Dn,scale:function(e){return e===1?this:new Dn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Dn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Nc=new Dn(1,0,0);Dn.prototype;function wc(e){e.stopImmediatePropagation()}function la(e){e.preventDefault(),e.stopImmediatePropagation()}function DM(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function OM(){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 Ey(){return this.__zoom||Nc}function PM(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zM(){return navigator.maxTouchPoints||"ontouchstart"in this}function FM(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 UM(){var e=DM,n=OM,o=FM,i=PM,a=zM,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=IT,d=ic("start","zoom","end"),u,m,p,f=500,h=150,_=0,g=10;function k(N){N.property("__zoom",Ey).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",T).on("touchmove.zoom",x).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(N,I,C,U){var A=N.selection?N.selection():N;A.property("__zoom",Ey),N!==A?y(N,I,C,U):A.interrupt().each(function(){S(this,arguments).event(U).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},k.scaleBy=function(N,I,C,U){k.scaleTo(N,function(){var A=this.__zoom.k,P=typeof I=="function"?I.apply(this,arguments):I;return A*P},C,U)},k.scaleTo=function(N,I,C,U){k.transform(N,function(){var A=n.apply(this,arguments),P=this.__zoom,F=C==null?v(A):typeof C=="function"?C.apply(this,arguments):C,H=P.invert(F),G=typeof I=="function"?I.apply(this,arguments):I;return o(b(E(P,G),F,H),A,l)},C,U)},k.translateBy=function(N,I,C,U){k.transform(N,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof C=="function"?C.apply(this,arguments):C),n.apply(this,arguments),l)},null,U)},k.translateTo=function(N,I,C,U,A){k.transform(N,function(){var P=n.apply(this,arguments),F=this.__zoom,H=U==null?v(P):typeof U=="function"?U.apply(this,arguments):U;return o(Nc.translate(H[0],H[1]).scale(F.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof C=="function"?-C.apply(this,arguments):-C),P,l)},U,A)};function E(N,I){return I=Math.max(r[0],Math.min(r[1],I)),I===N.k?N:new Dn(I,N.x,N.y)}function b(N,I,C){var U=I[0]-C[0]*N.k,A=I[1]-C[1]*N.k;return U===N.x&&A===N.y?N:new Dn(N.k,U,A)}function v(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function y(N,I,C,U){N.on("start.zoom",function(){S(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(U).end()}).tween("zoom",function(){var A=this,P=arguments,F=S(A,P).event(U),H=n.apply(A,P),G=C==null?v(H):typeof C=="function"?C.apply(A,P):C,le=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),se=A.__zoom,ue=typeof I=="function"?I.apply(A,P):I,ye=c(se.invert(G).concat(le/se.k),ue.invert(G).concat(le/ue.k));return function(ae){if(ae===1)ae=ue;else{var Ie=ye(ae),Pe=le/Ie[2];ae=new Dn(Pe,G[0]-Ie[0]*Pe,G[1]-Ie[1]*Pe)}F.zoom(null,ae)}})}function S(N,I,C){return!C&&N.__zooming||new $(N,I)}function $(N,I){this.that=N,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(N,I),this.taps=0}$.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,I){return this.mouse&&N!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var I=to(this.that).datum();d.call(N,this.that,new BM(N,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:d}),I)}};function O(N,...I){if(!e.apply(this,arguments))return;var C=S(this,I).event(N),U=this.__zoom,A=Math.max(r[0],Math.min(r[1],U.k*Math.pow(2,i.apply(this,arguments)))),P=no(N);if(C.wheel)(C.mouse[0][0]!==P[0]||C.mouse[0][1]!==P[1])&&(C.mouse[1]=U.invert(C.mouse[0]=P)),clearTimeout(C.wheel);else{if(U.k===A)return;C.mouse=[P,U.invert(P)],Jr(this),C.start()}la(N),C.wheel=setTimeout(F,h),C.zoom("mouse",o(b(E(U,A),C.mouse[0],C.mouse[1]),C.extent,l));function F(){C.wheel=null,C.end()}}function B(N,...I){if(p||!e.apply(this,arguments))return;var C=N.currentTarget,U=S(this,I,!0).event(N),A=to(N.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",le,!0),P=no(N,C),F=N.clientX,H=N.clientY;X$(N.view),wc(N),U.mouse=[P,this.__zoom.invert(P)],Jr(this),U.start();function G(se){if(la(se),!U.moved){var ue=se.clientX-F,ye=se.clientY-H;U.moved=ue*ue+ye*ye>_}U.event(se).zoom("mouse",o(b(U.that.__zoom,U.mouse[0]=no(se,C),U.mouse[1]),U.extent,l))}function le(se){A.on("mousemove.zoom mouseup.zoom",null),Z$(se.view,U.moved),la(se),U.event(se).end()}}function z(N,...I){if(e.apply(this,arguments)){var C=this.__zoom,U=no(N.changedTouches?N.changedTouches[0]:N,this),A=C.invert(U),P=C.k*(N.shiftKey?.5:2),F=o(b(E(C,P),U,A),n.apply(this,I),l);la(N),s>0?to(this).transition().duration(s).call(y,F,U,N):to(this).call(k.transform,F,U,N)}}function T(N,...I){if(e.apply(this,arguments)){var C=N.touches,U=C.length,A=S(this,I,N.changedTouches.length===U).event(N),P,F,H,G;for(wc(N),F=0;F<U;++F)H=C[F],G=no(H,this),G=[G,this.__zoom.invert(G),H.identifier],A.touch0?!A.touch1&&A.touch0[2]!==G[2]&&(A.touch1=G,A.taps=0):(A.touch0=G,P=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(A.taps<2&&(m=G[0],u=setTimeout(function(){u=null},f)),Jr(this),A.start())}}function x(N,...I){if(this.__zooming){var C=S(this,I).event(N),U=N.changedTouches,A=U.length,P,F,H,G;for(la(N),P=0;P<A;++P)F=U[P],H=no(F,this),C.touch0&&C.touch0[2]===F.identifier?C.touch0[0]=H:C.touch1&&C.touch1[2]===F.identifier&&(C.touch1[0]=H);if(F=C.that.__zoom,C.touch1){var le=C.touch0[0],se=C.touch0[1],ue=C.touch1[0],ye=C.touch1[1],ae=(ae=ue[0]-le[0])*ae+(ae=ue[1]-le[1])*ae,Ie=(Ie=ye[0]-se[0])*Ie+(Ie=ye[1]-se[1])*Ie;F=E(F,Math.sqrt(ae/Ie)),H=[(le[0]+ue[0])/2,(le[1]+ue[1])/2],G=[(se[0]+ye[0])/2,(se[1]+ye[1])/2]}else if(C.touch0)H=C.touch0[0],G=C.touch0[1];else return;C.zoom("touch",o(b(F,H,G),C.extent,l))}}function R(N,...I){if(this.__zooming){var C=S(this,I).event(N),U=N.changedTouches,A=U.length,P,F;for(wc(N),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),P=0;P<A;++P)F=U[P],C.touch0&&C.touch0[2]===F.identifier?delete C.touch0:C.touch1&&C.touch1[2]===F.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&&(F=no(F,this),Math.hypot(m[0]-F[0],m[1]-F[1])<g)){var H=to(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return k.wheelDelta=function(N){return arguments.length?(i=typeof N=="function"?N:Xr(+N),k):i},k.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Xr(!!N),k):e},k.touchable=function(N){return arguments.length?(a=typeof N=="function"?N:Xr(!!N),k):a},k.extent=function(N){return arguments.length?(n=typeof N=="function"?N:Xr([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),k):n},k.scaleExtent=function(N){return arguments.length?(r[0]=+N[0],r[1]=+N[1],k):[r[0],r[1]]},k.translateExtent=function(N){return arguments.length?(l[0][0]=+N[0][0],l[1][0]=+N[1][0],l[0][1]=+N[0][1],l[1][1]=+N[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(N){return arguments.length?(o=N,k):o},k.duration=function(N){return arguments.length?(s=+N,k):s},k.interpolate=function(N){return arguments.length?(c=N,k):c},k.on=function(){var N=d.on.apply(d,arguments);return N===d?k:N},k.clickDistance=function(N){return arguments.length?(_=(N=+N)*N,k):Math.sqrt(_)},k.tapDistance=function(N){return arguments.length?(g=+N,k):g},k}const Ny=Symbol("MiniMapSlots"),HM=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],jM={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},KM=t.defineComponent({...jM,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(Ny),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,p)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,HM))],64)):t.createCommentVNode("",!0)}}),GM=["width","height","viewBox","aria-labelledby"],YM=["id"],qM=["d","fill","stroke","stroke-width"],WM={name:"MiniMap",compatConfig:{MODE:3}},JM=t.defineComponent({...WM,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:p,d3Zoom:f,getNodesInitialized:h}=tt(),_=t.ref();t.provide(Ny,o);const g=t.toRef(()=>{var A;return e.width??((A=i.style)==null?void 0:A.width)??a}),k=t.toRef(()=>{var A;return e.height??((A=i.style)==null?void 0:A.height)??r}),E=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",b=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),v=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),y=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),S=t.computed(()=>Ts(h.value.filter(A=>!A.hidden))),$=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),O=t.computed(()=>h.value&&h.value.length?tw(S.value,$.value):$.value),B=t.computed(()=>{const A=O.value.width/g.value,P=O.value.height/k.value;return Math.max(A,P)}),z=t.computed(()=>{const A=B.value*g.value,P=B.value*k.value,F=e.offsetScale*B.value;return{offset:F,x:O.value.x-(A-O.value.width)/2-F,y:O.value.y-(P-O.value.height)/2-F,width:A+F*2,height:P+F*2}}),T=t.computed(()=>!z.value.x||!z.value.y?"":`
59
+ 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 vt extends Error{constructor(n,...o){var i;super((i=sp[n])==null?void 0:i.call(sp,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Ds(e){return"clientX"in e}function uw(e){return"sourceEvent"in e}function bn(e,n){const o=Ds(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 Ji=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function mw(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 kr(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const fw=()=>!0;function Os(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function pw(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())yr(a,hr(r))>0&&i.push(r);return i}const hw=250;function yw(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=pw(e,o,n+hw);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:p,y:f}=si(d,m,m.position,!0),h=Math.sqrt((p-e.x)**2+(f-e.y)**2);h>n||(h<s?(l=[{...m,x:p,y:f}],s=h):h===s&&l.push({...m,x:p,y:f}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function cp(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=fw},u,m,p,f){const h=r==="target",_=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:g,y:k}=bn(e),E=l.elementFromPoint(g,k),b=E!=null&&E.classList.contains(`${s}-flow__handle`)?E:_,v={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const y=dp(void 0,b),S=b.getAttribute("data-nodeid"),$=b.getAttribute("data-handleid"),O=b.classList.contains("connectable"),B=b.classList.contains("connectableend");if(!S||!y)return v;const z={source:h?S:i,sourceHandle:h?$:a,target:h?i:S,targetHandle:h?a:$};v.connection=z;const x=O&&B&&(o===Mn.Strict?h&&y==="source"||!h&&y==="target":S!==i||$!==a);v.isValid=x&&d(z,{nodes:m,edges:u,sourceNode:p(z.source),targetNode:p(z.target)}),v.toHandle=up(S,y,$,f,o,!0)}return v}function dp(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function gw(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function bw(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function up(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===Mn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...si(d,m,m.position,!0)}:m}const Ps={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},_w=["production","prod"];function Xi(e,...n){mp()&&console.warn(`[Vue Flow]: ${e}`,...n)}function mp(){return!_w.includes(process.env.NODE_ENV||"")}function fp(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,...gr(l)}}):null}function zs(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 bt(e){return typeof t.unref(e)<"u"}function kw(e,n,o,i){if(!e||!e.source||!e.target)return o(new vt(gt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Wn(e)?a=e:a={...e,id:Gf(e)},a=jf(a,void 0,i),ew(a,n)?!1:a}function Ew(e,n,o,i,a){if(!n.source||!n.target)return a(new vt(gt.EDGE_INVALID,e.id)),!1;if(!o)return a(new vt(gt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Gf(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function pp(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Ro(l)){o(new vt(gt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=X0(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new vt(gt.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 hp(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 Fs(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}`;hp("source",c,u,e,a,l),hp("target",c,d,e,r,s)}}function yp(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Us(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=Wn(d)?d:kw(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new vt(gt.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new vt(gt.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new vt(gt.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new vt(gt.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...jf(u,f,r),sourceNode:m,targetNode:p})}return c}const gp=Symbol("vueFlow"),bp=Symbol("nodeId"),_p=Symbol("nodeRef"),Nw=Symbol("edgeId"),ww=Symbol("edgeRef"),Er=Symbol("slots");function kp(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:p,findNode:f,multiSelectionActive:h,nodesSelectionActive:_,selectNodesOnDrag:g,removeSelectedElements:k,addSelectedNodes:E,updateNodePositions:b,emits:v}=tt(),{onStart:y,onDrag:S,onStop:$,onClick:O,el:B,disabled:z,id:T,selectable:x,dragHandle:R}=e,N=t.shallowRef(!1);let I=[],C,U=null,A={x:void 0,y:void 0},P={x:0,y:0},F=null,H=!1,G=!1,le=0,se=!1;const ue=Cw(),ye=({x:ge,y:_e})=>{A={x:ge,y:_e};let V=!1;if(I=I.map(L=>{const j={x:ge-L.distance.x,y:_e-L.distance.y},{computedPosition:ee}=Bs(L,o.value?kr(j,i.value):j,v.error,l.value,L.parentNode?f(L.parentNode):void 0);return V=V||L.position.x!==ee.x||L.position.y!==ee.y,L.position=ee,L}),G=G||V,!!V&&(b(I,!0,!0),N.value=!0,F)){const[L,j]=Ls({id:T,dragItems:I,findNode:f});S({event:F,node:L,nodes:j})}},ae=()=>{if(!U)return;const[ge,_e]=Qf(P,U,u.value);if(ge!==0||_e!==0){const V={x:(A.x??0)-ge/c.value.zoom,y:(A.y??0)-_e/c.value.zoom};p({x:ge,y:_e})&&ye(V)}le=requestAnimationFrame(ae)},Ie=(ge,_e)=>{H=!0;const V=f(T);!g.value&&!h.value&&V&&(V.selected||k()),V&&t.toValue(x)&&g.value&&zs(V,h.value,E,k,_,!1,_e);const L=ue(ge.sourceEvent);if(A=L,I=aw(r.value,m.value,L,T),I.length){const[j,ee]=Ls({id:T,dragItems:I,findNode:f});y({event:ge.sourceEvent,node:j,nodes:ee})}},Pe=(ge,_e)=>{var V;ge.sourceEvent.type==="touchmove"&&ge.sourceEvent.touches.length>1||(G=!1,s.value===0&&Ie(ge,_e),A=ue(ge.sourceEvent),U=((V=n.value)==null?void 0:V.getBoundingClientRect())||null,P=bn(ge.sourceEvent,U))},Ae=(ge,_e)=>{const V=ue(ge.sourceEvent);if(!se&&H&&d.value&&(se=!0,ae()),!H){const L=V.xSnapped-(A.x??0),j=V.ySnapped-(A.y??0);Math.sqrt(L*L+j*j)>s.value&&Ie(ge,_e)}(A.x!==V.xSnapped||A.y!==V.ySnapped)&&I.length&&H&&(F=ge.sourceEvent,P=bn(ge.sourceEvent,U),ye(V))},de=ge=>{let _e=!1;if(!H&&!N.value&&!h.value){const V=ge.sourceEvent,L=ue(V),j=L.xSnapped-(A.x??0),ee=L.ySnapped-(A.y??0),Z=Math.sqrt(j*j+ee*ee);Z!==0&&Z<=s.value&&(O==null||O(V),_e=!0)}if(I.length&&!_e){G&&(b(I,!1,!1),G=!1);const[V,L]=Ls({id:T,dragItems:I,findNode:f});$({event:ge.sourceEvent,node:V,nodes:L})}I=[],N.value=!1,se=!1,H=!1,A={x:void 0,y:void 0},cancelAnimationFrame(le)};return t.watch([()=>t.toValue(z),B],([ge,_e],V,L)=>{if(_e){const j=nn(_e);ge||(C=J1().on("start",ee=>Pe(ee,_e)).on("drag",ee=>Ae(ee,_e)).on("end",ee=>de(ee)).filter(ee=>{const Z=ee.target,pe=t.toValue(R);return!ee.button&&(!a.value||!ap(Z,`.${a.value}`,_e)&&(!pe||ap(Z,pe,_e)))}),j.call(C)),L(()=>{j.on(".drag",null),C&&(C.on("start",null),C.on("drag",null),C.on("end",null))})}}),N}function Iw(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),updateStart:Se(),update:Se(),updateEnd:Se()}}function vw(e,n){const o=Iw();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 Cw(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=tt();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=uw(a)?a.sourceEvent:a,{x:c,y:d}=bn(s,l),u=qi({x:c,y:d},e.value),{x:m,y:p}=o.value?kr(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function Nr(){return!0}function Ep({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:p,nodesConnectable:f,autoPanOnConnect:h,autoPanSpeed:_,findNode:g,panBy:k,startConnection:E,updateConnection:b,endConnection:v,emits:y,viewport:S,edges:$,nodes:O,isValidConnection:B,nodeLookup:z}=tt();let T=null,x=!1,R=null;function N(C){var U;const A=t.toValue(o)==="target",P=Ds(C),F=Hf(C.target),H=C.currentTarget;if(H&&(P&&C.button===0||!P)){let G=function(Ee){V=bn(Ee,de),ye=yw(qi(V,S.value,!1,[1,1]),u.value,z.value,ee),L||(j(),L=!0);const W=cp(Ee,{handle:ye,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:A?"target":"source",isValidConnection:ue,doc:F,lib:"vue",flowId:s,nodeLookup:z.value},$.value,O.value,g,z.value);R=W.handleDomNode,T=W.connection,x=bw(!!ye,W.isValid);const J={...ve,isValid:x,to:W.toHandle&&x?Yi({x:W.toHandle.x,y:W.toHandle.y},S.value):V,toHandle:W.toHandle,toPosition:x&&W.toHandle?W.toHandle.position:Ps[ee.position],toNode:W.toHandle?z.value.get(W.toHandle.nodeId):null};if(x&&ye&&(ve!=null&&ve.toHandle)&&J.toHandle&&ve.toHandle.type===J.toHandle.type&&ve.toHandle.nodeId===J.toHandle.nodeId&&ve.toHandle.id===J.toHandle.id&&ve.to.x===J.to.x&&ve.to.y===J.to.y)return;const X=ye??W.toHandle;if(b(X&&x?Yi({x:X.x,y:X.y},S.value):V,X,gw(!!X,x)),ve=J,!ye&&!x&&!R)return Os(_e);T&&T.source!==T.target&&R&&(Os(_e),_e=R,R.classList.add("connecting","vue-flow__handle-connecting"),R.classList.toggle("valid",!!x),R.classList.toggle("vue-flow__handle-valid",!!x))},le=function(Ee){"touches"in Ee&&Ee.touches.length>0||((ye||R)&&T&&x&&(r?r(Ee,T):y.connect(T)),y.connectEnd(Ee),a&&(l==null||l(Ee)),Os(_e),cancelAnimationFrame(ae),v(Ee),L=!1,x=!1,T=null,R=null,F.removeEventListener("mousemove",G),F.removeEventListener("mouseup",le),F.removeEventListener("touchmove",G),F.removeEventListener("touchend",le))};const se=g(t.toValue(n));let ue=t.toValue(i)||B.value||Nr;!ue&&se&&(ue=(A?se.isValidSourcePos:se.isValidTargetPos)||Nr);let ye,ae=0;const{x:Ie,y:Pe}=bn(C),Ae=dp(t.toValue(a),H),de=(U=c.value)==null?void 0:U.getBoundingClientRect();if(!de||!Ae)return;const ge=up(t.toValue(n),Ae,t.toValue(e),z.value,d.value);if(!ge)return;let _e,V=bn(C,de),L=!1;const j=()=>{if(!h.value)return;const[Ee,W]=Qf(V,de,_.value);k({x:Ee,y:W}),ae=requestAnimationFrame(j)},ee={...ge,nodeId:t.toValue(n),type:Ae,position:ge.position},Z=z.value.get(t.toValue(n)),me={inProgress:!0,isValid:null,from:si(Z,ee,$e.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:Z,to:V,toHandle:null,toPosition:Ps[ee.position],toNode:null};E({nodeId:t.toValue(n),id:t.toValue(e),type:Ae,position:(H==null?void 0:H.getAttribute("data-handlepos"))||$e.Top,...V},{x:Ie-de.left,y:Pe-de.top}),y.connectStart({event:C,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:Ae});let ve=me;F.addEventListener("mousemove",G),F.addEventListener("mouseup",le),F.addEventListener("touchmove",G),F.addEventListener("touchend",le)}}function I(C){var U,A;if(!m.value)return;const P=t.toValue(o)==="target";if(!p.value){y.clickConnectStart({event:C,nodeId:t.toValue(n),handleId:t.toValue(e)}),E({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:$e.Top,...bn(C)},void 0,!0);return}let F=t.toValue(i)||B.value||Nr;const H=g(t.toValue(n));if(!F&&H&&(F=(P?H.isValidSourcePos:H.isValidTargetPos)||Nr),H&&(typeof H.connectable>"u"?f.value:H.connectable)===!1)return;const G=Hf(C.target),le=cp(C,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:$e.Top,...bn(C)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:F,doc:G,lib:"vue",flowId:s,nodeLookup:z.value},$.value,O.value,g,z.value),se=((U=le.connection)==null?void 0:U.source)===((A=le.connection)==null?void 0:A.target);le.isValid&&le.connection&&!se&&y.connect(le.connection),y.clickConnectEnd(C),v(C,!0)}return{handlePointerDown:N,handleClick:I}}function Sw(){return t.inject(bp,"")}function Np(e){const n=e??Sw()??"",o=t.inject(_p,t.ref(null)),{findNode:i,edges:a,emits:r}=tt(),l=i(n);return l||r.error(new vt(gt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Ao([l],a.value))}}function xw(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),dragStart:Se(),drag:Se(),dragStop:Se()}}function Rw(e,n){const o=xw();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 wp(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=tt();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,p=d?4:1,f=c.x*u*p,h=c.y*m*p,_=[];for(const g of e.value)if(g.draggable||l&&typeof g.draggable>"u"){const k={x:g.computedPosition.x+f,y:g.computedPosition.y+h},{position:E}=Bs(g,k,s.error,n.value,g.parentNode?i(g.parentNode):void 0);_.push({id:g.id,position:E,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(_,!0,!1)}}const wr=.1,Aw=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Zn(){return Xi("Viewport not initialized yet."),Promise.resolve(!1)}const $w={zoomIn:Zn,zoomOut:Zn,zoomTo:Zn,fitView:Zn,setCenter:Zn,fitBounds:Zn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Zn,setTransform:Zn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Tw(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Oi:ar).scaleBy(Hs(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}=Uf({x:-i,y:-a},e.translateExtent),m=ai.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?Oi:ar).transform(Hs(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"?Oi:ar).scaleTo(Hs(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:wr,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Ts(s),{x:d,y:u,zoom:m}=Jf(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??wr);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:wr})=>{const{x:l,y:s,zoom:c}=Jf(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??wr);return o(l,s,c,r)},project:a=>qi(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 qi(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 Yi(s,e.viewport)}return{x:0,y:0}}}:$w)}function Hs(e,n=0,o=Aw,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function Mw(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let _,g,k=!!(o.nodes.value.length||o.edges.value.length);_=ei([e.modelValue,()=>{var E,b;return(b=(E=e.modelValue)==null?void 0:E.value)==null?void 0:b.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setElements(E),!g&&!k&&E.length?k=!0:g==null||g.resume())}),g=ei([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([E,b])=>{var v;(v=e.modelValue)!=null&&v.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...E,...b],t.nextTick(()=>{_==null||_.resume()}))},{immediate:k}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let _,g,k=!!o.nodes.value.length;_=ei([e.nodes,()=>{var E,b;return(b=(E=e.nodes)==null?void 0:E.value)==null?void 0:b.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setNodes(E),!g&&!k&&E.length?k=!0:g==null||g.resume())}),g=ei([o.nodes,()=>o.nodes.value.length],([E])=>{var b;(b=e.nodes)!=null&&b.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...E],t.nextTick(()=>{_==null||_.resume()}))},{immediate:k}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let _,g,k=!!o.edges.value.length;_=ei([e.edges,()=>{var E,b;return(b=(E=e.edges)==null?void 0:E.value)==null?void 0:b.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setEdges(E),!g&&!k&&E.length?k=!0:g==null||g.resume())}),g=ei([o.edges,()=>o.edges.value.length],([E])=>{var b;(b=e.edges)!=null&&b.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...E],t.nextTick(()=>{_==null||_.resume()}))},{immediate:k}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&bt(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&bt(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&bt(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&bt(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{bt(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const _=async g=>{let k=g;typeof n.autoConnect=="function"&&(k=await n.autoConnect(g)),k!==!1&&o.addEdges([k])};t.watch(()=>n.autoConnect,()=>{bt(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(g,k,E)=>{g?o.onConnect(_):o.hooks.value.connect.off(_),E(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},f=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(n)){const k=g;if(!_.includes(k)){const E=t.toRef(()=>n[k]),b=o[k];t.isRef(b)&&i.run(()=>{t.watch(E,v=>{bt(v)&&(b.value=v)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function Vw(){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=>Xi(e.message))}}function Lw(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),Ti(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),Ti(r.removeHasEmitListeners)}});function i(a){var r;const l=Bw(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function Bw(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Ip(){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:Rs.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ji.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:So.Bezier,style:{}},connectionMode:Mn.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:Ji()?"Meta":"Control",zoomActivationKeyCode:Ji()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Vw(),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 Dw=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Ow(e,n,o){const i=Tw(e),a=V=>{const L=V??[];e.hooks.updateNodeInternals.trigger(L)},r=V=>Q0(V,e.nodes,e.edges),l=V=>Z0(V,e.nodes,e.edges),s=V=>Ao(V,e.edges),c=({id:V,type:L,nodeId:j})=>{var ee;const Z=V?`-${L}-${V}`:`-${L}`;return Array.from(((ee=e.connectionLookup.get(`${j}${Z}`))==null?void 0:ee.values())??[])},d=V=>{if(V)return n.value.get(V)},u=V=>{if(V)return o.value.get(V)},m=(V,L,j)=>{var ee,Z;const pe=[];for(const me of V){const ve={id:me.id,type:"position",dragging:j,from:me.from};if(L&&(ve.position=me.position,me.parentNode)){const Ee=d(me.parentNode);ve.position={x:ve.position.x-(((ee=Ee==null?void 0:Ee.computedPosition)==null?void 0:ee.x)??0),y:ve.position.y-(((Z=Ee==null?void 0:Ee.computedPosition)==null?void 0:Z.y)??0)}}pe.push(ve)}pe!=null&&pe.length&&e.hooks.nodesChange.trigger(pe)},p=V=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const j=window.getComputedStyle(L),{m22:ee}=new window.DOMMatrixReadOnly(j.transform),Z=[];for(const pe of V){const me=pe,ve=d(me.id);if(ve){const Ee=gr(me.nodeElement);if(!!(Ee.width&&Ee.height&&(ve.dimensions.width!==Ee.width||ve.dimensions.height!==Ee.height||me.forceUpdate))){const J=me.nodeElement.getBoundingClientRect();ve.dimensions=Ee,ve.handleBounds.source=fp("source",me.nodeElement,J,ee,ve.id),ve.handleBounds.target=fp("target",me.nodeElement,J,ee,ve.id),Z.push({id:ve.id,type:"dimensions",dimensions:Ee})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),Z.length&&e.hooks.nodesChange.trigger(Z)},f=(V,L)=>{const j=new Set,ee=new Set;for(const me of V)Ro(me)?j.add(me.id):Wn(me)&&ee.add(me.id);const Z=Xn(n.value,j,!0),pe=Xn(o.value,ee);if(e.multiSelectionActive){for(const me of j)Z.push(Jn(me,L));for(const me of ee)pe.push(Jn(me,L))}Z.length&&e.hooks.nodesChange.trigger(Z),pe.length&&e.hooks.edgesChange.trigger(pe)},h=V=>{if(e.multiSelectionActive){const L=V.map(j=>Jn(j.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(Xn(n.value,new Set(V.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(Xn(o.value))},_=V=>{if(e.multiSelectionActive){const L=V.map(j=>Jn(j.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(Xn(o.value,new Set(V.map(L=>L.id)))),e.hooks.nodesChange.trigger(Xn(n.value,new Set,!0))},g=V=>{f(V,!0)},k=V=>{const j=(V||e.nodes).map(ee=>(ee.selected=!1,Jn(ee.id,!1)));e.hooks.nodesChange.trigger(j)},E=V=>{const j=(V||e.edges).map(ee=>(ee.selected=!1,Jn(ee.id,!1)));e.hooks.edgesChange.trigger(j)},b=V=>{if(!V||!V.length)return f([],!1);const L=V.reduce((j,ee)=>{const Z=Jn(ee.id,!1);return Ro(ee)?j.nodes.push(Z):j.edges.push(Z),j},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},v=V=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([V,e.maxZoom]),e.minZoom=V},y=V=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,V]),e.maxZoom=V},S=V=>{var L;(L=e.d3Zoom)==null||L.translateExtent(V),e.translateExtent=V},$=V=>{e.nodeExtent=V,a()},O=V=>{var L;(L=e.d3Zoom)==null||L.clickDistance(V)},B=V=>{e.nodesDraggable=V,e.nodesConnectable=V,e.elementsSelectable=V},z=V=>{const L=V instanceof Function?V(e.nodes):V;!e.initialized&&!L.length||(e.nodes=pp(L,d,e.hooks.error.trigger))},T=V=>{const L=V instanceof Function?V(e.edges):V;if(!e.initialized&&!L.length)return;const j=Us(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Fs(e.connectionLookup,o.value,j),e.edges=j},x=V=>{const L=V instanceof Function?V([...e.nodes,...e.edges]):V;!e.initialized&&!L.length||(z(L.filter(Ro)),T(L.filter(Wn)))},R=V=>{let L=V instanceof Function?V(e.nodes):V;L=Array.isArray(L)?L:[L];const j=pp(L,d,e.hooks.error.trigger),ee=[];for(const Z of j)ee.push(tp(Z));ee.length&&e.hooks.nodesChange.trigger(ee)},N=V=>{let L=V instanceof Function?V(e.edges):V;L=Array.isArray(L)?L:[L];const j=Us(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),ee=[];for(const Z of j)ee.push(tp(Z));ee.length&&e.hooks.edgesChange.trigger(ee)},I=(V,L=!0,j=!1)=>{const ee=V instanceof Function?V(e.nodes):V,Z=Array.isArray(ee)?ee:[ee],pe=[],me=[];function ve(W){const J=s(W);for(const X of J)(!bt(X.deletable)||X.deletable)&&me.push(op(X.id,X.source,X.target,X.sourceHandle,X.targetHandle))}function Ee(W){const J=[];for(const X of e.nodes)X.parentNode===W&&J.push(X);if(J.length){for(const X of J)pe.push(np(X.id));L&&ve(J);for(const X of J)Ee(X.id)}}for(const W of Z){const J=typeof W=="string"?d(W):W;J&&(bt(J.deletable)&&!J.deletable||(pe.push(np(J.id)),L&&ve([J]),j&&Ee(J.id)))}me.length&&e.hooks.edgesChange.trigger(me),pe.length&&e.hooks.nodesChange.trigger(pe)},C=V=>{const L=V instanceof Function?V(e.edges):V,j=Array.isArray(L)?L:[L],ee=[];for(const Z of j){const pe=typeof Z=="string"?u(Z):Z;pe&&(bt(pe.deletable)&&!pe.deletable||ee.push(op(typeof Z=="string"?Z:Z.id,pe.source,pe.target,pe.sourceHandle,pe.targetHandle)))}e.hooks.edgesChange.trigger(ee)},U=(V,L,j=!0)=>{const ee=u(V.id);if(!ee)return!1;const Z=e.edges.indexOf(ee),pe=Ew(V,L,ee,j,e.hooks.error.trigger);if(pe){const[me]=Us([pe],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((ve,Ee)=>Ee===Z?me:ve),Fs(e.connectionLookup,o.value,[me]),me}return!1},A=(V,L,j={replace:!1})=>{const ee=u(V);if(!ee)return;const Z=typeof L=="function"?L(ee):L;ee.data=j.replace?Z:{...ee.data,...Z}},P=V=>ep(V,e.nodes),F=V=>{const L=ep(V,e.edges);return Fs(e.connectionLookup,o.value,L),L},H=(V,L,j={replace:!1})=>{const ee=d(V);if(!ee)return;const Z=typeof L=="function"?L(ee):L;j.replace?e.nodes.splice(e.nodes.indexOf(ee),1,Z):Object.assign(ee,Z)},G=(V,L,j={replace:!1})=>{const ee=d(V);if(!ee)return;const Z=typeof L=="function"?L(ee):L;ee.data=j.replace?Z:{...ee.data,...Z}},le=(V,L,j=!1)=>{j?e.connectionClickStartHandle=V:e.connectionStartHandle=V,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},se=(V,L=null,j=null)=>{e.connectionStartHandle&&(e.connectionPosition=V,e.connectionEndHandle=L,e.connectionStatus=j)},ue=(V,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ye=V=>{const L=J0(V),j=L?null:Gi(V)?V:d(V.id);return!L&&!j?[null,null,L]:[L?V:hr(j),j,L]},ae=(V,L=!0,j=e.nodes)=>{const[ee,Z,pe]=ye(V);if(!ee)return[];const me=[];for(const ve of j||e.nodes){if(!pe&&(ve.id===Z.id||!ve.computedPosition))continue;const Ee=hr(ve),W=yr(Ee,ee);(L&&W>0||W>=Ee.width*Ee.height||W>=Number(ee.width)*Number(ee.height))&&me.push(ve)}return me},Ie=(V,L,j=!0)=>{const[ee]=ye(V);if(!ee)return!1;const Z=yr(ee,L);return j&&Z>0||Z>=Number(ee.width)*Number(ee.height)},Pe=V=>{const{viewport:L,dimensions:j,d3Zoom:ee,d3Selection:Z,translateExtent:pe}=e;if(!ee||!Z||!V.x&&!V.y)return!1;const me=ai.translate(L.x+V.x,L.y+V.y).scale(L.zoom),ve=[[0,0],[j.width,j.height]],Ee=ee.constrain()(me,ve,pe),W=e.viewport.x!==Ee.x||e.viewport.y!==Ee.y||e.viewport.zoom!==Ee.k;return ee.transform(Z,Ee),W},Ae=V=>{const L=V instanceof Function?V(e):V,j=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];bt(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const ee=L.modelValue||L.nodes||L.edges?[]:void 0;ee&&(L.modelValue&&ee.push(...L.modelValue),L.nodes&&ee.push(...L.nodes),L.edges&&ee.push(...L.edges),x(ee));const Z=()=>{bt(L.maxZoom)&&y(L.maxZoom),bt(L.minZoom)&&v(L.minZoom),bt(L.translateExtent)&&S(L.translateExtent)};for(const pe of Object.keys(L)){const me=pe,ve=L[me];![...Dw,...j].includes(me)&&bt(ve)&&(e[me]=ve)}ss(()=>e.d3Zoom).not.toBeNull().then(Z),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:x,setNodes:z,setEdges:T,addNodes:R,addEdges:N,removeNodes:I,removeEdges:C,findNode:d,findEdge:u,updateEdge:U,updateEdgeData:A,updateNode:H,updateNodeData:G,applyEdgeChanges:F,applyNodeChanges:P,addSelectedElements:g,addSelectedNodes:h,addSelectedEdges:_,setMinZoom:v,setMaxZoom:y,setTranslateExtent:S,setNodeExtent:$,setPaneClickDistance:O,removeSelectedElements:b,removeSelectedNodes:k,removeSelectedEdges:E,startConnection:le,updateConnection:se,endConnection:ue,setInteractive:B,setState:Ae,getIntersectingNodes:ae,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ie,panBy:Pe,fitView:V=>i.value.fitView(V),zoomIn:V=>i.value.zoomIn(V),zoomOut:V=>i.value.zoomOut(V),zoomTo:(V,L)=>i.value.zoomTo(V,L),setViewport:(V,L)=>i.value.setViewport(V,L),setTransform:(V,L)=>i.value.setTransform(V,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(V,L,j)=>i.value.setCenter(V,L,j),fitBounds:(V,L)=>i.value.fitBounds(V,L),project:V=>i.value.project(V),screenToFlowCoordinate:V=>i.value.screenToFlowCoordinate(V),flowToScreenCoordinate:V=>i.value.flowToScreenCoordinate(V),toObject:()=>{const V=[],L=[];for(const j of e.nodes){const{computedPosition:ee,handleBounds:Z,selected:pe,dimensions:me,isParent:ve,resizing:Ee,dragging:W,events:J,...X}=j;V.push(X)}for(const j of e.edges){const{selected:ee,sourceNode:Z,targetNode:pe,events:me,...ve}=j;L.push(ve)}return JSON.parse(JSON.stringify({nodes:V,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:V=>new Promise(L=>{const{nodes:j,edges:ee,position:Z,zoom:pe,viewport:me}=V;j&&z(j),ee&&T(ee);const[ve,Ee]=me!=null&&me.x&&(me!=null&&me.y)?[me.x,me.y]:Z??[null,null];if(ve&&Ee){const W=(me==null?void 0:me.zoom)||pe||e.viewport.zoom;return ss(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:ve,y:Ee,zoom:W}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const V=Ip();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=ai.translate(V.defaultViewport.x??0,V.defaultViewport.y??0).scale(xo(V.defaultViewport.zoom??1,V.minZoom,V.maxZoom)),j=e.viewportRef.getBoundingClientRect(),ee=[[0,0],[j.width,j.height]],Z=e.d3Zoom.constrain()(L,ee,V.translateExtent);e.d3Zoom.transform(e.d3Selection,Z)}Ae(V)},$destroy:()=>{}}}const Pw=["data-id","data-handleid","data-nodeid","data-handlepos"],zw={name:"Handle",compatConfig:{MODE:3}},Qn=t.defineComponent({...zw,props:{id:{default:null},type:{},position:{default:()=>$e.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:p}=tt(),{id:f,node:h,nodeEl:_,connectedEdges:g}=Np(),k=t.ref(),E=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),b=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),v=t.toRef(()=>{var T,x,R,N,I,C;return((T=l.value)==null?void 0:T.nodeId)===f&&((x=l.value)==null?void 0:x.id)===e.id&&((R=l.value)==null?void 0:R.type)===i.value||((N=c.value)==null?void 0:N.nodeId)===f&&((I=c.value)==null?void 0:I.id)===e.id&&((C=c.value)==null?void 0:C.type)===i.value}),y=t.toRef(()=>{var T,x,R;return((T=s.value)==null?void 0:T.nodeId)===f&&((x=s.value)==null?void 0:x.id)===e.id&&((R=s.value)==null?void 0:R.type)===i.value}),{handlePointerDown:S,handleClick:$}=Ep({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),O=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(T=>{const x=T[`${i.value}Handle`];return T[i.value]!==f?!1:x?x===e.id:!0}):typeof e.connectable=="number"?g.value.filter(T=>{const x=T[`${i.value}Handle`];return T[i.value]!==f?!1:x?x===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,g.value):bt(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var T;if(!h.dimensions.width||!h.dimensions.height)return;const x=(T=h.handleBounds[i.value])==null?void 0:T.find(P=>P.id===e.id);if(!d.value||x)return;const R=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!k.value||!R||!e.id)return;const N=_.value.getBoundingClientRect(),I=k.value.getBoundingClientRect(),C=window.getComputedStyle(R),{m22:U}=new window.DOMMatrixReadOnly(C.transform),A={id:e.id,position:e.position,x:(I.left-N.left)/U,y:(I.top-N.top)/U,type:i.value,nodeId:f,...gr(k.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],A]});function B(T){const x=Ds(T);O.value&&E.value&&(x&&T.button===0||!x)&&S(T)}function z(T){!f||!s.value&&!E.value||O.value&&$(T)}return n({handleClick:$,handlePointerDown:S,onClick:z,onPointerDown:B}),(T,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:k,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":T.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${T.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:O.value,connecting:y.value,connectablestart:E.value,connectableend:b.value,connectionindicator:O.value&&(E.value&&!v.value||b.value&&v.value)}]]),onMousedown:B,onTouchstartPassive:B,onClick:z},[t.renderSlot(T.$slots,"default",{id:T.id})],42,Pw))}}),Ir=function({sourcePosition:e=$e.Bottom,targetPosition:n=$e.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Qn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Qn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Ir.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ir.inheritAttrs=!1,Ir.compatConfig={MODE:3};const Fw=Ir,vr=function({targetPosition:e=$e.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Qn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};vr.props=["targetPosition","label","isValidTargetPos","connectable","data"],vr.inheritAttrs=!1,vr.compatConfig={MODE:3};const Uw=vr,Cr=function({sourcePosition:e=$e.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Qn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Cr.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Cr.inheritAttrs=!1,Cr.compatConfig={MODE:3};const Hw=Cr,jw=["transform"],Kw=["width","height","x","y","rx","ry"],Gw=["y"],Yw={name:"EdgeText",compatConfig:{MODE:3}},qw=t.defineComponent({...Yw,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,Kw)):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,Gw)],8,jw))}}),Ww=["id","d","marker-end","marker-start"],Jw=["d","stroke-width"],Xw={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Sr=t.defineComponent({...Xw,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,Ww),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,Jw)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(qw,{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 vp({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 Cp({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 xr(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Sp({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case $e.Left:l=n-xr(n-i,r),s=o;break;case $e.Right:l=n+xr(i-n,r),s=o;break;case $e.Top:l=n,s=o-xr(o-a,r);break;case $e.Bottom:l=n,s=o+xr(a-o,r);break}return[l,s]}function xp(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,curvature:s=.25}=e,[c,d]=Sp({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=Sp({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,h,_]=Cp({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,p,f,h,_]}function Rp({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case $e.Left:case $e.Right:r=.5*(n+i),l=o;break;case $e.Top:case $e.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Ap(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top}=e,[s,c]=Rp({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=Rp({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,h]=Cp({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,p,f,h]}const $p={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};function Zw({source:e,sourcePosition:n=$e.Bottom,target:o}){return n===$e.Left||n===$e.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function Tp(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function Qw({source:e,sourcePosition:n=$e.Bottom,target:o,targetPosition:i=$e.Top,center:a,offset:r}){const l=$p[n],s=$p[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=Zw({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,h,_;const g={x:0,y:0},k={x:0,y:0},[E,b,v,y]=vp({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){h=a.x??E,_=a.y??b;const $=[{x:h,y:c.y},{x:h,y:d.y}],O=[{x:c.x,y:_},{x:d.x,y:_}];l[m]===p?f=m==="x"?$:O:f=m==="x"?O:$}else{const $=[{x:c.x,y:d.y}],O=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?O:$:f=l.y===p?$:O,n===i){const R=Math.abs(e[m]-o[m]);if(R<=r){const N=Math.min(r-1,r-R);l[m]===p?g[m]=(c[m]>e[m]?-1:1)*N:k[m]=(d[m]>o[m]?-1:1)*N}}if(n!==i){const R=m==="x"?"y":"x",N=l[m]===s[R],I=c[R]>d[R],C=c[R]<d[R];(l[m]===1&&(!N&&I||N&&C)||l[m]!==1&&(!N&&C||N&&I))&&(f=m==="x"?$:O)}const B={x:c.x+g.x,y:c.y+g.y},z={x:d.x+k.x,y:d.y+k.y},T=Math.max(Math.abs(B.x-f[0].x),Math.abs(z.x-f[0].x)),x=Math.max(Math.abs(B.y-f[0].y),Math.abs(z.y-f[0].y));T>=x?(h=(B.x+z.x)/2,_=f[0].y):(h=f[0].x,_=(B.y+z.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...f,{x:d.x+k.x,y:d.y+k.y},o],h,_,v,y]}function eI(e,n,o,i){const a=Math.min(Tp(e,n)/2,Tp(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 js(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,h,_]=Qw({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((k,E,b)=>{let v;return b>0&&b<m.length-1?v=eI(m[b-1],E,m[b+1],s):v=`${b===0?"M":"L"}${E.x} ${E.y}`,k+=v,k},""),p,f,h,_]}function tI(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=vp({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const nI=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]=tI(e);return t.h(Sr,{path:o,labelX:i,labelY:a,...n,...e})}}}),Mp=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]=js({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Sr,{path:o,labelX:i,labelY:a,...n,...e})}}}),oI=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(Mp,{...e,...n,borderRadius:0})}}),iI=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]=xp({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Sr,{path:o,labelX:i,labelY:a,...n,...e})}}}),aI=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]=Ap({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Sr,{path:o,labelX:i,labelY:a,...n,...e})}}}),rI={input:Hw,default:Fw,output:Uw},lI={default:iI,straight:nI,step:oI,smoothstep:Mp,simplebezier:aI};function sI(e,n,o){const i=t.computed(()=>_=>n.value.get(_)),a=t.computed(()=>_=>o.value.get(_)),r=t.computed(()=>{const _={...lI,...e.edgeTypes},g=Object.keys(_);for(const k of e.edges)k.type&&!g.includes(k.type)&&(_[k.type]=k.type);return _}),l=t.computed(()=>{const _={...rI,...e.nodeTypes},g=Object.keys(_);for(const k of e.nodes)k.type&&!g.includes(k.type)&&(_[k.type]=k.type);return _}),s=t.computed(()=>e.onlyRenderVisibleElements?Wf(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const g of e.edges){const k=n.value.get(g.source),E=n.value.get(g.target);cw({sourcePos:k.computedPosition||{x:0,y:0},targetPos:E.computedPosition||{x:0,y:0},sourceWidth:k.dimensions.width,sourceHeight:k.dimensions.height,targetWidth:E.dimensions.width,targetHeight:E.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(g)}return _}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const _=[];for(const g of e.nodes)g.selected&&_.push(g);return _}),m=t.computed(()=>{const _=[];for(const g of e.edges)g.selected&&_.push(g);return _}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const _=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&_.push(g);return _}),h=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:h}}class $o{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)??$o.instance;return $o.instance=i??new $o,o&&(o.config.globalProperties.$vueFlowStorage=$o.instance),$o.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=Ip(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[h]=f.on}const l={};for(const[p,f]of Object.entries(a.hooks))l[p]=f.trigger;const s=t.computed(()=>{const p=new Map;for(const f of a.nodes)p.set(f.id,f);return p}),c=t.computed(()=>{const p=new Map;for(const f of a.edges)p.set(f.id,f);return p}),d=sI(a,s,c),u=Ow(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...aE(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 tt(e){const n=$o.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(gp,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,p,f)=>{const h=g=>{d.applyNodeChanges(g)},_=g=>{d.applyEdgeChanges(g)};m?(d.onNodesChange(h),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(_)),f(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),Ti(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Xi(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(gp,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new vt(gt.USEVUEFLOW_OPTIONS))}return s}function cI(e){const{emits:n,dimensions:o}=tt();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=gr(e.value);(s.width===0||s.height===0)&&n.error(new vt(gt.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 dI={name:"UserSelection",compatConfig:{MODE:3}},uI=t.defineComponent({...dI,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))}}),mI=["tabIndex"],fI={name:"NodesSelection",compatConfig:{MODE:3}},pI=t.defineComponent({...fI,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=tt(),s=wp(),c=t.ref(null),d=kp({el:c,onStart(h){n.selectionDragStart(h),n.nodeDragStart(h)},onDrag(h){n.selectionDrag(h),n.nodeDrag(h)},onStop(h){n.selectionDragStop(h),n.nodeDragStop(h)}});t.onMounted(()=>{var h;r.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=t.computed(()=>Ts(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){n.selectionContextMenu({event:h,nodes:i.value})}function f(h){r.value||ri[h.key]&&(h.preventDefault(),s({x:ri[h.key].x,y:ri[h.key].y},h.shiftKey))}return(h,_)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,mI)],6)):t.createCommentVNode("",!0)}});function hI(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const yI={name:"Pane",compatConfig:{MODE:3}},gI=t.defineComponent({...yI,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:p,removeEdges:f,selectionMode:h,deleteKeyCode:_,multiSelectionKeyCode:g,multiSelectionActive:k,edgeLookup:E,nodeLookup:b,connectionLookup:v,defaultEdgeOptions:y,connectionStartHandle:S,panOnDrag:$}=tt(),O=t.shallowRef(null),B=t.shallowRef(new Set),z=t.shallowRef(new Set),T=t.shallowRef(null),x=t.toRef(()=>c.value&&(e.isSelecting||r.value)),R=t.toRef(()=>S.value!==null);let N=!1,I=!1;const C=Ki(_,{actInsideInputWithModifier:!1}),U=Ki(g);t.watch(C,ue=>{ue&&(p(m.value),f(u.value),d.value=!1)}),t.watch(U,ue=>{k.value=ue});function A(ue,ye){return ae=>{ae.target===ye&&(ue==null||ue(ae))}}function P(ue){if(N||R.value){N=!1;return}a.paneClick(ue),l(),d.value=!1}function F(ue){var ye;if(Array.isArray($.value)&&((ye=$.value)!=null&&ye.includes(2))){ue.preventDefault();return}a.paneContextMenu(ue)}function H(ue){a.paneScroll(ue)}function G(ue){var ye,ae,Ie;if(T.value=((ye=n.value)==null?void 0:ye.getBoundingClientRect())??null,!c.value||!e.isSelecting||ue.button!==0||ue.target!==O.value||!T.value)return;(Ie=(ae=ue.target)==null?void 0:ae.setPointerCapture)==null||Ie.call(ae,ue.pointerId);const{x:Pe,y:Ae}=hI(ue,T.value);I=!0,N=!1,l(),s.value={width:0,height:0,startX:Pe,startY:Ae,x:Pe,y:Ae},a.selectionStart(ue)}function le(ue){var ye;if(!T.value||!s.value)return;N=!0;const{x:ae,y:Ie}=bn(ue,T.value),{startX:Pe=0,startY:Ae=0}=s.value,de={startX:Pe,startY:Ae,x:ae<Pe?ae:Pe,y:Ie<Ae?Ie:Ae,width:Math.abs(ae-Pe),height:Math.abs(Ie-Ae)},ge=B.value,_e=z.value;B.value=new Set(Wf(o.value,de,i.value,h.value===Rs.Partial,!0).map(L=>L.id)),z.value=new Set;const V=((ye=y.value)==null?void 0:ye.selectable)??!0;for(const L of B.value){const j=v.value.get(L);if(j)for(const{edgeId:ee}of j.values()){const Z=E.value.get(ee);Z&&(Z.selectable??V)&&z.value.add(ee)}}if(!yp(ge,B.value)){const L=Xn(b.value,B.value,!0);a.nodesChange(L)}if(!yp(_e,z.value)){const L=Xn(E.value,z.value);a.edgesChange(L)}s.value=de,r.value=!0,d.value=!1}function se(ue){var ye;ue.button!==0||!I||((ye=ue.target)==null||ye.releasePointerCapture(ue.pointerId),!r.value&&s.value&&ue.target===O.value&&P(ue),r.value=!1,s.value=null,d.value=B.value.size>0,a.selectionEnd(ue),e.selectionKeyPressed&&(N=!1),I=!1)}return(ue,ye)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:O,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:ue.isSelecting}]),onClick:ye[0]||(ye[0]=ae=>x.value?void 0:A(P,O.value)(ae)),onContextmenu:ye[1]||(ye[1]=ae=>A(F,O.value)(ae)),onWheelPassive:ye[2]||(ye[2]=ae=>A(H,O.value)(ae)),onPointerenter:ye[3]||(ye[3]=ae=>x.value?void 0:t.unref(a).paneMouseEnter(ae)),onPointerdown:ye[4]||(ye[4]=ae=>x.value?G(ae):t.unref(a).paneMouseMove(ae)),onPointermove:ye[5]||(ye[5]=ae=>x.value?le(ae):t.unref(a).paneMouseMove(ae)),onPointerup:ye[6]||(ye[6]=ae=>x.value?se(ae):void 0),onPointerleave:ye[7]||(ye[7]=ae=>t.unref(a).paneMouseLeave(ae))},[t.renderSlot(ue.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(uI,{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(pI,{key:1})):t.createCommentVNode("",!0)],34))}}),bI={name:"Transform",compatConfig:{MODE:3}},_I=t.defineComponent({...bI,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=tt(),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))}}),kI={name:"Viewport",compatConfig:{MODE:3}},EI=t.defineComponent({...kI,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:p,zoomOnPinch:f,zoomOnScroll:h,preventScrolling:_,noWheelClassName:g,noPanClassName:k,emits:E,connectionStartHandle:b,userSelectionActive:v,paneDragging:y,d3Zoom:S,d3Selection:$,d3ZoomHandler:O,viewport:B,viewportRef:z,paneClickDistance:T}=tt();cI(z);const x=t.shallowRef(!1),R=t.shallowRef(!1);let N=null,I=!1,C=0,U={x:0,y:0,zoom:0};const A=Ki(s),P=Ki(l),F=Ki(r),H=t.toRef(()=>(!P.value||P.value&&l.value===!0)&&(A.value||m.value)),G=t.toRef(()=>A.value||c.value),le=t.toRef(()=>l.value===!0&&H.value!==!0),se=t.toRef(()=>P.value&&l.value!==!0||v.value||le.value),ue=t.toRef(()=>b.value!==null);t.onMounted(()=>{if(!z.value){Xi("Viewport element is missing");return}const Ae=z.value,de=Ae.getBoundingClientRect(),ge=H0().clickDistance(T.value).scaleExtent([n.value,o.value]).translateExtent(a.value),_e=nn(Ae).call(ge),V=_e.on("wheel.zoom"),L=ai.translate(i.value.x??0,i.value.y??0).scale(xo(i.value.zoom??1,n.value,o.value)),j=[[0,0],[de.width,de.height]],ee=ge.constrain()(L,j,a.value);ge.transform(_e,ee),ge.wheelDelta(Ms),S.value=ge,$.value=_e,O.value=V,B.value={x:ee.x,y:ee.y,zoom:ee.k},ge.on("start",Z=>{var pe;if(!Z.sourceEvent)return null;C=Z.sourceEvent.button,x.value=!0;const me=Ie(Z.transform);((pe=Z.sourceEvent)==null?void 0:pe.type)==="mousedown"&&(y.value=!0),U=me,E.viewportChangeStart(me),E.moveStart({event:Z,flowTransform:me})}),ge.on("end",Z=>{if(!Z.sourceEvent)return null;if(x.value=!1,y.value=!1,ye(H.value,C??0)&&!I&&E.paneContextMenu(Z.sourceEvent),I=!1,ae(U,Z.transform)){const pe=Ie(Z.transform);U=pe,E.viewportChangeEnd(pe),E.moveEnd({event:Z,flowTransform:pe})}}),ge.filter(Z=>{var pe;const me=F.value||h.value,ve=f.value&&Z.ctrlKey,Ee=Z.button,W=Z.type==="wheel";if(Ee===1&&Z.type==="mousedown"&&(Pe(Z,"vue-flow__node")||Pe(Z,"vue-flow__edge")))return!0;if(!H.value&&!me&&!G.value&&!p.value&&!f.value||v.value||ue.value&&!W||!p.value&&Z.type==="dblclick"||Pe(Z,g.value)&&W||Pe(Z,k.value)&&(!W||G.value&&W&&!F.value)||!f.value&&Z.ctrlKey&&W||!me&&!G.value&&!ve&&W)return!1;if(!f&&Z.type==="touchstart"&&((pe=Z.touches)==null?void 0:pe.length)>1)return Z.preventDefault(),!1;if(!H.value&&(Z.type==="mousedown"||Z.type==="touchstart")||le.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ee===0||Array.isArray(m.value)&&!m.value.includes(Ee)&&(Z.type==="mousedown"||Z.type==="touchstart"))return!1;const J=Array.isArray(m.value)&&m.value.includes(Ee)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ee||Ee<=1;return(!Z.ctrlKey||A.value||W)&&J}),t.watch([v,H],()=>{v.value&&!x.value?ge.on("zoom",null):v.value||ge.on("zoom",Z=>{B.value={x:Z.transform.x,y:Z.transform.y,zoom:Z.transform.k};const pe=Ie(Z.transform);I=ye(H.value,C??0),E.viewportChange(pe),E.move({event:Z,flowTransform:pe})})},{immediate:!0}),t.watch([v,G,d,F,f,_,g],()=>{G.value&&!F.value&&!v.value?_e.on("wheel.zoom",Z=>{if(Pe(Z,g.value))return!1;const pe=F.value||h.value,me=f.value&&Z.ctrlKey;if(!(!_.value||G.value||pe||me))return!1;Z.preventDefault(),Z.stopImmediatePropagation();const Ee=_e.property("__zoom").k||1,W=Ji();if(!A.value&&Z.ctrlKey&&f.value&&W){const De=pn(Z),Oe=Ms(Z),ie=Ee*2**Oe;ge.scaleTo(_e,ie,De,Z);return}const J=Z.deltaMode===1?20:1;let X=d.value===ji.Vertical?0:Z.deltaX*J,he=d.value===ji.Horizontal?0:Z.deltaY*J;!W&&Z.shiftKey&&d.value!==ji.Vertical&&!X&&he&&(X=he,he=0),ge.translateBy(_e,-(X/Ee)*u.value,-(he/Ee)*u.value);const Te=Ie(_e.property("__zoom"));N&&clearTimeout(N),R.value?(E.move({event:Z,flowTransform:Te}),E.viewportChange(Te),N=setTimeout(()=>{E.moveEnd({event:Z,flowTransform:Te}),E.viewportChangeEnd(Te),R.value=!1},150)):(R.value=!0,E.moveStart({event:Z,flowTransform:Te}),E.viewportChangeStart(Te))},{passive:!1}):typeof V<"u"&&_e.on("wheel.zoom",function(Z,pe){const me=!_.value&&Z.type==="wheel"&&!Z.ctrlKey,ve=F.value||h.value,Ee=f.value&&Z.ctrlKey;if(!ve&&!c.value&&!Ee&&Z.type==="wheel"||me||Pe(Z,g.value))return null;Z.preventDefault(),V.call(this,Z,pe)},{passive:!1})},{immediate:!0})});function ye(Ae,de){return de===2&&Array.isArray(Ae)&&Ae.includes(2)}function ae(Ae,de){return Ae.x!==de.x&&!Number.isNaN(de.x)||Ae.y!==de.y&&!Number.isNaN(de.y)||Ae.zoom!==de.k&&!Number.isNaN(de.k)}function Ie(Ae){return{x:Ae.x,y:Ae.y,zoom:Ae.k}}function Pe(Ae,de){return Ae.target.closest(`.${de}`)}return(Ae,de)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:z,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(gI,{"is-selecting":se.value,"selection-key-pressed":t.unref(P),class:t.normalizeClass({connecting:ue.value,dragging:t.unref(y),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(_I,null,{default:t.withCtx(()=>[t.renderSlot(Ae.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),NI=["id"],wI=["id"],II=["id"],vI={name:"A11yDescriptions",compatConfig:{MODE:3}},CI=t.defineComponent({...vI,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=tt();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(Pf)}-${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,NI),t.createElementVNode("div",{id:`${t.unref(zf)}-${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,wI),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(W0)}-${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,II))],64))}});function SI(){const e=tt();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function xI(e,n,o){return o===$e.Left?e-n:o===$e.Right?e+n:e}function RI(e,n,o){return o===$e.Top?e-n:o===$e.Bottom?e+n:e}const Ks=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=$e.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:xI(n,e,i),cy:RI(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Ks.props=["radius","centerX","centerY","position","type"],Ks.compatConfig={MODE:3};const Vp=Ks,AI=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:p,multiSelectionActive:f,disableKeyboardA11y:h,elementsSelectable:_,edgesUpdatable:g,edgesFocusable:k,hooks:E}=tt(),b=t.computed(()=>u(e.id)),{emit:v,on:y}=vw(b.value,r),S=t.inject(Er),$=t.getCurrentInstance(),O=t.ref(!1),B=t.ref(!1),z=t.ref(""),T=t.ref(null),x=t.ref("source"),R=t.ref(null),N=t.toRef(()=>typeof b.value.selectable>"u"?_.value:b.value.selectable),I=t.toRef(()=>typeof b.value.updatable>"u"?g.value:b.value.updatable),C=t.toRef(()=>typeof b.value.focusable>"u"?k.value:b.value.focusable);t.provide(Nw,e.id),t.provide(ww,R);const U=t.computed(()=>b.value.class instanceof Function?b.value.class(b.value):b.value.class),A=t.computed(()=>b.value.style instanceof Function?b.value.style(b.value):b.value.style),P=t.computed(()=>{const L=b.value.type||"default",j=S==null?void 0:S[`edge-${L}`];if(j)return j;let ee=b.value.template??c.value[L];if(typeof ee=="string"&&$){const Z=Object.keys($.appContext.components);Z&&Z.includes(L)&&(ee=t.resolveComponent(L,!1))}return ee&&typeof ee!="string"?ee:(r.error(new vt(gt.EDGE_TYPE_MISSING,ee)),!1)}),{handlePointerDown:F}=Ep({nodeId:z,handleId:T,type:x,isValidConnection:p,edgeUpdaterType:x,onEdgeUpdate:le,onEdgeUpdateEnd:se});return()=>{const L=m(b.value.source),j=m(b.value.target),ee="pathOptions"in b.value?b.value.pathOptions:{};if(!L&&!j)return r.error(new vt(gt.EDGE_SOURCE_TARGET_MISSING,b.value.id,b.value.source,b.value.target)),null;if(!L)return r.error(new vt(gt.EDGE_SOURCE_MISSING,b.value.id,b.value.source)),null;if(!j)return r.error(new vt(gt.EDGE_TARGET_MISSING,b.value.id,b.value.target)),null;if(!b.value||b.value.hidden||L.hidden||j.hidden)return null;let Z;i.value===Mn.Strict?Z=L.handleBounds.source:Z=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const pe=lp(Z,b.value.sourceHandle);let me;i.value===Mn.Strict?me=j.handleBounds.target:me=[...j.handleBounds.target||[],...j.handleBounds.source||[]];const ve=lp(me,b.value.targetHandle),Ee=(pe==null?void 0:pe.position)||$e.Bottom,W=(ve==null?void 0:ve.position)||$e.Top,{x:J,y:X}=si(L,pe,Ee),{x:he,y:Te}=si(j,ve,W);return b.value.sourceX=J,b.value.sourceY=X,b.value.targetX=he,b.value.targetY=Te,t.h("g",{ref:R,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${P.value===!1?"default":b.value.type||"default"}`,s.value,U.value,{updating:O.value,selected:b.value.selected,animated:b.value.animated,inactive:!N.value&&!E.value.edgeClick.hasListeners()}],tabIndex:C.value?0:void 0,"aria-label":b.value.ariaLabel===null?void 0:b.value.ariaLabel??`Edge from ${b.value.source} to ${b.value.target}`,"aria-describedby":C.value?`${zf}-${n}`:void 0,"aria-roledescription":"edge",role:C.value?"group":"img",...b.value.domAttributes,onClick:ye,onContextmenu:ae,onDblclick:Ie,onMouseenter:Pe,onMousemove:Ae,onMouseleave:de,onKeyDown:C.value?V:void 0},[B.value?null:t.h(P.value===!1?c.value.default:P.value,{id:e.id,sourceNode:L,targetNode:j,source:b.value.source,target:b.value.target,type:b.value.type,updatable:I.value,selected:b.value.selected,animated:b.value.animated,label:b.value.label,labelStyle:b.value.labelStyle,labelShowBg:b.value.labelShowBg,labelBgStyle:b.value.labelBgStyle,labelBgPadding:b.value.labelBgPadding,labelBgBorderRadius:b.value.labelBgBorderRadius,data:b.value.data,events:{...b.value.events,...y},style:A.value,markerStart:`url('#${Wi(b.value.markerStart,n)}')`,markerEnd:`url('#${Wi(b.value.markerEnd,n)}')`,sourcePosition:Ee,targetPosition:W,sourceX:J,sourceY:X,targetX:he,targetY:Te,sourceHandleId:b.value.sourceHandle,targetHandleId:b.value.targetHandle,interactionWidth:b.value.interactionWidth,...ee}),[I.value==="source"||I.value===!0?[t.h("g",{onMousedown:ge,onMouseenter:H,onMouseout:G},t.h(Vp,{position:Ee,centerX:J,centerY:X,radius:a.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[t.h("g",{onMousedown:_e,onMouseenter:H,onMouseout:G},t.h(Vp,{position:W,centerX:he,centerY:Te,radius:a.value,type:"target","data-type":"target"}))]:null]])};function H(){O.value=!0}function G(){O.value=!1}function le(L,j){v.update({event:L,edge:b.value,connection:j})}function se(L){v.updateEnd({event:L,edge:b.value}),B.value=!1}function ue(L,j){L.button===0&&(B.value=!0,z.value=j?b.value.target:b.value.source,T.value=(j?b.value.targetHandle:b.value.sourceHandle)??null,x.value=j?"target":"source",v.updateStart({event:L,edge:b.value}),F(L))}function ye(L){var j;const ee={event:L,edge:b.value};N.value&&(l.value=!1,b.value.selected&&f.value?(d([b.value]),(j=R.value)==null||j.blur()):o([b.value])),v.click(ee)}function ae(L){v.contextMenu({event:L,edge:b.value})}function Ie(L){v.doubleClick({event:L,edge:b.value})}function Pe(L){v.mouseEnter({event:L,edge:b.value})}function Ae(L){v.mouseMove({event:L,edge:b.value})}function de(L){v.mouseLeave({event:L,edge:b.value})}function ge(L){ue(L,!0)}function _e(L){ue(L,!1)}function V(L){var j;!h.value&&Ff.includes(L.key)&&N.value&&(L.key==="Escape"?((j=R.value)==null||j.blur(),d([u(e.id)])):o([u(e.id)]))}}}),$I=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}=tt(),p=(e=t.inject(Er))==null?void 0:e["connection-line"],f=t.computed(()=>{var E;return m((E=i.value)==null?void 0:E.nodeId)}),h=t.computed(()=>{var E;return m((E=a.value)==null?void 0:E.nodeId)??null}),_=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),g=t.computed(()=>c.value.markerStart?`url(#${Wi(c.value.markerStart,n)})`:""),k=t.computed(()=>c.value.markerEnd?`url(#${Wi(c.value.markerEnd,n)})`:"");return()=>{var E,b,v;if(!f.value||!i.value)return null;const y=i.value.id,S=i.value.type,$=f.value.handleBounds;let O=($==null?void 0:$[S])??[];if(o.value===Mn.Loose){const A=($==null?void 0:$[S==="source"?"target":"source"])??[];O=[...O,...A]}if(!O)return null;const B=(y?O.find(A=>A.id===y):O[0])??null,z=(B==null?void 0:B.position)??$e.Top,{x:T,y:x}=si(f.value,B,z);let R=null;h.value&&(o.value===Mn.Strict?R=((E=h.value.handleBounds[S==="source"?"target":"source"])==null?void 0:E.find(A=>{var P;return A.id===((P=a.value)==null?void 0:P.id)}))||null:R=((b=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:b.find(A=>{var P;return A.id===((P=a.value)==null?void 0:P.id)}))||null);const N=((v=a.value)==null?void 0:v.position)??(z?Ps[z]:null);if(!z||!N)return null;const I=l.value??c.value.type??So.Bezier;let C="";const U={sourceX:T,sourceY:x,sourcePosition:z,targetX:_.value.x,targetY:_.value.y,targetPosition:N};return I===So.Bezier?[C]=xp(U):I===So.Step?[C]=js({...U,borderRadius:0}):I===So.SmoothStep?[C]=js(U):I===So.SimpleBezier?[C]=Ap(U):C=`M${T},${x} ${_.value.x},${_.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:T,sourceY:x,sourcePosition:z,targetX:_.value.x,targetY:_.value.y,targetPosition:N,sourceNode:f.value,sourceHandle:B,targetNode:h.value,targetHandle:R,markerEnd:k.value,markerStart:g.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":k.value,"marker-start":g.value})))}}}),TI=["id","markerWidth","markerHeight","markerUnits","orient"],MI={name:"MarkerType",compatConfig:{MODE:3}},VI=t.defineComponent({...MI,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(As).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(As).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,TI))}}),LI={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},BI={name:"MarkerDefinitions",compatConfig:{MODE:3}},DI=t.defineComponent({...BI,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=tt(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Wi(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",LI,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(VI,{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))])]))}}),OI={name:"Edges",compatConfig:{MODE:3}},PI=t.defineComponent({...OI,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=tt();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(DI),(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(dw)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(AI),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref($I))],64))}}),zI=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:p,elevateNodesOnSelect:f,disableKeyboardA11y:h,ariaLiveMessage:_,snapToGrid:g,snapGrid:k,nodeDragThreshold:E,nodesDraggable:b,elementsSelectable:v,nodesConnectable:y,nodesFocusable:S,hooks:$}=tt(),O=t.ref(null);t.provide(_p,O),t.provide(bp,e.id);const B=t.inject(Er),z=t.getCurrentInstance(),T=wp(),{node:x,parentNode:R}=Np(e.id),{emit:N,on:I}=Rw(x,l),C=t.toRef(()=>typeof x.draggable>"u"?b.value:x.draggable),U=t.toRef(()=>typeof x.selectable>"u"?v.value:x.selectable),A=t.toRef(()=>typeof x.connectable>"u"?y.value:x.connectable),P=t.toRef(()=>typeof x.focusable>"u"?S.value:x.focusable),F=t.computed(()=>U.value||C.value||$.value.nodeClick.hasListeners()||$.value.nodeDoubleClick.hasListeners()||$.value.nodeMouseEnter.hasListeners()||$.value.nodeMouseMove.hasListeners()||$.value.nodeMouseLeave.hasListeners()),H=t.toRef(()=>!!x.dimensions.width&&!!x.dimensions.height),G=t.computed(()=>{const j=x.type||"default",ee=B==null?void 0:B[`node-${j}`];if(ee)return ee;let Z=x.template||m.value[j];if(typeof Z=="string"&&z){const pe=Object.keys(z.appContext.components);pe&&pe.includes(j)&&(Z=t.resolveComponent(j,!1))}return Z&&typeof Z!="string"?Z:(l.error(new vt(gt.NODE_TYPE_MISSING,Z)),!1)}),le=kp({id:e.id,el:O,disabled:()=>!C.value,selectable:U,dragHandle:()=>x.dragHandle,onStart(j){N.dragStart(j)},onDrag(j){N.drag(j)},onStop(j){N.dragStop(j)},onClick(j){V(j)}}),se=t.computed(()=>x.class instanceof Function?x.class(x):x.class),ue=t.computed(()=>{const j=(x.style instanceof Function?x.style(x):x.style)||{},ee=x.width instanceof Function?x.width(x):x.width,Z=x.height instanceof Function?x.height(x):x.height;return!j.width&&ee&&(j.width=typeof ee=="string"?ee:`${ee}px`),!j.height&&Z&&(j.height=typeof Z=="string"?Z:`${Z}px`),j}),ye=t.toRef(()=>Number(x.zIndex??ue.value.zIndex??0));return u(j=>{(j.includes(e.id)||!j.length)&&Ie()}),t.onMounted(()=>{t.watch(()=>x.hidden,(j=!1,ee,Z)=>{!j&&O.value&&(e.resizeObserver.observe(O.value),Z(()=>{O.value&&e.resizeObserver.unobserve(O.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>x.type,()=>x.sourcePosition,()=>x.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:O.value,forceUpdate:!0}])})}),t.watch([()=>x.position.x,()=>x.position.y,()=>{var j;return(j=R.value)==null?void 0:j.computedPosition.x},()=>{var j;return(j=R.value)==null?void 0:j.computedPosition.y},()=>{var j;return(j=R.value)==null?void 0:j.computedPosition.z},ye,()=>x.selected,()=>x.dimensions.height,()=>x.dimensions.width,()=>{var j;return(j=R.value)==null?void 0:j.dimensions.height},()=>{var j;return(j=R.value)==null?void 0:j.dimensions.width}],([j,ee,Z,pe,me,ve])=>{const Ee={x:j,y:ee,z:ve+(f.value&&x.selected?1e3:0)};typeof Z<"u"&&typeof pe<"u"?x.computedPosition=iw({x:Z,y:pe,z:me},Ee):x.computedPosition=Ee},{flush:"post",immediate:!0}),t.watch([()=>x.extent,p],([j,ee],[Z,pe])=>{(j!==Z||ee!==pe)&&ae()}),x.extent==="parent"||typeof x.extent=="object"&&"range"in x.extent&&x.extent.range==="parent"?ss(()=>H).toBe(!0).then(ae):ae(),()=>x.hidden?null:t.h("div",{ref:O,"data-id":x.id,class:["vue-flow__node",`vue-flow__node-${G.value===!1?"default":x.type||"default"}`,{[o.value]:C.value,dragging:le==null?void 0:le.value,draggable:C.value,selected:x.selected,selectable:U.value,parent:x.isParent},se.value],style:{visibility:H.value?"visible":"hidden",zIndex:x.computedPosition.z??ye.value,transform:`translate(${x.computedPosition.x}px,${x.computedPosition.y}px)`,pointerEvents:F.value?"all":"none",...ue.value},tabIndex:P.value?0:void 0,role:P.value?"group":void 0,"aria-describedby":h.value?void 0:`${Pf}-${n}`,"aria-label":x.ariaLabel,"aria-roledescription":"node",...x.domAttributes,onMouseenter:Pe,onMousemove:Ae,onMouseleave:de,onContextmenu:ge,onClick:V,onDblclick:_e,onKeydown:L},[t.h(G.value===!1?m.value.default:G.value,{id:x.id,type:x.type,data:x.data,events:{...x.events,...I},selected:x.selected,resizing:x.resizing,dragging:le.value,connectable:A.value,position:x.computedPosition,dimensions:x.dimensions,isValidTargetPos:x.isValidTargetPos,isValidSourcePos:x.isValidSourcePos,parent:x.parentNode,parentNodeId:x.parentNode,zIndex:x.computedPosition.z??ye.value,targetPosition:x.targetPosition,sourcePosition:x.sourcePosition,label:x.label,dragHandle:x.dragHandle,onUpdateNodeInternals:Ie})]);function ae(){const j=x.computedPosition,{computedPosition:ee,position:Z}=Bs(x,g.value?kr(j,k.value):j,l.error,p.value,R.value);(x.computedPosition.x!==ee.x||x.computedPosition.y!==ee.y)&&(x.computedPosition={...x.computedPosition,...ee}),(x.position.x!==Z.x||x.position.y!==Z.y)&&(x.position=Z)}function Ie(){O.value&&d([{id:e.id,nodeElement:O.value,forceUpdate:!0}])}function Pe(j){le!=null&&le.value||N.mouseEnter({event:j,node:x})}function Ae(j){le!=null&&le.value||N.mouseMove({event:j,node:x})}function de(j){le!=null&&le.value||N.mouseLeave({event:j,node:x})}function ge(j){return N.contextMenu({event:j,node:x})}function _e(j){return N.doubleClick({event:j,node:x})}function V(j){U.value&&(!i.value||!C.value||E.value>0)&&zs(x,r.value,c,s,a,!1,O.value),N.click({event:j,node:x})}function L(j){if(!($s(j)||h.value))if(Ff.includes(j.key)&&U.value){const ee=j.key==="Escape";zs(x,r.value,c,s,a,ee,O.value)}else C.value&&x.selected&&ri[j.key]&&(j.preventDefault(),_.value=`Moved selected node ${j.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~x.position.x}, y: ${~~x.position.y}`,T({x:ri[j.key].x,y:ri[j.key].y},j.shiftKey))}}});function FI(e={includeHiddenNodes:!1}){const{nodes:n}=tt();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 UI={class:"vue-flow__nodes vue-flow__container"},HI={name:"Nodes",compatConfig:{MODE:3}},jI=t.defineComponent({...HI,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=tt(),a=FI(),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",UI,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(zI),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=p,f},s,0),128)):t.createCommentVNode("",!0)]))}});function KI(){const{emits:e}=tt();t.onMounted(()=>{if(mp()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new vt(gt.MISSING_STYLES))}})}const GI=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),YI={name:"VueFlow",compatConfig:{MODE:3}},qI=t.defineComponent({...YI,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=cs(i,"modelValue",o),l=cs(i,"nodes",o),s=cs(i,"edges",o),c=tt(i),d=Mw({modelValue:r,nodes:l,edges:s},i,c);return Lw(o,c.hooks),SI(),KI(),t.provide(Er,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(EI,null,{default:t.withCtx(()=>[t.createVNode(PI),GI,t.createVNode(jI),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(CI)],512))}}),WI={name:"Panel",compatConfig:{MODE:3}},Lp=t.defineComponent({...WI,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=tt(),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))}}),JI=["width","height","innerHTML"],XI=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(t.openBlock(),t.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:n[e.name]??""},null,8,JI))}}),Qe=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},xe=Qe(XI,[["__scopeId","data-v-05aac699"]]),To=["red","amber","green","teal","blue","indigo","violet","pink"],Bp={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function ZI(e){return typeof e=="string"&&e in Bp}const QI={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},ev=.15;function tv(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 nv(e){if(typeof e!="string")return null;const n=tv(e);if(!n||n.s<ev)return null;let o=null,i=1/0;for(const a of To){const r=Math.abs(n.h-QI[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function Vt(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(ZI(n))return n;const o=e==null?void 0:e.properties;return nv((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Gs(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const ov={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)"},iv={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 Dp(e,n=!1){return e?n?iv[e]:ov[e]:null}function Mo(e){return Bp[e]}function ci(e){return`var(--em-swatch-${e}-bar)`}function av(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 rv(e,n){const o=av(n);return o?e(o):n.split("-")[1]??n}function lv(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";case"CHK-TYPE-8":return"em.check.type8";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function Op(e,n){const o=lv(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 sv(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const cv={class:"em-inline-issue__msgs"},Vo=Qe(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(xe,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",cv,[(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(Op)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),dv=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],uv={key:0,class:"em-mlang__dot"},mv=["id","role","aria-labelledby"],fv=["title"],Jt=Qe(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const k=o.defaultLang;return k&&o.languages.includes(k)?k:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const k=o.activeLang;return k&&o.languages.includes(k)?k:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(k){var E,b;return!!((b=(E=o.modelValue)==null?void 0:E[k])!=null&&b.trim())}const d=k=>`${o.name}-tab-${k}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(k){var v,y;const E=o.languages,b=E[(k+E.length)%E.length];b&&(l.value=b,await t.nextTick(),(y=(v=m.value)==null?void 0:v.querySelectorAll('[role="tab"]')[E.indexOf(b)])==null||y.focus())}function f(k){p(o.languages.indexOf(s.value)+k)}const h=t.computed(()=>o.languages.filter(k=>{var E,b;return k!==s.value&&!!((b=(E=o.modelValue)==null?void 0:E[k])!=null&&b.trim())})),_=t.computed(()=>{var k;return((k=o.modelValue)==null?void 0:k[s.value])??""});function g(k){const E={...o.modelValue};k.trim()===""?delete E[s.value]:E[s.value]=k,i("update:modelValue",E)}return(k,E)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,b=>(t.openBlock(),t.createElementBlock("span",{id:d(b),key:b,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===b}]),role:"tab","aria-selected":s.value===b,"aria-controls":u.value,tabindex:s.value===b?0:-1,onClick:v=>l.value=b,onKeydown:[t.withKeys(t.withModifiers(v=>l.value=b,["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>l.value=b,["prevent"]),["space"]),E[0]||(E[0]=t.withKeys(t.withModifiers(v=>f(-1),["prevent"]),["left"])),E[1]||(E[1]=t.withKeys(t.withModifiers(v=>f(1),["prevent"]),["right"])),E[2]||(E[2]=t.withKeys(t.withModifiers(v=>p(0),["prevent"]),["home"])),E[3]||(E[3]=t.withKeys(t.withModifiers(v=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(b),1),c(b)?(t.openBlock(),t.createElementBlock("span",uv,"•")):t.createCommentVNode("",!0)],42,dv))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(te.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":_.value,"onUpdate:modelValue":g},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":_.value,"onUpdate:modelValue":g},null,8,["name","placeholder","model-value"]))],8,mv),r.value&&h.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:h.value.join(", "),"aria-hidden":"true"},"•",8,fv)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),pv=["disabled"],hv={class:"em-panel__sub-label"},yv={class:"em-field"},gv={class:"em-field"},bv={class:"em-field"},_v={key:0,class:"em-field"},kv={class:"em-field"},Ev={class:"em-class"},Nv={class:"em-field"},wv={class:"em-field"},Iv={key:1,class:"em-attr__navhint"},vv={key:2,class:"em-field"},Cv={key:3,class:"em-field"},Sv={class:"em-multilang"},xv={class:"em-multilang"},Rv={key:4,class:"em-jpa"},Av={class:"em-field"},$v={class:"em-field"},Tv={class:"em-field"},Mv=["title"],Vv={class:"em-swatch"},Lv={class:"em-swatch__row"},Bv=["title"],Dv=["title","onClick"],Pp=Qe(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(H=>H.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(H=>H.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var H;return Vt(((H=l.value)==null?void 0:H.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","SERIALIZED_TYPE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=["none","LIST","SET","MAP"],u=t.computed(()=>{var H,G;return((G=(H=r.value)==null?void 0:H.serialization)==null?void 0:G.collectionType)??"none"});function m(H){return H==="none"?a.t("em.entity.serializedContainerNone"):H}function p(H){var se,ue;const G=H==="none"?void 0:H,le=G==="MAP"?(ue=(se=r.value)==null?void 0:se.serialization)==null?void 0:ue.mapKeyType:void 0;E({serialization:G?{collectionType:G,...le?{mapKeyType:le}:{}}:null})}function f(H){var le,se;((se=(le=r.value)==null?void 0:le.serialization)==null?void 0:se.collectionType)==="MAP"&&E({serialization:{collectionType:"MAP",...H.trim()?{mapKeyType:H.trim()}:{}}})}const h=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],_=["inherit","STRING","CHAR","INTEGER"],g=H=>H;function k(H){return H==="inherit"?a.t("em.common.inherit"):H}function E(H){r.value&&a.updateEntity(r.value.modelId,H)}function b(H,G,le){var ue;const se=((ue=r.value)==null?void 0:ue.table)??{physicalName:""};E(H==="physicalName"?{table:{...se,physicalName:le}}:{table:{...se,logicalName:{...se.logicalName,[G]:le}}})}const v=t.computed(()=>{var H;return cn(((H=r.value)==null?void 0:H.stereotype)??"UNDEFINED")});function y(H){var le,se,ue;const G=v.value?(le=r.value)==null?void 0:le.classLogicalName:(ue=(se=r.value)==null?void 0:se.table)==null?void 0:ue.logicalName;return(G==null?void 0:G[H])??""}function S(H,G){var ue;if(!v.value)return b("logicalName",H,G);const le={...(ue=r.value)==null?void 0:ue.classLogicalName,[H]:G},se=Object.fromEntries(Object.entries(le).filter(([,ye])=>ye!=null&&String(ye).trim()!==""));E({classLogicalName:Object.keys(se).length?se:void 0})}function $(H){E({description:Object.keys(H).length?H:void 0})}function O(H,G){var le;E({jpaAttrs:{...(le=r.value)==null?void 0:le.jpaAttrs,[H]:G}})}function B(H,G){O(H,G)}const z=t.computed(()=>{var H,G;return((G=(H=r.value)==null?void 0:H.jpaAttrs)==null?void 0:G.discriminatorType)??"inherit"}),T=t.computed(()=>{var H,G;return!((G=(H=r.value)==null?void 0:H.jpaAttrs)!=null&&G.useDiscriminator)});function x(H){O("discriminatorType",H==="inherit"?void 0:H)}function R(H){E({hasPersonalInfo:H})}function N(H){E({referenceOnly:H?!0:void 0})}function I(H){E({superClass:H.trim()||void 0})}function C(H){E({schema:H.trim()||void 0})}function U(H){E({abstractClass:H})}const A=t.computed(()=>{var H,G;return((G=(H=r.value)==null?void 0:H.declarationOfInterfaces)==null?void 0:G.join(", "))??""});function P(H){const G=H.split(",").map(le=>le.trim()).filter(Boolean);E({declarationOfInterfaces:G.length?G:void 0})}function F(H){r.value&&a.setEntitySwatch(r.value.modelId,H)}return(H,G)=>{var le,se,ue,ye;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:G[0]||(G[0]=ae=>i("toggle"))},[t.createElementVNode("span",hv,[t.createVNode(xe,{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(Vo,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",yv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":G[1]||(G[1]=ae=>E({name:ae}))},null,8,["model-value"])]),t.createElementVNode("label",gv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":g,"label-provider":t.unref(yi),"onUpdate:modelValue":G[2]||(G[2]=ae=>E({stereotype:ae}))},null,8,["model-value","label-provider"])]),r.value.stereotype==="SERIALIZED_TYPE"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",bv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.serializedContainer")),1),t.createVNode(t.unref(te.BSSelect),{name:"ent-ser-container","model-value":u.value,items:d,"value-provider":g,"label-provider":m,"onUpdate:modelValue":G[3]||(G[3]=ae=>ae&&p(ae))},null,8,["model-value"])]),u.value==="MAP"?(t.openBlock(),t.createElementBlock("label",_v,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.serializedMapKey")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-ser-mapkey",width:"100%",placeholder:t.unref(a).t("em.entity.serializedMapKeyPlaceholder"),"model-value":((le=r.value.serialization)==null?void 0:le.mapKeyType)??"","onUpdate:modelValue":f},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("label",kv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":G[4]||(G[4]=ae=>E({packageName:ae}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Ev,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Nv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":G[5]||(G[5]=ae=>I(ae))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",wv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":A.value,"onUpdate:modelValue":G[6]||(G[6]=ae=>P(ae))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":G[7]||(G[7]=ae=>U(ae))},null,8,["label","model-value"])]),t.unref(at)(r.value.stereotype)?(t.openBlock(),t.createElementBlock("p",Iv,t.toDisplayString(t.unref(a).t("em.entity.noOwnTableNote")),1)):(t.openBlock(),t.createElementBlock("label",vv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-table",width:"100%","model-value":((se=r.value.table)==null?void 0:se.physicalName)??"","onUpdate:modelValue":G[8]||(G[8]=ae=>b("physicalName",null,ae))},null,8,["model-value"])])),t.unref(cn)(r.value.stereotype)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",Cv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":G[9]||(G[9]=ae=>C(ae))},null,8,["placeholder","model-value"])])),t.createElementVNode("fieldset",Sv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t(v.value?"em.entity.classLogicalLegend":"em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,ae=>(t.openBlock(),t.createElementBlock("label",{key:ae,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(ae),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${ae}`,width:"100%","model-value":y(ae),"onUpdate:modelValue":Ie=>S(ae,Ie)},null,8,["name","model-value","onUpdate:modelValue"])]))),128))]),t.createElementVNode("fieldset",xv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":$},null,8,["languages","default-lang","model-value"])]),t.unref(cn)(r.value.stereotype)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",Rv,[G[14]||(G[14]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(h,ae=>{var Ie;return t.createVNode(t.unref(te.BSCheckbox),{key:ae.key,name:`jpa-${ae.key}`,class:"em-check",label:ae.label,"model-value":!!((Ie=r.value.jpaAttrs)!=null&&Ie[ae.key]),"onUpdate:modelValue":Pe=>B(ae.key,Pe)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Av,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(te.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:T.value,"model-value":((ue=r.value.jpaAttrs)==null?void 0:ue.discriminatorColumnName)??"","onUpdate:modelValue":G[10]||(G[10]=ae=>O("discriminatorColumnName",ae.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",$v,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(te.BSSelect),{disabled:T.value,"model-value":z.value,items:_,"value-provider":g,"label-provider":k,"onUpdate:modelValue":G[11]||(G[11]=ae=>ae&&x(ae))},null,8,["disabled","model-value"])]),t.createElementVNode("label",Tv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(te.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:T.value,"model-value":(ye=r.value.jpaAttrs)==null?void 0:ye.discriminatorLength,"onUpdate:modelValue":G[12]||(G[12]=ae=>O("discriminatorLength",ae||void 0))},null,8,["disabled","model-value"])])])),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":R},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(te.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":N},null,8,["label","model-value"])],8,Mv),t.createElementVNode("fieldset",Vv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",Lv,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:G[13]||(G[13]=ae=>F(null))},"∅",10,Bv),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),ae=>(t.openBlock(),t.createElementBlock("button",{key:ae,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===ae}]),style:t.normalizeStyle({background:t.unref(ci)(ae)}),title:t.unref(a).t(t.unref(Mo)(ae)),onClick:Ie=>F(ae)},null,14,Dv))),128))])])],64)):t.createCommentVNode("",!0)],8,pv)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-e5c28fb1"]]),Ov=["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"],Ys=["inherit","true","false"],Rr="__OWN__";function zp(e,n){const o=t.computed(()=>e.state.logical.entities.find(K=>K.modelId===n())??null),i=t.computed(()=>{var K;return at(((K=o.value)==null?void 0:K.stereotype)??"UNDEFINED")}),a=t.computed(()=>{var K;return cn(((K=o.value)==null?void 0:K.stereotype)??"UNDEFINED")}),r=t.computed(()=>new Set(e.selectedAttrIds.value));function l(K){return K==="none"?e.t("em.common.noneParen"):K}const s=K=>K;function c(K,oe){o.value&&e.updateAttribute(o.value.modelId,K.modelId,oe)}const d=t.computed(()=>nl(e.state.logical.associations));function u(K){if(!o.value)return;const oe=po(e.state.logical,o.value.modelId,K.modelId);return oe&&$a(K,oe)?oe:void 0}function m(K){return!!u(K)}function p(K){return m(K)?K.derivedIdFieldName??"":K.name??""}function f(K){const oe=u(K);if(!oe)return e.t("em.attr.namePlaceholder");const Me=new Map(e.state.logical.entities.map(ze=>[ze.modelId,ze]));return Tl({...K,derivedIdFieldName:void 0},oe,Me)||e.t("em.attr.namePlaceholder")}function h(K,oe){m(K)?c(K,{derivedIdFieldName:oe||void 0}):c(K,{name:oe})}function _(K){return K.name??""}function g(K,oe){c(K,{name:oe})}function k(K){return!!o.value&&ol(K,o.value,d.value)}function E(K){var ze,Ct;const oe=(ze=K.derivedFrom)==null?void 0:ze.associationRef,Me=(Ct=o.value)==null?void 0:Ct.attributes.find(Tt=>{var Ue;return Tt.attrType==="RELATION_OWN"&&((Ue=Tt.derivedFrom)==null?void 0:Ue.associationRef)===oe&&d.value.has(Tt.modelId)});return e.t("em.attr.joinColumnOnlyNote",{anchor:(Me==null?void 0:Me.name)||e.t("em.attr.nameless")})}function b(K){return!!o.value&&!!po(e.state.logical,o.value.modelId,K.modelId)}function v(K,oe){c(K,{naturalId:oe||void 0,naturalIdMutable:oe?K.naturalIdMutable:void 0})}function y(){return{naturalId:void 0,naturalIdMutable:void 0}}function S(K,oe){c(K,{identifier:oe,...oe?y():{}})}function $(K,oe){c(K,{transient:oe||void 0,...oe?y():{}})}const O=["none","LIST","SET"];function B(K,oe){c(K,{collectionType:oe==="none"?void 0:oe})}function z(K){return!!K.transient||K.attrType==="RELATION_REF"}function T(K){return fa(K)}function x(K,oe=0){var Me;return((Me=pa(K,o.value,e.state.logical.entities,e.state.logical.associations,oe))==null?void 0:Me.physicalName)||void 0}function R(K){const oe=ul(K);return oe==="association"||oe==="derived"||!!K.groupCode}const N=K=>K.value,I=K=>K.label;function C(K,oe){if(!oe)return;if(o.value&&Wc(K,oe,e.embeddableCatalog.value)){e.convertAttributeType(o.value.modelId,K.modelId,oe);return}const Me=Pe.value.find(ze=>ze.type===oe);if(Me){const ze=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};c(K,{type:oe,customType:void 0,dbAttrs:[Jc(ze,Me)]});return}c(K,oe===dn?{type:oe}:{type:oe,customType:void 0})}function U(K,oe){c(K,{customType:oe.trim()===""?void 0:oe})}function A(K,oe){if(K.attrType==="RELATION_REF")return;const ze={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...oe};oe.dataType!==void 0&&!sl.has(ze.dataType)&&(ze.scale=void 0),c(K,{dbAttrs:[ze]})}function P(K){var oe;return sl.has(((oe=K.dbAttrs[0])==null?void 0:oe.dataType)??"")}function F(K){return!P(K)&&!T(K)&&!z(K)?e.t("em.attr.scaleTypeHint"):void 0}function H(K,oe){A(K,{logicalName:Object.keys(oe).length?oe:void 0})}function G(K,oe){c(K,{fieldLogicalName:Object.keys(oe).length?oe:void 0})}function le(K){var oe;return a.value?K.fieldLogicalName:(oe=K.dbAttrs[0])==null?void 0:oe.logicalName}function se(K,oe){a.value?G(K,oe):H(K,oe)}function ue(K,oe){const Me=e.t("em.attr.logicalPlaceholder"),ze=K.dbAttrs[0];if(a.value||!ze)return Me;const Ct=Bt(K,ze,0,o.value??void 0,e.state.logical,{embeddableCatalog:e.embeddableCatalog.value}).logicalName;return Mt(Ct,oe)??Me}function ye(K,oe){c(K,{description:Object.keys(oe).length?oe:void 0})}function ae(K){return K.personalInfoAttributeType??"none"}function Ie(K,oe){c(K,{personalInfoAttributeType:oe==="none"?void 0:oe})}const Pe=t.computed(()=>e.predefinedCustomTypeCatalog.value),Ae=t.computed(()=>[...Ho(e.state.logical).keys()].sort()),de=t.computed(()=>e.embeddableCatalog.value);function ge(K){return Mt(K.label,e.userLanguage.value)??K.type}const _e=t.computed(()=>e.groupCodeCatalog.value);function V(K){var oe;return((oe=_e.value.find(Me=>Me.groupCode===K.groupCode))==null?void 0:oe.codes)??[]}function L(K){return["none",...V(K)]}function j(K){return K==="none"?"none":K.code}function ee(K){if(K==="none")return e.t("em.common.noneParen");const oe=Mt(K.label,e.userLanguage.value);return oe?`${K.code} (${oe})`:K.code}function Z(K,oe){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,oe)}function pe(K,oe){c(K,{defaultValue:oe==="none"?void 0:oe})}function me(K,oe){c(K,{defaultValue:oe.trim()===""?void 0:oe})}function ve(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}const Ee=Nn;function W(K){return ve(K)||Ee(K)}function J(K,oe,Me){const ze=K.dbAttrs.map((Ct,Tt)=>{if(Tt!==oe)return Ct;const Ue={...Ct,...Me};for(const M of Object.keys(Me))Me[M]===void 0&&delete Ue[M];return Ue});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,ze)}function X(K,oe,Me){J(K,oe,{logicalName:Object.keys(Me).length?Me:void 0})}function he(K,oe){var Ct,Tt,Ue;if(Ee(K)){const M=pa(K,o.value,e.state.logical.entities,e.state.logical.associations,oe);return M?{physicalName:M.physicalName,dataType:M.dataType,length:M.length,scale:M.scale,logicalName:M.logicalName}:void 0}if(K.attrType==="EMBED_PREDEF"){const M=(Ct=e.embeddableCatalog.value.find(w=>w.type===K.type))==null?void 0:Ct.fields[oe];return M?{name:M.name,physicalName:M.physicalName,dataType:M.dataType,length:M.length,scale:M.scale,shareable:M.shareable,logicalName:M.logicalName}:void 0}const Me=(Tt=K.embedded)==null?void 0:Tt.embeddableRef;if(!Me)return;const ze=(Ue=e.state.logical.entities.find(M=>M.modelId===Me))==null?void 0:Ue.attributes.flatMap(M=>M.dbAttrs)[oe];return ze?{physicalName:ze.physicalName,dataType:ze.dataType,length:ze.length,scale:ze.scale,logicalName:ze.logicalName}:void 0}function Te(K,oe){var Me,ze;return((Me=he(K,oe))==null?void 0:Me.dataType)||((ze=K.dbAttrs[oe])==null?void 0:ze.dataType)||""}function De(K,oe){var Me,ze;return((Me=he(K,oe))==null?void 0:Me.length)??((ze=K.dbAttrs[oe])==null?void 0:ze.length)}function Oe(K,oe){var Me,ze;return((Me=he(K,oe))==null?void 0:Me.scale)??((ze=K.dbAttrs[oe])==null?void 0:ze.scale)}function ie(K){return e.t(Ee(K)?"em.attr.fkFixedHint":"em.attr.embedFixedHint")}const Ne=Ys;function Ye(K){return K==="inherit"?e.t("em.common.inherit"):K}function it(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function Q(K,oe,Me){J(K,oe,{updatable:Me==="inherit"?void 0:Me==="true"})}function ce(K,oe){A(K,{updatable:oe==="inherit"?void 0:oe==="true"})}const je=Ys;function lt(K){return K==="inherit"?e.t("em.common.inherit"):K}function Xe(K){return(K==null?void 0:K.notNull)===void 0||(K==null?void 0:K.notNull)===null?"inherit":K.notNull?"true":"false"}function _t(K,oe,Me){J(K,oe,{notNull:Me==="inherit"?void 0:Me==="true"})}const st=Ys;function kt(K){return K==="inherit"?e.t("em.common.inherit"):K}function Et(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function On(K,oe,Me){J(K,oe,{insertable:Me==="inherit"?void 0:Me==="true"})}function En(K,oe){A(K,{insertable:oe==="inherit"?void 0:oe==="true"})}const Nt=t.computed(()=>o.value?rl(o.value,e.state.logical.entities):[]),ft=t.computed(()=>lo(Nt.value.flatMap(K=>K.attributes.flatMap(oe=>oe.dbAttrs)))),ht=t.computed(()=>Nt.value.flatMap(K=>K.attributes.filter(oe=>oe.attrType==="NORMAL"&&oe.dbAttrs.length===1&&oe.dbAttrs[0]).map(oe=>{var Me;return{modelId:oe.dbAttrs[0].modelId,physical:oe.dbAttrs[0].physicalName||oe.name,isCurrency:oe.type==="Currency",ownerName:K.modelId===((Me=o.value)==null?void 0:Me.modelId)?void 0:K.name}})));function St(){const K=[...ht.value].sort((oe,Me)=>Number(Me.isCurrency)-Number(oe.isCurrency));return[Rr,...K.map(oe=>oe.modelId)]}function Pn(K){if(K===Rr)return e.t("em.attr.sharedOwn");const oe=ht.value.find(ze=>ze.modelId===K);if(!oe)return K;const Me=oe.ownerName?`${oe.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:Me,physical:oe.physical,mode:oe.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function ut(K){return(K==null?void 0:K.sharedColumnRef)??Rr}function Be(K,oe,Me){J(K,oe,{sharedColumnRef:Me===Rr?void 0:Me})}function q(K){return(K==null?void 0:K.sharedColumnRef)!=null}function Gt(K){var oe;return((oe=so(K,ft.value))==null?void 0:oe.physicalName)??""}return{SERIALIZED_FIELD_CONTAINERS:O,setCollectionType:B,entity:o,isValueType:i,isColumnless:a,focusedAttrIds:r,personalInfoItems:Ov,piiLabel:l,idn:s,setAttr:c,isDerivedIdRow:m,rowName:p,rowNamePlaceholder:f,setRowName:h,assocFieldName:_,setAssocFieldName:g,nameLocked:k,nameLockedHint:E,isManagedFk:b,setNaturalId:v,clearNaturalIdPatch:y,setIdentifier:S,setTransient:$,dbLocked:z,fkDerived:T,fkOriginPhysical:x,typeLocked:R,typeValueOf:N,typeLabelOf:I,setAttrType:C,setAttrCustomType:U,setDb:A,scaleApplicable:P,scaleHint:F,setDbLogical:H,setAttrLogical:G,logicalNameOf:le,setLogicalName:se,setAttrDescription:ye,attrPiiValue:ae,setAttrPii:Ie,predefinedCustomTypeCatalog:Pe,serializedTypeNames:Ae,embeddableCatalog:de,predefinedLabel:ge,groupCodeCatalog:_e,attrGroupCodes:V,attrCodeItems:L,codeValueOf:j,codeLabelOf:ee,setAttrGroupCode:Z,setAttrCode:pe,setAttrDefaultValue:me,isEmbedExpanded:ve,isMultiColFk:Ee,hasColumnSlots:W,setDbAt:J,setDbLogicalAt:X,logicalPlaceholder:ue,colSlotMeta:he,fixedDataType:Te,fixedLength:De,fixedScale:Oe,slotFixedHint:ie,updatableItems:Ne,updatableLabel:Ye,updatableValue:it,setUpdatableAt:Q,setUpdatable:ce,insertableItems:st,insertableLabel:kt,insertableValue:Et,setInsertableAt:On,notNullItems:je,notNullLabel:lt,notNullValue:Xe,setNotNullAt:_t,setInsertable:En,scopeEntities:Nt,columnsById:ft,sharedCandidates:ht,sharedItems:St,sharedLabel:Pn,sharedValue:ut,setSharedAt:Be,isShared:q,sharedPhysical:Gt}}const Fp={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.classLogicalLegend":"Class logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.fkFixedHint":"Inherited from the parent PK column — its shape follows the parent.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.derivedIdField":"Derived @Id field","em.attr.assocField":"Association field (@MapsId)","em.attr.derivedIdNote":"This attribute emits **two Java fields** — the name box above is the scalar @Id field (leave empty to derive it from the parent PK column), and this is the @MapsId association field. The same value is also editable from the relationship inspector.","em.attr.joinColumnOnlyNote":"Sibling column of a composite foreign key — JPA emits one field per association, so this name is never generated. Edit the field name on «{anchor}».","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.attr.embedConvertPkBlocked":"An identifier attribute cannot be converted to an embeddable with a different column count — changing the PK shape breaks child FKs that mirror it","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.fkChildCols":"Composite foreign key — {n} columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.connectHintNode":"Drag to connect a relationship (anchored to the whole entity)","em.node.derivedIdRow":"Scalar @Id field emitted by a derived identifier (@MapsId). The model stores a single association attribute; edit it from that attribute’s inspector.","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every sub-column in this entity","em.node.embedAllShow":"Expand all collapsed sub-columns","em.node.embedAllSummary":"{n} sub-column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.entity.valueTypeSwitchEmbedded":'"{name}" is currently embedded by {owners} entit(y/ies), so it cannot be switched directly between a serialized type and an embeddable — remove the embedded attributes first (a serialized type is referenced by type, not by a relation)',"em.attr.serializedNoColumnNote":"A serialized type has no per-field physical columns — it is serialized whole into a single column on the consuming attribute","em.attr.serializedContainer":"Container","em.attr.serializedContainerNone":"None (single value)","em.entity.noOwnTableNote":"A value type has no table of its own — an embeddable is flattened into the owner table, and a serialized type is serialized into a single column on the consuming attribute","em.entity.serializedTypeHasRelations":'"{name}" participates in {count} relationship(s), so it cannot be turned into a serialized type — remove those relationships first (a serialized type is referenced by an attribute type, not by a relationship)',"em.entity.serializedContainer":"Container","em.entity.serializedContainerNone":"none (single value)","em.entity.serializedMapKey":"Map key type","em.entity.serializedMapKeyPlaceholder":"e.g. PromoType (unset → codegen emits a placeholder Object + fill-in)","em.entity.noIndexNote":"A serialized type cannot have indexes — an index is placed on columns, and this type is serialized whole into a single column on the consuming attribute","em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'A value type (embeddable / 직렬화 타입) cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","em.check.type8":"A nullable column ({dataType}) is mapped to a primitive type ({type}) — reading a NULL from the DB throws at load time. Mark it NOT NULL or switch to the boxed type ({boxed})","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},Up={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.classLogicalLegend":"クラス論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.fkFixedHint":"親のPKカラムから継承された値です — 形状は親に従います。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.derivedIdField":"派生識別 @Id フィールド","em.attr.assocField":"関連フィールド名(@MapsId)","em.attr.derivedIdNote":"この属性は**2つの Java フィールド**を出力します — 上の名前欄はスカラー @Id のフィールド名(空欄なら親 PK の物理名から派生)で、こちらは @MapsId 関連フィールド名です。同じ値は関連線のインスペクタからも編集できます。","em.attr.joinColumnOnlyNote":"複合外部キーの兄弟カラムです — JPAのフィールドは関連ごとに1つだけなので、この名前は出力されません。フィールド名は«{anchor}»で編集してください。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.attr.embedConvertPkBlocked":"識別子属性は列数が変わる埋め込み型には変換できません — PK の形が変わると、それを写す子の FK が崩れます","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.fkChildCols":"複合外部キー — カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.connectHintNode":"ドラッグして関連を接続(エンティティ全体を始点に)","em.node.derivedIdRow":"派生識別(@MapsId)が出力するスカラー @Id フィールドです — モデルには関連属性ひとつとして保存され、編集はその属性のインスペクタで行います。","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティのサブカラムをすべて折りたたむ","em.node.embedAllShow":"折りたたまれたサブカラムをすべて展開","em.node.embedAllSummary":"サブカラム {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.entity.valueTypeSwitchEmbedded":'"{name}" は現在 {owners} 件のエンティティに組み込まれているため、シリアライズ型と組込み可能の間を直接切り替えられません — 先に組込み属性を整理してください(シリアライズ型は関係ではなく型参照で指定されます)',"em.attr.serializedNoColumnNote":"シリアライズ型はフィールドごとの物理カラムを持ちません — 利用側属性の単一カラムにまとめてシリアライズされます","em.attr.serializedContainer":"コンテナ","em.attr.serializedContainerNone":"なし (単一値)","em.entity.noOwnTableNote":"値型は自身のテーブルを持ちません — 組込み可能は所有者テーブルに展開され、シリアライズ型は利用側属性の単一カラムにシリアライズされます","em.entity.serializedTypeHasRelations":'"{name}" は {count} 件の関連に参加しているためシリアライズ型に変更できません — 先に関連を整理してください(シリアライズ型は関係ではなく属性の型参照で指定されます)',"em.entity.serializedContainer":"コンテナ","em.entity.serializedContainerNone":"なし(単一値)","em.entity.serializedMapKey":"Map キー型","em.entity.serializedMapKeyPlaceholder":"例: PromoType(未指定ならコード生成が仮の Object + 手入力箇所を出す)","em.entity.noIndexNote":"シリアライズ型はインデックスを持てません — インデックスはカラムに張られますが、この型は利用側属性の単一カラムにまとめてシリアライズされます","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'値型(組込み可能・シリアライズ型)は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","em.check.type8":"NULL 許容カラム({dataType})がプリミティブ型({type})にマッピングされています — DB の NULL を読み込んだ瞬間に例外が発生します。NOT NULL を指定するか、ボックス型({boxed})に変更してください","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},Hp={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.classLogicalLegend":"클래스 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.fkFixedHint":"부모 PK 컬럼에서 상속된 값입니다 — 형상은 부모를 따릅니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.derivedIdField":"파생 식별 @Id 필드","em.attr.assocField":"연관 필드명(@MapsId)","em.attr.derivedIdNote":"이 속성은 **두 Java 필드**를 냅니다 — 위 이름 칸은 스칼라 @Id 필드명(비우면 부모 PK 물리명에서 파생)이고, 여기는 @MapsId 연관 필드명입니다. 같은 값을 관계선 인스펙터에서도 편집할 수 있습니다.","em.attr.joinColumnOnlyNote":"복합 외래키의 형제 컬럼입니다 — JPA 필드는 관계당 하나뿐이라 이 이름은 방출되지 않습니다. 필드명은 «{anchor}»에서 편집하세요.","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.attr.embedConvertPkBlocked":"식별자 속성은 컬럼 개수가 바뀌는 임베더블로 전환할 수 없습니다 — PK 형상이 바뀌면 이 PK를 참조하는 자식 FK가 함께 어긋납니다","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.fkChildCols":"복합 외래키 — 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.connectHintNode":"드래그해 관계 연결 (이 엔티티 전체를 시작점으로)","em.node.derivedIdRow":"파생 식별(@MapsId)이 방출하는 스칼라 @Id 필드입니다 — 모델에는 연관 속성 하나로 저장되며, 편집은 그 속성의 인스펙터에서 합니다.","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 서브컬럼 모두 접기","em.node.embedAllShow":"접힌 서브컬럼 모두 펼치기","em.node.embedAllSummary":"서브컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.entity.valueTypeSwitchEmbedded":'"{name}"은(는) 현재 {owners}개 엔티티에 임베드되어 있어 직렬화 타입/임베더블 사이를 바로 전환할 수 없습니다 — 임베드 속성을 먼저 정리한 뒤 전환하세요(직렬화 타입은 관계가 아니라 타입 참조로 지목됩니다)',"em.attr.serializedNoColumnNote":"직렬화 타입은 필드별 물리 컬럼이 없습니다 — 소비 속성의 컬럼 하나에 통째로 직렬화됩니다","em.attr.serializedContainer":"컨테이너","em.attr.serializedContainerNone":"없음 (단일 값)","em.entity.noOwnTableNote":"값 타입은 자체 테이블이 없습니다 — 임베더블은 소유자 테이블로 펼쳐지고, 직렬화 타입은 소비 속성의 컬럼 하나에 직렬화됩니다","em.entity.serializedTypeHasRelations":'"{name}"은(는) 연관관계 {count}개에 참여 중이라 직렬화 타입으로 바꿀 수 없습니다 — 연관을 먼저 정리하세요(직렬화 타입은 관계가 아니라 소비 속성의 타입 참조로 지목됩니다)',"em.entity.serializedContainer":"컨테이너","em.entity.serializedContainerNone":"없음 (단일 값)","em.entity.serializedMapKey":"Map 키 타입","em.entity.serializedMapKeyPlaceholder":"예: PromoType (미지정 시 코드젠이 임시 Object + 손채움)","em.entity.noIndexNote":"직렬화 타입은 인덱스를 가질 수 없습니다 — 인덱스는 컬럼에 걸리는데 이 타입은 소비 속성의 컬럼 하나에 통째로 직렬화됩니다","em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'값 타입(임베더블·직렬화 타입)은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","em.check.type8":"NULL 허용 컬럼({dataType})이 원시 타입({type})에 매핑됩니다 — DB의 NULL 을 읽는 순간 예외가 납니다. NOT NULL 을 지정하거나 박싱 타입({boxed})으로 바꾸세요","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},Pv=["ko","en","ja"],qs={ko:Hp,en:Fp,ja:Up};function rn(e,n,o){let a=(qs[e]??qs.ko)[n]??qs.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const jp=["ko","en","ja","zh"];function zv(e){if(e)for(const n of jp){const o=e[n];if(o)return o}}function Ws(e){const n=zv(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function Fv(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:jp.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const Uv=["aria-expanded","placeholder"],Hv=["aria-selected","onClick","onMouseenter"],jv={key:0,class:"gcc__opt gcc__opt--empty"},Kp=Qe(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(B,z)=>rn(o.locale??"ko",B,z),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),p=t.computed(()=>o.items.find(B=>B.groupCode===o.modelValue)),f=t.computed(()=>p.value?Ws(p.value):"");t.watch(f,B=>{d.value||(c.value=B)},{immediate:!0});const h=t.computed(()=>c.value===f.value?o.items:Fv(o.items,c.value));function _(){var z;const B=(z=r.value)==null?void 0:z.getBoundingClientRect();B&&(m.value={left:`${B.left}px`,top:`${B.bottom}px`,width:`${B.width}px`})}function g(){d.value=!0,_(),u.value=Math.max(0,h.value.findIndex(B=>B.groupCode===o.modelValue)),window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),document.addEventListener("mousedown",O)}function k(){d.value=!1,window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_),document.removeEventListener("mousedown",O)}t.onBeforeUnmount(k);function E(){g(),t.nextTick(()=>{var B;return(B=l.value)==null?void 0:B.select()})}function b(){d.value||g(),u.value=0}function v(B){i("update:modelValue",B.groupCode),c.value=Ws(B),k()}function y(){i("update:modelValue",void 0),c.value="",k()}function S(){c.value.trim()===""?y():(c.value=f.value,k())}function $(B){var z;if(B.key==="ArrowDown")d.value||g(),u.value=Math.min(u.value+1,h.value.length-1),B.preventDefault();else if(B.key==="ArrowUp")u.value=Math.max(u.value-1,0),B.preventDefault();else if(B.key==="Enter"){const T=h.value[u.value];T&&v(T),B.preventDefault()}else B.key==="Escape"&&(c.value=f.value,k(),(z=l.value)==null||z.blur())}function O(B){var T,x;const z=B.target;!((T=r.value)!=null&&T.contains(z))&&!((x=s.value)!=null&&x.contains(z))&&S()}return(B,z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":z[0]||(z[0]=T=>c.value=T),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:E,onInput:b,onKeydown:$},null,40,Uv),[[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:z[1]||(z[1]=t.withModifiers(()=>{},["prevent"])),onClick:y},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,(T,x)=>(t.openBlock(),t.createElementBlock("li",{key:T.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":x===u.value,"is-selected":T.groupCode===e.modelValue}]),role:"option","aria-selected":T.groupCode===e.modelValue,onMousedown:z[2]||(z[2]=t.withModifiers(()=>{},["prevent"])),onClick:R=>v(T),onMouseenter:R=>u.value=x},t.toDisplayString(t.unref(Ws)(T)),43,Hv))),128)),h.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",jv,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),Kv=["aria-labelledby"],Gv=["aria-checked","tabindex","onClick","onKeydown"],Gp=Qe(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,Gv))),128))],8,Kv))}}),[["__scopeId","data-v-5c793bbb"]]),Yv=["disabled"],qv={class:"em-aw__toolbar"},Wv={class:"em-aw__count"},Jv={class:"em-aw__scroll"},Xv={class:"em-aw__table"},Zv={class:"c-name"},Qv={class:"c-type"},eC={class:"c-logical"},tC=["id"],nC={class:"c-col"},oC={class:"c-constraints"},iC={class:"c-del"},aC={class:"c-expand"},rC=["title","onClick","onKeydown"],lC=["title"],sC=["title"],cC={key:1,class:"em-aw__muted"},dC=["title"],uC=["title"],mC=["title"],fC=["title"],pC={class:"em-aw__cflags"},hC=["title"],yC={key:0,class:"em-aw__embed-col"},gC={class:"em-aw__embed-label"},bC=["title"],_C={colspan:"8"},kC={class:"em-aw__detail"},EC={class:"em-aw__dgroup"},NC=["title"],wC={class:"em-aw__df"},IC={class:"em-aw__df"},vC={class:"em-aw__dgroup"},CC={key:0,class:"em-aw__dgroup"},SC={class:"em-aw__df"},xC={key:0,class:"em-aw__df"},RC={class:"em-aw__df"},AC={class:"em-aw__dgroup em-aw__ddesc"},$C={class:"c-expand"},TC=["title","onClick","onKeydown"],MC={key:1,class:"em-aw__caret is-static","aria-hidden":"true"},VC=["title"],LC=["title"],BC=["colspan"],DC=["title"],OC={class:"em-aw__cflags"},PC=["title"],zC={colspan:"8"},FC={class:"em-aw__detail"},UC={class:"em-aw__dgroup em-aw__ddesc"},HC={class:"c-expand"},jC=["title","onClick","onKeydown"],KC={class:"em-aw__embed-label"},GC=["title"],YC=["title"],qC={class:"em-aw__ro"},WC=["title"],JC={class:"em-aw__ro"},XC=["title"],ZC={class:"em-aw__ro"},QC={key:0,class:"em-aw__detail-row em-aw__embed-detail"},eS={colspan:"8"},tS={class:"em-aw__detail"},nS={class:"em-aw__dgroup"},oS={key:0,class:"em-aw__df"},iS={class:"em-aw__df"},aS={class:"em-aw__df"},rS={key:0},lS={colspan:"99",class:"em-aw__empty"},sS=6,Yp=5,cS=Qe(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isValueType:a,isColumnless:r,focusedAttrIds:l,personalInfoItems:s,piiLabel:c,idn:d,logicalNameOf:u,setLogicalName:m,logicalPlaceholder:p,SERIALIZED_FIELD_CONTAINERS:f,setCollectionType:h,setAttr:_,isDerivedIdRow:g,rowName:k,rowNamePlaceholder:E,setRowName:b,assocFieldName:v,setAssocFieldName:y,nameLocked:S,nameLockedHint:$,isManagedFk:O,setNaturalId:B,setIdentifier:z,setTransient:T,dbLocked:x,fkDerived:R,fkOriginPhysical:N,typeLocked:I,typeValueOf:C,typeLabelOf:U,setAttrType:A,setAttrCustomType:P,setDb:F,scaleApplicable:H,scaleHint:G,attrPiiValue:le,setAttrPii:se,predefinedCustomTypeCatalog:ue,serializedTypeNames:ye,embeddableCatalog:ae,predefinedLabel:Ie,groupCodeCatalog:Pe,attrGroupCodes:Ae,attrCodeItems:de,codeValueOf:ge,codeLabelOf:_e,setAttrGroupCode:V,setAttrCode:L,setAttrDefaultValue:j,setAttrDescription:ee,hasColumnSlots:Z,isMultiColFk:pe,setDbAt:me,setDbLogicalAt:ve,colSlotMeta:Ee,fixedDataType:W,fixedLength:J,fixedScale:X,slotFixedHint:he,updatableItems:Te,updatableLabel:De,updatableValue:Oe,setUpdatableAt:ie,setUpdatable:Ne,insertableItems:Ye,insertableLabel:it,insertableValue:Q,setInsertableAt:ce,setInsertable:je,sharedItems:lt,sharedLabel:Xe,sharedValue:_t,setSharedAt:st,isShared:kt,sharedPhysical:Et}=zp(o,()=>n.entityId),On=t.computed(()=>{var ut;return[...((ut=i.value)==null?void 0:ut.attributes)??[]].sort((Be,q)=>Be.order-q.order)}),En=t.computed(()=>{var ut;return(((ut=i.value)==null?void 0:ut.attributes)??[]).filter(Be=>Be.attrType!=="DIVIDER").length}),Nt=t.ref(new Set);function ft(ut){return Nt.value.has(ut)}function ht(ut){const Be=new Set(Nt.value);Be.has(ut)?Be.delete(ut):Be.add(ut),Nt.value=Be}const St=t.ref(o.userLanguage.value);function Pn(ut){!ut||!i.value||o.addPredefinedEmbed(i.value.modelId,ut)}return(ut,Be)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",qv,[t.createElementVNode("span",Wv,t.toDisplayString(t.unref(o).t("em.attr.section",{n:En.value})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Be[0]||(Be[0]=q=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:Be[1]||(Be[1]=q=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(ae).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(ae),"value-provider":q=>q.type,"label-provider":t.unref(Ie),"onUpdate:modelValue":Pn},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Jv,[t.createElementVNode("table",Xv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[Be[3]||(Be[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",Zv,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",Qv,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",eC,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,tC),t.createVNode(Gp,{modelValue:St.value,"onUpdate:modelValue":Be[2]||(Be[2]=q=>St.value=q),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",nC,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),Be[4]||(Be[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),Be[5]||(Be[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",oC,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),Be[6]||(Be[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(On.value,q=>{var Gt,K,oe,Me,ze,Ct,Tt,Ue,M;return t.openBlock(),t.createElementBlock(t.Fragment,{key:q.modelId},[q.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(l).has(q.modelId)}])},[Be[7]||(Be[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-divlabel-${q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":q.name,"onUpdate:modelValue":w=>t.unref(_)(q,{name:w})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:sS,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",iC,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeAttribute(t.unref(i).modelId,q.modelId)},null,8,["onClick"])])],2)):t.unref(Z)(q)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(l).has(q.modelId)}])},[t.createElementVNode("td",$C,[t.unref(pe)(q)?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["em-aw__caret",{"is-open":ft(q.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(q.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:w=>ht(q.modelId),onKeydown:[t.withKeys(t.withModifiers(w=>ht(q.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(w=>ht(q.modelId),["prevent"]),["space"])]},[t.createVNode(xe,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,TC)):(t.openBlock(),t.createElementBlock("span",MC,[t.createVNode(xe,{name:"chevron",size:14,class:"em-aw__caret-ic"})]))]),t.createElementVNode("td",{title:t.unref(S)(q)?t.unref($)(q):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${q.modelId}`,width:"100%",disabled:t.unref(S)(q),placeholder:t.unref(E)(q),"model-value":t.unref(k)(q),"onUpdate:modelValue":w=>t.unref(b)(q,w)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,VC),t.createElementVNode("td",{title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${q.modelId}`,width:"100%",disabled:"","model-value":q.type},null,8,["name","model-value"])],8,LC),t.createElementVNode("td",{colspan:t.unref(pe)(q)?Yp-1:Yp,class:"em-aw__embed-note"},t.toDisplayString(t.unref(pe)(q)?t.unref(o).t("em.attr.fkChildCols",{n:q.dbAttrs.length}):t.unref(o).t("em.attr.embedChildCols",{n:q.dbAttrs.length})),9,BC),t.unref(pe)(q)?(t.openBlock(),t.createElementBlock("td",{key:0,class:"c-constraints",title:t.unref(o).t("em.attr.fkDerivedNote")},[t.createElementVNode("div",OC,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${q.modelId}`,label:"PK","model-value":q.identifier,disabled:"","onUpdate:modelValue":w=>t.unref(z)(q,w)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${q.modelId}`,label:"NN","model-value":q.notNull,disabled:"","onUpdate:modelValue":w=>t.unref(_)(q,{notNull:w})},null,8,["name","model-value","onUpdate:modelValue"])])],8,DC)):t.createCommentVNode("",!0),t.createElementVNode("td",{class:"c-del",title:t.unref(O)(q)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeAttribute(t.unref(i).modelId,q.modelId)},null,8,["onClick"])],8,PC)],2),t.unref(pe)(q)&&ft(q.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(l).has(q.modelId)}])},[Be[15]||(Be[15]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",zC,[t.createElementVNode("div",FC,[t.createElementVNode("fieldset",UC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`aw-desc-${q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":q.description,"onUpdate:modelValue":w=>t.unref(ee)(q,w)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(q.dbAttrs,(w,ne)=>{var ke,Ce,Ve,Ke,He;return t.openBlock(),t.createElementBlock(t.Fragment,{key:w.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":ft(w.modelId)}])},[t.createElementVNode("td",HC,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ft(w.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(w.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:fe=>ht(w.modelId),onKeydown:[t.withKeys(t.withModifiers(fe=>ht(w.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(fe=>ht(w.modelId),["prevent"]),["space"])]},[t.createVNode(xe,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,jC)]),t.createElementVNode("td",KC,"↳ "+t.toDisplayString(((ke=t.unref(Ee)(q,ne))==null?void 0:ke.name)??((Ce=t.unref(Ee)(q,ne))==null?void 0:Ce.physicalName)??t.unref(o).t("em.attr.colFallback",{n:ne+1})),1),Be[16]||(Be[16]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(Jt,{name:`aw-embed-logical-${w.modelId}`,languages:t.unref(o).languages.value,"active-lang":St.value,placeholder:t.unref(Mt)((Ve=t.unref(Ee)(q,ne))==null?void 0:Ve.logicalName,St.value)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":w.logicalName,"onUpdate:modelValue":fe=>t.unref(ve)(q,ne,fe)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(kt)(w)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-embed-col-${w.modelId}`,width:"100%",disabled:t.unref(kt)(w),placeholder:((Ke=t.unref(Ee)(q,ne))==null?void 0:Ke.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(kt)(w)?t.unref(Et)(w):w.physicalName,"onUpdate:modelValue":fe=>t.unref(me)(q,ne,{physicalName:fe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":w.modelId},null,8,["controller","ref-id"])],8,GC),t.createElementVNode("td",{title:t.unref(he)(q)},[t.createElementVNode("span",qC,t.toDisplayString(t.unref(W)(q,ne)),1)],8,YC),t.createElementVNode("td",{title:t.unref(he)(q)},[t.createElementVNode("span",JC,t.toDisplayString(t.unref(J)(q,ne)??""),1)],8,WC),t.createElementVNode("td",{class:"c-constraints",title:t.unref(he)(q)},[t.createElementVNode("span",ZC,t.toDisplayString(t.unref(X)(q,ne)!=null?`scale ${t.unref(X)(q,ne)}`:""),1)],8,XC),Be[17]||(Be[17]=t.createElementVNode("td",null,null,-1))],2),ft(w.modelId)?(t.openBlock(),t.createElementBlock("tr",QC,[Be[20]||(Be[20]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",eS,[t.createElementVNode("div",tS,[t.createElementVNode("fieldset",nS,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(He=t.unref(Ee)(q,ne))!=null&&He.shareable?(t.openBlock(),t.createElementBlock("label",oS,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(_t)(w),items:t.unref(lt)(),"value-provider":t.unref(d),"label-provider":t.unref(Xe),"onUpdate:modelValue":fe=>fe&&t.unref(st)(q,ne,fe)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",iS,[Be[18]||(Be[18]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(kt)(w),"model-value":t.unref(kt)(w)?"false":t.unref(Q)(w),items:t.unref(Ye),"value-provider":t.unref(d),"label-provider":t.unref(it),"onUpdate:modelValue":fe=>fe&&t.unref(ce)(q,ne,fe)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",aS,[Be[19]||(Be[19]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(kt)(w),"model-value":t.unref(kt)(w)?"false":t.unref(Oe)(w),items:t.unref(Te),"value-provider":t.unref(d),"label-provider":t.unref(De),"onUpdate:modelValue":fe=>fe&&t.unref(ie)(q,ne,fe)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(l).has(q.modelId),"em-aw__open":ft(q.modelId)})},[t.createElementVNode("td",aC,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ft(q.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(q.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:w=>ht(q.modelId),onKeydown:[t.withKeys(t.withModifiers(w=>ht(q.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(w=>ht(q.modelId),["prevent"]),["space"])]},[t.createVNode(xe,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,rC)]),t.createElementVNode("td",{title:t.unref(S)(q)?t.unref($)(q):t.unref(g)(q)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${q.modelId}`,width:"100%",disabled:t.unref(S)(q),placeholder:t.unref(E)(q),"model-value":t.unref(k)(q),"onUpdate:modelValue":w=>t.unref(b)(q,w)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,lC),t.createElementVNode("td",{title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:t.unref(I)(q),items:t.unref(qc)(q.type,t.unref(ue),t.unref(ye),t.unref(ae)),"value-provider":t.unref(C),"label-provider":t.unref(U),"model-value":q.type,"onUpdate:modelValue":w=>t.unref(A)(q,w)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),q.type===t.unref(dn)&&!t.unref(R)(q)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":q.customType??"","onUpdate:modelValue":w=>t.unref(P)(q,w)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,sC),t.createElementVNode("td",null,[q.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Jt,{key:0,name:`aw-logical-${q.modelId}`,languages:t.unref(o).languages.value,"active-lang":St.value,placeholder:t.unref(p)(q,St.value),"model-value":t.unref(u)(q),"onUpdate:modelValue":w=>t.unref(m)(q,w)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",cC,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${q.modelId}`,width:"100%",placeholder:t.unref(N)(q)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(r)||t.unref(x)(q),"model-value":((Gt=q.dbAttrs[0])==null?void 0:Gt.physicalName)??"","onUpdate:modelValue":w=>t.unref(F)(q,{physicalName:w})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":(K=q.dbAttrs[0])==null?void 0:K.modelId},null,8,["controller","ref-id"])]),t.unref(r)?(t.openBlock(),t.createElementBlock("td",{key:0,title:t.unref(o).t("em.attr.serializedNoColumnNote")},[t.createVNode(t.unref(te.BSSelect),{name:`aw-container-${q.modelId}`,width:"100%",items:[...t.unref(f)],"value-provider":t.unref(d),"label-provider":w=>w==="none"?t.unref(o).t("em.attr.serializedContainerNone"):w,"model-value":q.collectionType??"none","onUpdate:modelValue":w=>w&&t.unref(h)(q,w)},null,8,["name","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,dC)):(t.openBlock(),t.createElementBlock("td",{key:1,title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${q.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(x)(q)||t.unref(R)(q),items:t.unref(Uc)(((oe=q.dbAttrs[0])==null?void 0:oe.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(d),"label-provider":t.unref(ll),"model-value":((Me=q.dbAttrs[0])==null?void 0:Me.dataType)??"","onUpdate:modelValue":w=>w&&t.unref(F)(q,{dataType:w})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,uC)),t.createElementVNode("td",{title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${q.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(x)(q)||t.unref(R)(q),"model-value":(ze=q.dbAttrs[0])==null?void 0:ze.length,"onUpdate:modelValue":w=>t.unref(F)(q,{length:w||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,mC),t.createElementVNode("td",{class:"c-constraints",title:t.unref(R)(q)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",pC,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${q.modelId}`,label:"PK","model-value":q.identifier,disabled:t.unref(a)||t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(z)(q,w)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${q.modelId}`,label:"NN","model-value":t.unref(r)?!1:q.notNull,disabled:t.unref(r)||t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(_)(q,{notNull:w})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${q.modelId}`,label:"UQ","model-value":!!((Ct=q.dbAttrs[0])!=null&&Ct.unique),disabled:t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(F)(q,{unique:w})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,fC),t.createElementVNode("td",{class:"c-del",title:t.unref(O)(q)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeAttribute(t.unref(i).modelId,q.modelId)},null,8,["onClick"])],8,hC)],2),t.unref(g)(q)?(t.openBlock(),t.createElementBlock("tr",yC,[Be[8]||(Be[8]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",gC,"↳ "+t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("td",{colspan:"7",title:t.unref(o).t("em.attr.derivedIdNote")},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-assocname-${q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(v)(q),"onUpdate:modelValue":w=>t.unref(y)(q,w)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,bC)])):t.createCommentVNode("",!0),ft(q.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(l).has(q.modelId)}])},[Be[14]||(Be[14]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",_C,[t.createElementVNode("div",kC,[t.createElementVNode("fieldset",EC,[Be[12]||(Be[12]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(G)(q)},[Be[9]||(Be[9]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${q.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(x)(q)||t.unref(R)(q)||!t.unref(H)(q),"model-value":(Tt=q.dbAttrs[0])==null?void 0:Tt.scale,"onUpdate:modelValue":w=>t.unref(F)(q,{scale:w||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,NC),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${q.modelId}`,label:"Auto Increment","model-value":!!((Ue=q.dbAttrs[0])!=null&&Ue.autoIncrement),disabled:t.unref(x)(q)||t.unref(R)(q)||!q.identifier,"onUpdate:modelValue":w=>t.unref(F)(q,{autoIncrement:w})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",wC,[Be[10]||(Be[10]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${q.modelId}`,width:"110px",disabled:t.unref(x)(q),"model-value":t.unref(Q)(q.dbAttrs[0]),items:t.unref(Ye),"value-provider":t.unref(d),"label-provider":t.unref(it),"onUpdate:modelValue":w=>w&&t.unref(je)(q,w)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",IC,[Be[11]||(Be[11]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${q.modelId}`,width:"110px",disabled:t.unref(x)(q),"model-value":t.unref(Oe)(q.dbAttrs[0]),items:t.unref(Te),"value-provider":t.unref(d),"label-provider":t.unref(De),"onUpdate:modelValue":w=>w&&t.unref(Ne)(q,w)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",vC,[Be[13]||(Be[13]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${q.modelId}`,label:"@Transient","model-value":!!q.transient,disabled:q.identifier||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(T)(q,w)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${q.modelId}`,label:"@NaturalId","model-value":!!q.naturalId,disabled:q.identifier||t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(B)(q,w)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${q.modelId}`,label:"mutable","model-value":!!q.naturalIdMutable,disabled:t.unref(x)(q)||!q.naturalId,"onUpdate:modelValue":w=>t.unref(_)(q,{naturalIdMutable:w||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${q.modelId}`,label:"Multi-Value (Set)","model-value":!!((M=q.dbAttrs[0])!=null&&M.multiValue),disabled:t.unref(x)(q)||t.unref(R)(q),"onUpdate:modelValue":w=>t.unref(F)(q,{multiValue:w||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(R)(q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",CC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",SC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(le)(q),items:t.unref(s),"value-provider":t.unref(d),"label-provider":t.unref(c),"onUpdate:modelValue":w=>w&&t.unref(se)(q,w)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(Pe).length?(t.openBlock(),t.createElementBlock("label",xC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Kp,{"model-value":q.groupCode,items:t.unref(Pe),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":w=>t.unref(V)(q,w)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",RC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(Ae)(q).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":q.defaultValue??"none",items:t.unref(de)(q),"value-provider":t.unref(ge),"label-provider":t.unref(_e),"onUpdate:modelValue":w=>w&&t.unref(L)(q,w)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`aw-default-${q.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":q.defaultValue??"","onUpdate:modelValue":w=>t.unref(j)(q,w)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",AC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`aw-desc-${q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":q.description,"onUpdate:modelValue":w=>t.unref(ee)(q,w)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",rS,[t.createElementVNode("td",lS,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,Yv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-472632d9"]]);function Js(e,n){return n&&n!==e?`${e} (${n})`:e}function qp(e,n,o){const i=e.dbAttrs[n];return i?bi(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function dS(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):Js(o,qp(e,0,n))}function Xs(e,n){var l;if(ao(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?Js(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return Js(i,qp(o,r<0?0:r,n))}function Wp(e){const n=[];for(const o of e.entity.attributes??[]){const i=o.dbAttrs.filter(a=>!a.sharedColumnRef);if(i.length!==0){if(o.dbAttrs.length===1){n.push({ref:o.modelId,label:dS(o,e)});continue}for(const a of i)n.push({ref:a.modelId,label:Xs(a.modelId,e)})}}return n}const uS=["disabled"],mS={class:"em-idxw__list"},fS={class:"em-idxw__list-head"},pS=["aria-label"],hS=["aria-current","onClick","onKeydown"],yS={class:"em-idxw__item-name"},gS={key:0,class:"em-idxw__badge"},bS={class:"em-idxw__item-cnt"},_S={key:0,class:"em-idxw__empty"},kS={key:0,class:"em-idxw__edit"},ES={class:"em-idxw__form"},NS={class:"em-field em-idxw__name"},wS={class:"em-field"},IS=["value","placeholder"],vS={class:"em-idxw__transfer"},CS={class:"em-idxw__pane"},SS={class:"em-idxw__pane-head"},xS=["aria-label"],RS=["aria-pressed","onClick","onKeydown"],AS=["title"],$S={key:0,class:"em-idxw__empty"},TS={class:"em-idxw__arrows"},MS={class:"em-idxw__pane"},VS={class:"em-idxw__pane-head"},LS={class:"em-idxw__col-name"},BS=["title"],DS={class:"em-idxw__col-ops"},OS=["title","disabled","onClick"],PS=["title","disabled","onClick"],zS=["title","onClick"],FS={key:0,class:"em-idxw__empty"},US={key:1,class:"em-idxw__edit em-idxw__edit--empty"},HS=Qe(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(R=>R.modelId===n.entityId)??null),a=t.computed(()=>{var R;return((R=i.value)==null?void 0:R.indexes)??[]}),r=t.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,R=>{var N;R.some(I=>I.modelId===s.value)||(s.value=((N=R[0])==null?void 0:N.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(R=>R.modelId===s.value)??null),d=t.computed(()=>i.value?gi(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>io(r.value)),m=R=>u.value.canon(R),p=t.computed(()=>{var R;return new Set((((R=c.value)==null?void 0:R.columns)??[]).map(N=>m(N.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function h(R){return R.physicalName&&R.physicalName!==R.field?`${R.field} (${R.physicalName})`:R.field}function _(R){return Xs(R,f.value)}const g=t.computed(()=>[...Wp(f.value).filter(R=>!p.value.has(m(R.ref))).map(R=>({ref:R.ref,label:R.label,inherited:!1})),...d.value.filter(R=>!p.value.has(m(R.modelId))).map(R=>({ref:R.modelId,label:h(R),inherited:!0}))]),k=t.ref(new Set);t.watch(s,()=>k.value=new Set);function E(R){return ao(R)}function b(R,N){i.value&&o.updateIndex(i.value.modelId,R,N)}function v(){var N;if(!i.value)return;const R=Le();o.addIndex(i.value.modelId,{modelId:R,name:`idx_${(((N=i.value.indexes)==null?void 0:N.length)??0)+1}`,unique:!1,columns:[]}),s.value=R}function y(R){i.value&&o.removeIndex(i.value.modelId,R)}function S(R){c.value&&b(c.value.modelId,{parameters:R.trim()===""?void 0:R})}function $(R){const N=new Set(k.value);N.has(R)?N.delete(R):N.add(R),k.value=N}function O(){const R=c.value;if(!R||!k.value.size)return;const N=[...k.value].map(I=>({columnRef:I,descending:!1}));b(R.modelId,{columns:[...R.columns,...N]}),k.value=new Set}function B(R){const N=c.value;N&&b(N.modelId,{columns:N.columns.filter((I,C)=>C!==R)})}function z(R,N){const I=c.value;I&&b(I.modelId,{columns:I.columns.map((C,U)=>U===R?{...C,descending:N}:C)})}function T(R,N){const I=c.value;if(!I)return;const C=R+N;if(C<0||C>=I.columns.length)return;const U=[...I.columns];[U[R],U[C]]=[U[C],U[R]],b(I.modelId,{columns:U}),x(C,N)}async function x(R,N){var P,F;await t.nextTick();const I=(P=l.value)==null?void 0:P.querySelectorAll(".em-idxw__col--idx")[R];if(!I)return;const C=H=>I.querySelector(`[data-move="${H}"]`),U=C(N<0?"up":"down"),A=C(N<0?"down":"up");(F=U&&!U.disabled?U:A)==null||F.focus()}return(R,N)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",mS,[t.createElementVNode("div",fS,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:v},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":I.modelId===s.value}]),role:"button",tabindex:"0","aria-current":I.modelId===s.value?"true":void 0,onClick:C=>s.value=I.modelId,onKeydown:[t.withKeys(t.withModifiers(C=>s.value=I.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(C=>s.value=I.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",yS,t.toDisplayString(I.name||t.unref(o).t("em.attr.nameless")),1),I.unique?(t.openBlock(),t.createElementBlock("span",gS,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",bS,t.toDisplayString(I.columns.length),1)],42,hS))),128))],8,pS),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",_S,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",kS,[t.createElementVNode("div",ES,[t.createElementVNode("label",NS,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":N[0]||(N[0]=I=>b(c.value.modelId,{name:I}))},null,8,["model-value"]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":N[1]||(N[1]=I=>b(c.value.modelId,{unique:I}))},null,8,["model-value"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:N[2]||(N[2]=I=>y(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",wS,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:N[3]||(N[3]=I=>S(I.target.value))},null,40,IS)]),t.createElementVNode("div",vS,[t.createElementVNode("div",CS,[t.createElementVNode("div",SS,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:g.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:g.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":k.value.has(I.ref)}]),role:"button",tabindex:"0","aria-pressed":k.value.has(I.ref),onClick:C=>$(I.ref),onKeydown:[t.withKeys(t.withModifiers(C=>$(I.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(C=>$(I.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(I.label),1),I.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,AS)):t.createCommentVNode("",!0)],42,RS))),128))],8,xS),g.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",$S,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",TS,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!k.value.size,onClick:O},null,8,["caption","disabled"])]),t.createElementVNode("div",MS,[t.createElementVNode("div",VS,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(I,C)=>(t.openBlock(),t.createElementBlock("li",{key:C,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",LS,[t.createTextVNode(t.toDisplayString(_(I.columnRef)),1),E(I.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,BS)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${C}`,class:"em-check",label:"DESC","model-value":I.descending,"onUpdate:modelValue":U=>z(C,U)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",DS,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:C===0,onClick:U=>T(C,-1)},"↑",8,OS),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:C===c.value.columns.length-1,onClick:U=>T(C,1)},"↓",8,PS),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:U=>B(C)},"✕",8,zS)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",FS,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",US,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,uS)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-76dd7610"]]),jS={class:"em-op-src"},KS=["placeholder"],GS={class:"em-op-src__actions"},Jp=Qe(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(l,s)=>rn(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",jS,[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,KS),[[t.vModelText,a.value]]),t.createElementVNode("div",GS,[t.createVNode(t.unref(te.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),YS=["disabled"],qS={class:"em-ow__toolbar"},WS={class:"em-ow__count"},JS={class:"em-ow__scroll"},XS={class:"em-ow__table"},ZS={class:"c-name"},QS={class:"c-desc"},ex=["id"],tx={class:"c-pii"},nx={class:"c-src"},ox={class:"c-del"},ix={key:0},ax={colspan:"6",class:"em-ow__empty"},rx=Qe(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModal(),a=t.computed(()=>o.state.logical.entities.find(g=>g.modelId===n.entityId)??null),r=t.computed(()=>{var g;return[...((g=a.value)==null?void 0:g.operations)??[]].sort((k,E)=>k.order-E.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(g){return g==="none"?o.t("em.common.noneParen"):g}const u=g=>g;function m(g,k){a.value&&o.updateOperation(a.value.modelId,g.modelId,k)}function p(g,k){m(g,{description:Object.keys(k).length?k:void 0})}function f(g){return g.personalInfoAttributeType??"none"}function h(g,k){m(g,{personalInfoAttributeType:k==="none"?void 0:k})}function _(g){i.openModal({component:Jp,bind:{operationName:g.name,sourceCode:g.sourceCode??"",locale:o.uiLocale.value,onSave:k=>m(g,{sourceCode:k})}})}return(g,k)=>{var E,b;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",qS,[t.createElementVNode("span",WS,t.toDisplayString(t.unref(o).t("em.op.section",{n:((E=a.value.operations)==null?void 0:E.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:k[0]||(k[0]=v=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",JS,[t.createElementVNode("table",XS,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",ZS,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),k[2]||(k[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",QS,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,ex),t.createVNode(Gp,{modelValue:l.value,"onUpdate:modelValue":k[1]||(k[1]=v=>l.value=v),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",tx,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",nx,t.toDisplayString(t.unref(o).t("em.op.body")),1),k[3]||(k[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,v=>(t.openBlock(),t.createElementBlock("tr",{key:v.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`ow-name-${v.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":v.name,"onUpdate:modelValue":y=>m(v,{name:y})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":v.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":y=>y&&m(v,{visibility:y})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(Jt,{name:`ow-desc-${v.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":v.description,"onUpdate:modelValue":y=>p(v,y)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":f(v),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":y=>y&&h(v,y)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t(v.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:y=>_(v)},null,8,["caption","onClick"])]),t.createElementVNode("td",ox,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:y=>t.unref(o).removeOperation(a.value.modelId,v.modelId)},null,8,["onClick"])])]))),128)),(b=a.value.operations)!=null&&b.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",ix,[t.createElementVNode("td",ax,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,YS)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),lx={class:"em-detail__tabs"},sx=["onClick"],cx={key:0,class:"em-detail__lock"},dx=["disabled"],ux={key:0,class:"em-detail__narrow"},mx=Qe(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",lx,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:p=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,sx)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",cx,[t.createVNode(xe,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",ux,[t.createVNode(Pp,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(cS,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(HS,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(rx,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,dx)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Ar(e,n,o){e.openModal({component:mx,bind:{controller:t.markRaw(n),entityId:o}})}function fx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Le(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},p={...n.logical,associations:[...n.logical.associations,m]},f=Ii(p,s,Le),h=f.add[0];h&&(m.end2.attributeRef=h.modelId);const _={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(h==null?void 0:h.modelId)??d},g=Fa(m,_),k=Ka(p,s,f,[]);return i(k.length?ot("관계 추가",[g,...k]):g),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(S=>S.modelId===l),d=n.logical.entities.find(S=>S.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Le(),m=Le(),p=Le(),f=Yt(c.attributes),h=tm(d),_=S=>S&&S.charAt(0).toLowerCase()+S.slice(1),g=new Set(c.attributes.map(S=>S.name)),k=_(d.name);let E=k;for(let S=2;g.has(E);S++)E=`${k}${S}`;const b={modelId:m,name:E,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:h,embedded:{associationRef:u,embeddableRef:s}},v={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},y={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(ot("임베드 추가",[qt(l,b),Fa(v,y)])),u},setEmbedCardinality(l,s){var k;if(r(l))return;const c=n.logical.associations.find(E=>E.modelId===l);if(!c)return;let d,u;for(const E of n.logical.entities){const b=E.attributes.find(v=>{var y;return((y=v.embedded)==null?void 0:y.associationRef)===l&&v.attrType==="EMBED_OWN"});if(b){d=E.modelId,u=b;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,p=c.end2.entityRef===m?"end2":"end1",f=c[p];if(f.multiplicity===s)return;const h=E=>E==="ZERO_OR_MORE_INSTANCES"||E==="ONE_OR_MORE_INSTANCES",_=h(f.multiplicity),g=h(s);if(_===g){i(en(l,p,{multiplicity:s}));return}if(g)i(ot("임베드 컬렉션 전환",[Qt(d,u.modelId,{dbAttrs:[]}),en(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((k=f.jpa)==null?void 0:k.collectionType)??"LIST"}})]));else{const E=n.logical.entities.find(b=>b.modelId===m);if(!E)return;i(ot("임베드 단일 전환",[Qt(d,u.modelId,{dbAttrs:tm(E)}),en(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=vu(l);if(!s){i(c);return}for(const f of n.logical.entities){const h=f.attributes.find(_=>{var g;return((g=_.embedded)==null?void 0:g.associationRef)===l});if(h){const _=[];i(ot("임베드 삭제",[c,...fn(f.modelId,[h.modelId],_),...Wt(n.logical,_)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=Ga(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(_=>_.modelId===s.end1.entityRef),h=f==null?void 0:f.attributes.find(_=>_.modelId===s.end1.attributeRef&&_.attrType==="RELATION_REF");h&&p.push(...fn(f.modelId,[h.modelId],m))}p.push(...Wt(n.logical,m)),i(p.length?ot("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(h=>h.modelId===l),d=Ua(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(h=>h.modelId===l?{...h,identifying:s}:h)},p=[],f=Ga(m,[u],p);f.push(...Wt(n.logical,p)),i(f.length?ot("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=om(n.logical,l,c.navigable===!0);if(u){const m=en(l,"end1",{...c,...u.endPatch}),p=u.endPatch.attributeRef?[...u.cmds,m]:[...u.cmds,m];i(p.length>1?ot(c.navigable===!0?"inverse nav 추가":"inverse nav 제거",p):m);return}}i(en(l,s,c))}}}function px(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,predefinedCustomTypeCatalog:l,t:s,emitGateNotice:c,selection:d}=e,u=(m,p,f)=>{if(a(m))return;const h=Qt(m,p,f),_=Eo(n.logical,m,E=>E.map(b=>b.modelId===p?{...b,...f}:b)),g=[],k=Xo(_,m,g);k.push(...Wt(n.logical,g)),i(k.length?ot("속성 수정",[h,...k]):h)};return{addPredefinedEmbed(m,p){if(!o.value||a(m))return null;const f=r.value.find(b=>b.type===p),h=n.logical.entities.find(b=>b.modelId===m);if(!f||!h)return null;const _=Yt(h.attributes),g=Le(),k=f.fields.map(()=>({modelId:Le(),physicalName:"",dataType:""})),E={modelId:g,name:f.defaultName,type:f.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:_,dbAttrs:k};return i(qt(m,E)),g},convertAttributeType(m,p,f){if(!o.value||a(m))return null;const h=n.logical.entities.find(N=>N.modelId===m),_=h==null?void 0:h.attributes.find(N=>N.modelId===p);if(!h||!_||_.attrType!=="NORMAL"&&_.attrType!=="EMBED_PREDEF"||_.groupCode||!f||f===_.type||po(n.logical,m,p))return null;const g=r.value.find(N=>N.type===f),k=g?void 0:l.value.find(N=>N.type===f),E=g?g.fields.length:1,b=_.dbAttrs.length===E;if(g&&_.identifier&&!b)return c(s("em.attr.embedConvertPkBlocked")),null;const v=Array.from({length:E},(N,I)=>{const C=b?{..._.dbAttrs[I]}:{modelId:Le(),physicalName:g?"":_.name,dataType:""};return k?Jc(C,k):C}),{customType:y,...S}=_,$=Le(),O={...S,modelId:$,type:f,attrType:g?"EMBED_PREDEF":"NORMAL",identifier:_.identifier,dbAttrs:v};f===dn&&y!==void 0&&(O.customType=y);const B=[],z=fn(m,[p],B),T=Eo(n.logical,m,N=>N.filter(I=>I.modelId!==p)),x=new Map;if(b){for(const N of v)x.set(N.modelId,N.modelId);x.set(p,v.length===1?v[0].modelId:$)}const R=[...Xo(T,m,B),...Wt(n.logical,B,x),...Zl(n.logical,m,[p])];return i(ot("속성 타입 전환",[...z,...R,qt(m,O)])),$},addSerializedTypeAttribute(m,p){if(!o.value||a(m))return null;const f=n.logical.entities.find(E=>E.modelId===m),h=n.logical.entities.find(E=>E.modelId===p);if(!f||!h||!cn(h.stereotype)||!h.name)return null;const _=h.name.charAt(0).toLowerCase()+h.name.slice(1),g=uo(_,new Set(f.attributes.map(E=>E.name))),k=Le();return i(qt(m,{modelId:k,name:g,type:h.name,attrType:"NORMAL",identifier:!1,notNull:!1,order:Yt(f.attributes),dbAttrs:[{modelId:Le(),physicalName:g,dataType:"CLOB"}]})),k},addAttribute(m,p={}){if(!o.value||a(m))return null;const f=n.logical.entities.find(S=>S.modelId===m),h=f?Yt(f.attributes):0,_=p.modelId??Le(),g=p.name??`field${h}`,k={modelId:_,name:g,type:p.type??dl,attrType:p.attrType??"NORMAL",identifier:p.identifier??!1,notNull:p.notNull??!1,order:h,dbAttrs:p.dbAttrs??(f&&cn(f.stereotype)?[]:[{modelId:Le(),physicalName:g,dataType:"VARCHAR"}]),...p},E=qt(m,k),b=Eo(n.logical,m,S=>[...S,k]),v=[],y=Xo(b,m,v);return y.push(...Wt(n.logical,v)),i(y.length?ot("속성 추가",[E,...y]):E),_},addDivider(m){if(!o.value||a(m))return null;const p=n.logical.entities.find(g=>g.modelId===m),f=p?Yt(p.attributes):0,h=Le();return i(qt(m,{modelId:h,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:f,dbAttrs:[]})),h},updateAttribute(m,p,f){u(m,p,f)},setAttributeGroupCode(m,p,f){u(m,p,{groupCode:f,type:f?jn:dl})},setEmbedColumns(m,p,f){var b,v;if(a(m))return;const h=Qt(m,p,{dbAttrs:f}),_=(b=n.logical.entities.find(y=>y.modelId===m))==null?void 0:b.attributes.find(y=>y.modelId===p),g=(v=_==null?void 0:_.embedded)==null?void 0:v.associationRef,k=g?n.logical.associations.find(y=>y.modelId===g):void 0,E=[];k&&g&&(k.end1.legacyEmbedRaw&&E.push(en(g,"end1",{legacyEmbedRaw:void 0})),k.end2.legacyEmbedRaw&&E.push(en(g,"end2",{legacyEmbedRaw:void 0}))),i(E.length?ot("임베드 컬럼 수정",[h,...E]):h)},removeAttribute(m,p){if(a(m))return;if(po(n.logical,m,p)){c(s("em.attr.fkDeleteHint"));return}const f=[],h=fn(m,[p],f),_=Eo(n.logical,m,E=>E.filter(b=>b.modelId!==p)),g=[...Xo(_,m,f),...Wt(n.logical,f),...Zl(n.logical,m,[p])],k=[...h,...g];i(k.length===1?k[0]:ot("속성 삭제",k))},removeAttributes(m,p){var b;if(!p.length||a(m))return;const f=p.filter(v=>!po(n.logical,m,v));if(f.length<p.length&&c(s("em.attr.fkDeleteHint")),!f.length)return;const h=[],_=fn(m,f,h),g=new Set(f),k=Eo(n.logical,m,v=>v.filter(y=>!g.has(y.modelId))),E=[..._,...Xo(k,m,h),...Wt(n.logical,h),...Zl(n.logical,m,f)];i(E.length===1?E[0]:ot("속성 삭제",E)),((b=d.value)==null?void 0:b.kind)==="attribute"&&d.value.entityId===m&&(d.value=null)},setAttributeSwatch(m,p,f){i(Oa(m,p,f))},setAttributeSwatches(m,p,f){p.length&&(p.length===1?i(Oa(m,p[0],f)):i(ot("속성 색상",p.map(h=>Oa(m,h,f)))))},reorderAttributes(m,p,f){if(!p.length||a(m))return;const h=Jl(m,p,f),_=g_(n.logical,m,p,f);i(_.length?ot("속성 재정렬",[h,..._]):h)}}}function hx(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Le(),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=Le();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Le()}for(const a of n.indexes??[]){a.modelId=Le();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Le();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const yx=220;function gx(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||yx));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 Zs=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function bx(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const _=c.filter(g=>n.logical.entities.some(k=>k.modelId===g));if(_.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:_}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const _=n.logical.entities.find(k=>k.modelId===d.entityId);if(!_)return;const g=[..._.attributes].sort((k,E)=>k.order-E.order).filter(k=>d.ids.includes(k.modelId));if(!g.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:g}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(_=>_.modelId===u),p=n.layout.entityLayouts.find(_=>_.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let h;if(p){const{entityRef:_,geo:g,locked:k,...E}=p;Object.keys(E).length&&(h=E)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:h}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const h=n.logical.entities.find(v=>v.modelId===f);if(!h)return[];const _=new Set(h.attributes.map(v=>v.name)),g=new Set(h.attributes.flatMap(v=>v.dbAttrs.map(y=>y.physicalName))),k=Yt(h.attributes),E=[],b=c.attributes.map((v,y)=>{const S=JSON.parse(JSON.stringify(v));S.modelId=Le();for(const $ of S.dbAttrs)$.modelId=Le();_.has(S.name)&&(S.name=uo(`${S.name}_copy`,_)),_.add(S.name);for(const $ of S.dbAttrs)$.physicalName&&g.has($.physicalName)&&($.physicalName=uo(`${$.physicalName}_copy`,g)),$.physicalName&&g.add($.physicalName);return S.order=k+y,E.push(S.modelId),qt(f,S)});return l(b.length===1?b[0]:ot("속성 붙여넣기",b)),i.value={kind:"attribute",entityId:f,ids:E,anchor:E[E.length-1]},[]}const{clone:d,idMap:u}=hx(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let p;if(c.layoutExtras){const f={...c.layoutExtras},h=_=>u.get(_);f.attributeStyles&&(f.attributeStyles=Ma(f.attributeStyles,h)),f.operationStyles&&(f.operationStyles=Ma(f.operationStyles,h)),p=f}return l(Ba(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Jd(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const p=(u==null?void 0:u.placement)??"append-right",f=p==="append-right"?gx(n.layout,m.layout):p.offset,h=new Map(m.layout.entityLayouts.map(b=>[b.entityRef,b])),_=new Map(m.layout.associationLayouts.map(b=>[b.associationRef,b])),g=new Map(m.layout.groupLayouts.map(b=>[b.groupRef,b])),k=[];let E=80;for(const b of m.logical.entities){const v=h.get(b.modelId),y=v?{location:Zs(v.geo.location,f),size:{...v.geo.size}}:{location:{x:E+=40,y:80},size:{width:220,height:140}};let S;if(v){const{entityRef:$,geo:O,locked:B,...z}=v;S=z}k.push(Ba(b,y,S))}for(const b of m.logical.associations){const v=_.get(b.modelId),y=v?{...v,waypoints:v.waypoints.map(S=>Zs(S,f))}:{associationRef:b.modelId,waypoints:[]};k.push(Fa(b,y))}for(const b of m.logical.groups){const v=g.get(b.modelId),y=v?{location:Zs(v.geo.location,f),size:{...v.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let S;if(v){const{groupRef:$,geo:O,locked:B,memberNoteRefs:z,...T}=v;S=T}k.push(Pa(b,y,S))}return l(ot("다이어그램 가져오기",k)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(b=>b.modelId)}};return s}function _x(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l,t:s,emitGateNotice:c}=e;return{addEntity(d="NewEntity",u={x:80,y:80}){if(!o.value)return null;const m=Le(),p={modelId:m,name:d,stereotype:"JPA_ENTITY",table:{physicalName:d.toLowerCase()},attributes:[{modelId:Le(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Le(),physicalName:"id",dataType:"BIGINT"}]}]};return i(Ba(p,{location:{...u},size:{width:220,height:140}})),m},renameEntity(d,u){a(d)||i(ru(d,u))},updateEntity(d,u){if(a(d))return;const m=Da(d,u),p=n.logical.entities.find(E=>E.modelId===d),f=p==null?void 0:p.stereotype,h=u.stereotype,_=!!h&&!!p&&!!f&&at(h)&&!at(f),g=!!h&&!!p&&!!f&&!at(h)&&at(f);if(!!h&&!!p&&!!f&&h!==f&&at(h)&&at(f)&&p){const E=n.logical.entities.filter(v=>v.attributes.some(y=>{var S;return((S=y.embedded)==null?void 0:S.embeddableRef)===d}));if(E.length>0){c(s("em.entity.valueTypeSwitchEmbedded",{name:p.name,owners:E.length}));return}const b=em(p,h);i(b.length?ot("직렬화 타입 변환",[m,...b]):m);return}if(h==="SERIALIZED_TYPE"&&p){const E=n.logical.associations.filter(b=>b.end1.entityRef===d||b.end2.entityRef===d);if(E.length>0){c(s("em.entity.serializedTypeHasRelations",{name:p.name,count:E.length}));return}}if(_&&p&&h){const E=im(n.logical,d,h),b=[m,...E];i(b.length>1?ot(h==="SERIALIZED_TYPE"?"직렬화 타입 변환":"임베더블 변환",b):m);return}if(g){const E=nm(n.logical,d),b=[m,...E];i(b.length>1?ot("엔터티 전환",b):m);return}i(m)},moveEntity(d,u){a(d)||i(Jo(d,u))},resizeEntity(d,u){a(d)||i(lu(d,u))},removeEntity(d){if(a(d))return;const u=au(d);if(!n.logical.entities.find(E=>E.modelId===d)){i(u);return}const p=n.logical.associations.filter(E=>E.end1.entityRef===d||E.end2.entityRef===d),f=new Set(p.map(E=>E.modelId)),h=[],_=[];for(const E of n.logical.entities)if(E.modelId!==d)for(const b of E.attributes)b.embedded&&f.has(b.embedded.associationRef)&&h.push(...fn(E.modelId,[b.modelId],_));for(const E of p){if(E.end1.entityRef===d||!E.end1.attributeRef)continue;const b=n.logical.entities.find(y=>y.modelId===E.end1.entityRef),v=b==null?void 0:b.attributes.find(y=>y.modelId===E.end1.attributeRef&&y.attrType==="RELATION_REF");v&&h.push(...fn(b.modelId,[v.modelId],_))}const g={...n.logical,entities:n.logical.entities.filter(E=>E.modelId!==d),associations:n.logical.associations.filter(E=>!f.has(E.modelId))},k=new Set(p.filter(E=>E.end1.entityRef===d&&E.end2.entityRef!==d).map(E=>E.end2.entityRef));h.push(...Ga(g,[...k],_)),h.push(...Wt(n.logical,_.filter(E=>E.entityId!==d))),i(h.length?ot("엔티티 삭제",[u,...h]):u)},setEntitySwatch(d,u){i(su(d,u))},setEntityCollapsed(d,u){i(cu(d,u))},setEntityLocked(d,u){i(du(d,u))},isEntityLocked(d){return r(d)},isAssociationLocked(d){return l(d)},collapseAll(){i(Wl(!0))},expandAll(){i(Wl(!1))}}}function kx(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(k=>n.layout.entityLayouts.find(E=>E.entityRef===k)).filter(k=>!!k);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,h=-1/0;for(const k of u){const E=k.geo.size.width||220,b=k.geo.size.height||140;m=Math.min(m,k.geo.location.x),p=Math.min(p,k.geo.location.y),f=Math.max(f,k.geo.location.x+E),h=Math.max(h,k.geo.location.y+b)}const _=40,g=28;return{location:{x:m-_,y:p-_-g},size:{width:f-m+_*2,height:h-p+_*2+g}}}return{dragGroup(d,u,m){l(d)||i(ot("그룹 이동",am(n,d,u,m)))},resizeGroup(d,u){l(d)||i(hu(d,u))},setGroupSwatch(d,u){i(yu(d,u))},setGroupLocked(d,u){i(gu(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(uu(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const h of n.logical.groups)for(const _ of d)h.memberEntityRefs.includes(_)&&m.push(za(h.modelId,_));const p=Le(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(Pa(f,c(d))),i(ot("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Le();return i(Pa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(mu(d))},dropEntity(d,u,m){var h;if(r(d))return;const p=((h=n.logical.groups.find(_=>_.memberEntityRefs.includes(d)))==null?void 0:h.modelId)??null,f=[Jo(d,u)];p!==m&&(p&&f.push(za(p,d)),m&&f.push(fu(m,d))),i(ot("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(za(u.modelId,d))},dropNote(d,u,m){var h;const p=((h=n.layout.groupLayouts.find(_=>{var g;return(g=_.memberNoteRefs)==null?void 0:g.includes(d)}))==null?void 0:h.groupRef)??null,f=[$i(d,u)];p!==m&&(p&&f.push(Pu(p,d)),m&&f.push(Ou(m,d))),i(ot("이동",f))}}}function Ex(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(_,g){if(d(),!o.value||!e.opTransport)return;const k=new Yu({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:E=>{i.value=!1,a.value=E},onError:e.onOpError});k.seed((g==null?void 0:g.revSeed)??{}),c=k.attach(_),s=k}const m=t.computed(()=>o.value&&r!==void 0),p=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function h(_){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let g;try{g=await l(_)}catch(k){return{ok:!1,reason:k instanceof Error?k.message:String(k)}}return g.ok&&p.value++,g}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:h,reloadRequest:p}}function Nx(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Le();return o(Mu({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(Vu(i))},moveNote(i,a){o($i(i,a))},resizeNote(i,a){o(Lu(i,a))},setNoteMemo(i,a){o(Bu(i,a))},setNoteSwatch(i,a){o(Du(i,a))},addNoteConnection(i,a){o(zu(i,a))},removeNoteConnection(i,a){o(Fu(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Uu(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Hu(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(ju(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Ku(i,a))}}}function wx(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const v=p.ids.includes(u),y=v?p.ids.filter($=>$!==u):[...p.ids,u];if(!y.length){o.value=null;return}const S=v&&p.anchor===u?y[y.length-1]:v?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:y,anchor:S};return}const h=n.logical.entities.find(v=>v.modelId===d),_=[...(h==null?void 0:h.attributes)??[]].sort((v,y)=>v.order-y.order).map(v=>v.modelId),g=_.indexOf(p.anchor),k=_.indexOf(u);if(g<0||k<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[E,b]=g<=k?[g,k]:[k,g];o.value={kind:"attribute",entityId:d,ids:_.slice(E,b+1),anchor:p.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(_=>_.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(_=>_.modelId===u.anchor);if(p<0)return!1;const f=Math.min(Math.max(p+d,0),m.attributes.length-1);if(f===p)return!0;const h=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[h],anchor:h},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(v=>v.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),h=p.map((v,y)=>f.has(v.modelId)?y:-1).filter(v=>v>=0);if(!h.length)return!1;const _=Math.min(...h),g=p.filter(v=>!f.has(v.modelId)),k=p.slice(0,_).filter(v=>!f.has(v.modelId)).length;let E;if(d<0){if(k<=0)return!0;E=k-1}else{if(g.length-k<=0)return!0;E=k+1}if(r(u.entityId))return!0;const b=p.filter(v=>f.has(v.modelId)).map(v=>v.modelId);return a(Jl(u.entityId,b,E)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(E=>E.modelId)),f=new Set(n.logical.groups.map(E=>E.modelId)),h=new Set(n.layout.notes.map(E=>E.modelId)),_=new Set;for(const E of d){if(!f.has(E))continue;const b=n.logical.groups.find(v=>v.modelId===E);for(const v of(b==null?void 0:b.memberEntityRefs)??[])_.add(v)}const g=[],k=[];for(const E of d)if(f.has(E)){if(s(E))continue;const b=n.layout.groupLayouts.find($=>$.groupRef===E);if(!b)continue;const v=n.logical.groups.find($=>$.modelId===E),y=((v==null?void 0:v.memberEntityRefs)??[]).map($=>{var B;const O=((B=n.layout.entityLayouts.find(z=>z.entityRef===$))==null?void 0:B.geo.location)??{x:0,y:0};return{id:$,location:{x:O.x+u,y:O.y+m}}}),S={x:b.geo.location.x+u,y:b.geo.location.y+m};g.push(ot("그룹 이동",am(n,E,S,y))),k.push("g:"+E)}else if(p.has(E)){if(_.has(E)||l(E))continue;const b=n.layout.entityLayouts.find(v=>v.entityRef===E);if(!b)continue;g.push(Jo(E,{x:b.geo.location.x+u,y:b.geo.location.y+m})),k.push("e:"+E)}else if(h.has(E)){const b=n.layout.notes.find(v=>v.modelId===E);if(!b)continue;g.push($i(E,{x:b.geo.location.x+u,y:b.geo.location.y+m})),k.push("n:"+E)}return g.length?(a(ot("이동",g,"nudge:"+k.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const eo=Symbol("editorController");function Xp(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Ix(e=Xp(),n={}){var Ne,Ye,it;const o=t.reactive(e);let i=new ql(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=(Q,ce)=>rn(u.value,Q,ce),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),h=t.ref(n.largeEntityThreshold),_=t.ref(n.flagEntitiesWithoutRelations??!1),g=t.ref(!1),k=t.ref(!1),E=t.ref(!1),b=t.ref(0),v=t.ref(null);let y=0;const S=Q=>{if(n.onNotice){n.onNotice(Q);return}v.value={text:Q,id:++y}},$=t.ref(((Ne=n.meta)==null?void 0:Ne.schemaVersion)??1),O=t.ref(((Ye=n.meta)==null?void 0:Ye.opWriteEnabled)??!1),B=t.ref(((it=n.meta)==null?void 0:it.referenceOnly)??!1),z=t.computed(()=>$.value>=2&&O.value),T=t.ref(!($.value>=2&&O.value===!1)),x=t.ref("LOGICAL_PHYSICAL"),R=t.ref("straight"),N=t.ref(!0),I=t.ref(!0),C=t.ref(null),U=t.computed(()=>{var Q;return((Q=C.value)==null?void 0:Q.kind)==="attribute"?{entityId:C.value.entityId,attrId:C.value.anchor}:null}),A=t.computed(()=>{var Q;return((Q=C.value)==null?void 0:Q.kind)==="attribute"?C.value.ids:[]}),P=t.computed(()=>{var Q,ce;return((Q=C.value)==null?void 0:Q.kind)==="entity"?C.value.id:((ce=C.value)==null?void 0:ce.kind)==="attribute"?C.value.entityId:null}),F=t.ref(null),H=t.ref(null),G=t.ref(null),le=t.ref(null),se=Ex({state:o,opMode:z,editable:T,opConflict:G,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function ue(){i.onChange(()=>{g.value=i.canUndo,k.value=i.canRedo,E.value=i.isDirty,b.value++})}ue(),se.setupOpAdapter(i,n.meta);const ye=t.computed(()=>Ac(o.logical,o.layout)),ae=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:h.value,flagEntitiesWithoutRelations:_.value,embeddableCatalog:a.value,superClassCatalog:s.value,predefinedCustomTypes:l.value})),Ie=()=>hl(o.logical,B.value),Pe=n.validationDebounceMs??250;let Ae,de=()=>{};if(Pe>0){const Q=t.shallowRef(xa(Ie(),ae.value));let ce;de=()=>{ce!==void 0&&(clearTimeout(ce),ce=void 0),Q.value=xa(Ie(),ae.value)},t.watch([b,ae,B],()=>{ce!==void 0&&clearTimeout(ce),ce=setTimeout(de,Pe)},{flush:"sync"}),Ae=t.computed(()=>Q.value)}else Ae=t.computed(()=>xa(Ie(),ae.value));const ge=t.computed(()=>{const Q=new Map;for(const ce of Ae.value){if(!ce.targetRef)continue;const je=Q.get(ce.targetRef);je?je.push(ce):Q.set(ce.targetRef,[ce])}return Q}),_e=1500,V=new Map,L=Q=>{const ce=Date.now();ce-(V.get(Q)??0)<_e||(V.set(Q,ce),S(Q))},j=Q=>{if(!le.value){if(!T.value){L(m("em.notice.readOnly"));return}try{i.execute(Q)}catch(ce){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${Q.label}):`,ce),T.value=!1,le.value={label:Q.label}}}},ee=Q=>o.layout.entityLayouts.some(ce=>ce.entityRef===Q&&!!ce.locked),Z=Q=>o.layout.groupLayouts.some(ce=>ce.groupRef===Q&&!!ce.locked),pe=Q=>{const ce=o.logical.associations.find(je=>je.modelId===Q);return!!ce&&(ee(ce.end1.entityRef)||ee(ce.end2.entityRef))},me=Q=>ee(Q)?(L(m("em.notice.entityLocked")),!0):!1,ve=Q=>Z(Q)?(L(m("em.notice.groupLocked")),!0):!1,Ee=Q=>pe(Q)?(L(m("em.notice.assocLocked")),!0):!1,W=bx({state:o,clipboard:H,selection:C,inspectedEntityId:P,editable:T,run:j}),J=wx({state:o,selection:C,focusRequest:F,run:j,gateEntityLocked:me,isEntityLockedFn:ee,isGroupLockedFn:Z}),X=_x({state:o,editable:T,run:j,gateEntityLocked:me,isEntityLockedFn:ee,isAssocLockedFn:pe,t:m,emitGateNotice:L}),he=px({state:o,editable:T,run:j,gateEntityLocked:me,embeddableCatalog:a,predefinedCustomTypeCatalog:l,t:m,emitGateNotice:L,selection:C}),Te=kx({state:o,editable:T,run:j,selection:C,gateEntityLocked:me,gateGroupLocked:ve,isGroupLockedFn:Z}),De=Nx({editable:T,run:j}),Oe=fx({state:o,editable:T,run:j,gateEntityLocked:me,gateAssocLocked:Ee});return{state:o,resolved:ye,issues:Ae,issuesByRef:ge,flagEntitiesWithoutRelations:_,canUndo:g,canRedo:k,dirty:E,revision:b,notice:v,editable:T,schemaVersion:$,opWriteEnabled:O,opMode:z,opConflict:G,commandFailure:le,historyTransport:se.historyTransport,historyAvailable:se.historyAvailable,restoreTransport:se.restoreTransport,restoreAvailable:se.restoreAvailable,restoreToSeq:se.restoreToSeq,reloadRequest:se.reloadRequest,displayMode:x,routingMode:R,showGrid:N,showMinimap:I,selection:C,selectedAttr:U,selectedAttrIds:A,inspectedEntityId:P,focusRequest:F,clipboard:H,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:B,uiLocale:u,t:m,selectableDataTypes:f,setEditable(Q){T.value=Q&&z.value},setEmbeddableCatalog(Q){a.value=Q},setGroupCodeCatalog(Q){r.value=Q},setPredefinedCustomTypeCatalog(Q){l.value=Q},setSuperClassCatalog(Q){s.value=Q},selectAttribute:J.selectAttribute,moveAttributeFocus:J.moveAttributeFocus,nudgeSelectedAttributes:J.nudgeSelectedAttributes,nudgeNodes:J.nudgeNodes,requestFocus:J.requestFocus,deleteSelection(){if(!T.value)return!1;const Q=C.value;if(!Q)return!1;if(Q.kind==="attribute"){if(me(Q.entityId))return!1;const ce=Q.ids;if(!ce.length)return!1;ce.length===1?he.removeAttribute(Q.entityId,ce[0]):he.removeAttributes(Q.entityId,ce)}else if(Q.kind==="entity"){if(me(Q.id))return!1;X.removeEntity(Q.id)}else if(Q.kind==="note")De.removeNote(Q.id);else if(Q.kind==="group"){if(ve(Q.id))return!1;Te.removeGroup(Q.id)}else Oe.removeAssociation(Q.id);return C.value=null,!0},undo:()=>{T.value&&i.undo()},redo:()=>{T.value&&i.redo()},markSaved:()=>{T.value&&(se.flush(),i.markSavePoint())},loadDiagram(Q,ce){se.teardownOpAdapter(),o.logical=Q.logical,o.layout=Q.layout,i=new ql(o),ue(),$.value=(ce==null?void 0:ce.schemaVersion)??1,O.value=(ce==null?void 0:ce.opWriteEnabled)??!1,B.value=(ce==null?void 0:ce.referenceOnly)??!1,T.value=!($.value>=2&&O.value===!1),G.value=null,le.value=null,C.value=null,g.value=i.canUndo,k.value=i.canRedo,E.value=i.isDirty,se.setupOpAdapter(i,ce),de()},flush:se.flush,whenOpsSettled:se.whenOpsSettled,addEntity:X.addEntity,renameEntity:X.renameEntity,updateEntity:X.updateEntity,moveEntity:X.moveEntity,resizeEntity:X.resizeEntity,removeEntity:X.removeEntity,setEntitySwatch:X.setEntitySwatch,setEntityCollapsed:X.setEntityCollapsed,setEntityLocked:X.setEntityLocked,isEntityLocked:X.isEntityLocked,isAssociationLocked:X.isAssociationLocked,collapseAll:X.collapseAll,expandAll:X.expandAll,setAttributeSwatch:he.setAttributeSwatch,dragGroup:Te.dragGroup,resizeGroup:Te.resizeGroup,setGroupSwatch:Te.setGroupSwatch,setGroupLocked:Te.setGroupLocked,isGroupLocked:Te.isGroupLocked,updateGroup:Te.updateGroup,createGroup:Te.createGroup,addEmptyGroup:Te.addEmptyGroup,removeGroup:Te.removeGroup,dropEntity:Te.dropEntity,ungroupEntity:Te.ungroupEntity,dropNote:Te.dropNote,addPredefinedEmbed:he.addPredefinedEmbed,convertAttributeType:he.convertAttributeType,addSerializedTypeAttribute:he.addSerializedTypeAttribute,addAttribute:he.addAttribute,addDivider:he.addDivider,updateAttribute:he.updateAttribute,setAttributeGroupCode:he.setAttributeGroupCode,setEmbedColumns:he.setEmbedColumns,removeAttribute:he.removeAttribute,removeAttributes:he.removeAttributes,setAttributeSwatches:he.setAttributeSwatches,reorderAttributes:he.reorderAttributes,addIndex(Q,ce){me(Q)||j(Cu(Q,ce))},updateIndex(Q,ce,je){me(Q)||j(Ha(Q,ce,je))},removeIndex(Q,ce){me(Q)||j(Su(Q,ce))},addOperation(Q,ce={}){if(!T.value||me(Q))return null;const je=o.logical.entities.find(st=>st.modelId===Q),lt=je!=null&&je.operations?Yt(je.operations):0,Xe=ce.modelId??Le(),_t={modelId:Xe,name:ce.name??`method${lt}`,visibility:ce.visibility??"PACKAGE",order:lt,...ce};return j(ku(Q,_t)),Xe},updateOperation(Q,ce,je){me(Q)||j(Eu(Q,ce,je))},removeOperation(Q,ce){me(Q)||j(Nu(Q,ce))},reorderOperations(Q,ce,je){!ce.length||me(Q)||j(wu(Q,ce,je))},setOperationSwatch(Q,ce,je){j(Iu(Q,ce,je))},addAssociation:Oe.addAssociation,addEmbedAssociation:Oe.addEmbedAssociation,setEmbedCardinality:Oe.setEmbedCardinality,removeAssociation:Oe.removeAssociation,setAssociationIdentifying:Oe.setAssociationIdentifying,updateAssociationEnd:Oe.updateAssociationEnd,hasQuickFix(Q){if(!T.value)return!1;const ce=xl(Q,o.logical);return ce?ce.kind==="setEndCascades"?!pe(ce.assocRef):!ee(ce.entityRef):!1},applyQuickFix(Q){if(!T.value)return!1;const ce=xl(Q,o.logical);if(!ce)return!1;if(ce.kind==="setIndexColumns")return me(ce.entityRef)?!1:(j(Ha(ce.entityRef,ce.indexRef,{columns:ce.columns})),!0);if(Ee(ce.assocRef))return!1;const je=o.logical.associations.find(lt=>lt.modelId===ce.assocRef);return je?(j(en(ce.assocRef,ce.which,{jpa:{...je[ce.which].jpa,cascadeTypes:ce.cascades}})),!0):!1},moveWaypoint(Q,ce,je){j(xu(Q,ce,je))},addWaypoint(Q,ce,je){j(Tu(Q,ce,je))},removeWaypoint(Q,ce){j(Ru(Q,ce))},clearWaypoints(Q){j($u(Q))},addNote:De.addNote,removeNote:De.removeNote,moveNote:De.moveNote,resizeNote:De.resizeNote,setNoteMemo:De.setNoteMemo,setNoteSwatch:De.setNoteSwatch,addNoteConnection:De.addNoteConnection,removeNoteConnection:De.removeNoteConnection,moveNoteConnectionWaypoint:De.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:De.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:De.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:De.clearNoteConnectionWaypoints,autoLayout(){const Q=$c(o.logical,o.layout);Q.length&&j(ot("자동 배치",Q.map(ce=>Jo(ce.id,ce.location))))},copy:W.copy,paste:W.paste,importEntities:W.importEntities}}const $r=Symbol("groupHover"),Zp=Symbol("groupDrag"),Lo=Symbol("relationHighlight"),Qp=Symbol("diffOverlay"),eh=Symbol("nodeInternals"),th=Symbol("columnResolution");function vx(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function nh(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!vx(e[o],n[o]))return!1;return!0}function Cx(e,n){const o=e,i=n;for(const a of Object.keys(o))if(o[a]!==i[a])return!1;return!0}function oh(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!nh(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function Sx(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function xx(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!Sx(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!oh(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!nh(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!!Rx(e.classRows,n.classRows)}function Rx(e,n){if(e===n)return!0;if(!e||!n||e.length!==n.length)return!1;for(let o=0;o<e.length;o++){const i=e[o],a=n[o];if(i.synthetic!==a.synthetic||i.sourceAttrId!==a.sourceAttrId||i.targetName!==a.targetName||i.collection!==a.collection||i.attr!==a.attr&&!oh(i.attr,a.attr))return!1}return!0}function Ax(){let e;return(n,o)=>e=$x(n,o,e)}function $x(e,n,o){const i=e.entities,a=new Map,r={embeddableCatalog:n};let l=null;const s=()=>l??(l=new Map(i.map(c=>[c.modelId,c])));for(const c of i){const d=new Map,u=new Map,m=new Map;let p=null;const f=()=>p??(p=lo(vn(c,i)));for(const b of c.attributes){if(fa(b)){const S=b.dbAttrs[0],$=S&&Bt(b,S,0,c,e);S&&$&&!Cx($,S)&&d.set(b.modelId,{...b,dbAttrs:[$,...b.dbAttrs.slice(1)]})}if(b.identifier&&b.attrType==="RELATION_OWN"){const S=po(e,c.modelId,b.modelId);if(S&&$a(b,S)){const $=d.get(b.modelId)??b,O=b.derivedIdFieldName||Tl({...b,derivedIdFieldName:void 0},S,s());O&&d.set(b.modelId,{...$,derivedIdFieldName:O})}}const v=Ei(b,e.associations);if(v&&m.set(b.modelId,v),Nn(b)){u.set(b.modelId,b.dbAttrs.map((S,$)=>Bt(b,S,$,c,e)));continue}if(!b.attrType.startsWith("EMBED")||b.dbAttrs.length===0||b.attrType==="EMBED_PREDEF"&&!(n!=null&&n.some(S=>S.type===b.type)))continue;const y=f();u.set(b.modelId,b.dbAttrs.map((S,$)=>{const O=Bt(b,S,$,c,e,r),B=so(O,y);return B?{...O,physicalName:B.physicalName}:O}))}const h=new Map,_=new Map;for(const b of c.attributes){const v=u.get(b.modelId);if(v)for(let y=0;y<v.length;y++){const S=`${b.attrType}\0${b.type??""}\0${y}`,$={attrId:b.modelId,slot:y,name:v[y].physicalName??""},O=_.get(S);O?O.push($):_.set(S,[$])}}for(const b of _.values()){if(b.length<2)continue;const v=new Map;for(const y of b)v.set(y.name,(v.get(y.name)??0)+1);for(const y of b){if((v.get(y.name)??0)<2)continue;const S=h.get(y.attrId);S?S.add(y.slot):h.set(y.attrId,new Set([y.slot]))}}const g=Ml(c,e).fields.map(b=>{var v;return{attr:b.attr,synthetic:b.synthetic,sourceAttrId:b.sourceAttr.modelId,targetName:(v=b.target)==null?void 0:v.name,collection:b.collection}}),k={effectiveAttrs:d,embedCols:u,collectionTypes:m,redundantSlots:h,classRows:g},E=o==null?void 0:o.get(c.modelId);a.set(c.modelId,E&&xx(k,E)?E:k)}return a}const ih=Symbol("embedSlotCollapse"),ah=(e,n)=>`${e}:${n}`,rh="all:",lh="one:",sh="fk:",ch=e=>`${rh}${e}`,Tx=(e,n)=>`${lh}${e}:${n}`,Mx=(e,n)=>`${sh}${e}:${n}`,Vx=e=>e.startsWith(sh)||!e.startsWith(rh)&&!e.startsWith(lh),Lx=["title"],Bx={key:0,class:"em-sel","aria-hidden":"true"},Dx=["title","aria-expanded","disabled"],Ox={class:"em-entity__stereotype"},Px={key:2,class:"em-entity__name"},zx=["title","aria-expanded"],Fx={"aria-hidden":"true"},Ux=["data-attr","title","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Hx=["onPointerdown"],jx={key:1,class:"em-entity__divider-label"},Kx=["title"],Gx={class:"em-key-slot"},Yx={class:"em-key-slot"},qx=["title","aria-expanded","onClick"],Wx=["title","onClick"],Jx=["title","aria-expanded","onClick"],Xx={key:2,class:"em-entity__type"},Zx=["onClick"],Qx={class:"em-entity__attrname"},eR={class:"em-entity__type"},tR={key:1,class:"em-entity__embed-summary"},nR=["title"],oR=["data-op"],iR=["onPointerdown"],aR={class:"em-entity__op-vis","aria-hidden":"true"},rR=["title"],lR={key:4,class:"em-entity__footer"},dh=Qe(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(eo,null),i=(D,Y)=>o?o.t(D,Y):rn("ko",D,Y),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=te.useModal();function l(){o&&Ar(r,o,n.id)}const s=t.inject($r,null),c=t.inject(Lo,null),d=t.inject(Qp,null),u=t.computed(()=>{var D;return((D=d==null?void 0:d.marks.value)==null?void 0:D.get(n.id))??null}),m=t.inject(th,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(ih,void 0),h=t.inject(eh,null);t.onUpdated(()=>h==null?void 0:h.mark(n.id));const _=t.computed(()=>!!o&&o.editable.value);function g(){s&&(s.value=n.data.groupRef??null)}function k(){c==null||c.setEntityHover(n.id)}function E(){c==null||c.setEntityHover(null)}const b=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),v=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!b.value),y=t.computed(()=>{var D;return((D=o==null?void 0:o.selection.value)==null?void 0:D.kind)==="entity"&&o.selection.value.id===n.id}),S=t.computed(()=>!!n.selected&&!y.value),$=t.computed(()=>{var D;return o&&((D=o.selectedAttr.value)==null?void 0:D.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),O=t.computed(()=>$.value.size>0);function B(D,Y){const we=Y.shiftKey?"range":Y.metaKey||Y.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,U(D),we)}const z=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!y.value),T=t.computed(()=>n.data.entity),x=t.computed(()=>ag(T.value,o==null?void 0:o.referenceOnlyDocument.value)),R=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),N=t.computed(()=>{var D;if(R.value==="CLASS"){const Y=(D=p.value)==null?void 0:D.classRows;if(Y)return Y.map(we=>we.attr)}return[...T.value.attributes].sort((Y,we)=>Y.order-we.order)}),I=t.computed(()=>{var Y;const D=R.value==="CLASS"?(Y=p.value)==null?void 0:Y.classRows:void 0;return new Set((D??[]).filter(we=>we.synthetic).map(we=>we.attr.modelId))});function C(D){return I.value.has(D.modelId)}function U(D){return F.value.get(D.modelId)??D.modelId}function A(D){return $.value.has(U(D))}function P(D){var Y;return!!((Y=u.value)!=null&&Y.changedAttributeIds.has(U(D)))}const F=t.computed(()=>{var Y;const D=new Map;if(R.value!=="CLASS")return D;for(const we of((Y=p.value)==null?void 0:Y.classRows)??[])we.synthetic&&D.set(we.attr.modelId,we.sourceAttrId);return D}),H=t.computed(()=>{var we;const D=new Map,Y=R.value==="CLASS";for(const Re of((we=p.value)==null?void 0:we.classRows)??[])!Y&&!Nn(Re.attr)||(Re.targetName||Re.collection)&&D.set(Re.attr.modelId,{targetName:Re.targetName,collection:Re.collection});return D}),G=t.computed(()=>n.data.collapsed??!1),le=t.computed(()=>n.data.locked??!1),se=t.computed(()=>_.value&&!le.value);function ue(){_.value&&(o==null||o.setEntityCollapsed(n.id,!G.value))}const ye=t.computed(()=>!G.value&&N.value.some(D=>!he(D))),ae=[{id:"e-left",pos:$e.Left},{id:"e-right",pos:$e.Right}],Ie=t.computed(()=>R.value==="PHYSICAL"||R.value==="LOGICAL_PHYSICAL"),Pe=t.computed(()=>{var we;const D=R.value==="PHYSICAL"||R.value==="LOGICAL_PHYSICAL",Y={};for(const Re of N.value){const re=Re.attrType.startsWith("RELATION")&&Re.dbAttrs.length>0,Ge=cn(((we=T.value)==null?void 0:we.stereotype)??"UNDEFINED");Y[Re.modelId]={pk:Re.identifier,fk:re&&D,required:!Ge&&Re.notNull&&!Re.identifier}}return Y});function Ae(D){if(!D)return"";const Y=[];return D.pk&&D.fk?Y.push(i("em.node.keyPfk")):D.pk?Y.push(i("em.node.keyPk")):D.fk&&Y.push(i("em.node.keyFk")),D.required&&Y.push(i("em.node.required")),Y.join(" · ")}const de=t.computed(()=>{const D=Gs(Vt(n.data.style)),Y={};return D&&(Y["--em-header-bg"]=D.bar,Y["--em-header-fg"]=D.barOn),Y});function ge(D){var Y,we;return(we=Gs(Vt((Y=n.data.attributeStyles)==null?void 0:Y[D.modelId])))==null?void 0:we.text}const _e=t.computed(()=>[...T.value.operations??[]].sort((D,Y)=>D.order-Y.order)),V=t.computed(()=>R.value==="CLASS"&&_e.value.length>0),L={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function j(D){return D?L[D]:"~"}function ee(D){var Y,we;return(we=Gs(Vt((Y=n.data.operationStyles)==null?void 0:Y[D.modelId])))==null?void 0:we.text}function Z(D,Y,we){switch(R.value){case"CLASS":return[{text:D}];case"PHYSICAL":return[{text:we||D}];case"LOGICAL":return[Y?{text:Y}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const Re=Y?{text:Y}:{text:i("em.node.logicalMissing"),missing:!0};return we?[Re,{text:` · ${we}`}]:[Re]}}}function pe(D){var Y;return((Y=p.value)==null?void 0:Y.effectiveAttrs.get(D.modelId))??D}function me(D){var Re;if(J(D))return[{text:D.name}];const Y=pe(D),we=Fo(Y,Y.dbAttrs[0]);return Z(ve(D),we==null?void 0:we[a.value],((Re=Y.dbAttrs[0])==null?void 0:Re.physicalName)??"")}function ve(D){return R.value==="CLASS"?D.name:pe(D).derivedIdFieldName||D.name}function Ee(D){return D.attrType.startsWith("EMBED")&&D.dbAttrs.length>0}const W=Nn;function J(D){return Ee(D)||W(D)}function X(D){return W(D)?Mx(n.id,D.modelId):Tx(n.id,D.modelId)}function he(D){return D.attrType==="DIVIDER"}function Te(D){var Y;return((Y=p.value)==null?void 0:Y.embedCols.get(D.modelId))??D.dbAttrs}function De(D){var Y;return(Y=p.value)==null?void 0:Y.redundantSlots.get(D.modelId)}const Oe=t.computed(()=>(f==null?void 0:f.isCollapsed(ch(n.id)))??!1),ie=t.computed(()=>Oe.value&&Ie.value?N.value.reduce((D,Y)=>J(Y)?D+Te(Y).length:D,0):0),Ne=t.computed(()=>N.value.some(D=>J(D)));function Ye(D){const Y=De(D);return!Y||Y.size===0?!1:f?f.isCollapsed(ah(n.id,D.modelId)):!1}function it(D){var Y;return Ye(D)?((Y=De(D))==null?void 0:Y.size)??0:0}function Q(D){return f?f.isCollapsed(X(D)):!1}function ce(D){var Y;return!Ie.value||Oe.value?null:Q(D)?"attr":(((Y=De(D))==null?void 0:Y.size)??0)>0?"slot":null}function je(D){return!Oe.value&&J(D)}function lt(D){return Q(D)?Te(D).length:0}function Xe(D){if(Oe.value||Q(D))return[];const Y=Te(D);if(!Ye(D))return Y;const we=De(D);return Y.filter((Re,re)=>!we.has(re))}function _t(D){f==null||f.toggle(ah(n.id,D.modelId))}function st(D){f==null||f.toggle(X(D))}function kt(){f==null||f.toggle(ch(n.id))}function Et(D){var Y;return Z(D.physicalName,(Y=D.logicalName)==null?void 0:Y[a.value],D.physicalName)}function On(D){var Ge;const Y=H.value.get(D.modelId),we=(Y==null?void 0:Y.collection)??((Ge=p.value)==null?void 0:Ge.collectionTypes.get(D.modelId)),Re=o?_i(D,Ho(o.state.logical),T.value,o.state.logical):void 0,re=(Re==null?void 0:Re.kind)==="resolved"?Re.entity:void 0;return fl(R.value,pe(D),we,Y==null?void 0:Y.targetName,re)}const En=t.computed(()=>{const D={};for(const Y of N.value)D[Y.modelId]=On(Y);return D}),Nt=t.computed(()=>{var D,Y;return Z(T.value.name,(D=In(T.value))==null?void 0:D[a.value],((Y=T.value.table)==null?void 0:Y.physicalName)??"")}),ft=t.ref(!1),ht=t.ref(""),St=t.ref(null);async function Pn(){var D,Y;se.value&&(ht.value=T.value.name,ft.value=!0,await t.nextTick(),(D=St.value)==null||D.focus(),(Y=St.value)==null||Y.select())}function ut(){if(!ft.value)return;ft.value=!1;const D=ht.value.trim();D&&D!==T.value.name&&(o==null||o.renameEntity(n.id,D))}function Be(){o==null||o.addAttribute(n.id)}function q(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:Gt,findNode:K}=tt(),oe=t.ref(null),Me=t.computed(()=>{const D=oe.value??n.data.size;return D?{width:`${D.width}px`,minHeight:`${D.height}px`}:void 0});let ze=null;function Ct(D){var Re,re,Ge;if(!se.value)return;D.stopPropagation();const Y=(Re=K(n.id))==null?void 0:Re.dimensions,we=Gt({x:D.clientX,y:D.clientY});ze={fx:we.x,fy:we.y,w:(Y==null?void 0:Y.width)??((re=n.data.size)==null?void 0:re.width)??200,h:(Y==null?void 0:Y.height)??((Ge=n.data.size)==null?void 0:Ge.height)??120},D.target.setPointerCapture(D.pointerId)}function Tt(D){if(!ze)return;const Y=Gt({x:D.clientX,y:D.clientY});oe.value={width:Math.max(40,ze.w+(Y.x-ze.fx)),height:Math.max(40,ze.h+(Y.y-ze.fy))}}function Ue(D){var Y,we,Re;if(ze&&oe.value&&o){const re=(Y=K(n.id))==null?void 0:Y.dimensions;o.resizeEntity(n.id,{width:Math.round((re==null?void 0:re.width)??oe.value.width),height:Math.round((re==null?void 0:re.height)??oe.value.height)})}ze=null,oe.value=null,(Re=(we=D.target).releasePointerCapture)==null||Re.call(we,D.pointerId)}const M=t.ref(null),w=t.ref(null);function ne(D,Y){if(!se.value)return;Y.stopPropagation(),Y.preventDefault();const we=$.value,Re=we.has(D.modelId)?new Set(we):new Set([D.modelId]);w.value={ids:Re,dropIndex:-1,lineY:0},Y.target.setPointerCapture(Y.pointerId)}function ke(D){if(!w.value||!M.value)return;const Y=Array.from(M.value.querySelectorAll(".em-entity__row"));if(!Y.length)return;let we=Y.length;for(let Ge=0;Ge<Y.length;Ge++){const ct=Y[Ge].getBoundingClientRect();if(D.clientY<ct.top+ct.height/2){we=Ge;break}}const Re=Y[Y.length-1],re=we<Y.length?Y[we].offsetTop:Re.offsetTop+Re.offsetHeight;w.value={...w.value,dropIndex:we,lineY:re}}function Ce(){const D=w.value;if(w.value=null,!D||D.dropIndex<0)return;const Y=N.value,we=Y.filter(Ze=>D.ids.has(Ze.modelId)).map(Ze=>Ze.modelId),Re=Y.filter((Ze,zo)=>D.ids.has(Ze.modelId)&&zo<D.dropIndex).length,re=D.dropIndex-Re,Ge=Y.filter(Ze=>!D.ids.has(Ze.modelId)).map(Ze=>Ze.modelId);[...Ge.slice(0,re),...we,...Ge.slice(re)].join(",")!==Y.map(Ze=>Ze.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,we,re))}function Ve(){w.value=null}const Ke=t.ref(null),He=t.ref(null);function fe(D,Y){se.value&&(Y.stopPropagation(),Y.preventDefault(),He.value={id:D.modelId,dropIndex:-1,lineY:0},Y.target.setPointerCapture(Y.pointerId))}function qe(D){if(!He.value||!Ke.value)return;const Y=Array.from(Ke.value.querySelectorAll(".em-entity__op-row"));if(!Y.length)return;let we=Y.length;for(let Ge=0;Ge<Y.length;Ge++){const ct=Y[Ge].getBoundingClientRect();if(D.clientY<ct.top+ct.height/2){we=Ge;break}}const Re=Y[Y.length-1],re=we<Y.length?Y[we].offsetTop:Re.offsetTop+Re.offsetHeight;He.value={...He.value,dropIndex:we,lineY:re}}function We(){const D=He.value;if(He.value=null,!D||D.dropIndex<0)return;const we=_e.value.findIndex(re=>re.modelId===D.id);if(we<0)return;const Re=D.dropIndex-(we<D.dropIndex?1:0);Re!==we&&(o==null||o.reorderOperations(n.id,[D.id],Re))}function Je(){He.value=null}return(D,Y)=>{var we,Re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":b.value,"is-related":v.value,"is-dimmed":z.value,"is-selected":y.value,"is-multi-selected":S.value,"has-focused-attr":O.value,"is-locked":le.value,"is-reference-only":x.value,"is-diff-added":((we=u.value)==null?void 0:we.verb)==="added","is-diff-modified":((Re=u.value)==null?void 0:Re.verb)==="modified"}]),tabindex:"-1",title:x.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(Me.value),onPointerdown:g,onMouseenter:k,onMouseleave:E,onDblclick:l},[y.value?(t.openBlock(),t.createElementBlock("div",Bx,[...Y[11]||(Y[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(de.value),onDblclick:t.withModifiers(Pn,["stop"])},[ye.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},t.renderList(ae,re=>t.createVNode(t.unref(Qn),{id:re.id,key:re.id,type:"source",position:re.pos,class:"em-handle em-handle--node",title:se.value?i("em.node.connectHintNode"):void 0},null,8,["id","position","title"])),64)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(G.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!G.value,disabled:!_.value,onClick:t.withModifiers(ue,["stop"]),onPointerdown:Y[0]||(Y[0]=t.withModifiers(()=>{},["stop"])),onDblclick:Y[1]||(Y[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(G.value?"▸":"▾"),41,Dx),t.createElementVNode("span",Ox,"«"+t.toDisplayString(t.unref(yi)(T.value.stereotype))+"»",1),ft.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"inputEl",ref:St,"onUpdate:modelValue":Y[2]||(Y[2]=re=>ht.value=re),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(ut,["enter"]),Y[3]||(Y[3]=t.withKeys(re=>ft.value=!1,["esc"]))],onBlur:ut,onPointerdown:Y[4]||(Y[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,ht.value]]):(t.openBlock(),t.createElementBlock("span",Px,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Nt.value,(re,Ge)=>(t.openBlock(),t.createElementBlock("span",{key:Ge,class:t.normalizeClass({"em-entity__missing":re.missing})},t.toDisplayString(re.text),3))),128))])),!G.value&&Ie.value&&Ne.value?(t.openBlock(),t.createElementBlock("button",{key:3,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:Oe.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!Oe.value,onClick:t.withModifiers(kt,["stop"]),onPointerdown:Y[5]||(Y[5]=t.withModifiers(()=>{},["stop"])),onDblclick:Y[6]||(Y[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(xe,{name:"table",size:11}),t.createElementVNode("span",Fx,t.toDisplayString(Oe.value?"▸":"▾"),1)],40,zx)):t.createCommentVNode("",!0),le.value?(t.openBlock(),t.createBlock(xe,{key:4,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:5,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),G.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:M,class:"em-entity__attrs"},[w.value&&w.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${w.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,re=>{var Ge,ct,Ze,zo,da;return t.openBlock(),t.createElementBlock(t.Fragment,{key:re.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":A(re),"is-dragging":(Ge=w.value)==null?void 0:Ge.ids.has(re.modelId),"is-embed":J(re),"is-divider":he(re),"has-embed-badge":!!ce(re),nodrag:he(re)&&se.value,"is-diff-changed":P(re),"is-synthetic":C(re)}]),"data-attr":re.modelId,title:C(re)?i("em.node.derivedIdRow"):void 0,onClick:t.withModifiers(yt=>B(re,yt),["stop"]),onPointerdown:yt=>he(re)?ne(re,yt):void 0,onPointermove:yt=>he(re)?ke(yt):void 0,onPointerup:yt=>he(re)?Ce():void 0,onPointercancel:yt=>he(re)?Ve():void 0},[se.value&&!he(re)&&!C(re)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:yt=>ne(re,yt),onPointermove:ke,onPointerup:Ce,onPointercancel:Ve,onClick:Y[7]||(Y[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Hx)):t.createCommentVNode("",!0),he(re)?(t.openBlock(),t.createElementBlock("span",jx,t.toDisplayString(re.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Qn),{id:`l:${re.modelId}`,type:"target",position:t.unref($e).Left,class:"em-handle",title:se.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:Ae(Pe.value[re.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",Gx,[(ct=Pe.value[re.modelId])!=null&&ct.pk?(t.openBlock(),t.createBlock(xe,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Ze=Pe.value[re.modelId])!=null&&Ze.required?(t.openBlock(),t.createBlock(xe,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",Yx,[Ie.value&&je(re)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:Q(re)?i("em.node.embedAttrShow",{count:lt(re)}):i("em.node.embedAttrHide"),"aria-expanded":!Q(re),onClick:t.withModifiers(yt=>st(re),["stop"]),onPointerdown:Y[8]||(Y[8]=t.withModifiers(()=>{},["stop"])),onDblclick:Y[9]||(Y[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(Q(re)?"▸":"▾"),41,qx)):J(re)?(t.openBlock(),t.createBlock(xe,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(zo=Pe.value[re.modelId])!=null&&zo.fk?(t.openBlock(),t.createBlock(xe,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,Kx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:ge(re)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me(re),(yt,zn)=>(t.openBlock(),t.createElementBlock("span",{key:zn,class:t.normalizeClass({"em-entity__missing":yt.missing})},t.toDisplayString(yt.text),3))),128))],4),ce(re)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:lt(re)}),onClick:t.withModifiers(yt=>st(re),["stop"])},"+"+t.toDisplayString(lt(re)),9,Wx)):ce(re)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:Ye(re)?i("em.node.embedRepeatedShow",{count:((da=De(re))==null?void 0:da.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!Ye(re),onClick:t.withModifiers(yt=>_t(re),["stop"])},t.toDisplayString(Ye(re)?`+${it(re)}`:"−"),9,Jx)):t.createCommentVNode("",!0),En.value[re.modelId]?(t.openBlock(),t.createElementBlock("span",Xx,t.toDisplayString(En.value[re.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Qn),{id:`r:${re.modelId}`,type:"source",position:t.unref($e).Right,class:"em-handle",title:se.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,Ux),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J(re)&&Ie.value?Xe(re):[],yt=>(t.openBlock(),t.createElementBlock("li",{key:`${re.modelId}:${yt.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":A(re)}]),onClick:t.withModifiers(zn=>B(re,zn),["stop"])},[Y[12]||(Y[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",Qx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Et(yt),(zn,et)=>(t.openBlock(),t.createElementBlock("span",{key:et,class:t.normalizeClass({"em-entity__missing":zn.missing})},t.toDisplayString(zn.text),3))),128))]),t.createElementVNode("span",eR,t.toDisplayString(yt.dataType),1)],10,Zx))),128))],64)}),128)),ie.value?(t.openBlock(),t.createElementBlock("li",tR,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(kt,["stop"])},[t.createVNode(xe,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:ie.value})),1)],8,nR)])):t.createCommentVNode("",!0)],512)),!G.value&&V.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ke,class:"em-entity__ops"},[He.value&&He.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${He.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,re=>{var Ge,ct;return t.openBlock(),t.createElementBlock("li",{key:re.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ge=He.value)==null?void 0:Ge.id)===re.modelId,"is-diff-changed":!!((ct=u.value)!=null&&ct.changedOperationIds.has(re.modelId))}]),"data-op":re.modelId},[se.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ze=>fe(re,Ze),onPointermove:qe,onPointerup:We,onPointercancel:Je,onClick:Y[10]||(Y[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,iR)):t.createCommentVNode("",!0),t.createElementVNode("span",aR,t.toDisplayString(j(re.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:ee(re)})},t.toDisplayString(re.name)+"()",5)],10,oR)}),128))],512)):_e.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:_e.value.length})},[t.createVNode(xe,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:_e.value.length})),1)],8,rR)):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("footer",lR,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Be},t.toDisplayString(i("em.node.addAttr")),1),Y[13]||(Y[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:q},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),se.value&&!ft.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:Ct,onPointermove:Tt,onPointerup:Ue},null,32)):t.createCommentVNode("",!0)],46,Lx)}}}),[["__scopeId","data-v-0224247e"]]),sR={key:0,class:"em-sel","aria-hidden":"true"},cR={class:"em-group__label"},dR={class:"em-group__name"},uR={key:0,class:"em-group__pkg"},mR={key:1,class:"em-group__flag"},uh=Qe(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(()=>Vt(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(eo,null),s=(T,x)=>l?l.t(T,x):rn("ko",T,x),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($r,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Lo,null);function h(){n.id&&(f==null||f.setGroupHover(n.id))}function _(){f==null||f.setGroupHover(null)}const g=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),k=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:E,findNode:b}=tt();let v=null,y=null;function S(T){var N;if(!n.id||!c.value)return;T.stopPropagation();const x=((N=b(n.id))==null?void 0:N.dimensions)??{width:400,height:300},R=E({x:T.clientX,y:T.clientY});v={fx:R.x,fy:R.y,w:x.width,h:x.height},T.target.setPointerCapture(T.pointerId)}function $(T){if(!v||!n.id)return;const x=E({x:T.clientX,y:T.clientY});y={width:Math.max(160,v.w+(x.x-v.fx)),height:Math.max(120,v.h+(x.y-v.fy))};const R=b(n.id);R&&(R.style={width:`${y.width}px`,height:`${y.height}px`})}function O(T){var x,R;v&&y&&n.id&&l&&l.resizeGroup(n.id,y),v=null,y=null,(R=(x=T.target).releasePointerCapture)==null||R.call(x,T.pointerId)}const B=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),z=t.computed(()=>{const T=o.value.name;return Mt(T,B.value)||o.value.packageName||s("em.group.fallback")});return(T,x)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":g.value,"is-dimmed":k.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:h,onMouseleave:_},[d.value?(t.openBlock(),t.createElementBlock("div",sR,[...x[0]||(x[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",cR,[t.createElementVNode("span",dR,t.toDisplayString(z.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",uR,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",mR,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(xe,{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:S,onPointermove:$,onPointerup:O},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-4fd27d62"]]),fR={key:0,class:"em-sel","aria-hidden":"true"},pR={key:2,class:"em-note__text"},mh=Qe(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(eo,null),i=t.inject($r,null),a=t.inject(Lo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>Vt(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const p=t.computed(()=>{var N;return((N=a==null?void 0:a.source.value)==null?void 0:N.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),h=t.computed(()=>{var N;return((N=o==null?void 0:o.selection.value)==null?void 0:N.kind)==="note"&&o.selection.value.id===n.id}),_=t.computed(()=>!!n.selected&&!h.value),g=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!h.value),k=[{id:"n-top",pos:$e.Top},{id:"n-right",pos:$e.Right},{id:"n-bottom",pos:$e.Bottom},{id:"n-left",pos:$e.Left}],E=t.ref(!1),b=t.ref(""),v=t.ref(null);async function y(){var N;l.value&&(b.value=r.value.memo,E.value=!0,await t.nextTick(),(N=v.value)==null||N.focus())}function S(){E.value&&(E.value=!1,b.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,b.value)))}const{screenToFlowCoordinate:$,findNode:O}=tt();let B=null,z=null;function T(N){var U;if(!l.value)return;N.stopPropagation();const I=((U=O(n.id))==null?void 0:U.dimensions)??r.value.geo.size,C=$({x:N.clientX,y:N.clientY});B={fx:C.x,fy:C.y,w:I.width,h:I.height},N.target.setPointerCapture(N.pointerId)}function x(N){if(!B)return;const I=$({x:N.clientX,y:N.clientY});z={width:Math.max(140,B.w+(I.x-B.fx)),height:Math.max(60,B.h+(I.y-B.fy))};const C=O(n.id);C&&(C.style={width:`${z.width}px`,height:`${z.height}px`})}function R(N){var I,C;B&&z&&o&&o.resizeNote(n.id,z),B=null,z=null,(C=(I=N.target).releasePointerCapture)==null||C.call(I,N.pointerId)}return(N,I)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":g.value,"is-selected":h.value,"is-multi-selected":_.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:y,onPointerdown:d,onMouseenter:u,onMouseleave:m},[h.value?(t.openBlock(),t.createElementBlock("div",fR,[...I[4]||(I[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),E.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:v,"onUpdate:modelValue":I[0]||(I[0]=C=>b.value=C),class:"em-note__edit nodrag",onBlur:S,onKeydown:I[1]||(I[1]=t.withKeys(C=>E.value=!1,["esc"])),onPointerdown:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,b.value]]):(t.openBlock(),t.createElementBlock("div",pR,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(k,C=>t.createVNode(t.unref(Qn),{id:C.id,key:C.id,type:"source",position:C.pos,class:"em-note-handle",onPointerdown:I[3]||(I[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!E.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:T,onPointermove:x,onPointerup:R},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Tr(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 di=.5;function fh(e,n,o,i,a,r){const l=Tr(n),s=Tr(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let p=e;const f=(g,k)=>{(Math.abs(g.x-p.x)>=di||Math.abs(g.y-p.y)>=di)&&(m.push({a:p,b:g,seg:k}),p=g)};f(c,0);let h=l.x!==0,_=c;for(let g=1;g<u.length;g++){const k=u[g],E=g<=o.length?g-1:o.length,b=Math.abs(k.x-_.x)<di,v=Math.abs(k.y-_.y)<di;b&&v||(b?(f(k,E),h=!1):v?(f(k,E),h=!0):h?(f({x:_.x,y:k.y},E),f(k,E),h=!0):(f({x:k.x,y:_.y},E),f(k,E),h=!1),_=k)}return f(i,o.length),m}function Qs(e,n,o,i,a,r=20){const l=fh(e,n,o,i,a,r);let s=`M ${Lt(e.x)},${Lt(e.y)}`;for(const c of l)s+=` L ${Lt(c.b.x)},${Lt(c.b.y)}`;return s}const hR=14;function ph(e,n,o,i,a,r=20){return fh(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=hR).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function Lt(e){return Math.round(e*100)/100}const yR=36;function gR(e,n,o=yR){const i=Math.max(e.x,n.x)+o;return`M ${Lt(e.x)},${Lt(e.y)} L ${Lt(i)},${Lt(e.y)} L ${Lt(i)},${Lt(n.y)} L ${Lt(n.x)},${Lt(n.y)}`}function ec(e,n,o){const i=[e,...n,o];let a=`M ${Lt(i[0].x)},${Lt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${Lt(i[r].x)},${Lt(i[r].y)}`;return a}function bR(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function hh(e,n){const o=bR(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<di&&Math.abs(l)<di)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 yh(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 gh(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 _R=20,kR=22,ER=7,NR=22,bh=31,_h=7,wR=20,kh=11,Eh=11,IR=bh+_h;function vR(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function CR(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Mr(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function Nh(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function Vr(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function wh(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Nh(e,n);return[Vr(o,a,r-Math.PI/2),Vr(o,a,r+Math.PI/2)]}function Ih(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 vh(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Mr(e,n,_R),[d,u]=wh(e,n,c,kR);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}),vR(o.multiplicity)){const m=Mr(e,n,bh);r.push({cx:m.x,cy:m.y,r:_h})}if(CR(o.multiplicity)){const m=Mr(e,n,ER),[p,f]=wh(e,n,m,NR);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Mr(e,n,wR),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Nh(e,n),m=Vr(d,kh/2,u-Math.PI/2),p=Vr(d,kh/2,u+Math.PI/2);l.push({points:[e,m,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=Ih(s,c,Eh,!0),u=Ih(s,c,Eh,!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 Ch=200,Sh=120,tc=24;function xh(e){var a,r;if(!e)return{x:0,y:0,width:Ch,height:Sh};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Ch,i=((r=e.dimensions)==null?void 0:r.height)||Sh;return{x:n.x,y:n.y,width:o,height:i}}function Rh(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function nc(e){const n=t.computed(()=>xh(e.sourceNode())),o=t.computed(()=>xh(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,h;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<tc){const _=(m+p)/2;m=_-tc/2,p=_+tc/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??Rh(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Rh(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?yh(n.value,d,r.value.x):hh(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?yh(o.value,d,l.value.x):hh(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 oc=Symbol("waypointController"),SR=["d"],xR=["d"],RR=["d"],AR=["x1","y1","x2","y2"],$R=["cx","cy","r"],TR=["x","y"],MR=["x","y"],VR=["cx","cy","onDblclick"],LR=["x","y","onPointerdown","onDblclick"],Ah=Qe(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=tt(),i=t.inject(oc),a=t.inject(eo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Zp,null),s=t.inject(Lo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var de;return((de=a==null?void 0:a.selection.value)==null?void 0:de.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 de=l==null?void 0:l.value;if(!de||!a)return null;const ge=a.resolved.value.entities,_e=L=>{var j;return(j=ge.find(ee=>ee.entity.modelId===L))==null?void 0:j.groupRef},V=n.data.association;return _e(V.end1.entityRef)===de.groupId&&_e(V.end2.entityRef)===de.groupId?{dx:de.dx,dy:de.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),h=t.ref({x:0,y:0}),_=t.computed(()=>{const de=m.value;return p.value.map((ge,_e)=>_e===f.value?h.value:de?{x:ge.x+de.dx,y:ge.y+de.dy}:ge)}),g=t.computed(()=>{var de;return!!((de=n.sourceNode.data)!=null&&de.collapsed)}),k=t.computed(()=>{var de;return!!((de=n.targetNode.data)!=null&&de.collapsed)}),{source:E,target:b,sourceSide:v,targetSide:y,isSelf:S}=nc({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>_.value,sourceRowY:()=>n.data.sourceColumnRef&&!g.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!k.value?n.targetY:void 0}),$=IR+4,O=t.computed(()=>S.value?gR(E.value,b.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Qs(E.value,v.value,_.value,b.value,y.value,$):ec(E.value,_.value,b.value)),B=t.computed(()=>S.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ph(E.value,v.value,_.value,b.value,y.value,$):gh(E.value,_.value,b.value).map((de,ge)=>({point:de,segIndex:ge}))),z=t.computed(()=>S.value||!r.value?[]:_.value),T=Ea;function x(de,ge){f.value=de,h.value={...p.value[de]},ge.target.setPointerCapture(ge.pointerId),ge.stopPropagation()}function R(de){if(f.value<0)return;const ge=o({x:de.clientX,y:de.clientY});h.value={x:ge.x,y:ge.y}}function N(de){var ge,_e;f.value>=0&&i&&i.movePoint(n.id,f.value,{...h.value}),f.value=-1,(_e=(ge=de.target).releasePointerCapture)==null||_e.call(ge,de.pointerId)}function I(de,ge){ge.stopPropagation(),i==null||i.removePoint(n.id,de)}function C(de,ge){if(!i)return;const _e=o({x:ge.clientX,y:ge.clientY});i.insertPoint(n.id,de,{x:_e.x,y:_e.y})}const U=t.computed(()=>T(n.data.association.end1.multiplicity)),A=t.computed(()=>T(n.data.association.end2.multiplicity)),P=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),F=t.computed(()=>P.value==="class"),H=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const de=Tr(v.value);return{x:E.value.x+de.x*10,y:E.value.y+de.y*10}}return _.value[0]??b.value}),G=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ge=Tr(y.value);return{x:b.value.x+ge.x*10,y:b.value.y+ge.y*10}}const de=_.value;return de[de.length-1]??E.value}),le=t.computed(()=>{const de=n.data.association;return{multiplicity:de.end1.multiplicity,navigable:de.end1.navigable,composition:de.end1.composition,otherNavigable:de.end2.navigable}}),se=t.computed(()=>{const de=n.data.association;return{multiplicity:de.end2.multiplicity,navigable:de.end2.navigable,composition:de.end2.composition,otherNavigable:de.end1.navigable}}),ue=t.computed(()=>vh(E.value,H.value,le.value,P.value)),ye=t.computed(()=>vh(b.value,G.value,se.value,P.value)),ae=t.computed(()=>[...ue.value.lines,...ye.value.lines]),Ie=t.computed(()=>[...ue.value.circles,...ye.value.circles]),Pe=t.computed(()=>[...ue.value.polygons,...ye.value.polygons].map(de=>`M${de.points.map(ge=>`${ge.x},${ge.y}`).join(" L")} Z`)),Ae=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(de,ge)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:O.value,fill:"none",class:"em-edge__hit"},null,8,SR),t.createElementVNode("path",{d:O.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,xR),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Pe.value,(_e,V)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${V}`,d:_e,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",Ae.value])},null,10,RR))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ae.value,(_e,V)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${V}`,x1:_e.x1,y1:_e.y1,x2:_e.x2,y2:_e.y2,class:t.normalizeClass(["em-edge__marker",Ae.value])},null,10,AR))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.value,(_e,V)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${V}`,cx:_e.cx,cy:_e.cy,r:_e.r,class:t.normalizeClass(["em-edge__marker",Ae.value])},null,10,$R))),128)),F.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(E).x+8,y:t.unref(E).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(U.value),11,TR),t.createElementVNode("text",{x:t.unref(b).x-8,y:t.unref(b).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(A.value),11,MR)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.value,(_e,V)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${V}`,cx:_e.point.x,cy:_e.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(L=>C(_e.segIndex,L),["stop"])},null,42,VR))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(z.value,(_e,V)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${V}`,x:_e.x-5,y:_e.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>x(V,L),onPointermove:R,onPointerup:N,onDblclick:L=>I(V,L)},null,42,LR))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var Vn=(e=>(e.Lines="lines",e.Dots="dots",e))(Vn||{});const $h=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]}`})},Th=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};Vn.Lines+"",Vn.Dots+"";const BR={[Vn.Dots]:"#81818a",[Vn.Lines]:"#eee"},DR=["id","x","y","width","height","patternTransform"],OR={key:2,height:"100",width:"100"},PR=["fill"],zR=["x","y","fill"],FR={name:"Background",compatConfig:{MODE:3}},UR=t.defineComponent({...FR,props:{id:{},variant:{default:()=>Vn.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}=tt(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||BR[e.variant||Vn.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(Vn).Lines?(t.openBlock(),t.createBlock(t.unref($h),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(Vn).Dots?(t.openBlock(),t.createBlock(t.unref(Th),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",OR,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,PR)])):t.createCommentVNode("",!0)])],8,DR)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,zR),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),HR={name:"ControlButton",compatConfig:{MODE:3}},jR=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},KR={type:"button",class:"vue-flow__controls-button"};function GR(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",KR,[t.renderSlot(e.$slots,"default")])}const Bo=jR(HR,[["render",GR]]),YR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},qR=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function WR(e,n){return t.openBlock(),t.createElementBlock("svg",YR,qR)}const JR={render:WR},XR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ZR=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function QR(e,n){return t.openBlock(),t.createElementBlock("svg",XR,ZR)}const eA={render:QR},tA={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},nA=[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 oA(e,n){return t.openBlock(),t.createElementBlock("svg",tA,nA)}const iA={render:oA},aA={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},rA=[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 lA(e,n){return t.openBlock(),t.createElementBlock("svg",aA,rA)}const sA={render:lA},cA={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dA=[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 uA(e,n){return t.openBlock(),t.createElementBlock("svg",cA,dA)}const mA={render:uA},fA={name:"Controls",compatConfig:{MODE:3}},pA=t.defineComponent({...fA,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Df.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}=tt(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),h=t.toRef(()=>d.value.zoom>=m.value);function _(){l(),n("zoomIn")}function g(){s(),n("zoomOut")}function k(){c(e.fitViewParams),n("fitView")}function E(){r(!p.value),n("interactionChange",!p.value)}return(b,v)=>(t.openBlock(),t.createBlock(t.unref(Lp),{class:"vue-flow__controls",position:b.position},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"top"),b.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(b.$slots,"control-zoom-in",{},()=>[t.createVNode(Bo,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(JR))))])]),_:3},8,["disabled"])]),t.renderSlot(b.$slots,"control-zoom-out",{},()=>[t.createVNode(Bo,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(eA))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),b.showFitView?t.renderSlot(b.$slots,"control-fit-view",{key:1},()=>[t.createVNode(Bo,{class:"vue-flow__controls-fitview",onClick:k},{default:t.withCtx(()=>[t.renderSlot(b.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(iA))))])]),_:3})]):t.createCommentVNode("",!0),b.showInteractive?t.renderSlot(b.$slots,"control-interactive",{key:2},()=>[b.showInteractive?(t.openBlock(),t.createBlock(Bo,{key:0,class:"vue-flow__controls-interactive",onClick:E},{default:t.withCtx(()=>[p.value?t.renderSlot(b.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(mA))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(b.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(sA))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(b.$slots,"default")]),_:3},8,["position"]))}});var hA={value:()=>{}};function ic(){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 Lr(o)}function Lr(e){this._=e}function yA(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}})}Lr.prototype=ic.prototype={constructor:Lr,on:function(e,n){var o=this._,i=yA(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=gA(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]=Mh(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Mh(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 Lr(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 gA(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Mh(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=hA,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ac="http://www.w3.org/1999/xhtml";const Vh={svg:"http://www.w3.org/2000/svg",xhtml:ac,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Br(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Vh.hasOwnProperty(n)?{space:Vh[n],local:e}:e}function bA(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ac&&n.documentElement.namespaceURI===ac?n.createElement(e):n.createElementNS(o,e)}}function _A(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Lh(e){var n=Br(e);return(n.local?_A:bA)(n)}function kA(){}function rc(e){return e==null?kA:function(){return this.querySelector(e)}}function EA(e){typeof e!="function"&&(e=rc(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 NA(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wA(){return[]}function Bh(e){return e==null?wA:function(){return this.querySelectorAll(e)}}function IA(e){return function(){return NA(e.apply(this,arguments))}}function vA(e){typeof e=="function"?e=IA(e):e=Bh(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 Dh(e){return function(){return this.matches(e)}}function Oh(e){return function(n){return n.matches(e)}}var CA=Array.prototype.find;function SA(e){return function(){return CA.call(this.children,e)}}function xA(){return this.firstElementChild}function RA(e){return this.select(e==null?xA:SA(typeof e=="function"?e:Oh(e)))}var AA=Array.prototype.filter;function $A(){return Array.from(this.children)}function TA(e){return function(){return AA.call(this.children,e)}}function MA(e){return this.selectAll(e==null?$A:TA(typeof e=="function"?e:Oh(e)))}function VA(e){typeof e!="function"&&(e=Dh(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 Ph(e){return new Array(e.length)}function LA(){return new Kt(this._enter||this._groups.map(Ph),this._parents)}function Dr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Dr.prototype={constructor:Dr,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 BA(e){return function(){return e}}function DA(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 Dr(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function OA(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new Dr(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function PA(e){return e.__data__}function zA(e,n){if(!arguments.length)return Array.from(this,PA);var o=n?OA:DA,i=this._parents,a=this._groups;typeof e!="function"&&(e=BA(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],p=m.length,f=FA(e.call(u,u&&u.__data__,d,i)),h=f.length,_=s[d]=new Array(h),g=l[d]=new Array(h),k=c[d]=new Array(p);o(u,m,_,g,k,f,n);for(var E=0,b=0,v,y;E<h;++E)if(v=_[E]){for(E>=b&&(b=E+1);!(y=g[b])&&++b<h;);v._next=y||null}}return l=new Kt(l,i),l._enter=s,l._exit=c,l}function FA(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function UA(){return new Kt(this._exit||this._groups.map(Ph),this._parents)}function HA(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 jA(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Kt(s,this._parents)}function KA(){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 GA(e){e||(e=YA);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Kt(a,this._parents).order()}function YA(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function qA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function WA(){return Array.from(this)}function JA(){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 XA(){let e=0;for(const n of this)++e;return e}function ZA(){return!this.node()}function QA(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 e$(e){return function(){this.removeAttribute(e)}}function t$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function n$(e,n){return function(){this.setAttribute(e,n)}}function o$(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function i$(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function a$(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function r$(e,n){var o=Br(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?t$:e$:typeof n=="function"?o.local?a$:i$:o.local?o$:n$)(o,n))}function zh(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function l$(e){return function(){this.style.removeProperty(e)}}function s$(e,n,o){return function(){this.style.setProperty(e,n,o)}}function c$(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function d$(e,n,o){return arguments.length>1?this.each((n==null?l$:typeof n=="function"?c$:s$)(e,n,o??"")):ui(this.node(),e)}function ui(e,n){return e.style.getPropertyValue(n)||zh(e).getComputedStyle(e,null).getPropertyValue(n)}function u$(e){return function(){delete this[e]}}function m$(e,n){return function(){this[e]=n}}function f$(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function p$(e,n){return arguments.length>1?this.each((n==null?u$:typeof n=="function"?f$:m$)(e,n)):this.node()[e]}function Fh(e){return e.trim().split(/^|\s+/)}function lc(e){return e.classList||new Uh(e)}function Uh(e){this._node=e,this._names=Fh(e.getAttribute("class")||"")}Uh.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 Hh(e,n){for(var o=lc(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function jh(e,n){for(var o=lc(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function h$(e){return function(){Hh(this,e)}}function y$(e){return function(){jh(this,e)}}function g$(e,n){return function(){(n.apply(this,arguments)?Hh:jh)(this,e)}}function b$(e,n){var o=Fh(e+"");if(arguments.length<2){for(var i=lc(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?g$:n?h$:y$)(o,n))}function _$(){this.textContent=""}function k$(e){return function(){this.textContent=e}}function E$(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function N$(e){return arguments.length?this.each(e==null?_$:(typeof e=="function"?E$:k$)(e)):this.node().textContent}function w$(){this.innerHTML=""}function I$(e){return function(){this.innerHTML=e}}function v$(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function C$(e){return arguments.length?this.each(e==null?w$:(typeof e=="function"?v$:I$)(e)):this.node().innerHTML}function S$(){this.nextSibling&&this.parentNode.appendChild(this)}function x$(){return this.each(S$)}function R$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function A$(){return this.each(R$)}function $$(e){var n=typeof e=="function"?e:Lh(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function T$(){return null}function M$(e,n){var o=typeof e=="function"?e:Lh(e),i=n==null?T$:typeof n=="function"?n:rc(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function V$(){var e=this.parentNode;e&&e.removeChild(this)}function L$(){return this.each(V$)}function B$(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function D$(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function O$(e){return this.select(e?D$:B$)}function P$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function z$(e){return function(n){e.call(this,n,this.__data__)}}function F$(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 U$(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 H$(e,n,o){return function(){var i=this.__on,a,r=z$(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 j$(e,n,o){var i=F$(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?H$:U$,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Kh(e,n,o){var i=zh(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 K$(e,n){return function(){return Kh(this,e,n)}}function G$(e,n){return function(){return Kh(this,e,n.apply(this,arguments))}}function Y$(e,n){return this.each((typeof n=="function"?G$:K$)(e,n))}function*q$(){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 Gh=[null];function Kt(e,n){this._groups=e,this._parents=n}function Zi(){return new Kt([[document.documentElement]],Gh)}function W$(){return this}Kt.prototype=Zi.prototype={constructor:Kt,select:EA,selectAll:vA,selectChild:RA,selectChildren:MA,filter:VA,data:zA,enter:LA,exit:UA,join:HA,merge:jA,selection:W$,order:KA,sort:GA,call:qA,nodes:WA,node:JA,size:XA,empty:ZA,each:QA,attr:r$,style:d$,property:p$,classed:b$,text:N$,html:C$,raise:x$,lower:A$,append:$$,insert:M$,remove:L$,clone:O$,datum:P$,on:j$,dispatch:Y$,[Symbol.iterator]:q$};function to(e){return typeof e=="string"?new Kt([[document.querySelector(e)]],[document.documentElement]):new Kt([[e]],Gh)}function J$(e){let n;for(;n=e.sourceEvent;)e=n;return e}function no(e,n){if(e=J$(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 sc={capture:!0,passive:!1};function cc(e){e.preventDefault(),e.stopImmediatePropagation()}function X$(e){var n=e.document.documentElement,o=to(e).on("dragstart.drag",cc,sc);"onselectstart"in n?o.on("selectstart.drag",cc,sc):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Z$(e,n){var o=e.document.documentElement,i=to(e).on("dragstart.drag",null);n&&(i.on("click.drag",cc,sc),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 dc(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Yh(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Qi(){}var ea=.7,Or=1/ea,mi="\\s*([+-]?\\d+)\\s*",ta="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Q$=/^#([0-9a-f]{3,8})$/,eT=new RegExp(`^rgb\\(${mi},${mi},${mi}\\)$`),tT=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),nT=new RegExp(`^rgba\\(${mi},${mi},${mi},${ta}\\)$`),oT=new RegExp(`^rgba\\(${_n},${_n},${_n},${ta}\\)$`),iT=new RegExp(`^hsl\\(${ta},${_n},${_n}\\)$`),aT=new RegExp(`^hsla\\(${ta},${_n},${_n},${ta}\\)$`),qh={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};dc(Qi,na,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wh,formatHex:Wh,formatHex8:rT,formatHsl:lT,formatRgb:Jh,toString:Jh});function Wh(){return this.rgb().formatHex()}function rT(){return this.rgb().formatHex8()}function lT(){return ty(this).formatHsl()}function Jh(){return this.rgb().formatRgb()}function na(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Q$.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Xh(n):o===3?new zt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Pr(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Pr(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=eT.exec(e))?new zt(n[1],n[2],n[3],1):(n=tT.exec(e))?new zt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=nT.exec(e))?Pr(n[1],n[2],n[3],n[4]):(n=oT.exec(e))?Pr(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=iT.exec(e))?ey(n[1],n[2]/100,n[3]/100,1):(n=aT.exec(e))?ey(n[1],n[2]/100,n[3]/100,n[4]):qh.hasOwnProperty(e)?Xh(qh[e]):e==="transparent"?new zt(NaN,NaN,NaN,0):null}function Xh(e){return new zt(e>>16&255,e>>8&255,e&255,1)}function Pr(e,n,o,i){return i<=0&&(e=n=o=NaN),new zt(e,n,o,i)}function sT(e){return e instanceof Qi||(e=na(e)),e?(e=e.rgb(),new zt(e.r,e.g,e.b,e.opacity)):new zt}function uc(e,n,o,i){return arguments.length===1?sT(e):new zt(e,n,o,i??1)}function zt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}dc(zt,uc,Yh(Qi,{brighter(e){return e=e==null?Or:Math.pow(Or,e),new zt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ea:Math.pow(ea,e),new zt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new zt(Do(this.r),Do(this.g),Do(this.b),zr(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:Zh,formatHex:Zh,formatHex8:cT,formatRgb:Qh,toString:Qh}));function Zh(){return`#${Oo(this.r)}${Oo(this.g)}${Oo(this.b)}`}function cT(){return`#${Oo(this.r)}${Oo(this.g)}${Oo(this.b)}${Oo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qh(){const e=zr(this.opacity);return`${e===1?"rgb(":"rgba("}${Do(this.r)}, ${Do(this.g)}, ${Do(this.b)}${e===1?")":`, ${e})`}`}function zr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Do(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Oo(e){return e=Do(e),(e<16?"0":"")+e.toString(16)}function ey(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new ln(e,n,o,i)}function ty(e){if(e instanceof ln)return new ln(e.h,e.s,e.l,e.opacity);if(e instanceof Qi||(e=na(e)),!e)return new ln;if(e instanceof ln)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 ln(l,s,c,e.opacity)}function dT(e,n,o,i){return arguments.length===1?ty(e):new ln(e,n,o,i??1)}function ln(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}dc(ln,dT,Yh(Qi,{brighter(e){return e=e==null?Or:Math.pow(Or,e),new ln(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ea:Math.pow(ea,e),new ln(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 zt(mc(e>=240?e-240:e+120,a,i),mc(e,a,i),mc(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new ln(ny(this.h),Fr(this.s),Fr(this.l),zr(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=zr(this.opacity);return`${e===1?"hsl(":"hsla("}${ny(this.h)}, ${Fr(this.s)*100}%, ${Fr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ny(e){return e=(e||0)%360,e<0?e+360:e}function Fr(e){return Math.max(0,Math.min(1,e||0))}function mc(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 oy=e=>()=>e;function uT(e,n){return function(o){return e+o*n}}function mT(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 fT(e){return(e=+e)==1?iy:function(n,o){return o-n?mT(n,o,e):oy(isNaN(n)?o:n)}}function iy(e,n){var o=n-e;return o?uT(e,o):oy(isNaN(e)?n:e)}const ay=(function e(n){var o=fT(n);function i(a,r){var l=o((a=uc(a)).r,(r=uc(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=iy(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 oo(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var fc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pc=new RegExp(fc.source,"g");function pT(e){return function(){return e}}function hT(e){return function(n){return e(n)+""}}function yT(e,n){var o=fc.lastIndex=pc.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=fc.exec(e))&&(a=pc.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:oo(i,a)})),o=pc.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?hT(c[0].x):pT(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 ry=180/Math.PI,hc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ly(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)*ry,skewX:Math.atan(c)*ry,scaleX:l,scaleY:s}}var Ur;function gT(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?hc:ly(n.a,n.b,n.c,n.d,n.e,n.f)}function bT(e){return e==null||(Ur||(Ur=document.createElementNS("http://www.w3.org/2000/svg","g")),Ur.setAttribute("transform",e),!(e=Ur.transform.baseVal.consolidate()))?hc:(e=e.matrix,ly(e.a,e.b,e.c,e.d,e.e,e.f))}function sy(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var _=f.push("translate(",null,n,null,o);h.push({i:_-4,x:oo(d,m)},{i:_-2,x:oo(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:oo(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:oo(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var _=f.push(a(f)+"scale(",null,",",null,")");h.push({i:_-4,x:oo(d,m)},{i:_-2,x:oo(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,_=p.length,g;++h<_;)m[(g=p[h]).i]=g.x(f);return m.join("")}}}var _T=sy(gT,"px, ","px)","deg)"),kT=sy(bT,", ",")",")"),ET=1e-12;function cy(e){return((e=Math.exp(e))+1/e)/2}function NT(e){return((e=Math.exp(e))-1/e)/2}function wT(e){return((e=Math.exp(2*e))-1)/(e+1)}const IT=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,_=f*f+h*h,g,k;if(_<ET)k=Math.log(p/d)/n,g=function($){return[s+$*f,c+$*h,d*Math.exp(n*$*k)]};else{var E=Math.sqrt(_),b=(p*p-d*d+i*_)/(2*d*o*E),v=(p*p-d*d-i*_)/(2*p*o*E),y=Math.log(Math.sqrt(b*b+1)-b),S=Math.log(Math.sqrt(v*v+1)-v);k=(S-y)/n,g=function($){var O=$*k,B=cy(y),z=d/(o*E)*(B*wT(n*O+y)-NT(y));return[s+z*f,c+z*h,d*B/cy(n*O+y)]}}return g.duration=k*1e3*n/Math.SQRT2,g}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var fi=0,oa=0,ia=0,dy=1e3,Hr,aa,jr=0,Po=0,Kr=0,ra=typeof performance=="object"&&performance.now?performance:Date,uy=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yc(){return Po||(uy(vT),Po=ra.now()+Kr)}function vT(){Po=0}function Gr(){this._call=this._time=this._next=null}Gr.prototype=my.prototype={constructor:Gr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?yc():+o)+(n==null?0:+n),!this._next&&aa!==this&&(aa?aa._next=this:Hr=this,aa=this),this._call=e,this._time=o,gc()},stop:function(){this._call&&(this._call=null,this._time=1/0,gc())}};function my(e,n,o){var i=new Gr;return i.restart(e,n,o),i}function CT(){yc(),++fi;for(var e=Hr,n;e;)(n=Po-e._time)>=0&&e._call.call(void 0,n),e=e._next;--fi}function fy(){Po=(jr=ra.now())+Kr,fi=oa=0;try{CT()}finally{fi=0,xT(),Po=0}}function ST(){var e=ra.now(),n=e-jr;n>dy&&(Kr-=n,jr=e)}function xT(){for(var e,n=Hr,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:Hr=o);aa=e,gc(i)}function gc(e){if(!fi){oa&&(oa=clearTimeout(oa));var n=e-Po;n>24?(e<1/0&&(oa=setTimeout(fy,e-ra.now()-Kr)),ia&&(ia=clearInterval(ia))):(ia||(jr=ra.now(),ia=setInterval(ST,dy)),fi=1,uy(fy))}}function py(e,n,o){var i=new Gr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var RT=ic("start","end","cancel","interrupt"),AT=[],hy=0,yy=1,bc=2,Yr=3,gy=4,_c=5,qr=6;function Wr(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:RT,tween:AT,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:hy})}function kc(e,n){var o=sn(e,n);if(o.state>hy)throw new Error("too late; already scheduled");return o}function kn(e,n){var o=sn(e,n);if(o.state>Yr)throw new Error("too late; already running");return o}function sn(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=my(r,0,o.time);function r(d){o.state=yy,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==yy)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Yr)return py(l);f.state===gy?(f.state=qr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=qr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(py(function(){o.state===Yr&&(o.state=gy,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=bc,o.on.call("start",e,e.__data__,o.index,o.group),o.state===bc){for(o.state=Yr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=_c,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===_c&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=qr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Jr(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>bc&&i.state<_c,i.state=qr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function TT(e){return this.each(function(){Jr(this,e)})}function MT(e,n){var o,i;return function(){var a=kn(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 VT(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=kn(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 LT(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=sn(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?MT:VT)(o,e,n))}function Ec(e,n,o){var i=e._id;return e.each(function(){var a=kn(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return sn(a,i).value[n]}}function by(e,n){var o;return(typeof n=="number"?oo:n instanceof na?ay:(o=na(n))?(n=o,ay):yT)(e,n)}function BT(e){return function(){this.removeAttribute(e)}}function DT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function OT(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 PT(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 zT(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 FT(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 UT(e,n){var o=Br(e),i=o==="transform"?kT:by;return this.attrTween(e,typeof n=="function"?(o.local?FT:zT)(o,i,Ec(this,"attr."+e,n)):n==null?(o.local?DT:BT)(o):(o.local?PT:OT)(o,i,n))}function HT(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function jT(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function KT(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&jT(e,r)),o}return a._value=n,a}function GT(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&HT(e,r)),o}return a._value=n,a}function YT(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=Br(e);return this.tween(o,(i.local?KT:GT)(i,n))}function qT(e,n){return function(){kc(this,e).delay=+n.apply(this,arguments)}}function WT(e,n){return n=+n,function(){kc(this,e).delay=n}}function JT(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?qT:WT)(n,e)):sn(this.node(),n).delay}function XT(e,n){return function(){kn(this,e).duration=+n.apply(this,arguments)}}function ZT(e,n){return n=+n,function(){kn(this,e).duration=n}}function QT(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?XT:ZT)(n,e)):sn(this.node(),n).duration}function eM(e,n){if(typeof n!="function")throw new Error;return function(){kn(this,e).ease=n}}function tM(e){var n=this._id;return arguments.length?this.each(eM(n,e)):sn(this.node(),n).ease}function nM(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;kn(this,e).ease=o}}function oM(e){if(typeof e!="function")throw new Error;return this.each(nM(this._id,e))}function iM(e){typeof e!="function"&&(e=Dh(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 Ln(i,this._parents,this._name,this._id)}function aM(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new Ln(l,this._parents,this._name,this._id)}function rM(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 lM(e,n,o){var i,a,r=rM(n)?kc:kn;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function sM(e,n){var o=this._id;return arguments.length<2?sn(this.node(),o).on.on(e):this.each(lM(o,e,n))}function cM(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function dM(){return this.on("end.remove",cM(this._id))}function uM(e){var n=this._name,o=this._id;typeof e!="function"&&(e=rc(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Wr(d[p],n,o,p,d,sn(u,o)));return new Ln(r,this._parents,n,o)}function mM(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Bh(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var p=e.call(u,u.__data__,m,c),f,h=sn(u,o),_=0,g=p.length;_<g;++_)(f=p[_])&&Wr(f,n,o,_,p,h);r.push(p),l.push(u)}return new Ln(r,l,n,o)}var fM=Zi.prototype.constructor;function pM(){return new fM(this._groups,this._parents)}function hM(e,n){var o,i,a;return function(){var r=ui(this,e),l=(this.style.removeProperty(e),ui(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function _y(e){return function(){this.style.removeProperty(e)}}function yM(e,n,o){var i,a=o+"",r;return function(){var l=ui(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function gM(e,n,o){var i,a,r;return function(){var l=ui(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),ui(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function bM(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=kn(this,e),d=c.on,u=c.value[r]==null?s||(s=_y(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function _M(e,n,o){var i=(e+="")=="transform"?_T:by;return n==null?this.styleTween(e,hM(e,i)).on("end.style."+e,_y(e)):typeof n=="function"?this.styleTween(e,gM(e,i,Ec(this,"style."+e,n))).each(bM(this._id,e)):this.styleTween(e,yM(e,i,n),o).on("end.style."+e,null)}function kM(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function EM(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&kM(e,l,o)),i}return r._value=n,r}function NM(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,EM(e,n,o??""))}function wM(e){return function(){this.textContent=e}}function IM(e){return function(){var n=e(this);this.textContent=n??""}}function vM(e){return this.tween("text",typeof e=="function"?IM(Ec(this,"text",e)):wM(e==null?"":e+""))}function CM(e){return function(n){this.textContent=e.call(this,n)}}function SM(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&CM(a)),n}return i._value=e,i}function xM(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,SM(e))}function RM(){for(var e=this._name,n=this._id,o=ky(),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=sn(c,n);Wr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ln(i,this._parents,e,o)}function AM(){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=kn(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 $M=0;function Ln(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function ky(){return++$M}var Bn=Zi.prototype;Ln.prototype={constructor:Ln,select:uM,selectAll:mM,selectChild:Bn.selectChild,selectChildren:Bn.selectChildren,filter:iM,merge:aM,selection:pM,transition:RM,call:Bn.call,nodes:Bn.nodes,node:Bn.node,size:Bn.size,empty:Bn.empty,each:Bn.each,on:sM,attr:UT,attrTween:YT,style:_M,styleTween:NM,text:vM,textTween:xM,remove:dM,tween:LT,delay:JT,duration:QT,ease:tM,easeVarying:oM,end:AM,[Symbol.iterator]:Bn[Symbol.iterator]};function TM(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var MM={time:null,delay:0,duration:250,ease:TM};function VM(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 LM(e){var n,o;e instanceof Ln?(n=e._id,e=e._name):(n=ky(),(o=MM).time=yc(),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])&&Wr(c,e,n,d,l,o||VM(c,n));return new Ln(i,this._parents,e,n)}Zi.prototype.interrupt=TT,Zi.prototype.transition=LM;const Xr=e=>()=>e;function BM(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Dn(e,n,o){this.k=e,this.x=n,this.y=o}Dn.prototype={constructor:Dn,scale:function(e){return e===1?this:new Dn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Dn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Nc=new Dn(1,0,0);Dn.prototype;function wc(e){e.stopImmediatePropagation()}function la(e){e.preventDefault(),e.stopImmediatePropagation()}function DM(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function OM(){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 Ey(){return this.__zoom||Nc}function PM(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zM(){return navigator.maxTouchPoints||"ontouchstart"in this}function FM(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 UM(){var e=DM,n=OM,o=FM,i=PM,a=zM,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=IT,d=ic("start","zoom","end"),u,m,p,f=500,h=150,_=0,g=10;function k(N){N.property("__zoom",Ey).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",T).on("touchmove.zoom",x).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(N,I,C,U){var A=N.selection?N.selection():N;A.property("__zoom",Ey),N!==A?y(N,I,C,U):A.interrupt().each(function(){S(this,arguments).event(U).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},k.scaleBy=function(N,I,C,U){k.scaleTo(N,function(){var A=this.__zoom.k,P=typeof I=="function"?I.apply(this,arguments):I;return A*P},C,U)},k.scaleTo=function(N,I,C,U){k.transform(N,function(){var A=n.apply(this,arguments),P=this.__zoom,F=C==null?v(A):typeof C=="function"?C.apply(this,arguments):C,H=P.invert(F),G=typeof I=="function"?I.apply(this,arguments):I;return o(b(E(P,G),F,H),A,l)},C,U)},k.translateBy=function(N,I,C,U){k.transform(N,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof C=="function"?C.apply(this,arguments):C),n.apply(this,arguments),l)},null,U)},k.translateTo=function(N,I,C,U,A){k.transform(N,function(){var P=n.apply(this,arguments),F=this.__zoom,H=U==null?v(P):typeof U=="function"?U.apply(this,arguments):U;return o(Nc.translate(H[0],H[1]).scale(F.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof C=="function"?-C.apply(this,arguments):-C),P,l)},U,A)};function E(N,I){return I=Math.max(r[0],Math.min(r[1],I)),I===N.k?N:new Dn(I,N.x,N.y)}function b(N,I,C){var U=I[0]-C[0]*N.k,A=I[1]-C[1]*N.k;return U===N.x&&A===N.y?N:new Dn(N.k,U,A)}function v(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function y(N,I,C,U){N.on("start.zoom",function(){S(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(U).end()}).tween("zoom",function(){var A=this,P=arguments,F=S(A,P).event(U),H=n.apply(A,P),G=C==null?v(H):typeof C=="function"?C.apply(A,P):C,le=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),se=A.__zoom,ue=typeof I=="function"?I.apply(A,P):I,ye=c(se.invert(G).concat(le/se.k),ue.invert(G).concat(le/ue.k));return function(ae){if(ae===1)ae=ue;else{var Ie=ye(ae),Pe=le/Ie[2];ae=new Dn(Pe,G[0]-Ie[0]*Pe,G[1]-Ie[1]*Pe)}F.zoom(null,ae)}})}function S(N,I,C){return!C&&N.__zooming||new $(N,I)}function $(N,I){this.that=N,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(N,I),this.taps=0}$.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,I){return this.mouse&&N!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var I=to(this.that).datum();d.call(N,this.that,new BM(N,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:d}),I)}};function O(N,...I){if(!e.apply(this,arguments))return;var C=S(this,I).event(N),U=this.__zoom,A=Math.max(r[0],Math.min(r[1],U.k*Math.pow(2,i.apply(this,arguments)))),P=no(N);if(C.wheel)(C.mouse[0][0]!==P[0]||C.mouse[0][1]!==P[1])&&(C.mouse[1]=U.invert(C.mouse[0]=P)),clearTimeout(C.wheel);else{if(U.k===A)return;C.mouse=[P,U.invert(P)],Jr(this),C.start()}la(N),C.wheel=setTimeout(F,h),C.zoom("mouse",o(b(E(U,A),C.mouse[0],C.mouse[1]),C.extent,l));function F(){C.wheel=null,C.end()}}function B(N,...I){if(p||!e.apply(this,arguments))return;var C=N.currentTarget,U=S(this,I,!0).event(N),A=to(N.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",le,!0),P=no(N,C),F=N.clientX,H=N.clientY;X$(N.view),wc(N),U.mouse=[P,this.__zoom.invert(P)],Jr(this),U.start();function G(se){if(la(se),!U.moved){var ue=se.clientX-F,ye=se.clientY-H;U.moved=ue*ue+ye*ye>_}U.event(se).zoom("mouse",o(b(U.that.__zoom,U.mouse[0]=no(se,C),U.mouse[1]),U.extent,l))}function le(se){A.on("mousemove.zoom mouseup.zoom",null),Z$(se.view,U.moved),la(se),U.event(se).end()}}function z(N,...I){if(e.apply(this,arguments)){var C=this.__zoom,U=no(N.changedTouches?N.changedTouches[0]:N,this),A=C.invert(U),P=C.k*(N.shiftKey?.5:2),F=o(b(E(C,P),U,A),n.apply(this,I),l);la(N),s>0?to(this).transition().duration(s).call(y,F,U,N):to(this).call(k.transform,F,U,N)}}function T(N,...I){if(e.apply(this,arguments)){var C=N.touches,U=C.length,A=S(this,I,N.changedTouches.length===U).event(N),P,F,H,G;for(wc(N),F=0;F<U;++F)H=C[F],G=no(H,this),G=[G,this.__zoom.invert(G),H.identifier],A.touch0?!A.touch1&&A.touch0[2]!==G[2]&&(A.touch1=G,A.taps=0):(A.touch0=G,P=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(A.taps<2&&(m=G[0],u=setTimeout(function(){u=null},f)),Jr(this),A.start())}}function x(N,...I){if(this.__zooming){var C=S(this,I).event(N),U=N.changedTouches,A=U.length,P,F,H,G;for(la(N),P=0;P<A;++P)F=U[P],H=no(F,this),C.touch0&&C.touch0[2]===F.identifier?C.touch0[0]=H:C.touch1&&C.touch1[2]===F.identifier&&(C.touch1[0]=H);if(F=C.that.__zoom,C.touch1){var le=C.touch0[0],se=C.touch0[1],ue=C.touch1[0],ye=C.touch1[1],ae=(ae=ue[0]-le[0])*ae+(ae=ue[1]-le[1])*ae,Ie=(Ie=ye[0]-se[0])*Ie+(Ie=ye[1]-se[1])*Ie;F=E(F,Math.sqrt(ae/Ie)),H=[(le[0]+ue[0])/2,(le[1]+ue[1])/2],G=[(se[0]+ye[0])/2,(se[1]+ye[1])/2]}else if(C.touch0)H=C.touch0[0],G=C.touch0[1];else return;C.zoom("touch",o(b(F,H,G),C.extent,l))}}function R(N,...I){if(this.__zooming){var C=S(this,I).event(N),U=N.changedTouches,A=U.length,P,F;for(wc(N),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),P=0;P<A;++P)F=U[P],C.touch0&&C.touch0[2]===F.identifier?delete C.touch0:C.touch1&&C.touch1[2]===F.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&&(F=no(F,this),Math.hypot(m[0]-F[0],m[1]-F[1])<g)){var H=to(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return k.wheelDelta=function(N){return arguments.length?(i=typeof N=="function"?N:Xr(+N),k):i},k.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Xr(!!N),k):e},k.touchable=function(N){return arguments.length?(a=typeof N=="function"?N:Xr(!!N),k):a},k.extent=function(N){return arguments.length?(n=typeof N=="function"?N:Xr([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),k):n},k.scaleExtent=function(N){return arguments.length?(r[0]=+N[0],r[1]=+N[1],k):[r[0],r[1]]},k.translateExtent=function(N){return arguments.length?(l[0][0]=+N[0][0],l[1][0]=+N[1][0],l[0][1]=+N[0][1],l[1][1]=+N[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(N){return arguments.length?(o=N,k):o},k.duration=function(N){return arguments.length?(s=+N,k):s},k.interpolate=function(N){return arguments.length?(c=N,k):c},k.on=function(){var N=d.on.apply(d,arguments);return N===d?k:N},k.clickDistance=function(N){return arguments.length?(_=(N=+N)*N,k):Math.sqrt(_)},k.tapDistance=function(N){return arguments.length?(g=+N,k):g},k}const Ny=Symbol("MiniMapSlots"),HM=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],jM={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},KM=t.defineComponent({...jM,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(Ny),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,p)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,HM))],64)):t.createCommentVNode("",!0)}}),GM=["width","height","viewBox","aria-labelledby"],YM=["id"],qM=["d","fill","stroke","stroke-width"],WM={name:"MiniMap",compatConfig:{MODE:3}},JM=t.defineComponent({...WM,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:p,d3Zoom:f,getNodesInitialized:h}=tt(),_=t.ref();t.provide(Ny,o);const g=t.toRef(()=>{var A;return e.width??((A=i.style)==null?void 0:A.width)??a}),k=t.toRef(()=>{var A;return e.height??((A=i.style)==null?void 0:A.height)??r}),E=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",b=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),v=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),y=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),S=t.computed(()=>Ts(h.value.filter(A=>!A.hidden))),$=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),O=t.computed(()=>h.value&&h.value.length?tw(S.value,$.value):$.value),B=t.computed(()=>{const A=O.value.width/g.value,P=O.value.height/k.value;return Math.max(A,P)}),z=t.computed(()=>{const A=B.value*g.value,P=B.value*k.value,F=e.offsetScale*B.value;return{offset:F,x:O.value.x-(A-O.value.width)/2-F,y:O.value.y-(P-O.value.height)/2-F,width:A+F*2,height:P+F*2}}),T=t.computed(()=>!z.value.x||!z.value.y?"":`
60
60
  M${z.value.x-z.value.offset},${z.value.y-z.value.offset}
61
61
  h${z.value.width+z.value.offset*2}
62
62
  v${z.value.height+z.value.offset*2}
@@ -70,4 +70,4 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
70
70
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
71
71
  v${-($.value.height-2*e.maskBorderRadius)}
72
72
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(A=>{if(_.value){const P=to(_.value),F=le=>{if(le.sourceEvent.type!=="wheel"||!p.value||!f.value)return;const se=le.sourceEvent.ctrlKey&&Ji()?10:1,ue=-le.sourceEvent.deltaY*(le.sourceEvent.deltaMode===1?.05:le.sourceEvent.deltaMode?1:.002)*e.zoomStep,ye=c.value.zoom*2**(ue*se);f.value.scaleTo(p.value,ye)},H=le=>{if(le.sourceEvent.type!=="mousemove"||!p.value||!f.value)return;const se=B.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),ue={x:c.value.x-le.sourceEvent.movementX*se,y:c.value.y-le.sourceEvent.movementY*se},ye=[[0,0],[u.value.width,u.value.height]],ae=Nc.translate(ue.x,ue.y).scale(c.value.zoom),Ie=f.value.constrain()(ae,ye,d.value);f.value.transform(p.value,Ie)},G=UM().wheelDelta(le=>Ms(le)*(e.zoomStep/10)).on("zoom",e.pannable?H:()=>{}).on("zoom.wheel",e.zoomable?F:()=>{});P.call(G),A(()=>{P.on("zoom",null)})}},{flush:"post"});function x(A){const[P,F]=no(A);n("click",{event:A,position:{x:P,y:F}})}function R(A,P){const F={event:A,node:P,connectedEdges:Ao([P],s.value)};m.miniMapNodeClick(F),n("nodeClick",F)}function N(A,P){const F={event:A,node:P,connectedEdges:Ao([P],s.value)};m.miniMapNodeDoubleClick(F),n("nodeDblclick",F)}function I(A,P){const F={event:A,node:P,connectedEdges:Ao([P],s.value)};m.miniMapNodeMouseEnter(F),n("nodeMouseenter",F)}function C(A,P){const F={event:A,node:P,connectedEdges:Ao([P],s.value)};m.miniMapNodeMouseMove(F),n("nodeMousemove",F)}function U(A,P){const F={event:A,node:P,connectedEdges:Ao([P],s.value)};m.miniMapNodeMouseLeave(F),n("nodeMouseleave",F)}return(A,P)=>(t.openBlock(),t.createBlock(t.unref(Lp),{position:A.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:A.pannable,zoomable:A.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:_,width:g.value,height:k.value,viewBox:[z.value.x,z.value.y,z.value.width,z.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:x},[A.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(A.ariaLabel),9,YM)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(h),F=>(t.openBlock(),t.createBlock(KM,{id:F.id,key:F.id,f:"",position:F.computedPosition,dimensions:F.dimensions,selected:F.selected,dragging:F.dragging,style:t.normalizeStyle(F.style),class:t.normalizeClass(y.value(F)),color:b.value(F),"border-radius":A.nodeBorderRadius,"stroke-color":v.value(F),"stroke-width":A.nodeStrokeWidth,"shape-rendering":t.unref(E),type:F.type,hidden:F.hidden,onClick:H=>R(H,F),onDblclick:H=>N(H,F),onMouseenter:H=>I(H,F),onMousemove:H=>C(H,F),onMouseleave:H=>U(H,F)},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:T.value,fill:A.maskColor,stroke:A.maskStrokeColor,"stroke-width":A.maskStrokeWidth,"fill-rule":"evenodd"},null,8,qM)],8,GM))]),_:1},8,["position","class"]))}}),XM=["d"],ZM=["cx","cy","onDblclick"],QM=["x","y","onPointerdown","onDblclick"],e2=Qe(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=tt(),i=t.inject(oc),a=t.inject(eo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Lo,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((O,B)=>B===d.value?u.value:O)),{source:p,target:f,sourceSide:h,targetSide:_}=nc({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),g=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Qs(p.value,h.value,m.value,f.value,_.value):ec(p.value,m.value,f.value)),k=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ph(p.value,h.value,m.value,f.value,_.value):gh(p.value,m.value,f.value).map((O,B)=>({point:O,segIndex:B})):[]),E=t.computed(()=>r.value?m.value:[]);function b(O,B){d.value=O,u.value={...c.value[O]},B.target.setPointerCapture(B.pointerId),B.stopPropagation()}function v(O){if(d.value<0)return;const B=o({x:O.clientX,y:O.clientY});u.value={x:B.x,y:B.y}}function y(O){var B,z;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(z=(B=O.target).releasePointerCapture)==null||z.call(B,O.pointerId)}function S(O,B){B.stopPropagation(),i==null||i.removePoint(n.id,O)}function $(O,B){if(!i)return;const z=o({x:B.clientX,y:B.clientY});i.insertPoint(n.id,O,{x:z.x,y:z.y})}return(O,B)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:g.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,XM),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,(z,T)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${T}`,cx:z.point.x,cy:z.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(x=>$(z.segIndex,x),["stop"])},null,42,ZM))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(z,T)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${T}`,x:z.x-5,y:z.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:x=>b(T,x),onPointermove:v,onPointerup:y,onDblclick:x=>S(T,x)},null,42,QM))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),t2=["d"],n2=Qe(t.defineComponent({inheritAttrs:!1,__name:"SerializedTypeEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,o=t.inject(eo,null),i=t.inject(Lo,null),a=t.computed(()=>!!i&&i.active.value&&(!i.relatedEntityIds.value.has(n.data.consumerRef)||!i.relatedEntityIds.value.has(n.data.typeRef))),{source:r,target:l,sourceSide:s,targetSide:c}=nc({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>[]}),d=t.computed(()=>(o==null?void 0:o.routingMode.value)==="orthogonal"?Qs(r.value,s.value,[],l.value,c.value):ec(r.value,[],l.value));return(u,m)=>(t.openBlock(),t.createElementBlock("path",{d:d.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"2 5","stroke-linecap":"round",class:t.normalizeClass(["em-serialized-edge__path",{"is-dimmed":a.value}])},null,10,t2))}}),[["__scopeId","data-v-67430658"]]),o2=["data-theme"],i2={key:0,class:"em-ctx__sep",role:"separator"},a2=["aria-label"],r2={class:"em-ctx__swatches-label","aria-hidden":"true"},l2={class:"em-ctx__chips",role:"none"},s2=["aria-checked","aria-label","title","onClick"],c2=["aria-checked","aria-label","title","onClick"],d2=["disabled","onClick"],u2={class:"em-ctx__icon"},m2={class:"em-ctx__caption"},f2=Qe(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(b,v)=>rn(o.locale??"ko",b,v),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(b,v){var $,O;r.value=v,l.value=($=b.target)!=null&&$.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=b.clientX,c.y=b.clientY,a.value=!0,window.addEventListener("keydown",g),window.addEventListener("resize",p),await t.nextTick();const y=s.value;if(!y)return;const S=y.getBoundingClientRect();c.x+S.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-S.width)),c.y+S.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-S.height)),(O=f()[0])==null||O.focus()}function p(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",g),window.removeEventListener("resize",p);const b=d;d=null,b!=null&&b.isConnected&&b.focus()}function f(){const b=s.value;if(!b)return[];const v=[];for(const y of Array.from(b.children))if(y.classList.contains("em-ctx__item"))y.disabled||v.push(y);else if(y.classList.contains("em-ctx__swatches")){const S=Array.from(y.querySelectorAll(".em-ctx__chip"));S.length&&v.push(S.find($=>$===document.activeElement)??S[0])}return v}function h(b){var $;const v=f();if(!v.length)return;const y=v.indexOf(document.activeElement),S=y<0?b>0?0:v.length-1:(y+b+v.length)%v.length;($=v[S])==null||$.focus()}function _(b){var $,O;const v=($=document.activeElement)==null?void 0:$.closest(".em-ctx__swatches");if(!v)return!1;const y=Array.from(v.querySelectorAll(".em-ctx__chip")),S=y.indexOf(document.activeElement);return S<0?!1:((O=y[(S+b+y.length)%y.length])==null||O.focus(),!0)}function g(b){var v,y;switch(b.key){case"Escape":b.stopPropagation(),p();return;case"ArrowDown":b.preventDefault(),h(1);return;case"ArrowUp":b.preventDefault(),h(-1);return;case"ArrowRight":_(1)&&b.preventDefault();return;case"ArrowLeft":_(-1)&&b.preventDefault();return;case"Home":b.preventDefault(),(v=f()[0])==null||v.focus();return;case"End":{b.preventDefault();const S=f();(y=S[S.length-1])==null||y.focus();return}case"Tab":b.preventDefault(),h(b.shiftKey?-1:1)}}function k(b){b.disabled||(b.handler(),p())}function E(b,v){b.onPick(v),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(b,v)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:p,onContextmenu:t.withModifiers(p,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:v[0]||(v[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(y,S)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S},[y.type==="separator"?(t.openBlock(),t.createElementBlock("div",i2)):y.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":y.caption},[t.createElementVNode("span",r2,t.toDisplayString(y.caption),1),t.createElementVNode("div",l2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":y.current===null}]),role:"menuitemradio","aria-checked":y.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:$=>E(y,null)},null,10,s2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":y.current===$}]),style:t.normalizeStyle({background:t.unref(ci)($)}),role:"menuitemradio","aria-checked":y.current===$,"aria-label":i(t.unref(Mo)($)),title:i(t.unref(Mo)($)),onClick:O=>E(y,$)},null,14,c2))),128))])],8,a2)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":y.danger,"is-disabled":y.disabled}]),disabled:y.disabled,role:"menuitem",onClick:$=>k(y)},[t.createElementVNode("span",u2,[y.icon?(t.openBlock(),t.createBlock(xe,{key:0,name:y.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",m2,t.toDisplayString(y.caption),1)],10,d2))],64))),128))],36)],8,o2)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function Ic(e,n){return`serialized:${e}:${n}`}function wy(e){const n=Ho(e);if(n.size===0)return[];const o=new Map;for(const i of e.entities)for(const a of i.attributes){if(a.attrType!=="NORMAL")continue;const r=_i(a,n,i,e);if(r.kind!=="resolved")continue;const l=r.entity;if(l.modelId===i.modelId)continue;const s=Ic(i.modelId,l.modelId),c=o.get(s);c?c.usageCount++:o.set(s,{consumerRef:i.modelId,typeRef:l.modelId,usageCount:1})}return[...o.values()]}function Iy(e,n){return n?`${e}:${n}`:e}function vy(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(Iy(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function p2(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=Iy(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function Cy(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(vy(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=vy(e.storageKey,s)),t.watch(o,s=>p2(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const vc=[".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 pi(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function h2(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function y2(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const h=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const _=n(h.left,h.top+h.height/2);return[{...i,x:_.x,y:_.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,p=0;const f=()=>{const h=d.trim();if(h){const _=n(m,(u+p)/2);c.push({...i,x:_.x,y:_.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(r,h),a.setEnd(r,h+1);const _=a.getBoundingClientRect();u===null||Math.abs(_.top-u)>1?(f(),u=_.top,m=_.left,p=_.bottom,d=s[h]):(d+=s[h],p=Math.max(p,_.bottom))}return f(),c}function Zr(e,n){const o=[];for(const i of e.querySelectorAll("*"))h2(i)&&(i.closest(vc)||pi(i)&&o.push(...y2(i,n)));return o}function sa(e){return Math.round(e*100)/100}function g2(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(vc)||!pi(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="${sa(r.x)}" y="${sa(r.y)}" width="${sa(l.x-r.x)}" height="${sa(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 b2(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!pi(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=>sa(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 Sy(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(vc)||!pi(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 ca(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 Cc(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 _2(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,h)=>e.screenToFlowCoordinate({x:f,y:h}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const h=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!h||!pi(h))continue;const _=h.firstElementChild;if(_)if(f.type==="group"){const g=ca(_,o);Cc(s,g),i.push({...g,texts:[]});const k=_.querySelector(".em-group__label");k&&i.push({...ca(k,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Zr(_,o)})}else if(f.type==="note"){const g={...ca(_,o),texts:Zr(_,o),lines:Sy(_,_,o)};Cc(s,g),r.push(g)}else{const g=ca(_,o);Cc(s,g);const k=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const E=_.querySelector(".em-entity__header");if(E){const b=ca(E,o);a.push({x:g.x,y:g.y,w:g.w,h:b.y+b.h-g.y,fill:b.fill,stroke:"none",radius:{tl:k.tl,tr:k.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Zr(_,o),lines:Sy(_,_,o),icons:g2(_,o)}),a.push({...g,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const h=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!pi(h))continue;const _=h.getAttribute("d");if(!_)continue;const g=getComputedStyle(h),k=g.strokeDasharray,E=b2(f);l.push({d:_,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:k&&k!=="none"?k:void 0,labels:Zr(f,o),markers:E.length?E:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Sc(e){return Nd(_2(e))}function xy(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 Ry(e,n="diagram.svg"){const o=Sc(e);xy(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function k2(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 Ay(e,n="diagram.png",o=2){const i=Sc(e),{w:a,h:r}=k2(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,p)=>{s.onload=()=>m(),s.onerror=()=>p(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");xy(u,n)}finally{URL.revokeObjectURL(l)}}const E2={class:"em-shortcuts"},N2={class:"em-shortcuts__list"},w2={class:"em-shortcuts__title"},I2={class:"em-shortcuts__keys"},v2={class:"em-shortcuts__kbd"},C2={key:0,class:"em-shortcuts__plus"},S2={class:"em-shortcuts__desc"},x2={class:"em-shortcuts__actions"},$y=Qe(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(s,c)=>rn(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",E2,[t.createElementVNode("div",N2,[(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",w2,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",I2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+p},[t.createElementVNode("kbd",v2,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",C2,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",S2,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",x2,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function hi(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function R2(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 A2=["aria-label"],$2=["aria-activedescendant","aria-label","placeholder"],T2={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},M2=["aria-label"],V2={class:"em-cmdk__section","aria-hidden":"true"},L2=["id","aria-selected","onMouseenter","onClick"],B2={class:"em-cmdk__label"},D2={key:0,class:"em-cmdk__tag"},O2={key:1,class:"em-cmdk__sub"},P2=["aria-label"],z2={class:"em-cmdk__section","aria-hidden":"true"},F2=["id","aria-selected","aria-disabled","onMouseenter","onClick"],U2={class:"em-cmdk__label"},H2={key:1,class:"em-cmdk__empty"},j2=Qe(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 y=c.value,S=a.state.logical.entities.map(O=>{var B,z,T,x;return{type:"goto",kind:"entity",id:O.modelId,label:((B=In(O))==null?void 0:B[y])||O.name,sub:(z=O.table)==null?void 0:z.physicalName,match:hi(O.name,(T=In(O))==null?void 0:T[y],(x=O.table)==null?void 0:x.physicalName)??""}}),$=a.state.logical.groups.map(O=>{var B,z;return{type:"goto",kind:"group",id:O.modelId,label:Mt(O.name,y)||O.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:hi((B=O.name)==null?void 0:B[y],(z=O.name)==null?void 0:z.ko,O.packageName)??""}});return[...S,...$]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const y=[];a.editable.value&&(y.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),y.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),y.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),y.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),y.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),y.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),y.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),y.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const S of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])y.push({type:"action",id:`dm-${S}`,label:a.t(u[S]),run:()=>a.displayMode.value=S});return y});function p(y,S){return y.label.toLowerCase().includes(S)}const f=t.computed(()=>{const y=r.value.trim().toLowerCase();return y?d.value.filter(S=>S.match.includes(y)):d.value}),h=t.computed(()=>{const y=r.value.trim().toLowerCase();return y?m.value.filter(S=>p(S,y)):m.value}),_=t.computed(()=>[...f.value,...h.value]);t.watch([f,h],()=>{l.value=0});function g(y){return _.value.indexOf(y)}const k=y=>`em-cmdk-opt-${y}`,E=t.computed(()=>_.value[l.value]?k(l.value):void 0);t.watch(l,async()=>{var S;await t.nextTick();const y=E.value;y&&((S=document.getElementById(y))==null||S.scrollIntoView({block:"nearest"}))});function b(y){if(y.type==="goto")a.selection.value={kind:y.kind,id:y.id},a.requestFocus(y.id);else{if(y.disabled)return;y.run()}i("close")}function v(y){if(y.key==="Escape"){i("close"),y.preventDefault();return}if(y.key==="ArrowDown"){l.value=Math.min(l.value+1,_.value.length-1),y.preventDefault();return}if(y.key==="ArrowUp"){l.value=Math.max(l.value-1,0),y.preventDefault();return}if(y.key==="Enter"){const S=_.value[l.value];S&&b(S),y.preventDefault();return}y.key==="Tab"&&y.preventDefault()}return t.nextTick(()=>{var y;return(y=s.value)==null?void 0:y.focus()}),(y,S)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:S[1]||(S[1]=t.withModifiers($=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":S[0]||(S[0]=$=>r.value=$),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":E.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:v},null,40,$2),[[t.vModelText,r.value]]),t.createElementVNode("div",T2,[_.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",V2,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,$=>(t.openBlock(),t.createElementBlock("button",{id:k(g($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g($)===l.value}]),role:"option","aria-selected":g($)===l.value,onMouseenter:O=>l.value=g($),onClick:O=>b($)},[t.createElementVNode("span",B2,t.toDisplayString($.label),1),$.tag?(t.openBlock(),t.createElementBlock("span",D2,t.toDisplayString($.tag),1)):$.sub?(t.openBlock(),t.createElementBlock("span",O2,t.toDisplayString($.sub),1)):t.createCommentVNode("",!0)],42,L2))),128))],8,M2)):t.createCommentVNode("",!0),h.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",z2,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,$=>(t.openBlock(),t.createElementBlock("button",{id:k(g($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g($)===l.value,"is-disabled":$.disabled}]),role:"option","aria-selected":g($)===l.value,"aria-disabled":$.disabled||void 0,onMouseenter:O=>l.value=g($),onClick:O=>b($)},[t.createElementVNode("span",U2,t.toDisplayString($.label),1)],42,F2))),128))],8,P2)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",H2,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,A2)],32)]))}}),[["__scopeId","data-v-92971c73"]]);function K2(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const G2={key:0,class:"em-canvas__empty","aria-hidden":"true"},Y2={class:"em-canvas__empty-title"},q2=["innerHTML"],W2=["innerHTML"],J2=["innerHTML"],X2={key:1,class:"em-canvas__empty-title"},Z2={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},Q2={class:"em-conflict-banner__body"},eV={class:"em-conflict-banner__title"},tV={class:"em-conflict-banner__detail"},nV={key:0,class:"em-toast",role:"status","aria-live":"polite"},xc="nc:",Ty=Qe(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=te.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(M){l.value=M,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,M=>{M&&c(M.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const M=K2(i.opConflict.value);return M?{title:i.t(M.titleKey),detail:i.t(M.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(M){p.x=M.clientX,p.y=M.clientY}const h=t.ref(null);t.provide($r,h);const _=t.ref(null);t.provide(Zp,_);const g=t.ref(null),k=t.computed(()=>{const M=g.value,w=new Set;if(!M)return w;if(M.kind==="entity")w.add(M.id);else if(M.kind==="group"){const ne=i.resolved.value.groups.find(ke=>ke.group.modelId===M.id);for(const ke of(ne==null?void 0:ne.group.memberEntityRefs)??[])w.add(ke)}return w}),E=t.computed(()=>{const M=g.value,w=new Set(k.value),ne=new Set,ke=new Set;if(!M)return{related:w,edges:ne,notes:ke};if(M.kind==="note"){ke.add(M.id);for(const Ve of i.resolved.value.noteConnections)Ve.noteRef===M.id&&w.add(Ve.targetRef);return{related:w,edges:ne,notes:ke}}const Ce=k.value;if(!Ce.size)return{related:w,edges:ne,notes:ke};for(const Ve of i.resolved.value.associations){const{end1:Ke,end2:He}=Ve.association;(Ce.has(Ke.entityRef)||Ce.has(He.entityRef))&&(ne.add(Ve.association.modelId),w.add(Ke.entityRef),w.add(He.entityRef))}for(const Ve of i.resolved.value.noteConnections)w.has(Ve.targetRef)&&ke.add(Ve.noteRef);return{related:w,edges:ne,notes:ke}});t.provide(Lo,{source:g,active:t.computed(()=>g.value!==null),primaryEntityIds:k,relatedEntityIds:t.computed(()=>E.value.related),relatedEdgeIds:t.computed(()=>E.value.edges),relatedNoteIds:t.computed(()=>E.value.notes),hoverGroupId:t.computed(()=>{var M;return((M=g.value)==null?void 0:M.kind)==="group"?g.value.id:null}),setEntityHover:M=>{_.value||m.value||(g.value=M?{kind:"entity",id:M}:null)},setGroupHover:M=>{_.value||m.value||(g.value=M?{kind:"group",id:M}:null)},setNoteHover:M=>{_.value||m.value||(g.value=M?{kind:"note",id:M}:null)}}),t.provide(eo,i);const b=Ax(),v=t.computed(()=>b(i.state.logical,i.embeddableCatalog.value));t.provide(th,v);const y=Cy({expandableKeys:()=>[],defaultCollapsed:Vx,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(ih,{isCollapsed:y.isCollapsed,toggle:y.toggle}),t.provide(Qp,{marks:t.toRef(o,"diffMarks")});function S(M,w){return`${xc}${M}:${w}`}function $(M){if(!M.startsWith(xc))return null;const[w,ne]=M.slice(xc.length).split(":");return w&&ne?{noteRef:w,targetRef:ne}:null}t.provide(oc,{points:M=>{var ne,ke;const w=$(M);return w?((ne=i.resolved.value.noteConnections.find(Ce=>Ce.noteRef===w.noteRef&&Ce.targetRef===w.targetRef))==null?void 0:ne.waypoints)??[]:((ke=i.resolved.value.associations.find(Ce=>Ce.association.modelId===M))==null?void 0:ke.waypoints)??[]},movePoint:(M,w,ne)=>{const ke=$(M);ke?i.moveNoteConnectionWaypoint(ke.noteRef,ke.targetRef,w,ne):i.moveWaypoint(M,w,ne)},insertPoint:(M,w,ne)=>{const ke=$(M);ke?i.addNoteConnectionWaypoint(ke.noteRef,ke.targetRef,w,ne):i.addWaypoint(M,w,ne)},removePoint:(M,w)=>{const ne=$(M);ne?i.removeNoteConnectionWaypoint(ne.noteRef,ne.targetRef,w):i.removeWaypoint(M,w)}});const O=tt(),{nodes:B,edges:z,findNode:T,findEdge:x,addNodes:R,addEdges:N,removeNodes:I,removeEdges:C,fitView:U,setCenter:A,getViewport:P,screenToFlowCoordinate:F,getSelectedNodes:H,updateNodeInternals:G}=O,le=t.ref(!1);async function se(M){le.value=!0,await t.nextTick(),await new Promise(w=>requestAnimationFrame(()=>w(null)));try{return await M()}finally{le.value=!1}}async function ue(){try{await se(()=>Ry(O))}catch(M){console.error("[entity-modeler] SVG export failed",M),c(i.t("em.canvas.exportFailed"))}}async function ye(){try{await se(()=>Ay(O))}catch(M){console.error("[entity-modeler] PNG export failed",M),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:ue,exportPng:ye,fitView:U});const ae=t.computed(()=>i.resolved.value.entities.length===0);function Ie(){const M=P(),{width:w,height:ne}=O.dimensions.value;return{x:(w/2-M.x)/M.zoom,y:(ne/2-M.y)/M.zoom}}function Pe(){const M=Ie();i.addEntity("NewEntity",{x:M.x,y:M.y})}function Ae(){const M=Ie();i.addNote("메모",{x:M.x,y:M.y})}function de(M){for(const w of i.resolved.value.groups){const{location:ne,size:ke}=w.geo;if(M.x>=ne.x&&M.x<=ne.x+ke.width&&M.y>=ne.y&&M.y<=ne.y+ke.height)return w.group.modelId}return null}function ge(M,w){return M.x===w.x&&M.y===w.y}function _e(M,w){return(M==null?void 0:M.width)===(w==null?void 0:w.width)&&(M==null?void 0:M.height)===(w==null?void 0:w.height)}function V(M,w){return M.entity===w.entity&&M.displayMode===w.displayMode&&M.collapsed===w.collapsed&&M.locked===w.locked&&M.groupRef===w.groupRef&&_e(M.size,w.size)&&M.style===w.style&&M.attributeStyles===w.attributeStyles&&M.operationStyles===w.operationStyles}function L(M,w){const ne=Object.keys(M);if(ne.length!==Object.keys(w).length)return!1;for(const ke of ne)if(ke==="geo"){const Ce=M.geo,Ve=w.geo;if(!ge(Ce.location,Ve.location)||!_e(Ce.size,Ve.size))return!1}else if(M[ke]!==w[ke])return!1;return!0}function j(){const M=i.resolved.value,w=new Map(M.groups.map(fe=>[fe.group.modelId,fe.geo])),ne=new Set(M.groups.map(fe=>fe.group.modelId)),ke=new Set([...ne,...M.entities.map(fe=>fe.entity.modelId),...M.notes.map(fe=>fe.note.modelId)]);for(const fe of[...B.value])ke.has(fe.id)||I([fe.id]);for(const fe of M.groups){const qe=fe.group.modelId,We={width:`${fe.geo.size.width}px`,height:`${fe.geo.size.height}px`},Je={group:fe.group,style:fe.style,locked:fe.locked},D=fe.locked?!1:void 0,Y=T(qe);if(Y){ge(Y.position,fe.geo.location)||(Y.position={...fe.geo.location});const we=Y.data;(we.group!==Je.group||we.style!==Je.style||we.locked!==Je.locked)&&(Y.data=Je);const Re=Y.style;((Re==null?void 0:Re.width)!==We.width||(Re==null?void 0:Re.height)!==We.height)&&(Y.style=We),Y.draggable!==D&&(Y.draggable=D)}else R([{id:qe,type:"group",position:{...fe.geo.location},draggable:D,style:We,data:Je}])}for(const fe of M.entities){const qe=fe.entity.modelId,We=fe.groupRef&&ne.has(fe.groupRef)?fe.groupRef:void 0,Je={entity:fe.entity,displayMode:i.displayMode.value,collapsed:fe.collapsed,locked:fe.locked,groupRef:We,size:fe.geo.size,style:fe.style,attributeStyles:fe.attributeStyles,operationStyles:fe.operationStyles},D=fe.locked?!1:void 0,Y=fe.locked?!1:void 0,we=We?w.get(We):void 0,Re=we?{x:fe.geo.location.x-we.location.x,y:fe.geo.location.y-we.location.y}:{...fe.geo.location},re=T(qe);re?(ge(re.position,Re)||(re.position=Re),V(re.data,Je)||(re.data=Je),re.parentNode!==We&&(re.parentNode=We),re.draggable!==D&&(re.draggable=D),re.connectable!==Y&&(re.connectable=Y)):R([{id:qe,type:"entity",position:Re,parentNode:We,draggable:D,connectable:Y,data:Je}])}for(const fe of M.notes){const qe=fe.note,We=qe.modelId,Je=fe.groupRef&&ne.has(fe.groupRef)?fe.groupRef:void 0,D={note:qe,groupRef:Je},Y={width:`${qe.geo.size.width}px`,height:`${qe.geo.size.height}px`},we=Je?w.get(Je):void 0,Re=we?{x:qe.geo.location.x-we.location.x,y:qe.geo.location.y-we.location.y}:{...qe.geo.location},re=T(We);if(re){ge(re.position,Re)||(re.position=Re);const Ge=re.data;(Ge.groupRef!==Je||!L(Ge.note,qe))&&(re.data=D);const ct=re.style;((ct==null?void 0:ct.width)!==Y.width||(ct==null?void 0:ct.height)!==Y.height)&&(re.style=Y),re.parentNode!==Je&&(re.parentNode=Je)}else R([{id:We,type:"note",position:Re,parentNode:Je,style:Y,data:D}])}const Ce=new Map(M.associations.map(fe=>[fe.association.modelId,fe])),Ve=new Set(M.noteConnections.map(fe=>S(fe.noteRef,fe.targetRef))),Ke=wy(i.state.logical).filter(fe=>T(fe.consumerRef)&&T(fe.typeRef)),He=new Set(Ke.map(fe=>Ic(fe.consumerRef,fe.typeRef)));for(const fe of[...z.value])!Ce.has(fe.id)&&!Ve.has(fe.id)&&!He.has(fe.id)&&C([fe.id]);for(const[fe,qe]of Ce){const We={id:fe,type:"association",source:qe.association.end1.entityRef,target:qe.association.end2.entityRef,sourceHandle:qe.sourceColumnRef?`r:${qe.sourceColumnRef}`:void 0,targetHandle:qe.targetColumnRef?`l:${qe.targetColumnRef}`:void 0,data:{association:qe.association,sourceColumnRef:qe.sourceColumnRef,targetColumnRef:qe.targetColumnRef}},Je=x(fe);if(Je){const D=Je.data;(D.association!==We.data.association||D.sourceColumnRef!==We.data.sourceColumnRef||D.targetColumnRef!==We.data.targetColumnRef)&&(Je.data=We.data),Je.sourceHandle!==We.sourceHandle&&(Je.sourceHandle=We.sourceHandle),Je.targetHandle!==We.targetHandle&&(Je.targetHandle=We.targetHandle)}else N([We])}for(const fe of M.noteConnections){const qe=S(fe.noteRef,fe.targetRef),We={noteRef:fe.noteRef,targetRef:fe.targetRef};x(qe)||N([{id:qe,type:"note-connection",source:fe.noteRef,target:fe.targetRef,data:We}])}for(const fe of Ke){const qe=Ic(fe.consumerRef,fe.typeRef),We={consumerRef:fe.consumerRef,typeRef:fe.typeRef,usageCount:fe.usageCount},Je=x(qe);Je?Je.data.usageCount!==We.usageCount&&(Je.data=We):N([{id:qe,type:"serialized-type",source:fe.consumerRef,target:fe.typeRef,data:We}])}}const ee=new Set;let Z=!1,pe=!1;const me=new Map;function ve(M){const w=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(M)}"]`);if(!w)return null;let ne=`${w.offsetHeight}`;for(const ke of w.querySelectorAll(".em-entity__row"))ne+=`|${ke.dataset.attr}:${ke.offsetTop}`;return ne}function Ee(){pe=!1;const M=Z;Z=!1;const w=[...ee];if(ee.clear(),M){G();for(const ke of B.value){const Ce=ve(ke.id);Ce!==null&&me.set(ke.id,Ce)}return}const ne=[];for(const ke of w){const Ce=ve(ke);if(Ce===null){me.delete(ke);continue}me.get(ke)!==Ce&&(me.set(ke,Ce),ne.push(ke))}ne.length&&G(ne)}function W(M){if(M)for(const w of M)ee.add(w);else Z=!0;pe||(pe=!0,t.nextTick(()=>requestAnimationFrame(Ee)))}t.provide(eh,{mark:M=>W([M])});function J(){const M=H.value.map(ne=>ne.id);if(M.length)return M;const w=i.selection.value;return w&&(w.kind==="entity"||w.kind==="note"||w.kind==="group")?[w.id]:[]}function X(){return H.value.filter(M=>M.type==="entity").map(M=>M.id)}function he(){return H.value.filter(M=>M.type==="group").map(M=>M.id)}function Te(M){var w;return[...((w=i.state.logical.groups.find(ne=>ne.modelId===M))==null?void 0:w.memberEntityRefs)??[]]}function De(){const M=he().flatMap(Te);return[...new Set([...X(),...M])]}function Oe(){return he().length>0||X().length>1}function ie(){Oe()?i.copy(De()):i.copy()}async function Ne(M){if(!M.length)return;await t.nextTick();const w=H.value;w.length&&O.removeSelectedNodes(w);const ne=M.map(ke=>T(ke)).filter(ke=>!!ke);ne.length&&O.addSelectedNodes(ne)}function Ye(M){if(Oe()&&X().includes(M)){const w=De();return{caption:i.t("em.ctx.copyN",{n:w.length}),icon:"copy",handler:()=>i.copy(w)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:M},i.copy()}}}function it(M){var Ce;const w=M.target;if(w&&(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable))return;if(M.key==="?"){a.openModal({component:$y,bind:{locale:i.uiLocale.value}}),M.preventDefault();return}if((M.metaKey||M.ctrlKey)&&M.key.toLowerCase()==="k"){r.value=!0,M.preventDefault();return}if(!i.editable.value){(M.metaKey||M.ctrlKey)&&M.key.toLowerCase()==="c"&&(ie(),M.preventDefault());return}if(M.key==="Delete"||M.key==="Backspace"){i.deleteSelection()&&M.preventDefault();return}if(M.key==="ArrowUp"||M.key==="ArrowDown"||M.key==="ArrowLeft"||M.key==="ArrowRight"){if(((Ce=i.selection.value)==null?void 0:Ce.kind)==="attribute"){if(M.key==="ArrowUp"||M.key==="ArrowDown"){const fe=M.key==="ArrowDown"?1:-1;(M.altKey?i.nudgeSelectedAttributes(fe):i.moveAttributeFocus(fe))&&M.preventDefault()}return}const Ve=M.shiftKey?10:1,Ke=M.key==="ArrowLeft"?-Ve:M.key==="ArrowRight"?Ve:0,He=M.key==="ArrowUp"?-Ve:M.key==="ArrowDown"?Ve:0;i.nudgeNodes(J(),Ke,He)&&M.preventDefault();return}if(!(M.metaKey||M.ctrlKey))return;const ke=M.key.toLowerCase();ke==="c"?(ie(),M.preventDefault()):ke==="v"?(Ne(i.paste()),M.preventDefault()):ke==="z"&&(M.shiftKey?i.redo():i.undo(),M.preventDefault())}t.onMounted(async()=>{j(),await t.nextTick(),U(),W(),window.addEventListener("keydown",it),window.addEventListener("pointerup",Q),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",it),window.removeEventListener("pointerup",Q),window.removeEventListener("pointermove",f)});function Q(){h.value=null}function ce(){m.value=!0,g.value=null}function je(){var ke;m.value=!1;const M=(ke=document.elementFromPoint(p.x,p.y))==null?void 0:ke.closest(".vue-flow__node"),w=M==null?void 0:M.dataset.id;if(!w){g.value=null;return}const ne=M.classList.contains("vue-flow__node-group")?"group":M.classList.contains("vue-flow__node-note")?"note":"entity";g.value={kind:ne,id:w}}const lt=t.computed(()=>wy(i.state.logical).map(M=>`${M.consumerRef}>${M.typeRef}:${M.usageCount}`).sort().join("|"));t.watch([()=>i.resolved.value,()=>i.displayMode.value,()=>lt.value],j),t.watch(()=>i.resolved.value,M=>{const w=g.value;if(!w)return;(w.kind==="entity"?M.entities.some(ke=>ke.entity.modelId===w.id):w.kind==="group"?M.groups.some(ke=>ke.group.modelId===w.id):M.notes.some(ke=>ke.note.modelId===w.id))||(g.value=null)});function Xe(M){const w=M.computedPosition??M.position,ne=M.dimensions??{width:0,height:0};return{x:w.x+ne.width/2,y:w.y+ne.height/2}}function _t(M){const w=M.node;if(w){if(g.value=null,w.type==="group"){const ne=i.resolved.value.groups.find(ke=>ke.group.modelId===w.id);_.value=ne?{groupId:w.id,dx:w.position.x-ne.geo.location.x,dy:w.position.y-ne.geo.location.y}:null,h.value=null;return}if(w.type!=="entity"&&w.type!=="note"){h.value=null;return}h.value=de(Xe(w))}}function st(M){var ke;h.value=null,_.value=null;const w=(ke=M.nodes)!=null&&ke.length?M.nodes:[M.node],ne=w.filter(Ce=>(Ce==null?void 0:Ce.type)==="group");if(ne.length){for(const Ce of ne){if(!Ce)continue;const Ve=i.resolved.value.entities.filter(Ke=>Ke.groupRef===Ce.id).map(Ke=>{const He=T(Ke.entity.modelId),fe=(He==null?void 0:He.computedPosition)??(He==null?void 0:He.position)??{x:0,y:0};return{id:Ke.entity.modelId,location:{x:fe.x,y:fe.y}}});i.dragGroup(Ce.id,{x:Ce.position.x,y:Ce.position.y},Ve)}return}for(const Ce of w){if(!Ce||Ce.type==="group")continue;const Ve=Ce.computedPosition??Ce.position,Ke=Ce.dimensions??{width:0,height:0},He={x:Ve.x+Ke.width/2,y:Ve.y+Ke.height/2};Ce.type==="note"?i.dropNote(Ce.id,{x:Ve.x,y:Ve.y},de(He)):i.dropEntity(Ce.id,{x:Ve.x,y:Ve.y},de(He))}}function kt(M){var D,Y,we,Re;if(!i.editable.value)return;const w=((D=O.connectionStartHandle.value)==null?void 0:D.type)==="target"?{source:M.target,sourceHandle:M.targetHandle,target:M.source,targetHandle:M.sourceHandle}:M;if(!w.source||!w.target)return;const ne=((Y=T(w.source))==null?void 0:Y.type)==="note",ke=((we=T(w.target))==null?void 0:we.type)==="note";if(ne||ke){if(ne&&ke)return;const re=ne?w.source:w.target,Ge=ne?w.target:w.source;((Re=T(Ge))==null?void 0:Re.type)==="entity"&&i.addNoteConnection(re,Ge);return}const Ce=re=>{var Ge;return(Ge=i.state.logical.entities.find(ct=>ct.modelId===re))==null?void 0:Ge.stereotype},Ve=Ce(w.source)==="JPA_EMBEDDABLE",Ke=Ce(w.target)==="JPA_EMBEDDABLE";if(Ve||Ke){if(Ve&&Ke)return;const re=Ve?w.source:w.target,Ge=Ve?w.target:w.source;i.addEmbedAssociation(Ge,re);return}const He=Ce(w.source)==="SERIALIZED_TYPE",fe=Ce(w.target)==="SERIALIZED_TYPE";if(He||fe){const re=fe?w.target:w.source,Ge=fe?w.source:w.target;re!==Ge&&i.addSerializedTypeAttribute(Ge,re);return}const qe=re=>re!=null&&re.startsWith("r:")||re!=null&&re.startsWith("l:")?re.slice(2):void 0,We=qe(w.sourceHandle),Je=qe(w.targetHandle);i.addAssociation(w.source,w.target,We,Je)}const Et=t.ref(null);function On(M,w){var ke;const ne=i.state.layout.entityLayouts.find(Ce=>Ce.entityRef===M);return Vt((ke=ne==null?void 0:ne.attributeStyles)==null?void 0:ke[w])}function En(M,w){var ke;const ne=i.state.layout.entityLayouts.find(Ce=>Ce.entityRef===M);return Vt((ke=ne==null?void 0:ne.operationStyles)==null?void 0:ke[w])}function Nt(M){var w;return Vt((w=i.state.layout.groupLayouts.find(ne=>ne.groupRef===M))==null?void 0:w.style)}function ft(M){var w;return Vt((w=i.state.layout.notes.find(ne=>ne.modelId===M))==null?void 0:w.style)}function ht(M){var Ce,Ve;if(M.preventDefault(),!i.editable.value)return;const w=()=>F({x:M.clientX,y:M.clientY}),ne=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const Ke=w();i.addEntity("NewEntity",{x:Ke.x,y:Ke.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const Ke=w();i.addNote("메모",{x:Ke.x,y:Ke.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const Ke=w();i.addEmptyGroup({x:Ke.x,y:Ke.y})}}],ke=(Ce=i.clipboard.value)==null?void 0:Ce.kind;(ke==="entity"||ke==="entities")&&ne.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>Ne(i.paste())}),i.resolved.value.entities.length>0&&ne.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()}),(Ve=Et.value)==null||Ve.open(M,ne)}function St({event:M,node:w}){var fe,qe,We,Je,D,Y,we,Re,re,Ge,ct,Ze,zo,da,yt,zn;const ne=M;if(ne.preventDefault(),!i.editable.value){if(w.type==="group"||w.type==="note")return;const et=(qe=(fe=ne.target)==null?void 0:fe.closest("[data-attr]"))==null?void 0:qe.dataset.attr;if(et){const wt=i.selection.value;(wt==null?void 0:wt.kind)==="attribute"&&wt.entityId===w.id&&wt.ids.includes(et)||i.selectAttribute(w.id,et);const Fn=((We=i.selection.value)==null?void 0:We.kind)==="attribute"&&i.selection.value.entityId===w.id?[...i.selection.value.ids]:[et];(Je=Et.value)==null||Je.open(ne,[{caption:Fn.length>1?i.t("em.ctx.copyN",{n:Fn.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(D=Et.value)==null||D.open(ne,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Ar(a,i,w.id)},Ye(w.id)]);return}if(w.type==="group"){const et=i.isGroupLocked(w.id),wt=[];et||wt.push({type:"swatches",caption:i.t("em.common.color"),current:Nt(w.id),onPick:Fn=>i.setGroupSwatch(w.id,Fn)},{type:"separator"});const xt=Oe()&&he().includes(w.id)?De():Te(w.id);xt.length&&wt.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(xt)}),wt.push({caption:et?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:et?"unlock":"lock",handler:()=>i.setGroupLocked(w.id,!et)}),et||wt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(w.id)}),(Y=Et.value)==null||Y.open(ne,wt);return}if(w.type==="note"){(we=Et.value)==null||we.open(ne,[{type:"swatches",caption:i.t("em.common.color"),current:ft(w.id),onPick:et=>i.setNoteSwatch(w.id,et)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(w.id)}]);return}const ke=(re=(Re=ne.target)==null?void 0:Re.closest("[data-attr]"))==null?void 0:re.dataset.attr;if(ke){const et=i.selection.value;(et==null?void 0:et.kind)==="attribute"&&et.entityId===w.id&&et.ids.includes(ke)||i.selectAttribute(w.id,ke);const xt=((Ge=i.selection.value)==null?void 0:Ge.kind)==="attribute"&&i.selection.value.entityId===w.id?[...i.selection.value.ids]:[ke];if(i.isEntityLocked(w.id)){(ct=Et.value)==null||ct.open(ne,[{caption:xt.length>1?i.t("em.ctx.copyN",{n:xt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const Fn=xt.length>1,Rc=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(w.id)},{type:"swatches",caption:Fn?i.t("em.ctx.colorN",{n:xt.length}):i.t("em.common.color"),current:Fn?null:On(w.id,ke),onPick:EO=>i.setAttributeSwatches(w.id,xt,EO)},{type:"separator"},{caption:Fn?i.t("em.ctx.copyN",{n:xt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],ua=i.clipboard.value;(ua==null?void 0:ua.kind)==="attribute"&&Rc.push({caption:ua.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:ua.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:w.id},i.paste()}}),Rc.push({type:"separator"},{caption:Fn?i.t("em.ctx.deleteAttrN",{n:xt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(w.id,xt)}),(Ze=Et.value)==null||Ze.open(ne,Rc);return}const Ce=(da=(zo=ne.target)==null?void 0:zo.closest("[data-op]"))==null?void 0:da.dataset.op;if(Ce){if(i.isEntityLocked(w.id))return;(yt=Et.value)==null||yt.open(ne,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(w.id)},{type:"swatches",caption:i.t("em.common.color"),current:En(w.id,Ce),onPick:et=>i.setOperationSwatch(w.id,Ce,et)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(w.id,Ce)}]);return}const Ve=i.resolved.value.entities.find(et=>et.entity.modelId===w.id),Ke=!!(Ve!=null&&Ve.locked),He=[{caption:Ke?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Ar(a,i,w.id)}];if(!Ke){He.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(w.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(w.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const wt=H.value.filter(xt=>xt.type==="entity").map(xt=>xt.id);i.createGroup(wt.includes(w.id)&&wt.length?wt:[w.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(w.id,w.id)});const et=i.embeddableCatalog.value;if(et.length){He.push({type:"separator"});for(const wt of et){const xt=Mt(wt.label,i.userLanguage.value)??wt.type;He.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:xt}),icon:"link",handler:()=>i.addPredefinedEmbed(w.id,wt.type)})}}}if(He.push({type:"separator"}),He.push({caption:Ve!=null&&Ve.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Ve!=null&&Ve.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(w.id,!(Ve!=null&&Ve.collapsed))}),Ve!=null&&Ve.groupRef&&!Ke&&He.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(w.id)}),He.push({caption:Ke?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Ke?"unlock":"lock",handler:()=>i.setEntityLocked(w.id,!Ke)}),He.push(Ye(w.id)),!Ke){const et=i.clipboard.value;(et==null?void 0:et.kind)==="attribute"&&He.push({caption:et.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:et.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:w.id},i.paste()}}),He.push({type:"separator"}),He.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(w.id)})}(zn=Et.value)==null||zn.open(ne,He)}function Pn({event:M,edge:w}){var Ve,Ke;const ne=M;if(ne.preventDefault(),!i.editable.value)return;const ke=$(w.id);if(ke){(Ve=Et.value)==null||Ve.open(ne,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(ke.noteRef,ke.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(ke.noteRef,ke.targetRef)}]);return}const Ce=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(w.id)}];i.isAssociationLocked(w.id)||Ce.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(w.id)}),(Ke=Et.value)==null||Ke.open(ne,Ce)}function ut(M){return M==="group"?"group":M==="note"?"note":"entity"}function Be({node:M}){if(H.value.length>1){i.selection.value=null;return}i.selection.value={kind:ut(M.type),id:M.id}}function q({nodes:M}){M.length>1&&(i.selection.value=null)}function Gt({edge:M}){const w=$(M.id);i.selection.value=w?{kind:"note",id:w.noteRef}:{kind:"association",id:M.id}}function K(M){const w=i.selection.value;return!!w&&w.kind!=="attribute"&&w.id===M.id}function oe(M){var w,ne;return K(M)?M.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":M.type==="note"?"var(--em-note-soft)":M.type==="group"?Dp(Vt((w=M.data)==null?void 0:w.style),!0)??"var(--em-mm-group)":Dp(Vt((ne=M.data)==null?void 0:ne.style))??"var(--em-mm-entity)"}function Me(M){return K(M)?"var(--em-selection)":M.type==="note"?"var(--em-note-accent)":M.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ze(M,w){A(M,w,{zoom:P().zoom,duration:350})}t.watch(()=>i.focusRequest.value,M=>{if(!M)return;const w=T(M.id);if(!w)return;const ne=w.computedPosition??w.position,ke=w.dimensions??{width:0,height:0};ze(ne.x+ke.width/2,ne.y+ke.height/2)});function Ct({position:M}){ze(M.x,M.y)}function Tt({node:M}){i.selection.value={kind:ut(M.type),id:M.id};const w=M.computedPosition??M.position,ne=M.dimensions??{width:0,height:0};ze(w.x+ne.width/2,w.y+ne.height/2)}function Ue({node:M}){U({nodes:[M.id],duration:350,maxZoom:1.2,padding:.6})}return(M,w)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(qI),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!le.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(Mn).Loose,"connect-on-click":!1,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:ce,onMoveEnd:je,onConnect:kt,onConnectStart:w[1]||(w[1]=ne=>u.value=!0),onConnectEnd:w[2]||(w[2]=ne=>u.value=!1),onNodeDrag:_t,onNodeDragStop:st,onNodeClick:Be,onEdgeClick:Gt,onSelectionChange:q,onPaneClick:w[3]||(w[3]=ne=>t.unref(i).selection.value=null),onPaneContextMenu:ht,onNodeContextMenu:St,onEdgeContextMenu:Pn},{"node-group":t.withCtx(ne=>[t.createVNode(uh,t.normalizeProps(t.guardReactiveProps(ne)),null,16)]),"node-entity":t.withCtx(ne=>[t.createVNode(dh,t.normalizeProps(t.guardReactiveProps(ne)),null,16)]),"node-note":t.withCtx(ne=>[t.createVNode(mh,t.normalizeProps(t.guardReactiveProps(ne)),null,16)]),"edge-association":t.withCtx(ne=>[t.createVNode(Ah,t.normalizeProps(t.guardReactiveProps(ne)),null,16)]),"edge-note-connection":t.withCtx(ne=>[t.createVNode(e2,t.normalizeProps(t.guardReactiveProps(ne)),null,16)]),"edge-serialized-type":t.withCtx(ne=>[t.createVNode(n2,t.normalizeProps(t.guardReactiveProps(ne)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(UR),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(pA),{"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(Bo),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:Pe},{default:t.withCtx(()=>[t.createVNode(xe,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Bo),{title:t.unref(i).t("em.ctx.addNote"),onClick:Ae},{default:t.withCtx(()=>[t.createVNode(xe,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Bo),{title:t.unref(i).t("em.palette.autoLayout"),onClick:w[0]||(w[0]=ne=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(xe,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(JM),{key:1,pannable:"",width:224,height:160,"node-color":oe,"node-stroke-color":Me,"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:Ct,onNodeClick:Tt,onNodeDblclick:Ue})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ae.value?(t.openBlock(),t.createElementBlock("div",G2,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",Y2,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,q2),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,W2),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,J2)],64)):(t.openBlock(),t.createElementBlock("p",X2,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(j2,{key:1,controller:t.unref(i),onClose:w[4]||(w[4]=ne=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",Z2,[t.createVNode(xe,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",Q2,[t.createElementVNode("strong",eV,t.toDisplayString(d.value.title),1),t.createElementVNode("span",tV,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(f2,{ref_key:"menuRef",ref:Et,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",nV,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-8ad12590"]]),oV={class:"em-explorer em-scroll-overlay"},iV={class:"em-explorer__search"},aV=["placeholder","aria-label"],rV=["aria-label","title"],lV={key:0,class:"em-explorer__empty"},sV=["aria-label"],cV=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],dV=["onClick"],uV=["title"],mV={class:"em-key-slot"},fV={class:"em-key-slot"},pV={class:"em-explorer__label"},hV={key:2,class:"em-explorer__sr"},My=Qe(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=te.useModal(),r=t.computed(()=>{const R=i.resolved.value,N=i.displayMode.value,I=i.userLanguage.value,C=V=>{var L,j;return ya(N,V.name,(L=In(V))==null?void 0:L[I],(j=V.table)==null?void 0:j.physicalName,i.t("em.node.logicalMissing"))},U=N==="PHYSICAL"||N==="LOGICAL_PHYSICAL",A=V=>{const L=V.attrType.startsWith("RELATION")&&V.dbAttrs.length>0;return{icon:V.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:V.identifier,fk:L&&U}}},P=V=>V.attrType.startsWith("EMBED")&&V.dbAttrs.length>0,F=V=>P(V)||Nn(V),H=N==="PHYSICAL"||N==="LOGICAL_PHYSICAL",G=new Map(i.state.logical.entities.map(V=>[V.modelId,V])),le=(V,L)=>{const j=V.dbAttrs[0];return j?Bt(V,j,0,G.get(L),i.state.logical,{embeddableCatalog:i.embeddableCatalog.value}):void 0},se={embeddableCatalog:i.embeddableCatalog.value},ue=new Map,ye=V=>{let L=ue.get(V.modelId);return L||ue.set(V.modelId,L=lo(vn(V,i.state.logical.entities))),L},ae=(V,L)=>{const j=G.get(L);return Nn(V)?V.dbAttrs.map((ee,Z)=>Bt(V,ee,Z,j,i.state.logical)):V.attrType==="EMBED_PREDEF"&&!i.embeddableCatalog.value.some(ee=>ee.type===V.type)?V.dbAttrs:V.dbAttrs.map((ee,Z)=>{const pe=Bt(V,ee,Z,j,i.state.logical,se),me=j?so(pe,ye(j)):null;return me?{...pe,physicalName:me.physicalName}:pe})},Ie=(V,L)=>{const j=_i(V,Ho(i.state.logical),L,i.state.logical);return j.kind==="resolved"?j.entity:void 0},Pe=(V,L,j)=>{var ve,Ee,W,J;const ee={entityId:L,attrId:V.modelId};if(F(V)){const X=fl(N,V,j==null?void 0:j.collection,j==null?void 0:j.targetName,Ie(V));return{key:`attr:${V.modelId}`,label:V.name+(X?` : ${X}`:""),icon:"table",attrRef:ee,focusId:L,matchText:hi(V.name,(ve=Fo(V,V.dbAttrs[0]))==null?void 0:ve[I],(Ee=V.dbAttrs[0])==null?void 0:Ee.physicalName),children:H?ae(V,L).map(he=>{var Te,De;return{key:`attr:${V.modelId}:col:${he.modelId}`,label:ya(N,he.physicalName,(Te=he.logicalName)==null?void 0:Te[I],he.physicalName,i.t("em.node.logicalMissing"))+(he.dataType?` : ${he.dataType}`:""),icon:"field",attrRef:ee,focusId:L,matchText:hi(he.physicalName,(De=he.logicalName)==null?void 0:De[I]),children:[]}}):[]}}const Z=(j==null?void 0:j.collection)??Ei(V,i.state.logical.associations),pe=fl(N,V,Z,j==null?void 0:j.targetName,Ie(V)),me=le(V,L);return{key:`attr:${V.modelId}`,label:ya(N,V.name,(W=Fo(V,me))==null?void 0:W[I],me==null?void 0:me.physicalName,i.t("em.node.logicalMissing"))+(pe?` : ${pe}`:""),...A(V),attrRef:ee,focusId:L,matchText:hi(V.name,(J=Fo(V,me))==null?void 0:J[I],me==null?void 0:me.physicalName),children:[]}},Ae=V=>{var ve,Ee;const L=V.entity,j=N==="CLASS",Z=j||L.attributes.some(Nn)?Ml(L,i.state.logical):void 0,pe=j&&Z?Z.fields.map(W=>W.attr):[...L.attributes].sort((W,J)=>W.order-J.order),me=new Map(((Z==null?void 0:Z.fields)??[]).filter(W=>(j||Nn(W.attr))&&(W.target||W.collection)).map(W=>{var J;return[W.attr.modelId,{targetName:(J=W.target)==null?void 0:J.name,collection:W.collection}]}));return{key:`entity:${L.modelId}`,label:C(L),icon:"table",selectKind:"entity",selectId:L.modelId,focusId:L.modelId,matchText:hi(L.name,(ve=In(L))==null?void 0:ve[I],(Ee=L.table)==null?void 0:Ee.physicalName),children:pe.map(W=>Pe(W,L.modelId,me.get(W.modelId)))}},de=new Map,ge=[];for(const V of R.entities)if(V.groupRef){const L=de.get(V.groupRef)??[];L.push(V),de.set(V.groupRef,L)}else ge.push(V);const _e=[];for(const V of R.groups){const L=V.group;_e.push({key:`group:${L.modelId}`,label:Mt(L.name,I)||L.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:L.modelId,children:(de.get(L.modelId)??[]).map(Ae)})}for(const V of ge)_e.push(Ae(V));if(R.associations.length){const V=new Map(R.entities.map(L=>[L.entity.modelId,C(L.entity)]));_e.push({key:"section:associations",label:i.t("em.explorer.associations",{n:R.associations.length}),icon:"arrow-lr",children:R.associations.map(L=>{const j=L.association,ee=V.get(j.end1.entityRef)??j.end1.entityRef,Z=V.get(j.end2.entityRef)??j.end2.entityRef;return{key:`assoc:${j.modelId}`,label:`${ee} — ${Z}`,icon:"arrow-lr",selectKind:"association",selectId:j.modelId,children:[]}})})}return R.notes.length&&_e.push({key:"section:notes",label:i.t("em.explorer.notes",{n:R.notes.length}),icon:"note",children:R.notes.map(({note:V})=>{var L;return{key:`note:${V.modelId}`,label:((L=V.memo.split(`
73
- `)[0])==null?void 0:L.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:V.modelId,focusId:V.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:_e}});function l(R){return R?R.pk&&R.fk?i.t("em.node.keyPfk"):R.pk?i.t("em.node.keyPk"):R.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const R=[],N=I=>{if(I.children.length){I.key!=="root"&&R.push(I.key);for(const C of I.children)N(C)}};return N(r.value),R}),c=R=>R.startsWith("entity:")||R==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=Cy({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),h=t.ref(null),_=t.computed(()=>f.value.trim().length>0),g=t.computed(()=>{const R=[];if(_.value){const I=R2(r.value,f.value.trim().toLowerCase()),C=(U,A,P,F,H)=>{if(!I.has(U.key))return;R.push({node:U,depth:A,parentKey:P,posinset:F,setsize:H});const G=U.children.filter(le=>I.has(le.key));G.forEach((le,se)=>C(le,A+1,U.key,se+1,G.length))};return C(r.value,0,null,1,1),R}const N=(I,C,U,A,P)=>{R.push({node:I,depth:C,parentKey:U,posinset:A,setsize:P}),d(I.key)||I.children.forEach((F,H)=>N(F,C+1,I.key,H+1,I.children.length))};return N(r.value,0,null,1,1),R}),k=t.ref(null),E=t.ref(null),b=t.computed(()=>{var N;const R=g.value;return E.value&&R.some(I=>I.node.key===E.value)?E.value:((N=R[0])==null?void 0:N.node.key)??null}),v=R=>!_.value&&d(R);async function y(R){var N,I;R&&(E.value=R,await t.nextTick(),(I=(N=k.value)==null?void 0:N.querySelector(`[data-key="${R}"]`))==null||I.focus())}function S(R,N){var U,A,P,F,H;const I=g.value,C=I.findIndex(G=>G.node.key===N.node.key);switch(R.key){case"ArrowDown":R.preventDefault(),y((U=I[C+1])==null?void 0:U.node.key);return;case"ArrowUp":R.preventDefault(),y((A=I[C-1])==null?void 0:A.node.key);return;case"Home":R.preventDefault(),y((P=I[0])==null?void 0:P.node.key);return;case"End":R.preventDefault(),y((F=I[I.length-1])==null?void 0:F.node.key);return;case"ArrowRight":if(R.preventDefault(),!N.node.children.length)return;v(N.node.key)?u(N.node.key):y((H=I[C+1])==null?void 0:H.node.key);return;case"ArrowLeft":R.preventDefault(),N.node.children.length&&!v(N.node.key)?u(N.node.key):y(N.parentKey);return;case"Enter":case" ":R.preventDefault(),T(N.node,R);return;case"F2":R.preventDefault(),x(N.node)}}const $=t.computed(()=>_.value&&g.value.length<=1);function O(R){var C;if(R.key!=="/"||R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;const N=R.target,I=N==null?void 0:N.tagName;I==="INPUT"||I==="TEXTAREA"||I==="SELECT"||N!=null&&N.isContentEditable||(R.preventDefault(),(C=h.value)==null||C.focus())}t.onMounted(()=>window.addEventListener("keydown",O)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",O)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function B(R){const N=i.selection.value;return R.attrRef?(N==null?void 0:N.kind)==="attribute"&&N.entityId===R.attrRef.entityId&&N.ids.includes(R.attrRef.attrId):!!N&&N.kind!=="attribute"&&!!R.selectId&&R.selectKind===N.kind&&R.selectId===N.id}function z(R){const N=i.selection.value;return R.selectKind==="entity"&&(N==null?void 0:N.kind)==="attribute"&&N.entityId===R.selectId}function T(R,N){if(R.attrRef){const I=N.shiftKey?"range":N.metaKey||N.ctrlKey?"toggle":"replace";i.selectAttribute(R.attrRef.entityId,R.attrRef.attrId,I)}else R.selectKind&&R.selectId&&(i.selection.value={kind:R.selectKind,id:R.selectId});R.focusId&&i.requestFocus(R.focusId)}function x(R){R.selectKind==="entity"&&R.selectId&&Ar(a,i,R.selectId)}return(R,N)=>(t.openBlock(),t.createElementBlock("section",oV,[t.createElementVNode("div",iV,[t.createVNode(xe,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":N[0]||(N[0]=I=>f.value=I),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:N[1]||(N[1]=t.withKeys(I=>f.value="",["esc"]))},null,40,aV),[[t.vModelText,f.value]]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:N[2]||(N[2]=I=>f.value="")},[t.createVNode(xe,{name:"x",size:13})],8,rV)):t.createCommentVNode("",!0)]),$.value?(t.openBlock(),t.createElementBlock("p",lV,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:k,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,I=>(t.openBlock(),t.createElementBlock("div",{key:I.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":B(I.node),"is-focus-parent":z(I.node),"is-selectable":!!I.node.selectKind||!!I.node.attrRef||!!I.node.focusId}]),"data-key":I.node.key,role:"treeitem","aria-level":I.depth+1,"aria-posinset":I.posinset,"aria-setsize":I.setsize,"aria-expanded":I.node.children.length?!v(I.node.key):void 0,"aria-selected":B(I.node),tabindex:I.node.key===b.value?0:-1,style:t.normalizeStyle({paddingLeft:4+I.depth*14+"px"}),onClick:C=>T(I.node,C),onDblclick:C=>x(I.node),onFocus:C=>E.value=I.node.key,onKeydown:C=>S(C,I)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!I.node.children.length,"is-open":!v(I.node.key)}]),onClick:t.withModifiers(C=>I.node.children.length&&t.unref(u)(I.node.key),["stop"])},[I.node.children.length?(t.openBlock(),t.createBlock(xe,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,dV),I.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(I.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",mV,[I.node.keyMarks.pk?(t.openBlock(),t.createBlock(xe,{key:0,name:"key",size:14,class:"em-key is-pk"})):I.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(xe,{key:1,class:"em-explorer__icon",name:I.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",fV,[I.node.keyMarks.fk?(t.openBlock(),t.createBlock(xe,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,uV)):(t.openBlock(),t.createBlock(xe,{key:1,class:"em-explorer__icon",name:I.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",pV,t.toDisplayString(I.node.label),1),l(I.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",hV,t.toDisplayString(l(I.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,cV))),128))],8,sV)]))}}),[["__scopeId","data-v-ffebc201"]]),yV={class:"em-text-export"},gV=["id","aria-selected","tabindex","onClick"],bV=["aria-labelledby"],_V={class:"em-text-export__actions"},kV=Qe(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(m,p)=>rn(n.locale??"ko",m,p),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var p,f;a.value=m,await t.nextTick(),(f=(p=l.value)==null?void 0:p.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const p=n.formats.length;p&&s((a.value+m+p)%p)}async function d(){try{await navigator.clipboard.writeText(r().content),te.showNotification(i("em.export.copied"),"info")}catch{te.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),p=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(p);try{const h=document.createElement("a");h.href=f,h.download=m.filename,document.body.appendChild(h),h.click(),h.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",yV,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,h)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${h}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":h===a.value}]),"aria-selected":h===a.value,"aria-controls":"em-text-export-panel",tabindex:h===a.value?0:-1,onClick:_=>a.value=h,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(_=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(_=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(_=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(_=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,gV))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,bV),t.createElementVNode("div",_V,[t.createVNode(t.unref(te.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),EV={class:"em-text-import"},NV=["aria-label"],wV=["aria-checked","tabindex","onClick"],IV=["placeholder"],vV={class:"em-text-import__status"},CV={class:"em-text-import__ok"},SV={key:0,class:"em-text-import__warn"},xV={key:1,class:"em-text-import__err"},RV={key:2,class:"em-text-import__err"},AV={key:3,class:"em-text-import__err"},$V={class:"em-text-import__actions"},TV=Qe(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(_,g)=>rn(n.locale??"ko",_,g),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(_){var k,E;const g=l[(_+l.length)%l.length];g&&(r.value=g.key,await t.nextTick(),(E=(k=s.value)==null?void 0:k.querySelectorAll('[role="radio"]')[l.indexOf(g)])==null||E.focus())}function d(_){c(l.findIndex(g=>g.key===r.value)+_)}function u(_){return _?_.startsWith("{")?"json":/\berdiagram\b/i.test(_)?"mermaid":/\bcreate\s+table\b/i.test(_)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const _=a.value.trim();if(!_)return{status:"empty"};const g=m.value;if(!g)return{status:"unknown"};try{let k,E=[];return g==="json"?k=kd(_):g==="mermaid"?k=ud(_):(k=hd(_),E=_l(_).warnings),k.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:k,warnings:E}}catch(k){return{status:"error",message:k instanceof Error?k.message:String(k)}}}),f=t.computed(()=>p.value.status==="ok");function h(){const _=p.value;_.status!=="ok"||!_.source||(n.onImport(_.source),o.close())}return(_,g)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",EV,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,k=>t.createElementVNode("button",{key:k.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":k.key===r.value}]),"aria-checked":k.key===r.value,tabindex:k.key===r.value?0:-1,onClick:E=>r.value=k.key,onKeydown:[g[0]||(g[0]=t.withKeys(t.withModifiers(E=>d(-1),["prevent"]),["left"])),g[1]||(g[1]=t.withKeys(t.withModifiers(E=>d(1),["prevent"]),["right"])),g[2]||(g[2]=t.withKeys(t.withModifiers(E=>c(0),["prevent"]),["home"])),g[3]||(g[3]=t.withKeys(t.withModifiers(E=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(k.labelKey)),43,wV)),64))],8,NV),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":g[4]||(g[4]=k=>a.value=k),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,IV),[[t.vModelText,a.value]]),t.createElementVNode("div",vV,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",CV,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:p.value.source.logical.entities.length,relations:p.value.source.logical.associations.length})),1),p.value.warnings&&p.value.warnings.length?(t.openBlock(),t.createElementBlock("span",SV," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:p.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):p.value.status==="error"?(t.openBlock(),t.createElementBlock("span",xV,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",RV,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",AV,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",$V,[t.createVNode(t.unref(te.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:h},null,8,["caption","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:g[5]||(g[5]=k=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),MV={class:"em-toolbar"},VV=["title"],LV={class:"em-toolbar__mode"},Vy=Qe(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=te.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:h=>i.displayMode.value=h});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const h=i.resolved.value.entities;return h.length>0&&h.every(_=>_.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const h=hl(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:kV,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:nd(h,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:yl(h,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:yl(h,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:yd(h,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:_d(h,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:TV,bind:{locale:i.uiLocale.value,onImport:h=>{i.importEntities(h,h.logical.entities.map(_=>_.modelId))}}})}function f(){r.openModal({component:$y,bind:{locale:i.uiLocale.value}})}return(h,_)=>(t.openBlock(),t.createElementBlock("div",MV,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,VV)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:_[0]||(_[0]=g=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(xe,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:_[1]||(_[1]=g=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(xe,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),_[9]||(_[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",LV,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":_[2]||(_[2]=g=>s.value=g),items:l,"value-provider":g=>g.v,"label-provider":g=>t.unref(i).t(g.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(xe,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:_[3]||(_[3]=g=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(xe,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:_[4]||(_[4]=g=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(xe,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(xe,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),_[10]||(_[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:p},{left:t.withCtx(()=>[t.createVNode(xe,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(xe,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:_[5]||(_[5]=g=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(xe,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:_[6]||(_[6]=g=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(xe,{name:"camera",size:16})]),_:1},8,["tooltip"]),_[11]||(_[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:_[7]||(_[7]=g=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(xe,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),_[8]||(_[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(xe,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),BV=["title"],DV=["title"],OV=["disabled","aria-pressed"],PV=["disabled","aria-pressed"],zV=Qe(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=>rn(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(xe,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,BV)):(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(xe,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,OV),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(xe,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,PV)],10,DV))}}),[["__scopeId","data-v-2b5162b7"]]),FV=["disabled"],UV={class:"em-panel__sub"},HV={class:"em-nav"},jV={key:0,class:"em-nav__divider","aria-hidden":"true"},KV={key:1},GV=["onClick","onKeydown"],YV={class:"em-nav__name"},qV=["title"],WV={key:0,class:"em-panel__note"},JV=["data-attr-block"],XV={key:0,class:"em-embed-col__label"},ZV={class:"em-attr__row"},QV=["title"],eL={key:1,class:"em-attr__row"},tL={key:2,class:"em-embed-cols"},nL={class:"em-embed-col"},oL={class:"em-embed-col__label"},iL={class:"em-attr__row"},aL={class:"em-attr__navhint"},rL={key:3,class:"em-attr__navhint"},lL={class:"em-attr__navhint"},sL={class:"em-attr__row"},cL={class:"em-field"},dL={key:0,class:"em-attr__navhint"},uL={class:"em-attr__row"},mL={class:"em-attr__row"},fL=["title"],pL={class:"em-attr__flags"},hL={class:"em-attr__pii"},yL={class:"em-attr__pii"},gL={key:1,class:"em-attr__pii"},bL={key:2,class:"em-attr__pii em-attr__codetop"},_L={class:"em-multilang"},kL={key:6,class:"em-embed-cols"},EL={key:0,class:"em-attr__navhint"},NL={class:"em-embed-col__label"},wL={class:"em-attr__row"},IL=["title"],vL=["title"],CL=["title"],SL={class:"em-attr__row"},xL={key:0,class:"em-embed-upd"},RL={key:1,class:"em-attr__navhint"},AL={class:"em-embed-upd"},$L={class:"em-embed-upd"},TL={class:"em-embed-upd"},ML={class:"em-attr__flags"},VL={class:"em-multilang"},LL={class:"em-swatch__row em-attr__swatch"},BL=["title","onClick"],DL=["title","onClick"],OL={key:0,class:"em-attr__swatch-hint"},PL=Qe(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isValueType:a,isColumnless:r,focusedAttrIds:l,personalInfoItems:s,piiLabel:c,idn:d,setAttrLogical:u,SERIALIZED_FIELD_CONTAINERS:m,setCollectionType:p,setAttr:f,isDerivedIdRow:h,rowName:_,rowNamePlaceholder:g,setRowName:k,assocFieldName:E,setAssocFieldName:b,nameLocked:v,nameLockedHint:y,isManagedFk:S,setNaturalId:$,setIdentifier:O,setTransient:B,dbLocked:z,fkDerived:T,fkOriginPhysical:x,typeLocked:R,typeValueOf:N,typeLabelOf:I,setAttrType:C,setAttrCustomType:U,setDb:A,scaleApplicable:P,scaleHint:F,setDbLogical:H,logicalPlaceholder:G,setAttrDescription:le,attrPiiValue:se,setAttrPii:ue,predefinedCustomTypeCatalog:ye,serializedTypeNames:ae,embeddableCatalog:Ie,predefinedLabel:Pe,groupCodeCatalog:Ae,attrGroupCodes:de,attrCodeItems:ge,codeValueOf:_e,codeLabelOf:V,setAttrGroupCode:L,setAttrCode:j,setAttrDefaultValue:ee,hasColumnSlots:Z,isMultiColFk:pe,setDbAt:me,setDbLogicalAt:ve,colSlotMeta:Ee,fixedDataType:W,fixedLength:J,fixedScale:X,slotFixedHint:he,updatableItems:Te,updatableLabel:De,updatableValue:Oe,setUpdatableAt:ie,setUpdatable:Ne,insertableItems:Ye,insertableLabel:it,insertableValue:Q,setInsertableAt:ce,setInsertable:je,notNullItems:lt,notNullLabel:Xe,notNullValue:_t,setNotNullAt:st,sharedItems:kt,sharedLabel:Et,sharedValue:On,setSharedAt:En,isShared:Nt,sharedPhysical:ft}=zp(o,()=>n.entityId),ht=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Ue=>Ue.entityRef===i.value.modelId)??null:null),St=t.computed(()=>{var Ue;return((Ue=i.value)==null?void 0:Ue.attributes.filter(M=>M.attrType!=="DIVIDER"))??[]}),Pn=t.computed(()=>{var Ue;return((Ue=i.value)==null?void 0:Ue.attributes)??[]}),ut=t.computed(()=>St.value.filter(Ue=>l.value.has(Ue.modelId)));function Be(Ue){return{pk:Ue.identifier,fk:Ue.attrType.startsWith("RELATION")&&Ue.dbAttrs.length>0,required:Ue.notNull&&!Ue.identifier}}function q(Ue){const M=Be(Ue),w=[M.pk&&"PK",M.fk&&"FK",M.required&&"NOT NULL"].filter(Boolean);return w.length?w.join(" · "):void 0}function Gt(Ue,M){i.value&&o.selectAttribute(i.value.modelId,Ue.modelId,M.shiftKey?"range":M.metaKey||M.ctrlKey?"toggle":"replace")}function K(Ue){var M,w;return Vt((w=(M=ht.value)==null?void 0:M.attributeStyles)==null?void 0:w[Ue.modelId])}function oe(Ue){return l.value.size>1&&l.value.has(Ue.modelId)}function Me(Ue,M){if(!i.value)return;const w=oe(Ue)?o.selectedAttrIds.value:[Ue.modelId];o.setAttributeSwatches(i.value.modelId,w,M)}const ze=t.ref(void 0);function Ct(Ue){if(!Ue||!i.value)return;const M=o.addPredefinedEmbed(i.value.modelId,Ue);M&&o.selectAttribute(i.value.modelId,M),ze.value=void 0}function Tt(){if(!i.value)return;const Ue=o.addAttribute(i.value.modelId);Ue&&o.selectAttribute(i.value.modelId,Ue)}return(Ue,M)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",UV,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:St.value.length}))+" ",1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Tt},null,8,["caption"]),t.unref(Ie).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":ze.value,items:t.unref(Ie),"value-provider":w=>w.type,"label-provider":t.unref(Pe),"onUpdate:modelValue":Ct},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",HV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Pn.value,w=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:w.modelId},[w.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",jV,[...M[0]||(M[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",KV,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(l).has(w.modelId)}]),role:"button",tabindex:"0",onClick:ne=>Gt(w,ne),onKeydown:[t.withKeys(t.withModifiers(ne=>Gt(w,ne),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ne=>Gt(w,ne),["prevent"]),["space"])]},[t.createElementVNode("span",YV,t.toDisplayString(w.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:q(w)},[Be(w).pk?(t.openBlock(),t.createBlock(xe,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):Be(w).required?(t.openBlock(),t.createBlock(xe,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),Be(w).fk?(t.openBlock(),t.createBlock(xe,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,qV)],42,GV)]))],64))),128))]),St.value.length&&!ut.value.length?(t.openBlock(),t.createElementBlock("p",WV,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ut.value,w=>{var ne,ke,Ce,Ve,Ke,He,fe,qe,We,Je;return t.openBlock(),t.createElementBlock("div",{key:w.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(l).has(w.modelId)}]),"data-attr-block":w.modelId},[t.unref(h)(w)?(t.openBlock(),t.createElementBlock("span",XV,t.toDisplayString(t.unref(o).t("em.attr.derivedIdField")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",ZV,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-name-${w.modelId}`,width:"100%",disabled:t.unref(v)(w),title:t.unref(v)(w)?t.unref(y)(w):t.unref(h)(w)?t.unref(o).t("em.attr.derivedIdNote"):void 0,placeholder:t.unref(g)(w),"model-value":t.unref(_)(w),"onUpdate:modelValue":D=>t.unref(k)(w,D)},null,8,["name","disabled","title","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-type-${w.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:t.unref(R)(w),items:t.unref(qc)(w.type,t.unref(ye),t.unref(ae),t.unref(Ie)),"value-provider":t.unref(N),"label-provider":t.unref(I),"model-value":w.type,"onUpdate:modelValue":D=>t.unref(C)(w,D)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(S)(w)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:D=>t.unref(o).removeAttribute(t.unref(i).modelId,w.modelId)},null,8,["onClick"])],8,QV)]),w.type===t.unref(dn)&&!t.unref(T)(w)?(t.openBlock(),t.createElementBlock("div",eL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-customtype-${w.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":w.customType??"","onUpdate:modelValue":D=>t.unref(U)(w,D)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(h)(w)?(t.openBlock(),t.createElementBlock("div",tL,[t.createElementVNode("div",nL,[t.createElementVNode("span",oL,t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("div",iL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-assocname-${w.modelId}`,width:"100%",title:t.unref(o).t("em.attr.derivedIdNote"),placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(E)(w),"onUpdate:modelValue":D=>t.unref(b)(w,D)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("p",aL,t.toDisplayString(t.unref(o).t("em.attr.derivedIdNote")),1)])])):t.createCommentVNode("",!0),w.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",rL,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.createCommentVNode("",!0),t.unref(r)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[t.createElementVNode("p",lL,t.toDisplayString(t.unref(o).t("em.attr.serializedNoColumnNote")),1),t.createElementVNode("div",sL,[t.createVNode(Jt,{class:"grow",name:`attr-field-logical-${w.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":w.fieldLogicalName,"onUpdate:modelValue":D=>t.unref(u)(w,D)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",cL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.serializedContainer")),1),t.createVNode(t.unref(te.BSSelect),{name:`attr-container-${w.modelId}`,width:"100%",items:[...t.unref(m)],"value-provider":t.unref(d),"label-provider":D=>D==="none"?t.unref(o).t("em.attr.serializedContainerNone"):D,"model-value":w.collectionType??"none","onUpdate:modelValue":D=>D&&t.unref(p)(w,D)},null,8,["name","items","value-provider","label-provider","model-value","onUpdate:modelValue"])])],64)):t.unref(Z)(w)?(t.openBlock(),t.createElementBlock("div",kL,[t.unref(pe)(w)?(t.openBlock(),t.createElementBlock("p",EL,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.dbAttrs,(D,Y)=>{var we,Re,re,Ge,ct;return t.openBlock(),t.createElementBlock("div",{key:D.modelId,class:"em-embed-col"},[t.createElementVNode("span",NL,t.toDisplayString(((we=t.unref(Ee)(w,Y))==null?void 0:we.name)??((Re=t.unref(Ee)(w,Y))==null?void 0:Re.physicalName)??t.unref(o).t("em.attr.colFallback",{n:Y+1})),1),t.createElementVNode("div",wL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`embed-col-${D.modelId}`,width:"100%",disabled:t.unref(Nt)(D),placeholder:((re=t.unref(Ee)(w,Y))==null?void 0:re.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Nt)(D)?t.unref(ft)(D):D.physicalName,"onUpdate:modelValue":Ze=>t.unref(me)(w,Y,{physicalName:Ze})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(he)(w)},[t.createVNode(t.unref(te.BSTextInput),{name:`embed-dtype-${D.modelId}`,width:"84px",disabled:"","model-value":t.unref(W)(w,Y)},null,8,["name","model-value"])],8,IL),t.createElementVNode("span",{title:t.unref(he)(w)},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-len-${D.modelId}`,width:"48px",disabled:"","model-value":t.unref(J)(w,Y)},null,8,["name","model-value"])],8,vL),t.createElementVNode("span",{title:t.unref(he)(w)},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-scale-${D.modelId}`,width:"48px",disabled:"","model-value":t.unref(X)(w,Y)},null,8,["name","model-value"])],8,CL)]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":D.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",SL,[t.createVNode(Jt,{class:"grow",name:`embed-logical-${D.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(Mt)((Ge=t.unref(Ee)(w,Y))==null?void 0:Ge.logicalName,t.unref(o).userLanguage.value)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":D.logicalName,"onUpdate:modelValue":Ze=>t.unref(ve)(w,Y,Ze)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(ct=t.unref(Ee)(w,Y))!=null&&ct.shareable?(t.openBlock(),t.createElementBlock("label",xL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"110px","model-value":t.unref(On)(D),items:t.unref(kt)(),"value-provider":t.unref(d),"label-provider":t.unref(Et),"onUpdate:modelValue":Ze=>Ze&&t.unref(En)(w,Y,Ze)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(Nt)(D)?(t.openBlock(),t.createElementBlock("p",RL,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",AL,[M[3]||(M[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(Nt)(D),"model-value":t.unref(Nt)(D)?"false":t.unref(Q)(D),items:t.unref(Ye),"value-provider":t.unref(d),"label-provider":t.unref(it),"onUpdate:modelValue":Ze=>Ze&&t.unref(ce)(w,Y,Ze)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",$L,[M[4]||(M[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(Nt)(D),"model-value":t.unref(Nt)(D)?"false":t.unref(Oe)(D),items:t.unref(Te),"value-provider":t.unref(d),"label-provider":t.unref(De),"onUpdate:modelValue":Ze=>Ze&&t.unref(ie)(w,Y,Ze)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",TL,[M[5]||(M[5]=t.createElementVNode("span",null,"NOT NULL",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(Nt)(D)||t.unref(z)(w)||t.unref(T)(w),"model-value":t.unref(_t)(D),items:t.unref(lt),"value-provider":t.unref(d),"label-provider":t.unref(Xe),"onUpdate:modelValue":Ze=>Ze&&t.unref(st)(w,Y,Ze)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128)),t.unref(pe)(w)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",ML,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${w.modelId}`,label:"Primary Key","model-value":w.identifier,disabled:"","onUpdate:modelValue":D=>t.unref(O)(w,D)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${w.modelId}`,label:"Not Null","model-value":w.notNull,disabled:"","onUpdate:modelValue":D=>t.unref(f)(w,{notNull:D})},null,8,["name","model-value","onUpdate:modelValue"])]),t.createElementVNode("fieldset",VL,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`attr-desc-${w.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":w.description,"onUpdate:modelValue":D=>t.unref(le)(w,D)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[t.unref(T)(w)?(t.openBlock(),t.createElementBlock("p",dL,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",uL,[t.createVNode(Jt,{class:"grow",name:`attr-logical-${w.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(G)(w,t.unref(o).userLanguage.value),"model-value":(ne=w.dbAttrs[0])==null?void 0:ne.logicalName,"onUpdate:modelValue":D=>t.unref(H)(w,D)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",mL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-col-${w.modelId}`,width:"100%",placeholder:t.unref(x)(w)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(z)(w),"model-value":((ke=w.dbAttrs[0])==null?void 0:ke.physicalName)??"","onUpdate:modelValue":D=>t.unref(A)(w,{physicalName:D})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-dtype-${w.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(z)(w)||t.unref(T)(w),items:t.unref(Uc)(((Ce=w.dbAttrs[0])==null?void 0:Ce.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(d),"label-provider":t.unref(ll),"model-value":((Ve=w.dbAttrs[0])==null?void 0:Ve.dataType)??"","onUpdate:modelValue":D=>D&&t.unref(A)(w,{dataType:D})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSNumberInput),{name:`attr-len-${w.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(z)(w)||t.unref(T)(w),"model-value":(Ke=w.dbAttrs[0])==null?void 0:Ke.length,"onUpdate:modelValue":D=>t.unref(A)(w,{length:D||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(F)(w)},[t.createVNode(t.unref(te.BSNumberInput),{name:`attr-scale-${w.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(z)(w)||t.unref(T)(w)||!t.unref(P)(w),"model-value":(He=w.dbAttrs[0])==null?void 0:He.scale,"onUpdate:modelValue":D=>t.unref(A)(w,{scale:D||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,fL)]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":(fe=w.dbAttrs[0])==null?void 0:fe.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",pL,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${w.modelId}`,label:"Primary Key","model-value":w.identifier,disabled:t.unref(a)||t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(O)(w,D)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${w.modelId}`,label:"Not Null","model-value":w.notNull,disabled:t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(f)(w,{notNull:D})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-uq-${w.modelId}`,label:"Unique","model-value":!!((qe=w.dbAttrs[0])!=null&&qe.unique),disabled:t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(A)(w,{unique:D})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-ai-${w.modelId}`,label:"Auto Increment","model-value":!!((We=w.dbAttrs[0])!=null&&We.autoIncrement),disabled:t.unref(z)(w)||t.unref(T)(w)||!w.identifier,"onUpdate:modelValue":D=>t.unref(A)(w,{autoIncrement:D})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-tr-${w.modelId}`,label:"@Transient","model-value":!!w.transient,disabled:w.identifier||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(B)(w,D)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nid-${w.modelId}`,label:"@NaturalId","model-value":!!w.naturalId,disabled:w.identifier||t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref($)(w,D)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${w.modelId}`,label:"mutable","model-value":!!w.naturalIdMutable,disabled:t.unref(z)(w)||!w.naturalId,"onUpdate:modelValue":D=>t.unref(f)(w,{naturalIdMutable:D||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-mv-${w.modelId}`,label:"Multi-Value (Set)","model-value":!!((Je=w.dbAttrs[0])!=null&&Je.multiValue),disabled:t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(A)(w,{multiValue:D||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",hL,[M[1]||(M[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(z)(w),"model-value":t.unref(Q)(w.dbAttrs[0]),items:t.unref(Ye),"value-provider":t.unref(d),"label-provider":t.unref(it),"onUpdate:modelValue":D=>D&&t.unref(je)(w,D)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",yL,[M[2]||(M[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(z)(w),"model-value":t.unref(Oe)(w.dbAttrs[0]),items:t.unref(Te),"value-provider":t.unref(d),"label-provider":t.unref(De),"onUpdate:modelValue":D=>D&&t.unref(Ne)(w,D)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(T)(w)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",gL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":t.unref(se)(w),items:t.unref(s),"value-provider":t.unref(d),"label-provider":t.unref(c),"onUpdate:modelValue":D=>D&&t.unref(ue)(w,D)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(Ae).length&&!t.unref(T)(w)?(t.openBlock(),t.createElementBlock("label",bL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Kp,{"model-value":w.groupCode,items:t.unref(Ae),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":D=>t.unref(L)(w,D)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(T)(w)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(Ae).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(de)(w).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"100%","model-value":w.defaultValue??"none",items:t.unref(ge)(w),"value-provider":t.unref(_e),"label-provider":t.unref(V),"onUpdate:modelValue":D=>D&&t.unref(j)(w,D)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`attr-default-${w.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":w.defaultValue??"","onUpdate:modelValue":D=>t.unref(ee)(w,D)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",_L,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`attr-desc-${w.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":w.description,"onUpdate:modelValue":D=>t.unref(le)(w,D)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",LL,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":K(w)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:D=>Me(w,null)},"∅",10,BL),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),D=>(t.openBlock(),t.createElementBlock("button",{key:D,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":K(w)===D}]),style:t.normalizeStyle({background:t.unref(ci)(D)}),title:t.unref(o).t(t.unref(Mo)(D)),onClick:Y=>Me(w,D)},null,14,DL))),128)),oe(w)?(t.openBlock(),t.createElementBlock("span",OL,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(l).size})),1)):t.createCommentVNode("",!0)])],10,JV)}),128))],8,FV)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-787f788f"]]),zL=["disabled"],FL={class:"em-panel__sub-label"},UL={class:"em-attr__row"},HL={class:"em-field em-idx-params"},jL=["value","placeholder","onChange"],KL=Qe(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(y=>y.modelId===o.entityId)??null),l=t.computed(()=>r.value?gi(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var y;return io(((y=r.value)==null?void 0:y.attributes)??[])}),c=y=>s.value.canon(y),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>[...Wp(d.value).map(y=>({value:y.ref,label:y.label})),...l.value.map(y=>({value:y.modelId,label:a.t("em.index.inherited",{field:y.field})}))]);function m(y,S){var z;const $=new Set(y.columns.filter((T,x)=>x!==S).map(T=>c(T.columnRef))),O=u.value.filter(T=>!$.has(c(T.value))),B=(z=y.columns[S])==null?void 0:z.columnRef;return B&&!O.some(T=>T.value===B)&&O.push({value:B,label:p(B)}),O}function p(y){return Xs(y,d.value)}function f(y){const S=new Set(y.columns.map($=>c($.columnRef)));return u.value.filter($=>!S.has(c($.value)))}function h(){var S;if(!r.value)return;const y=u.value[0];a.addIndex(r.value.modelId,{modelId:Le(),name:`idx_${(((S=r.value.indexes)==null?void 0:S.length)??0)+1}`,unique:!1,columns:y?[{columnRef:y.value,descending:!1}]:[]})}function _(y,S){r.value&&a.updateIndex(r.value.modelId,y,S)}function g(y){const S=f(y)[0];S&&_(y.modelId,{columns:[...y.columns,{columnRef:S.value,descending:!1}]})}function k(y,S,$){_(y.modelId,{columns:y.columns.map((O,B)=>B===S?{...O,columnRef:$}:O)})}function E(y,S,$){_(y.modelId,{columns:y.columns.map((O,B)=>B===S?{...O,descending:$}:O)})}function b(y,S){_(y.modelId,{columns:y.columns.filter(($,O)=>O!==S)})}function v(y,S){_(y.modelId,{parameters:S.trim()===""?void 0:S})}return(y,S)=>{var $;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:S[0]||(S[0]=O=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",FL,[e.collapsible?(t.openBlock(),t.createBlock(xe,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:(($=r.value.indexes)==null?void 0:$.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(h,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],O=>(t.openBlock(),t.createElementBlock("div",{key:O.modelId,class:"em-attr"},[t.createElementVNode("div",UL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`idx-name-${O.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":O.name,"onUpdate:modelValue":B=>_(O.modelId,{name:B})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-uq-${O.modelId}`,class:"em-check",label:"UQ","model-value":O.unique,"onUpdate:modelValue":B=>_(O.modelId,{unique:B})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:B=>t.unref(a).removeIndex(r.value.modelId,O.modelId)},null,8,["onClick"])]),t.createVNode(Vo,{controller:t.unref(a),"ref-id":O.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.columns,(B,z)=>(t.openBlock(),t.createElementBlock("div",{key:z,class:"em-attr__row"},[t.createVNode(t.unref(te.BSSelect),{class:"grow","model-value":B.columnRef,items:m(O,z),"value-provider":T=>T.value,"label-provider":T=>T.label,"onUpdate:modelValue":T=>T&&k(O,z,T)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-${O.modelId}-desc-${z}`,class:"em-check",label:"DESC","model-value":B.descending,"onUpdate:modelValue":T=>E(O,z,T)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:"−",onClick:T=>b(O,z)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(O).length,onClick:B=>g(O)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",HL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:O.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:B=>v(O,B.target.value)},null,40,jL)])]))),128)):t.createCommentVNode("",!0)],8,zL)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-ee0032b1"]]),GL=["disabled"],YL={class:"em-panel__sub-label"},qL={class:"em-attr__row"},WL={class:"em-attr__row"},JL={class:"em-multilang"},XL={class:"em-attr__pii"},ZL={class:"em-swatch__row em-attr__swatch"},QL=["title","onClick"],eB=["title","onClick"],tB=Qe(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=te.useModal(),l=t.computed(()=>a.state.logical.entities.find(b=>b.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(b=>b.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(b){return b==="none"?a.t("em.common.noneParen"):b}const m=b=>b;function p(b,v){l.value&&a.updateOperation(l.value.modelId,b.modelId,v)}function f(b,v){p(b,{description:Object.keys(v).length?v:void 0})}function h(b){return b.personalInfoAttributeType??"none"}function _(b,v){p(b,{personalInfoAttributeType:v==="none"?void 0:v})}function g(b){var v,y;return Vt((y=(v=s.value)==null?void 0:v.operationStyles)==null?void 0:y[b.modelId])}function k(b,v){l.value&&a.setOperationSwatch(l.value.modelId,b.modelId,v)}function E(b){r.openModal({component:Jp,bind:{operationName:b.name,sourceCode:b.sourceCode??"",locale:a.uiLocale.value,onSave:v=>p(b,{sourceCode:v})}})}return(b,v)=>{var y;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:v[1]||(v[1]=S=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",YL,[e.collapsible?(t.openBlock(),t.createBlock(xe,{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:((y=l.value.operations)==null?void 0:y.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:v[0]||(v[0]=t.withModifiers(S=>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??[],S=>(t.openBlock(),t.createElementBlock("div",{key:S.modelId,class:"em-attr"},[t.createElementVNode("div",qL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":S.name,"onUpdate:modelValue":$=>p(S,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":$=>$&&p(S,{visibility:$})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>t.unref(a).removeOperation(l.value.modelId,S.modelId)},null,8,["onClick"])]),t.createElementVNode("div",WL,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t(S.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:$=>E(S)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",JL,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`op-desc-${S.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":$=>f(S,$)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",XL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":h(S),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":$=>$&&_(S,$)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",ZL,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(S)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:$=>k(S,null)},"∅",10,QL),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":g(S)===$}]),style:t.normalizeStyle({background:t.unref(ci)($)}),title:t.unref(a).t(t.unref(Mo)($)),onClick:O=>k(S,$)},null,14,eB))),128))])]))),128)):t.createCommentVNode("",!0)],8,GL)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),nB=["title"],oB={class:"em-panel__head"},iB={class:"em-panel__head-row"},aB=["title"],rB={class:"em-panel__context"},lB={key:0,class:"em-panel__lock"},sB=["disabled"],cB={key:0,class:"em-attr__navhint"},dB={key:0,class:"em-panel__note"},uB={key:1,class:"em-panel__note"},mB={key:2,class:"em-jpa"},fB={class:"em-field"},pB={class:"em-field"},hB={class:"em-field"},yB={key:0,class:"em-field"},gB={class:"em-panel__note"},bB={class:"em-panel__sub"},_B={class:"em-field"},kB={class:"em-field"},EB={class:"em-jpa"},NB={key:0,class:"em-panel__note"},wB={key:1,class:"em-panel__note"},IB={class:"em-jpa"},vB={class:"em-field"},CB={key:0,class:"em-panel__note"},SB={class:"em-field"},xB={class:"em-multilang"},RB={class:"em-field"},AB=["value"],$B={class:"em-field"},TB={class:"em-swatch"},MB={class:"em-swatch__row"},VB=["title"],LB=["title","onClick"],BB={class:"em-panel__note"},DB={class:"em-field"},OB=["value"],PB={class:"em-swatch"},zB={class:"em-swatch__row"},FB=["title"],UB=["title","onClick"],Ly=Qe(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var W;return(W=r.value)==null?void 0:W.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const W=c.value;return W?l.state.logical.entities.find(J=>J.modelId===W)??null:null}),u=t.computed(()=>{const W=s.value;if((W==null?void 0:W.kind)==="association")return l.isAssociationLocked(W.id);const J=c.value;return!!J&&l.isEntityLocked(J)}),m=t.computed(()=>{var W;return((W=l.selectedAttr.value)==null?void 0:W.attrId)??null}),p=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),h=t.ref({});t.watch(f,()=>{h.value={}});function _(W){return h.value[W]??f.value}function g(W){h.value={...h.value,[W]:!_(W)}}const k=t.computed(()=>{var X;const W=d.value;if(!W)return l.t("em.entity.fallback");const J=(X=W.table)==null?void 0:X.physicalName;return J?`${W.name} (${J})`:W.name}),E=t.computed(()=>{const W=s.value;return(W==null?void 0:W.kind)==="association"?l.state.logical.associations.find(J=>J.modelId===W.id)??null:null}),b=t.computed(()=>{const W=s.value;return(W==null?void 0:W.kind)==="group"?l.state.logical.groups.find(J=>J.modelId===W.id)??null:null}),v=t.computed(()=>{const W=s.value;return(W==null?void 0:W.kind)==="note"?l.state.layout.notes.find(J=>J.modelId===W.id)??null:null}),y=t.computed(()=>{var J,X;const W=(J=b.value)==null?void 0:J.name;return Mt(W,l.userLanguage.value)||((X=b.value)==null?void 0:X.packageName)||l.t("em.group.fallback")}),S=t.computed(()=>{if(d.value){const W=p.value.size;if(W>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:W});if(m.value){const J=d.value.attributes.find(X=>X.modelId===m.value);return(J==null?void 0:J.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(J==null?void 0:J.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(E.value){const W=J=>{var X;return((X=l.state.logical.entities.find(he=>he.modelId===J))==null?void 0:X.name)??J};return l.t("em.inspector.ctxAssoc",{a:W(E.value.end1.entityRef),b:W(E.value.end2.entityRef)})}return b.value?l.t("em.inspector.ctxGroup",{name:y.value}):v.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),$=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],O=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],B={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},z=W=>{const J=B[W];return J?l.t(J):W},T=W=>{var J;return((J=l.state.logical.entities.find(X=>X.modelId===W))==null?void 0:J.name)??W},x=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],R=["LIST","SET"],N=["inherit","LAZY","EAGER"],I=W=>W;function C(W){return W==="inherit"?l.t("em.common.inherit"):W}const U=t.computed(()=>!!E.value&&E.value.end1.entityRef===E.value.end2.entityRef);function A(W,J){E.value&&l.updateAssociationEnd(E.value.modelId,W,J)}function P(W){return de.value?W:W==="end1"?"end2":"end1"}function F(W){var Te;const J=(Te=E.value)==null?void 0:Te[W];if(!(J!=null&&J.attributeRef))return;const X=l.state.logical.entities.find(De=>De.modelId===J.entityRef),he=X==null?void 0:X.attributes.find(De=>De.modelId===J.attributeRef);return he&&(he.attrType==="RELATION_OWN"||he.attrType==="RELATION_REF")?he.name:void 0}function H(W,J){var he;const X=(he=E.value)==null?void 0:he[W];X!=null&&X.attributeRef&&l.updateAttribute(X.entityRef,X.attributeRef,{name:J})}function G(W){var De;const J=F(W);if(J!==void 0)return J;const X=(De=E.value)==null?void 0:De[W];if(X!=null&&X.navFieldNameHint)return X.navFieldNameHint;const he=W==="end1"?"end2":"end1",Te=l.state.logical.entities.find(Oe=>{var ie;return Oe.modelId===((ie=E.value)==null?void 0:ie[he].entityRef)});return Te?Na(Te.name,ka(E.value[he].multiplicity)):""}function le(W){return!!de.value||F(W)!==void 0}function se(W){E.value&&!U.value&&l.setAssociationIdentifying(E.value.modelId,W)}function ue(W){var J,X,he;return!!((he=(X=(J=E.value)==null?void 0:J[W].jpa)==null?void 0:X.cascadeTypes)!=null&&he.includes("ALL"))}function ye(W,J,X){var De,Oe;const he=(De=E.value)==null?void 0:De[W];if(J==="ALL"&&X){A(W,{jpa:{...he==null?void 0:he.jpa,cascadeTypes:["ALL"]}});return}const Te=new Set(((Oe=he==null?void 0:he.jpa)==null?void 0:Oe.cascadeTypes)??[]);X?Te.add(J):Te.delete(J),A(W,{jpa:{...he==null?void 0:he.jpa,cascadeTypes:[...Te]}})}function ae(W,J){var he;const X=(he=E.value)==null?void 0:he[W];A(W,{jpa:{...X==null?void 0:X.jpa,...J}})}function Ie(W){var J,X;return((X=(J=E.value)==null?void 0:J[W].jpa)==null?void 0:X.fetchType)??"inherit"}function Pe(W,J){ae(W,{fetchType:J==="inherit"?void 0:J})}function Ae(W){var X;const J=(X=E.value)==null?void 0:X[W==="end1"?"end2":"end1"];return(J==null?void 0:J.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(J==null?void 0:J.multiplicity)==="ONE_OR_MORE_INSTANCES"}const de=t.computed(()=>{const W=E.value;if(!W)return null;for(const J of l.state.logical.entities){const X=J.attributes.find(Oe=>{var ie;return((ie=Oe.embedded)==null?void 0:ie.associationRef)===W.modelId&&Oe.attrType==="EMBED_OWN"});if(!X)continue;const he=W.end2.entityRef===X.embedded.embeddableRef?"end2":"end1",Te=W[he].multiplicity,De=W[he].jpa;return{which:he,cardinality:Te,isCollection:Te==="ZERO_OR_MORE_INSTANCES"||Te==="ONE_OR_MORE_INSTANCES",collectionType:(De==null?void 0:De.collectionType)??"LIST",collectionTable:(De==null?void 0:De.collectionTable)??"",orderColumn:(De==null?void 0:De.orderColumn)??""}}return null});function ge(W){E.value&&l.setEmbedCardinality(E.value.modelId,W)}function _e(W){const J=de.value;J&&ae(J.which,W==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function V(W){const J=de.value;J&&ae(J.which,{collectionTable:W.trim()||void 0})}function L(W){const J=de.value;J&&ae(J.which,{orderColumn:W.trim()||void 0})}function j(W){b.value&&l.updateGroup(b.value.modelId,W)}function ee(W,J){var X;j({name:{...(X=b.value)==null?void 0:X.name,[W]:J}})}const Z=t.computed(()=>{var W;return b.value?Vt((W=l.state.layout.groupLayouts.find(J=>J.groupRef===b.value.modelId))==null?void 0:W.style):null});function pe(W){b.value&&l.setGroupSwatch(b.value.modelId,W)}function me(W){v.value&&l.setNoteMemo(v.value.modelId,W)}const ve=t.computed(()=>{var W;return Vt((W=v.value)==null?void 0:W.style)});function Ee(W){v.value&&l.setNoteSwatch(v.value.modelId,W)}return(W,J)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:J[0]||(J[0]=(...X)=>e.startResize&&e.startResize(...X))},null,42,nB),t.createElementVNode("header",oB,[t.createElementVNode("div",iB,[J[14]||(J[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:J[1]||(J[1]=X=>a("collapse"))},[t.createVNode(xe,{name:"panel-right-close",size:16})],8,aB)]),t.createElementVNode("p",rB,t.toDisplayString(S.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",lB,[t.createVNode(xe,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:J[2]||(J[2]=X=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(Pp,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("basics"),title:k.value,onToggle:J[3]||(J[3]=X=>g("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(PL,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.unref(cn)(d.value.stereotype)?(t.openBlock(),t.createElementBlock("p",cB,t.toDisplayString(t.unref(l).t("em.entity.noIndexNote")),1)):(t.openBlock(),t.createBlock(KL,{key:1,controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("index"),onToggle:J[4]||(J[4]=X=>g("index"))},null,8,["controller","entity-id","collapsed"])),t.createVNode(tB,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("ops"),onToggle:J[5]||(J[5]=X=>g("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!E.value.identifying,disabled:U.value||!!de.value,"onUpdate:modelValue":se},null,8,["label","model-value","disabled"]),U.value?(t.openBlock(),t.createElementBlock("p",dB,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):de.value?(t.openBlock(),t.createElementBlock("p",uB,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),de.value?(t.openBlock(),t.createElementBlock("fieldset",mB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",fB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":de.value.cardinality,items:O,"value-provider":I,"label-provider":z,"onUpdate:modelValue":J[6]||(J[6]=X=>X&&ge(X))},null,8,["model-value"])]),de.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",pB,[J[15]||(J[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(te.BSSelect),{"model-value":de.value.collectionType,items:R,"value-provider":I,"label-provider":I,"onUpdate:modelValue":J[7]||(J[7]=X=>X&&_e(X))},null,8,["model-value"])]),t.createElementVNode("label",hB,[J[16]||(J[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(te.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":de.value.collectionTable,"onUpdate:modelValue":V},null,8,["placeholder","model-value"])]),de.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",yB,[J[17]||(J[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(te.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":de.value.orderColumn,"onUpdate:modelValue":L},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",gB,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],X=>{var he,Te,De;return t.withDirectives(t.createElementVNode("div",{key:X,class:"em-end"},[t.createElementVNode("h4",bB,t.toDisplayString(X)+" → "+t.toDisplayString(T(E.value[X].entityRef)),1),de.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",_B,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":E.value[X].multiplicity,items:$,"value-provider":I,"label-provider":t.unref(Ea),"onUpdate:modelValue":Oe=>A(X,{multiplicity:Oe})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${P(X)}-navigable`,class:"em-check",label:"navigable",title:P(X)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:P(X)==="end2","model-value":P(X)==="end2"?!0:E.value[P(X)].navigable,"onUpdate:modelValue":Oe=>A(P(X),{navigable:Oe})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",kB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(te.BSTextInput),{name:`${P(X)}-navname`,width:"100%",disabled:!le(P(X)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":G(P(X)),"onUpdate:modelValue":Oe=>H(P(X),Oe)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${P(X)}-composition`,class:"em-check",label:"composition","model-value":E.value[P(X)].composition,"onUpdate:modelValue":Oe=>A(P(X),{composition:Oe})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",EB,[J[18]||(J[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(x,Oe=>{var ie,Ne;return t.createVNode(t.unref(te.BSCheckbox),{key:Oe,name:`${P(X)}-cascade-${Oe}`,class:"em-check",label:Oe,"model-value":!!((Ne=(ie=E.value[P(X)].jpa)==null?void 0:ie.cascadeTypes)!=null&&Ne.includes(Oe)),disabled:!le(P(X))||Oe!=="ALL"&&ue(P(X)),"onUpdate:modelValue":Ye=>ye(P(X),Oe,Ye)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),le(P(X))?ue(P(X))?(t.openBlock(),t.createElementBlock("p",wB,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",NB,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",IB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",vB,[J[19]||(J[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(te.BSSelect),{disabled:!le(P(X)),"model-value":Ie(P(X)),items:N,"value-provider":I,"label-provider":C,"onUpdate:modelValue":Oe=>Oe&&Pe(P(X),Oe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${P(X)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((he=E.value[P(X)].jpa)!=null&&he.orphanRemoval),disabled:!le(P(X))||Ae(X),"onUpdate:modelValue":Oe=>ae(P(X),{orphanRemoval:Oe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),Ae(X)&&((Te=E.value[P(X)].jpa)!=null&&Te.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",CB,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",SB,[J[20]||(J[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(te.BSTextInput),{name:`${P(X)}-orderby`,width:"100%",disabled:!le(P(X)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((De=E.value[P(X)].jpa)==null?void 0:De.orderBy)??"","onUpdate:modelValue":Oe=>ae(P(X),{orderBy:Oe.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!de.value||X===de.value.which]])}),64))],64)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",xB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,X=>{var he;return t.openBlock(),t.createElementBlock("label",{key:X,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(X),1),t.createVNode(t.unref(te.BSTextInput),{name:`grp-name-${X}`,width:"100%","model-value":((he=b.value.name)==null?void 0:he[X])??"","onUpdate:modelValue":Te=>ee(X,Te)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",RB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:b.value.description??"",rows:"3",onChange:J[8]||(J[8]=X=>j({description:X.target.value}))},null,40,AB)]),t.createElementVNode("label",$B,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"grp-package",width:"100%","model-value":b.value.packageName??"","onUpdate:modelValue":J[9]||(J[9]=X=>j({packageName:X}))},null,8,["model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":b.value.excludeDDLGeneration,"onUpdate:modelValue":J[10]||(J[10]=X=>j({excludeDDLGeneration:X}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",TB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",MB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Z.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:J[11]||(J[11]=X=>pe(null))},"∅",10,VB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),X=>(t.openBlock(),t.createElementBlock("button",{key:X,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Z.value===X}]),style:t.normalizeStyle({background:t.unref(ci)(X)}),title:t.unref(l).t(t.unref(Mo)(X)),onClick:he=>pe(X)},null,14,LB))),128))])]),t.createElementVNode("p",BB,t.toDisplayString(t.unref(l).t("em.group.members",{n:b.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",DB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:v.value.memo,rows:"6",onChange:J[12]||(J[12]=X=>me(X.target.value))},null,40,OB)]),t.createElementVNode("fieldset",PB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",zB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ve.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:J[13]||(J[13]=X=>Ee(null))},"∅",10,FB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),X=>(t.openBlock(),t.createElementBlock("button",{key:X,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ve.value===X}]),style:t.normalizeStyle({background:t.unref(ci)(X)}),title:t.unref(l).t(t.unref(Mo)(X)),onClick:he=>Ee(X)},null,14,UB))),128))])])],64)):t.createCommentVNode("",!0)],8,sB)],4))}}),[["__scopeId","data-v-923cccbb"]]),HB=["title"],jB={class:"em-validation__title"},KB=["title","onClick"],GB={key:0,class:"em-validation__body"},YB={class:"em-validation__opt"},qB={key:0,class:"em-validation__empty"},WB={key:1,class:"em-validation__empty"},JB={key:2,class:"em-validation__list"},XB=["onClick"],ZB={class:"em-validation__item-msg"},QB={key:0,class:"em-validation__item-entity"},eD=["title","onClick"],tD=["title"],nD=Qe(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const _=new Map;for(const g of o.state.logical.entities)_.set(g.modelId,g.name);return _});function r(_){const g=sv(_);if(!g)return null;const k=a.value.get(g);return k===void 0?null:k.trim()===""?o.t("em.validation.nameless"):k}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const _={error:0,warning:0,info:0};for(const g of i.value)_[g.severity]++;return _}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(_=>c.value[_.severity]).slice().sort((_,g)=>l[_.severity].order-l[g.severity].order)),u=t.computed(()=>d.value.map(_=>({issue:_,entityName:r(_),message:Op(o.t,_),category:rv(o.t,_.ruleId)}))),m=t.ref(!1);function p(_){c.value[_]=!c.value[_]}function f(_){if(!m.value){m.value=!0;return}p(_)}function h(_){_.targetRef&&o.requestFocus(_.targetRef)}return(_,g)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:g[1]||(g[1]=k=>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(xe,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",jB,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,HB),t.createElementVNode("div",{class:"em-validation__counts",onClick:g[0]||(g[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],k=>t.createElementVNode("button",{key:k,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${k}`,{"is-off":!c.value[k]}]]),title:m.value?t.unref(o).t(c.value[k]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[k].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:E=>f(k)},[t.createVNode(xe,{name:l[k].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[k]),1)],10,KB)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",GB,[t.createElementVNode("label",YB,[t.createVNode(t.unref(te.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":g[2]||(g[2]=k=>t.unref(o).flagEntitiesWithoutRelations.value=k)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",qB,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",WB,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",JB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:k,entityName:E,message:b,category:v},y)=>(t.openBlock(),t.createElementBlock("li",{key:`${k.ruleId}:${k.targetRef??"model"}:${y}`,class:t.normalizeClass(["em-validation__item",[`is-${k.severity}`,{"is-clickable":!!k.targetRef}]]),onClick:S=>h(k)},[t.createVNode(xe,{name:l[k.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",ZB,[E?(t.openBlock(),t.createElementBlock("span",QB,t.toDisplayString(E),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(b),1)]),t.unref(o).hasQuickFix(k)?(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(S=>t.unref(o).applyQuickFix(k),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,eD)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:k.ruleId},t.toDisplayString(v),9,tD)],10,XB))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),oD={class:"em-history"},iD={class:"em-history__head"},aD={class:"em-history__title"},rD={class:"em-history__head-actions"},lD=["title","disabled"],sD=["title"],cD={class:"em-history__filters"},dD={class:"em-history__filter"},uD={class:"em-history__filters em-history__filters--period"},mD={class:"em-history__filter-label"},fD=["title","aria-label","max"],pD=["title","aria-label","min"],hD=["title"],yD={key:0,class:"em-history__diffbar"},gD={class:"em-history__diffbar-range"},bD={class:"em-history__diffbar-count"},_D={class:"em-history__body"},kD={key:0,class:"em-history__empty"},ED={key:1,class:"em-history__diff-list"},ND=["onClick"],wD={class:"em-history__action-head"},ID={class:"em-history__action-name"},vD={key:0,class:"em-history__fields"},CD={class:"em-history__fname"},SD={key:0,class:"em-history__old"},xD={class:"em-history__val"},RD={key:1,class:"em-history__empty"},AD={key:2,class:"em-history__empty is-error"},$D={key:3,class:"em-history__empty"},TD={key:4,class:"em-history__list"},MD=["onClick"],VD={class:"em-history__summary"},LD={class:"em-history__seq"},BD={class:"em-history__gmeta"},DD={class:"em-history__who"},OD={key:0,class:"em-history__time"},PD={key:1,class:"em-history__restored-from"},zD=["onClick"],FD={key:0,class:"em-history__detail"},UD={class:"em-history__action-head"},HD={class:"em-history__action-name"},jD={key:0,class:"em-history__fields"},KD={class:"em-history__fname"},GD={key:0,class:"em-history__old"},YD={class:"em-history__val"},qD={class:"em-history__preview"},WD=["disabled"],JD={key:0,class:"em-history__diff-list is-preview"},XD={class:"em-history__action-head"},ZD={class:"em-history__action-name"},QD={key:0,class:"em-history__fields"},eO={class:"em-history__fname"},tO={key:0,class:"em-history__old"},nO={class:"em-history__val"},oO={class:"em-history__confirm-row"},iO={class:"em-history__confirm-msg"},aO=["disabled","onClick"],rO=["disabled"],lO=["onClick"],Qr=50,sO=Qe(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((ie,Ne)=>Ne.seq>ie?Ne.seq:ie,-1/0));async function u(ie){if(a.historyTransport){l.value=!0,s.value=null;try{const Ne=!(ie!=null&&ie.full)&&r.value.length>0&&Number.isFinite(d.value),Ye=await a.historyTransport(Ne?d.value:void 0);if(!Ne)r.value=Ye;else if(Ye.length){const it=new Set(r.value.map(ce=>ce.seq)),Q=Ye.filter(ce=>!it.has(ce.seq));Q.length&&(r.value=[...r.value,...Q])}c.value=!0}catch(Ne){s.value=Ne instanceof Error?Ne.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const p=t.ref(null),f=t.ref(null);t.watch(()=>o.open,ie=>{ie?m():(p.value=null,f.value=null)},{immediate:!0});let h=null;t.watch(()=>a.revision.value,()=>{o.open&&(h&&clearTimeout(h),h=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const _=t.computed(()=>new Map(a.state.logical.entities.map(ie=>[ie.modelId,ie]))),g=t.computed(()=>new Map(a.state.logical.associations.map(ie=>[ie.modelId,ie]))),k=t.computed(()=>{const ie=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(Ne=>[Ne.modelId,Ne.packageName||Mt(Ne.name,ie)||Ne.modelId]))});function E(ie){var Q,ce,je,lt,Xe,_t,st;const Ne=g.value.get(ie);if(!Ne)return a.t("em.history.assocFallback");if((Q=Ne.description)!=null&&Q.trim())return Ne.description.trim();const Ye=(lt=(je=_.value.get((ce=Ne.end1)==null?void 0:ce.entityRef))==null?void 0:je.name)==null?void 0:lt.trim(),it=(st=(_t=_.value.get((Xe=Ne.end2)==null?void 0:Xe.entityRef))==null?void 0:_t.name)==null?void 0:st.trim();return Ye&&it?`${Ye}→${it}`:a.t("em.history.assocFallback")}function b(ie){var Ne,Ye,it,Q;if(ie.kind==="entity")return((Ye=(Ne=_.value.get(ie.ref))==null?void 0:Ne.name)==null?void 0:Ye.trim())||a.t("em.attr.nameless");if(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index"){const ce=ie.entityRef?_.value.get(ie.entityRef):void 0,lt=((ie.kind==="attribute"?ce==null?void 0:ce.attributes:ie.kind==="operation"?ce==null?void 0:ce.operations:ce==null?void 0:ce.indexes)??[]).find(_t=>_t.modelId===ie.ref),Xe=(it=ce==null?void 0:ce.name)==null?void 0:it.trim();return`${Xe?Xe+".":""}${((Q=lt==null?void 0:lt.name)==null?void 0:Q.trim())||ie.ref}`}return ie.kind==="association"?E(ie.ref):ie.kind==="associationEnd"?`${E(ie.ref)}(${ie.end})`:ie.kind==="group"?a.t("em.history.groupSubject",{name:k.value.get(ie.ref)??ie.ref}):ie.ref}const v={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},y={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},S=t.ref("all"),$=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],O=t.computed({get:()=>S.value,set:ie=>{ie&&(S.value=ie)}}),B=t.computed(()=>Gl(r.value)),z=t.computed(()=>B.value.length?B.value[0].seq:null),T=t.computed(()=>S.value==="all"?B.value:B.value.filter(ie=>(ie.kind??"edit")===S.value)),x=t.ref(Qr),R=t.ref(""),N=t.ref(""),I=t.computed(()=>!!R.value||!!N.value);function C(){R.value="",N.value=""}const U=t.computed(()=>{const ie=R.value?new Date(`${R.value}T00:00:00`).getTime():null,Ne=N.value?new Date(`${N.value}T23:59:59.999`).getTime():null;return ie==null&&Ne==null?T.value:T.value.filter(Ye=>{if(Ye.ts==null)return!1;const it=new Date(Ye.ts).getTime();return!(isNaN(it)||ie!=null&&it<ie||Ne!=null&&it>Ne)})}),A=t.computed(()=>U.value.slice(0,x.value)),P=t.computed(()=>Math.max(0,U.value.length-x.value));function F(){x.value+=Qr}t.watch([S,R,N],()=>{x.value=Qr}),t.watch(()=>o.open,ie=>{ie&&(x.value=Qr,C())});function H(ie){return ie===void 0?"—":ie===null?a.t("em.history.emptyValue"):typeof ie=="object"?JSON.stringify(ie):String(ie)}function G(ie){const Ne=b(ie.subject);if(ie.verb==="add")return a.t("em.history.summaryAdd",{name:Ne});if(ie.verb==="remove")return a.t("em.history.summaryRemove",{name:Ne});if(ie.fields.length===1){const Ye=ie.fields[0];return`${Ne}.${Ye.field} ${Ye.oldValue!==void 0?H(Ye.oldValue)+"→":""}${H(Ye.value)}`}return a.t("em.history.summaryFields",{name:Ne,n:ie.fields.length})}function le(ie){return ie.actions.length===0?a.t("em.history.noChange"):ie.actions.length===1?G(ie.actions[0]):a.t("em.history.summaryMore",{summary:G(ie.actions[0]),n:ie.actions.length-1})}const se=t.ref(new Set);function ue(ie){const Ne=new Set(se.value);Ne.has(ie)?Ne.delete(ie):Ne.add(ie),se.value=Ne}function ye(ie){if(ie==null)return"";const Ne=new Date(ie);return isNaN(Ne.getTime())?String(ie):Ne.toLocaleString()}function ae(ie){const Ne=ie.author,Ye=ie.origin;return Ne&&Ye?`${Ne}(${Ye})`:Ne||(Ye?`(${Ye})`:"—")}const Ie=t.computed(()=>p.value==null?null:Yl(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Ie.value?nu(Ie.value):null,ie=>i("diffChange",ie));function Pe(ie){p.value=ie,f.value=null,J.value=null}function Ae(){p.value=null,f.value=null}const de=t.computed(()=>B.value.map(ie=>ie.seq)),ge=t.computed(()=>z.value??1/0),_e=t.computed(()=>f.value??ge.value),V=t.computed(()=>f.value??ge.value),L=t.computed(()=>de.value.filter(ie=>ie<_e.value).map(ie=>({v:ie}))),j=t.computed(()=>de.value.filter(ie=>p.value!=null&&ie>p.value).map(ie=>({v:ie})));function ee(ie){ie!=null&&(p.value=ie,f.value!=null&&f.value<=ie&&(f.value=null))}function Z(ie){ie!=null&&(f.value=ie>=ge.value?null:ie)}function pe(ie){return ie>=ge.value?a.t("em.history.diff.current"):`#${ie}`}function me(ie){return ie.kind==="entity"?_.value.has(ie.ref)?ie.ref:null:(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index")&&ie.entityRef?_.value.has(ie.entityRef)?ie.entityRef:null:ie.kind==="group"&&k.value.has(ie.ref)?ie.ref:null}function ve(ie){const Ne=me(ie);Ne&&a.requestFocus(Ne)}const Ee={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},W={added:"add",modified:"update",removed:"remove"},J=t.ref(null),X=t.ref(!1),he=t.computed(()=>J.value==null?null:Yl(r.value,{fromSeq:J.value})),Te=t.ref(!1);function De(ie){J.value=ie,Te.value=!1}async function Oe(ie){X.value=!0;try{const Ne=await a.restoreToSeq(ie);Ne.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:Ne.reason??a.t("em.history.unknown")})}finally{X.value=!1,J.value=null}}return(ie,Ne)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Ye,it;return[t.withDirectives(t.createElementVNode("section",oD,[t.createElementVNode("header",iD,[t.createElementVNode("div",aD,[t.createVNode(xe,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",rD,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:Ne[0]||(Ne[0]=Q=>u({full:!0}))},[t.createVNode(xe,{name:"redo",size:15})],8,lD),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:Ne[1]||(Ne[1]=Q=>i("close"))},[t.createVNode(xe,{name:"panel-close",size:15})],8,sD)])]),t.createElementVNode("div",cD,[t.createElementVNode("label",dD,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(te.BSSelect),{modelValue:O.value,"onUpdate:modelValue":Ne[2]||(Ne[2]=Q=>O.value=Q),items:$,"value-provider":Q=>Q.v,"label-provider":Q=>t.unref(a).t(Q.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",uD,[t.createElementVNode("span",mD,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:N.value||void 0,"onUpdate:modelValue":Ne[3]||(Ne[3]=Q=>R.value=Q)},null,8,fD),[[t.vModelText,R.value]]),Ne[9]||(Ne[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:R.value||void 0,"onUpdate:modelValue":Ne[4]||(Ne[4]=Q=>N.value=Q)},null,8,pD),[[t.vModelText,N.value]]),I.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:C},[t.createVNode(xe,{name:"x",size:12})],8,hD)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",yD,[t.createElementVNode("div",gD,[t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:L.value,"value-provider":Q=>Q.v,"label-provider":Q=>`#${Q.v}`,"onUpdate:modelValue":Ne[5]||(Ne[5]=Q=>ee(Q??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(xe,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":V.value,items:j.value,"value-provider":Q=>Q.v,"label-provider":Q=>pe(Q.v),"onUpdate:modelValue":Ne[6]||(Ne[6]=Q=>Z(Q??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",bD,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Ye=Ie.value)==null?void 0:Ye.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:Ae},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",_D,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(it=Ie.value)!=null&&it.entries.length?(t.openBlock(),t.createElementBlock("ul",ED,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.value.entries,(Q,ce)=>(t.openBlock(),t.createElementBlock("li",{key:ce,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!me(Q.subject)}]),onClick:je=>ve(Q.subject)},[t.createElementVNode("div",wD,[t.createVNode(xe,{name:v[Q.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",ID,t.toDisplayString(b(Q.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${W[Q.verb]}`])},t.toDisplayString(t.unref(a).t(Ee[Q.verb])),3)]),Q.fields.length?(t.openBlock(),t.createElementBlock("ul",vD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.fields,(je,lt)=>(t.openBlock(),t.createElementBlock("li",{key:lt,class:"em-history__field"},[t.createElementVNode("span",CD,t.toDisplayString(je.field),1),je.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",SD,t.toDisplayString(H(je.oldValue)),1)):t.createCommentVNode("",!0),je.oldValue!==void 0?(t.openBlock(),t.createBlock(xe,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",xD,t.toDisplayString(H(je.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,ND))),128))])):(t.openBlock(),t.createElementBlock("p",kD,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",RD,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",AD,t.toDisplayString(s.value),1)):U.value.length===0?(t.openBlock(),t.createElementBlock("p",$D,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",TD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(A.value,Q=>{var ce,je,lt;return t.openBlock(),t.createElementBlock("li",{key:Q.seq,class:t.normalizeClass(["em-history__group",[`is-${Q.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Xe=>ue(Q.seq)},[t.createVNode(xe,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":se.value.has(Q.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${Q.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(Q.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",VD,t.toDisplayString(le(Q)),1),t.createElementVNode("span",LD,"#"+t.toDisplayString(Q.seq),1)],8,MD),t.createElementVNode("div",BD,[t.createElementVNode("span",DD,t.toDisplayString(ae(Q)),1),Q.ts?(t.openBlock(),t.createElementBlock("span",OD,t.toDisplayString(ye(Q.ts)),1)):t.createCommentVNode("",!0),Q.kind==="restore"&&Q.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",PD,"← #"+t.toDisplayString(Q.restoredFromSeq),1)):t.createCommentVNode("",!0),Q.seq!==z.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Xe=>Pe(Q.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,zD)):t.createCommentVNode("",!0)]),se.value.has(Q.seq)?(t.openBlock(),t.createElementBlock("div",FD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.actions,(Xe,_t)=>(t.openBlock(),t.createElementBlock("div",{key:_t,class:"em-history__action"},[t.createElementVNode("div",UD,[t.createVNode(xe,{name:v[Xe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",HD,t.toDisplayString(b(Xe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Xe.verb}`])},t.toDisplayString(t.unref(a).t(y[Xe.verb])),3)]),Xe.fields.length?(t.openBlock(),t.createElementBlock("ul",jD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.fields,(st,kt)=>(t.openBlock(),t.createElementBlock("li",{key:kt,class:"em-history__field"},[t.createElementVNode("span",KD,t.toDisplayString(st.field),1),st.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",GD,t.toDisplayString(H(st.oldValue)),1)):t.createCommentVNode("",!0),st.oldValue!==void 0?(t.openBlock(),t.createBlock(xe,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",YD,t.toDisplayString(H(st.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&Q.seq!==z.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":J.value===Q.seq}])},[J.value===Q.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",qD,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((ce=he.value)!=null&&ce.entries.length),onClick:Ne[7]||(Ne[7]=Xe=>Te.value=!Te.value)},[t.createVNode(xe,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Te.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((je=he.value)!=null&&je.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:he.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,WD),Te.value&&((lt=he.value)!=null&&lt.entries.length)?(t.openBlock(),t.createElementBlock("ul",JD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he.value.entries,(Xe,_t)=>(t.openBlock(),t.createElementBlock("li",{key:_t,class:"em-history__diff-entry"},[t.createElementVNode("div",XD,[t.createVNode(xe,{name:v[Xe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",ZD,t.toDisplayString(b(Xe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${W[Xe.verb]}`])},t.toDisplayString(t.unref(a).t(Ee[Xe.verb])),3)]),Xe.fields.length?(t.openBlock(),t.createElementBlock("ul",QD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.fields,(st,kt)=>(t.openBlock(),t.createElementBlock("li",{key:kt,class:"em-history__field"},[t.createElementVNode("span",eO,t.toDisplayString(st.field),1),st.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",tO,t.toDisplayString(H(st.oldValue)),1)):t.createCommentVNode("",!0),st.oldValue!==void 0?(t.openBlock(),t.createBlock(xe,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",nO,t.toDisplayString(H(st.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",oO,[t.createElementVNode("span",iO,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:X.value,onClick:Xe=>Oe(Q.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,aO),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:X.value,onClick:Ne[8]||(Ne[8]=Xe=>J.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,rO)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Xe=>De(Q.seq)},[t.createVNode(xe,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,lO))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&P.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:F},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:P.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-c7fac08e"]]);function cO(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 By(e){const n=t.ref(cO(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 dO={class:"em-modeler"},uO={class:"em-modeler__body"},mO={class:"em-drawer__inner"},fO={class:"em-drawer__head"},pO={class:"em-drawer__actions"},hO=["title"],yO=["title"],gO=["title"],bO=["title"],_O=["title"],kO=Qe(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(v){t.nextTick(()=>{const y=v();y&&("focusCollapse"in y?y.focusCollapse():y.focus())})}function c(v){n.value=v,s(()=>v?i.value:a.value)}function d(v){o.value=v,s(()=>v?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:h}=By({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:_,dragging:g,startResize:k}=By({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),E=t.ref(null),b=t.ref(null);return(v,y)=>{var S,$,O;return t.openBlock(),t.createElementBlock("div",dO,[t.createVNode(Vy,{controller:e.controller,"history-open":u.value,onExportSvg:y[0]||(y[0]=B=>{var z;return(z=E.value)==null?void 0:z.exportSvg()}),onExportPng:y[1]||(y[1]=B=>{var z;return(z=E.value)==null?void 0:z.exportPng()}),onToggleHistory:y[2]||(y[2]=B=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",uO,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",mO,[t.createElementVNode("header",fO,[y[11]||(y[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",pO,[(S=b.value)!=null&&S.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t(($=b.value)!=null&&$.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:y[3]||(y[3]=B=>{var z;return(z=b.value)==null?void 0:z.toggleAll()})},[t.createVNode(xe,{name:(O=b.value)!=null&&O.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,hO)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:y[4]||(y[4]=B=>c(!1))},[t.createVNode(xe,{name:"panel-close",size:16})],8,yO)])]),t.createVNode(My,{ref_key:"explorer",ref:b,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:y[5]||(y[5]=(...B)=>t.unref(h)&&t.unref(h)(...B))},null,42,gO),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:y[6]||(y[6]=B=>c(!0))},[t.createVNode(xe,{name:"panel-open",size:18})],8,bO),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(p)-6+"px"})},[t.createVNode(Ty,{ref_key:"canvas",ref:E,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(Ly,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(_),resizing:t.unref(g),"start-resize":t.unref(k),onCollapse:y[7]||(y[7]=B=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:y[8]||(y[8]=B=>d(!0))},[t.createVNode(xe,{name:"panel-right-open",size:18})],8,_O),[[t.vShow,!o.value]])]),_:1}),t.createVNode(sO,{controller:e.controller,open:u.value,onClose:y[9]||(y[9]=B=>u.value=!1),onDiffChange:y[10]||(y[10]=B=>m.value=B)},null,8,["controller","open"])]),t.createVNode(nD,{controller:e.controller,"panel-width":t.unref(_),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=hk,be.AssociationEdge=Ah,be.CUSTOM_TYPE_VALUE=dn,be.CommandStack=ql,be.DEFAULT_JAVA_TYPE=dl,be.DIAGRAM_JSON_FORMAT=El,be.DIAGRAM_JSON_VERSION=Nl,be.DiagramCanvas=Ty,be.DiagramExplorer=My,be.EDITOR=eo,be.EditModeToggle=zV,be.EditorToolbar=Vy,be.EntityModeler=kO,be.EntityNode=dh,be.GROUP_CODE_ENUM_VALUE=jn,be.GroupNode=uh,be.INHERITED_REF_PREFIX=ma,be.InvalidDiagramJsonError=fo,be.JAVA_TYPES=ki,be.LIB_VERSION=Pb,be.NoteNode=mh,be.OpSyncAdapter=Yu,be.PHYSICAL_NAME_MAX_LENGTH=vi,be.PropertyPanel=Ly,be.RevCache=Gu,be.SELECTABLE_JAVA_TYPES=Yc,be.SYMBOLIC_OP_KINDS=qu,be.SYMBOLIC_OP_SCHEMA=vm,be.UI_LOCALES=Pv,be.applyDocumentReferenceOnly=hl,be.buildAgentBatch=yk,be.buildDiagramSvg=Sc,be.buildDiffMarks=nu,be.collectSharedColumns=vn,be.commands=d_,be.computeAutoLayout=$c,be.createEditorController=Ix,be.dedupeModelIds=Db,be.defaultMermaidDialect=sg,be.defaultSqlDialect=Rg,be.diagramToJson=_d,be.displayLabel=ya,be.emptyState=Xp,be.entityModelToDdl=yd,be.entityModelToMermaid=yl,be.entityModelToText=nd,be.exportDiagramPng=Ay,be.exportDiagramSvg=Ry,be.fromPersisted=Bm,be.isGeneratable=Ld,be.isInheritedColumnRef=ao,be.isValueTypeStereotype=at,be.javaTypeLabel=jo,be.makeInheritedColumnRef=Vc,be.mergeDiagram=Jd,be.mermaidErToImportSource=ud,be.migrateLegacyMoney=Bb,be.multiplicityLabel=Ea,be.newId=Le,be.packEntityBoxes=el,be.parseDiagramJson=kd,be.parseInheritedColumnRef=tl,be.parseMermaidEr=dd,be.parseSqlDdl=_l,be.planHealBackfillOps=Jk,be.projectActionLog=Gl,be.projectEntityAudit=eu,be.projectFieldAudit=Gn,be.projectInheritedColumns=gi,be.projectSeqDiff=Yl,be.renderDiagramSvg=Nd,be.resolveColumnPhysicalName=bi,be.resolveDiagram=Ac,be.resolveEffectiveColumn=Bt,be.resolveQuickFix=xl,be.resolveSharedColumn=so,be.resolveSymbolicOps=Y_,be.restoreDeepEqual=go,be.scaffoldEntityJava=sb,be.sharedColumnScopeEntities=rl,be.sqlDdlToImportSource=hd,be.stereotypeLabel=yi,be.synthesizeRestoreOps=Jb,be.toPersisted=Yk,be.toPersistedV2=qk,be.translate=rn,be.uiMessagesEn=Fp,be.uiMessagesJa=Up,be.uiMessagesKo=Hp,be.validateModel=xa,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
73
+ `)[0])==null?void 0:L.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:V.modelId,focusId:V.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:_e}});function l(R){return R?R.pk&&R.fk?i.t("em.node.keyPfk"):R.pk?i.t("em.node.keyPk"):R.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const R=[],N=I=>{if(I.children.length){I.key!=="root"&&R.push(I.key);for(const C of I.children)N(C)}};return N(r.value),R}),c=R=>R.startsWith("entity:")||R==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=Cy({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),h=t.ref(null),_=t.computed(()=>f.value.trim().length>0),g=t.computed(()=>{const R=[];if(_.value){const I=R2(r.value,f.value.trim().toLowerCase()),C=(U,A,P,F,H)=>{if(!I.has(U.key))return;R.push({node:U,depth:A,parentKey:P,posinset:F,setsize:H});const G=U.children.filter(le=>I.has(le.key));G.forEach((le,se)=>C(le,A+1,U.key,se+1,G.length))};return C(r.value,0,null,1,1),R}const N=(I,C,U,A,P)=>{R.push({node:I,depth:C,parentKey:U,posinset:A,setsize:P}),d(I.key)||I.children.forEach((F,H)=>N(F,C+1,I.key,H+1,I.children.length))};return N(r.value,0,null,1,1),R}),k=t.ref(null),E=t.ref(null),b=t.computed(()=>{var N;const R=g.value;return E.value&&R.some(I=>I.node.key===E.value)?E.value:((N=R[0])==null?void 0:N.node.key)??null}),v=R=>!_.value&&d(R);async function y(R){var N,I;R&&(E.value=R,await t.nextTick(),(I=(N=k.value)==null?void 0:N.querySelector(`[data-key="${R}"]`))==null||I.focus())}function S(R,N){var U,A,P,F,H;const I=g.value,C=I.findIndex(G=>G.node.key===N.node.key);switch(R.key){case"ArrowDown":R.preventDefault(),y((U=I[C+1])==null?void 0:U.node.key);return;case"ArrowUp":R.preventDefault(),y((A=I[C-1])==null?void 0:A.node.key);return;case"Home":R.preventDefault(),y((P=I[0])==null?void 0:P.node.key);return;case"End":R.preventDefault(),y((F=I[I.length-1])==null?void 0:F.node.key);return;case"ArrowRight":if(R.preventDefault(),!N.node.children.length)return;v(N.node.key)?u(N.node.key):y((H=I[C+1])==null?void 0:H.node.key);return;case"ArrowLeft":R.preventDefault(),N.node.children.length&&!v(N.node.key)?u(N.node.key):y(N.parentKey);return;case"Enter":case" ":R.preventDefault(),T(N.node,R);return;case"F2":R.preventDefault(),x(N.node)}}const $=t.computed(()=>_.value&&g.value.length<=1);function O(R){var C;if(R.key!=="/"||R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;const N=R.target,I=N==null?void 0:N.tagName;I==="INPUT"||I==="TEXTAREA"||I==="SELECT"||N!=null&&N.isContentEditable||(R.preventDefault(),(C=h.value)==null||C.focus())}t.onMounted(()=>window.addEventListener("keydown",O)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",O)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function B(R){const N=i.selection.value;return R.attrRef?(N==null?void 0:N.kind)==="attribute"&&N.entityId===R.attrRef.entityId&&N.ids.includes(R.attrRef.attrId):!!N&&N.kind!=="attribute"&&!!R.selectId&&R.selectKind===N.kind&&R.selectId===N.id}function z(R){const N=i.selection.value;return R.selectKind==="entity"&&(N==null?void 0:N.kind)==="attribute"&&N.entityId===R.selectId}function T(R,N){if(R.attrRef){const I=N.shiftKey?"range":N.metaKey||N.ctrlKey?"toggle":"replace";i.selectAttribute(R.attrRef.entityId,R.attrRef.attrId,I)}else R.selectKind&&R.selectId&&(i.selection.value={kind:R.selectKind,id:R.selectId});R.focusId&&i.requestFocus(R.focusId)}function x(R){R.selectKind==="entity"&&R.selectId&&Ar(a,i,R.selectId)}return(R,N)=>(t.openBlock(),t.createElementBlock("section",oV,[t.createElementVNode("div",iV,[t.createVNode(xe,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":N[0]||(N[0]=I=>f.value=I),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:N[1]||(N[1]=t.withKeys(I=>f.value="",["esc"]))},null,40,aV),[[t.vModelText,f.value]]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:N[2]||(N[2]=I=>f.value="")},[t.createVNode(xe,{name:"x",size:13})],8,rV)):t.createCommentVNode("",!0)]),$.value?(t.openBlock(),t.createElementBlock("p",lV,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:k,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,I=>(t.openBlock(),t.createElementBlock("div",{key:I.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":B(I.node),"is-focus-parent":z(I.node),"is-selectable":!!I.node.selectKind||!!I.node.attrRef||!!I.node.focusId}]),"data-key":I.node.key,role:"treeitem","aria-level":I.depth+1,"aria-posinset":I.posinset,"aria-setsize":I.setsize,"aria-expanded":I.node.children.length?!v(I.node.key):void 0,"aria-selected":B(I.node),tabindex:I.node.key===b.value?0:-1,style:t.normalizeStyle({paddingLeft:4+I.depth*14+"px"}),onClick:C=>T(I.node,C),onDblclick:C=>x(I.node),onFocus:C=>E.value=I.node.key,onKeydown:C=>S(C,I)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!I.node.children.length,"is-open":!v(I.node.key)}]),onClick:t.withModifiers(C=>I.node.children.length&&t.unref(u)(I.node.key),["stop"])},[I.node.children.length?(t.openBlock(),t.createBlock(xe,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,dV),I.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(I.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",mV,[I.node.keyMarks.pk?(t.openBlock(),t.createBlock(xe,{key:0,name:"key",size:14,class:"em-key is-pk"})):I.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(xe,{key:1,class:"em-explorer__icon",name:I.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",fV,[I.node.keyMarks.fk?(t.openBlock(),t.createBlock(xe,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,uV)):(t.openBlock(),t.createBlock(xe,{key:1,class:"em-explorer__icon",name:I.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",pV,t.toDisplayString(I.node.label),1),l(I.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",hV,t.toDisplayString(l(I.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,cV))),128))],8,sV)]))}}),[["__scopeId","data-v-ffebc201"]]),yV={class:"em-text-export"},gV=["id","aria-selected","tabindex","onClick"],bV=["aria-labelledby"],_V={class:"em-text-export__actions"},kV=Qe(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(m,p)=>rn(n.locale??"ko",m,p),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var p,f;a.value=m,await t.nextTick(),(f=(p=l.value)==null?void 0:p.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const p=n.formats.length;p&&s((a.value+m+p)%p)}async function d(){try{await navigator.clipboard.writeText(r().content),te.showNotification(i("em.export.copied"),"info")}catch{te.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),p=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(p);try{const h=document.createElement("a");h.href=f,h.download=m.filename,document.body.appendChild(h),h.click(),h.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",yV,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,h)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${h}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":h===a.value}]),"aria-selected":h===a.value,"aria-controls":"em-text-export-panel",tabindex:h===a.value?0:-1,onClick:_=>a.value=h,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(_=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(_=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(_=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(_=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,gV))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,bV),t.createElementVNode("div",_V,[t.createVNode(t.unref(te.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),EV={class:"em-text-import"},NV=["aria-label"],wV=["aria-checked","tabindex","onClick"],IV=["placeholder"],vV={class:"em-text-import__status"},CV={class:"em-text-import__ok"},SV={key:0,class:"em-text-import__warn"},xV={key:1,class:"em-text-import__err"},RV={key:2,class:"em-text-import__err"},AV={key:3,class:"em-text-import__err"},$V={class:"em-text-import__actions"},TV=Qe(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(_,g)=>rn(n.locale??"ko",_,g),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(_){var k,E;const g=l[(_+l.length)%l.length];g&&(r.value=g.key,await t.nextTick(),(E=(k=s.value)==null?void 0:k.querySelectorAll('[role="radio"]')[l.indexOf(g)])==null||E.focus())}function d(_){c(l.findIndex(g=>g.key===r.value)+_)}function u(_){return _?_.startsWith("{")?"json":/\berdiagram\b/i.test(_)?"mermaid":/\bcreate\s+table\b/i.test(_)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const _=a.value.trim();if(!_)return{status:"empty"};const g=m.value;if(!g)return{status:"unknown"};try{let k,E=[];return g==="json"?k=kd(_):g==="mermaid"?k=ud(_):(k=hd(_),E=_l(_).warnings),k.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:k,warnings:E}}catch(k){return{status:"error",message:k instanceof Error?k.message:String(k)}}}),f=t.computed(()=>p.value.status==="ok");function h(){const _=p.value;_.status!=="ok"||!_.source||(n.onImport(_.source),o.close())}return(_,g)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",EV,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,k=>t.createElementVNode("button",{key:k.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":k.key===r.value}]),"aria-checked":k.key===r.value,tabindex:k.key===r.value?0:-1,onClick:E=>r.value=k.key,onKeydown:[g[0]||(g[0]=t.withKeys(t.withModifiers(E=>d(-1),["prevent"]),["left"])),g[1]||(g[1]=t.withKeys(t.withModifiers(E=>d(1),["prevent"]),["right"])),g[2]||(g[2]=t.withKeys(t.withModifiers(E=>c(0),["prevent"]),["home"])),g[3]||(g[3]=t.withKeys(t.withModifiers(E=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(k.labelKey)),43,wV)),64))],8,NV),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":g[4]||(g[4]=k=>a.value=k),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,IV),[[t.vModelText,a.value]]),t.createElementVNode("div",vV,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",CV,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:p.value.source.logical.entities.length,relations:p.value.source.logical.associations.length})),1),p.value.warnings&&p.value.warnings.length?(t.openBlock(),t.createElementBlock("span",SV," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:p.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):p.value.status==="error"?(t.openBlock(),t.createElementBlock("span",xV,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",RV,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",AV,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",$V,[t.createVNode(t.unref(te.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:h},null,8,["caption","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:g[5]||(g[5]=k=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),MV={class:"em-toolbar"},VV=["title"],LV={class:"em-toolbar__mode"},Vy=Qe(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=te.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:h=>i.displayMode.value=h});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const h=i.resolved.value.entities;return h.length>0&&h.every(_=>_.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const h=hl(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:kV,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:nd(h,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:yl(h,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:yl(h,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:yd(h,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:_d(h,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:TV,bind:{locale:i.uiLocale.value,onImport:h=>{i.importEntities(h,h.logical.entities.map(_=>_.modelId))}}})}function f(){r.openModal({component:$y,bind:{locale:i.uiLocale.value}})}return(h,_)=>(t.openBlock(),t.createElementBlock("div",MV,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,VV)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:_[0]||(_[0]=g=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(xe,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:_[1]||(_[1]=g=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(xe,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),_[9]||(_[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",LV,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":_[2]||(_[2]=g=>s.value=g),items:l,"value-provider":g=>g.v,"label-provider":g=>t.unref(i).t(g.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(xe,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:_[3]||(_[3]=g=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(xe,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:_[4]||(_[4]=g=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(xe,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(xe,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),_[10]||(_[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:p},{left:t.withCtx(()=>[t.createVNode(xe,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(xe,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:_[5]||(_[5]=g=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(xe,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:_[6]||(_[6]=g=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(xe,{name:"camera",size:16})]),_:1},8,["tooltip"]),_[11]||(_[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:_[7]||(_[7]=g=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(xe,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),_[8]||(_[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(xe,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),BV=["title"],DV=["title"],OV=["disabled","aria-pressed"],PV=["disabled","aria-pressed"],zV=Qe(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=>rn(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(xe,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,BV)):(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(xe,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,OV),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(xe,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,PV)],10,DV))}}),[["__scopeId","data-v-2b5162b7"]]),FV=["disabled"],UV={class:"em-panel__sub"},HV={class:"em-nav"},jV={key:0,class:"em-nav__divider","aria-hidden":"true"},KV={key:1},GV=["onClick","onKeydown"],YV={class:"em-nav__name"},qV=["title"],WV={key:0,class:"em-panel__note"},JV=["data-attr-block"],XV={key:0,class:"em-embed-col__label"},ZV={class:"em-attr__row"},QV=["title"],eL={key:1,class:"em-attr__row"},tL={key:2,class:"em-embed-cols"},nL={class:"em-embed-col"},oL={class:"em-embed-col__label"},iL={class:"em-attr__row"},aL={class:"em-attr__navhint"},rL={key:3,class:"em-attr__navhint"},lL={class:"em-attr__navhint"},sL={class:"em-attr__row"},cL={class:"em-field"},dL={key:0,class:"em-attr__navhint"},uL={class:"em-attr__row"},mL={class:"em-attr__row"},fL=["title"],pL={class:"em-attr__flags"},hL={class:"em-attr__pii"},yL={class:"em-attr__pii"},gL={key:1,class:"em-attr__pii"},bL={key:2,class:"em-attr__pii em-attr__codetop"},_L={class:"em-multilang"},kL={key:6,class:"em-embed-cols"},EL={key:0,class:"em-attr__navhint"},NL={class:"em-embed-col__label"},wL={class:"em-attr__row"},IL=["title"],vL=["title"],CL=["title"],SL={class:"em-attr__row"},xL={key:0,class:"em-embed-upd","data-em-slot-ctl":"currency"},RL={key:1,class:"em-attr__navhint"},AL={class:"em-embed-upd","data-em-slot-ctl":"insertable"},$L={class:"em-embed-upd","data-em-slot-ctl":"updatable"},TL={class:"em-embed-upd","data-em-slot-ctl":"notnull"},ML={class:"em-attr__flags"},VL={class:"em-multilang"},LL={class:"em-swatch__row em-attr__swatch"},BL=["title","onClick"],DL=["title","onClick"],OL={key:0,class:"em-attr__swatch-hint"},PL=Qe(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isValueType:a,isColumnless:r,focusedAttrIds:l,personalInfoItems:s,piiLabel:c,idn:d,setAttrLogical:u,SERIALIZED_FIELD_CONTAINERS:m,setCollectionType:p,setAttr:f,isDerivedIdRow:h,rowName:_,rowNamePlaceholder:g,setRowName:k,assocFieldName:E,setAssocFieldName:b,nameLocked:v,nameLockedHint:y,isManagedFk:S,setNaturalId:$,setIdentifier:O,setTransient:B,dbLocked:z,fkDerived:T,fkOriginPhysical:x,typeLocked:R,typeValueOf:N,typeLabelOf:I,setAttrType:C,setAttrCustomType:U,setDb:A,scaleApplicable:P,scaleHint:F,setDbLogical:H,logicalPlaceholder:G,setAttrDescription:le,attrPiiValue:se,setAttrPii:ue,predefinedCustomTypeCatalog:ye,serializedTypeNames:ae,embeddableCatalog:Ie,predefinedLabel:Pe,groupCodeCatalog:Ae,attrGroupCodes:de,attrCodeItems:ge,codeValueOf:_e,codeLabelOf:V,setAttrGroupCode:L,setAttrCode:j,setAttrDefaultValue:ee,hasColumnSlots:Z,isMultiColFk:pe,setDbAt:me,setDbLogicalAt:ve,colSlotMeta:Ee,fixedDataType:W,fixedLength:J,fixedScale:X,slotFixedHint:he,updatableItems:Te,updatableLabel:De,updatableValue:Oe,setUpdatableAt:ie,setUpdatable:Ne,insertableItems:Ye,insertableLabel:it,insertableValue:Q,setInsertableAt:ce,setInsertable:je,notNullItems:lt,notNullLabel:Xe,notNullValue:_t,setNotNullAt:st,sharedItems:kt,sharedLabel:Et,sharedValue:On,setSharedAt:En,isShared:Nt,sharedPhysical:ft}=zp(o,()=>n.entityId),ht=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Ue=>Ue.entityRef===i.value.modelId)??null:null),St=t.computed(()=>{var Ue;return((Ue=i.value)==null?void 0:Ue.attributes.filter(M=>M.attrType!=="DIVIDER"))??[]}),Pn=t.computed(()=>{var Ue;return((Ue=i.value)==null?void 0:Ue.attributes)??[]}),ut=t.computed(()=>St.value.filter(Ue=>l.value.has(Ue.modelId)));function Be(Ue){return{pk:Ue.identifier,fk:Ue.attrType.startsWith("RELATION")&&Ue.dbAttrs.length>0,required:Ue.notNull&&!Ue.identifier}}function q(Ue){const M=Be(Ue),w=[M.pk&&"PK",M.fk&&"FK",M.required&&"NOT NULL"].filter(Boolean);return w.length?w.join(" · "):void 0}function Gt(Ue,M){i.value&&o.selectAttribute(i.value.modelId,Ue.modelId,M.shiftKey?"range":M.metaKey||M.ctrlKey?"toggle":"replace")}function K(Ue){var M,w;return Vt((w=(M=ht.value)==null?void 0:M.attributeStyles)==null?void 0:w[Ue.modelId])}function oe(Ue){return l.value.size>1&&l.value.has(Ue.modelId)}function Me(Ue,M){if(!i.value)return;const w=oe(Ue)?o.selectedAttrIds.value:[Ue.modelId];o.setAttributeSwatches(i.value.modelId,w,M)}const ze=t.ref(void 0);function Ct(Ue){if(!Ue||!i.value)return;const M=o.addPredefinedEmbed(i.value.modelId,Ue);M&&o.selectAttribute(i.value.modelId,M),ze.value=void 0}function Tt(){if(!i.value)return;const Ue=o.addAttribute(i.value.modelId);Ue&&o.selectAttribute(i.value.modelId,Ue)}return(Ue,M)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",UV,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:St.value.length}))+" ",1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Tt},null,8,["caption"]),t.unref(Ie).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":ze.value,items:t.unref(Ie),"value-provider":w=>w.type,"label-provider":t.unref(Pe),"onUpdate:modelValue":Ct},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",HV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Pn.value,w=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:w.modelId},[w.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",jV,[...M[0]||(M[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",KV,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(l).has(w.modelId)}]),role:"button",tabindex:"0",onClick:ne=>Gt(w,ne),onKeydown:[t.withKeys(t.withModifiers(ne=>Gt(w,ne),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ne=>Gt(w,ne),["prevent"]),["space"])]},[t.createElementVNode("span",YV,t.toDisplayString(w.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:q(w)},[Be(w).pk?(t.openBlock(),t.createBlock(xe,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):Be(w).required?(t.openBlock(),t.createBlock(xe,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),Be(w).fk?(t.openBlock(),t.createBlock(xe,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,qV)],42,GV)]))],64))),128))]),St.value.length&&!ut.value.length?(t.openBlock(),t.createElementBlock("p",WV,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ut.value,w=>{var ne,ke,Ce,Ve,Ke,He,fe,qe,We,Je;return t.openBlock(),t.createElementBlock("div",{key:w.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(l).has(w.modelId)}]),"data-attr-block":w.modelId},[t.unref(h)(w)?(t.openBlock(),t.createElementBlock("span",XV,t.toDisplayString(t.unref(o).t("em.attr.derivedIdField")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",ZV,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-name-${w.modelId}`,width:"100%",disabled:t.unref(v)(w),title:t.unref(v)(w)?t.unref(y)(w):t.unref(h)(w)?t.unref(o).t("em.attr.derivedIdNote"):void 0,placeholder:t.unref(g)(w),"model-value":t.unref(_)(w),"onUpdate:modelValue":D=>t.unref(k)(w,D)},null,8,["name","disabled","title","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-type-${w.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:t.unref(R)(w),items:t.unref(qc)(w.type,t.unref(ye),t.unref(ae),t.unref(Ie)),"value-provider":t.unref(N),"label-provider":t.unref(I),"model-value":w.type,"onUpdate:modelValue":D=>t.unref(C)(w,D)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(S)(w)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:D=>t.unref(o).removeAttribute(t.unref(i).modelId,w.modelId)},null,8,["onClick"])],8,QV)]),w.type===t.unref(dn)&&!t.unref(T)(w)?(t.openBlock(),t.createElementBlock("div",eL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-customtype-${w.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":w.customType??"","onUpdate:modelValue":D=>t.unref(U)(w,D)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(h)(w)?(t.openBlock(),t.createElementBlock("div",tL,[t.createElementVNode("div",nL,[t.createElementVNode("span",oL,t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("div",iL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-assocname-${w.modelId}`,width:"100%",title:t.unref(o).t("em.attr.derivedIdNote"),placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(E)(w),"onUpdate:modelValue":D=>t.unref(b)(w,D)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("p",aL,t.toDisplayString(t.unref(o).t("em.attr.derivedIdNote")),1)])])):t.createCommentVNode("",!0),w.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",rL,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.createCommentVNode("",!0),t.unref(r)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[t.createElementVNode("p",lL,t.toDisplayString(t.unref(o).t("em.attr.serializedNoColumnNote")),1),t.createElementVNode("div",sL,[t.createVNode(Jt,{class:"grow",name:`attr-field-logical-${w.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":w.fieldLogicalName,"onUpdate:modelValue":D=>t.unref(u)(w,D)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",cL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.serializedContainer")),1),t.createVNode(t.unref(te.BSSelect),{name:`attr-container-${w.modelId}`,width:"100%",items:[...t.unref(m)],"value-provider":t.unref(d),"label-provider":D=>D==="none"?t.unref(o).t("em.attr.serializedContainerNone"):D,"model-value":w.collectionType??"none","onUpdate:modelValue":D=>D&&t.unref(p)(w,D)},null,8,["name","items","value-provider","label-provider","model-value","onUpdate:modelValue"])])],64)):t.unref(Z)(w)?(t.openBlock(),t.createElementBlock("div",kL,[t.unref(pe)(w)?(t.openBlock(),t.createElementBlock("p",EL,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.dbAttrs,(D,Y)=>{var we,Re,re,Ge,ct;return t.openBlock(),t.createElementBlock("div",{key:D.modelId,class:"em-embed-col"},[t.createElementVNode("span",NL,t.toDisplayString(((we=t.unref(Ee)(w,Y))==null?void 0:we.name)??((Re=t.unref(Ee)(w,Y))==null?void 0:Re.physicalName)??t.unref(o).t("em.attr.colFallback",{n:Y+1})),1),t.createElementVNode("div",wL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`embed-col-${D.modelId}`,width:"100%",disabled:t.unref(Nt)(D),placeholder:((re=t.unref(Ee)(w,Y))==null?void 0:re.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Nt)(D)?t.unref(ft)(D):D.physicalName,"onUpdate:modelValue":Ze=>t.unref(me)(w,Y,{physicalName:Ze})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(he)(w)},[t.createVNode(t.unref(te.BSTextInput),{name:`embed-dtype-${D.modelId}`,width:"84px",disabled:"","model-value":t.unref(W)(w,Y)},null,8,["name","model-value"])],8,IL),t.createElementVNode("span",{title:t.unref(he)(w)},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-len-${D.modelId}`,width:"48px",disabled:"","model-value":t.unref(J)(w,Y)},null,8,["name","model-value"])],8,vL),t.createElementVNode("span",{title:t.unref(he)(w)},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-scale-${D.modelId}`,width:"48px",disabled:"","model-value":t.unref(X)(w,Y)},null,8,["name","model-value"])],8,CL)]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":D.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",SL,[t.createVNode(Jt,{class:"grow",name:`embed-logical-${D.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(Mt)((Ge=t.unref(Ee)(w,Y))==null?void 0:Ge.logicalName,t.unref(o).userLanguage.value)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":D.logicalName,"onUpdate:modelValue":Ze=>t.unref(ve)(w,Y,Ze)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(ct=t.unref(Ee)(w,Y))!=null&&ct.shareable?(t.openBlock(),t.createElementBlock("label",xL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"110px","model-value":t.unref(On)(D),items:t.unref(kt)(),"value-provider":t.unref(d),"label-provider":t.unref(Et),"onUpdate:modelValue":Ze=>Ze&&t.unref(En)(w,Y,Ze)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(Nt)(D)?(t.openBlock(),t.createElementBlock("p",RL,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",AL,[M[3]||(M[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(Nt)(D),"model-value":t.unref(Nt)(D)?"false":t.unref(Q)(D),items:t.unref(Ye),"value-provider":t.unref(d),"label-provider":t.unref(it),"onUpdate:modelValue":Ze=>Ze&&t.unref(ce)(w,Y,Ze)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",$L,[M[4]||(M[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(Nt)(D),"model-value":t.unref(Nt)(D)?"false":t.unref(Oe)(D),items:t.unref(Te),"value-provider":t.unref(d),"label-provider":t.unref(De),"onUpdate:modelValue":Ze=>Ze&&t.unref(ie)(w,Y,Ze)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",TL,[M[5]||(M[5]=t.createElementVNode("span",null,"NOT NULL",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(Nt)(D)||t.unref(z)(w)||t.unref(T)(w),"model-value":t.unref(_t)(D),items:t.unref(lt),"value-provider":t.unref(d),"label-provider":t.unref(Xe),"onUpdate:modelValue":Ze=>Ze&&t.unref(st)(w,Y,Ze)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128)),t.unref(pe)(w)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",ML,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${w.modelId}`,label:"Primary Key","model-value":w.identifier,disabled:"","onUpdate:modelValue":D=>t.unref(O)(w,D)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${w.modelId}`,label:"Not Null","model-value":w.notNull,disabled:"","onUpdate:modelValue":D=>t.unref(f)(w,{notNull:D})},null,8,["name","model-value","onUpdate:modelValue"])]),t.createElementVNode("fieldset",VL,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`attr-desc-${w.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":w.description,"onUpdate:modelValue":D=>t.unref(le)(w,D)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[t.unref(T)(w)?(t.openBlock(),t.createElementBlock("p",dL,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",uL,[t.createVNode(Jt,{class:"grow",name:`attr-logical-${w.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(G)(w,t.unref(o).userLanguage.value),"model-value":(ne=w.dbAttrs[0])==null?void 0:ne.logicalName,"onUpdate:modelValue":D=>t.unref(H)(w,D)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",mL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-col-${w.modelId}`,width:"100%",placeholder:t.unref(x)(w)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(z)(w),"model-value":((ke=w.dbAttrs[0])==null?void 0:ke.physicalName)??"","onUpdate:modelValue":D=>t.unref(A)(w,{physicalName:D})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-dtype-${w.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(z)(w)||t.unref(T)(w),items:t.unref(Uc)(((Ce=w.dbAttrs[0])==null?void 0:Ce.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(d),"label-provider":t.unref(ll),"model-value":((Ve=w.dbAttrs[0])==null?void 0:Ve.dataType)??"","onUpdate:modelValue":D=>D&&t.unref(A)(w,{dataType:D})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSNumberInput),{name:`attr-len-${w.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(z)(w)||t.unref(T)(w),"model-value":(Ke=w.dbAttrs[0])==null?void 0:Ke.length,"onUpdate:modelValue":D=>t.unref(A)(w,{length:D||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(F)(w)},[t.createVNode(t.unref(te.BSNumberInput),{name:`attr-scale-${w.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(z)(w)||t.unref(T)(w)||!t.unref(P)(w),"model-value":(He=w.dbAttrs[0])==null?void 0:He.scale,"onUpdate:modelValue":D=>t.unref(A)(w,{scale:D||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,fL)]),t.createVNode(Vo,{controller:t.unref(o),"ref-id":(fe=w.dbAttrs[0])==null?void 0:fe.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",pL,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${w.modelId}`,label:"Primary Key","model-value":w.identifier,disabled:t.unref(a)||t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(O)(w,D)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${w.modelId}`,label:"Not Null","model-value":w.notNull,disabled:t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(f)(w,{notNull:D})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-uq-${w.modelId}`,label:"Unique","model-value":!!((qe=w.dbAttrs[0])!=null&&qe.unique),disabled:t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(A)(w,{unique:D})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-ai-${w.modelId}`,label:"Auto Increment","model-value":!!((We=w.dbAttrs[0])!=null&&We.autoIncrement),disabled:t.unref(z)(w)||t.unref(T)(w)||!w.identifier,"onUpdate:modelValue":D=>t.unref(A)(w,{autoIncrement:D})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-tr-${w.modelId}`,label:"@Transient","model-value":!!w.transient,disabled:w.identifier||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(B)(w,D)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nid-${w.modelId}`,label:"@NaturalId","model-value":!!w.naturalId,disabled:w.identifier||t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref($)(w,D)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${w.modelId}`,label:"mutable","model-value":!!w.naturalIdMutable,disabled:t.unref(z)(w)||!w.naturalId,"onUpdate:modelValue":D=>t.unref(f)(w,{naturalIdMutable:D||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-mv-${w.modelId}`,label:"Multi-Value (Set)","model-value":!!((Je=w.dbAttrs[0])!=null&&Je.multiValue),disabled:t.unref(z)(w)||t.unref(T)(w),"onUpdate:modelValue":D=>t.unref(A)(w,{multiValue:D||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",hL,[M[1]||(M[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(z)(w),"model-value":t.unref(Q)(w.dbAttrs[0]),items:t.unref(Ye),"value-provider":t.unref(d),"label-provider":t.unref(it),"onUpdate:modelValue":D=>D&&t.unref(je)(w,D)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",yL,[M[2]||(M[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(z)(w),"model-value":t.unref(Oe)(w.dbAttrs[0]),items:t.unref(Te),"value-provider":t.unref(d),"label-provider":t.unref(De),"onUpdate:modelValue":D=>D&&t.unref(Ne)(w,D)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(T)(w)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",gL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":t.unref(se)(w),items:t.unref(s),"value-provider":t.unref(d),"label-provider":t.unref(c),"onUpdate:modelValue":D=>D&&t.unref(ue)(w,D)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(Ae).length&&!t.unref(T)(w)?(t.openBlock(),t.createElementBlock("label",bL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Kp,{"model-value":w.groupCode,items:t.unref(Ae),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":D=>t.unref(L)(w,D)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(T)(w)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(Ae).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(de)(w).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"100%","model-value":w.defaultValue??"none",items:t.unref(ge)(w),"value-provider":t.unref(_e),"label-provider":t.unref(V),"onUpdate:modelValue":D=>D&&t.unref(j)(w,D)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`attr-default-${w.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":w.defaultValue??"","onUpdate:modelValue":D=>t.unref(ee)(w,D)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",_L,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`attr-desc-${w.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":w.description,"onUpdate:modelValue":D=>t.unref(le)(w,D)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",LL,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":K(w)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:D=>Me(w,null)},"∅",10,BL),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),D=>(t.openBlock(),t.createElementBlock("button",{key:D,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":K(w)===D}]),style:t.normalizeStyle({background:t.unref(ci)(D)}),title:t.unref(o).t(t.unref(Mo)(D)),onClick:Y=>Me(w,D)},null,14,DL))),128)),oe(w)?(t.openBlock(),t.createElementBlock("span",OL,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(l).size})),1)):t.createCommentVNode("",!0)])],10,JV)}),128))],8,FV)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-4127b61b"]]),zL=["disabled"],FL={class:"em-panel__sub-label"},UL={class:"em-attr__row"},HL={class:"em-field em-idx-params"},jL=["value","placeholder","onChange"],KL=Qe(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(y=>y.modelId===o.entityId)??null),l=t.computed(()=>r.value?gi(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var y;return io(((y=r.value)==null?void 0:y.attributes)??[])}),c=y=>s.value.canon(y),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>[...Wp(d.value).map(y=>({value:y.ref,label:y.label})),...l.value.map(y=>({value:y.modelId,label:a.t("em.index.inherited",{field:y.field})}))]);function m(y,S){var z;const $=new Set(y.columns.filter((T,x)=>x!==S).map(T=>c(T.columnRef))),O=u.value.filter(T=>!$.has(c(T.value))),B=(z=y.columns[S])==null?void 0:z.columnRef;return B&&!O.some(T=>T.value===B)&&O.push({value:B,label:p(B)}),O}function p(y){return Xs(y,d.value)}function f(y){const S=new Set(y.columns.map($=>c($.columnRef)));return u.value.filter($=>!S.has(c($.value)))}function h(){var S;if(!r.value)return;const y=u.value[0];a.addIndex(r.value.modelId,{modelId:Le(),name:`idx_${(((S=r.value.indexes)==null?void 0:S.length)??0)+1}`,unique:!1,columns:y?[{columnRef:y.value,descending:!1}]:[]})}function _(y,S){r.value&&a.updateIndex(r.value.modelId,y,S)}function g(y){const S=f(y)[0];S&&_(y.modelId,{columns:[...y.columns,{columnRef:S.value,descending:!1}]})}function k(y,S,$){_(y.modelId,{columns:y.columns.map((O,B)=>B===S?{...O,columnRef:$}:O)})}function E(y,S,$){_(y.modelId,{columns:y.columns.map((O,B)=>B===S?{...O,descending:$}:O)})}function b(y,S){_(y.modelId,{columns:y.columns.filter(($,O)=>O!==S)})}function v(y,S){_(y.modelId,{parameters:S.trim()===""?void 0:S})}return(y,S)=>{var $;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:S[0]||(S[0]=O=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",FL,[e.collapsible?(t.openBlock(),t.createBlock(xe,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:(($=r.value.indexes)==null?void 0:$.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(h,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],O=>(t.openBlock(),t.createElementBlock("div",{key:O.modelId,class:"em-attr"},[t.createElementVNode("div",UL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`idx-name-${O.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":O.name,"onUpdate:modelValue":B=>_(O.modelId,{name:B})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-uq-${O.modelId}`,class:"em-check",label:"UQ","model-value":O.unique,"onUpdate:modelValue":B=>_(O.modelId,{unique:B})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:B=>t.unref(a).removeIndex(r.value.modelId,O.modelId)},null,8,["onClick"])]),t.createVNode(Vo,{controller:t.unref(a),"ref-id":O.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.columns,(B,z)=>(t.openBlock(),t.createElementBlock("div",{key:z,class:"em-attr__row"},[t.createVNode(t.unref(te.BSSelect),{class:"grow","model-value":B.columnRef,items:m(O,z),"value-provider":T=>T.value,"label-provider":T=>T.label,"onUpdate:modelValue":T=>T&&k(O,z,T)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-${O.modelId}-desc-${z}`,class:"em-check",label:"DESC","model-value":B.descending,"onUpdate:modelValue":T=>E(O,z,T)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:"−",onClick:T=>b(O,z)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(O).length,onClick:B=>g(O)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",HL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:O.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:B=>v(O,B.target.value)},null,40,jL)])]))),128)):t.createCommentVNode("",!0)],8,zL)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-ee0032b1"]]),GL=["disabled"],YL={class:"em-panel__sub-label"},qL={class:"em-attr__row"},WL={class:"em-attr__row"},JL={class:"em-multilang"},XL={class:"em-attr__pii"},ZL={class:"em-swatch__row em-attr__swatch"},QL=["title","onClick"],eB=["title","onClick"],tB=Qe(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=te.useModal(),l=t.computed(()=>a.state.logical.entities.find(b=>b.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(b=>b.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(b){return b==="none"?a.t("em.common.noneParen"):b}const m=b=>b;function p(b,v){l.value&&a.updateOperation(l.value.modelId,b.modelId,v)}function f(b,v){p(b,{description:Object.keys(v).length?v:void 0})}function h(b){return b.personalInfoAttributeType??"none"}function _(b,v){p(b,{personalInfoAttributeType:v==="none"?void 0:v})}function g(b){var v,y;return Vt((y=(v=s.value)==null?void 0:v.operationStyles)==null?void 0:y[b.modelId])}function k(b,v){l.value&&a.setOperationSwatch(l.value.modelId,b.modelId,v)}function E(b){r.openModal({component:Jp,bind:{operationName:b.name,sourceCode:b.sourceCode??"",locale:a.uiLocale.value,onSave:v=>p(b,{sourceCode:v})}})}return(b,v)=>{var y;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:v[1]||(v[1]=S=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",YL,[e.collapsible?(t.openBlock(),t.createBlock(xe,{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:((y=l.value.operations)==null?void 0:y.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:v[0]||(v[0]=t.withModifiers(S=>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??[],S=>(t.openBlock(),t.createElementBlock("div",{key:S.modelId,class:"em-attr"},[t.createElementVNode("div",qL,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":S.name,"onUpdate:modelValue":$=>p(S,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":$=>$&&p(S,{visibility:$})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>t.unref(a).removeOperation(l.value.modelId,S.modelId)},null,8,["onClick"])]),t.createElementVNode("div",WL,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t(S.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:$=>E(S)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",JL,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Jt,{multiline:"",name:`op-desc-${S.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":$=>f(S,$)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",XL,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":h(S),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":$=>$&&_(S,$)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",ZL,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(S)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:$=>k(S,null)},"∅",10,QL),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":g(S)===$}]),style:t.normalizeStyle({background:t.unref(ci)($)}),title:t.unref(a).t(t.unref(Mo)($)),onClick:O=>k(S,$)},null,14,eB))),128))])]))),128)):t.createCommentVNode("",!0)],8,GL)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),nB=["title"],oB={class:"em-panel__head"},iB={class:"em-panel__head-row"},aB=["title"],rB={class:"em-panel__context"},lB={key:0,class:"em-panel__lock"},sB=["disabled"],cB={key:0,class:"em-attr__navhint"},dB={key:0,class:"em-panel__note"},uB={key:1,class:"em-panel__note"},mB={key:2,class:"em-jpa"},fB={class:"em-field"},pB={class:"em-field"},hB={class:"em-field"},yB={key:0,class:"em-field"},gB={class:"em-panel__note"},bB={class:"em-panel__sub"},_B={class:"em-field"},kB={class:"em-field"},EB={class:"em-jpa"},NB={key:0,class:"em-panel__note"},wB={key:1,class:"em-panel__note"},IB={class:"em-jpa"},vB={class:"em-field"},CB={key:0,class:"em-panel__note"},SB={class:"em-field"},xB={class:"em-multilang"},RB={class:"em-field"},AB=["value"],$B={class:"em-field"},TB={class:"em-swatch"},MB={class:"em-swatch__row"},VB=["title"],LB=["title","onClick"],BB={class:"em-panel__note"},DB={class:"em-field"},OB=["value"],PB={class:"em-swatch"},zB={class:"em-swatch__row"},FB=["title"],UB=["title","onClick"],Ly=Qe(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var W;return(W=r.value)==null?void 0:W.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const W=c.value;return W?l.state.logical.entities.find(J=>J.modelId===W)??null:null}),u=t.computed(()=>{const W=s.value;if((W==null?void 0:W.kind)==="association")return l.isAssociationLocked(W.id);const J=c.value;return!!J&&l.isEntityLocked(J)}),m=t.computed(()=>{var W;return((W=l.selectedAttr.value)==null?void 0:W.attrId)??null}),p=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),h=t.ref({});t.watch(f,()=>{h.value={}});function _(W){return h.value[W]??f.value}function g(W){h.value={...h.value,[W]:!_(W)}}const k=t.computed(()=>{var X;const W=d.value;if(!W)return l.t("em.entity.fallback");const J=(X=W.table)==null?void 0:X.physicalName;return J?`${W.name} (${J})`:W.name}),E=t.computed(()=>{const W=s.value;return(W==null?void 0:W.kind)==="association"?l.state.logical.associations.find(J=>J.modelId===W.id)??null:null}),b=t.computed(()=>{const W=s.value;return(W==null?void 0:W.kind)==="group"?l.state.logical.groups.find(J=>J.modelId===W.id)??null:null}),v=t.computed(()=>{const W=s.value;return(W==null?void 0:W.kind)==="note"?l.state.layout.notes.find(J=>J.modelId===W.id)??null:null}),y=t.computed(()=>{var J,X;const W=(J=b.value)==null?void 0:J.name;return Mt(W,l.userLanguage.value)||((X=b.value)==null?void 0:X.packageName)||l.t("em.group.fallback")}),S=t.computed(()=>{if(d.value){const W=p.value.size;if(W>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:W});if(m.value){const J=d.value.attributes.find(X=>X.modelId===m.value);return(J==null?void 0:J.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(J==null?void 0:J.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(E.value){const W=J=>{var X;return((X=l.state.logical.entities.find(he=>he.modelId===J))==null?void 0:X.name)??J};return l.t("em.inspector.ctxAssoc",{a:W(E.value.end1.entityRef),b:W(E.value.end2.entityRef)})}return b.value?l.t("em.inspector.ctxGroup",{name:y.value}):v.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),$=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],O=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],B={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},z=W=>{const J=B[W];return J?l.t(J):W},T=W=>{var J;return((J=l.state.logical.entities.find(X=>X.modelId===W))==null?void 0:J.name)??W},x=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],R=["LIST","SET"],N=["inherit","LAZY","EAGER"],I=W=>W;function C(W){return W==="inherit"?l.t("em.common.inherit"):W}const U=t.computed(()=>!!E.value&&E.value.end1.entityRef===E.value.end2.entityRef);function A(W,J){E.value&&l.updateAssociationEnd(E.value.modelId,W,J)}function P(W){return de.value?W:W==="end1"?"end2":"end1"}function F(W){var Te;const J=(Te=E.value)==null?void 0:Te[W];if(!(J!=null&&J.attributeRef))return;const X=l.state.logical.entities.find(De=>De.modelId===J.entityRef),he=X==null?void 0:X.attributes.find(De=>De.modelId===J.attributeRef);return he&&(he.attrType==="RELATION_OWN"||he.attrType==="RELATION_REF")?he.name:void 0}function H(W,J){var he;const X=(he=E.value)==null?void 0:he[W];X!=null&&X.attributeRef&&l.updateAttribute(X.entityRef,X.attributeRef,{name:J})}function G(W){var De;const J=F(W);if(J!==void 0)return J;const X=(De=E.value)==null?void 0:De[W];if(X!=null&&X.navFieldNameHint)return X.navFieldNameHint;const he=W==="end1"?"end2":"end1",Te=l.state.logical.entities.find(Oe=>{var ie;return Oe.modelId===((ie=E.value)==null?void 0:ie[he].entityRef)});return Te?Na(Te.name,ka(E.value[he].multiplicity)):""}function le(W){return!!de.value||F(W)!==void 0}function se(W){E.value&&!U.value&&l.setAssociationIdentifying(E.value.modelId,W)}function ue(W){var J,X,he;return!!((he=(X=(J=E.value)==null?void 0:J[W].jpa)==null?void 0:X.cascadeTypes)!=null&&he.includes("ALL"))}function ye(W,J,X){var De,Oe;const he=(De=E.value)==null?void 0:De[W];if(J==="ALL"&&X){A(W,{jpa:{...he==null?void 0:he.jpa,cascadeTypes:["ALL"]}});return}const Te=new Set(((Oe=he==null?void 0:he.jpa)==null?void 0:Oe.cascadeTypes)??[]);X?Te.add(J):Te.delete(J),A(W,{jpa:{...he==null?void 0:he.jpa,cascadeTypes:[...Te]}})}function ae(W,J){var he;const X=(he=E.value)==null?void 0:he[W];A(W,{jpa:{...X==null?void 0:X.jpa,...J}})}function Ie(W){var J,X;return((X=(J=E.value)==null?void 0:J[W].jpa)==null?void 0:X.fetchType)??"inherit"}function Pe(W,J){ae(W,{fetchType:J==="inherit"?void 0:J})}function Ae(W){var X;const J=(X=E.value)==null?void 0:X[W==="end1"?"end2":"end1"];return(J==null?void 0:J.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(J==null?void 0:J.multiplicity)==="ONE_OR_MORE_INSTANCES"}const de=t.computed(()=>{const W=E.value;if(!W)return null;for(const J of l.state.logical.entities){const X=J.attributes.find(Oe=>{var ie;return((ie=Oe.embedded)==null?void 0:ie.associationRef)===W.modelId&&Oe.attrType==="EMBED_OWN"});if(!X)continue;const he=W.end2.entityRef===X.embedded.embeddableRef?"end2":"end1",Te=W[he].multiplicity,De=W[he].jpa;return{which:he,cardinality:Te,isCollection:Te==="ZERO_OR_MORE_INSTANCES"||Te==="ONE_OR_MORE_INSTANCES",collectionType:(De==null?void 0:De.collectionType)??"LIST",collectionTable:(De==null?void 0:De.collectionTable)??"",orderColumn:(De==null?void 0:De.orderColumn)??""}}return null});function ge(W){E.value&&l.setEmbedCardinality(E.value.modelId,W)}function _e(W){const J=de.value;J&&ae(J.which,W==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function V(W){const J=de.value;J&&ae(J.which,{collectionTable:W.trim()||void 0})}function L(W){const J=de.value;J&&ae(J.which,{orderColumn:W.trim()||void 0})}function j(W){b.value&&l.updateGroup(b.value.modelId,W)}function ee(W,J){var X;j({name:{...(X=b.value)==null?void 0:X.name,[W]:J}})}const Z=t.computed(()=>{var W;return b.value?Vt((W=l.state.layout.groupLayouts.find(J=>J.groupRef===b.value.modelId))==null?void 0:W.style):null});function pe(W){b.value&&l.setGroupSwatch(b.value.modelId,W)}function me(W){v.value&&l.setNoteMemo(v.value.modelId,W)}const ve=t.computed(()=>{var W;return Vt((W=v.value)==null?void 0:W.style)});function Ee(W){v.value&&l.setNoteSwatch(v.value.modelId,W)}return(W,J)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:J[0]||(J[0]=(...X)=>e.startResize&&e.startResize(...X))},null,42,nB),t.createElementVNode("header",oB,[t.createElementVNode("div",iB,[J[14]||(J[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:J[1]||(J[1]=X=>a("collapse"))},[t.createVNode(xe,{name:"panel-right-close",size:16})],8,aB)]),t.createElementVNode("p",rB,t.toDisplayString(S.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",lB,[t.createVNode(xe,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:J[2]||(J[2]=X=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(Pp,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("basics"),title:k.value,onToggle:J[3]||(J[3]=X=>g("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(PL,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.unref(cn)(d.value.stereotype)?(t.openBlock(),t.createElementBlock("p",cB,t.toDisplayString(t.unref(l).t("em.entity.noIndexNote")),1)):(t.openBlock(),t.createBlock(KL,{key:1,controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("index"),onToggle:J[4]||(J[4]=X=>g("index"))},null,8,["controller","entity-id","collapsed"])),t.createVNode(tB,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("ops"),onToggle:J[5]||(J[5]=X=>g("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!E.value.identifying,disabled:U.value||!!de.value,"onUpdate:modelValue":se},null,8,["label","model-value","disabled"]),U.value?(t.openBlock(),t.createElementBlock("p",dB,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):de.value?(t.openBlock(),t.createElementBlock("p",uB,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),de.value?(t.openBlock(),t.createElementBlock("fieldset",mB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",fB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":de.value.cardinality,items:O,"value-provider":I,"label-provider":z,"onUpdate:modelValue":J[6]||(J[6]=X=>X&&ge(X))},null,8,["model-value"])]),de.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",pB,[J[15]||(J[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(te.BSSelect),{"model-value":de.value.collectionType,items:R,"value-provider":I,"label-provider":I,"onUpdate:modelValue":J[7]||(J[7]=X=>X&&_e(X))},null,8,["model-value"])]),t.createElementVNode("label",hB,[J[16]||(J[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(te.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":de.value.collectionTable,"onUpdate:modelValue":V},null,8,["placeholder","model-value"])]),de.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",yB,[J[17]||(J[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(te.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":de.value.orderColumn,"onUpdate:modelValue":L},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",gB,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],X=>{var he,Te,De;return t.withDirectives(t.createElementVNode("div",{key:X,class:"em-end"},[t.createElementVNode("h4",bB,t.toDisplayString(X)+" → "+t.toDisplayString(T(E.value[X].entityRef)),1),de.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",_B,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":E.value[X].multiplicity,items:$,"value-provider":I,"label-provider":t.unref(Ea),"onUpdate:modelValue":Oe=>A(X,{multiplicity:Oe})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${P(X)}-navigable`,class:"em-check",label:"navigable",title:P(X)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:P(X)==="end2","model-value":P(X)==="end2"?!0:E.value[P(X)].navigable,"onUpdate:modelValue":Oe=>A(P(X),{navigable:Oe})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",kB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(te.BSTextInput),{name:`${P(X)}-navname`,width:"100%",disabled:!le(P(X)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":G(P(X)),"onUpdate:modelValue":Oe=>H(P(X),Oe)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${P(X)}-composition`,class:"em-check",label:"composition","model-value":E.value[P(X)].composition,"onUpdate:modelValue":Oe=>A(P(X),{composition:Oe})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",EB,[J[18]||(J[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(x,Oe=>{var ie,Ne;return t.createVNode(t.unref(te.BSCheckbox),{key:Oe,name:`${P(X)}-cascade-${Oe}`,class:"em-check",label:Oe,"model-value":!!((Ne=(ie=E.value[P(X)].jpa)==null?void 0:ie.cascadeTypes)!=null&&Ne.includes(Oe)),disabled:!le(P(X))||Oe!=="ALL"&&ue(P(X)),"onUpdate:modelValue":Ye=>ye(P(X),Oe,Ye)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),le(P(X))?ue(P(X))?(t.openBlock(),t.createElementBlock("p",wB,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",NB,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",IB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",vB,[J[19]||(J[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(te.BSSelect),{disabled:!le(P(X)),"model-value":Ie(P(X)),items:N,"value-provider":I,"label-provider":C,"onUpdate:modelValue":Oe=>Oe&&Pe(P(X),Oe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${P(X)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((he=E.value[P(X)].jpa)!=null&&he.orphanRemoval),disabled:!le(P(X))||Ae(X),"onUpdate:modelValue":Oe=>ae(P(X),{orphanRemoval:Oe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),Ae(X)&&((Te=E.value[P(X)].jpa)!=null&&Te.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",CB,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",SB,[J[20]||(J[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(te.BSTextInput),{name:`${P(X)}-orderby`,width:"100%",disabled:!le(P(X)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((De=E.value[P(X)].jpa)==null?void 0:De.orderBy)??"","onUpdate:modelValue":Oe=>ae(P(X),{orderBy:Oe.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!de.value||X===de.value.which]])}),64))],64)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",xB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,X=>{var he;return t.openBlock(),t.createElementBlock("label",{key:X,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(X),1),t.createVNode(t.unref(te.BSTextInput),{name:`grp-name-${X}`,width:"100%","model-value":((he=b.value.name)==null?void 0:he[X])??"","onUpdate:modelValue":Te=>ee(X,Te)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",RB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:b.value.description??"",rows:"3",onChange:J[8]||(J[8]=X=>j({description:X.target.value}))},null,40,AB)]),t.createElementVNode("label",$B,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"grp-package",width:"100%","model-value":b.value.packageName??"","onUpdate:modelValue":J[9]||(J[9]=X=>j({packageName:X}))},null,8,["model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":b.value.excludeDDLGeneration,"onUpdate:modelValue":J[10]||(J[10]=X=>j({excludeDDLGeneration:X}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",TB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",MB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Z.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:J[11]||(J[11]=X=>pe(null))},"∅",10,VB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),X=>(t.openBlock(),t.createElementBlock("button",{key:X,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Z.value===X}]),style:t.normalizeStyle({background:t.unref(ci)(X)}),title:t.unref(l).t(t.unref(Mo)(X)),onClick:he=>pe(X)},null,14,LB))),128))])]),t.createElementVNode("p",BB,t.toDisplayString(t.unref(l).t("em.group.members",{n:b.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",DB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:v.value.memo,rows:"6",onChange:J[12]||(J[12]=X=>me(X.target.value))},null,40,OB)]),t.createElementVNode("fieldset",PB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",zB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ve.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:J[13]||(J[13]=X=>Ee(null))},"∅",10,FB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(To),X=>(t.openBlock(),t.createElementBlock("button",{key:X,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ve.value===X}]),style:t.normalizeStyle({background:t.unref(ci)(X)}),title:t.unref(l).t(t.unref(Mo)(X)),onClick:he=>Ee(X)},null,14,UB))),128))])])],64)):t.createCommentVNode("",!0)],8,sB)],4))}}),[["__scopeId","data-v-923cccbb"]]),HB=["title"],jB={class:"em-validation__title"},KB=["title","onClick"],GB={key:0,class:"em-validation__body"},YB={class:"em-validation__opt"},qB={key:0,class:"em-validation__empty"},WB={key:1,class:"em-validation__empty"},JB={key:2,class:"em-validation__list"},XB=["onClick"],ZB={class:"em-validation__item-msg"},QB={key:0,class:"em-validation__item-entity"},eD=["title","onClick"],tD=["title"],nD=Qe(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const _=new Map;for(const g of o.state.logical.entities)_.set(g.modelId,g.name);return _});function r(_){const g=sv(_);if(!g)return null;const k=a.value.get(g);return k===void 0?null:k.trim()===""?o.t("em.validation.nameless"):k}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const _={error:0,warning:0,info:0};for(const g of i.value)_[g.severity]++;return _}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(_=>c.value[_.severity]).slice().sort((_,g)=>l[_.severity].order-l[g.severity].order)),u=t.computed(()=>d.value.map(_=>({issue:_,entityName:r(_),message:Op(o.t,_),category:rv(o.t,_.ruleId)}))),m=t.ref(!1);function p(_){c.value[_]=!c.value[_]}function f(_){if(!m.value){m.value=!0;return}p(_)}function h(_){_.targetRef&&o.requestFocus(_.targetRef)}return(_,g)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:g[1]||(g[1]=k=>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(xe,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",jB,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,HB),t.createElementVNode("div",{class:"em-validation__counts",onClick:g[0]||(g[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],k=>t.createElementVNode("button",{key:k,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${k}`,{"is-off":!c.value[k]}]]),title:m.value?t.unref(o).t(c.value[k]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[k].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:E=>f(k)},[t.createVNode(xe,{name:l[k].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[k]),1)],10,KB)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",GB,[t.createElementVNode("label",YB,[t.createVNode(t.unref(te.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":g[2]||(g[2]=k=>t.unref(o).flagEntitiesWithoutRelations.value=k)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",qB,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",WB,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",JB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:k,entityName:E,message:b,category:v},y)=>(t.openBlock(),t.createElementBlock("li",{key:`${k.ruleId}:${k.targetRef??"model"}:${y}`,class:t.normalizeClass(["em-validation__item",[`is-${k.severity}`,{"is-clickable":!!k.targetRef}]]),onClick:S=>h(k)},[t.createVNode(xe,{name:l[k.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",ZB,[E?(t.openBlock(),t.createElementBlock("span",QB,t.toDisplayString(E),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(b),1)]),t.unref(o).hasQuickFix(k)?(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(S=>t.unref(o).applyQuickFix(k),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,eD)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:k.ruleId},t.toDisplayString(v),9,tD)],10,XB))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),oD={class:"em-history"},iD={class:"em-history__head"},aD={class:"em-history__title"},rD={class:"em-history__head-actions"},lD=["title","disabled"],sD=["title"],cD={class:"em-history__filters"},dD={class:"em-history__filter"},uD={class:"em-history__filters em-history__filters--period"},mD={class:"em-history__filter-label"},fD=["title","aria-label","max"],pD=["title","aria-label","min"],hD=["title"],yD={key:0,class:"em-history__diffbar"},gD={class:"em-history__diffbar-range"},bD={class:"em-history__diffbar-count"},_D={class:"em-history__body"},kD={key:0,class:"em-history__empty"},ED={key:1,class:"em-history__diff-list"},ND=["onClick"],wD={class:"em-history__action-head"},ID={class:"em-history__action-name"},vD={key:0,class:"em-history__fields"},CD={class:"em-history__fname"},SD={key:0,class:"em-history__old"},xD={class:"em-history__val"},RD={key:1,class:"em-history__empty"},AD={key:2,class:"em-history__empty is-error"},$D={key:3,class:"em-history__empty"},TD={key:4,class:"em-history__list"},MD=["onClick"],VD={class:"em-history__summary"},LD={class:"em-history__seq"},BD={class:"em-history__gmeta"},DD={class:"em-history__who"},OD={key:0,class:"em-history__time"},PD={key:1,class:"em-history__restored-from"},zD=["onClick"],FD={key:0,class:"em-history__detail"},UD={class:"em-history__action-head"},HD={class:"em-history__action-name"},jD={key:0,class:"em-history__fields"},KD={class:"em-history__fname"},GD={key:0,class:"em-history__old"},YD={class:"em-history__val"},qD={class:"em-history__preview"},WD=["disabled"],JD={key:0,class:"em-history__diff-list is-preview"},XD={class:"em-history__action-head"},ZD={class:"em-history__action-name"},QD={key:0,class:"em-history__fields"},eO={class:"em-history__fname"},tO={key:0,class:"em-history__old"},nO={class:"em-history__val"},oO={class:"em-history__confirm-row"},iO={class:"em-history__confirm-msg"},aO=["disabled","onClick"],rO=["disabled"],lO=["onClick"],Qr=50,sO=Qe(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((ie,Ne)=>Ne.seq>ie?Ne.seq:ie,-1/0));async function u(ie){if(a.historyTransport){l.value=!0,s.value=null;try{const Ne=!(ie!=null&&ie.full)&&r.value.length>0&&Number.isFinite(d.value),Ye=await a.historyTransport(Ne?d.value:void 0);if(!Ne)r.value=Ye;else if(Ye.length){const it=new Set(r.value.map(ce=>ce.seq)),Q=Ye.filter(ce=>!it.has(ce.seq));Q.length&&(r.value=[...r.value,...Q])}c.value=!0}catch(Ne){s.value=Ne instanceof Error?Ne.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const p=t.ref(null),f=t.ref(null);t.watch(()=>o.open,ie=>{ie?m():(p.value=null,f.value=null)},{immediate:!0});let h=null;t.watch(()=>a.revision.value,()=>{o.open&&(h&&clearTimeout(h),h=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const _=t.computed(()=>new Map(a.state.logical.entities.map(ie=>[ie.modelId,ie]))),g=t.computed(()=>new Map(a.state.logical.associations.map(ie=>[ie.modelId,ie]))),k=t.computed(()=>{const ie=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(Ne=>[Ne.modelId,Ne.packageName||Mt(Ne.name,ie)||Ne.modelId]))});function E(ie){var Q,ce,je,lt,Xe,_t,st;const Ne=g.value.get(ie);if(!Ne)return a.t("em.history.assocFallback");if((Q=Ne.description)!=null&&Q.trim())return Ne.description.trim();const Ye=(lt=(je=_.value.get((ce=Ne.end1)==null?void 0:ce.entityRef))==null?void 0:je.name)==null?void 0:lt.trim(),it=(st=(_t=_.value.get((Xe=Ne.end2)==null?void 0:Xe.entityRef))==null?void 0:_t.name)==null?void 0:st.trim();return Ye&&it?`${Ye}→${it}`:a.t("em.history.assocFallback")}function b(ie){var Ne,Ye,it,Q;if(ie.kind==="entity")return((Ye=(Ne=_.value.get(ie.ref))==null?void 0:Ne.name)==null?void 0:Ye.trim())||a.t("em.attr.nameless");if(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index"){const ce=ie.entityRef?_.value.get(ie.entityRef):void 0,lt=((ie.kind==="attribute"?ce==null?void 0:ce.attributes:ie.kind==="operation"?ce==null?void 0:ce.operations:ce==null?void 0:ce.indexes)??[]).find(_t=>_t.modelId===ie.ref),Xe=(it=ce==null?void 0:ce.name)==null?void 0:it.trim();return`${Xe?Xe+".":""}${((Q=lt==null?void 0:lt.name)==null?void 0:Q.trim())||ie.ref}`}return ie.kind==="association"?E(ie.ref):ie.kind==="associationEnd"?`${E(ie.ref)}(${ie.end})`:ie.kind==="group"?a.t("em.history.groupSubject",{name:k.value.get(ie.ref)??ie.ref}):ie.ref}const v={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},y={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},S=t.ref("all"),$=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],O=t.computed({get:()=>S.value,set:ie=>{ie&&(S.value=ie)}}),B=t.computed(()=>Gl(r.value)),z=t.computed(()=>B.value.length?B.value[0].seq:null),T=t.computed(()=>S.value==="all"?B.value:B.value.filter(ie=>(ie.kind??"edit")===S.value)),x=t.ref(Qr),R=t.ref(""),N=t.ref(""),I=t.computed(()=>!!R.value||!!N.value);function C(){R.value="",N.value=""}const U=t.computed(()=>{const ie=R.value?new Date(`${R.value}T00:00:00`).getTime():null,Ne=N.value?new Date(`${N.value}T23:59:59.999`).getTime():null;return ie==null&&Ne==null?T.value:T.value.filter(Ye=>{if(Ye.ts==null)return!1;const it=new Date(Ye.ts).getTime();return!(isNaN(it)||ie!=null&&it<ie||Ne!=null&&it>Ne)})}),A=t.computed(()=>U.value.slice(0,x.value)),P=t.computed(()=>Math.max(0,U.value.length-x.value));function F(){x.value+=Qr}t.watch([S,R,N],()=>{x.value=Qr}),t.watch(()=>o.open,ie=>{ie&&(x.value=Qr,C())});function H(ie){return ie===void 0?"—":ie===null?a.t("em.history.emptyValue"):typeof ie=="object"?JSON.stringify(ie):String(ie)}function G(ie){const Ne=b(ie.subject);if(ie.verb==="add")return a.t("em.history.summaryAdd",{name:Ne});if(ie.verb==="remove")return a.t("em.history.summaryRemove",{name:Ne});if(ie.fields.length===1){const Ye=ie.fields[0];return`${Ne}.${Ye.field} ${Ye.oldValue!==void 0?H(Ye.oldValue)+"→":""}${H(Ye.value)}`}return a.t("em.history.summaryFields",{name:Ne,n:ie.fields.length})}function le(ie){return ie.actions.length===0?a.t("em.history.noChange"):ie.actions.length===1?G(ie.actions[0]):a.t("em.history.summaryMore",{summary:G(ie.actions[0]),n:ie.actions.length-1})}const se=t.ref(new Set);function ue(ie){const Ne=new Set(se.value);Ne.has(ie)?Ne.delete(ie):Ne.add(ie),se.value=Ne}function ye(ie){if(ie==null)return"";const Ne=new Date(ie);return isNaN(Ne.getTime())?String(ie):Ne.toLocaleString()}function ae(ie){const Ne=ie.author,Ye=ie.origin;return Ne&&Ye?`${Ne}(${Ye})`:Ne||(Ye?`(${Ye})`:"—")}const Ie=t.computed(()=>p.value==null?null:Yl(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Ie.value?nu(Ie.value):null,ie=>i("diffChange",ie));function Pe(ie){p.value=ie,f.value=null,J.value=null}function Ae(){p.value=null,f.value=null}const de=t.computed(()=>B.value.map(ie=>ie.seq)),ge=t.computed(()=>z.value??1/0),_e=t.computed(()=>f.value??ge.value),V=t.computed(()=>f.value??ge.value),L=t.computed(()=>de.value.filter(ie=>ie<_e.value).map(ie=>({v:ie}))),j=t.computed(()=>de.value.filter(ie=>p.value!=null&&ie>p.value).map(ie=>({v:ie})));function ee(ie){ie!=null&&(p.value=ie,f.value!=null&&f.value<=ie&&(f.value=null))}function Z(ie){ie!=null&&(f.value=ie>=ge.value?null:ie)}function pe(ie){return ie>=ge.value?a.t("em.history.diff.current"):`#${ie}`}function me(ie){return ie.kind==="entity"?_.value.has(ie.ref)?ie.ref:null:(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index")&&ie.entityRef?_.value.has(ie.entityRef)?ie.entityRef:null:ie.kind==="group"&&k.value.has(ie.ref)?ie.ref:null}function ve(ie){const Ne=me(ie);Ne&&a.requestFocus(Ne)}const Ee={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},W={added:"add",modified:"update",removed:"remove"},J=t.ref(null),X=t.ref(!1),he=t.computed(()=>J.value==null?null:Yl(r.value,{fromSeq:J.value})),Te=t.ref(!1);function De(ie){J.value=ie,Te.value=!1}async function Oe(ie){X.value=!0;try{const Ne=await a.restoreToSeq(ie);Ne.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:Ne.reason??a.t("em.history.unknown")})}finally{X.value=!1,J.value=null}}return(ie,Ne)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Ye,it;return[t.withDirectives(t.createElementVNode("section",oD,[t.createElementVNode("header",iD,[t.createElementVNode("div",aD,[t.createVNode(xe,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",rD,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:Ne[0]||(Ne[0]=Q=>u({full:!0}))},[t.createVNode(xe,{name:"redo",size:15})],8,lD),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:Ne[1]||(Ne[1]=Q=>i("close"))},[t.createVNode(xe,{name:"panel-close",size:15})],8,sD)])]),t.createElementVNode("div",cD,[t.createElementVNode("label",dD,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(te.BSSelect),{modelValue:O.value,"onUpdate:modelValue":Ne[2]||(Ne[2]=Q=>O.value=Q),items:$,"value-provider":Q=>Q.v,"label-provider":Q=>t.unref(a).t(Q.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",uD,[t.createElementVNode("span",mD,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:N.value||void 0,"onUpdate:modelValue":Ne[3]||(Ne[3]=Q=>R.value=Q)},null,8,fD),[[t.vModelText,R.value]]),Ne[9]||(Ne[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:R.value||void 0,"onUpdate:modelValue":Ne[4]||(Ne[4]=Q=>N.value=Q)},null,8,pD),[[t.vModelText,N.value]]),I.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:C},[t.createVNode(xe,{name:"x",size:12})],8,hD)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",yD,[t.createElementVNode("div",gD,[t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:L.value,"value-provider":Q=>Q.v,"label-provider":Q=>`#${Q.v}`,"onUpdate:modelValue":Ne[5]||(Ne[5]=Q=>ee(Q??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(xe,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":V.value,items:j.value,"value-provider":Q=>Q.v,"label-provider":Q=>pe(Q.v),"onUpdate:modelValue":Ne[6]||(Ne[6]=Q=>Z(Q??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",bD,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Ye=Ie.value)==null?void 0:Ye.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:Ae},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",_D,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(it=Ie.value)!=null&&it.entries.length?(t.openBlock(),t.createElementBlock("ul",ED,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.value.entries,(Q,ce)=>(t.openBlock(),t.createElementBlock("li",{key:ce,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!me(Q.subject)}]),onClick:je=>ve(Q.subject)},[t.createElementVNode("div",wD,[t.createVNode(xe,{name:v[Q.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",ID,t.toDisplayString(b(Q.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${W[Q.verb]}`])},t.toDisplayString(t.unref(a).t(Ee[Q.verb])),3)]),Q.fields.length?(t.openBlock(),t.createElementBlock("ul",vD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.fields,(je,lt)=>(t.openBlock(),t.createElementBlock("li",{key:lt,class:"em-history__field"},[t.createElementVNode("span",CD,t.toDisplayString(je.field),1),je.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",SD,t.toDisplayString(H(je.oldValue)),1)):t.createCommentVNode("",!0),je.oldValue!==void 0?(t.openBlock(),t.createBlock(xe,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",xD,t.toDisplayString(H(je.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,ND))),128))])):(t.openBlock(),t.createElementBlock("p",kD,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",RD,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",AD,t.toDisplayString(s.value),1)):U.value.length===0?(t.openBlock(),t.createElementBlock("p",$D,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",TD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(A.value,Q=>{var ce,je,lt;return t.openBlock(),t.createElementBlock("li",{key:Q.seq,class:t.normalizeClass(["em-history__group",[`is-${Q.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Xe=>ue(Q.seq)},[t.createVNode(xe,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":se.value.has(Q.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${Q.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(Q.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",VD,t.toDisplayString(le(Q)),1),t.createElementVNode("span",LD,"#"+t.toDisplayString(Q.seq),1)],8,MD),t.createElementVNode("div",BD,[t.createElementVNode("span",DD,t.toDisplayString(ae(Q)),1),Q.ts?(t.openBlock(),t.createElementBlock("span",OD,t.toDisplayString(ye(Q.ts)),1)):t.createCommentVNode("",!0),Q.kind==="restore"&&Q.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",PD,"← #"+t.toDisplayString(Q.restoredFromSeq),1)):t.createCommentVNode("",!0),Q.seq!==z.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Xe=>Pe(Q.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,zD)):t.createCommentVNode("",!0)]),se.value.has(Q.seq)?(t.openBlock(),t.createElementBlock("div",FD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.actions,(Xe,_t)=>(t.openBlock(),t.createElementBlock("div",{key:_t,class:"em-history__action"},[t.createElementVNode("div",UD,[t.createVNode(xe,{name:v[Xe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",HD,t.toDisplayString(b(Xe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Xe.verb}`])},t.toDisplayString(t.unref(a).t(y[Xe.verb])),3)]),Xe.fields.length?(t.openBlock(),t.createElementBlock("ul",jD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.fields,(st,kt)=>(t.openBlock(),t.createElementBlock("li",{key:kt,class:"em-history__field"},[t.createElementVNode("span",KD,t.toDisplayString(st.field),1),st.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",GD,t.toDisplayString(H(st.oldValue)),1)):t.createCommentVNode("",!0),st.oldValue!==void 0?(t.openBlock(),t.createBlock(xe,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",YD,t.toDisplayString(H(st.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&Q.seq!==z.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":J.value===Q.seq}])},[J.value===Q.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",qD,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((ce=he.value)!=null&&ce.entries.length),onClick:Ne[7]||(Ne[7]=Xe=>Te.value=!Te.value)},[t.createVNode(xe,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Te.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((je=he.value)!=null&&je.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:he.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,WD),Te.value&&((lt=he.value)!=null&&lt.entries.length)?(t.openBlock(),t.createElementBlock("ul",JD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he.value.entries,(Xe,_t)=>(t.openBlock(),t.createElementBlock("li",{key:_t,class:"em-history__diff-entry"},[t.createElementVNode("div",XD,[t.createVNode(xe,{name:v[Xe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",ZD,t.toDisplayString(b(Xe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${W[Xe.verb]}`])},t.toDisplayString(t.unref(a).t(Ee[Xe.verb])),3)]),Xe.fields.length?(t.openBlock(),t.createElementBlock("ul",QD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.fields,(st,kt)=>(t.openBlock(),t.createElementBlock("li",{key:kt,class:"em-history__field"},[t.createElementVNode("span",eO,t.toDisplayString(st.field),1),st.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",tO,t.toDisplayString(H(st.oldValue)),1)):t.createCommentVNode("",!0),st.oldValue!==void 0?(t.openBlock(),t.createBlock(xe,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",nO,t.toDisplayString(H(st.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",oO,[t.createElementVNode("span",iO,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:X.value,onClick:Xe=>Oe(Q.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,aO),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:X.value,onClick:Ne[8]||(Ne[8]=Xe=>J.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,rO)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Xe=>De(Q.seq)},[t.createVNode(xe,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,lO))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&P.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:F},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:P.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-c7fac08e"]]);function cO(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 By(e){const n=t.ref(cO(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 dO={class:"em-modeler"},uO={class:"em-modeler__body"},mO={class:"em-drawer__inner"},fO={class:"em-drawer__head"},pO={class:"em-drawer__actions"},hO=["title"],yO=["title"],gO=["title"],bO=["title"],_O=["title"],kO=Qe(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(v){t.nextTick(()=>{const y=v();y&&("focusCollapse"in y?y.focusCollapse():y.focus())})}function c(v){n.value=v,s(()=>v?i.value:a.value)}function d(v){o.value=v,s(()=>v?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:h}=By({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:_,dragging:g,startResize:k}=By({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),E=t.ref(null),b=t.ref(null);return(v,y)=>{var S,$,O;return t.openBlock(),t.createElementBlock("div",dO,[t.createVNode(Vy,{controller:e.controller,"history-open":u.value,onExportSvg:y[0]||(y[0]=B=>{var z;return(z=E.value)==null?void 0:z.exportSvg()}),onExportPng:y[1]||(y[1]=B=>{var z;return(z=E.value)==null?void 0:z.exportPng()}),onToggleHistory:y[2]||(y[2]=B=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",uO,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",mO,[t.createElementVNode("header",fO,[y[11]||(y[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",pO,[(S=b.value)!=null&&S.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t(($=b.value)!=null&&$.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:y[3]||(y[3]=B=>{var z;return(z=b.value)==null?void 0:z.toggleAll()})},[t.createVNode(xe,{name:(O=b.value)!=null&&O.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,hO)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:y[4]||(y[4]=B=>c(!1))},[t.createVNode(xe,{name:"panel-close",size:16})],8,yO)])]),t.createVNode(My,{ref_key:"explorer",ref:b,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:y[5]||(y[5]=(...B)=>t.unref(h)&&t.unref(h)(...B))},null,42,gO),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:y[6]||(y[6]=B=>c(!0))},[t.createVNode(xe,{name:"panel-open",size:18})],8,bO),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(p)-6+"px"})},[t.createVNode(Ty,{ref_key:"canvas",ref:E,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(Ly,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(_),resizing:t.unref(g),"start-resize":t.unref(k),onCollapse:y[7]||(y[7]=B=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:y[8]||(y[8]=B=>d(!0))},[t.createVNode(xe,{name:"panel-right-open",size:18})],8,_O),[[t.vShow,!o.value]])]),_:1}),t.createVNode(sO,{controller:e.controller,open:u.value,onClose:y[9]||(y[9]=B=>u.value=!1),onDiffChange:y[10]||(y[10]=B=>m.value=B)},null,8,["controller","open"])]),t.createVNode(nD,{controller:e.controller,"panel-width":t.unref(_),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=hk,be.AssociationEdge=Ah,be.CUSTOM_TYPE_VALUE=dn,be.CommandStack=ql,be.DEFAULT_JAVA_TYPE=dl,be.DIAGRAM_JSON_FORMAT=El,be.DIAGRAM_JSON_VERSION=Nl,be.DiagramCanvas=Ty,be.DiagramExplorer=My,be.EDITOR=eo,be.EditModeToggle=zV,be.EditorToolbar=Vy,be.EntityModeler=kO,be.EntityNode=dh,be.GROUP_CODE_ENUM_VALUE=jn,be.GroupNode=uh,be.INHERITED_REF_PREFIX=ma,be.InvalidDiagramJsonError=fo,be.JAVA_TYPES=ki,be.LIB_VERSION=Pb,be.NoteNode=mh,be.OpSyncAdapter=Yu,be.PHYSICAL_NAME_MAX_LENGTH=vi,be.PropertyPanel=Ly,be.RevCache=Gu,be.SELECTABLE_JAVA_TYPES=Yc,be.SYMBOLIC_OP_KINDS=qu,be.SYMBOLIC_OP_SCHEMA=vm,be.UI_LOCALES=Pv,be.applyDocumentReferenceOnly=hl,be.buildAgentBatch=yk,be.buildDiagramSvg=Sc,be.buildDiffMarks=nu,be.collectSharedColumns=vn,be.commands=d_,be.computeAutoLayout=$c,be.createEditorController=Ix,be.dedupeModelIds=Db,be.defaultMermaidDialect=sg,be.defaultSqlDialect=Rg,be.diagramToJson=_d,be.displayLabel=ya,be.emptyState=Xp,be.entityModelToDdl=yd,be.entityModelToMermaid=yl,be.entityModelToText=nd,be.exportDiagramPng=Ay,be.exportDiagramSvg=Ry,be.fromPersisted=Bm,be.isGeneratable=Ld,be.isInheritedColumnRef=ao,be.isValueTypeStereotype=at,be.javaTypeLabel=jo,be.makeInheritedColumnRef=Vc,be.mergeDiagram=Jd,be.mermaidErToImportSource=ud,be.migrateLegacyMoney=Bb,be.multiplicityLabel=Ea,be.newId=Le,be.packEntityBoxes=el,be.parseDiagramJson=kd,be.parseInheritedColumnRef=tl,be.parseMermaidEr=dd,be.parseSqlDdl=_l,be.planHealBackfillOps=Jk,be.projectActionLog=Gl,be.projectEntityAudit=eu,be.projectFieldAudit=Gn,be.projectInheritedColumns=gi,be.projectSeqDiff=Yl,be.renderDiagramSvg=Nd,be.resolveColumnPhysicalName=bi,be.resolveDiagram=Ac,be.resolveEffectiveColumn=Bt,be.resolveQuickFix=xl,be.resolveSharedColumn=so,be.resolveSymbolicOps=Y_,be.restoreDeepEqual=go,be.scaffoldEntityJava=sb,be.sharedColumnScopeEntities=rl,be.sqlDdlToImportSource=hd,be.stereotypeLabel=yi,be.synthesizeRestoreOps=Jb,be.toPersisted=Yk,be.toPersistedV2=qk,be.translate=rn,be.uiMessagesEn=Fp,be.uiMessagesJa=Up,be.uiMessagesKo=Hp,be.validateModel=xa,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));